%
% Example B.1: Carbon Removal Process
%
% Bob Newell, March 1996
%
%-----------------------------------------------------------
%
function y = Carbon_Removal_Outputs( t, x )
global p
%
% x = [ 1=V 2=Sn 3=So 4=Xb ];
% y = [ 1=v_in 2=Ss_in 3=So_in 4=Xh_in 
%       5=v_out 6=Ss_out 7=So_out 8=Xh_out
%       9=v_a 10=v_r 11=v_w ];
% p = [ 1=muhat 2=Ks 3=Koh 4=Yh 5=bh 6=fp
%       7=a 8=b 9=So_sat ];
%
%-----------------------------------------------------------
[ n, m ] = size( x );
if m == 1,
   x = x';
   n = 1;
end;
y = zeros( n, 2 );
%
for i = 1:n,
   % influent conditions
   y(i,1) = 50;
   y(i,3) = 1;
   y(i,4) = 5;
   if t(i) < 5/24,
      y(i,2) = 150;
      y(i,9) = 31.5;
   else,
      y(i,2) = 200;
      y(i,9) = 31.5;
   end; 
   % sludge flows
   y(i,10) = 50;
   y(i,11) = 1.615;
   % constant volume
   y(i,5) = y(i,1);
   % well mixed
   y(i,6) = x(i,2);
   y(i,7) = x(i,3);
   y(i,8) = x(i,4);
end;
%-----------------------------------------------------------
% the end!   
