function  [sys,x0,str,ts]=reactor_sfcn(t,x,u,flag,Cinit,Tinit,p2)
switch flag
    case 0  % initialize
        str=[]                     ;
        ts = [0 0]                 ;
        s = simsizes               ;
        s.NumContStates = 3    ;
        s.NumDiscStates = 0    ;
        s.NumOutputs = 3      ;
        s.NumInputs = 1        ;
        s.DirFeedthrough = 0   ;
        s.NumSampleTimes = 1   ;
        sys = simsizes(s)          ;
                
        x0 = [Cinit]    ;    
    case 1                         % derivatives
%         p2=parameters_real;
        sys = reactor(t,x,u,p2)      ;
    case 3  % output
        sys = x;
    case {2 4 9}                   % 2:discrete
        % 4:calcTimeHit
        % 9:termination
        sys =[];
    otherwise
        error(['unhandled flag =',num2str(flag)])   ;
end