%
% Example 14.3: 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 = 0;
Xh = 400;
Xs = 100;
%
xo = [ Sf Sno3 So Xh Xs ];
%-----------------------------------------------------------
% operational section
to = clock;
days = 2/24;
xx = [];
figure;
for Sf = [36 24 12 0];
  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.1, 5.1, 'no soluble carbon' );
set( h, 'fontsize', 16 );
h = text( 1.0, 4, '12 mg/l' );
set( h, 'fontsize', 16 );
h = text( 0.9, 2.9, '24 mg/l' );
set( h, 'fontsize', 16 );
h = text( 0.8, 1.8, '36 mg/l' );
set( h, 'fontsize', 16 );
%
print -f1 -deps2 fig14-6.eps
%
%-----------------------------------------------------------
% the end!   
