%
% Example 14.2: 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 = 1.5/24;
xx = [];
figure;
for So = [0 4 9];
  xo = [ Sf Sno3 So Xh Xs ];
  [ t, x ] = ode45( 'Anoxic_Zone', [ 0 days ], xo );
  plot( 24*t, x(:,2) );
  hold on;
end;
hold off;
secs = etime( clock, to )
%-----------------------------------------------------------
set( gca, 'fontsize', 16 );
axis( [ 0 24*days 0 12 ] );
xlabel( 'Time in hours' );
ylabel( 'Nitrate in mg/l' );
%
h = text( 1.0, 4, '9 mg/l' );
set( h, 'fontsize', 16 );
h = text( 0.9, 2.7, '4 mg/l' );
set( h, 'fontsize', 16 );
h = text( 0.825, 1.8, '0' );
set( h, 'fontsize', 16 );
%
print -f1 -deps2 fig14-5.eps
%
%-----------------------------------------------------------
% the end!   
