% s_co2ventil.m

function [sys,x0,str,ts] = s_co2ventil(t,x,u,flag)
% u = [p rho H]_tank, z, [p T]_1.kontrollvolumPC
global b
switch flag


  % INITALIZATION
  % -------------
  case 0,
    [sys,x0,str,ts]=Initialize;

  
  % OUTPUTS 
  % -------
  case 3,
    sys = co2ventil(u);

  case { 1, 2, 4, 9 }
    sys=[];

  % UNEXPECTED FLAGS
  % ----------------
  otherwise
    error(['Unhandled flag = ',num2str(flag)]);

end

% initialisering
function [sys,x0,str,ts]=Initialize
global b

sizes = simsizes;

sizes.NumContStates  = 0;
sizes.NumDiscStates  = 0;
sizes.NumOutputs     = 5; % wl wv Htot
sizes.NumInputs      = 6; % rho,H,pinn, z, p og T etter ventil
sizes.DirFeedthrough = 1; % 0 hvis utgang ikke direkte funksjon av inngang, ellers 1
sizes.NumSampleTimes = 1; % at least one sample time is needed

sys = simsizes(sizes);

% initialize the initial conditions
x0 = []; % temp
%
% str is always an empty matrix
str = [];

% initialize the array of sample times
ts  = [0 0];
%data=initialize;
% end mdlInitializeSizes

