function [sys,sys2,x0]=accum(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
holdup=x(nc);
if (flag==1)
   qin=u(1);
   xin=u(2:nc);
   qout=u(nc+1);
   mdot=qin-qout;
   xdot=qin*(xin-x(1:nc-1))/holdup;
   sys=xdot;
   sys2=mdot;
elseif (flag==3)
   sys=x;
end