%
% Example 14.4: Activated Sludge Anoxic Zone
%
% Batch reactor formulation
%
% Bob Newell, March 1996
%
%-----------------------------------------------------------
% parameters
muhath =6.0;
nuno3 =0.8;
Kf = 4.0;
Kno3 = 0.5;
Yh = 0.63;
Ko2 = 0.2;
%
global p
p = [ muhath nuno3 Kf Kno3 Yh Ko2 ];
%-----------------------------------------------------------
% initial states
Sf = 36;             % 20 - 250
Sno3 = 10;
So = 5;
Xh = 400;
Xs = 100;
%
xo = [ Sf Sno3 So Xh Xs ];
%-----------------------------------------------------------
% operational section
to = clock;
days = 2/24;
[ t, x ] = ode45( 'Anoxic_Zone', [ 0 days ], xo );
secs = etime( clock, to )
%-----------------------------------------------------------
% plot the results
figure
hax = plotyy( 24*t, x(:,1), 24*t, x(:,[2 3]) );
axesyy( hax, [ 0 24*days -40 40 0 20 ], ...
   'Time in hours', ...
   'RBCOD in mg/l', ...
   'DO and nitrate in mg/l', 2, ...
   [ 0 20 40 ], [ 0 5 10 ] );
%
h = text( 0.9, 6, 'RBCOD' );
set( h, 'fontsize', 16 );
h = text( 0.1, -30, 'DO' );
set( h, 'fontsize', 16 );
h = text( 0.7, -20, 'nitrate' );
set( h, 'fontsize', 16 );
%
%-----------------------------------------------------------
% the end!   
