function [sys,sys2,x0]=tank(T,x,u,flag,nc,M0,hydraulics,Tc)
%
% simple accumulator model with constant holdup
% state vector consists of composition vector
% input vector contains inflow + inflow composition vector
global coldata
holdup=x(nc);
if (flag==1)
   V=u(1);
   xin=u(2:nc);
   L=u(nc+1);
   D=u(nc+2);
   mdot=V-L-D;
   xdot=V*(xin-x(1:nc-1))/holdup;
   sys=xdot;
   sys2=mdot;
elseif (flag==3)
   sys=x;
end

   
   
