%
% Example 4.3B: Complex Fermentation Process
%
% - constant volume
% - well mixed
% - Monod kinetics
% - batch configuration
%
% Bob Newell, May 1996
%
%-----------------------------------------------------------
% parameters
Khxs = 0.5*0.1;
Khs = 3;
Khn = 3;
muhatf = 6;
Kf = 20;
muhatm = 0.6;
Km = 20;
de = 0.4;
dh = 0.4;
dm = 0.4;
Yh = 0.6;
Ym = 0.6;
Ynx = 0.01;
Ye = 0.01;
%
global p
p = [ Khxs Khs Khn muhatf Kf muhatm Km ...
       de dh dm Yh Ym Ynx Ye ];
%-----------------------------------------------------------
% initial states
V = 12.5;
Xs = 350;
Ss = 150;
Xon = 25;
Xe = 10;
Sf = 25;
Snh = 0;
Sa = 50;
CH4 = 0;
Xh = 850;
Xm = 10;
%
xo = [ V Xs Ss Xon Xe Sf Snh Sa CH4 Xh Xm ];
%-----------------------------------------------------------
% integrate the state equation
to = clock;
days = 4/24;
[ t, x ] = ode45( 'Complex_Fermentation', [ 0 days ], xo );
secs = etime( clock, to )
%-----------------------------------------------------------
% plot the results
font = 20;
figure;
plot( 24*t, x(:,2), 24*t, x(:,6), 24*t, x(:,8) );
axis( [ 0 24*days 0 400 ] );
set( gca, 'fontsize', font );
xlabel( 'Time in hours' );
ylabel( 'Substrate in mg/l' )
%
stext( 2.5, 310, '{\times \20 \it X_S}' );
stext( 1.9, 150, '{\times \20 \it S_A}' );
stext( 1.0, 35, '{\times \20 \it S_F}' );
%
printsto -f1 -deps2 ex4_3b.eps
%
%-----------------------------------------------------------
% the end!   
