Professional Documents
Culture Documents
TigerPrints
All Theses Theses
5-2011
Recommended Citation
Phan-thien, Y, "BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION" (2011). All Theses. 1096.
https://tigerprints.clemson.edu/all_theses/1096
This Thesis is brought to you for free and open access by the Theses at TigerPrints. It has been accepted for inclusion in All Theses by an authorized
administrator of TigerPrints. For more information, please contact kokeefe@clemson.edu.
BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION
____________________________________
A Thesis
Presented to
the Graduate School of
Clemson University
____________________________________
In Partial Fulfillment
of the Requirements for the Degree of
Master of Science
Biosystems Engineering
____________________________________
by
Y N. Phan-Thien
May 2011
____________________________________
Accepted by:
Dr. Caye M. Drapcho, Committee Chair
Dr. John Nghiem
Dr. Terry Walker
ABSTRACT
Software) was upgraded from the previous version and provided with additional
enhancements. Several new bioprocess configurations and their subroutines have been
added. The additional processes included continuous stirred tank reactor (CSTR) with
biomass recycle, and CSTR with additional stream in the second stage. The primary goal
expressive visual modeling tools. In this new version, output from simulation can be
visualized in graphics. Printing, exporting, and saving file options also are available. In
ii
ACKNOWLEDGEMENTS
I wish to express my deepest gratitude to Dr. Caye Drapcho for suggesting the
topic of this thesis as well as her professional guidance and constructive criticism.
I am also greatly indebted to Dr. Nhuan Nghiem, whose valuable advices, and
enduring motivation and support were of inestimable value. Sincere thanks are also to
I also would like to thank Dr. Walker for giving useful lectures which helped me a
my brother, and my little sister for their love, patience and encouragement during the
Finally, I would like to thank all my friends in the United States for just
iii
TABLE OF CONTENTS
ABSTRACT........................................................................................................................ ii
Chapter 1 ..........................................................................................................................1
INTRODUCTION ....................................................................................................... 1
Chapter 2 ..........................................................................................................................5
BioMASS v2.0............................................................................................................. 5
Chapter 3 ........................................................................................................................29
CONCLUSION ......................................................................................................... 62
APPENDICES .................................................................................................................. 63
APPENDIX A ................................................................................................................... 64
iv
APPENDIX E ................................................................................................................. 118
v
LIST OF FIGURES
Figure 2.4. Simulation window of Irreversible Chemical Kinetics for zero-order reaction.
........................................................................................................................................... 12
Figure 2.8. Simulation results of Single Limiting Nutrient were displayed in Table. ...... 19
Figure 2.9. Simulation results of Single Limiting Nutrient were displayed in Graph. ..... 20
Figure 2.12. “Enter data for Substrate” window of Multiple Limiting Nutrients. ............ 23
Figure 2.13. “Enter data for product” window of Multiple Limiting Nutrients. .............. 24
Figure 2.15. “Enter data for Substrate” window of Inhibition Model. ............................. 26
Figure 2.16. “Enter data for product” window of Inhibition Model. ................................ 27
Figure 2.17. “Enter data for Xenobiotic Compound” of Inhibition Model. ..................... 28
Figure 3.3. List of supported product inhibition model in BioMASS v2.0. ..................... 36
vi
Figure 3.5. Experimental (points) and simulated (lines) profiles of substrate, biomass and
H2 concentration in a batch system including impact of H2 inhibition. ............................ 41
Figure 3.9. Experimental (points) and simulated (lines) profiles of substrate, biomass and
H2 concentration in a batch system without including impact of H2 inhibition................ 44
Figure 3.11. Simulated profiles of H2 concentration with different µ max values in a batch
system including impact of H2 inhibition. ........................................................................ 46
Figure 3.14. Simulated results of hydrogen production in a CSTR system at HRT of 6h.
........................................................................................................................................... 49
Figure 3.17. Experimental (points) and simulated (lines) profiles of glucose, xylose and
xylitol concentration in a batch system............................................................................. 53
Figure 3.20. Simulated profiles of xylitol concentration with different µ max values in a
batch system. ..................................................................................................................... 55
vii
Figure 3.21. Simulated profiles of xylitol concentration with different K S1 values in a
batch system. ..................................................................................................................... 55
Figure 3.25. Simulated profiles of glucose, xylose, xylitol and ethanol concentration in a
batch system. ..................................................................................................................... 58
viii
LIST OF TABLES
Table 3.1. Simulated results of hydrogen production at different retention time. ............ 48
Table 3.2. Simulated results of rate of H2 production with different initial substrate
concentration in a batch system. ....................................................................................... 51
Table 3.3. Simulated results of xylitol and ethanol concentration with different initial
glucose concentration in a batch system. .......................................................................... 59
Table 3.4. Simulated results of xylitol and ethanol concentration with different initial
xylose concentration in a batch system............................................................................. 59
ix
Chapter 1
INTRODUCTION
In the world of software development, systems often begin as simple and well-
understood, and normally contain elements such as creation of process flow diagrams, and
generation of material and energy balances. To meet the ultimate requirements, models become
more complex to include calculations such as equipment sizing, and capital and operating cost
estimation.
Simulation is becoming a requirement for all major process designs. Using simulation,
bioprocess engineers can identify potential problems ahead of time and take corrective action. A
common use for bioprocess simulation is for process mapping and cost analysis. Process
mapping enables investigators to analyze or predict the action of organisms in response to certain
specific inputs. Cost analysis identifies the expensive process steps and other cost items that have
major impacts overall process economics. A simulation program development must meet several
requirements, e.g. the mathematical models must be described in the ordinary differential
equations (ODE). In addition, one of the challenges for users when using such simulation tool is
accumulation of the appropriate data. Simulation can only be run until all the data is collected
BioMASS stands for Biological Modeling and Simulation Software and was developed Bhairavi
• Kinetics models for three different types of irreversible chemical reactions (zero, first and
second order).
• Biological kinetics where single limiting nutrient is used for simple Monod kinetics and
for multiple limiting nutrients model, which allows users to select a maximum of four
substrates and a maximum of two products. The user can also select one pair of
All of these modes can be carried out in either batch or continuous operation and with a
• Many complex equations may be solved simultaneously. In other words, a large number
• The software may be integrated with other commonly used softwares such as Excel to
2
Simulate bioreactor experiments involving microbial species and predict the
Study the effects of key process variables, for example, initial substrate
concentration, temperature.
potential problems can be investigated, and behavior under varying conditions can be
• The software can be further developed to satisfy other demands, and also can be used in
However, the aforementioned version of the BioMASS software also has several limitations,
which include:
• Lack of operations that help to increase cell concentration and improve product formation
Objectives
3
• The ultimate objective of the research is to develop a tool for bioprocess modeling, which
does not require the users to have special computer programming skills.
• The tool will include all important aspects of common bioprocess configurations but also
will be made simple and easy to understand so that it can be used by beginners who are
just starting to learn bioprocessing as well as by those who already have advanced
• The tool will include definitions of all necessary process parameters, and also will allow
simulation by inputting values, and comparison of predicted results with actual data.
There are four chapters in this thesis, followed by a list of references and relevant
appendices. This section gives a brief overview of the organization of the chapters.
The current chapter (Chapter 1) gives an introduction to bioprocess modeling and the
Chapter 2 gives detailed description and functions of BioMASS v2.0. Output samples of
irreversible chemical kinetics and biological kinetics are given in this chapter.
Chapter 3 reviews the various available process simulators including SuperPro Designer,
which is one of the best commercially available simulator packages. This chapter also gives
literature reviews of kinetics and mass balance of chemical and biological reactions that can be
used during the simulation of BioMASS. Then the simulation results are also given. The data is
obtained from published research papers. Predictive results are compared with the actual values
4
Chapter 2
BioMASS v2.0
• Simple, inexpensive tool that could be easily used by the users with minimum
training.
The primary goal of BioMASS is to create a software application where users may
choose and specify the feed, bioreactor type, operational conditions, then predicts the substrate,
product, and biomass concentration over a period of bioreactor operation. The results can be
stored in files and these files are reloadable and are printable at any time. The features of
BioMASS v2.0 are highlighted, and examples of outputs generated by BioMASS are also given
System Requirements
BioMASS will run on any PC and compatible with processor that runs
requirements:
hard dish.
5
• Mouse: The presence of a mouse or similar pointing device supported by
1024x768.
Installation
The installation is very simple. First of all, copy or download all necessary files onto the
hard disk at a directory of the user’s choice. Then, double-click on the “setup” file to install the
application. Finally, start running the software by double-clicking the BioMASS icon on the
desktop.
Start Page
When the software is launched, a “Start Page” window will appear as default (Fig 2.1).
The “Start Page” displays the version number of this application along with the name of
developers and corresponding email address. The main BioMASS window, with its
accompanying toolbars and menus, closely resembles the windows the user works in for other
Window based programs. The main window for the operation consists of a menu bar, a toolbar, a
6
Figure 2.1. “Start Page” window.
7
Figure 2.2. Commands in “File” Menu.
8
Irreversible Chemical Kinetics
The following is the irreversible chemical reaction which is considered in the simulator:
A
→
k
B
Within the process, all the reactant A reacts to form product B. The reactant in a
BioMASS v2.0 supports three different kinds of kinetics models of irreversible chemical
reactions (zero, first and second order). The user interface contains four main blocks (Fig 2.3).
- The “Chemical Kinetics Reaction” block contains two textboxes for the user to enter the
name of reactant and product of irreversible chemical reaction. Changing names in those
- The ‘Set-up” block stores the information about the initial concentrations of reactant
and product; and allows user to set the mode of operation. While the initial reactant
Regular units such as mg/L, g/L, mg/m3, g/m3 are supported in BioMASS. The default
unit of concentration is “mg/L”. Changing the unit in a textbox will automatically change the
units of the rest of the parameters. The unit of chemical constant k will be changed with the
change of reaction order. The unit of k in zero-order reaction will be ML−3T −1 (M, L, T are
expressed as the units of mass, length, and time, respectively), or T −1 in first-order reaction, and
L3 M −1 t −1 in second-order reaction.
BioMASS provides many operation options such as batch, CSTR at Transient State, and
CSTR at Steady State. By default, the batch operation is checked. Click on “CSTR at Transient
State” to run the simulation in a given duration, or click on “CSTR at Steady State” to let the
9
simulation run until it reaches the steady state, and then the steady time is calculated and
reported. In this version, images of various operating systems are also given to help the user has
a better idea about the differences between them. The bioprocess with multiple stages is also
considered in BioMASS v2.0. Check on “Click here to add another reactor” checkbox to create
- The last two blocks are “Reactor 1” and “Reactor 2”, which store information about the
physical characteristic such as volume, flow rate, dilution rate, chemical constant, etc. Each
block represents a bioreactor. By default, block of “Reactor 2” will be hidden, and it will only be
shown when “Click here to add another reactor” checkbox is selected. In each block, there is a
textbox, set with orange background, to introduce which reaction order is selected to run the
simulation (Fig 2.4). This is a good way to remind the user that the reaction order should be the
If the batch operation is chosen, the physical parameters such as flow rate, volume,
dilution rate, retention time are hidden and cannot be edited by the user. If the process is set to
continuous mode, those physical parameters are shown again. BioMASS v2.0 supports to
simulate CSTR operation with flow rate or dilution rate, or retention time. The user must select
Biological reactions just like any others are temperature sensitive because reaction rate is
a function of temperature, and this dependence may be modeled using Arrhenius or modified
Arrhenius equation. If the user selects “Temperature correction” checkbox, this will bring up a
dialog box (Fig 2.5). This dialog allows the user to calculate the effect of temperature on
chemical constant k. When this checkbox is selected, it means that the value of chemical
10
constant k has been corrected by Arrhenius equation. The user can uncheck that checkbox to
11
Figure 2.4. Simulation window of Irreversible Chemical Kinetics for zero-order reaction.
12
Figure 2.5. “Temperature Effect” window.
13
Biological Kinetics
the model can be zero, first or second-order reaction. For example, the term of the Monod
equation, which is determined experimentally, makes the model fit the system investigated.
µˆ S S
µ= (3.10)
K s + SS
The specific growth rate µ is not constant, and dependent on the substrate concentration. The
value of half saturation constant K S is equal to the substrate concentration at which the growth
µˆ
rate µ is equal to 1/2 of µ̂ K S = S when µ = . During low substrate concentration, reactions
2
µˆ S
are first order µ ≈ S , while at high substrate concentrations, they are zero order (µ ≈ µ̂ ) .
KS
BioMASS v2.0 supports single, multiple limiting nutrient and inhibition model.
- The “Biological Reaction” block contains two text boxes to introduce the name of
substrate and product. Some common substrate names of glucose, xylose, arabinose, fructose,
etc., and some common product names of hydrogen, ethanol, xylitol, etc. are listed in those
boxes. The user can either select one of them or enter a different name. Inputting name of
substrate and product in the bioreaction are optional, and it does not affect to the calculation.
However, this step will help to make sense for the simulation results; hence, it will be useful for
the user to review later. The default name of substrate or product will be the first name appears
in the list. If there is not any product in the user’s model, “no product” option must be selected or
14
the program will ask for it and the simulation cannot run until all necessary information is
entered.
- The ‘Set-up” block allows the user to set the mode of operation. “Single Limiting
Nutrient” provides more options than “Irreversible Chemical Kinetics”. They are batch, CSTR at
Transient State, and CSTR at Steady State, CSTR with biomass recycle, multistage CSTR with
additional feed stream. The user can select one of those options by checking on its radiobutton.
By default, the batch operation is checked. Whenever the user changes the selection, the images
in picturebox, which is used to explain that option, will also be changed. Including images for
each option is one of the improvements of BioMASS v2.0. Images help the user better
- The last two blocks are “Biological Reactor 1” and “Biological Reactor 2”, which store
the information about the physical characteristic such as volume, flow rate, dilution rate,
chemical constant, etc. Click on “Click here to add another reactor” checkbox to create the
system composed of two reactors linked in series. The “Biological Reactor 2” will only be shown
Each block represents as a bioreactor, and in each block, there is an input data button of
“Click here to enter your data”. Clicking on this button will bring up a dialog that allows the user
maintenance parameters, etc. (Fig 2.7). The feed for the microbial species in a bioreactor comes
in the form of substrate and nutrients. Depending on the substrate type, microbial species
involved and bioreactor operational conditions; different kinds of products are produced in the
bioprocess.
15
Figure 2.6. Simulation window of “Single Limiting Nutrient”.
16
Figure 2.7. “Enter Data for Bioreactor 1” window.
After defining all necessary information, the user may run the simulation. As a short-cut
for performing simulation, the user may hit CTRL + R or simply click on the button that looks
like a calculator . The user may use the following toolbar button to go back any time to
the input form to change, remove, or add any information. The “View Graph” and “View Table”
The “View Table” button appears as a picture of a small table . Click on this icon to
view the result of simulation in table (Fig 2.8). BioMASS v2.0 calculates and reports the
following variables in its table result: substrate and product concentration, growth rate, rate of
substrate utilization, rate of biomass formation, rate of decay, and rate of product production (Fig
2.8). The simulation is calculated by step time of 0.1. Unlike the previous version, BioMASS
17
v2.0 gives the user the flexibility of changing the time interval ( ∆t ) that is displayed in table
result. The format of table result is another improvement of BioMASS v2.0. The same format of
spreadsheet as Microsoft Excel 2007 is used. The result of each variable is presented in a
column, and the size of each column is changeable. The header of each column is the name of
calculated value and its unit. When a row in table is selected, that row will be highlighted.
The “View Graph” button appears as a picture of a small graph . After clicking this
icon, a graph popup window appears immediately and displays graphs of the calculated values
with time (Fig 2.9). BioMASS also allows the user to adjust the size of the graph by dragging on
its edges. In the previous version of BioMASS, the results are exported to Excel and then built a
graph; therefore, it takes time whenever the user would like to view graph. BioMASS v2.0
improves this disadvantage by creating the graph by itself without the help of Excel. Since
concentrations of biomass and product are usually small to compare with concentration of
substrate, when plotting them in the same graph, sometimes they cannot be seen. Therefore,
BioMASS v2.0 plots those two values in the secondary y-axis to have a better view. There are
three different graphs created in BioMASS v2.0. The first one is the graph of the calculated
values of concentration with time. The second one is the graph of the rate of substrate utilization,
the rate of biomass formation, and the rate of product production with time. The first two graphs
are arranged vertically to help the user follow the change of the nutrients with time. The last one
18
Figure 2.8. Simulation results of Single Limiting Nutrient were displayed in Table.
19
Figure 2.9. Simulation results of Single Limiting Nutrient were displayed in Graph.
Another improvement of BioMASS v2.0 is to allow the user save their data or results in
Microsoft Excel. The user can either select “Save Data” or “Save All”. Unfortunately, until now
the software only works effectively on Excel 2007. The saved file will include three sheets (Fig
2.10). Those sheets are named “Data”, “Results”, and “Graph”, which is used to save simulation
data, calculated values and images of graphs, respectively. This is the attempts of the developer
to make it convenient for the user. The saved file can be used to run another simulation in
20
Figure 2.10. Save Data, Results and Graphs in Excel.
When the model has more than one substrate, the user can use “Multiple Limiting
Nutrients”. The user interface contains four main blocks (Fig 2.11).
- The “Biological Reaction” block contains two textboxes which allow the user to specify
the number of substrate and product involved in the reaction. BioMASS is able to simulate up to
four substrates and two products. Since this is “Multiple Limiting Nutrients” model, the
- The ‘Set-up” block has functions as in Single Limiting Nutrient but with fewer option.
The function only allows the user to simulate the system operation of batch and CSTR.
21
- The “Operation Parameters” block stores the information about the physical
characteristic such as simulation time, volume, flow rate, dilution rate, etc.
- The “Multiple Limiting Nutrients” block provides two types of multiple substrate
models. Since there is more than one substrate in this model, the user needs to select either
substrates. Clicking on “Substrate” button, which is the red button, will open a window where
stores the information related to substrates and nutrients being fed to the bioreactor (Fig 2.11).
Clicking on “Product” button, which is the blue button, will open a window where stores the
22
When inputting data for substrate, some values are initial concentrations, biomass yield,
maximum growth rate µ max , half saturation concentration K S need to be entered to enable
running the simulation (Fig 2.12). Neglecting one of these important values will cause to appear
an error message, and the error message will keep appearing until all necessary information is
entered. The values of µ max and b for “Substrate 1” will be set constant for the rest of the
substrates. If the user selects “Temperature correction for Decay constant” or “Temperature
correction for Max Growth Rate”, this will bring up a dialog. This dialog allows the user to
calculate the effect of temperature on decay constant, b or maximum growth rate, µ max by using
Figure 2.12. “Enter data for Substrate” window of Multiple Limiting Nutrients.
23
When inputting data for product, some values need to be entered to enable running the
product K png or both those values, depends on product type (Fig 2.13).
Figure 2.13. “Enter data for product” window of Multiple Limiting Nutrients.
Inhibition Model
The user interface has a same format as in the “Multiple Limiting Nutrient”. In the
“Biological Reaction” block contains three textboxes which allow the user to specify the number
of substrate, product, and Xenobiotic compound involved in the reaction. BioMASS is able to
simulate up to four substrates, two products, and two Xenobiotic compounds. A minimum of one
24
substrate can be chosen, whereas for both product and Xenobiotic compound, a minimum of zero
The user is allowed to set inhibitory for Substrate 1 and Substrate 2 (Fig 2.15). BioMASS
Inhibition, Andrew’s Model, Edward’s Model and Modified Steele’s Model. By default, the
model will be set as “No Inhibition”. In this list, there are not only names but also equations that
incorporate Monod’s equation and inhibition model, to help the user easily identify them. The
25
Figure 2.15. “Enter data for Substrate” window of Inhibition Model.
BioMASS v2.0 allows the user to set inhibitory for only Product 1 (Fig 2.16). BioMASS
General Inhibition Term 1, General Inhibition Term 2, Modified General Inhibition Term 2. The
difference in each model can be easily seen in its equation. BioMASS allows the user to select
only one competitive inhibitory term. Therefore, if there is more than one of this term is chosen,
an error message will appear and inhibition model is automatically reset to “No Inhibition”.
26
Figure 2.16. “Enter data for product” window of Inhibition Model.
BioMASS v2.0 also accounts for the inhibitory effect of Xenobiotic Compound (Fig
Inhibition, and Uncompetitive Inhibition. The user can click on the arrow in the ComboBox to
27
Figure 2.17. “Enter data for Xenobiotic Compound” of Inhibition Model.
28
Chapter 3
ABSTRACT
A simulation software (BioMASS – Biological Modeling and Simulation Software) was upgraded
from the previous version and provided with additional enhancements. Several new bioprocess
configurations and their subroutines have been added. The additional processes included
continuous stirred tank reactor (CSTR) with biomass recycle, and CSTR with additional stream
in the second stage. The primary goal in the development of BioMASS v2.0 was to provide users
with a ready-to-use, expressive visual modeling tools. In this new version, output from simulation
can be visualized in graphics. Printing, exporting, and saving file options also are available. In
29
Nomenclature: S, substrate concentration (g/L); S 0 , initial substrate concentration (g/l); Si ,
critical product concentration above which cells cannot grow (g/L); Pt1 , product concentration at
constant (g/L); K S1 , half saturation contant of glucose (g/L); K S2 , half saturation constant of
xylose (g/L); µ , specific growth rate coefficient (h-1); µ max , maximum specific growth rate
yield (g of P/ g of S); K pg , coefficient for growth associated product (g of P/g of X); K png ,
INTRODUCTION
Simulation software has been used in the petroleum and chemical industries since the late
1950’s, while its practice in bioprocessing has only taken place within the last 20 to 25 years
30
(Shankin, 2000). There are several challenges in the application of process simulation software
to bioprocessing. First, most bio-products are produced by fermentation, and the metabolic
processes of the microorganisms are very complicated and often cannot be modeled precisely.
Second, most biological processes are difficult to describe mathematically or may include a large
number of highly nonlinear differential equations that, are impossible to solve without the help
of numerical methods and suitable computer software tools. Third, reliable online sensors are
lacking. Measurement devices give insight to the process, allowing operators to know what is
going on inside the system; however, some key parameters are not measurable with standard
information on the subject. On the other hand, simulation can only be run until all the data is
Other factors should be taken into consideration when running the simulation. First, raw
materials and products are unidentified or have varying compositions (Shankin, 2000). Also,
identification of the residues or by-products is often difficult. Second, a vast majority of process
data are acquired online, which are measured continuously with respect to the time. However,
some important parameters such as concentrations of substrate, biomass, and product are
measure off-line, which are measured periodically or at single time point only. Biomass
Despite many challenges, new models and measurement methods are constantly being
Microsoft Excel are very popular. Data is input in cells and results are displayed in variety of
graphs. This application can be very useful for bioreactor design (Gimbun, 2004). The model is
easy to operate or scale up to meet demand by changing variable values in the spreadsheet.
31
MATLAB is developed by the MathWorks, used widely by many researchers and universities. It
is a tool for computation and visualization in an integrated environment. MATLAB can be used
to investigate the effect of many important factors in bioprocesses such as pH, temperature, flow
rate, etc. (Birol, 2002). Like Excel, MATLAB provides flexibility of changing initial conditions
to scale up or optimize the model. However, processing of large amounts of data as well as
ISEE systems, which is easy to learn and that is the reason for its extensive use in education.
However, STELLA is not designed for large complex system modeling but for small relatively
simple systems. Some other applications that have the same graphical icon-based interface as
STELLA such as Madonna, GoldSim and Simulink, are also becoming popular and give the user
under National Science Foundation and National Institute of Health sponsorship. The program
has capacity to directly import STELLA models and is very useful when evaluating the relative
ASPENPlus® and SuperPro® (Intelligen, Inc.) are considered to be the most two popular
tools for bioprocess industry (Shankin, 2000). They are well suited to perform basic material and
energy balances, and economic analysis. They provide a flexible flow sheet where the user
simply adds graphical icons that represent specific operation unit at any location and with any
frequency. However, the use of ASPEN Plus® and SuperPro® is often restricted to built-in
model with limited option for user-defined models or customization. In addition, the cost for
both is high; for example, it costs $15,950 to purchase a copy of SuperPro® in 2011
(http://www.intelligen.com/). SuperPro is a very powerful and flexible tool, and provides many
32
options for the user to choose; however, this is also its limitation. The user needs to be trained to
learn how to use it. Some other popular names such as Simulations Plus provides a list of
BioMASS v2.0 is the result of this work, which enables modeling of batch and continuous flow
biological reactors for bioprocessing (fermentation processes such as ethanol and xylitol
categories and prices; therefore, the users can select a suitable tool depends on their demand.
MODEL DEVELOPMENT
BioMASS
BioMASS was written in Visual Basic language, and includes user through a user-
friendly graphic surface (Fig 3.1). It is a flexible and inexpensive tool that could be easily used
by the user with minimum training. The primary goal of BioMASS is to create a software
application where the user can choose and specify the feed, operational conditions, to simulate
the substrate, product, and biomass concentration over a period of bioreactor operation. The
results can be stored in files and these files are reloadable and are printable at any time. The
installation is very simple, and includes copying all necessary files onto the hard disk at a
directory of the user’s choice, then starting the program by double-clicking the BioMASS icon.
33
Figure 3.1. Start Pageof BioMASS v2.0.
BioMASS simulation provides kinetics models for three different types of irreversible
chemical reactions (zero, first and second order), and three main types of biological kinetics
(single limiting nutrient, multiple limiting nutrient and inhibition model), all based on Monod
Kinetics (Fig 3.2, 3.3). The multiple limiting nutrients model allows user to select a maximum of
four substrates and a maximum of two products. The user can also select one pair of substitutable
or complementary substrates. Finally, inhibition models can be selected to model the inhibitory
effects of substrates, products, or xenobiotic compounds on microbial growth. All of these modes
34
can be carried out in either batch or continuous operation and with a single bioreactor or two
bioreactors in series.
35
Figure 3.3. List of supported product inhibition model in BioMASS v2.0.
In addition, BioMASS v2.0 will be a useful tool in education and training. In Help menu,
the “Notebook” command brings up a window that introduces frequently asked questions, listed
in alphabetical order, along with short answers, images, and animations to help the user has a
36
Figure 3.4. “Notebook” window in BioMASS v2.0
Kinetics Models
allows researchers to determine production rates of their products, or how fast organisms will
uptake substrates, etc. BioMASS uses the well-known Monod model because of its simplicity
and capability to simulate the biological reactor. The terms of the Monod equation, which are
µˆ S S
µ= (3. 1)
K s + SS
Once the reaction rates of interest are know, their influence on the mass balance should
be evaluated. When the mass balance equation combines with reaction rate to form simple
37
mathematical models, it can be used to describe quantitatively all the materials that enter, leave
and accumulate in a reactor. Since there is no flow into or out of the reactor during reaction time
dX
= µX − bX (3. 2)
dt
dS µ r
= − + P + mS X (3. 3)
dt YX / S YP / S
dP
= rP X (3. 4)
dt
rP = K pg µ + mP (3. 5)
rP = K png + mP (3. 6)
rP = K pg µ + K png + mP (3. 7)
Since there is continuous flow into and out of a CSTR, the mass balance must consider
not only changes that occur as a result of reactions within the reactor but also must include those
dX X i X
= − + µX − bX (3. 8)
dt τ τ
dS S i S µ r
= − − + P + mS X (3. 9)
dt τ τ YX / S YP / S
dP Pi P
= − + rP X (3. 10)
dt τ τ
38
When microbes are presented, different types of kinetics may be observed due to toxicity
or inhibition of the organisms or enzymes by the substrate or product. Inhibition decreases the
rate of reaction because it slows down bio-catalytic activities, and then affects the whole
bioprocess. One common expression for modeling product inhibition is given in Equation 11.
n
µ̂ P
µ= 1 − (3. 11)
KS Pm
1 +
S S
BioMASS v2.0 was developed using Microsoft Visual Basic 2008, which contains
different input controls like text fields, option buttons, checkboxes, and command buttons. The
following is a sample of Visual Basic code to allow the user to add a second bioreactor in
“Reactor2GroupBox.Hide()”.The user needs to fill all the necessary data in the text fields and
make a choice from the available options to define the model. The results are then reported by
( ) ( )
Pt2 = Pt1 + [ k png * X t1 + k pg * µ * X t1 ] * (t 2 − t1 ) (3. 13)
( ) ( )
S t2 = S t1 − [ µ * X t1 / YX / S + k png * X t1 / YP / S ] * (t 2 − t1 ) (3. 14)
MODEL VALIDATION
Two case studies will be evaluated to compare simulated results with actual data.
39
Case study 1: Growth-associated product formation in batch reactor using single Monod’s
model
The bioprocess data and operating conditions required for simulation were gathered from
literature (Yu, 2007). In this case, fermentation used glucose as a single limiting nutrient, and
neapolitana was cultured at 77oC, and the batch growth was carried out in 20 hours. The
following input variables were used to run the simulation. The maintenance requirement for
P0 = 0, µ max = 0.94 h-1, K S = 0.57 g/L, b = 0.01 g/L, YX / S = 0.248 g XB/g S, YP / S = 0.0286 g H2/g
Batch fermentation
Simulation was carried out to determine the suitability of Monod’s model for hydrogen
production in a batch system. The experimental results reported in literature were used to verify
the models developed (Yu, 2007). The time course of predicted concentrations was compared
with experimental values (Fig 3.5). The effect of product inhibition was taken into consideration
with Pm = 27 mmol/L and n =1 (Drapcho, 2008). The Monod model was incorporated with
product inhibition kinetics to describe the batch growth of Thermotoga neapolitana. The
comparisons demonstrated a good agreement between data from simulations with experimental
data. After 20 hours of fermentation, biomass concentration of 0.5 g/L and hydrogen
40
Figure 3.5. Experimental (points) and simulated (lines) profiles of substrate, biomass and H2
concentration in a batch system including impact of H2 inhibition.
Figure 3.7 shows a plot of studentized residual against simulated biomass concentration.
concentration is evident, indicating some factor impacting biomass concentration is not being
41
Figure 3.6. Studentized residual plot for glucose concentration.
Figure 3.8 indicates that BioMASS accurately predicts H2 concentration, but with the
42
Figure 3.8. Studentized residual plot for Hydrogen concentration.
In Figure 3.9, significant differences between the experimental and simulated results
were observed when the impact of inhibition not included. The growth models that incorporate
the production inhibition parameter gave better fits to the experimental data compared to the
models with only growth parameters. The predicted concentrations of biomass and hydrogen
were much greater than those obtained from experiment, and glucose was depleted rapidly. After
was batch operation, which means no material was either added or removed from the bioreactor;
headspace gas was removed during incubation to avoid production prohibition, the hydrogen
43
Figure 3.9. Experimental (points) and simulated (lines) profiles of substrate, biomass and H2
concentration in a batch system without including impact of H2 inhibition.
When glucose was used as the carbon source, hydrogen production increased with an
simulated H2 production between initial glucose concentration of 5 g/L, 10 g/L and 20 g/L. Due
to the effect of product inhibition, there was no potential to increase hydrogen production in this
system, and 5 g/L is practical upper limit for initial glucose concentration if H2 gas is not
removed.
44
Figure 3.10. Simulated profiles of H2 concentration with various initial glucose concentration in
a batch system including impact of H2 inhibition.
A sensitivity analysis was conducted and compare with experimental data to determine
the impact of µ max , K S , and YX / S (Fig 3.11, 3.12, 3.13). Due to impact of product inhibition,
there is no change in final H2 concentration. However, the rate of hydrogen production was
increased with the increase of µ max . At µ max = 4.7 h -1 , 26.5 mmol/L of H2 was achieved only after
4 hours of fermentation (Fig 3.11). On the other hand, the rate of H2 production was decreased
K S = 2.85 g/L (Fig 3.12). In Figure 3.13, H2 concentration is increased with the increase of YX / S ;
g S. The results of sensitivity analysis demonstrated a good agreement between estimated values
45
Figure 3.11. Simulated profiles of H2 concentration with different µ max values in a batch system
including impact of H2 inhibition.
Figure 3.12. Simulated profiles of H2 concentration with different K S values in a batch system
including impact of H2 inhibition.
46
Figure 3.13. Simulated profiles of H2 concentration with different YX / S values in batch system
including impact of H2 inhibition.
CSTR fermentation
bioprocess under varying conditions. The results can be analyzed to allow process optimization.
In this case, in order to improve the production of hydrogen, CSTR operation was suggested. In a
batch system, the cumulative hydrogen production ceases once the cells reached their stationary
phase. Using a continuous system, it was possible to maintain the cell concentration by
maintaining a specific favorable retention time. Consumption of substrate was found to increase
with increase in retention time and the percent of glucose conversion was about 0.002% at a
47
Table 3.1. Simulated results of hydrogen production at different retention time.
1 0.002 0 0
10 98.538 1.1435 7
Figure 3.14 shows time course of substrate utilization, biomass growth and hydrogen
production in a CSTR system at HRT of 6 hours. After 12 hours, cell growth and product
formation entered a steady state. Two graphs were arranged vertically so that the user can easily
follow the changing of nutrient concentrations with time. Hydrogen production increased with
fermentation time. After 20 hours of fermentation, hydrogen concentration of 69.45 mmol/L was
achieved, corresponding to more 2.5 times than that of batch operation (27 mmol/L). The final
cell density climbed up to 1.14 g/L to compare with 0.43 g/L of batch operation.
48
Figure 3.14. Simulated results of hydrogen production in a CSTR system at HRT of 6h.
Figure 3.15 shows the simulation results of steady state concentration of glucose, biomass
and hydrogen. It was evident that steady state concentration of hydrogen increased when the
HRT was increased from 1 to 3 hours. After 3 hours, the concentrations remained almost
constant throughout the run. There was no siginificant difference in concentration of glucose,
biomass, and H2 between HRT of 3 hours and 10 hours. The minimum retention time should be
more than 1 hour. Low retention time may result in washout of slow growing cell.
49
Figure 3.15. Simulated profiles of glucose, biomass and H2 concentration at various retention
time in a CSTR system.
concentration of glucose were performed (Fig. 3.16). As a result, 69.45, 140.75 and 285.05
mmol/L of hydrogen concentration were obtained from 5, 10, and 20 g/L of glucose
concentration, respectively. The highest rate of hydrogen production for an initial substrate
concentration of 5 g/L was 34.05 mmol/L-h, whereas with an initial substrate concentration of 20
g/L the maximum rate of hydrogen production was 189.35 mmol/L-h (Table 3.2). The results
suggested that high production of hydrogen might be obtained if continuous operation was
employed.
50
Table 3.2. Simulated results of rate of H2 production with different initial substrate concentration
in a batch system.
5 69.45 34.05
10 140.75 82.5
20 285.05 189.35
Case study 2: Xylitol production from xylose and glucose as multiple substitutable nutrients
microorganism prefers glucose over the other and will inhibit the use of the xylose. Since
glucose (S1) is preferred, then the growth rate of the microorganism using xylose (S2) will be
51
S1
µ1 = µˆ (3. 15)
K S 1 + S1
S K
µ 2 = f * µˆ 2
K + S
S1
(3. 16)
K
S2 + S 2 S1 1
Yeast strain of Candida was cultured at 30oC, and the batch growth was carried out in 35
hours (Pfeifer, 1996). Xylitol production was modeled as nongrowth-associated product. The
following input variables were used to run the simulation. SGlu = 7 g/L, S Xyl = 28 g/L, X 0 = 0.01
g/L, P0 = 0, µ max = 0.8 h-1, f = 0.4, K S1 = 1 g/L, K S 2 = 7 g/L, b = 0.1 h-1, YX / SGlu = 0.16 g X/g SGlu,
YX / S Xyl = 0.45 g X/g SXyl, YP / S Xyl = 0.55 g xylitol/g xylose, k png = 0.3 g xylitol/g X.
The time course of predicted concentrations was compared with experimental values (Fig
3.17). After 10 hours of fermentation, glucose was utilized completely. After 20 hours of
fermentation, complete xylose utilization was observed and 17.57 g/L of xylitol concentration
was obtained. The comparisons demonstrated a good agreement between data from simulations
52
Figure 3.17. Experimental (points) and simulated (lines) profiles of glucose, xylose and xylitol
concentration in a batch system.
A same pattern of studentized residual was observed in Figure 3.19, indicating some
factor impacting xylitol concentration was not being considered during the simulation.
53
Figure 3.19. Studentized residual plot for xylitol concentration.
A sensitivity analysis was conducted and compare with experimental data to determine
the impact of µ max , K S , and YX / S (Fig 3.20, 3.21, 3.22, 3.23, 3.24). The results indicate that the
model is not sensitive to small changes in data. However, when those values were increased 20%
54
Figure 3.20. Simulated profiles of xylitol concentration with different µ max values in a batch
system.
Figure 3.21. Simulated profiles of xylitol concentration with different K S1 values in a batch
system.
55
Figure 3.22. Simulated profiles of xylitol concentration with different K S2 values in a batch
system.
Figure 3.23. Simulated profiles of xylitol concentration with different YX / S1 values in a batch
system.
56
Figure 3.24. Simulated profiles of xylitol concentration with different YX / S2 values in a batch
system.
To investigage the effect of ethanol on the xylitol production, simulation of glucose and
xylose fermentation was carried out to produce xylitol as non-growth associated product and
glucose) (Krishnan, 1999). As shown in Figure 3.25, all the glucose in the medium was
converted to ethanol before xylose utilization started. Ethanol production was very rapid and
occurred within 10 hours after the start of fermentation and remained almost constant throughout
the run. After 35 hours of fermentation, lower xylitol concentration of 15.76 g/L was achieved,
compared with 17.57 g/L in the absence of ethanol. It’s evident that the ethanol produced from
utilization of the glucose partitially inhibits xylitol formation; therefore, the presence of ethanol
could account for the decrease in the xylitol concentration. Although the effect is not significant,
57
if xylitol is the desired product, it would be necessary to remove the ethanol formed from the
Figure 3.25. Simulated profiles of glucose, xylose, xylitol and ethanol concentration in a batch
system.
The initial glucose concentration was varied from 0 g/L to 112 g/L to evaluate its effect
on the fermentation, while the initial xylose concentration of 28 g/L remained the same (Table
3.3). A higher concentration of glucose produced a higher concentration of ethanol, while during
the increase of xylose concentration, ethanol concentration was approximately the same (Table
3.4). This was because ethanol mostly produced by the fermentation of glucose. The effect of
different ratio of glucose to xylose on xylitol production rate was investigated. At the ratio of
0:1, there is no glucose and the fermentation process uses xylose as single limiting nutrient, only
3.91 g/L of xylitol concentration was observed, which is lower than value obtained at the feeding
ratio of 0.25:1 (14.73 g/L) or 0.5:1 (16.52 g/L). The initial glucose concentration is an important
factor to obtain a high xylitol production. However, at high concentration of glucose, xylose
58
utilization was repressed and ethanol produced from glucose caused reduction in xylitol
concentration. Therefore, the xylitol production rate at the ratio of 2:1 (1.74 g/L-h) was lower
than the value obtained at the ratio of 1:2 (2.52 g/L-h). In this study, the xylitol concentration
Table 3.3. Simulated results of xylitol and ethanol concentration with different initial glucose
concentration in a batch system.
0.5:1 (14 g/L Glu + 28 g/L Xyl) 16.52 3.97 1.02 1.71
1:1 (28 g/L Glu + 28 g/L Xyl) 19.27 7.98 1.26 3.9
2:1 (56 g/L Glu +28g/L Xyl) 24.29 16.12 1.74 8.6
4:1 (112 g/L Glu + 28 g/L Xyl) 33.78 32.07 2.68 18.45
Table 3.4. Simulated results of xylitol and ethanol concentration with different initial xylose
concentration in a batch system.
1:0.25 (28 g/L Glu + 7 g/L Xyl) 7.43 7.99 0.54 3.87
1:0.5 (28 g/L Glu + 14 g/L Xyl) 11.06 7.99 0.72 3.88
1:1 (28 g/L Glu + 28 g/L Xyl) 19.27 7.99 1.26 3.9
1:2 (28 g/L Glu + 56 g/L Xyl) 36.38 7.99 2.52 3.91
59
1:4 (28 g/L Glu + 112 g/L Xyl) 70.13 7.99 5.25 3.91
CONCLUSION
Experimental data was used to verify the model established in this work, and satisfactory
simulation results were obtained. With the verification of two cases for production of hydrogen
and xylitol, the model in the present work were demonstrated to be suitable for describing the
kinetics of substrate utilization, biomass growth and product formation, which can thus be used
for optimizing the process. By using BioMASS v2.0, the users can perform a series of “what if”
simulations assuming different process scenarios. In addition, the program provides a cheaper
alternative for the user compared with costly commercial software. SuperPro or Aspen can
provide sophisticated modeling for bioprocess. However, such simplified program as BioMASS
is still very useful, which can model typical biological systems with satisfactory results.
ACKNOWLEDMENTS
I wish to express my deepest gratitude to Dr. Caye Drapcho for suggesting the topic of
this thesis as well as her professional guidance and constructive criticism. I am also greatly
indebted to Dr. Nhuan Nghiem, whose valuable advices, and enduring motivation and support
were of inestimable value. Sincere thanks are also to him for critical review of my thesis. I also
would like to thank Dr. Walker for giving useful lectures which helped me a lot to complete this
thesis.
60
REFERENCES
Birol, G., Undey, C., Cinar, A., A modular simulation package for fed-batch fermentation:
Drapcho, C. M., Nghiem, P. N., Walker, T. W., Biofuel engnieering process technology, 2008.
GimBun, J., Radiah, A. B. D., Chuah, T. G., Bioreactor design via spreadsheet - a study on the
Krishnan, M. S., Fermentation kinetics of ethanol production from glucose and xylose by
Nemeth, A., Sevella, B., Development of a new bioprocess for production of 1,3 – propandiol I.:
Rizzo, D. M., The comparison of four dynamic systems-based software packages: Translation
Pfeifer, M. J., Effect of culture conditions on Xylitol production by Candida guilliermondii FTI
Shanklin, T., Selection of bioprocess simulation software for industrial applications, Biotechnol
Bioeng, 2000.
Shi, J., Functional Food Ingredients and Nutraceuticals: Processing Technologies (Functional
2007.
61
Chapter 4
CONCLUSION
Experimental data was used to verify the model established in this work, and satisfactory
simulation results were obtained. With the verification of two cases for production of hydrogen
and xylitol, the model in the present work were demonstrated to be suitable for describing the
kinetics of substrate utilization, biomass growth and product formation, which can thus be used
for optimizing the process. By using BioMASS v2.0, the users can perform a series of “what if”
simulations assuming different process scenarios. In addition, the program provides a cheaper
alternative for the user compared with costly commercial software. SuperPro or Aspen can
provide sophisticated modeling for bioprocess. However, such simplified program as BioMASS
is still very useful, which can model typical biological systems with satisfactory results.
Future Scope
be designed to allow the user to investigate the effect of pH on final concentrations. Moreover,
besides batch and CSTR operation, fed-batch approach is popular for using in fermentation
process; therefore, BioMASS application should also include it. BioMASS v1.0 and v2.0 were
only designed to work on Window platform, future working system of BioMASS can be Mac
62
APPENDICES
63
APPENDIX A
Menu Bar
The menu bar lists the available menus. A menu contains a list of commands. Some
commands carry out an action immediately; others display a dialog box so that the users can
select options. The user will know that a command will display a dialog box if it is followed by
three periods (...). The user can choose commands from a menu or toolbar, or the user can use
shortcut keys. The keyboard shortcut keys are listed on the menu to the right of the command.
The menu bar at the top of the screen containing the following headings: File, View, Tools,
- File Menu:
• Irreversible Chemical Kinetics: This command has three sub choices of “Zero
• Biological Kinetics: This command has three sub choices of “Single Limiting
• Open File: This command brings up a dialog box to open a previous saved file.
• Save Data: Choosing this option will raise a dialog that allows you to determine
the location in which you want the current simulation to be saved and the name
64
under which you want to save it. Since BioMASS only supports file format of
Excel, the filename will always end in .xls. To use this option, the user should
have the corresponding Microsoft Excel object, which is usually supplied with the
• Save All: It is the same as “Save Data”, but this command allows the user to save
• Print Preview.
• Print: The user can choose File > Print or Ctrl + P keyboard shortcut to print the
current window.
• Exit: Use this command to exit the program. If any test results remain open, a
dialog will appear asking whether or not the user wishes to save the results.
- View Menu:
65
• Toolbar: Select the command when the user wants to show or hide the toolbar.
Check mark is display in the menu when the corresponding option is selected.
• Status Bar: This command displays or hides the status bar at the bottom of the
main window, which shows information about the current state of the program.
Check mark is display in the menu when the corresponding option is selected.
• Full Screen/ Exit Full Screen: In full screen view, the application window is
maximized and status bar as well as toolbar is removed. The users can restore
• Show Start Page: Click this command to show the Start Page again.
- Tools Menu:
66
• Zoom in: The size of image can be changed by using the Zoom-in (+) commands
on the View menu. This function lets the users get a closer view of bioreactors.
• Clear Form: BioMASS v1.0 does not allow the users to view and compare the
Fortunately, BioMASS v2.0 can handle that. When the users click on a button of
“Zero Order” or “First Order” or “Second Order” on standard toolbar, the current
project is opened, not a new project. Therefore, if the users want to start a new
project, they need to click on “Clear All” to clear all data and results of the
current project. In other words, choosing this option will erase all existing
- Windows Menu: When the user has multiple windows open, they can be arranges that the user
67
• Cascade: An arrangement of windows such that they overlap one another.
Typically, the title bar remains visible so that the user can always see which
• Tile Vertical: Every window is completely visible, and they are arranged
vertically.
• Tile Horizontal: Every window is completely visible, and they are arranged
horizontally.
- Help Menu:
68
• Notebook: This command brings up a window that introduces frequently asked
questions, listed in alphabetical order, along with short answers, images, and
• About Biomass v2.0: Displays the version number of this application and
69
Figure A. 6. “About BioMASS v2.0” window.
Standard Toolbar
70
This toolbar includes commands that are used more often. They are arranged in a toolbar
to faster access with a mouse click. Tooltips explaining the functions of each button are
displayed if you hold the mouse pointer over the desire button.
Icon is a considerably important part in user interface. It means that users can understand
the function represented by the icon and further learn how to use the function. Icon interface can
reduce the trouble of memorizing functions for users. The list of command icons and their
Icon Description
71
Zoom In selected images.
Calculation Toolbar
Icon Description
Results can be presented in suitable graphs. Click this button to view them.
Scroll Bars
When the window is zoomed-in or zoomed-out, Scroll Bars appear that you can use to
view information that exists beyond the borders of the window. When you can view all the
contents of the window without scrolling, the Scroll Bars are absent. Drag a Scroll Box or click
72
Figure A. 8. Scroll Bar and Status Bar
Status Bar
The status bar is displayed at the bottom of BioMASS window. The left side of the status
bar is “Progress Bar”. When “Progress Bar” is full, it indicates that the program is ready;
otherwise, it indicates that the program is running. The right side of the status bar shows the
current date and time and indicators of the following keys when they are latched down:
Indicator Description
73
CAP The Caps Lock key is latched down.
Default values for most of the input parameters required for simulating the effects of each
operation are already preset and displayed the first time you open the input simulation dialog for
operation.
74
APPENDIX B
The following are common questions which are listed in alphabetical order, along with short
answers, images, and an animation to help the user has a better understanding about bioprocess.
Arrhenius equation which was created in 1889, by Svante Arrhenius, a chemist from Sweden.
k = A * e − Ea / RT
where:
k: rate constant. The unit will vary depending on the order of the reaction.
different reactions.
Ea: activation energy, (KJ/mol ). This is the minimum energy needed for the reaction to
occur.
T: the absolute temperature in which the reaction takes place, and has to be measured in
Kelvin.
75
- The effect of a change of temperature: If the temperature is increased, (-Ea/RT) is a smaller
number; therefore, A*exp(-Ea/RT) is a larger number. This means the rate constant will be
- The effect of a catalyst: Catalyst is a substance that provides an alternative way, which has
lower activation energy, for the reaction to happen. If Ea is decreased, (-Ea/RT) is a smaller
number; therefore, A*exp(-Ea/RT) is a larger number. This means the rate constant will be larger
A: This is the minimum energy needed for the reaction to occur. Before the reactants can be
converted into products, the free energy of the system must overcome the activation energy for
the reaction.
A: Operation is characterized by three periods of time: the filling period, the cell growth period,
and the emptying period. No additional material is added or removed from the bioreactor.
Concentration of biomass, substrate, and product change continuously with respect to time.
A: A competitive inhibitor has a shape similar to that of the normal substrate. The substrate and
inhibitor compete for the active site. If the inhibitor binds to the active site, it prevents the
76
Q: What are complementary substrates?
A: Complementary substrates are those that meet different needs for the microorganism. For
example: oxygen may serve as electron acceptor for yeast growth while glucose serve as electron
donor.
If complementary substrates are present in the media, there can be an interactive model (both
substrates influence growth rate) or non-interactive model (assumes that one substrate limits
growth).
A: The substrate is continuously fed to the bioreactor whereas the broth is continuously
withdrawn at rate equal to feed rate to maintain constant bioreactor volume. The bioreactor will
achieve a steady state after a transient period. Also, this is an open system with constant reaction
In order to overcome washout problems and increase cell concentration within the continuous
bioreactor, a portion of cells from the outlet stream can be recycled back to the bioreactor.
A: Rate is directly proportional to the concentration of the reactant. Doubling the concentration
rate = −k[ A]
A
ln = −kt
A0
77
where: A, A0:concentration of A (mass/volume) at t, t = 0, respectively
t: reaction time
A: It is a simplified or overall reaction that occurs in a biological system usually with respect to a
single compound.
A
→
k
B
A: The interactive model is based on the assumption that both (or all) of the complementary
substrates can influence the specific growth rate. For a two complementary substrate system then
S1 S 2
µ = µˆ
K S + S1 K S + S 2
1 2
where:
S1 is the substrate 1
S2 is the substrate 2
78
Q: What is multistage system?
A: A second reactor is added in series with the first rector such that the output of first reactor is
the input for second reactor. Therefore, the final concentration in the first reactor becomes the
A: A non-competitive inhibitor does not bind to the active site but attaches to an enzyme at some
other place. The attachment causes the shape of the active site to change, preventing the
A: The non-interactive model is based on the assumption that only one nutrient can be rate
limiting at a time. For a two complementary substrate system then the specific growth rate is
given as:
S1 S 2
µ = µˆ ,
K S1 + S1 K S2 + S 2
where:
S1 is the substrate 1
S2 is the substrate 2
79
A: At high product concentrations, microbial growth rate is inhibited by the product. Product
rate = − k [ A]
m
where:
k: rate constant
The reaction order is integral (0, 1, 2...), but fractional orders such as 3/2 are possible.
rate = − k [ A]
2
The rate is to the square of the concentration of the reactant. Doubling the concentration
1 1
− = kt
[A] [A0 ]
where: A, A0 is concentration of A (mass/volume) at t, t = 0, respectively
t: reaction time
80
If the reaction is second-order, a plot of 1/[A] verus t should be linear.
A: Steady state is the one in which there are no accumulations of the constituent in the reactor.
A: Substitutable substrates are those that meet the same needs for the microorganism. For
example: glucose and xylose use by yeasts such as Candida may be viewed as substitutable
substrates. If substituable substrate are present in the media, one compound may be preferred by
A: At high substrate concentrations, microbial growth rate is inhibited by the substrate. Substrate
A: Transient state is the one in which there are mass accumulations of the constituent in the
A: The term xenobiotic is derived from the Greek words xenos = foreigner, stranger and bios =
life. A xenobiotic is a chemical which is found in an organism but which is not normally
81
produced in it. For example, antibiotics are xenobiotics in humans because the human body does
The term xenobiotics is very often used in the context of pollutants, and some of them are
resistant to degradation.
rate.
rate = −k
[A] − [A0 ] = kt
where:
t: reaction time
82
APPENDIX C
'BackColor
BatchPicturePanel.BackColor = Color.White
CSTRPicturePanel.BackColor = Color.White
ChemKineticsPanel.AutoScroll = True
ChemKineticsPanel.Dock = DockStyle.Fill
'Reactant Name
ReactantNameComboBox.Items.Add("Reactant")
ReactantNameComboBox.Text = ReactantNameComboBox.Items(0).ToString
'Product Name
ProductNameComboBox.Items.Add("Product")
ProductNameComboBox.Text = ProductNameComboBox.Items(0).ToString
'Button
BackToolStripButton.Enabled = False
CalculateToolStripButton.Enabled = True
GraphToolStripButton.Enabled = False
TableToolStripButton.Enabled = False
'Operation Parameters
Call ChemReactor1_Load()
Call ChemReactor2_Load()
'Enable
Call ClickClickClick()
'Show GroupBox
Call ShowGroupBox()
End Sub
#End Region
'Reactor 2
SimulationTimeR2ComboBox.Text = "(mins)"
StepTimeR2ComboBox.Text = "(mins)"
FlowRateR2ComboBox.Text = "(L/mins)"
RetentionTimeR2ComboBox.Text = "(mins)"
DilutionRateR2ComboBox.Text = "(1/mins)"
ConstkR2ComboBox.Text = "(mg/L-mins)"
'Reactor 2
83
SimulationTimeR2ComboBox.Text = "(mins)"
StepTimeR2ComboBox.Text = "(mins)"
FlowRateR2ComboBox.Text = "(L/mins)"
RetentionTimeR2ComboBox.Text = "(mins)"
DilutionRateR2ComboBox.Text = "(1/mins)"
ConstkR2ComboBox.Text = "(g/L-mins)"
'Reactor 2
SimulationTimeR2ComboBox.Text = "(mins)"
StepTimeR2ComboBox.Text = "(mins)"
FlowRateR2ComboBox.Text = "(m3/mins)"
RetentionTimeR2ComboBox.Text = "(mins)"
DilutionRateR2ComboBox.Text = "(1/mins)"
ConstkR2ComboBox.Text = "(g/m3-mins)"
'Reactor 2
SimulationTimeR2ComboBox.Text = "(mins)"
StepTimeR2ComboBox.Text = "(mins)"
FlowRateR2ComboBox.Text = "(m3/mins)"
RetentionTimeR2ComboBox.Text = "(mins)"
DilutionRateR2ComboBox.Text = "(1/mins)"
ConstkR2ComboBox.Text = "(mg/m3-mins)"
'Reactor 2
SimulationTimeR2ComboBox.Text = "(hours)"
StepTimeR2ComboBox.Text = "(hours)"
FlowRateR2ComboBox.Text = "(L/hours)"
RetentionTimeR2ComboBox.Text = "(hours)"
DilutionRateR2ComboBox.Text = "(1/hours)"
ConstkR2ComboBox.Text = "(mg/L-hours)"
'Reactor 2
SimulationTimeR2ComboBox.Text = "(hours)"
StepTimeR2ComboBox.Text = "(hours)"
FlowRateR2ComboBox.Text = "(L/hours)"
RetentionTimeR2ComboBox.Text = "(hours)"
DilutionRateR2ComboBox.Text = "(1/hours)"
ConstkR2ComboBox.Text = "(g/L-hours)"
'Reactor 2
SimulationTimeR2ComboBox.Text = "(hours)"
StepTimeR2ComboBox.Text = "(hours)"
84
FlowRateR2ComboBox.Text = "(m3/hours)"
RetentionTimeR2ComboBox.Text = "(hours)"
DilutionRateR2ComboBox.Text = "(1/hours)"
ConstkR2ComboBox.Text = "(g/m3-hours)"
'Reactor 2
SimulationTimeR2ComboBox.Text = "(hours)"
StepTimeR2ComboBox.Text = "(hours)"
FlowRateR2ComboBox.Text = "(m3/hours)"
RetentionTimeR2ComboBox.Text = "(hours)"
DilutionRateR2ComboBox.Text = "(1/hours)"
ConstkR2ComboBox.Text = "(mg/m3-hours)"
'Reactor 2
SimulationTimeR2ComboBox.Text = "(days)"
StepTimeR2ComboBox.Text = "(days)"
FlowRateR2ComboBox.Text = "(L/days)"
RetentionTimeR2ComboBox.Text = "(days)"
DilutionRateR2ComboBox.Text = "(1/days)"
ConstkR2ComboBox.Text = "(mg/L-days)"
'Reactor 2
SimulationTimeR2ComboBox.Text = "(days)"
StepTimeR2ComboBox.Text = "(days)"
FlowRateR2ComboBox.Text = "(L/days)"
RetentionTimeR2ComboBox.Text = "(days)"
DilutionRateR2ComboBox.Text = "(1/days)"
ConstkR2ComboBox.Text = "(g/L-days)"
'Reactor 2
SimulationTimeR2ComboBox.Text = "(days)"
StepTimeR2ComboBox.Text = "(days)"
FlowRateR2ComboBox.Text = "(m3/days)"
RetentionTimeR2ComboBox.Text = "(days)"
DilutionRateR2ComboBox.Text = "(1/days)"
ConstkR2ComboBox.Text = "(g/m3-days)"
'Reactor 2
SimulationTimeR2ComboBox.Text = "(days)"
StepTimeR2ComboBox.Text = "(days)"
FlowRateR2ComboBox.Text = "(m3/days)"
RetentionTimeR2ComboBox.Text = "(days)"
85
DilutionRateR2ComboBox.Text = "(1/days)"
ConstkR2ComboBox.Text = "(mg/m3-days)"
End If
End Sub
#End Region
'Reactor 2
StepTimeR2ComboBox.Text = "(hours)"
SimulationTimeR2ComboBox.Text = "(hours)"
'Reactor 2
StepTimeR2ComboBox.Text = "(days)"
SimulationTimeR2ComboBox.Text = "(days)"
End If
End Sub
#End Region
End Sub
#End Region
End Sub
#End Region
'Reactor 2
StepTimeR2ComboBox.Text = "(mins)"
FlowRateR2ComboBox.Text = "(L/mins)"
RetentionTimeR2ComboBox.Text = "(mins)"
DilutionRateR2ComboBox.Text = "(1/mins)"
ConstkR2ComboBox.Text = "(mg/L-mins)"
86
ReactantConcComboBox.Text = "(g/L)" Then
'Reactor 1
SimulationTimeComboBox.Text = "(mins)"
FlowRateComboBox.Text = "(L/mins)"
RetentionTimeComboBox.Text = "(mins)"
DilutionRateComboBox.Text = "(1/mins)"
ConstkComboBox.Text = "(g/L-mins)"
'Reactor 2
StepTimeR2ComboBox.Text = "(mins)"
FlowRateR2ComboBox.Text = "(L/mins)"
RetentionTimeR2ComboBox.Text = "(mins)"
DilutionRateR2ComboBox.Text = "(1/mins)"
ConstkR2ComboBox.Text = "(g/L-mins)"
'Reactor 2
StepTimeR2ComboBox.Text = "(mins)"
FlowRateR2ComboBox.Text = "(m3/mins)"
RetentionTimeR2ComboBox.Text = "(mins)"
DilutionRateR2ComboBox.Text = "(1/mins)"
ConstkR2ComboBox.Text = "(g/m3-mins)"
'Reactor 2
StepTimeR2ComboBox.Text = "(mins)"
FlowRateR2ComboBox.Text = "(m3/mins)"
RetentionTimeR2ComboBox.Text = "(mins)"
DilutionRateR2ComboBox.Text = "(1/mins)"
ConstkR2ComboBox.Text = "(mg/m3-mins)"
'Reactor 2
StepTimeR2ComboBox.Text = "(hours)"
FlowRateR2ComboBox.Text = "(L/hours)"
RetentionTimeR2ComboBox.Text = "(hours)"
DilutionRateR2ComboBox.Text = "(1/hours)"
ConstkR2ComboBox.Text = "(mg/L-hours)"
'Reactor 2
StepTimeR2ComboBox.Text = "(hours)"
FlowRateR2ComboBox.Text = "(L/hours)"
RetentionTimeR2ComboBox.Text = "(hours)"
DilutionRateR2ComboBox.Text = "(1/hours)"
ConstkR2ComboBox.Text = "(g/L-hours)"
87
SimulationTimeComboBox.Text = "(hours)"
FlowRateComboBox.Text = "(m3/hours)"
RetentionTimeComboBox.Text = "(hours)"
DilutionRateComboBox.Text = "(1/hours)"
ConstkComboBox.Text = "(g/m3-hours)"
'Reactor 2
StepTimeR2ComboBox.Text = "(hours)"
FlowRateR2ComboBox.Text = "(m3/hours)"
RetentionTimeR2ComboBox.Text = "(hours)"
DilutionRateR2ComboBox.Text = "(1/hours)"
ConstkR2ComboBox.Text = "(g/m3-hours)"
'Reactor 2
StepTimeR2ComboBox.Text = "(hours)"
FlowRateR2ComboBox.Text = "(m3/hours)"
RetentionTimeR2ComboBox.Text = "(hours)"
DilutionRateR2ComboBox.Text = "(1/hours)"
ConstkR2ComboBox.Text = "(mg/m3-hours)"
'Reactor 2
StepTimeR2ComboBox.Text = "(days)"
FlowRateR2ComboBox.Text = "(L/days)"
RetentionTimeR2ComboBox.Text = "(days)"
DilutionRateR2ComboBox.Text = "(1/days)"
ConstkR2ComboBox.Text = "(mg/L-days)"
'Reactor 2
StepTimeR2ComboBox.Text = "(days)"
FlowRateR2ComboBox.Text = "(L/days)"
RetentionTimeR2ComboBox.Text = "(days)"
DilutionRateR2ComboBox.Text = "(1/days)"
ConstkR2ComboBox.Text = "(g/L-days)"
'Reactor 2
StepTimeR2ComboBox.Text = "(days)"
FlowRateR2ComboBox.Text = "(m3/days)"
RetentionTimeR2ComboBox.Text = "(days)"
DilutionRateR2ComboBox.Text = "(1/days)"
ConstkR2ComboBox.Text = "(g/m3-days)"
88
RetentionTimeComboBox.Text = "(days)"
DilutionRateComboBox.Text = "(1/days)"
ConstkComboBox.Text = "(mg/m3-days)"
'Reactor 2
StepTimeR2ComboBox.Text = "(days)"
FlowRateR2ComboBox.Text = "(m3/days)"
RetentionTimeR2ComboBox.Text = "(days)"
DilutionRateR2ComboBox.Text = "(1/days)"
ConstkR2ComboBox.Text = "(mg/m3-days)"
End If
End Sub
#End Region
'Reactor 2
StepTimeR2ComboBox.Text = "(hours)"
End If
End Sub
#End Region
#End Region
'Reactor 2
SimulationTimeR2ComboBox.Text = ""
StepTimeR2ComboBox.Text = ""
VolumeR2ComboBox.Text = ""
FlowRateR2ComboBox.Text = ""
DilutionRateR2ComboBox.Text = ""
RetentionTimeR2ComboBox.Text = ""
ConstkR2ComboBox.Text = ""
End Sub
#End Region
'ComboBox
Private Sub ChemReactor1ComboBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles ReactantConcComboBox.KeyPress, _
ProductConcComboBox.KeyPress, _
ReactionOrderTextBox.KeyPress, _
SimulationTimeComboBox.KeyPress, _
StepTimeComboBox.KeyPress, _
VolumeComboBox.KeyPress, _
FlowRateComboBox.KeyPress, _
RetentionTimeComboBox.KeyPress, _
DilutionRateComboBox.KeyPress, _
ConstkComboBox.KeyPress
e.Handled = True
End Sub
89
'Textbox
Private Sub ChemReactor1TextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles ReactantConcTextBox.KeyPress, _
ProductConcTextBox.KeyPress, _
SimulationTimeTextBox.KeyPress, _
StepTimeTextBox.KeyPress, _
VolumeTextBox.KeyPress, _
FlowRateTextBox.KeyPress, _
RetentionTimeTextBox.KeyPress, _
DilutionRateTextBox.KeyPress, _
ConstkTextBox.KeyPress
End If
End Sub
#End Region
'ComboBox
Private Sub ChemReactor2ComboBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles ReactionOrderR2TextBox.KeyPress, _
SimulationTimeR2ComboBox.KeyPress, _
StepTimeR2ComboBox.KeyPress, _
VolumeR2ComboBox.KeyPress, _
FlowRateR2ComboBox.KeyPress, _
RetentionTimeR2ComboBox.KeyPress, _
DilutionRateR2ComboBox.KeyPress, _
ConstkR2ComboBox.KeyPress
e.Handled = True
End Sub
'Textbox
Private Sub ChemReactor2TextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles SimulationTimeR2TextBox.KeyPress, _
StepTimeR2TextBox.KeyPress, _
VolumeR2TextBox.KeyPress, _
FlowRateR2TextBox.KeyPress, _
RetentionTimeR2TextBox.KeyPress, _
DilutionRateR2TextBox.KeyPress, _
ConstkR2TextBox.KeyPress
End If
End Sub
#End Region
#End Region
ModelGroupBox.Hide()
Add2ndReactorCheckBox.Hide()
Reactor1GroupBox.Hide()
Reactor2GroupBox.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
ResultGroupBox.Hide()
GraphGroupBox.Hide()
TableGroupBox.Hide()
End Sub
#End Region
90
'PictureBox
'Batch
If BatchRadioButton.Checked = True AndAlso _
Add2ndReactorCheckBox.Checked = False Then
OperationModeToolStripLabel.Text = "Batch"
BatchPicturePanel.Show()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
BatchSeriesPicturePanel.Show()
BatchSeriesPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
BatchSeriesPicturePanel.Width = BatchPicturePanel.Width
BatchSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
End If
CSTRPicturePanel.Width = BatchPicturePanel.Width
CSTRPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
CSTRSeriesPicturePanel.Show()
CSTRSeriesPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRSeriesPicturePanel.Width = BatchPicturePanel.Width
CSTRSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
End If
CSTRPicturePanel.Width = BatchPicturePanel.Width
CSTRPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
ElseIf CSTRSteadyStateRadioButton.Checked = True AndAlso _
Add2ndReactorCheckBox.Checked = True Then
OperationModeToolStripLabel.Text = "CSTR Steady State MultiStage"
91
CSTRSeriesPicturePanel.Show()
CSTRSeriesPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRSeriesPicturePanel.Width = BatchPicturePanel.Width
CSTRSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
End If
End Sub
#End Region
ReactionGroupBox.Show()
ModelGroupBox.Show()
Add2ndReactorCheckBox.Show()
Reactor1GroupBox.Show()
End Sub
#End Region
xTimeStepComboBox.Items.Clear()
y1ReactantConcR1StepComboBox.Items.Clear()
y2ProductConcR1StepComboBox.Items.Clear()
'Reactor 2
xTimeR2ComboBox.Items.Clear()
y1ReactantConcR2ComboBox.Items.Clear()
y2ProductConcR2ComboBox.Items.Clear()
xTimeR2StepComboBox.Items.Clear()
y1ReactantConcR2StepComboBox.Items.Clear()
y2ProductConcR2StepComboBox.Items.Clear()
End Sub
#End Region
BackToolStripButton.Enabled = False
CalculateToolStripButton.Enabled = True
GraphToolStripButton.Enabled = True
TableToolStripButton.Enabled = True
End If
End If
End Sub
#End Region
92
If TempCorrectionCheckBox.Checked = True Then
'Save value
ConstantKToolStripLabel.Text = ConstkTextBox.Text
End If
End Sub
End If
End Sub
#End Region
#End Region
'Reactant Concentration
ReactantConcComboBox.Items.Add("(mg/L)")
ReactantConcComboBox.Items.Add("(mg/m3)")
ReactantConcComboBox.Items.Add("(g/L)")
ReactantConcComboBox.Items.Add("(g/m3)")
ReactantConcComboBox.Text = ReactantConcComboBox.Items(0).ToString
'Change Unit
Call ChangeUnit_ReactantConc()
Call ChangeUnit_ReactantConc_SaveVolume()
Call ChangeUnit_SimulationTime()
Call ChangeUnit_SimulationTime_Volume_ReactantConc()
End Sub
#End Region
93
Handles FlowRateRadioButton.Click
'Clear
RetentionTimeTextBox.Clear()
DilutionRateTextBox.Clear()
Call FDtauRadioButton_Click()
End Sub
#End Region
Call FDtauRadioButton_Click()
End Sub
#End Region
Call FDtauRadioButton_Click()
End Sub
#End Region
Call ChangeUnit_SimulationTime()
Call ChangeUnit_SimulationTime_Volume_ReactantConc()
End Sub
#End Region
Call ChangeUnit_ReactantConc_SaveVolume()
Call ChangeUnit_SimulationTime_Volume_ReactantConc()
End Sub
#End Region
Call ChangeUnit_ReactantConc()
Call ChangeUnit_ReactantConc_SaveVolume()
Call ChangeUnit_SimulationTime_Volume_ReactantConc()
End Sub
#End Region
94
VolumeR2TextBox.Clear()
FlowRateR2TextBox.Clear()
RetentionTimeR2TextBox.Clear()
DilutionRateR2TextBox.Clear()
'PictureBox
Call ShowPictureBox()
'Enable
Call BatchCSTRRadioButton_Click()
End If
End Sub
VolumeR2TextBox.Clear()
FlowRateR2TextBox.Clear()
RetentionTimeR2TextBox.Clear()
DilutionRateR2TextBox.Clear()
'PictureBox
Call ShowPictureBox()
'Enable
Call BatchCSTRRadioButton_Click()
End If
End Sub
VolumeR2TextBox.Clear()
FlowRateR2TextBox.Clear()
RetentionTimeR2TextBox.Clear()
DilutionRateR2TextBox.Clear()
'PictureBox
Call ShowPictureBox()
'Enable
Call BatchCSTRRadioButton_Click()
End Sub
#End Region
End Sub
#End Region
#End Region
End Sub
#End Region
95
#Region "Click - Chem Flow rate Reactor 2"
Private Sub ChemFlowRate2RadioButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles FlowRateR2RadioButton.Click
RetentionTimeR2TextBox.Clear()
DilutionRateR2TextBox.Clear()
Call FDtauR2RadioButton_Click()
End Sub
#End Region
VolumeR2TextBox.Clear()
FlowRateR2TextBox.Clear()
DilutionRateR2TextBox.Clear()
Call FDtauR2RadioButton_Click()
End Sub
#End Region
VolumeR2TextBox.Clear()
FlowRateR2TextBox.Clear()
RetentionTimeR2TextBox.Clear()
Call FDtauR2RadioButton_Click()
End Sub
#End Region
End Sub
#End Region
#End Region
'ChemReactor1
Private R1ReactantConc As String
Private R1ProductConc As String
Private R1SimulationTime As String
Private R1TimeInterval As String
'ChemReactor2
Private R2ReactantConc As String
Private R2ProductConc As String
Private R2SimulationTime As String
Private R2TimeInterval As String
96
Private R2RetentionTime As String
Private R2DilutionRate As String
Private R2ConstantK As String
'Graph
'Reactor 1
Private numItm As Integer
Private xAdd As Double
'Reactor 2
Private numItmR2 As Integer
Private xAddR2 As Double
'Calculation
'Reactor 1
Private R1CAs_Zero As Double
'Reactor 2
Private R2CAs_Zero As Double
#End Region
R1ReactantConc = ReactantConcTextBox.Text
R1ProductConc = ProductConcTextBox.Text
R1SimulationTime = SimulationTimeTextBox.Text
R1TimeInterval = StepTimeTextBox.Text
R1Volume = VolumeTextBox.Text
R1FlowRate = FlowRateTextBox.Text
R1RetentionTime = RetentionTimeTextBox.Text
R1DilutionRate = DilutionRateTextBox.Text
R1ConstantK = ConstkTextBox.Text
'Convert to Decimal
'Reactant Concentration
If R1ReactantConc = "" Then
R1C0 = 0
Else
R1C0 = CDec(R1ReactantConc)
End If
'Product concentration
If R1ProductConc = "" Then
R1P0 = 0
Else
R1P0 = CDec(R1ProductConc)
End If
97
'Simulation time
If R1SimulationTime = "" Then
R1Time = 0
Else
R1Time = CDec(R1SimulationTime)
End If
'Step time
If R1TimeInterval = "" Then
R1deltaI = 0.1
Else
R1deltaI = CDec(R1TimeInterval)
End If
'Volume
If R1Volume = "" Then
R1V = 0
Else
R1V = CDec(R1Volume)
End If
'Flow rate
If R1FlowRate = "" Then
R1F = 0
Else
R1F = CDec(R1FlowRate)
End If
'Retention time
If R1RetentionTime = "" Then
R1tau = 0
Else
R1tau = CDec(R1RetentionTime)
End If
'Dilution time
If R1DilutionRate = "" Then
R1D = 0
Else
R1D = CDec(R1DilutionRate)
End If
'Constant K
If R1ConstantK = "" Then
R1ConstK = 0
Else
R1ConstK = CDec(R1ConstantK)
End If
End Sub
#End Region
R2SimulationTime = SimulationTimeR2TextBox.Text
R2TimeInterval = StepTimeR2TextBox.Text
R2Volume = VolumeR2TextBox.Text
R2FlowRate = FlowRateR2TextBox.Text
R2RetentionTime = RetentionTimeR2TextBox.Text
R2DilutionRate = DilutionRateR2TextBox.Text
R2ConstantK = ConstkR2TextBox.Text
'Convert to Decimal
'Simulation time
If R2SimulationTime = "" Then
R2Time = 0
Else
R2Time = CDec(R2SimulationTime)
End If
'Step time
If R2TimeInterval = "" Then
R2deltaI = 0.1
Else
R2deltaI = CDec(R2TimeInterval)
End If
'Volume
If R2Volume = "" Then
R1V = 0
Else
R2V = CDec(R2Volume)
End If
'Flow rate
If R2FlowRate = "" Then
R2F = 0
Else
98
R2F = CDec(R2FlowRate)
End If
'Retention time
If R2RetentionTime = "" Then
R2tau = 0
Else
R2tau = CDec(R2RetentionTime)
End If
'Dilution time
If R2DilutionRate = "" Then
R2D = 0
Else
R2D = CDec(R2DilutionRate)
End If
'Constant K
If R2ConstantK = "" Then
R2ConstK = 0
Else
R2ConstK = CDec(R2ConstantK)
End If
End Sub
#End Region
End Sub
#End Region
#Region "FindSteadyTime_Reactor1"
'Exit
Exit For
End If
99
R1PtiTempSteady = R1PtiSteady
Else
R1PtiTempSteady = 0
End If
End If
End Sub
#End Region
#Region "FindSteadyTime_Reactor2"
'Exit
Exit For
End If
End If
End Sub
#End Region
'///Cancel Progress
100
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientStateRadioButton.Checked = True Then
If SimulationTimeTextBox.Text = "" Then
SimulationTimeTextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateTextBox.Text = "" Then
FlowRateTextBox.Focus()
MessageBox.Show("Flow Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution rate
If DilutionRateRadioButton.Checked = True Then
If DilutionRateTextBox.Text = "" Then
DilutionRateTextBox.Focus()
MessageBox.Show("Dilution Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeRadioButton.Checked = True Then
If RetentionTimeTextBox.Text = "" Then
RetentionTimeTextBox.Focus()
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'Constant k
If ConstkTextBox.Text = "" Then
ConstkTextBox.Focus()
MessageBox.Show("Constant k is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
101
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If '1 Reactor
'***************************************************************Reactor 1
'Reactant
If ReactantConcTextBox.Text = "" Then
ReactantConcTextBox.Focus()
MessageBox.Show("Reactant Concentration is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientStateRadioButton.Checked = True Then
If SimulationTimeTextBox.Text = "" Then
SimulationTimeTextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateTextBox.Text = "" Then
FlowRateTextBox.Focus()
MessageBox.Show("Flow Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution rate
If DilutionRateRadioButton.Checked = True Then
If DilutionRateTextBox.Text = "" Then
DilutionRateTextBox.Focus()
MessageBox.Show("Dilution Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeRadioButton.Checked = True Then
If RetentionTimeTextBox.Text = "" Then
RetentionTimeTextBox.Focus()
MessageBox.Show("Retention Time is required!", _
102
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'Constant k
If ConstkTextBox.Text = "" Then
ConstkTextBox.Focus()
MessageBox.Show("Constant k is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'*************************************************************Reactor 2
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientStateRadioButton.Checked = True Then
If SimulationTimeR2TextBox.Text = "" Then
SimulationTimeR2TextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateR2TextBox.Text = "" Then
FlowRateR2TextBox.Focus()
MessageBox.Show("Flow Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution rate
If DilutionRateR2RadioButton.Checked = True Then
If DilutionRateR2TextBox.Text = "" Then
DilutionRateR2TextBox.Focus()
MessageBox.Show("Dilution Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeR2RadioButton.Checked = True Then
If RetentionTimeR2TextBox.Text = "" Then
RetentionTimeR2TextBox.Focus()
103
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'Constant k
If ConstkR2TextBox.Text = "" Then
ConstkR2TextBox.Focus()
MessageBox.Show("Constant k is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If '2 Reactors
''*****************************************************************Calculate
'Show Table
Call HideAllGroup()
TableGroupBox.Show()
TableGroupBox.Dock = DockStyle.Fill
'Batch
If BatchRadioButton.Checked = True Then
If Add2ndReactorCheckBox.Checked = False Then
ChemTableSplitContainer.Panel2Collapsed = True
Call ReadChemReactor1Data()
Call BatchZeroOrder_Reactor1()
Call BatchZeroOrder_2Reactor()
End If
End If
Call CSTRTransientZeroOrder_Reactor1()
ElseIf Add2ndReactorCheckBox.Checked = True Then
ChemTableSplitContainer.Panel2Collapsed = False
Call ReadChemReactor1Data()
104
Call ReadChemReactor2Data()
Call ChemFDtauCalculation_Reactor1()
Call ChemFDtauCalculation_Reactor2()
Call CSTRTransientZeroOrder_2Reactor()
End If
End If
Call CSTRSteadyZeroOrder_Reactor1()
Call CSTRSteadyZeroOrder_2Reactor()
End If
End If
'///Done Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Maximum
_MainForm.ProgressTimer.Enabled = False
'Button
Call EnableCommanButton()
End Sub
#End Region
105
APPENDIX D
'BackColor
BatchPicturePanel.BackColor = Color.White
CSTRPicturePanel.BackColor = Color.White
ChemKineticsPanel.AutoScroll = True
ChemKineticsPanel.Dock = DockStyle.Fill
'Reactant Name
ReactantNameComboBox.Items.Add("Reactant")
ReactantNameComboBox.Text = ReactantNameComboBox.Items(0).ToString
'Product Name
ProductNameComboBox.Items.Add("Product")
ProductNameComboBox.Text = ProductNameComboBox.Items(0).ToString
'Button
BackToolStripButton.Enabled = False
CalculateToolStripButton.Enabled = True
GraphToolStripButton.Enabled = False
TableToolStripButton.Enabled = False
Call ChemReactor1_Load()
Call ChemReactor2_Load()
'Enable
Call ClickClickClick()
'Show GroupBox
Call ShowGroupBox()
End Sub
#End Region
BatchPicturePanel.Show()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
BatchSeriesPicturePanel.Show()
BatchSeriesPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
BatchSeriesPicturePanel.Width = BatchPicturePanel.Width
BatchSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
End If
106
Add2ndReactorCheckBox.Checked = False Then
OperationModeToolStripLabel.Text = "CSTR Transient State"
CSTRPicturePanel.Show()
CSTRPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRPicturePanel.Width = BatchPicturePanel.Width
CSTRPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
CSTRSeriesPicturePanel.Show()
CSTRSeriesPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRSeriesPicturePanel.Width = BatchPicturePanel.Width
CSTRSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
End If
CSTRPicturePanel.Width = BatchPicturePanel.Width
CSTRPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
ElseIf CSTRSteadyStateRadioButton.Checked = True AndAlso _
Add2ndReactorCheckBox.Checked = True Then
OperationModeToolStripLabel.Text = "CSTR Steady State MultiStage"
CSTRSeriesPicturePanel.Show()
CSTRSeriesPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRSeriesPicturePanel.Width = BatchPicturePanel.Width
CSTRSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
End If
End Sub
#End Region
Reactor1GroupBox.Show()
End Sub
107
#End Region
xTimeStepComboBox.Items.Clear()
y1ReactantConcR1StepComboBox.Items.Clear()
y2ProductConcR1StepComboBox.Items.Clear()
'Reactor 2
xTimeR2ComboBox.Items.Clear()
y1ReactantConcR2ComboBox.Items.Clear()
y2ProductConcR2ComboBox.Items.Clear()
xTimeR2StepComboBox.Items.Clear()
y1ReactantConcR2StepComboBox.Items.Clear()
y2ProductConcR2StepComboBox.Items.Clear()
End Sub
#End Region
#Region "EnableCommanButton"
Private Sub EnableCommanButton()
BackToolStripButton.Enabled = False
CalculateToolStripButton.Enabled = True
GraphToolStripButton.Enabled = True
TableToolStripButton.Enabled = True
End If
End If
End Sub
#End Region
'ChemReactor1
Private R1ReactantConc As String
Private R1ProductConc As String
Private R1SimulationTime As String
Private R1Timeinterval As String
'ChemReactor2
Private R2ReactantConc As String
Private R2ProductConc As String
Private R2SimulationTime As String
Private R2TimeInterval As String
108
Private R2FlowRate As String
Private R2RetentionTime As String
Private R2DilutionRate As String
Private R2ConstantK As String
'Graph
'Reactor 1
Private numItm As Integer
Private xAdd As Double
'Reactor 2
Private numItmR2 As Integer
Private xAddR2 As Double
'Calculation
'Reactor 1
Private R1CAs_First As Double
'Reactor 2
Private R2CAs_First As Double
#End Region
R1ReactantConc = ReactantConcTextBox.Text
R1ProductConc = ProductConcTextBox.Text
R1SimulationTime = SimulationTimeTextBox.Text
R1Timeinterval = StepTimeTextBox.Text
R1Volume = VolumeTextBox.Text
R1FlowRate = FlowRateTextBox.Text
R1RetentionTime = RetentionTimeTextBox.Text
R1DilutionRate = DilutionRateTextBox.Text
R1ConstantK = ConstkTextBox.Text
'Convert to Decimal
'Reactant Concentration
If R1ReactantConc = "" Then
R1C0 = 0
Else
R1C0 = CDec(R1ReactantConc)
End If
'Product concentration
If R1ProductConc = "" Then
R1P0 = 0
Else
R1P0 = CDec(R1ProductConc)
109
End If
'Simulation time
If R1SimulationTime = "" Then
R1Time = 0
Else
R1Time = CDec(R1SimulationTime)
End If
'Step time
If R1Timeinterval = "" Then
R1deltaI = 0.1
Else
R1deltaI = CDec(R1Timeinterval)
End If
'Volume
If R1Volume = "" Then
R1V = 0
Else
R1V = CDec(R1Volume)
End If
'Flow rate
If R1FlowRate = "" Then
R1F = 1
Else
R1F = CDec(R1FlowRate)
End If
'Retention time
If R1RetentionTime = "" Then
R1tau = 0
Else
R1tau = CDec(R1RetentionTime)
End If
'Dilution time
If R1DilutionRate = "" Then
R1D = 0
Else
R1D = CDec(R1DilutionRate)
End If
'Constant K
If R1ConstantK = "" Then
R1ConstK = 0
Else
R1ConstK = CDec(R1ConstantK)
End If
End Sub
#End Region
R2SimulationTime = SimulationTimeR2TextBox.Text
R2TimeInterval = StepTimeR2TextBox.Text
R2Volume = VolumeR2TextBox.Text
R2FlowRate = FlowRateR2TextBox.Text
R2RetentionTime = RetentionTimeR2TextBox.Text
R2DilutionRate = DilutionRateR2TextBox.Text
R2ConstantK = ConstkR2TextBox.Text
'Convert to Decimal
'Simulation time
If R2SimulationTime = "" Then
R2Time = 0
Else
R2Time = CDec(R2SimulationTime)
End If
'Step time
If R2TimeInterval = "" Then
R2deltaI = 0.1
Else
R2deltaI = CDec(R2TimeInterval)
End If
'Volume
If R2Volume = "" Then
R1V = 0
Else
R2V = CDec(R2Volume)
End If
'Flow rate
If R2FlowRate = "" Then
R2F = 1
Else
110
R2F = CDec(R2FlowRate)
End If
'Retention time
If R2RetentionTime = "" Then
R2tau = 1
Else
R2tau = CDec(R2RetentionTime)
End If
'Dilution time
If R2DilutionRate = "" Then
R2D = 1
Else
R2D = CDec(R2DilutionRate)
End If
'Constant K
If R2ConstantK = "" Then
R2ConstK = 0
Else
R2ConstK = CDec(R2ConstantK)
End If
End Sub
#End Region
#End Region
#Region "FindSteadyTime_Reactor1"
'Exit
Exit For
End If
111
Else
R1PtiTempSteady = 0
End If
End If
End Sub
#End Region
#Region "FindSteadyTime_Reactor2"
'Exit
Exit For
End If
End If
End Sub
#End Region
'///Cancel Progress
112
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientStateRadioButton.Checked = True Then
If SimulationTimeTextBox.Text = "" Then
SimulationTimeTextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateTextBox.Text = "" Then
FlowRateTextBox.Focus()
MessageBox.Show("Flow Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution rate
If DilutionRateRadioButton.Checked = True Then
If DilutionRateTextBox.Text = "" Then
DilutionRateTextBox.Focus()
MessageBox.Show("Dilution Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeRadioButton.Checked = True Then
If RetentionTimeTextBox.Text = "" Then
RetentionTimeTextBox.Focus()
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'Constant k
If ConstkTextBox.Text = "" Then
ConstkTextBox.Focus()
MessageBox.Show("Constant k is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
113
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If '1 Reactor
'***************************************************************Reactor 1
'Reactant
If ReactantConcTextBox.Text = "" Then
ReactantConcTextBox.Focus()
MessageBox.Show("Reactant Concentration is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientStateRadioButton.Checked = True Then
If SimulationTimeTextBox.Text = "" Then
SimulationTimeTextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateTextBox.Text = "" Then
FlowRateTextBox.Focus()
MessageBox.Show("Flow Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution rate
If DilutionRateRadioButton.Checked = True Then
If DilutionRateTextBox.Text = "" Then
DilutionRateTextBox.Focus()
MessageBox.Show("Dilution Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeRadioButton.Checked = True Then
If RetentionTimeTextBox.Text = "" Then
RetentionTimeTextBox.Focus()
MessageBox.Show("Retention Time is required!", _
114
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'Constant k
If ConstkTextBox.Text = "" Then
ConstkTextBox.Focus()
MessageBox.Show("Constant k is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'*************************************************************Reactor 2
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientStateRadioButton.Checked = True Then
If SimulationTimeR2TextBox.Text = "" Then
SimulationTimeR2TextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateR2TextBox.Text = "" Then
FlowRateR2TextBox.Focus()
MessageBox.Show("Flow Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution rate
If DilutionRateR2RadioButton.Checked = True Then
If DilutionRateR2TextBox.Text = "" Then
DilutionRateR2TextBox.Focus()
MessageBox.Show("Dilution Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeR2RadioButton.Checked = True Then
If RetentionTimeR2TextBox.Text = "" Then
RetentionTimeR2TextBox.Focus()
115
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'Constant k
If ConstkR2TextBox.Text = "" Then
ConstkR2TextBox.Focus()
MessageBox.Show("Constant k is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If '2 Reactors
''******************************************************************Calculation
'Show Table
Call HideAllGroup()
TableGroupBox.Show()
TableGroupBox.Dock = DockStyle.Fill
'Batch
If BatchRadioButton.Checked = True Then
If Add2ndReactorCheckBox.Checked = False Then
ChemTableSplitContainer.Panel2Collapsed = True
Call ReadReactor1Data()
Call BatchFirstOrder_Reactor1()
Call BatchFirstOrder_2Reactor()
End If
End If
Call CSTRTransientFirstOrder_Reactor1()
ElseIf Add2ndReactorCheckBox.Checked = True Then
ChemTableSplitContainer.Panel2Collapsed = False
116
Call ReadReactor1Data()
Call ReadReactor2Data()
Call ChemFDtauCalculation_Reactor1()
Call ChemFDtauCalculation_Reactor2()
Call CSTRTransientFirstOrder_2Reactor()
End If
End If
Call CSTRSteadyFirstOrder_Reactor1()
ElseIf Add2ndReactorCheckBox.Checked = True Then
ChemTableSplitContainer.Panel2Collapsed = False
Call ReadReactor1Data()
Call ReadReactor2Data()
Call ChemFDtauCalculation_Reactor1()
Call ChemFDtauCalculation_Reactor2()
Call CSTRSteadyFirstOrder_2Reactor()
End If
End If
'///Done Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Maximum
_MainForm.ProgressTimer.Enabled = False
'Button
Call EnableCommanButton()
Call EnableCommanButton()
End Sub
#End Region
117
APPENDIX E
'BackColor
BatchPicturePanel.BackColor = Color.White
CSTRPicturePanel.BackColor = Color.White
ChemKineticsPanel.AutoScroll = True
''Reaction Order
'Reactant Name
ReactantNameComboBox.Items.Add("Reactant")
ReactantNameComboBox.Text = ReactantNameComboBox.Items(0).ToString
'Product Name
ProductNameComboBox.Items.Add("Product")
ProductNameComboBox.Text = ProductNameComboBox.Items(0).ToString
'Button
BackToolStripButton.Enabled = False
CalculateToolStripButton.Enabled = True
GraphToolStripButton.Enabled = False
TableToolStripButton.Enabled = False
'Operation Parameters
Call ChemReactor1_Load()
Call ChemReactor2_Load()
'Enable Button
Call ClickClickClick()
'Show GroupBox
Call ShowGroupBox()
End Sub
#End Region
BatchPicturePanel.Show()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
BatchSeriesPicturePanel.Show()
BatchSeriesPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
BatchSeriesPicturePanel.Width = BatchPicturePanel.Width
BatchSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
End If
118
OperationModeToolStripLabel.Text = "CSTR Transient State"
CSTRPicturePanel.Show()
CSTRPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRPicturePanel.Width = BatchPicturePanel.Width
CSTRPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
CSTRSeriesPicturePanel.Show()
CSTRSeriesPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRSeriesPicturePanel.Width = BatchPicturePanel.Width
CSTRSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
End If
CSTRPicturePanel.Width = BatchPicturePanel.Width
CSTRPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
ElseIf CSTRSteadyStateRadioButton.Checked = True AndAlso _
Add2ndReactorCheckBox.Checked = True Then
OperationModeToolStripLabel.Text = "CSTR steady State MultiStage"
CSTRSeriesPicturePanel.Show()
CSTRSeriesPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRSeriesPicturePanel.Width = BatchPicturePanel.Width
CSTRSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
End If
End Sub
#End Region
ReactionGroupBox.Show()
ModelGroupBox.Show()
Add2ndReactorCheckBox.Show()
Reactor1GroupBox.Show()
End Sub
119
#End Region
xTimeStepComboBox.Items.Clear()
y1ReactantConcR1StepComboBox.Items.Clear()
y2ProductConcR1StepComboBox.Items.Clear()
'Reactor 2
xTimeR2ComboBox.Items.Clear()
y1ReactantConcR2ComboBox.Items.Clear()
y2ProductConcR2ComboBox.Items.Clear()
xTimeR2StepComboBox.Items.Clear()
y1ReactantConcR2StepComboBox.Items.Clear()
y2ProductConcR2StepComboBox.Items.Clear()
End Sub
#End Region
BackToolStripButton.Enabled = False
CalculateToolStripButton.Enabled = True
GraphToolStripButton.Enabled = True
TableToolStripButton.Enabled = True
End If
End If
End Sub
#End Region
'ChemReactor1
Private R1ReactantConc As String
Private R1ProductConc As String
Private R1SimulationTime As String
Private R1TimeInterval As String
'ChemReactor2
Private R2ReactantConc As String
Private R2ProductConc As String
Private R2SimulationTime As String
Private R2TimeInterval As String
120
Private R2DilutionRate As String
Private R2ConstantK As String
'Graph
'Reactor 1
Private numItm As Integer
Private xAdd As Double
'Reactor 2
Private numItmR2 As Integer
Private xAddR2 As Double
'Calculation
'Reactor 1
Private R1CAs_Second As Double
'Reactor 2
Private R2CAs_Second As Double
#End Region
R1ReactantConc = ReactantConcTextBox.Text
R1ProductConc = ProductConcTextBox.Text
R1SimulationTime = SimulationTimeTextBox.Text
R1TimeInterval = StepTimeTextBox.Text
R1Volume = VolumeTextBox.Text
R1FlowRate = FlowRateTextBox.Text
R1RetentionTime = RetentionTimeTextBox.Text
R1DilutionRate = DilutionRateTextBox.Text
R1ConstantK = ConstkTextBox.Text
'Convert to Decimal
'Reactant Concentration
If R1ReactantConc = "" Then
R1C0 = 0
Else
R1C0 = CDec(R1ReactantConc)
End If
'Product concentration
If R1ProductConc = "" Then
R1P0 = 0
Else
R1P0 = CDec(R1ProductConc)
End If
121
'Simulation time
If R1SimulationTime = "" Then
R1Time = 0
Else
R1Time = CDec(R1SimulationTime)
End If
'Step time
If R1TimeInterval = "" Then
R1deltaI = 0.1
Else
R1deltaI = CDec(R1TimeInterval)
End If
'Volume
If R1Volume = "" Then
R1V = 0
Else
R1V = CDec(R1Volume)
End If
'Flow rate
If R1FlowRate = "" Then
R1F = 1
Else
R1F = CDec(R1FlowRate)
End If
'Retention time
If R1RetentionTime = "" Then
R1tau = 0
Else
R1tau = CDec(R1RetentionTime)
End If
'Dilution time
If R1DilutionRate = "" Then
R1D = 0
Else
R1D = CDec(R1DilutionRate)
End If
'Constant K
If R1ConstantK = "" Then
R1ConstK = 0
Else
R1ConstK = CDec(R1ConstantK)
End If
End Sub
#End Region
R2SimulationTime = SimulationTimeR2TextBox.Text
R2TimeInterval = StepTimeR2TextBox.Text
R2Volume = VolumeR2TextBox.Text
R2FlowRate = FlowRateR2TextBox.Text
R2RetentionTime = RetentionTimeR2TextBox.Text
R2DilutionRate = DilutionRateR2TextBox.Text
R2ConstantK = ConstkR2TextBox.Text
'Convert to Decimal
'Simulation time
If R2SimulationTime = "" Then
R2Time = 0
Else
R2Time = CDec(R2SimulationTime)
End If
'Step time
If R2TimeInterval = "" Then
R2deltaI = 0.1
Else
R2deltaI = CDec(R2TimeInterval)
End If
'Volume
If R2Volume = "" Then
R1V = 0
Else
R2V = CDec(R2Volume)
End If
'Flow rate
If R2FlowRate = "" Then
R2F = 1
Else
R2F = CDec(R2FlowRate)
122
End If
'Retention time
If R2RetentionTime = "" Then
R2tau = 1
Else
R2tau = CDec(R2RetentionTime)
End If
'Dilution time
If R2DilutionRate = "" Then
R2D = 1
Else
R2D = CDec(R2DilutionRate)
End If
'Constant K
If R2ConstantK = "" Then
R2ConstK = 0
Else
R2ConstK = CDec(R2ConstantK)
End If
End Sub
#End Region
#End Region
#Region "FindSteadyTime_Reactor1"
'Exit
Exit For
End If
123
If R1PtiSteady > 0 Then
R1PtiTempSteady = R1PtiSteady
Else
R1PtiTempSteady = 0
End If
End If
End Sub
#End Region
#Region "FindSteadyTime_Reactor2"
'Exit
Exit For
End If
End If
End Sub
#End Region
124
MessageBox.Show("Reactant Concentration is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientStateRadioButton.Checked = True Then
If SimulationTimeTextBox.Text = "" Then
SimulationTimeTextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateTextBox.Text = "" Then
FlowRateTextBox.Focus()
MessageBox.Show("Flow Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution rate
If DilutionRateRadioButton.Checked = True Then
If DilutionRateTextBox.Text = "" Then
DilutionRateTextBox.Focus()
MessageBox.Show("Dilution Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeRadioButton.Checked = True Then
If RetentionTimeTextBox.Text = "" Then
RetentionTimeTextBox.Focus()
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'Constant k
If ConstkTextBox.Text = "" Then
125
ConstkTextBox.Focus()
MessageBox.Show("Constant k is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If '1 Reactor
'***************************************************************Reactor 1
'Reactant
If ReactantConcTextBox.Text = "" Then
ReactantConcTextBox.Focus()
MessageBox.Show("Reactant Concentration is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientStateRadioButton.Checked = True Then
If SimulationTimeTextBox.Text = "" Then
SimulationTimeTextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateTextBox.Text = "" Then
FlowRateTextBox.Focus()
MessageBox.Show("Flow Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution rate
If DilutionRateRadioButton.Checked = True Then
If DilutionRateTextBox.Text = "" Then
DilutionRateTextBox.Focus()
MessageBox.Show("Dilution Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
126
'Retention Time
If RetentionTimeRadioButton.Checked = True Then
If RetentionTimeTextBox.Text = "" Then
RetentionTimeTextBox.Focus()
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'Constant k
If ConstkTextBox.Text = "" Then
ConstkTextBox.Focus()
MessageBox.Show("Constant k is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'*************************************************************Reactor 2
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientStateRadioButton.Checked = True Then
If SimulationTimeR2TextBox.Text = "" Then
SimulationTimeR2TextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateR2TextBox.Text = "" Then
FlowRateR2TextBox.Focus()
MessageBox.Show("Flow Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution rate
If DilutionRateR2RadioButton.Checked = True Then
If DilutionRateR2TextBox.Text = "" Then
DilutionRateR2TextBox.Focus()
MessageBox.Show("Dilution Rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
127
End If
'Retention Time
If RetentionTimeR2RadioButton.Checked = True Then
If RetentionTimeR2TextBox.Text = "" Then
RetentionTimeR2TextBox.Focus()
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'Constant k
If ConstkR2TextBox.Text = "" Then
ConstkR2TextBox.Focus()
MessageBox.Show("Constant k is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If '2 Reactors
'****************************************************************Calculation
'Show Table
Call HideAllGroup()
TableGroupBox.Show()
TableGroupBox.Dock = DockStyle.Fill
'Batch
If BatchRadioButton.Checked = True Then
If Add2ndReactorCheckBox.Checked = False Then
ChemTableSplitContainer.Panel2Collapsed = True
Call ReadChemReactor1Data()
128
Call BatchSecondOrder_Reactor1()
Call BatchSecondOrder_2Reactor()
End If
End If
Call CSTRTransientSecondOrder_Reactor1()
Call CSTRTransientSecondOrder_2Reactor()
End If
End If
Call CSTRSteadySecondOrder_Reactor1()
Call CSTRSteadySecondOrder_2Reactor()
End If
End If
'///Done Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Maximum
_MainForm.ProgressTimer.Enabled = False
'Button
Call EnableCommanButton()
End Sub
#End Region
129
APPENDIX F
'Panel
BatchPicturePanel.BackColor = Color.White
CSTRPicturePanel.BackColor = Color.White
CSTRRecyclePicturePanel.BackColor = Color.White
CSTRAddPicturePanel.BackColor = Color.White
'Graph TabControl
Me.GraphReactor1TabPage.BackColor = Color.Gainsboro
Me.GraphReactor2TabPage.BackColor = Color.Gainsboro
'BioOperation
Call BioOperation_Load()
'Load or OpenFile
If NumberSubstrateToolStripLabel.Text = "" AndAlso _
NumberProductToolStripLabel.Text = "" Then
'For Load
'Substrate
NumberSubstrateComboBox.Items.Clear()
NumberSubstrateComboBox.Text = "1"
'Product
NumberProductComboBox.Items.Clear()
NumberProductComboBox.Items.Add("0")
NumberProductComboBox.Items.Add("1")
NumberProductComboBox.Text = NumberProductComboBox.Items(0).ToString
'Product
NumberProductComboBox.Items.Clear()
NumberProductComboBox.Items.Add("0")
NumberProductComboBox.Items.Add("1")
NumberProductComboBox.Text = NumberProductToolStripLabel.Text
End If
'Enable
Call ClickClickClick()
'Show GroupBox
Call ShowGroupBox()
End Sub
#End Region
BatchPicturePanel.Show()
'BatchPictureGroupBox.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
CSTRRecyclePicturePanel.Hide()
CSTRAddPicturePanel.Hide()
130
BatchSeriesPicturePanel.Show()
BatchSeriesPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
BatchSeriesPicturePanel.Width = BatchPicturePanel.Width
BatchSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
'BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
CSTRRecyclePicturePanel.Hide()
CSTRAddPicturePanel.Hide()
End If
CSTRPicturePanel.Show()
CSTRPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRPicturePanel.Width = BatchPicturePanel.Width
CSTRPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
'CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
CSTRRecyclePicturePanel.Hide()
CSTRAddPicturePanel.Hide()
CSTRPicturePanel.Show()
CSTRPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRPicturePanel.Width = BatchPicturePanel.Width
CSTRPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
'CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
CSTRRecyclePicturePanel.Hide()
CSTRAddPicturePanel.Hide()
CSTRSeriesPicturePanel.Width = BatchPicturePanel.Width
CSTRSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
'CSTRSeriesPicturePanel.Hide()
CSTRRecyclePicturePanel.Hide()
131
CSTRAddPicturePanel.Hide()
CSTRSeriesPicturePanel.Width = BatchPicturePanel.Width
CSTRSeriesPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
'CSTRSeriesPicturePanel.Hide()
CSTRRecyclePicturePanel.Hide()
CSTRAddPicturePanel.Hide()
End If
CSTRRecyclePicturePanel.Width = BatchPicturePanel.Width
CSTRRecyclePicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
'CSTRRecyclePicturePanel.Hide()
CSTRAddPicturePanel.Hide()
End If
'CSTRAdd Picture
If CSTRAddRadioButton.Checked = True Then
OperationModeLabel.Text = "CSTR with Additional Feed Stream"
CSTRAddPicturePanel.Show()
CSTRAddPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
ModelTableLayoutPanel.Location.X + _
BatchPicturePanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRAddPicturePanel.Width = BatchPicturePanel.Width
CSTRAddPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
BatchSeriesPicturePanel.Hide()
CSTRPicturePanel.Hide()
CSTRSeriesPicturePanel.Hide()
CSTRRecyclePicturePanel.Hide()
'CSTRAddPicturePanel.Hide()
End If
End Sub
#End Region
132
ElseIf Add2ndBioReactorCheckBox.Checked = False Then
Reactor2GroupBox.Hide()
End If
End Sub
#End Region
End If
End If
End Sub
#End Region
xTimeStepComboBox.Items.Clear()
y1SubStepComboBox.Items.Clear()
y2BiomassStepComboBox.Items.Clear()
y3ProStepComboBox.Items.Clear()
y5umaxStepComboBox.Items.Clear()
y6rSStepComboBox.Items.Clear()
y7rX1StepComboBox.Items.Clear()
y7rDStepComboBox.Items.Clear()
y8rPStepComboBox.Items.Clear()
'Reactor2
xTimeR2ComboBox.Items.Clear()
y1SubstrateR2ComboBox.Items.Clear()
y2BiomassR2ComboBox.Items.Clear()
y3ProductR2ComboBox.Items.Clear()
y5umaxR2ComboBox.Items.Clear()
y6rSR2ComboBox.Items.Clear()
y7rX1R2ComboBox.Items.Clear()
y8rPR2ComboBox.Items.Clear()
xTimeR2StepComboBox.Items.Clear()
y1SubR2StepComboBox.Items.Clear()
y2BiomassR2StepComboBox.Items.Clear()
y3ProR2StepComboBox.Items.Clear()
y5umaxR2StepComboBox.Items.Clear()
y6rSR2StepComboBox.Items.Clear()
y7rX1R2StepComboBox.Items.Clear()
y7rDR2StepComboBox.Items.Clear()
y8rPR2StepComboBox.Items.Clear()
End Sub
#End Region
#Region "ShowReactor1_HideReactor2"
Private Sub ShowReactor1_HideReactor2()
SingleData.BioReactor1Panel.Show()
SingleData.BioReactor2Panel.Hide()
SingleData.SubmitToolStripButton.Visible = True
SingleData.CancelToolStripButton.Visible = True
133
SingleData.SubmitR2ToolStripButton.Visible = False
SingleData.CancelR2ToolStripButton.Visible = False
'Call KpgKpngRadioButton_Click()
'Size
SingleData.Width = 1100
'Name
SingleData.Text = "Enter Data for Bioreactor 1"
End Sub
#End Region
#Region "ShowReactor2_HideReactor1"
Private Sub ShowReactor2_HideReactor1()
SingleData.BioReactor1Panel.Hide()
SingleData.BioReactor2Panel.Show()
SingleData.BioReactor2Panel.Location = New Point(0, 0)
SingleData.SubmitToolStripButton.Visible = False
SingleData.CancelToolStripButton.Visible = False
SingleData.SubmitR2ToolStripButton.Visible = True
SingleData.CancelR2ToolStripButton.Visible = True
'Size
SingleData.Width = 700
'Name
SingleData.Text = "Enter Data for Bioreactor 2"
End Sub
#End Region
'*********************************************Operation Parameters
Private SimulationTime As String = ""
Private tableInterval As String = ""
Private Volume As String = ""
Private FlowRate As String = ""
Private RetentionTime As String = ""
Private DilutionRate As String = ""
Private FlowRateRecycleRatio As String
Private BiomassRecycleRatio As String
Private Tt As Decimal
Private deltaT As Decimal = 0.1
Private deltaI As Decimal
Private V As Double
Private F As Double
Private tau As Double
Private D As Double
Private Fr_F As Double
Private Xr_X As Double
'***********************************************Operation Parameters R2
Private SimulationTimeR2 As String = ""
Private tableIntervalR2 As String = ""
Private VolumeR2 As String = ""
Private FlowRateR2 As String = ""
Private RetentionTimeR2 As String = ""
Private DilutionRateR2 As String = ""
Private FlowRateAdd As String
'**************************************************Biomass Variables
Private biomassConc As String = ""
Private subYxs As String = ""
Private X0 As Double
Private Yxs As Double
Private rX As Double = 0
Private rX1 As Double = 0
Private rD As Double = 0
'***************************************************Biomass Variables R2
Private biomassConcR2 As String = ""
Private subR2Yxs As String = ""
134
Private rX1R2 As Double = 0
Private rDR2 As Double = 0
'*******************************************************Substrate 1 Variables
Private subConc As String = ""
'Calculation Variable
Private S0 As Double
Private DOR1 As Double
Private SatDOR1 As Double
Private I0 As Double
Private Iopt As Double
Private umax As Double
Private kd As Double
Private Ks As Double
Private rS As Double = 0
Private rI As Double
Private rDO As Double
'***************************************************Substrate R2 Variables
'Input Variable
Private SubR2umax As String
Private SubR2Kd As String
Private SubR2Ks As String
'Calculation Variable
Private S0_R2 As Double
Private DOR2 As Double
Private I0_R2 As Double
Private umaxR2 As Double
Private kdR2 As Double
Private KsR2 As Double
'*******************************************************Product 1 Variables
Private ProConc As String = ""
Private P0 As Decimal
Private Yps As Decimal
Private kpg As Decimal
Private kpng As Decimal
Private mP As Decimal
Private rP As Double = 0
'***************************************************Product R2 Variables
135
Private ProR2RefSubstrate As String = ""
'R2
Private XtiR2 As Double
Private StiR2 As Double
Private DOtiR2 As Double
Private ItiR2 As Double
Private PtiR2 As Double
Private umaxCalR2 As Double
'****************************************************************************Graph
'Reactor 1
Private numItm As Integer
'Reactor 2
Private numItmR2 As Integer
#End Region
136
Private Sub ReadOperationData()
SimulationTime = SimulationTimeTextBox.Text
tableInterval = StepTimeTextBox.Text
Volume = VolumeTextBox.Text
FlowRate = FlowRateTextBox.Text
RetentionTime = RetentionTimeTextBox.Text
DilutionRate = DilutionRateTextBox.Text
biomassConc = SingleData.BiomassConcTextBox.Text
FlowRateRecycleRatio = RecycleRatioTextBox.Text
BiomassRecycleRatio = ConcFactorTextBox.Text
subYxs = SingleData.YxsTextBox.Text
'Convert to decimal
'Simulation Time
If SimulationTime = "" Then
Tt = 0
Else
Tt = CDec(SimulationTime)
End If
'Step time
If tableInterval = "" Then
deltaI = 0.1
Else
deltaI = CDec(tableInterval)
End If
'V
If Volume = "" Then
V = 0
Else
V = CDec(Volume)
End If
'F
If FlowRate = "" Then
F = 0
Else
F = CDec(FlowRate)
End If
'tau
If RetentionTime = "" Then
tau = 0
Else
tau = CDec(RetentionTime)
End If
'D
If DilutionRate = "" Then
D = 0
Else
D = CDec(DilutionRate)
End If
'Biomass Conc
If biomassConc = "" Then
X0 = 0
Else
X0 = CDec(biomassConc)
End If
'Recycle Ratio
If FlowRateRecycleRatio = "" Then
Fr_F = 0
Else
Fr_F = CDec(FlowRateRecycleRatio)
End If
'Conc Factor
If BiomassRecycleRatio = "" Then
Xr_X = 0
Else
Xr_X = CDec(BiomassRecycleRatio)
End If
End Sub
#End Region
137
SimulationTimeR2 = SimulationTimeR2TextBox.Text
tableIntervalR2 = StepTimeR2TextBox.Text
VolumeR2 = VolumeR2TextBox.Text
FlowRate = FlowRateR2TextBox.Text
RetentionTimeR2 = RetentionTimeR2TextBox.Text
DilutionRateR2 = DilutionRateR2TextBox.Text
FlowRateAdd = FlowRateAddTextBox.Text
subR2Yxs = SingleData.YxsR2TextBox.Text
'Convert to decimal
'Simulation Time
If SimulationTimeR2 = "" Then
TtR2 = 0
Else
TtR2 = CDec(SimulationTimeR2)
End If
'Step time
If tableIntervalR2 = "" Then
deltaIR2 = 0.1
Else
deltaIR2 = CDec(tableIntervalR2)
End If
'V
If VolumeR2 = "" Then
VR2 = 0
Else
VR2 = CDec(VolumeR2)
End If
'F
If FlowRateR2 = "" Then
FR2 = 0
Else
FR2 = CDec(FlowRateR2)
End If
'tau
If RetentionTimeR2 = "" Then
tauR2 = 0
Else
tauR2 = CDec(RetentionTimeR2)
End If
'D
If DilutionRateR2 = "" Then
DR2 = 0
Else
DR2 = CDec(DilutionRateR2)
End If
'Flow rate
If FlowRateAdd = "" Then
FAdd = 0
Else
FAdd = CDec(FlowRateAdd)
End If
End Sub
#End Region
subConc = SingleData.SubConcTextBox.Text
Subumax = SingleData.umaxTextBox.Text
SubKd = SingleData.kdTextBox.Text
SubKs = SingleData.KsTextBox.Text
SubmS = SingleData.mSTextBox.Text
'Convert to Decimal
'Sub1 Conc
If subConc = "" Then
S0 = 0
Else
S0 = CDec(subConc)
End If
'DOR1
If SubDOConc = "" Then
DOR1 = 0
138
Else
DOR1 = CDec(SubDOConc)
End If
'SatDO1
If SubSatDOConc = "" Then
SatDOR1 = 0
Else
SatDOR1 = CDec(SubSatDOConc)
End If
'I
If subLight = "" Then
I0 = 0
Else
I0 = CDec(subLight)
End If
'OptI
If subOptLight = "" Then
Iopt = 0
Else
Iopt = CDec(subOptLight)
End If
'umax
If Subumax = "" Then
umax = 0
Else
umax = CDec(Subumax)
End If
'kd
If SubKd = "" Then
kd = 0
Else
kd = CDec(SubKd)
End If
'Ks
If SubKs = "" Then
Ks = 0
Else
Ks = CDec(SubKs)
End If
'mS
If SubmS = "" Then
mS = 0
Else
mS = CDec(SubmS)
End If
'kLa
If SubkLa = "" Then
kLa = 0
Else
kLa = CDec(SubkLa)
End If
End Sub
#End Region
SubR2umax = SingleData.umaxR2TextBox.Text
SubR2Kd = SingleData.kdR2TextBox.Text
SubR2Ks = SingleData.KsR2TextBox.Text
SubR2mS = SingleData.mSR2TextBox.Text
'Convert to Decimal
'umax
If SubR2umax = "" Then
umaxR2 = 0
Else
umaxR2 = CDec(SubR2umax)
End If
'kd
If SubR2Kd = "" Then
kdR2 = 0
Else
kdR2 = CDec(SubR2Kd)
End If
'Ks
If SubR2Ks = "" Then
KsR2 = 0
139
Else
KsR2 = CDec(SubR2Ks)
End If
'mS
If SubR2mS = "" Then
mSR2 = 0
Else
mSR2 = CDec(SubR2mS)
End If
'kLa
If SubR2kLa = "" Then
kLaR2 = 0
Else
kLaR2 = CDec(SubR2kLa)
End If
'DOR2
If SubR2DOConc = "" Then
DOR2 = 0
Else
DOR2 = CDec(SubR2DOConc)
End If
'SatDOR2
If SubR2SatDOConc = "" Then
SatDOR2 = 0
Else
SatDOR2 = CDec(SubR2SatDOConc)
End If
End Sub
#End Region
ProConc = SingleData.ProConcTextBox.Text
ProYps = SingleData.YpsTextBox.Text
ProKpg = SingleData.KpgTextBox.Text
ProKpng = SingleData.KpngTextBox.Text
PromP = SingleData.mPTextBox.Text
'Convert to decimal
'pro Conc
If ProConc = "" Then
P0 = 0
Else
P0 = CDec(ProConc)
End If
'Kpg
If ProKpg = "" Then
kpg = 0
Else
kpg = CDec(ProKpg)
End If
'Kpng
If ProKpng = "" Then
kpng = 0
Else
kpng = CDec(ProKpng)
End If
'mP
If PromP = "" Then
mP = 0
Else
mP = CDec(PromP)
End If
End Sub
#End Region
ProR2Yps = SingleData.YpsR2TextBox.Text
ProR2Kpg = SingleData.KpgR2TextBox.Text
ProR2Kpng = SingleData.KpngR2TextBox.Text
ProR2mP = SingleData.mPR2TextBox.Text
140
'Convert to decimal
'ProR2 Product Yield
If ProR2Yps = "" Then
YpsR2 = 1
Else
YpsR2 = CDec(ProR2Yps)
End If
'Kpg
If ProR2Kpg = "" Then
kpgR2 = 0
Else
kpgR2 = CDec(ProR2Kpg)
End If
'Kpng
If ProR2Kpng = "" Then
kpngR2 = 0
Else
kpngR2 = CDec(ProR2Kpng)
End If
'mP
If ProR2mP = "" Then
mPR2 = 0
Else
mPR2 = CDec(ProR2mP)
End If
End Sub
#End Region
#End Region
Call SetInitialConcentration()
Call FDtauCalculation()
Call ProNonGrowth()
'umaxCal
141
umaxCal = umax * (StiTemp / (Ks + StiTemp))
'Calculate Rate
rX = (umaxCal - kd) * XtiTemp
rP = (kpng * XtiTemp) + (kpg * umaxCal * XtiTemp) + (mP * XtiTemp)
rS = (umaxCal * XtiTemp / Yxs) + (Rpng * XtiTemp / Yps) + (mS * XtiTemp)
'Calculate Conc
Xti = XtiTemp + (rX * deltaT) + RepX
Pti = PtiTemp + (rP * deltaT) + RepP
Sti = StiTemp - (rS * deltaT) + RepS
'Exit
Exit For
End If
'Assign Value
XtiTemp = Xti
PtiTemp = Pti
Next
End Sub
#End Region
'umaxCalR2
umaxCalR2 = umaxR2 * (StiTempR2 / (KsR2 + StiTempR2))
'Calculate
rXR2 = (umaxCalR2 - kdR2) * XtiTempR2
rPR2 = (kpngR2 * XtiTempR2) + (kpgR2 * umaxCalR2 * XtiTempR2) + (mPR2 * XtiTempR2)
rSR2 = (umaxCalR2 * XtiTempR2 / YxsR2) + (mSR2 * XtiTempR2)
'Exit
Exit For
End If
'Assign Value
142
XtiTempR2 = XtiR2
PtiTempR2 = PtiTempR2
Next
End Sub
#End Region
End If
End Sub
#End Region
End If
End Sub
#End Region
143
#Region "Calculation Button"
Private Sub CalculateToolStripButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles CalculateToolStripButton.Click
'///Start Progress
_MainForm.ToolstripprogressBar.Value = 40
_MainForm.ProgressTimer.Enabled = True
'Recycle
If CSTRRecycleRadioButton.Checked = True Then
If RecycleRatioTextBox.Text = "" Then
RecycleRatioTextBox.Focus()
MessageBox.Show("Recycle Ratio is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Flow rate
If FlowRateTextBox.Text = "" Then
FlowRateTextBox.Focus()
MessageBox.Show("Flow rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution Rate
If DilutionRateRadioButton.Checked = True Then
If DilutionRateTextBox.Text = "" Then
DilutionRateTextBox.Focus()
144
MessageBox.Show("Dilution rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeRadioButton.Checked = True Then
If RetentionTimeTextBox.Text = "" Then
RetentionTimeTextBox.Focus()
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'\\\\\\SingleData
'Biomass, SubConc, Yxs, umax, Ks
If SingleData.BiomassConcTextBox.Text = "" OrElse _
SingleData.SubConcTextBox.Text = "" OrElse _
SingleData.YxsTextBox.Text = "" OrElse _
SingleData.umaxTextBox.Text = "" OrElse _
SingleData.KsTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
Call ShowReactor1_HideReactor2()
SingleData.ShowDialog()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Kpg, Kpng
If NumberProductComboBox.Text = "1" Then
If SingleData.ProTypeToolStripLabel.Text = "Growth" OrElse _
SingleData.ProTypeToolStripLabel.Text = "" Then
If SingleData.KpgTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
Call ShowReactor1_HideReactor2()
SingleData.ShowDialog()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
145
'Product Yield
If SingleData.YpsTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
Call ShowReactor1_HideReactor2()
SingleData.ShowDialog()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If 'Pro Yield
'******************************************************************Reactor 1
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientRadioButton.Checked = True OrElse _
CSTRAddRadioButton.Checked = True Then
If SimulationTimeTextBox.Text = "" Then
SimulationTimeTextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateTextBox.Text = "" Then
FlowRateTextBox.Focus()
MessageBox.Show("Flow rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution Rate
If DilutionRateRadioButton.Checked = True Then
If DilutionRateTextBox.Text = "" Then
DilutionRateTextBox.Focus()
MessageBox.Show("Dilution rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
146
End If
'Retention Time
If RetentionTimeRadioButton.Checked = True Then
If RetentionTimeTextBox.Text = "" Then
RetentionTimeTextBox.Focus()
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'\\\\\\SingleData
'Biomass, SubConc, Yxs, umax, Ks
If SingleData.BiomassConcTextBox.Text = "" OrElse _
SingleData.SubConcTextBox.Text = "" OrElse _
SingleData.YxsTextBox.Text = "" OrElse _
SingleData.umaxTextBox.Text = "" OrElse _
SingleData.KsTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
Call ShowReactor1_HideReactor2()
SingleData.ShowDialog()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Kpg, Kpng
If NumberProductComboBox.Text = "1" Then
If SingleData.ProTypeToolStripLabel.Text = "Growth" OrElse _
SingleData.ProTypeToolStripLabel.Text = "" Then
If SingleData.KpgTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
Call ShowReactor1_HideReactor2()
SingleData.ShowDialog()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Product Yield
If SingleData.YpsTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
Call ShowReactor1_HideReactor2()
SingleData.ShowDialog()
147
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If 'Pro Yield
'***************************************************************Reactor 2
'Simulation Time
If BatchRadioButton.Checked = True OrElse _
CSTRTransientRadioButton.Checked = True OrElse _
CSTRAddRadioButton.Checked = True Then
If SimulationTimeR2TextBox.Text = "" Then
SimulationTimeR2TextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Flow rate
If FlowRateR2TextBox.Text = "" Then
FlowRateR2TextBox.Focus()
MessageBox.Show("Flow rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution Rate
If DilutionRateR2RadioButton.Checked = True Then
If DilutionRateR2TextBox.Text = "" Then
DilutionRateR2TextBox.Focus()
MessageBox.Show("Dilution rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeR2RadioButton.Checked = True Then
If RetentionTimeR2TextBox.Text = "" Then
RetentionTimeR2TextBox.Focus()
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
148
MessageBox.Show("Additional flow rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
'\\\\\\SingleData
'Biomass, SubConc, Yxs, umax, Ks
If SingleData.YxsR2TextBox.Text = "" OrElse _
SingleData.umaxR2TextBox.Text = "" OrElse _
SingleData.KsR2TextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
Call ShowReactor2_HideReactor1()
SingleData.ShowDialog()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Kpg, Kpng
If NumberProductComboBox.Text = "1" Then
If SingleData.ProTypeToolStripLabel.Text = "Growth" OrElse _
SingleData.ProTypeToolStripLabel.Text = "" Then
If SingleData.KpgR2TextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
Call ShowReactor2_HideReactor1()
SingleData.ShowDialog()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Product Yield
If SingleData.YpsR2TextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
Call ShowReactor2_HideReactor1()
SingleData.ShowDialog()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If 'Pro Yield
149
End If '2 reactor
'Show Table
Call HideAllGroup()
TableTabControl.Show()
TableTabControl.Dock = DockStyle.Fill
'AutScroll
Me.AutoScroll = False
'Clear ComboBox
Call ClearResultComboBox()
'Read Data
Call ReadOperationData()
Call ReadSub1Data()
Call ReadPro1Data()
Call ReadOperationDataR2()
Call ReadSubR2Data()
Call ReadProR2Data()
Call FDtauCalculation()
Call FDtauCalculationR2()
'Calculation
If Add2ndBioReactorCheckBox.Checked = False Then
Call Calculation_Reactor1()
ElseIf Add2ndBioReactorCheckBox.Checked = True Then
Call Calculation_2Reactor()
End If
'///Done Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Maximum
_MainForm.ProgressTimer.Enabled = False
'Button
Call EnableCommandButton()
End Sub
#End Region
150
APPENDIX G
'Panel
BatchPicturePanel.BackColor = Color.White
CSTRPicturePanel.BackColor = Color.White
'AutoScroll
Me.AutoScroll = False
'BioOperation
Call BioOperation_Load()
'Load or OpenFile
If NumberSubstrateToolStripLabel.Text = "" AndAlso _
NumberProductToolStripLabel.Text = "" Then
'For Load
'Substrate
NumberSubstrateComboBox.Items.Clear()
NumberSubstrateComboBox.Items.Add("2")
NumberSubstrateComboBox.Items.Add("3")
NumberSubstrateComboBox.Items.Add("4")
NumberSubstrateComboBox.Text = NumberSubstrateComboBox.Items(0).ToString
'Product
NumberProductComboBox.Items.Clear()
NumberProductComboBox.Items.Add("0")
NumberProductComboBox.Items.Add("1")
NumberProductComboBox.Items.Add("2")
NumberProductComboBox.Text = NumberProductComboBox.Items(0).ToString
Call NumberSubstrateChanged_Load()
'Product
NumberProductComboBox.Items.Clear()
NumberProductComboBox.Items.Add("0")
NumberProductComboBox.Items.Add("1")
NumberProductComboBox.Items.Add("2")
NumberProductComboBox.Text = NumberProductToolStripLabel.Text
Call NumberSubstrateChanged_OpenFile()
End If
''Complementary
Dim items(2) As String
For i As Int32 = 0 To 2
items(i) = "Item " & i.ToString
Next
Me.CompSubComboBox.Items.AddRange(items)
Me.CompSubComboBox.DropDownStyle = ComboBoxStyle.DropDownList
Me.CompSubComboBox.DrawMode = DrawMode.OwnerDrawVariable
Me.CompSubComboBox.ItemHeight = Me.CompSubImageList.ImageSize.Height
Me.CompSubComboBox.Width = Me.CompSubImageList.ImageSize.Width + 20
Me.CompSubComboBox.MaxDropDownItems = Me.CompSubImageList.Images.Count
'Selected Index
If CompSubLabel.Text = "Competitive" OrElse _
CompSubLabel.Text = "" Then
CompSubComboBox.SelectedIndex = 0
SubSubNoteLabel.Hide()
MultipleSubData.Sub2fFactorLabel.Enabled = False
MultipleSubData.Sub2fFactorTextBox.Enabled = False
SubSubNoteLabel.Hide()
MultipleSubData.Sub2fFactorLabel.Enabled = False
MultipleSubData.Sub2fFactorTextBox.Enabled = False
151
CompSubComboBox.SelectedIndex = 2
SubSubNoteLabel.Show()
MultipleSubData.Sub2fFactorLabel.Enabled = True
MultipleSubData.Sub2fFactorTextBox.Enabled = True
End If
'Enable
Call ClickClickClick()
'Show GroupBox
Call ShowGroupBox()
End Sub
#End Region
End If
'CSTR
If CSTRRadioButton.Checked = True Then
OperationModeLabel.Text = "CSTR"
CSTRPicturePanel.Show()
CSTRPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
BatchPicturePanel.Location.X + _
ModelTableLayoutPanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRPicturePanel.Width = BatchPicturePanel.Width
CSTRPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
End If
End Sub
#End Region
End If
End If
End Sub
#End Region
xTimeComboBox.Items.Clear()
y1Sub1ComboBox.Items.Clear()
y1Sub2ComboBox.Items.Clear()
y1Sub3ComboBox.Items.Clear()
y1Sub4ComboBox.Items.Clear()
y2BiomassComboBox.Items.Clear()
y3Pro1ComboBox.Items.Clear()
152
y3Pro2ComboBox.Items.Clear()
y5umaxComboBox.Items.Clear()
y5umax1ComboBox.Items.Clear()
y5umax2ComboBox.Items.Clear()
y6rS1ComboBox.Items.Clear()
y6rS2ComboBox.Items.Clear()
y6rS3ComboBox.Items.Clear()
y6rS4ComboBox.Items.Clear()
y7rX1ComboBox.Items.Clear()
y7rX2ComboBox.Items.Clear()
y8rP1ComboBox.Items.Clear()
y8rP2ComboBox.Items.Clear()
'Step
xTimeStepComboBox.Items.Clear()
y1Sub1StepComboBox.Items.Clear()
y1Sub2StepComboBox.Items.Clear()
y1Sub3StepComboBox.Items.Clear()
y1Sub4StepComboBox.Items.Clear()
y2BiomassStepComboBox.Items.Clear()
y3Pro1StepComboBox.Items.Clear()
y3Pro2StepComboBox.Items.Clear()
y5umaxStepComboBox.Items.Clear()
y5umax1StepComboBox.Items.Clear()
y5umax2StepComboBox.Items.Clear()
y6rS1StepComboBox.Items.Clear()
y6rS2StepComboBox.Items.Clear()
y6rS3StepComboBox.Items.Clear()
y6rS4StepComboBox.Items.Clear()
y7rX1StepComboBox.Items.Clear()
y7rX2StepComboBox.Items.Clear()
y8rP1StepComboBox.Items.Clear()
y8rP2StepComboBox.Items.Clear()
End Sub
#End Region
'*********************************************Operation Parameters
Private SimulationTime As String = ""
Private TimeInterval As String = ""
Private Volume As String = ""
Private FlowRate As String = ""
Private RetentionTime As String = ""
Private DilutionRate As String = ""
Private Tt As Decimal
Private deltaT As Decimal = 0.1
Private deltaI As Decimal
Private alphaRecycle As Double
Private CFactor As Double
Private V As Double
Private Vti As Double
Private F As Double
Private tau As Double
Private D As Double
'**********************************************Biomass Variables
Private biomassConc As String = ""
Private sub1BiomassYield As String = ""
Private sub2BiomassYield As String = ""
Private sub3BiomassYield As String = ""
Private sub4BiomassYield As String = ""
Private X0 As Double
Private Yxs1 As Double
Private Yxs2 As Double
Private Yxs3 As Double
Private Yxs4 As Double
Private rX As Double = 0
Private rX1 As Double
Private rX2 As Double
Private rDecay As Double
'********************************************Substrate 1 Variables
Private sub1Conc As String = ""
Private sub1umax As String
Private sub1Kd As String
Private sub1Ks As String
Private sub1mS As String
153
Private sub1InhibitionType As String = ""
Private sub1EdwardConst As String
Private sub1OptSubstrate As String
Private S0 As Double
Private KI1 As Double
Private KEd1 As Double
Private Sopt1 As Double
Private umax As Double
Private kd1 As Double
Private Ks1 As Double
Private rS As Double = 0
'***********************************************Substrate 2 Variables
'****************************************************Substrate 3 Variables
'************************************************************************Substrate 4 Variables
Private sub4Conc As String = ""
Private sub4umax As String
Private sub4Kd As String
Private sub4Ks As String
Private sub4mS As String
'************************************************************************Product 1 Variables
Private pro1Conc As String = ""
Private pro1ProductYield As String = ""
Private pro1Kpg As String
Private pro1Kpng As String
Private pro1mP As String
Private pro1RefSubstrate As String = ""
154
Private KpI1 As Decimal
Private Pm1 As Decimal
Private n1 As Decimal
Private alpha1 As Decimal
Private kpg1 As Decimal
Private kpng1 As Decimal
Private mP1 As Decimal
Private rP As Double = 0
'*************************************************************************Product 2 Variables
Private pro2Conc As String = ""
Private pro2ProductYield As String = ""
Private pro2Kpg As String
Private pro2Kpng As String
Private pro2mP As String
Private pro2Pm As String
Private pro2n As String
Private pro2alpha As String
Private pro2RefSubstrate As String = ""
'1
Private Xti As Double
Private Sti As Double
Private Pti As Double
Private umaxCal As Double
'2
Private minValue As Double
Private umaxCal2 As Double
Private Sti2 As Double
Private StiTemp2 As Double
'3
Private Sti3 As Double
Private StiTemp3 As Double
'4
Private Sti4 As Double
Private StiTemp4 As Double
'*******************************************************Calculation
Private RumaxCal As Double
Private RumaxCal2 As Double
155
Private Yps1 As Double
Private Yps2 As Double
Private Yps3 As Double
Private Yps4 As Double
'**********************************************************Graph
#End Region
SimulationTime = SimulationTimeTextBox.Text
TimeInterval = StepTimeTextBox.Text
Volume = VolumeTextBox.Text
FlowRate = FlowRateTextBox.Text
RetentionTime = RetentionTimeTextBox.Text
DilutionRate = DilutionRateTextBox.Text
biomassConc = MultipleSubData.BiomassConcTextBox.Text
sub1BiomassYield = MultipleSubData.Sub1Yxs1TextBox.Text
sub2BiomassYield = MultipleSubData.Sub2Yxs2TextBox.Text
sub3BiomassYield = MultipleSubData.Sub3Yxs3TextBox.Text
sub4BiomassYield = MultipleSubData.Sub4Yxs4TextBox.Text
'Convert to decimal
'Simulation Time
If SimulationTime = "" Then
Tt = 0
Else
Tt = CDec(SimulationTime)
End If
'Step time
If TimeInterval = "" Then
deltaI = 0.1
Else
deltaI = CDec(TimeInterval)
End If
'V
If Volume = "" Then
V = 1
Else
V = CDec(Volume)
End If
'F
If FlowRate = "" Then
F = 0
Else
F = CDec(FlowRate)
End If
'tau
If RetentionTime = "" Then
tau = 1
Else
tau = CDec(RetentionTime)
End If
'D
If DilutionRate = "" Then
D = 1
156
Else
D = CDec(DilutionRate)
End If
'Biomass Conc
If biomassConc = "" Then
X0 = 0
Else
X0 = CDec(biomassConc)
End If
'Yxs2
If sub2BiomassYield = "" Then
Yxs2 = 0.5
Else
Yxs2 = CDec(sub2BiomassYield)
End If
'Yxs3
If sub3BiomassYield = "" Then
Yxs3 = 0.5
Else
Yxs3 = CDec(sub3BiomassYield)
End If
'Yxs4
If sub4BiomassYield = "" Then
Yxs4 = 0.5
Else
Yxs4 = CDec(sub4BiomassYield)
End If
End Sub
#End Region
sub1Conc = MultipleSubData.Sub1ConcTextBox.Text
sub1umax = MultipleSubData.Sub1umaxTextBox.Text
sub1Kd = MultipleSubData.Sub1kdTextBox.Text
sub1Ks = MultipleSubData.Sub1KsTextBox.Text
sub1mS = MultipleSubData.Sub1mSTextBox.Text
'Convert to Decimal
'Sub1 Conc
If sub1Conc = "" Then
S0 = 0
Else
S0 = CDec(sub1Conc)
End If
'umax
If sub1umax = "" Then
umax = 0
Else
umax = CDec(sub1umax)
End If
'kd
If sub1Kd = "" Then
kd1 = 0
Else
kd1 = CDec(sub1Kd)
End If
'Ks
If sub1Ks = "" Then
Ks1 = 0
Else
Ks1 = CDec(sub1Ks)
End If
'mS
If sub1mS = "" Then
mS1 = 0
Else
mS1 = CDec(sub1mS)
End If
End Sub
#End Region
157
#Region "ReadSub2Data File"
Private Sub ReadSub2Data()
sub2Conc = MultipleSubData.Sub2ConcTextBox.Text
sub2factor_f = MultipleSubData.Sub2fFactorTextBox.Text
sub2Kd = MultipleSubData.Sub2kdTextBox.Text
sub2Ks = MultipleSubData.Sub2KsTextBox.Text
sub2mS = MultipleSubData.Sub2mSTextBox.Text
'Convert to Decimal
'Sub1 Conc
If sub2Conc = "" Then
S0_2 = 0
Else
S0_2 = CDec(sub2Conc)
End If
'f
If sub2factor_f = "" Then
factor_f = 0
Else
factor_f = CDec(sub2factor_f)
End If
'kd
If sub2Kd = "" Then
kd2 = 0
Else
kd2 = CDec(sub2Kd)
End If
'Ks
If sub2Ks = "" Then
Ks2 = 0
Else
Ks2 = CDec(sub2Ks)
End If
'mS
If sub2mS = "" Then
mS2 = 0
Else
mS2 = CDec(sub2mS)
End If
End Sub
#End Region
'Convert to Decimal
'Sub1 Conc
If sub3Conc = "" Then
S0_3 = 0
Else
S0_3 = CDec(sub3Conc)
End If
'kd
If sub3Kd = "" Then
kd3 = 0
Else
kd3 = CDec(sub3Kd)
End If
'Ks
If sub3Ks = "" Then
Ks3 = 0
Else
Ks3 = CDec(sub3Ks)
End If
'mS
If sub3mS = "" Then
mS3 = 0
Else
mS3 = CDec(sub3mS)
End If
End Sub
#End Region
158
Private Sub ReadSub4Data()
sub4Conc = MultipleSubData.Sub4ConcTextBox.Text
sub4umax = MultipleSubData.Sub4umaxTextBox.Text
sub4Kd = MultipleSubData.Sub4kdTextBox.Text
sub4Ks = MultipleSubData.Sub4KsTextBox.Text
sub4mS = MultipleSubData.Sub4mSTextBox.Text
'Convert to Decimal
'Sub1 Conc
If sub4Conc = "" Then
S0_4 = 0
Else
S0_4 = CDec(sub4Conc)
End If
'kd
If sub4Kd = "" Then
kd4 = 0
Else
kd4 = CDec(sub4Kd)
End If
'Ks
If sub4Ks = "" Then
Ks4 = 0
Else
Ks4 = CDec(sub4Ks)
End If
'mS
If sub4mS = "" Then
mS4 = 0
Else
mS4 = CDec(sub4mS)
End If
End Sub
#End Region
pro1Conc = MultipleProData.Pro1ConcTextBox.Text
pro1ProductYield = MultipleProData.Pro1Yp1sTextBox.Text
pro1Kpg = MultipleProData.Pro1KpgTextBox.Text
pro1Kpng = MultipleProData.Pro1KpngTextBox.Text
pro1mP = MultipleProData.Pro1mPTextBox.Text
'Convert to decimal
'pro1 Conc
If pro1Conc = "" Then
P0_1 = 0
Else
P0_1 = CDec(pro1Conc)
End If
'Kpg
If pro1Kpg = "" Then
kpg1 = 0
Else
kpg1 = CDec(pro1Kpg)
End If
'Kpng
If pro1Kpng = "" Then
kpng1 = 0
Else
kpng1 = CDec(pro1Kpng)
End If
'mP
If pro1mP = "" Then
mP1 = 0
Else
mP1 = CDec(pro1mP)
End If
End Sub
#End Region
159
#Region "ReadPro2Data File"
Private Sub ReadPro2Data()
pro2Conc = MultipleProData.Pro2ConcTextBox.Text
pro2ProductYield = MultipleProData.Pro2Yp2sTextBox.Text
pro2Kpg = MultipleProData.Pro2KpgTextBox.Text
pro2Kpng = MultipleProData.Pro2KpngTextBox.Text
pro2mP = MultipleProData.Pro2mPTextBox.Text
'Convert to decimal
'pro1 Conc
If pro2Conc = "" Then
P0_2 = 0
Else
P0_2 = CDec(pro2Conc)
End If
'Kpg
If pro2Kpg = "" Then
kpg2 = 0
Else
kpg2 = CDec(pro2Kpg)
End If
'Kpng
If pro2Kpng = "" Then
kpng2 = 0
Else
kpng2 = CDec(pro2Kpng)
End If
'mP
If pro2mP = "" Then
mP2 = 0
Else
mP2 = CDec(pro2mP)
End If
'Pm
If pro2Pm = "" Then
Pm2 = 1
Else
Pm2 = CDec(pro2Pm)
End If
'n
If pro2n = "" Then
n2 = 1
Else
n2 = CDec(pro2n)
End If
'alpha
If pro2alpha = "" Then
alpha2 = 1
Else
alpha2 = CDec(pro2alpha)
End If
End Sub
#End Region
#End Region
XtiTemp = X0
PtiTemp = P0_1
PtiTemp2 = P0_2
End Sub
#End Region
160
If BatchRadioButton.Checked = True Then
RepX = 0
RepP = 0
RepP2 = 0
RepS = 0
RepS2 = 0
RepS3 = 0
RepS4 = 0
End If
End Sub
#End Region
If CompSubComboBox.SelectedIndex = 0 Then
'Interactive Substrate
Rf = StiTemp / (Ks1 + StiTemp) * StiTemp2 / (Ks2 + StiTemp2)
RumaxCal = umax * Rf
RumaxCal2 = 0
Array.Sort(arr)
minValue = arr(0)
Rf = minValue
'NonInteractive Substrate
RumaxCal = umax * Rf
RumaxCal2 = 0
End If
If CompSubComboBox.SelectedIndex = 0 Then
'Interactive Substrate
Rf = StiTemp / (Ks1 + StiTemp) * StiTemp2 / (Ks2 + StiTemp2) * StiTemp3 / (Ks3 + StiTemp3)
RumaxCal = umax * Rf
RumaxCal2 = 0
161
num3 = StiTemp3 / (Ks3 + StiTemp3)
Array.Sort(arr)
minValue = arr(0)
Rf = minValue
'Substitutable substrate
RumaxCal = umax * Rf
RumaxCal2 = 0
'Substitutable substrate
RumaxCal = umax * StiTemp / (Ks1 + StiTemp) * StiTemp3 / (Ks3 + StiTemp3)
RumaxCal2 = factor_f * umax * StiTemp2 / (Ks2 + StiTemp2) * (Ks1 / (Ks1 + StiTemp))
End If
If CompSubComboBox.SelectedIndex = 0 Then
'Interactive Substrate
F = StiTemp / (Ks1 + StiTemp) * StiTemp2 / (Ks2 + StiTemp2) * StiTemp3 / (Ks3 + StiTemp3) * StiTemp4 / (Ks4 +
StiTemp4)
'Substitutable substrate
RumaxCal = umax * Rf
RumaxCal2 = 0
Array.Sort(arr)
minValue = arr(0)
Rf = minValue
'NonInteractive Substrate
RumaxCal = umax * Rf
RumaxCal2 = 0
End If
End Sub
#End Region
#End Region
162
#Region "Calculation Button"
Private Sub CalculateToolStripButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
CalculateToolStripButton.Click
'///Start Progress
_MainForm.ToolstripprogressBar.Value = 40
_MainForm.ProgressTimer.Enabled = True
''\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Initial data
'Simulation Time
If SimulationTimeTextBox.Text = "" Then
SimulationTimeTextBox.Focus()
MessageBox.Show("Simulation Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Flow rate
If FlowRateTextBox.Text = "" Then
FlowRateTextBox.Focus()
MessageBox.Show("Flow rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution Rate
If DilutionRateRadioButton.Checked = True Then
If DilutionRateTextBox.Text = "" Then
DilutionRateTextBox.Focus()
MessageBox.Show("Dilution rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeRadioButton.Checked = True Then
If RetentionTimeTextBox.Text = "" Then
RetentionTimeTextBox.Focus()
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
163
MultipleSubData.Sub2Yxs2TextBox.Text = "" OrElse _
MultipleSubData.Sub2KsTextBox.Text = "" OrElse _
MultipleSubData.Sub2fFactorTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'CompSub
If CompSubComboBox.SelectedIndex = 2 Then
If MultipleSubData.Sub2fFactorTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If 'CompSub
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
164
MultipleSubData.Sub2KsTextBox.Text = "" OrElse _
MultipleSubData.Sub2fFactorTextBox.Text = "" OrElse _
MultipleSubData.Sub3ConcTextBox.Text = "" OrElse _
MultipleSubData.Sub3Yxs3TextBox.Text = "" OrElse _
MultipleSubData.Sub3KsTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'CompSub
If CompSubComboBox.SelectedIndex = 2 Then
If MultipleSubData.Sub2fFactorTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If 'CompSub
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
165
End If
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'CompSub
If CompSubComboBox.SelectedIndex = 2 Then
If MultipleSubData.Sub2fFactorTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If 'CompSub
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
166
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
MultipleSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
167
Exit Sub
End If
168
Exit Sub
End If
'Product Yield
If MultipleProData.Pro1Yp1sTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If 'Pro Yield
'2 Product
If NumberProductComboBox.Text = "2" Then
'\\\\\\\\\\\\\\\\\\\\\ Product 1
'ProType
If MultipleProData.Pro1TypeToolStripLabel.Text = "Growth" OrElse _
MultipleProData.Pro1TypeToolStripLabel.Text = "" Then
If MultipleProData.Pro1KpgTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Product Yield
If MultipleProData.Pro1Yp1sTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
169
Exit Sub
End If 'Pro1 Yield
'\\\\\\\\\\\\\\\\\\\\\Product 2
If MultipleProData.Pro2TypeToolStripLabel.Text = "Growth" OrElse _
MultipleProData.Pro2TypeToolStripLabel.Text = "" Then
If MultipleProData.Pro2KpgTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Product Yield
If MultipleProData.Pro2Yp2sTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
MultipleProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If 'Pro2 Yield
170
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Show Table
Call HideAllGroup()
TableGroupBox.Show()
TableGroupBox.Dock = DockStyle.Fill
'AutScroll
Me.AutoScroll = False
'Hide
SubSubNoteLabel.Hide()
'Clear ComboBox
Call ClearResultComboBox()
'ReadData
Call ReadBioOperation()
Call ReadSub1Data()
Call ReadSub2Data()
Call ReadSub3Data()
Call ReadSub4Data()
Call ReadPro1Data()
Call ReadPro2Data()
'Calculation
Call MultipleCalculation()
'///Done Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Maximum
_MainForm.ProgressTimer.Enabled = False
'Button
Call EnableCommandButton()
End Sub
#End Region
171
APPENDIX H
'CAPS-NUM
CheckLockKeys()
'Panel
BatchPicturePanel.BackColor = Color.White
CSTRPicturePanel.BackColor = Color.White
'Bio Operation
Call BioOperation_Load()
'Load or OpenFile
If NumberSubstrateToolStripLabel.Text = "" AndAlso _
NumberProductToolStripLabel.Text = "" AndAlso _
NumberToxicToolStripLabel.Text = "" Then
'For Load
'Substrate
NumberSubstrateComboBox.Items.Clear()
NumberSubstrateComboBox.Items.Add("1")
NumberSubstrateComboBox.Items.Add("2")
NumberSubstrateComboBox.Items.Add("3")
NumberSubstrateComboBox.Items.Add("4")
NumberSubstrateComboBox.Text = NumberSubstrateComboBox.Items(0).ToString
'Product
Call NumberSubstrateChanged_Load()
'Toxic
NumberToxicComboBox.Items.Clear()
NumberToxicComboBox.Items.Add("0")
NumberToxicComboBox.Items.Add("1")
NumberToxicComboBox.Items.Add("2")
NumberToxicComboBox.Text = NumberToxicComboBox.Items(0).ToString
'Product
Call NumberSubstrateChanged_OpenFile()
'Toxic
NumberToxicComboBox.Items.Clear()
NumberToxicComboBox.Items.Add("0")
NumberToxicComboBox.Items.Add("1")
NumberToxicComboBox.Items.Add("2")
NumberToxicComboBox.Text = NumberToxicToolStripLabel.Text
End If
'Complementary
Dim items(2) As String
For i As Int32 = 0 To 2
items(i) = "Item " & i.ToString
Next
Me.CompSubComboBox.Items.AddRange(items)
Me.CompSubComboBox.DropDownStyle = ComboBoxStyle.DropDownList
Me.CompSubComboBox.DrawMode = DrawMode.OwnerDrawVariable
Me.CompSubComboBox.ItemHeight = Me.CompSubImageList.ImageSize.Height
Me.CompSubComboBox.Width = Me.CompSubImageList.ImageSize.Width + 20
Me.CompSubComboBox.MaxDropDownItems = Me.CompSubImageList.Images.Count
'Selected Index
If CompSubLabel.Text = "Monod's Model" OrElse _
CompSubLabel.Text = "" Then
'CompSubComboBox.Enabled = False
CompSubComboBox.SelectedIndex = 0
172
'CompSubComboBox.Enabled = True
CompSubComboBox.SelectedIndex = 2
End If
'Enable
Call ClickClickClick()
'Show GroupBox
Call ShowGroupBox()
End Sub
#End Region
End If
'CSTR
If CSTRRadioButton.Checked = True Then
CSTRPicturePanel.Show()
CSTRPicturePanel.Location = New Point(ModelGroupBox.Location.X + _
BatchPicturePanel.Location.X + _
ModelTableLayoutPanel.Location.X, _
ModelGroupBox.Location.Y + _
ModelTableLayoutPanel.Location.Y + _
BatchPicturePanel.Location.Y)
CSTRPicturePanel.Width = BatchPicturePanel.Width
CSTRPicturePanel.Height = BatchPicturePanel.Height
BatchPicturePanel.Hide()
End If
End Sub
#End Region
#Region "EnableCommandButton"
Private Sub EnableCommandButton()
If ReactionGroupBox.Visible = True OrElse _
ModelGroupBox.Visible = True OrElse _
OperationParaGroupBox.Visible = True Then
End If
End If
End Sub
#End Region
xTimeComboBox.Items.Clear()
y1Sub1ComboBox.Items.Clear()
y1Sub2ComboBox.Items.Clear()
y1Sub3ComboBox.Items.Clear()
y1Sub4ComboBox.Items.Clear()
y2BiomassComboBox.Items.Clear()
y3Pro1ComboBox.Items.Clear()
y3Pro2ComboBox.Items.Clear()
y5umaxComboBox.Items.Clear()
y4Xeno1ComboBox.Items.Clear()
y4Xeno2ComboBox.Items.Clear()
173
y6rS1ComboBox.Items.Clear()
y6rS2ComboBox.Items.Clear()
y6rS3ComboBox.Items.Clear()
y6rS4ComboBox.Items.Clear()
y7rX1ComboBox.Items.Clear()
y7rDComboBox.Items.Clear()
y8rP1ComboBox.Items.Clear()
y8rP2ComboBox.Items.Clear()
'Step
xTimeStepComboBox.Items.Clear()
y1Sub1StepComboBox.Items.Clear()
y1Sub2StepComboBox.Items.Clear()
y1Sub3StepComboBox.Items.Clear()
y1Sub4StepComboBox.Items.Clear()
y2BiomassStepComboBox.Items.Clear()
y3Pro1StepComboBox.Items.Clear()
y3Pro2StepComboBox.Items.Clear()
y4Xeno1StepComboBox.Items.Clear()
y4Xeno2StepComboBox.Items.Clear()
y5umaxStepComboBox.Items.Clear()
y6rS1StepComboBox.Items.Clear()
y6rS2StepComboBox.Items.Clear()
y6rS3StepComboBox.Items.Clear()
y6rS4StepComboBox.Items.Clear()
y7rX1StepComboBox.Items.Clear()
y7rDStepComboBox.Items.Clear()
y8rP1StepComboBox.Items.Clear()
y8rP2StepComboBox.Items.Clear()
End Sub
#End Region
'**************************************Operation Parameters
Private Tt As Decimal
Private deltaT As Decimal = 0.1
Private deltaI As Decimal
Private V As Double
Private F As Double
Private tau As Double
Private D As Double
'***************************************Biomass Variables
Private biomassConc As String = ""
Private sub1BiomassYield As String = ""
Private sub2BiomassYield As String = ""
Private sub3BiomassYield As String = ""
Private sub4BiomassYield As String = ""
Private X0 As Double
Private Yxs1 As Double
Private Yxs2 As Double
Private Yxs3 As Double
Private Yxs4 As Double
Private rX As Double = 0
Private rX1 As Double = 0
Private rD As Double = 0
'**************************************Substrate 1 Variables
Private sub1Conc As String = ""
Private sub1InhibitionConst As String
Private sub1umax As String
Private sub1Kd As String
Private sub1Ks As String
Private sub1mS As String
174
Private sub1OptSubstrate As String
Private S0 As Double
Private umax As Double
Private kd1 As Double
Private Ks1 As Double
Private mS1 As Double
Private rS As Double = 0
'****************************************Substrate 2 Variables
'**********************************************Substrate 3 Variables
'*******************************************Substrate 4 Variables
Private sub4Conc As String = ""
Private sub4Kd As String
Private sub4Ks As String
Private sub4mS As String
'**************************************Product 1 Variables
175
Private alpha1 As Double
Private rP As Double = 0
'**************************************Product 2 Variables
Private pro2Conc As String = ""
Private pro2ProductYield As String = ""
Private pro2Kpg As String
Private pro2Kpng As String
Private pro2mP As String
Private pro2RefSubstrate As String = ""
'****************************************************Toxic Variables
'Toxic 1
Private toxic1Conc As String
Private toxic1RefSub As String
Private toxic1KxI As String
Private toxic1InhibitionType As String
'Toxic 2
Private toxic2Conc As String
Private toxic2RefSub As String
Private toxic2KxI As String
Private toxic2InhibitionType As String
'1
Private Xti As Double
Private Sti As Double
Private Pti As Double
Private umaxCal As Double
'2
Private Sti2 As Double
Private StiTemp2 As Double
'3
Private Sti3 As Double
Private StiTemp3 As Double
'4
Private Sti4 As Double
Private StiTemp4 As Double
176
Private Rf_P1 As Double
Private Rf_P2 As Double
'**********************************************************Graph
#End Region
SimulationTime = SimulationTimeTextBox.Text
TimeInterval = StepTimeTextBox.Text
Volume = VolumeTextBox.Text
FlowRate = FlowRateTextBox.Text
RetentionTime = RetentionTimeTextBox.Text
DilutionRate = DilutionRateTextBox.Text
biomassConc = InhibitionSubData.BiomassConcTextBox.Text
sub1BiomassYield = InhibitionSubData.Sub1Yxs1TextBox.Text
sub2BiomassYield = InhibitionSubData.Sub2Yxs2TextBox.Text
sub3BiomassYield = InhibitionSubData.Sub3Yxs3TextBox.Text
sub4BiomassYield = InhibitionSubData.Sub4Yxs4TextBox.Text
'Convert to decimal
'Simulation Time
If SimulationTime = "" Then
Tt = 0
Else
Tt = CDec(SimulationTime)
End If
'Step time
If TimeInterval = "" Then
deltaI = 0.1
Else
deltaI = CDec(TimeInterval)
End If
'V
If Volume = "" Then
V = 1
Else
V = CDec(Volume)
End If
'F
177
If FlowRate = "" Then
F = 0
Else
F = CDec(FlowRate)
End If
'tau
If RetentionTime = "" Then
tau = 1
Else
tau = CDec(RetentionTime)
End If
'D
If DilutionRate = "" Then
D = 1
Else
D = CDec(DilutionRate)
End If
'Biomass Conc
If biomassConc = "" Then
X0 = 0
Else
X0 = CDec(biomassConc)
End If
'Yxs2
If sub2BiomassYield = "" Then
Yxs2 = 0.5
Else
Yxs2 = CDec(sub2BiomassYield)
End If
'Yxs3
If sub3BiomassYield = "" Then
Yxs3 = 0.5
Else
Yxs3 = CDec(sub3BiomassYield)
End If
'Yxs4
If sub4BiomassYield = "" Then
Yxs4 = 0.5
Else
Yxs4 = CDec(sub4BiomassYield)
End If
End Sub
#End Region
sub1Conc = InhibitionSubData.Sub1ConcTextBox.Text
sub1umax = InhibitionSubData.Sub1umaxTextBox.Text
sub1Kd = InhibitionSubData.Sub1kdTextBox.Text
sub1Ks = InhibitionSubData.Sub1KsTextBox.Text
sub1mS = InhibitionSubData.Sub1mSTextBox.Text
sub1InhibitionConst = InhibitionSubData.Sub1KITextBox.Text
sub1EdwardConst = InhibitionSubData.Sub1KEdTextBox.Text
sub1OptSubstrate = InhibitionSubData.Sub1OptSubTextBox.Text
'Convert to Decimal
'Sub1 Conc
If sub1Conc = "" Then
S0 = 0
Else
S0 = CDec(sub1Conc)
End If
'umax
If sub1umax = "" Then
umax = 0
Else
umax = CDec(sub1umax)
End If
'kd
If sub1Kd = "" Then
kd1 = 0
178
Else
kd1 = CDec(sub1Kd)
End If
'Ks
If sub1Ks = "" Then
Ks1 = 0
Else
Ks1 = CDec(sub1Ks)
End If
'mS
If sub1mS = "" Then
mS1 = 0
Else
mS1 = CDec(sub1mS)
End If
'Inhibition Const
If sub1InhibitionConst = "" Then
KI1 = 0
Else
KI1 = CDec(sub1InhibitionConst)
End If
'Edward const
If sub1EdwardConst = "" Then
KEd1 = 0
Else
KEd1 = CDec(sub1EdwardConst)
End If
'Sopt
If sub1OptSubstrate = "" Then
Sopt1 = 0
Else
Sopt1 = CDec(sub1OptSubstrate)
End If
End Sub
#End Region
sub2InhibitionConst = InhibitionSubData.Sub2KITextBox.Text
sub2EdwardConst = InhibitionSubData.Sub2KEdTextBox.Text
sub2OptSubstrate = InhibitionSubData.Sub2OptSubTextBox.Text
'Convert to Decimal
'Sub1 Conc
If sub2Conc = "" Then
S0_2 = 0
Else
S0_2 = CDec(sub2Conc)
End If
'kd
If sub2Kd = "" Then
kd2 = 0
Else
kd2 = CDec(sub2Kd)
End If
'Ks
If sub2Ks = "" Then
Ks2 = 0
Else
Ks2 = CDec(sub2Ks)
End If
'mS
If sub2mS = "" Then
mS2 = 0
Else
mS2 = CDec(sub2mS)
End If
'Inhibition Const
If sub2InhibitionConst = "" Then
KI2 = 0
Else
KI2 = CDec(sub2InhibitionConst)
End If
'Edward const
179
If sub2EdwardConst = "" Then
KEd2 = 0.5
Else
KEd2 = CDec(sub2EdwardConst)
End If
'Sopt
If sub2OptSubstrate = "" Then
Sopt2 = 0.5
Else
Sopt2 = CDec(sub2OptSubstrate)
End If
End Sub
#End Region
sub3Conc = InhibitionSubData.Sub3ConcTextBox.Text
sub3Kd = InhibitionSubData.Sub3kdTextBox.Text
sub3Ks = InhibitionSubData.Sub3KsTextBox.Text
sub3mS = InhibitionSubData.Sub3mSTextBox.Text
'Convert to Decimal
'Sub1 Conc
If sub3Conc = "" Then
S0_3 = 0
Else
S0_3 = CDec(sub3Conc)
End If
'kd
If sub3Kd = "" Then
kd3 = 0
Else
kd3 = CDec(sub3Kd)
End If
'Ks
If sub3Ks = "" Then
Ks3 = 0
Else
Ks3 = CDec(sub3Ks)
End If
'mS
If sub3mS = "" Then
mS3 = 0
Else
mS3 = CDec(sub3mS)
End If
End Sub
#End Region
'Convert to Decimal
'Sub1 Conc
If sub4Conc = "" Then
S0_4 = 0
Else
S0_4 = CDec(sub4Conc)
End If
'kd
If sub4Kd = "" Then
kd4 = 0
Else
kd4 = CDec(sub4Kd)
End If
'Ks
If sub4Ks = "" Then
Ks4 = 0
Else
Ks4 = CDec(sub4Ks)
End If
'mS
If sub4mS = "" Then
180
mS4 = 0
Else
mS4 = CDec(sub4mS)
End If
End Sub
#End Region
pro1Conc = InhibitionProData.Pro1ConcTextBox.Text
pro1ProductYield = InhibitionProData.Pro1Yp1sTextBox.Text
pro1InhibitionConst = InhibitionProData.Pro1KpTextBox.Text
pro1Kpg = InhibitionProData.Pro1KpgTextBox.Text
pro1Kpng = InhibitionProData.Pro1KpngTextBox.Text
pro1mP = InhibitionProData.Pro1mPTextBox.Text
pro1Pm = InhibitionProData.Pro1PmTextBox.Text
pro1n = InhibitionProData.Pro1nTextBox.Text
pro1alpha = InhibitionProData.Pro1alphaTextBox.Text
'Convert to decimal
'pro1 Conc
If pro1Conc = "" Then
P0_1 = 0
Else
P0_1 = CDec(pro1Conc)
End If
'KpI
If pro1InhibitionConst = "" Then
KpI1 = 0
Else
KpI1 = CDec(pro1InhibitionConst)
End If
'Kpg
If pro1Kpg = "" Then
kpg1 = 0
Else
kpg1 = CDec(pro1Kpg)
End If
'Kpng
If pro1Kpng = "" Then
kpng1 = 0
Else
kpng1 = CDec(pro1Kpng)
End If
'mP
If pro1mP = "" Then
mP1 = 0
Else
mP1 = CDec(pro1mP)
End If
'Pm
If pro1Pm = "" Then
Pm1 = 0
Else
Pm1 = CDec(pro1Pm)
End If
'n
If pro1n = "" Then
n1 = 0
Else
n1 = CDec(pro1n)
End If
'alpha
If pro1alpha = "" Then
alpha1 = 0
Else
alpha1 = CDec(pro1alpha)
End If
End Sub
#End Region
181
Private Sub ReadBioPro2Data()
pro2Conc = InhibitionProData.Pro2ConcTextBox.Text
pro2ProductYield = InhibitionProData.Pro2Yp2sTextBox.Text
pro2Kpg = InhibitionProData.Pro2KpgTextBox.Text
pro2Kpng = InhibitionProData.Pro2KpngTextBox.Text
pro2mP = InhibitionProData.Pro2mPTextBox.Text
'Convert to decimal
'pro1 Conc
If pro2Conc = "" Then
P0_2 = 0
Else
P0_2 = CDec(pro2Conc)
End If
'Kpg
If pro2Kpg = "" Then
kpg2 = 0
Else
kpg2 = CDec(pro2Kpg)
End If
'Kpng
If pro2Kpng = "" Then
kpng2 = 0
Else
kpng2 = CDec(pro2Kpng)
End If
'mP
If pro2mP = "" Then
mP2 = 0
Else
mP2 = CDec(pro2mP)
End If
End Sub
#End Region
toxic1Conc = InhibitionToxicData.Toxic1ConcTextBox.Text
toxic1KxI = InhibitionToxicData.Toxic1KITextBox.Text
toxic2Conc = InhibitionToxicData.Toxic2ConcTextBox.Text
toxic2KxI = InhibitionToxicData.Toxic2KITextBox.Text
'Convert to decimal
'Xe1
If toxic1Conc = "" Then
Xe1 = 0
Else
Xe1 = CDec(toxic1Conc)
End If
'KxI1
If toxic1KxI = "" Then
KxI1 = 0.5
Else
KxI1 = CDec(toxic1KxI)
End If
'Xe2
If toxic2Conc = "" Then
Xe2 = 0
Else
Xe2 = CDec(toxic2Conc)
End If
'KxI2
If toxic2KxI = "" Then
KxI2 = 0.5
Else
KxI2 = CDec(toxic2KxI)
End If
End Sub
#End Region
#End Region
182
#Region "Call SetInitialConcentration"
Private Sub SetInitialConcentration()
StiTemp = S0
StiTemp2 = S0_2
StiTemp3 = S0_3
StiTemp4 = S0_4
XtiTemp = X0
PtiTemp = P0_1
PtiTemp2 = P0_2
XetiTemp = Xe1
XetiTemp2 = Xe2
rS = 0
rS2 = 0
rS3 = 0
rS4 = 0
rX = 0
rP = 0
rP2 = 0
End Sub
#End Region
RepP = 0
RepP2 = 0
RepS = 0
RepS2 = 0
RepS3 = 0
RepS4 = 0
End If
End Sub
#End Region
If CompSubComboBox.SelectedIndex = 0 Then
Rf = Rf_S1 * Rf_P1 * Rf_Xe1 * Rf_Xe2
Array.Sort(arr)
minValue = arr(0)
Rf = Rf_S1 * minValue * Rf_P1 * Rf_Xe1 * Rf_Xe2
183
ElseIf (Sub1InhibitionTypeLabel.Text = "" OrElse _
Sub1InhibitionTypeLabel.Text = "None") AndAlso _
(Sub2InhibitionTypeLabel.Text = "Comp" OrElse _
Sub2InhibitionTypeLabel.Text = "NonComp" OrElse _
Sub2InhibitionTypeLabel.Text = "Andrew" OrElse _
Sub2InhibitionTypeLabel.Text = "Edward" OrElse _
Sub2InhibitionTypeLabel.Text = "Steele") Then
'Only S2 is inhibitory, find minValue of S1, S3, S4
num1 = StiTemp / (Ks1 + StiTemp)
num3 = StiTemp3 / (Ks3 + StiTemp3)
num4 = StiTemp4 / (Ks4 + StiTemp4)
Array.Sort(arr)
minValue = arr(0)
Rf = Rf_S2 * minValue * Rf_P1 * Rf_Xe1 * Rf_Xe2
Array.Sort(arr)
minValue = arr(0)
Rf = Rf_S1 * Rf_S2 * minValue * Rf_P1 * Rf_Xe1 * Rf_Xe2
End If
End If
End Sub
#End Region
#End Region
184
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Flow rate
If FlowRateTextBox.Text = "" Then
FlowRateTextBox.Focus()
MessageBox.Show("Flow rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Dilution Rate
If DilutionRateRadioButton.Checked = True Then
If DilutionRateTextBox.Text = "" Then
DilutionRateTextBox.Focus()
MessageBox.Show("Dilution rate is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Retention Time
If RetentionTimeRadioButton.Checked = True Then
If RetentionTimeTextBox.Text = "" Then
RetentionTimeTextBox.Focus()
MessageBox.Show("Retention Time is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
End If 'CSTR
185
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'2 Sub
If NumberSubstrateComboBox.Text = "2" Then
'Data
If InhibitionSubData.BiomassConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub1ConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub1Yxs1TextBox.Text = "" OrElse _
InhibitionSubData.Sub1umaxTextBox.Text = "" OrElse _
InhibitionSubData.Sub1KsTextBox.Text = "" OrElse _
InhibitionSubData.Sub2ConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub2Yxs2TextBox.Text = "" OrElse _
InhibitionSubData.Sub2KsTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
186
End If '2 Sub
'3 Sub
If NumberSubstrateComboBox.Text = "3" Then
'Data
If InhibitionSubData.BiomassConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub1ConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub1Yxs1TextBox.Text = "" OrElse _
InhibitionSubData.Sub1umaxTextBox.Text = "" OrElse _
InhibitionSubData.Sub1KsTextBox.Text = "" OrElse _
InhibitionSubData.Sub2ConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub2Yxs2TextBox.Text = "" OrElse _
InhibitionSubData.Sub2umaxTextBox.Text = "" OrElse _
InhibitionSubData.Sub2KsTextBox.Text = "" OrElse _
InhibitionSubData.Sub3ConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub3Yxs3TextBox.Text = "" OrElse _
InhibitionSubData.Sub3KsTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
187
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'4 Sub
If NumberSubstrateComboBox.Text = "4" Then
'Data
If InhibitionSubData.BiomassConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub1ConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub1Yxs1TextBox.Text = "" OrElse _
InhibitionSubData.Sub1umaxTextBox.Text = "" OrElse _
InhibitionSubData.Sub1KsTextBox.Text = "" OrElse _
InhibitionSubData.Sub2ConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub2Yxs2TextBox.Text = "" OrElse _
InhibitionSubData.Sub2umaxTextBox.Text = "" OrElse _
InhibitionSubData.Sub2KsTextBox.Text = "" OrElse _
InhibitionSubData.Sub3ConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub3Yxs3TextBox.Text = "" OrElse _
InhibitionSubData.Sub3KsTextBox.Text = "" OrElse _
InhibitionSubData.Sub4ConcTextBox.Text = "" OrElse _
InhibitionSubData.Sub4Yxs4TextBox.Text = "" OrElse _
InhibitionSubData.Sub4KsTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
188
'Sub4Name cannot be empty
If InhibitionSubData.Sub4NameComboBox.Text = "" Then
MessageBox.Show("Name of Substrate 4 is required.", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
189
MessageBox.Show("Cannot have the same name for Substrate 3 and Substrate 4." & ControlChars.NewLine & _
"Please select again!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionSubData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
End If
'Product Yield
If InhibitionProData.Pro1Yp1sTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If 'Pro Yield
'2 Product
If NumberProductComboBox.Text = "2" Then
'\\\\\\\\\\\\\\\\\\\\\ Product 1
190
If InhibitionProData.Pro1TypeToolStripLabel.Text = "Growth" OrElse _
InhibitionProData.Pro1TypeToolStripLabel.Text = "" Then
If InhibitionProData.Pro1KpgTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Product Yield
If InhibitionProData.Pro1Yp1sTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If 'Pro1 Yield
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Product 2
'Data
If InhibitionProData.Pro2TypeToolStripLabel.Text = "Growth" OrElse _
InhibitionProData.Pro2TypeToolStripLabel.Text = "" Then
If InhibitionProData.Pro2KpgTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
191
MessageBoxIcon.Information)
InhibitionProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
'Product Yield
If InhibitionProData.Pro2Yp2sTextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionProData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If 'Pro2 Yield
192
'Data
If InhibitionToxicData.Toxic1ConcTextBox.Text = "" OrElse _
InhibitionToxicData.Toxic1KITextBox.Text = "" Then
MessageBox.Show("Data is required!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionToxicData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If
193
(InhibitionToxicData.Xeno1RefSubToolStripLabel.Text = "2" AndAlso _
InhibitionToxicData.Xeno2RefSubToolStripLabel.Text = "2") OrElse _
(InhibitionToxicData.Xeno1RefSubToolStripLabel.Text = "3" AndAlso _
InhibitionToxicData.Xeno2RefSubToolStripLabel.Text = "3") OrElse _
(InhibitionToxicData.Xeno1RefSubToolStripLabel.Text = "4" AndAlso _
InhibitionToxicData.Xeno2RefSubToolStripLabel.Text = "4") Then
MessageBox.Show("Cannot have the same reference substrate." & ControlChars.NewLine & _
"Please select again!", _
"Message", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information)
InhibitionToxicData.ShowDialog()
Call EnableCommandButton()
'///Cancel Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum
_MainForm.ProgressTimer.Enabled = False
Exit Sub
End If 'Ref sub
End If '2 Xeno Comp
'Show Table
Call HideAllGroup()
TableGroupBox.Show()
TableGroupBox.Dock = DockStyle.Fill
'AutScroll
Me.AutoScroll = False
'Clear ComboBox
Call ClearComboBox()
'Read BioOperationData
Call ReadBioOperation()
'Read Sub1Data
Call ReadSub1Data()
'Read Sub2Data
Call ReadSub2Data()
'Read Sub3Data
Call ReadSub3Data()
'Read Sub4Data
Call ReadSub4Data()
'Read Product1Data
Call ReadBioPro1Data()
'Read Product2Data
Call ReadBioPro2Data()
'Read ToxicData
Call ReadToxicFile()
'Calculation
Call InhibitionModelCalculation()
'///Done Progress
_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Maximum
_MainForm.ProgressTimer.Enabled = False
'Button
Call EnableCommandButton()
End Sub
#End Region
194
REFERENCES
Birol, G., Undey, C., Cinar, A., A modular simulation package for fed-batch fermentation:
Drapcho, C. M., Nghiem, P. N., Walker, T. W., Biofuel engnieering process technology, 2008.
GimBun, J., Radiah, A. B. D., Chuah, T. G., Bioreactor design via spreadsheet - a study on the
Krishnan, M. S., Fermentation kinetics of ethanol production from glucose and xylose by
Nemeth, A., Sevella, B., Development of a new bioprocess for production of 1,3 – propandiol I.:
Rizzo, D. M., The comparison of four dynamic systems-based software packages: Translation
Pfeifer, M. J., Effect of culture conditions on Xylitol production by Candida guilliermondii FTI
Shanklin, T., Selection of bioprocess simulation software for industrial applications, Biotechnol
Bioeng, 2000.
Shi, J., Functional Food Ingredients and Nutraceuticals: Processing Technologies (Functional
2007.
195