%
% Example 3.8: Aerated Biological Reactor
%
% - constant volume
% - well mixed
% - Monod kinetics
%
% Bob Newell, March 1996
%
%-----------------------------------------------------------
% parameters
muhat = 6;
Ks = 20;
Koh = 0.2;
Yh = 0.67;
bh = 0.4;
fp = 0.1;
Ka = 14;
So_sat = 10;
%
global p
p = [ muhat Ks Koh Yh bh fp Ka So_sat ];
%-----------------------------------------------------------
% initial states
V = 1.4;
Ss = 20.5;
So = 2.92;
Xh = 348.8;
%
xo = [ V Ss So Xh ];
%-----------------------------------------------------------
% integrate the state equation
to = clock;
[ t, x ] = ode45( 'Aerated_Biological_Reactor', [ 0 1 ], xo );
etime( clock, to )
%-----------------------------------------------------------
% evaluate the outputs
y = Aerated_Biological_Reactor_Outputs( t, x ); 
%-----------------------------------------------------------
% plot the results
figure;
hax = plotyy( 24*t, y(:,8), 24*t, y(:,[6 7]) );
axesyy( hax, [ 0 24 -400 400 0 50 ], ...
   'Time in hours', ...
   'Active biomass in mg/l', ...
   'Nutrients in mg/l', 2, ...
   [ 0 200 400 ], [ 0 10 20 ] );
%
h = text( 14, -120, 'Substrate' );
set( h, 'fontsize', 16 );
h = text( 14, -300, 'Oxygen' );
set( h, 'fontsize', 16 );
%
%-----------------------------------------------------------
% the end!   
