Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Development of a MATLAB based bioprocess simulation tool

B. Sevella, G. Bertalan
Abstract A simple user friendly mathematical modelling
tool was developed on the basis of MATLAB software. The
program system provides the possibility of solving dif-
ferential equation system with the aid of an easy-to-use
graphical surface. It is suitable for bioprocess engineering
simulations to describe the dynamic behaviour of a great
series of various enzyme, fermentation and environmental
bioreaction systems. It is especially benecial that non-
time interventions can also be modelled and graphical
representations can be realized on a wide palette.
List of symbols
ODE Ordinary differential equation
X, X
prey
, X
pred
Biomass, prey and predator biomass
concentration
X
max
, X
min
Preset values of biomass in turbido-
stat fermentation
S, S
feed
Concentration of C/energy source and
its inlet concentration
C, C
+
Dissolved oxygen concentration and
its saturation value
Y
i
Overall yield coefcients
K
i
Substrate saturation (MONOD) con-
stants
K
L
a Volumetric oxygen absorption coef-
cient
a LuedekingPiret proportionality con-
stant
D Dilution rate
l
maxi
Maximum specic growth rates
1
Introduction
Nowadays mathematics based computer simulations be-
come essential part of research and higher education
systems because of their cost effectiveness and time saving
features. This is of even higher importance in the case of
teaching bioengineers (one of the main educational ac-
tivity of TU Budapest, Chemical Engineering Faculty)
where the necessarily many conventional laboratory
courses are getting more and more expensive and at least a
part of them has to be replaced by such simulation prac-
tices. A rather simple batch fermentation run in a pilot-
scale bioreactor needs tens of hours of experimental time
and several hundreds of USD for materials and energy. At
the same time using a proper simulation program tens of
various ``experimental'' runs can be carried out during
several minutes with an almost negligible price, keeping
naturally in mind that real manual experimentation and
model based simulations together are able to effectively
deepen our and our students' knowledge.
There have been a lot of efforts to develop math-based
simulation tools for bioreaction engineering. One of the
best known is the MATLAB based program system de-
veloped by S-O. Enfors [1] which can be used for the
simulation of a series of fermentation processes. It is
characteristic of this program system that
In theory the whole MATLAB-served functionality can
be exploited,
There are no clear denition-le formats,
In order to modify a given model, MATLAB les have
to be modied,
Parameter denition to the models is based upon
global variables and constants,
The user surface is rather unfriendly and visualization
of results is not taylor made, functions can not be
scaled,
The user surface and visualization need individual
developing work from model to model.
Another widely used approach is based upon the model-
ling work of Dunn et al. [2]. The earlier applied and a bit
cumbrous ISIM simulation language has recently been
replaced by the much more user friendly MADONNA
software. Numerous chemical and biochemical as well as
environmental engineering model examples are now ac-
cessible as sharewere programs on the Web [3, 4].
MADONNA is an easily programmable software pro-
viding special modelling environment: an ``equation win-
dow'' for formulating the system denition le, a
``parameter window'' to set numerical values of the equa-
tion constants, and a ``graph window'' for visualization of
the simulation results, with some other benecial features
like possibility of multiple running with one start and
statistical evaluation of the results and opportunity of
showing the results in table-format and others make this
approach a distinguished modelling tool. On the other
hand an unpleasant disadvantage of the MADONNA is that
programmed changing of model parameters is possible
exclusively in the function of time (as independent vari-
Bioprocess Engineering 23 (2000) 621626 Springer-Verlag 2000
621
Received: 6 December 1999
B. Sevella, G. Bertalan (&)
Department of Agricultural Chemical Technology,
TU Budapest H-1521 Szt. Gellert ter 4. Budapest Hungary
This work was supported by OTKA grant T-022182 and T-029882.
able). This does not make possible e.g. modelling those
systems where non-time variables should regulate the bi-
oreactions like in the case of turbidostat, varying feed rate
fed batch fermentations and so on.
To overcome some unpleasant drawback of the known
simulation tools we developed a program system with
which either simple unstructured and structured or more
sophisticated biological i.e. enzyme, microbial fermenta-
tion and environmental bioreactions can be simulated with
differential equation systems and the results can be
visualised on user-friendly graphical surfaces.
2
Designing the simulation program
Applying the built-in possibilities of the MATLAB 5.3
software our simulation program development met a set of
requirements:
1. The mathematical models can be described in the
ODEle (ordinary differential equation) denition
format of the MATLAB.
2. Solution of the model equations can be performed by
the MATLAB ODEsolvers.
3. Simple use of the program: the built-in options of the
ODEle and the proper ODEsolver can be chosen on
the graphic surface and the state of the running is
shown during the solution process therefore it can be
stopped at any time if the solution lasted too long.
4. Modications of the initial conditions as well as the
parameters of the model differential equations are
possible on the same graphic surface.
5. Regarding the visual appearance of the simulation
results the following benecial features of the program
can be applied during various simulations:
More than one result set can be shown at the same
time.
The results can be stored in les and these les are
reloadable and are printable at any time.
Individual or arbitrary combinations of the resulting
functions can be shown on preselected graphs and
results can be graphed not only as time functions but
any of the model variables can be chosen as ``inde-
pendent'' variable.
The graph axes of the functions are individually scal-
able.
Three dimensional graphical representations of the
results are also possible.
Designing of this simulation program based upon the use
of UML (Unied Modelling Language) methodologies [5]
and the structure of the resulting system is shown in the
Fig. 1.
3
Structure and use of the simulation program
Starting a simulation run can be initiated on the command
window of MATLAB with the ``ODEmain'' command. The
resulting window is empty with the only active ``Load
ODEle'' element which enables the loading of the de-
nition le of the actual mathematical model. For the sake
of simplicity here the single limiting substrate MONOD-
type model with bacterial growth, substrate consumption
and product formation serves as introductory example and
the whole denition le is shown in the Appendix.
Figure 2 shows the after-loading active picture of the
Fig. 1. Structure of the bioprocess simu-
lation program. After starting MATLAB
software only the xed ODEmain block
has to be started, all the others if they
are located in the same directory are
called automatically. The given model is
described in the Denition ODEle
Fig. 2. Active picture of ODE Driver Main Window showing all
the intervention, changing and varying possibilities before
running a simulation
622
Bioprocess Engineering 23 (2000)
``Main window'' on which the rst column denes the
variables of the model and the second refers to the model
parameters. Under these two columns one can give the
required numerical value of the variables initial values and
the model parameters. The ranges in which they are shif-
table have to be given in the ODEle. The third column
gives choices between the MATLAB ODEle denition
options but the value of these may also be empty (as is
shown in Fig. 2). At the right lower corner of this central
panel the time interval of the simulation can be given with
setting the start and end time of the simulation, while at
the upper corner the actual differential equation solving
algorithm can be chosen out of seven different built-in
MATLAB methods. During the simulation the picture of
the panel changes to the one shown in Fig. 3 where all the
elds and buttons are inactive but running coloured bars
indicate the status of solution process. If these bars are
moving too slow (possibly the solution method is not ef-
fective enough) the process can be interrupted by the only
active stop button. When the solution has completed the
button ``Display'' becomes active and the simulation re-
sults are to be graphed. This can be carried out with the
use of the ODE Driver Display Window (Fig. 4), with
which the following manipulations can be done with the
results:
In the case of step by step simulations all the consec-
utive set of results are shown on the same graph.
Saving the actual visible set of results in the form of
reloadable and ASCII convertible les is possible.
Scaling arbitrarily the variable axes thus making the
very much different order of magnitude results (e.g.:
biomass and dissolved oxygen tension) visible in one
coordinate system is a useful option.
Hiding or showing discretionary variable(s) simply
clicking on the chosen curve(s) helps the thorough
examination of the results.
Hiding and showing the parameters of the chosen set of
simulation could also be fruitful.
Any of the variables can be chosen as independent
variable not only the time that makes easier to interpret
the results exploring the correlations between impor-
tant process variables.
More than one simulation may also be graphed in a
three dimensional form, giving a clearer overview
among the various curves.
In the following section we demonstrate the use of our
simulation package through some practical instances with
special regards to some programming and graphic repre-
sentation advantages of the system.
Case 1: Simulation of a special fed batch fermentation
One of the disadvantages of many simulation tools is that
use of variables other than time as control variables is
difcult if not impossible. It is also clumsy if breaking the
time run is necessary and after that stop a new start is
needed. Such a typical event-control problem system is the
fed batch fermentation with a feed control on the basis of
dissolved oxygen tension. This system is widely used if a
relatively low C-source concentration is to be maintained
for some reasons, e.g. in the case of bakers yeast fermen-
tation. Saccharomyces cerevisiae is able to convert glucose
to cell mass with high overall yield only if alcoholic fer-
mentation is excluded i.e. if the oxygen level is high en-
ough (Pasteur effect) and glucose concentration is low
enough (Crabtree effect). These conditions can be satised
with an on-off controller. Depletion of the glucose results
in an increase of the dissolved oxygen level, if this exceeds
a certain preset level a substrate feeding pump has to start
the addition of glucose (ON state). As a consequence the
dissolved oxygen level (DO) change turns back because the
respiration rate of the microbes increases. When DO
crosses the setpoint downward the feeding stops (OFF
state) and it remains suspended until DO level goes
through the setpoint upward. With the proper choice of
the DO setpoint, substrate addition rate and allowed
overshoot above and underswing below the DO setpoint
makes it possible to maintain a stable fed batch yeast
fermentation.
The most important part of an ODEle which is able to
simulate the behaviour of such a system is given below. In
this case the double substrate (carbon source and oxygen)
MONOD model was applied to model the growth with
constant overall yields and the formation of one growth
associated product was also supposed, and the oxygen
transfer with constant K
L
a was described:
Fig. 3. Picture of the ODE Driver Main Window during solution
process. This actually shows a state very near to the end of a
solution. It can be seen that during the solution process only the
stop button is active giving the opportunity to cease of running
the program
Fig. 4. ODE Driver Display Window which shows the three
solutions of monod_b.m denition le describing a simple
MONOD-type system. Left hand side of the window shows some
possibilities of processing the results. Kinetic parameters:
K
S
= 1.3, Y
X/S
= 0.6, a = 0:667; l
max
= 0:5 and 0.25 on the
steeper and atter curve respectively
623
B. Sevella, G. Bertalan: Development of a MATLAB based bioprocess simulation tool
dX
dt
= l
max
S
K
S
S
c
K
O
c
X ;
dS
dt
=
1
Y
X=S
l
max
S
K
S
S
C
K
O
C
X ;
dP
dt
= a
dX
dt
;
dC
dt
=
1
Y
O
l
max
S
K
S
S
C
K
O
C
X K
L
a C
+
C ( ) :
Figure 5 shows the simulation results at a given param-
eter combination. The initial batch phase of the cultiva-
tion is consciously overemphasized, to demonstrate how
the system behaves when the substrate is getting
exhausted.
Case 2: Simulation of turbidostat fermentation
Turbidostat fermentation system is a useful experimental
tool when diluted culture media and unicellular micro-
organisms are to be cultured. The growing cell mass in-
creases the turbidity of the culture broth (measured in the
form of optical density i.e. absorbancy of a monochro-
matic light beam through a ow cell) and this value as a
measure of the cell mass can be used as control variable
for feeding of the fresh medium. When the turbidity of
the broth reaches a preset value (X
max
) a timer system
starts a medium feeding pump and at the same time
culture broth is taken off the bioreactor with an other
pump and with the same volumetric speed. This results in
a dilution of the culture broth thus the optical density
decreases. If it reaches another, arbitrarily chosen lower
turbidity setpoint (X
min
) both pumps stop and a new
growth period begins. X
min
is dened as a given percent
of X
max
.
The following minute detail program is a part of the
turbidostat simulating ODEle and it is responsible for the
denition of the parameters, equations and the turbidity
control unit. The routine is apparently a chemostat-algo-
rithm but during the growth periods dilution rate = 0
(thus it gives back a batch performance), while during the
medium addition and broth removal periods an enor-
mously high dilution rate is applied simulating a very high
speed pump operation. The variable subs determines the
amount of broth taken off during one pump operation
period.
function dydt=f(t; y; mumax; Kmonod; Yieldxs;
; Sfeed; Xmax; subs)
global D;
% Constants:
Dfinal=1e6;
Dinit=0;
%Variables:
X=y(1);
S=y(2);
P=y(3);
% Differential equations:
dydt=[D+XX+mumax+S=(SKmonod);...
% function dydt =
f (t, y, mumax, Ks, Ko, Yxsl, Yps1, Yos1, Yxs2, Yps2,
Yos2; Kla; c

star, X
feed, Sfeed, Pfeed, Smin, Ffinal, c

lim, c band)
global F t lim flag;
% Variables:
x = y(1);
S = y(2); P = y(3);
C = y(4); V = y(5);
if isempty (flag) & S < Smin
flag = 1;
t lim = t;
end;
if t < t lim
Yxs = Yxsl;
Yps = Yps1;
Yos = Yos1;
else
Yxs = Yxs2;
Yps = Yps2;
Yos = Yos2;
if c > c lim c band=2
F = F final;
elseifc < c lim c band=2
F = 0;
end;
end;
% Differential equations :
dydt = [F=V + (Xfeed X) X + mumax + S=(S Ks)+
c=(c Ko); . . .
F=V + (Sfeed S) X + (1=Yxs) + mumax + S=(S Ks)
+c=(c Ko); . . .
F=V + (Pfeed P) X + (Yps=Yxs) + mumax + S=(S Ks)
+c=(c Ko); . . .
Kla + (c star c) X + (Yos=Yxs) + mumax + S=(S Ks)
+c=(c Ko); %Kla
>> F=VF[;
Fig. 5. Simulation results of a dissolved oxygen level controlled
fed batch bakers yeast fermentation. Parameters of the kinetic
model: K
S
= 1.3, Y
X/S
= 0.6, a = 0:667; l
max
= 0:25, K
O
= 0.0006,
K
L
a = 200, C
+
= 0.006
624
Bioprocess Engineering 23 (2000)
D+(SfeedS)X+(1=Yieldxs) +mumax+S=(SKmonod);...
D+PX+(Yieldps=Yieldxs) +mumax+S=(SKmonod)[;
if X>Xmax
D=Dfinal;
elseif X<(1subs) +Xmax
D=Dinit;
end;
Example simulation results are shown in Fig. 6 where
one can see one of the benecial features of the developed
graphical surface: the possibility of three dimensional
representations. Here we wanted to examine the effect of
the broth removal. Fixing its value at three different levels
(0.7, 0.2 and 0.05) it can be seen that the rst run corre-
sponds to a highly discontinuous fermentation, as a matter
of fact it is a semi-continuous cultivation while the second
approaches and the third reaches a real continuous tur-
bidostat system behaviour.
Case 3: Simulation of a predator-prey system
A two species predator-prey interaction in a chemostat
culture can be described by the following set of differential
equations:
dX
prey
dt
= DX
prey
X
prey
l
max 1
S
K
S1
S
X
pred
1
Y
pp
l
max 2
X
prey
K
prey 2
X
prey
;
dX
pred
dt
= D
pred
X
pred
X
pred
l
max 2
X
prey
K
prey 2
X
prey
;
dS
dt
= D S
feed
S ( ) X
prey
1
Y
sp
l
max 1
S
K
S1
S
:
A suitably written ODEle composed similarly to that we
have shown above made possible to simulate this preda-
tion system. A set of results are shown in the Fig. 7 where
the kinetic parameters of the simulations refer to a system
of predator Dictyostelium discoideum and E. coli as prey
(6). The preparation of the gure is based upon a le of the
simulation result saved in ASCII format which has been
processed by the Excel software.
One of the favorable attributes of our program, that
any of the variables may be independent variable not
exclusively the time, is demonstrated with Fig. 8. System
behaviour is represented on a phase plane diagram which
shows a hard-oscillation of the concentrations of the
predator and prey species along a stable limit cycle.
4
Conclusion
Among recently used scientic approaches mathematical
modelling of bioprocesses plays an increasingly important
role. In numero experimentation i.e. mathematical simu-
lation serves as a cost effective and time saving method-
ology besides in vivo and in vitro techniques.
The kinetic representations of these systems usually
consist of ordinary differential equation systems, the so-
lution of which is possible with many well known com-
Fig. 7. Simulation results of a predato/prey interaction. The
system is a chemostat (D = 0.05) with the kinetic constants of the
two species: K
S1
= 0.1, K
prey2
= 0.25, Y
pp
= 0.5, Y
sp
= 0.5,
l
max 1
= 0:5, l
max 2
= 0:1
Fig. 8. Phase plane graph of the predator/prey system which
shows one stable oscillation around a non-existing steady state.
Parameters are the same as in the Fig. 7
Fig. 6. Original printout of a turbidostat simulation. Parameters
of the MONOD-type model: same as in Fig. 5. X
max
= 3.5,
S
feed
= 10. Curve 1: semicontinuous performance with 70%
withdrawal of the broth. Curve 2: course of the turbidostat with
high X
max
X
min
. Curve 3: real turbidostat with small X
max
X
min
625
B. Sevella, G. Bertalan: Development of a MATLAB based bioprocess simulation tool
mercial softwares and sharewares. We intended to im-
prove some undesired features of these programs with the
development of a MATLAB based simulation tool. This
work resulted in a exible, easy to use program with the
characteristics as follows:
It makes possible to use any of the MATLAB served
differential equation solving functions and denitions,
Extending the denition les the program serves as a
general modelling environment but does not require
the thorough knowledge of MATLAB.
It communicates with the model-maker through a user
friendly graphic surface on that results can be pre-
sented in suitable graphs.
It is able to convert the results into a savable and
further processable format.
It can be further developed on demand.
Testing the program with the presented cases prove the
exibility and usefulness of the system.
References
1. Enfors, S-O.: Continuous and fed batch operation of fermen-
tation processes. In: Bioreactor Engineering Course Notes EFB
Working Party on Bioreactor Performance, Saltsjobaden 1996
2. Dunn, I.J.; Heinzle, E.; Ingham, J.; Prenosil, J.E.: Biological
Reaction Engineering, Principles, Applications and Modelling
with PC simulations. Weinheim: Wiley-VCH 1992
3. Macey, R.; Oster, G.; Zahnley, T.: Madonna User's Guide.
(1998): Univ. of California Dept. of Molecular and Cellular
Biology. Berkeley, CA, http://www.kagi.com/authors
4. Heinzle, E.: http://www.uni-sb.de/matfak/fb12/heinzle/ma-
donna
5. Rumbaugh, J.; Jacobson, I.; Booch, G.: The Unied Modeling
LanguageReference Manual. Addison Wesley Longman, Inc.
Reading, MA, ISBN 0-201-30998-X (1999)
6. Blanch, H.W.; Clark, D.S.: Biochemical Engineering, Marcel
Dekker, Inc. New York, Basel, Hong Kong, 1996
Appendix
Definition file of the MONOD-model
function varargout = monod(t,y,flag,mumax,Kmonod,Yxs,Yps)
% Batch fermentation with Monod kinetics
% This routine gives the differential equations that are used for
% a batch fermentation process with Monod kinetics.
% == It demonstrate the usage of extra parameters and the naming
%== conventions for the output values.
switch flag
case `` % Return dy/dt = f(t,y).
varargout1 = f(t,y,mumax,Kmonod,Yxs,Yps);
case `mumax' % Return by default,min,max.
varargout1 = [0:25; 0; 2[;
case `Kmonod'
varargout1 = [1:3; 0; 10[;
case `Yxs'
varargout1 = [0:6; 0; 1[;
case `Yps'
varargout1 = [0:4; 0; 1[;
case `init' % Return default [tspan,y0,options].
[varargout1:3[ = init(mumax);
otherwise
error([`Unknown flag ```flag'''.']);
end
function [tspan,y0,options] = init(mumax)
tspan = [0; 100
+
mumax];
y0 = [1; 10; 0[;
options = odeset;
function dydt = f(t,y,mumax,Kmonod,Yxs,Yps)
% Constants:
% Variables:
X = y(1);
% P = y(3) faster if defined in comment
S = y(2);
% Differential equations:
dydt = [X
+
mumax
+
S/(S Kmonod); . . .
X
+
(1/Yxs)
+
mumax
+
S/(S Kmonod); . . .
X
+
(Yps/Yxs)
+
mumax
+
S/(S Kmonod)[;
%this is faster than transpose the matrix
626
Bioprocess Engineering 23 (2000)

You might also like