%
% Example 3.8: Carbon Removal Process
%
% - constant volume
% - well mixed
% - Monod kinetics
% - no biomass in effluent
% - no clarifier dynamics
% - same substrate in effluent, recycle & wastage
% - no oxygen in recycle & wastage
%
% Bob Newell, March 1996
%
%-----------------------------------------------------------
% parameters
muhat = 3.733;
Ks = 20;
Koh = 0.2;
Yh = 0.6;
bh = 0.4;
fp = 0.1;
a = 166;
b = 16;
So_sat = 10;
%
global p
p = [ muhat Ks Koh Yh bh fp a b So_sat ];
%-----------------------------------------------------------
% initial states
V = 12.5;
Ss = 4.4;
So = 3;
Xh = 850;
%
xo = [ V Ss So Xh ];
%-----------------------------------------------------------
% integrate the state equation
to = clock;
days = 1;
[ t, x ] = ode45( 'Carbon_Removal_Process', [0 days], xo );
etime( clock, to )
%-----------------------------------------------------------
% evaluate the outputs
y = Carbon_Removal_Process_Outputs( t, x ); 
%-----------------------------------------------------------
% plot the results
figure;
subplot( 2, 1, 1 );
plot( 24*t, y(:,8), '-' );
axis( [ 0 24*days 0 1000 ] );
ylabel( 'Biomass (mg/l)' )
legend( 'Xh_out' )
%
subplot( 2, 1, 2 );
plot( 24*t, y(:,6), '--', 24*t, y(:,7), '-' );
axis( [ 0 24*days 0 25 ] );
xlabel( 'Time (hrs)' )
ylabel( 'Nutrients (mg/l)' )
legend( 'Ss_out', 'So_out' )
%-----------------------------------------------------------
% the end!   
