function [sys,x0] = elheaters(t,x,u,flag)

global T0air T0HEX T0el T0incin

% Inputs:    t    - time in [s].
%            X    - State, which is the temperature in the elheater
%            U(1) - Inlet temperature [C]
%            U(2) - Effect to gas from elheater [W]
%            U(3) - Mass flow of process gas [kg/s]
%            U(4) - Mass flow of air [kg/s]

% Outputs:   sys and x0 as described in the SIMULINK manual.
%            when flag is 0 sys contains sizes and x0 contains 
%            initial condition. 
%            when flag is 1, sys contains the derivatives,
%            and when flag is 3 sys contains outputs; 
%            y    - x, output temp. from elheater [C]


if abs(flag) == 1
  % Return state derivatives.
  sys = elheater(t,x,u);
  
elseif abs(flag) == 3
  % Return system outputs.
  sys = x;
  
elseif flag == 0
  % Ininitalize the system
 % ssvaluesinit
  parameters
  %x0=[100 100 100]';
  x0 = T0el;
  sys = [1, 0, 1, 4, 0, 0];
  
else
  sys = [];
  
end
