biomass v2.0: a new tool for bioprocess simulation

205
Clemson University TigerPrints All eses eses 5-2011 BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION Y Phan-thien Clemson University, [email protected] Follow this and additional works at: hps://tigerprints.clemson.edu/all_theses Part of the Biochemistry Commons is esis is brought to you for free and open access by the eses at TigerPrints. It has been accepted for inclusion in All eses by an authorized administrator of TigerPrints. For more information, please contact [email protected]. Recommended Citation Phan-thien, Y, "BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION" (2011). All eses. 1096. hps://tigerprints.clemson.edu/all_theses/1096

Upload: others

Post on 01-Feb-2022

19 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

Clemson UniversityTigerPrints

All Theses Theses

5-2011

BioMASS v2.0: A NEW TOOL FORBIOPROCESS SIMULATIONY Phan-thienClemson University, [email protected]

Follow this and additional works at: https://tigerprints.clemson.edu/all_theses

Part of the Biochemistry Commons

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 authorizedadministrator of TigerPrints. For more information, please contact [email protected].

Recommended CitationPhan-thien, Y, "BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION" (2011). All Theses. 1096.https://tigerprints.clemson.edu/all_theses/1096

Page 2: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

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

Page 3: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

ii

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

summary, BioMASS v2.0 offers an effective way of better understanding bioprocessing.

Page 4: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

iii

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

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.

I would like to take this opportunity to express my deep gratitude to my parents,

my brother, and my little sister for their love, patience and encouragement during the

long course of my study.

Finally, I would like to thank all my friends in the United States for just

everything they did to make my stay here an experience for a lifetime.

Page 5: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

iv

TABLE OF CONTENTS

TITLE PAGE ....................................................................................................................... i

ABSTRACT ........................................................................................................................ ii

ACKNOWLEDGEMENTS ............................................................................................... iii

TABLE OF CONTENTS ................................................................................................... iv

LIST OF FIGURES ........................................................................................................... vi

LIST OF TABLES ............................................................................................................. ix

Chapter 1 ..........................................................................................................................1

INTRODUCTION ....................................................................................................... 1

Chapter 2 ..........................................................................................................................5

BioMASS v2.0............................................................................................................. 5

Chapter 3 ........................................................................................................................29

BIOPROCESS MODELING AND SIMULATION USING BioMASS v2.0 .......... 29

Chapter 4 ........................................................................................................................62

CONCLUSION ......................................................................................................... 62

APPENDICES .................................................................................................................. 63

APPENDIX A ................................................................................................................... 64

COMMANDS IN BioMASS v2.0 ............................................................................. 64

APPENDIX B ................................................................................................................... 75

DETAILS OF “NOTEBOOK” COMMAND ............................................................ 75

APPENDIX C ................................................................................................................... 83

VB CODE FOR ZERO-ORDER CHEMICAL REACTION.................................... 83

APPENDIX D ................................................................................................................. 106

VB CODE FOR FIRST-ORDER CHEMICAL REACTION ................................. 106

Page 6: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

v

APPENDIX E ................................................................................................................. 118

VB CODE FOR SECOND-ORDER CHEMICAL REACTION ............................ 118

APPENDIX F.................................................................................................................. 130

VB CODE FOR SINGLE LIMITING NUTRIENT ................................................ 130

APPENDIX G ................................................................................................................. 151

VB CODE FOR MULTIPLE LIMITING NUTRIENTS ........................................ 151

APPENDIX H ................................................................................................................. 172

VB CODE FOR INHIBITION MODEL ................................................................. 172

REFERENCES ............................................................................................................... 195

Page 7: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

vi

LIST OF FIGURES

Figure 2.1. “Start Page” window. ....................................................................................... 7

Figure 2.2. Commands in “File” Menu. .............................................................................. 8

Figure 2.3. “Add another reactor” checkbox is selected. .................................................. 11

Figure 2.4. Simulation window of Irreversible Chemical Kinetics for zero-order reaction............................................................................................................................................ 12

Figure 2.5. “Temperature Effect” window. ...................................................................... 13

Figure 2.6. Simulation window of “Single Limiting Nutrient”. ....................................... 16

Figure 2.7. “Enter Data for Bioreactor 1” window. .......................................................... 17

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.10. Save Data, Results and Graphs in Excel. ..................................................... 21

Figure 2.11. Simulation window of Multiple Limiting Nutrients. .................................... 22

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.14. Simulation window of Inhibition Model. ..................................................... 25

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.1. Start Pageof BioMASS v2.0. .......................................................................... 34

Figure 3.2. “Enter data for Substrate” window. ................................................................ 35

Figure 3.3. List of supported product inhibition model in BioMASS v2.0. ..................... 36

Figure 3.4. “Notebook” window in BioMASS v2.0 ......................................................... 37

Page 8: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

vii

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.6. Studentized residual plot for glucose concentration. ...................................... 42

Figure 3.7. Studentized residual plot for biomass concentration. ..................................... 42

Figure 3.8. Studentized residual plot for Hydrogen concentration. .................................. 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................ 44

Figure 3.10. Simulated profiles of H2 concentration with various initial glucose concentration in a batch system including impact of H2 inhibition. ................................. 45

Figure 3.11. Simulated profiles of H2 concentration with differentmaxµ values in a batch

system including impact of H2 inhibition. ........................................................................ 46

Figure 3.12. Simulated profiles of H2 concentration with different SK values in a batch

system including impact of H2 inhibition. ........................................................................ 46

Figure 3.13. Simulated profiles of H2 concentration with different SXY / values in batch

system including impact of H2 inhibition. ........................................................................ 47

Figure 3.14. Simulated results of hydrogen production in a CSTR system at HRT of 6h............................................................................................................................................ 49

Figure 3.15. Simulated profiles of glucose, biomass and H2 concentration at various retention time in a CSTR system. ..................................................................................... 50

Figure 3.16. Simulated profiles of H2 concentration at various initial glucose concentration in a CSTR system at HRT of 6 hours. ........................................................ 51

Figure 3.17. Experimental (points) and simulated (lines) profiles of glucose, xylose and xylitol concentration in a batch system. ............................................................................ 53

Figure 3.18. Studentized residual plot for xylose concentration. ..................................... 53

Figure 3.19. Studentized residual plot for xylitol concentration. ..................................... 54

Figure 3.20. Simulated profiles of xylitol concentration with different maxµ values in a

batch system. ..................................................................................................................... 55

Page 9: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

viii

Figure 3.21. Simulated profiles of xylitol concentration with different 1SK values in a

batch system. ..................................................................................................................... 55

Figure 3.22. Simulated profiles of xylitol concentration with different 2SK values in a

batch system. ..................................................................................................................... 56

Figure 3.23. Simulated profiles of xylitol concentration with different 1/ SXY values in a

batch system. ..................................................................................................................... 56

Figure 3.24. Simulated profiles of xylitol concentration with different 2/ SXY values in a

batch system. ..................................................................................................................... 57

Figure 3.25. Simulated profiles of glucose, xylose, xylitol and ethanol concentration in a batch system. ..................................................................................................................... 58

Figure A. 1. Commands in “View” Menu. ....................................................................... 65

Figure A. 2. Commands in “Tools” Menu. ....................................................................... 66

Figure A. 3. Commands in “Windows” Menu. ................................................................. 67

Figure A. 4. Commands in “Help” Menu. ........................................................................ 68

Figure A. 5. “Notebook” window. .................................................................................... 69

Figure A. 6. “About BioMASS v2.0” window. ................................................................ 70

Figure A. 7. Standard Toolbar and Calculation Toolbar. ................................................. 70

Figure A. 8. Scroll Bar and Status Bar.............................................................................. 73

Page 10: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

ix

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

Table A. 1. List of command icons in Standard Toolbar. ................................................. 71

Table A. 2. List of command icons in Calculation Toolbar.............................................. 72

Table A. 3. List of common function keys. ...................................................................... 73

Page 11: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

Chapter 1

INTRODUCTION

Bioprocess simulation software

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

and put into the system.

Page 12: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

2

BioMASS v1.0

BioMASS stands for Biological Modeling and Simulation Software and was developed Bhairavi

in 2006 that included:

• 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

substitutable or complementary substrates.

• Inhibition model includes inhibitory effects of substrates, products, or xenobiotic

compounds on microbial growth.

All of these modes can be carried out in either batch or continuous operation and with a

single bioreactor or two bioreactors in series.

The advantages that the software offers include:

• Many complex equations may be solved simultaneously. In other words, a large number

of process variations can be synthesized and analyzed interactively.

• The software may be run on inexpensive workstations and laptops.

• Results may be presented as graphs and tables.

• The software may be integrated with other commonly used softwares such as Excel to

export results for file saving or further data analysis.

• The software allows the user to :

Page 13: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

3

� Simulate bioreactor experiments involving microbial species and predict the

products of the experiments.

� Study the effects of key process variables, for example, initial substrate

concentration, temperature.

� Investigate complex or integrated biochemical operations without the need of

expensive or complex experiment.

� Study both batch and continuous bioprocesses.

• Performance characteristics can be described by mathematical expressions. Therefore,

potential problems can be investigated, and behavior under varying conditions can be

tested to allow process optimization.

• The software can be further developed to satisfy other demands, and also can be used in

training and education.

However, the aforementioned version of the BioMASS software also has several limitations,

which include:

• Programming interface is not very attractive.

• Screen resolution adjustment.

• Creation of charts takes too long.

• The application toolbar contains too few options.

• Lack of operations that help to increase cell concentration and improve product formation

such as continuous process with cell recycle.

Objectives

Page 14: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

4

• 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

knowledge of the field.

• 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.

Overview of the Thesis

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

need for process simulators exclusively to model microbial growth in bioreactors.

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

to validate the accuracy and utility of the simulator.

Finally, conclusions of this research are given in Chapter 4.

Page 15: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

5

Chapter 2

BioMASS v2.0

BioMASS is a flexible, easy to use program with the characteristics as follows:

• Communicates with the user through a user friendly graphic surface.

• 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

later in this chapter.

System Requirements

BioMASS will run on any PC and compatible with processor that runs

Windows2000/XP/7. The following is a more detailed description of hardware and software

requirements:

• Hard Disk: The program will occupy anywhere from 40 to 50 MB of space on

hard dish.

• Processor/RAM: 256 MB of RAM is required.

Page 16: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

6

• Mouse: The presence of a mouse or similar pointing device supported by

Windows 2000/XP/7 is required.

• Video adapter/Monitor: The program requires a minimum resolution of

1024x768.

• Software: Microsoft Excel 2007.

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

status bar, and the display field for graphic.

Page 17: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

7

Figure 2.1. “Start Page” window.

Page 18: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

8

Figure 2.2. Commands in “File” Menu.

Page 19: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

9

Irreversible Chemical Kinetics

The following is the irreversible chemical reaction which is considered in the simulator:

BA k→

Within the process, all the reactant A reacts to form product B. The reactant in a

bioreaction is known as the substrate.

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

textboxes is optional, and it does not affect to the calculation.

- 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

concentration is required for the simulation, product concentration can be zero.

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 13 −− TML (M, L, T are

expressed as the units of mass, length, and time, respectively), or 1−T in first-order reaction, and

113 −− tML 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

Page 20: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

10

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 system composed of two reactors link in series (Fig. 2.3).

- 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

same in a multi-stage system.

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

one of those options to enable the textbox.

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

Page 21: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

11

constant k has been corrected by Arrhenius equation. The user can uncheck that checkbox to

restore the original value.

Figure 2.3. “Add another reactor” checkbox is selected.

Page 22: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

12

Figure 2.4. Simulation window of Irreversible Chemical Kinetics for zero-order reaction.

Page 23: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

13

Figure 2.5. “Temperature Effect” window.

Page 24: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

14

Biological Kinetics

Microbial growth is a complex phenomenon, and depending on environment conditions,

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.

Ss

S

SK

S

+=

µµ

ˆ (3.10)

The specific growth rate µ is not constant, and dependent on the substrate concentration. The

value of half saturation constant SK is equal to the substrate concentration at which the growth

rate µ is equal to 1/2 ofµ̂

==2

ˆ when

µµSKS . During low substrate concentration, reactions

are first order

ˆ

S

S

K

Sµµ , while at high substrate concentrations, they are zero order( ) µ̂µ ≈ .

BioMASS v2.0 supports single, multiple limiting nutrient and inhibition model.

Single Limiting Nutrient

The user interface contains four main blocks (Fig 2.6).

- 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

Page 25: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

15

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

understand the differences of each option.

- 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

when this checkbox is selected.

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

to specify the operation conditions such as initial concentrations, kinetics parameters,

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.

Page 26: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

16

Figure 2.6. Simulation window of “Single Limiting Nutrient”.

Page 27: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

17

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”

buttons are enabled once the calculations have been performed.

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

Page 28: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

18

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

is the graph of growth rate with substrate concentration.

Page 29: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

19

Figure 2.8. Simulation results of Single Limiting Nutrient were displayed in Table.

Page 30: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

20

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

BioMASS v2.0 or do further analysis.

Page 31: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

21

Figure 2.10. Save Data, Results and Graphs in Excel.

Multiple Limiting Nutrients

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

minimum number of substrate can be chosen is two.

- 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.

Page 32: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

22

- 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

complementary substrate, which can be interactive or non-interactive model, or substitutable

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

information regarding the products of the bioprocess (Fig 2.11).

Figure 2.11. Simulation window of Multiple Limiting Nutrients.

Page 33: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

23

When inputting data for substrate, some values are initial concentrations, biomass yield,

maximum growth ratemaxµ , half saturation concentrationSK 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

the Arrhenius or Modified Arrhenius equation.

Figure 2.12. “Enter data for Substrate” window of Multiple Limiting Nutrients.

Page 34: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

24

When inputting data for product, some values need to be entered to enable running the

simulation such as product yield, growth associated product pgK or non-growth associated

product pngK 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

Page 35: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

25

substrate can be chosen, whereas for both product and Xenobiotic compound, a minimum of zero

can be selected (Fig 2.14).

Figure 2.14. Simulation window of Inhibition Model.

The user is allowed to set inhibitory for Substrate 1 and Substrate 2 (Fig 2.15). BioMASS

supports a list of substrate inhibition models of Competitive Inhibition, Non-Competitive

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

equation of a model will be highlighted every time it’s selected.

Page 36: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

26

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

supports product inhibition models of Competitive Inhibition, Non-Competitive Inhibition,

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”.

Page 37: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

27

Figure 2.16. “Enter data for product” window of Inhibition Model.

BioMASS v2.0 also accounts for the inhibitory effect of Xenobiotic Compound (Fig

2.17). BioMASS supports inhibition models of Competitive Inhibition, Non-Competitive

Inhibition, and Uncompetitive Inhibition. The user can click on the arrow in the ComboBox to

choose inhibition model for each Xenobiotic compound.

Page 38: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

28

Figure 2.17. “Enter data for Xenobiotic Compound” of Inhibition Model.

Page 39: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

29

Chapter 3

BIOPROCESS MODELING AND SIMULATION USING BioMASS v2.0

Y N. Phan-Thien, Caye M. Drapcho*

Department of Biosystems Engineering, Clemson University

Clemson, SC-29630, USA

*Corresponding author: Tel./Fax: +1 864 656 0378

E-mail address: [email protected]

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

summary, BioMASS v2.0 offers an effective way of better understanding bioprocessing.

Keywords: bioprocess modeling; simulation; hydrogen; fermentation.

Page 40: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

30

Nomenclature: S, substrate concentration (g/L); 0S , initial substrate concentration (g/l); iS ,

inlet substrate concentration (g/L); 1S , glucose concentration (g/L); 2S , xylose concentration

(g/L); 1t

S , substrate concentration at t1 (g/L); 2t

S , substrate concentration at t2 (g/L); X , biomass

concentration (g/L); 0X , initial biomass concentration (g/L); iX , inlet biomass concentration

(g/L); 1t

X , biomass concentration at t1 (g/L); 2t

X , biomass concentration at t2 (g/L); P, product

concentration (g/L); 0P , product concentration (g/L); iP , inlet product concentration (g/L); mP ,

critical product concentration above which cells cannot grow (g/L); 1t

P , product concentration at

t1 (g/L); 2t

P , product concentration at t2 (g/L); n, dimensionless constant; SK , half saturation

constant (g/L); 1SK , half saturation contant of glucose (g/L);

2SK , half saturation constant of

xylose (g/L); µ , specific growth rate coefficient (h-1); maxµ , maximum specific growth rate

coefficient (h-1); b, decay constant (h-1); SXY / , biomass yield (g of X / g of S); Sm , substrate

maintenance constant (g of S/ g of X -h); Pr , rate of production formation (g/L-h); SPY / , product

yield (g of P/ g of S); pgK , coefficient for growth associated product (g of P/g of X); pngK ,

coefficient for non-growth associated (g of P/g of X); Pm , substrate maintenance constant (g of

P/ g of X -h); ,τ retention time (h).

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

Page 41: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

31

(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

devices. Moreover, because of recent development of bioprocess, there is limited published

information on the subject. On the other hand, simulation can only be run until all the data is

collected and put into the system.

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

measurements are frequently subject to experimental error.

Despite many challenges, new models and measurement methods are constantly being

researched and developed to overcome these difficulties. Spreadsheet applications such as

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.

Page 42: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

32

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

simulating models in those applications is usually time-consuming. STELLA is developed by

ISEE systems, which is easy to learn and that is the reason for its extensive use in education.

STELLA creates a diagram of the interrelationships between the components of a model.

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

better understanding of bioprocesses (Rizzo, 2006). Madonna is a software package developed

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

importance of model parameters (Nemeth, 2008).

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

Page 43: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

33

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

simulation software which can be used in pharmaceutical and biotechnology industries

(http://www.simulations-plus.com/), and EnviroSim or Hydromatis are developers of wastewater

treatment software (http://www.envirosim.com/, http://www.hydromantis.com/). Finally,

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

production), or wastewater treatment. Simulation software packages come in variety of

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.

Page 44: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

34

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

Page 45: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

35

can be carried out in either batch or continuous operation and with a single bioreactor or two

bioreactors in series.

Figure 3.2. “Enter data for Substrate” window.

Page 46: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

36

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

better understanding about bioprocess (Fig 3.4).

Page 47: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

37

Figure 3.4. “Notebook” window in BioMASS v2.0

Kinetics Models

Kinetics is an important subject in biological engineering. It is important because it

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

determined experimentally, makes the model fit the system investigated.

Ss

S

SK

S

+=

µµ

ˆ (3. 1)

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

Page 48: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

38

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

of batch operation, the mass balance equation can be express as:

bXXdt

dX−= µ (3. 2)

XmY

r

Ydt

dSS

SP

P

SX

++−=

//

µ (3. 3)

Xrdt

dPP= (3. 4)

For growth associated products:

PpgP mKr += µ (3. 5)

For non-growth associated products:

PpngP mKr += (3. 6)

For mixed growth products:

PpngpgP mKKr ++= µ (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

changes resulting from the hydraulic characteristics of the system as well.

bXXXX

dt

dX i −+

−= µττ

(3. 8)

XmY

r

Y

SS

dt

dSS

SP

P

SX

i

++−

−=//

µττ

(3. 9)

XrPP

dt

dPP

i +

−=ττ

(3. 10)

Page 49: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

39

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

m

S

SP

P

S

K

+

= 1

1

µ̂µ (3. 11)

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

BioMASS v2.0. If “Add2ndBioReactorCheckBox.Checked = True ”, groupbox of bioreactor 2

will be shown, “Reactor2GroupBox.Show() ”; or vice versa, the groupbox will be hiden,

“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

performing the forward finite differential equation calculations.

( ) ( )12*]*[112

ttXbXX ttt −−+= µ (3. 12)

( ) ( ) ( )12*]***[1112

ttXkXkPP tpgtpngtt −++= µ (3. 13)

( ) ( ) )(*]/*/*[ 12// 1112ttYXkYXSS SPtpngSXttt −+−= µ (3. 14)

MODEL VALIDATION

Two case studies will be evaluated to compare simulated results with actual data.

Page 50: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

40

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

hydrogen was identified as primary (growth-associated) product. The bacterium of Thermotoga

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

limiting substrate is assumed to be small enough to be neglected. 0S = 5 g/L, 0X = 0.001 g/L,

0P = 0, maxµ = 0.94 h-1, SK = 0.57 g/L, b = 0.01 g/L, SXY / = 0.248 g XB/g S, SPY / = 0.0286 g H2/g

S, pgk = 0.115 g H2/g XB.

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 mP = 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

concentration of 26.7 mmol/L were observed.

Page 51: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

41

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.

A pattern of overprediction values at low concentration and underprediction at high

concentration is evident, indicating some factor impacting biomass concentration is not being

considered. However, studentized residual values range within ± 2 standard deviations,

indicating good fit of predicted values to actual observations.

Page 52: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

42

Figure 3.6. Studentized residual plot for glucose concentration.

Figure 3.7. Studentized residual plot for biomass concentration.

Figure 3.8 indicates that BioMASS accurately predicts H2 concentration, but with the

same pattern as Figure 3.7.

Page 53: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

43

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

10 hours of fermentation, no further glucose consumption or hydrogen production occurred. This

was batch operation, which means no material was either added or removed from the bioreactor;

therefore, there was potential of H2 inhibition due to increasing H2 concentration in bioreactor. If

headspace gas was removed during incubation to avoid production prohibition, the hydrogen

simulated could be doubled (71.3 mmol/L).

Page 54: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

44

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

increase of glucose concentration. In Figure 3.10, there was no significant difference in

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.

Page 55: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

45

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µ ,SK and SXY / (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 ofmaxµ . At -1max h 7.4=µ , 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

when increased ,SK and it took 20 hours of fermentation to reach 26.5 mmol/L of H2 at

85.2=SK g/L (Fig 3.12). In Figure 3.13, H2 concentration is increased with the increase of SXY / ;

however, there is no significant difference between 248.0/ =SXY g X/ g S and 496.0/ =SXY g X/

g S. The results of sensitivity analysis demonstrated a good agreement between estimated values

and experimental data.

Page 56: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

46

Figure 3.11. Simulated profiles of H2 concentration with differentmaxµ values in a batch system

including impact of H2 inhibition.

Figure 3.12. Simulated profiles of H2 concentration with different SK values in a batch system

including impact of H2 inhibition.

Page 57: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

47

Figure 3.13. Simulated profiles of H2 concentration with different SXY / values in batch system

including impact of H2 inhibition.

CSTR fermentation

One of the advantages of BioMASS development is to investigate the behavior of

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

retention time of 1 hour (Table 3.1).

Page 58: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

48

Table 3.1. Simulated results of hydrogen production at different retention time.

Retention time (h) Glucose conversion

(%) Biomass concentration

(g/L) Rate of H2 production

(mmol/L-h)

1 0.002 0 0

1.25 0.16 0.002 0.1

1.5 2.222 0.0272 1.3

2 48.648 0.5957 25.8

3 94.418 1.1366 20.2

4 95.668 1.1453 17.05

6 97.394 1.1506 11.55

8 98.13 1.1476 8.75

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.

Page 59: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

49

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.

Page 60: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

50

Figure 3.15. Simulated profiles of glucose, biomass and H2 concentration at various retention time in a CSTR system.

To investigate the effect of initial substrate concentration, simulation of various

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.

Page 61: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

51

Table 3.2. Simulated results of rate of H2 production with different initial substrate concentration in a batch system.

Initial substrate concentration (g/L)

H2 concentration (mmol/L)

Rate of H2 production (mmol/L-h)

5 69.45 34.05

10 140.75 82.5

20 285.05 189.35

Figure 3.16. Simulated profiles of H2 concentration at various initial glucose concentration in a CSTR system at HRT of 6 hours.

Case study 2: Xylitol production from xylose and glucose as multiple substitutable nutrients

Fermentation used glucose and xylose as a multiple substitutable nutrients. The

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

modeled as a function of S2 with inhibition by S1 as follows:

Page 62: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

52

+=

11

11 ˆ

SK

S

S

µµ (3. 15)

+

+=

11

1

22

22 ˆ*

SK

K

SK

Sf

S

S

S

µµ (3. 16)

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. GluS = 7 g/L, XylS = 28 g/L, 0X = 0.01

g/L, 0P = 0, maxµ = 0.8 h-1, f = 0.4, 1SK = 1 g/L, 2SK = 7 g/L, b = 0.1 h-1, GluSXY / = 0.16 g X/g SGlu,

XylSXY / = 0.45 g X/g SXyl, XylSPY / = 0.55 g xylitol/g xylose, pngk = 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

with experimental data (Pfeifer, 2000).

Page 63: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

53

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.

Figure 3.18. Studentized residual plot for xylose concentration.

Page 64: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

54

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µ ,SK and SXY / (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%

or 50%, they had significant effect on xylitol production.

Page 65: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

55

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 1SK values in a batch

system.

Page 66: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

56

Figure 3.22. Simulated profiles of xylitol concentration with different 2SK values in a batch

system.

Figure 3.23. Simulated profiles of xylitol concentration with different 1/ SXY values in a batch

system.

Page 67: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

57

Figure 3.24. Simulated profiles of xylitol concentration with different 2/ SXY 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

ethanol as growth associated product (pgk = 4 g ethanol/g X and GluSPY / = 0.51 g ethanol/g

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,

Page 68: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

58

if xylitol is the desired product, it would be necessary to remove the ethanol formed from the

fermentation in order to attain high xylitol concentration.

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

Page 69: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

59

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

was maximum at a glucose/xylose feeding ratio of 1:4 (70.13 g/L).

Table 3.3. Simulated results of xylitol and ethanol concentration with different initial glucose concentration in a batch system.

Ratio Xylitol (g/L) Ethanol (g/L) Rate of xylitol

production (g/L-h)

Rate of ethanol

production (g/L-h)

0:1 (0 g/L Glu + 28 g/L Xyl) 3.91 0 0.54 0

0.25:1 (7 g/L Glu + 28 g/L Xyl) 14.73 1.98 0.9 0.72

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.

Ratio Xylitol (g/L) Ethanol (g/L) Rate of xylitol

production (g/L-h)

Rate of ethanol

production (g/L-h)

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

Page 70: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

60

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.

Page 71: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

61

REFERENCES

Birol, G., Undey, C., Cinar, A., A modular simulation package for fed-batch fermentation:

penicillin production, Computers and Chemical Engineering, 2002.

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

monosodium glutamate (MSG) process, Journal of Food Engineering, 2004.

Krishnan, M. S., Fermentation kinetics of ethanol production from glucose and xylose by

Recombinant Saccharomyces 1400 (pLNH33), Applied Biochemistry and Biotechnology, 1999.

Nemeth, A., Sevella, B., Development of a new bioprocess for production of 1,3 – propandiol I.:

Modeling of Glycerol bioconversion to 1,3 – propanediol with Klebsiella pneumoniae enzymes,

Appl Biochem Biotechnol, 2008.

Rizzo, D. M., The comparison of four dynamic systems-based software packages: Translation

and sensitivity analysis, Environmental Modeling and Software, 2006.

Pfeifer, M. J., Effect of culture conditions on Xylitol production by Candida guilliermondii FTI

20037, Appl Biochem Biotechnol, 1996.

Shanklin, T., Selection of bioprocess simulation software for industrial applications, Biotechnol

Bioeng, 2000.

Shi, J., Functional Food Ingredients and Nutraceuticals: Processing Technologies (Functional

Foods and Nutraceuticals), 2006.

Yu, X., Biohydrogen production by the hyperthermophilic bacterium Thermotoga Neapolitana,

2007.

Page 72: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

62

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

pH is an important factor in biological system; therefore, in the future, BioMASS should

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

and Iphone application.

Page 73: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

63

APPENDICES

Page 74: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

64

APPENDIX A

COMMANDS IN BioMASS v2.0

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,

Windows and Help.

- File Menu:

• Irreversible Chemical Kinetics: This command has three sub choices of “Zero

Order”, “First Order”, and “Second Order” reaction.

• Biological Kinetics: This command has three sub choices of “Single Limiting

Nutrient”, “Multiple Limiting Nutrients”, and “Inhibition Model”.

• Open File: This command brings up a dialog box to open a previous saved file.

BioMASS v2.0 supports file format of Microsoft Excel (*.xls)

• 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

Page 75: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

65

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

Microsoft Office package, registered on the computer.

• Save All: It is the same as “Save Data”, but this command allows the user to save

both data and calculated results in Microsoft Excel.

• 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.

Figure A. 1. Commands in “View” Menu.

- View Menu:

Page 76: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

66

• 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

these by clicking “Exit Full Screen”.

• Show Start Page: Click this command to show the Start Page again.

Figure A. 2. Commands in “Tools” Menu.

- Tools Menu:

Page 77: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

67

• 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

results of zero, first, and second order of irreversible chemical kinetics.

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

variables from the workplace, and start a new project.

Figure A. 3. Commands in “Windows” Menu.

- Windows Menu: When the user has multiple windows open, they can be arranges that the user

can see all or part of each window.

Page 78: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

68

• 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

windows are open.

• Tile Vertical: Every window is completely visible, and they are arranged

vertically.

• Tile Horizontal: Every window is completely visible, and they are arranged

horizontally.

• Close All: Close all the opening windows.

Figure A. 4. Commands in “Help” Menu.

- Help Menu:

Page 79: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

69

• Notebook: This 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 better understanding about bioprocess.

• About Biomass v2.0: Displays the version number of this application and

introduces information related to the software version.

Figure A. 5. “Notebook” window.

Page 80: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

70

Figure A. 6. “About BioMASS v2.0” window.

Standard Toolbar

Figure A. 7. Standard Toolbar and Calculation Toolbar.

Page 81: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

71

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

description are summarized in Table.

Table A. 1. List of command icons in Standard Toolbar.

Icon Description

Open saved file.

Save data in Microsoft Excel.

Save both data and simulation results in Microsoft Excel.

Open Irreversible Chemical Kinetic Project (Zero Order)

Open Irreversible Chemical Kinetic Project (First Order)

Open Irreversible Chemical Kinetic Project (Second Order)

Open Single Limiting Nutrient Project.

Open Multiple Limiting Nutrients Project.

Open Inhibition Model Project.

Page 82: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

72

Zoom In selected images.

Clear All data and results from current running project.

Answer frequently asked questions (FAQs) about bioprocess.

Calculation Toolbar

Table A. 2. List of command icons in Calculation Toolbar.

Icon Description

Come back to input data form.

Run the simulation

Results can be presented in suitable graphs. Click this button to view them.

Click to view table.

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

on the Scroll Arrows to scroll the window.

Page 83: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

73

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:

Table A. 3. List of common function keys.

Indicator Description

Page 84: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

74

CAP The Caps Lock key is latched down.

NUM The Num Lock key is latched down.

Default input data values

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.

Page 85: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

75

APPENDIX B

DETAILS OF “NOTEBOOK” COMMAND

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.

Q: What is Arrhenius equation?

A: The effect of temperature on chemical or biological reactions can be described by the

Arrhenius equation which was created in 1889, by Svante Arrhenius, a chemist from Sweden.

RTEaeAk /* −=

where:

k: rate constant. The unit will vary depending on the order of the reaction.

A: Arrhenius constant. It is a factor that is determined experimentally, and it varies with

different reactions.

Ea: activation energy, (KJ/mol ). This is the minimum energy needed for the reaction to

occur.

R: gas constant. Its value is 8.314 J/mol K.

T: the absolute temperature in which the reaction takes place, and has to be measured in

Kelvin.

* Using the Arrhenius equation to investigate:

Page 86: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

76

- 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

larger and the rate is faster.

- 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

and the rate is faster.

Q: What is activation energy?

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.

Q: What is batch operation?

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.

Q: What are competitive substrate inhibitors?

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

binding of the substrate.

Page 87: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

77

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).

Q: What is CSTR operation?

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

rate and cell density at steady state

Q: What is CSTR with biomass recycle operation?

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.

Q: What is First Order reaction?

A: Rate is directly proportional to the concentration of the reactant. Doubling the concentration

increases the rate by a factor of 2.

][ Akrate −=

ktA

A−=

0

ln

Page 88: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

78

where: A, A0:concentration of A (mass/volume) at t, t = 0, respectively

k: rate constant, (1/time).

t: reaction time

If the reaction is first-order, a plot of ln[A] verus t should be linear.

Q: What is irreversible chemical reaction in biological modeling?

A: It is a simplified or overall reaction that occurs in a biological system usually with respect to a

single compound.

BA k→

where: A is reactant, B is product, k is reaction rate constant.

Q: What is Interactive Multiple Substrate Model?

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

the specific growth rate is given as:

+

+=

2

2

1

1

21

ˆSK

S

SK

S

SS

µµ

where:

S1 is the substrate 1

1SK is the half saturation constant for substrate 1

S2 is the substrate 2

2SK is the half saturation constant for substrate 2

Page 89: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

79

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

initial concentration in the second reactor.

Q: What are non-competitive substrate inhibitors?

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

formation of an enzyme-substrate complex.

Q: What is Non-Interactive Multiple Substrate Model?

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:

+

+=

2

2

1

1

21

,ˆSK

S

SK

S

SS

µµ

where:

S1 is the substrate 1

1SK is the half saturation constant for substrate 1

S2 is the substrate 2

2SK is the half saturation constant for substrate 2

Q: What is product inhibition?

Page 90: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

80

A: At high product concentrations, microbial growth rate is inhibited by the product. Product

inhibition of growth may be competitive or non-competitive.

Q: What is Reaction Order?

[ ]mAkrate −=

where:

k: rate constant

m:the order of the reaction

If m = 0, the reaction is said to be "zero-order".

If m = 1, the reaction is "first-order".

If m = 2, it is "second-order", and so on.

The reaction order is integral (0, 1, 2...), but fractional orders such as 3/2 are possible.

Q: What is Second Order reaction?

[ ]2Akrate −=

The rate is to the square of the concentration of the reactant. Doubling the concentration

increases the rate by a factor of 4.

[ ] [ ] ktAA

=−0

11

where: A, A0 is concentration of A (mass/volume) at t, t = 0, respectively

k: rate constant, (volume/mass-time).

t: reaction time

Page 91: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

81

If the reaction is second-order, a plot of 1/[A] verus t should be linear.

Q: What is Steady state?

A: Steady state is the one in which there are no accumulations of the constituent in the reactor.

Therefore, the concentration of the constituent is constant.

Q: What are substitutable substrates?

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

the microorganism over the other.

Q: What is substrate inhibition?

A: At high substrate concentrations, microbial growth rate is inhibited by the substrate. Substrate

inhibition of growth may be competitive or non-competitive.

Q: What is Transient State?

A: Transient state is the one in which there are mass accumulations of the constituent in the

reactor. Therefore, the concentration of the constituent is variable with time.

Q: What is Xenobiotic Compound?

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

Page 92: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

82

produced in it. For example, antibiotics are xenobiotics in humans because the human body does

not produce them itself.

The term xenobiotics is very often used in the context of pollutants, and some of them are

resistant to degradation.

Q: What is Zero Order reaction?

Rate is independent of the concentration of reactant. Doubling concentration has no effect on

rate.

krate −=

[ ] [ ] ktAA =− 0

where:

A, A0: concentration of A (mass/volume) at t, t = 0, respectively

k: rate constant, (mass/volume-time).

t: reaction time

If the reaction is zero-order, a plot of [A] verus t should be linear.

Page 93: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

83

APPENDIX C

VB CODE FOR ZERO-ORDER CHEMICAL REACTION

#Region "Load event" Private Sub ZeroOrder_Load( ByVal sender As Object , ByVal e As System.EventArgs) Handles Me.Load 'CAPS-NUM CheckLockKeys() '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

#Region "Call ChangeUnit" #Region "Call ChangeUnit_SimulationTime_Volume_ReactantConc" Private Sub ChangeUnit_SimulationTime_Volume_ReactantConc() 'Zero Order, mins, L, mg/L If SimulationTimeComboBox.Text = "(mins)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(mg/L)" Then 'Reactor 1 FlowRateComboBox.Text = "(L/mins)" RetentionTimeComboBox.Text = "(mins)" DilutionRateComboBox.Text = "(1/mins)" ConstkComboBox.Text = "(mg/L-mins)" 'Reactor 2 SimulationTimeR2ComboBox.Text = "(mins)" StepTimeR2ComboBox.Text = "(mins)" FlowRateR2ComboBox.Text = "(L/mins)" RetentionTimeR2ComboBox.Text = "(mins)" DilutionRateR2ComboBox.Text = "(1/mins)" ConstkR2ComboBox.Text = "(mg/L-mins)" 'Zero Order, mins, L, g/L ElseIf SimulationTimeComboBox.Text = "(mins)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(g/L)" Then 'Reactor 1 FlowRateComboBox.Text = "(L/mins)" RetentionTimeComboBox.Text = "(mins)" DilutionRateComboBox.Text = "(1/mins)" ConstkComboBox.Text = "(g/L-mins)" 'Reactor 2

Page 94: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

84

SimulationTimeR2ComboBox.Text = "(mins)" StepTimeR2ComboBox.Text = "(mins)" FlowRateR2ComboBox.Text = "(L/mins)" RetentionTimeR2ComboBox.Text = "(mins)" DilutionRateR2ComboBox.Text = "(1/mins)" ConstkR2ComboBox.Text = "(g/L-mins)" 'Zero Order, mins, m3, g/m3 ElseIf SimulationTimeComboBox.Text = "(mins)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(g/m3)" Then 'Reactor 1 FlowRateComboBox.Text = "(m3/mins)" RetentionTimeComboBox.Text = "(mins)" DilutionRateComboBox.Text = "(1/mins)" ConstkComboBox.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 = "(g/m3-mins)" 'Zero Order, mins, m3, mg/m3 ElseIf SimulationTimeComboBox.Text = "(mins)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(mg/m3)" Then 'Reactor 1 FlowRateComboBox.Text = "(m3/mins)" RetentionTimeComboBox.Text = "(mins)" DilutionRateComboBox.Text = "(1/mins)" ConstkComboBox.Text = "(mg/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)" 'Zero Order, hours, L, mg/L ElseIf SimulationTimeComboBox.Text = "(hours)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(mg/L)" Then 'Reactor 1 FlowRateComboBox.Text = "(L/hours)" RetentionTimeComboBox.Text = "(hours)" DilutionRateComboBox.Text = "(1/hours)" ConstkComboBox.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 = "(mg/L-hours)" 'Zero Order, hours, L, g/L ElseIf SimulationTimeComboBox.Text = "(hours)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(g/L)" Then 'Reactor 1 FlowRateComboBox.Text = "(L/hours)" RetentionTimeComboBox.Text = "(hours)" DilutionRateComboBox.Text = "(1/hours)" ConstkComboBox.Text = "(g/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)" 'Zero Order, hours, m3, g/m3 ElseIf SimulationTimeComboBox.Text = "(hours)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(g/m3)" Then 'Reactor 1 FlowRateComboBox.Text = "(m3/hours)" RetentionTimeComboBox.Text = "(hours)" DilutionRateComboBox.Text = "(1/hours)" ConstkComboBox.Text = "(g/m3-hours)" 'Reactor 2 SimulationTimeR2ComboBox.Text = "(hours)" StepTimeR2ComboBox.Text = "(hours)"

Page 95: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

85

FlowRateR2ComboBox.Text = "(m3/hours)" RetentionTimeR2ComboBox.Text = "(hours)" DilutionRateR2ComboBox.Text = "(1/hours)" ConstkR2ComboBox.Text = "(g/m3-hours)" 'Zero Order, hours, m3, mg/m3 ElseIf SimulationTimeComboBox.Text = "(hours)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(mg/m3)" Then 'Reactor 1 FlowRateComboBox.Text = "(m3/hours)" RetentionTimeComboBox.Text = "(hours)" DilutionRateComboBox.Text = "(1/hours)" ConstkComboBox.Text = "(mg/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)" 'Zero Order, days, L, mg/L ElseIf SimulationTimeComboBox.Text = "(days)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(mg/L)" Then 'Reactor 1 FlowRateComboBox.Text = "(L/days)" RetentionTimeComboBox.Text = "(days)" DilutionRateComboBox.Text = "(1/days)" ConstkComboBox.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 = "(mg/L-days)" 'Zero Order, days, L, g/L ElseIf SimulationTimeComboBox.Text = "(days)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(g/L)" Then 'Reactor 1 FlowRateComboBox.Text = "(L/days)" RetentionTimeComboBox.Text = "(days)" DilutionRateComboBox.Text = "(1/days)" ConstkComboBox.Text = "(g/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)" 'Zero Order, days, m3, g/m3 ElseIf SimulationTimeComboBox.Text = "(days)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(g/m3)" Then 'Reactor 1 FlowRateComboBox.Text = "(m3/days)" RetentionTimeComboBox.Text = "(days)" DilutionRateComboBox.Text = "(1/days)" ConstkComboBox.Text = "(g/m3-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)" 'Zero Order, days, m3, mg/m3 ElseIf SimulationTimeComboBox.Text = "(days)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(mg/m3)" Then 'Reactor 1 FlowRateComboBox.Text = "(m3/days)" RetentionTimeComboBox.Text = "(days)" DilutionRateComboBox.Text = "(1/days)" ConstkComboBox.Text = "(mg/m3-days)" 'Reactor 2 SimulationTimeR2ComboBox.Text = "(days)" StepTimeR2ComboBox.Text = "(days)" FlowRateR2ComboBox.Text = "(m3/days)" RetentionTimeR2ComboBox.Text = "(days)"

Page 96: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

86

DilutionRateR2ComboBox.Text = "(1/days)" ConstkR2ComboBox.Text = "(mg/m3-days)" End If End Sub #End Region #Region "Call ChangeUnit_SimulationTime" Private Sub ChangeUnit_SimulationTime() If SimulationTimeComboBox.Text = "(mins)" Then StepTimeComboBox.Text = "(mins)" 'Reactor 2 StepTimeR2ComboBox.Text = "(mins)" SimulationTimeR2ComboBox.Text = "(mins)" ElseIf SimulationTimeComboBox.Text = "(hours)" Then StepTimeComboBox.Text = "(hours)" 'Reactor 2 StepTimeR2ComboBox.Text = "(hours)" SimulationTimeR2ComboBox.Text = "(hours)" ElseIf SimulationTimeComboBox.Text = "(days)" Then StepTimeComboBox.Text = "(days)" 'Reactor 2 StepTimeR2ComboBox.Text = "(days)" SimulationTimeR2ComboBox.Text = "(days)" End If End Sub #End Region #Region "Call ChangeUnit_ReactantConc" Private Sub ChangeUnit_ReactantConc() If ReactantConcComboBox.Text = "(mg/L)" Then ProductConcComboBox.Text = "(mg/L)" ElseIf ReactantConcComboBox.Text = "(g/L)" Then ProductConcComboBox.Text = "(g/L)" ElseIf ReactantConcComboBox.Text = "(mg/m3)" Then ProductConcComboBox.Text = "(mg/m3)" ElseIf ReactantConcComboBox.Text = "(g/m3)" Then ProductConcComboBox.Text = "(g/m3)" End If End Sub #End Region #Region "Call ChangeUnit_ReactantConc_SaveVolume" Private Sub ChangeUnit_ReactantConc_SaveVolume() If ReactantConcComboBox.Text = "(mg/L)" _ OrElse ReactantConcComboBox.Text = "(g/L)" Then VolumeComboBox.Text = "(L)" VolumeR2ComboBox.Text = "(L)" ElseIf ReactantConcComboBox.Text = "(mg/m3)" _ OrElse ReactantConcComboBox.Text = "(g/m3)" Then VolumeComboBox.Text = "(m3)" VolumeR2ComboBox.Text = "(m3)" End If End Sub #End Region #Region "Call ChangeUnit_SimulationTimeR2_Volume_ReactantConc" Private Sub ChangeUnit_SimulationTimeR2_Volume_ReactantConc() 'Zero Order, mins, L, mg/L If SimulationTimeR2ComboBox.Text = "(mins)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(mg/L)" Then 'Reactor 1 SimulationTimeComboBox.Text = "(mins)" FlowRateComboBox.Text = "(L/mins)" RetentionTimeComboBox.Text = "(mins)" DilutionRateComboBox.Text = "(1/mins)" ConstkComboBox.Text = "(mg/L-mins)" 'Reactor 2 StepTimeR2ComboBox.Text = "(mins)" FlowRateR2ComboBox.Text = "(L/mins)" RetentionTimeR2ComboBox.Text = "(mins)" DilutionRateR2ComboBox.Text = "(1/mins)" ConstkR2ComboBox.Text = "(mg/L-mins)" 'Zero Order, mins, L, g/L ElseIf SimulationTimeR2ComboBox.Text = "(mins)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _

Page 97: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

87

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)" 'Zero Order, mins, m3, g/m3 ElseIf SimulationTimeR2ComboBox.Text = "(mins)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(g/m3)" Then 'Reactor 1 SimulationTimeComboBox.Text = "(mins)" FlowRateComboBox.Text = "(m3/mins)" RetentionTimeComboBox.Text = "(mins)" DilutionRateComboBox.Text = "(1/mins)" ConstkComboBox.Text = "(g/m3-mins)" 'Reactor 2 StepTimeR2ComboBox.Text = "(mins)" FlowRateR2ComboBox.Text = "(m3/mins)" RetentionTimeR2ComboBox.Text = "(mins)" DilutionRateR2ComboBox.Text = "(1/mins)" ConstkR2ComboBox.Text = "(g/m3-mins)" 'Zero Order, mins, m3, mg/m3 ElseIf SimulationTimeR2ComboBox.Text = "(mins)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(mg/m3)" Then 'Reactor 1 SimulationTimeComboBox.Text = "(mins)" FlowRateComboBox.Text = "(m3/mins)" RetentionTimeComboBox.Text = "(mins)" DilutionRateComboBox.Text = "(1/mins)" ConstkComboBox.Text = "(mg/m3-mins)" 'Reactor 2 StepTimeR2ComboBox.Text = "(mins)" FlowRateR2ComboBox.Text = "(m3/mins)" RetentionTimeR2ComboBox.Text = "(mins)" DilutionRateR2ComboBox.Text = "(1/mins)" ConstkR2ComboBox.Text = "(mg/m3-mins)" 'Zero Order, hours, L, mg/L ElseIf SimulationTimeR2ComboBox.Text = "(hours)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(mg/L)" Then 'Reactor 1 SimulationTimeComboBox.Text = "(hours)" FlowRateComboBox.Text = "(L/hours)" RetentionTimeComboBox.Text = "(hours)" DilutionRateComboBox.Text = "(1/hours)" ConstkComboBox.Text = "(mg/L-hours)" 'Reactor 2 StepTimeR2ComboBox.Text = "(hours)" FlowRateR2ComboBox.Text = "(L/hours)" RetentionTimeR2ComboBox.Text = "(hours)" DilutionRateR2ComboBox.Text = "(1/hours)" ConstkR2ComboBox.Text = "(mg/L-hours)" 'Zero Order, hours, L, g/L ElseIf SimulationTimeR2ComboBox.Text = "(hours)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(g/L)" Then 'Reactor 1 SimulationTimeComboBox.Text = "(hours)" FlowRateComboBox.Text = "(L/hours)" RetentionTimeComboBox.Text = "(hours)" DilutionRateComboBox.Text = "(1/hours)" ConstkComboBox.Text = "(g/L-hours)" 'Reactor 2 StepTimeR2ComboBox.Text = "(hours)" FlowRateR2ComboBox.Text = "(L/hours)" RetentionTimeR2ComboBox.Text = "(hours)" DilutionRateR2ComboBox.Text = "(1/hours)" ConstkR2ComboBox.Text = "(g/L-hours)" 'Zero Order, hours, m3, g/m3 ElseIf SimulationTimeR2ComboBox.Text = "(hours)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(g/m3)" Then 'Reactor 1

Page 98: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

88

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)" 'Zero Order, hours, m3, mg/m3 ElseIf SimulationTimeR2ComboBox.Text = "(hours)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(mg/m3)" Then 'Reactor 1 SimulationTimeComboBox.Text = "(hours)" FlowRateComboBox.Text = "(m3/hours)" RetentionTimeComboBox.Text = "(hours)" DilutionRateComboBox.Text = "(1/hours)" ConstkComboBox.Text = "(mg/m3-hours)" 'Reactor 2 StepTimeR2ComboBox.Text = "(hours)" FlowRateR2ComboBox.Text = "(m3/hours)" RetentionTimeR2ComboBox.Text = "(hours)" DilutionRateR2ComboBox.Text = "(1/hours)" ConstkR2ComboBox.Text = "(mg/m3-hours)" 'Zero Order, days, L, mg/L ElseIf SimulationTimeR2ComboBox.Text = "(days)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(mg/L)" Then 'Reactor 1 SimulationTimeComboBox.Text = "(days)" FlowRateComboBox.Text = "(L/days)" RetentionTimeComboBox.Text = "(days)" DilutionRateComboBox.Text = "(1/days)" ConstkComboBox.Text = "(mg/L-days)" 'Reactor 2 StepTimeR2ComboBox.Text = "(days)" FlowRateR2ComboBox.Text = "(L/days)" RetentionTimeR2ComboBox.Text = "(days)" DilutionRateR2ComboBox.Text = "(1/days)" ConstkR2ComboBox.Text = "(mg/L-days)" 'Zero Order, days, L, g/L ElseIf SimulationTimeR2ComboBox.Text = "(days)" AndAlso _ VolumeComboBox.Text = "(L)" AndAlso _ ReactantConcComboBox.Text = "(g/L)" Then 'Reactor 1 SimulationTimeComboBox.Text = "(days)" FlowRateComboBox.Text = "(L/days)" RetentionTimeComboBox.Text = "(days)" DilutionRateComboBox.Text = "(1/days)" ConstkComboBox.Text = "(g/L-days)" 'Reactor 2 StepTimeR2ComboBox.Text = "(days)" FlowRateR2ComboBox.Text = "(L/days)" RetentionTimeR2ComboBox.Text = "(days)" DilutionRateR2ComboBox.Text = "(1/days)" ConstkR2ComboBox.Text = "(g/L-days)" 'Zero Order, days, m3, g/m3 ElseIf SimulationTimeR2ComboBox.Text = "(days)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(g/m3)" Then 'Reactor 1 SimulationTimeComboBox.Text = "(days)" FlowRateComboBox.Text = "(m3/days)" RetentionTimeComboBox.Text = "(days)" DilutionRateComboBox.Text = "(1/days)" ConstkComboBox.Text = "(g/m3-days)" 'Reactor 2 StepTimeR2ComboBox.Text = "(days)" FlowRateR2ComboBox.Text = "(m3/days)" RetentionTimeR2ComboBox.Text = "(days)" DilutionRateR2ComboBox.Text = "(1/days)" ConstkR2ComboBox.Text = "(g/m3-days)" 'Zero Order, days, m3, mg/m3 ElseIf SimulationTimeR2ComboBox.Text = "(days)" AndAlso _ VolumeComboBox.Text = "(m3)" AndAlso _ ReactantConcComboBox.Text = "(mg/m3)" Then 'Reactor 1 SimulationTimeComboBox.Text = "(days)" FlowRateComboBox.Text = "(m3/days)"

Page 99: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

89

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 #Region "Call ChangeUnit_SimulationTimeR2" Private Sub ChangeUnit_SimulationTimeR2() If SimulationTimeR2ComboBox.Text = "(mins)" Then SimulationTimeComboBox.Text = "(mins)" StepTimeComboBox.Text = "(mins)" 'Reactor 2 StepTimeR2ComboBox.Text = "(mins)" ElseIf SimulationTimeR2ComboBox.Text = "(hours)" Then SimulationTimeComboBox.Text = "(hours)" StepTimeComboBox.Text = "(hours)" 'Reactor 2 StepTimeR2ComboBox.Text = "(hours)" ElseIf SimulationTimeR2ComboBox.Text = "(days)" Then SimulationTimeComboBox.Text = "(days)" StepTimeComboBox.Text = "(days)" 'Reactor 2 StepTimeR2ComboBox.Text = "(days)" End If End Sub #End Region #End Region #Region "Call ChemClearForm" Private Sub ChemClearFrom() 'Reactor 1 ReactantConcComboBox.Text = "" ProductConcComboBox.Text = "" SimulationTimeComboBox.Text = "" StepTimeComboBox.Text = "" VolumeComboBox.Text = "" FlowRateComboBox.Text = "" DilutionRateComboBox.Text = "" RetentionTimeComboBox.Text = "" ConstkComboBox.Text = "" 'Reactor 2 SimulationTimeR2ComboBox.Text = "" StepTimeR2ComboBox.Text = "" VolumeR2ComboBox.Text = "" FlowRateR2ComboBox.Text = "" DilutionRateR2ComboBox.Text = "" RetentionTimeR2ComboBox.Text = "" ConstkR2ComboBox.Text = "" End Sub #End Region #Region "Textbox accept only number" #Region "Chem Reactor 1" '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

Page 100: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

90

'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 If (e.KeyChar < "0" OrElse e.KeyChar > "9" ) _ AndAlso e.KeyChar <> ControlChars.Back _ AndAlso e.KeyChar <> "." Then e.Handled = True End If End Sub #End Region #Region "Chem Reactor 2" '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 If (e.KeyChar < "0" OrElse e.KeyChar > "9" ) _ AndAlso e.KeyChar <> ControlChars.Back _ AndAlso e.KeyChar <> "." Then e.Handled = True End If End Sub #End Region #End Region #Region "Call HideAllGroup" Private Sub HideAllGroup() ReactionGroupBox.Hide() ModelGroupBox.Hide() Add2ndReactorCheckBox.Hide() Reactor1GroupBox.Hide() Reactor2GroupBox.Hide() BatchSeriesPicturePanel.Hide() CSTRPicturePanel.Hide() CSTRSeriesPicturePanel.Hide() ResultGroupBox.Hide() GraphGroupBox.Hide() TableGroupBox.Hide() End Sub #End Region #Region "Call ShowPictureBox" Private Sub ShowPictureBox()

Page 101: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

91

'PictureBox 'Batch If BatchRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = False Then OperationModeToolStripLabel.Text = "Batch" BatchPicturePanel.Show() BatchSeriesPicturePanel.Hide() CSTRPicturePanel.Hide() CSTRSeriesPicturePanel.Hide() ElseIf BatchRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = True Then OperationModeToolStripLabel.Text = "Batch MultiStage" 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 'CSTR Transient State If CSTRTransientStateRadioButton.Checked = True AndAlso _ 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() ElseIf CSTRTransientStateRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = True Then OperationModeToolStripLabel.Text = "CSTR Transient 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 'CSTR Steady State If CSTRSteadyStateRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = False Then OperationModeToolStripLabel.Text = "CSTR Steady 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() ElseIf CSTRSteadyStateRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = True Then OperationModeToolStripLabel.Text = "CSTR Steady State MultiStage"

Page 102: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

92

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 #Region "Call ShowGroupBox" Private Sub ShowGroupBox() Call HideAllGroup() Call ShowPictureBox() ReactionGroupBox.Show() ModelGroupBox.Show() Add2ndReactorCheckBox.Show() Reactor1GroupBox.Show() If Add2ndReactorCheckBox.Checked = True Then Reactor2GroupBox.Show() End If End Sub #End Region #Region "Call ClearComboBox" Private Sub ChemClearComboBox() 'Reactor 1 xTimeComboBox.Items.Clear() y1ReactantConcR1ComboBox.Items.Clear() y2ProductConcR1ComboBox.Items.Clear() 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 "Call EnableCommanButton" Private Sub EnableCommanButton() If ReactionGroupBox.Visible = True OrElse _ ModelGroupBox.Visible = True OrElse _ Reactor1GroupBox.Visible = True Then BackToolStripButton.Enabled = False CalculateToolStripButton.Enabled = True GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If If GraphGroupBox.Visible = True OrElse _ TableGroupBox.Visible = True Then BackToolStripButton.Enabled = True CalculateToolStripButton.Enabled = False GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If End Sub #End Region #Region "Temp CheckBox" Private Sub TempCorrectionCheckBox_Click( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles TempCorrectionCheckBox.Click

Page 103: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

93

If TempCorrectionCheckBox.Checked = True Then 'Save value ConstantKToolStripLabel.Text = ConstkTextBox.Text ChemTempEffect.TempEffectToolStripLabel.Text = "Zero R1" ChemTempEffect.ShowDialog() ElseIf TempCorrectionCheckBox.Checked = False Then ConstkTextBox.Text = ConstantKToolStripLabel.Text End If End Sub Private Sub TempCorrectionR2CheckBox_Click( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles TempCorrectionR2CheckBox.Click If TempCorrectionR2CheckBox.Checked = True Then 'Save value ConstantKR2ToolStripLabel.Text = ConstkR2TextBox.Text ChemTempEffect.TempEffectToolStripLabel.Text = "Zero R2" ChemTempEffect.ShowDialog() ElseIf TempCorrectionR2CheckBox.Checked = False Then ConstkR2TextBox.Text = ConstantKR2ToolStripLabel.Text End If End Sub #End Region #Region "Constant K Textbox" Private Sub ConstkTextBox_TextChanged( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles ConstkTextBox.TextChanged ChemTempEffect.ConstKT2TextBox.Text = ConstkTextBox.Text End Sub Private Sub ConstkComboBox_TextChanged( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles ConstkComboBox.TextChanged ChemTempEffect.ConstKLabel.Text = ConstkComboBox.Text End Sub Private Sub ConstkR2TextBox_TextChanged( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles ConstkR2TextBox.TextChanged ChemTempEffect.ConstKT2TextBox.Text = ConstkR2TextBox.Text End Sub Private Sub ConstkR2ComboBox_TextChanged( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles ConstkR2ComboBox.TextChanged ChemTempEffect.ConstKLabel.Text = ConstkR2ComboBox.Text End Sub #End Region

#Region "Chem Reactor 1 Code" #Region "Call ChemReactor1_Load" Private Sub ChemReactor1_Load() 'Simulation Time SimulationTimeComboBox.Items.Add( "(mins)" ) SimulationTimeComboBox.Items.Add( "(hours)" ) SimulationTimeComboBox.Items.Add( "(days)" ) SimulationTimeComboBox.Text = SimulationTimeComboBox.Items(1).ToString '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() ''False enabled textbox PhysicalParaGroupBox.Enabled = False End Sub #End Region #Region "Click flow rate - Reactor 1" Private Sub FlowRateRadioButton_Click( ByVal sender As Object , ByVal e As System.EventArgs) _

Page 104: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

94

Handles FlowRateRadioButton.Click 'Clear RetentionTimeTextBox.Clear() DilutionRateTextBox.Clear() Call FDtauRadioButton_Click() End Sub #End Region #Region "Click retention time - Reactor 1" Private Sub RetentionTimeRadioButton_Click( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles RetentionTimeRadioButton.Click 'Clear VolumeTextBox.Clear() FlowRateTextBox.Clear() DilutionRateTextBox.Clear() Call FDtauRadioButton_Click() End Sub #End Region #Region "Click dilution rate - Reactor 1" Private Sub DilutionRateRadioButton_Click( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles DilutionRateRadioButton.Click 'Clear VolumeTextBox.Clear() FlowRateTextBox.Clear() RetentionTimeTextBox.Clear() Call FDtauRadioButton_Click() End Sub #End Region #Region "Change Unit of Simulation Time" Private Sub ChemSimulationTimeComboBox_SelectedIndexChanged( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles SimulationTimeComboBox.SelectedIndexChanged Call ChangeUnit_SimulationTime() Call ChangeUnit_SimulationTime_Volume_ReactantConc() End Sub #End Region #Region "Change Unit of Volume Reactor 1" Private Sub ChemVolumeComboBox_SelectedIndexChanged( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles VolumeComboBox.SelectedIndexChanged Call ChangeUnit_ReactantConc_SaveVolume() Call ChangeUnit_SimulationTime_Volume_ReactantConc() End Sub #End Region #Region "Change Unit of Reactant Concentration" Private Sub ChemReactantConcComboBox_SelectedIndexChanged( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles ReactantConcComboBox.SelectedIndexChanged Call ChangeUnit_ReactantConc() Call ChangeUnit_ReactantConc_SaveVolume() Call ChangeUnit_SimulationTime_Volume_ReactantConc() End Sub #End Region #Region "Operation Mode" Private Sub BatchRadioButton_Click( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles BatchRadioButton.Click If BatchRadioButton.Checked = True Then 'Clear VolumeTextBox.Clear() FlowRateTextBox.Clear() RetentionTimeTextBox.Clear() DilutionRateTextBox.Clear()

Page 105: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

95

VolumeR2TextBox.Clear() FlowRateR2TextBox.Clear() RetentionTimeR2TextBox.Clear() DilutionRateR2TextBox.Clear() 'PictureBox Call ShowPictureBox() 'Enable Call BatchCSTRRadioButton_Click() End If End Sub Private Sub CSTRTransientStateRadioButton_Click( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles CSTRTransientStateRadioButton.Click If CSTRTransientStateRadioButton.Checked = True Then 'Clear VolumeTextBox.Clear() FlowRateTextBox.Clear() RetentionTimeTextBox.Clear() DilutionRateTextBox.Clear() VolumeR2TextBox.Clear() FlowRateR2TextBox.Clear() RetentionTimeR2TextBox.Clear() DilutionRateR2TextBox.Clear() 'PictureBox Call ShowPictureBox() 'Enable Call BatchCSTRRadioButton_Click() End If End Sub Private Sub CSTRSteadyStateRadioButton_Click( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles CSTRSteadyStateRadioButton.Click 'Clear VolumeTextBox.Clear() FlowRateTextBox.Clear() RetentionTimeTextBox.Clear() DilutionRateTextBox.Clear() VolumeR2TextBox.Clear() FlowRateR2TextBox.Clear() RetentionTimeR2TextBox.Clear() DilutionRateR2TextBox.Clear() 'PictureBox Call ShowPictureBox() 'Enable Call BatchCSTRRadioButton_Click() End Sub #End Region #Region "Add 2nd reactor" Private Sub Add2ndReactorCheckBox_Click( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles Add2ndReactorCheckBox.Click 'Show Call ShowPictureBox() Call ShowGroupBox() End Sub #End Region #End Region #Region "Chem Reactor 2 Code" #Region "Call ChemReactor2_Load" Private Sub ChemReactor2_Load() 'Simulation Time SimulationTimeR2ComboBox.Items.Add( "(mins)" ) SimulationTimeR2ComboBox.Items.Add( "(hours)" ) SimulationTimeR2ComboBox.Items.Add( "(days)" ) ''False enabled textbox PhysicalParaR2GroupBox.Enabled = False End Sub #End Region

Page 106: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

96

#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 #Region "Click- Chem Retention time Reactor 2" Private Sub ChemRetentionTime2RadioButton_Click( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles RetentionTimeR2RadioButton.Click VolumeR2TextBox.Clear() FlowRateR2TextBox.Clear() DilutionRateR2TextBox.Clear() Call FDtauR2RadioButton_Click() End Sub #End Region #Region "Click- Chem Dilution rate Reactor 2" Private Sub ChemDilutionRate2RadioButton_Click( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles DilutionRateR2RadioButton.Click VolumeR2TextBox.Clear() FlowRateR2TextBox.Clear() RetentionTimeR2TextBox.Clear() Call FDtauR2RadioButton_Click() End Sub #End Region #Region "Change Unit of Simulation Time" Private Sub SimulationTimeR2ComboBox_SelectedIndexChanged( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles SimulationTimeR2ComboBox.SelectedIndexChanged Call ChangeUnit_SimulationTimeR2() Call ChangeUnit_SimulationTimeR2_Volume_ReactantConc() End Sub #End Region #End Region #Region "Declare variables for Chem Kinetics" Private temp As Decimal Private AbsTemp As Decimal 'ChemReactor1 Private R1ReactantConc As String Private R1ProductConc As String Private R1SimulationTime As String Private R1TimeInterval As String Private R1Volume As String Private R1FlowRate As String Private R1RetentionTime As String Private R1DilutionRate As String Private R1ConstantK As String Private R1C0 As Double Private R1Cti As Double Private R1P0 As Double Private R1Pti As Double Private R1Time As Decimal Private R1deltaT As Decimal = 0.1 Private R1deltaI As Decimal Private R1V As Double Private R1F As Double Private R1tau As Double Private R1D As Double Private R1ConstK As Decimal 'ChemReactor2 Private R2ReactantConc As String Private R2ProductConc As String Private R2SimulationTime As String Private R2TimeInterval As String Private R2Volume As String Private R2FlowRate As String

Page 107: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

97

Private R2RetentionTime As String Private R2DilutionRate As String Private R2ConstantK As String Private R2C0 As Double Private R2Cti As Double Private R2P0 As Double Private R2Pti As Double Private R2Time As Decimal Private R2deltaT As Decimal = 0.1 Private R2deltaI As Decimal Private R2V As Double Private R2F As Double Private R2tau As Double Private R2D As Double Private R2ConstK As Decimal 'Graph 'Reactor 1 Private numItm As Integer Private xAdd As Double Private y1Add As Double Private y2Add As Double 'Reactor 2 Private numItmR2 As Integer Private xAddR2 As Double Private y1AddR2 As Double Private y2AddR2 As Double 'Calculation 'Reactor 1 Private R1CAs_Zero As Double Private R1CtiTemp As Double Private R1PtiTemp As Double Private R1CtiSteady As Double Private R1PtiSteady As Double Private R1CtiTempSteady As Double Private R1PtiTempSteady As Double Private R1SteadyTime As Integer Private R1SteadyTimeRun As Integer Private R1ReachSteadyConc As Double 'Reactor 2 Private R2CAs_Zero As Double Private R2CtiTemp As Double Private R2PtiTemp As Double Private R2CtiSteady As Double Private R2PtiSteady As Double Private R2CtiTempSteady As Double Private R2PtiTempSteady As Double Private R2SteadyTime As Integer Private R2SteadyTimeRun As Integer #End Region #Region "Call ReadChemReactor1Data" Private Sub ReadChemReactor1Data() 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

Page 108: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

98

'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 #Region "Call ReadChemReactor2Data" Private Sub ReadChemReactor2Data() 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

Page 109: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

99

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 #Region "Call ChemFDtauCalculation" Private Sub ChemFDtauCalculation_Reactor1() Call ReadChemReactor1Data() If VolumeTextBox.Text <> "" AndAlso FlowRateTextBox.Text <> "" Then R1tau = R1V / R1F ElseIf DilutionRateTextBox.Text <> "" Then R1tau = 1 / R1D ElseIf RetentionTimeTextBox.Text <> "" Then R1tau = R1tau End If End Sub Private Sub ChemFDtauCalculation_Reactor2() Call ReadChemReactor2Data() If VolumeR2TextBox.Text <> "" AndAlso FlowRateR2TextBox.Text <> "" Then R2tau = R2V / R2F ElseIf DilutionRateR2TextBox.Text <> "" Then R2tau = 1 / R2D ElseIf RetentionTimeR2TextBox.Text <> "" Then R2tau = R2tau End If End Sub #End Region #Region "FindSteadyTime_Reactor1" Private Sub FindSteadyTime_Reactor1() 'Calculate steady state concentration R1CAs_Zero = R1C0 - (R1ConstK * R1tau) 'Find steady state time For j = 0 To 10000 Step R1deltaT If j = 0 Then R1CtiTempSteady = R1C0 R1PtiTempSteady = R1P0 ElseIf j > 0 Then R1CtiSteady = R1CtiTempSteady + ((R1C0 - R1CtiTempSteady) * (1 / R1tau) - R1ConstK) * R1deltaT R1PtiSteady = R1PtiTempSteady + ((R1P0 - R1PtiTempSteady) * (1 / R1tau) + R1ConstK) * R1deltaT 'Simulation reach the steady state If Math.Round((R1CAs_Zero / R1CtiTempSteady) * 100, 4) >= 99.9992 Then R1SteadyTime = j 'Exit Exit For End If If R1CtiSteady > 0 Then R1CtiTempSteady = R1CtiSteady Else R1CtiTempSteady = 0 End If If R1PtiSteady > 0 Then

Page 110: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

100

R1PtiTempSteady = R1PtiSteady Else R1PtiTempSteady = 0 End If End If Next 'Calculate circle for Steady state MessageBox.Show( "Steady state concentration of Reactor 1 is " & _ Math.Round(R1CAs_Zero, 4) & " " & ReactantConcComboBox.Text & ControlChars.NewLine & _ "and achieved at t = " & R1SteadyTime & " " & SimulationTimeComboBox.Text, _ "Messages" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) End Sub #End Region #Region "FindSteadyTime_Reactor2" Private Sub FindSteadyTime_Reactor2() 'Calculate steady state concentration R2CAs_Zero = R2C0 - (R2ConstK * R2tau) 'Find steady state time For j2 = 0 To 10000 Step R2deltaT If j2 = 0 Then R2CtiTempSteady = R2C0 R2PtiTempSteady = R2P0 ElseIf j2 > 0 Then R2CtiSteady = R2CtiTempSteady + ((R2C0 - R2CtiTempSteady) * (1 / R2tau) - R2ConstK) * R2deltaT R2PtiSteady = R2PtiTempSteady + ((R2P0 - R2PtiTempSteady) * (1 / R2tau) + R2ConstK) * R2deltaT 'Simulation reach the steady state If Math.Round((R2CAs_Zero / R2CtiTempSteady) * 100, 4) >= 99.9992 Then R2SteadyTime = j2 'Exit Exit For End If If R2CtiSteady > 0 Then R2CtiTempSteady = R2CtiSteady Else R2CtiTempSteady = 0 End If If R2PtiSteady > 0 Then R2PtiTempSteady = R2PtiSteady Else R2PtiTempSteady = 0 End If End If Next 'Calculate circle for Steady state MessageBox.Show( "Steady state concentration of Reactor 2 is " & _ Math.Round(R2CAs_Zero, 4) & " " & ReactantConcComboBox.Text & ControlChars.NewLine & _ "and achieved at t = " & R2SteadyTime & " " & SimulationTimeComboBox.Text, _ "Messages" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) End Sub #End Region #Region "Calculate Chem Kinetics" 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 ''Check if there's sufficient data '\\\\\\\\\\\\\\ For 1 reactor If Add2ndReactorCheckBox.Checked = False Then 'Reactant If ReactantConcTextBox.Text = "" Then ReactantConcTextBox.Focus() MessageBox.Show( "Reactant Concentration is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress

Page 111: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

101

_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 If CSTRSteadyStateRadioButton.Checked = True OrElse _ CSTRTransientStateRadioButton.Checked = True Then 'Flow rate If FlowRateRadioButton.Checked = True Then 'Volume If VolumeTextBox.Text = "" Then VolumeTextBox.Focus() MessageBox.Show( "Reactor Volume 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 'Constant k If ConstkTextBox.Text = "" Then ConstkTextBox.Focus() MessageBox.Show( "Constant k is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress

Page 112: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

102

_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If End If '1 Reactor ''\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ For 2 reactors If Add2ndReactorCheckBox.Checked = True Then '***************************************************************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 If CSTRTransientStateRadioButton.Checked = True OrElse _ CSTRSteadyStateRadioButton.Checked = True Then 'Flow rate If FlowRateRadioButton.Checked = True Then 'Volume If VolumeTextBox.Text = "" Then VolumeTextBox.Focus() MessageBox.Show( "Reactor Volume 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!" , _

Page 113: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

103

"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 If CSTRTransientStateRadioButton.Checked = True OrElse _ CSTRSteadyStateRadioButton.Checked = True Then 'Flow rate If FlowRateR2RadioButton.Checked = True Then 'Volume If VolumeR2TextBox.Text = "" Then VolumeR2TextBox.Focus() MessageBox.Show( "Reactor Volume 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 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()

Page 114: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

104

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 '\\\\\\\\\\\\Name cannot be empty If ReactantNameComboBox.Text = "" Then ReactantNameComboBox.Focus() MessageBox.Show( "Reactant Name is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If If ProductNameComboBox.Text = "" Then ProductNameComboBox.Focus() MessageBox.Show( "Product Name is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If 'Clear Result ComboBox ChemKineticsPanel.AutoScroll = False Call ChemClearComboBox() ''*****************************************************************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() ElseIf Add2ndReactorCheckBox.Checked = True Then ChemTableSplitContainer.Panel2Collapsed = False Call ReadChemReactor1Data() Call ReadChemReactor2Data() Call BatchZeroOrder_2Reactor() End If End If 'CSTR Transient State If CSTRTransientStateRadioButton.Checked = True Then If Add2ndReactorCheckBox.Checked = False Then ChemTableSplitContainer.Panel2Collapsed = True Call ReadChemReactor1Data() Call ChemFDtauCalculation_Reactor1() Call CSTRTransientZeroOrder_Reactor1() ElseIf Add2ndReactorCheckBox.Checked = True Then ChemTableSplitContainer.Panel2Collapsed = False Call ReadChemReactor1Data()

Page 115: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

105

Call ReadChemReactor2Data() Call ChemFDtauCalculation_Reactor1() Call ChemFDtauCalculation_Reactor2() Call CSTRTransientZeroOrder_2Reactor() End If End If 'CSTR Steady State If CSTRSteadyStateRadioButton.Checked = True Then If Add2ndReactorCheckBox.Checked = False Then ChemTableSplitContainer.Panel2Collapsed = True Call ReadChemReactor1Data() Call ChemFDtauCalculation_Reactor1() Call CSTRSteadyZeroOrder_Reactor1() ElseIf Add2ndReactorCheckBox.Checked = True Then ChemTableSplitContainer.Panel2Collapsed = False Call ReadChemReactor1Data() Call ReadChemReactor2Data() Call ChemFDtauCalculation_Reactor1() Call ChemFDtauCalculation_Reactor2() 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

Page 116: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

106

APPENDIX D

VB CODE FOR FIRST-ORDER CHEMICAL REACTION

#Region "Load Event" Private Sub FirstOrder_Load( ByVal sender As Object , ByVal e As System.EventArgs) Handles Me.Load 'CAPS-NUM CheckLockKeys() '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

#Region "Call ShowPictureBox" Private Sub ShowPictureBox() 'PictureBox 'Batch If BatchRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = False Then OperationModeToolStripLabel.Text = "Batch" BatchPicturePanel.Show() BatchSeriesPicturePanel.Hide() CSTRPicturePanel.Hide() CSTRSeriesPicturePanel.Hide() ElseIf BatchRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = True Then OperationModeToolStripLabel.Text = "Batch MultiStage" 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 'CSTR Transient State If CSTRTransientStateRadioButton.Checked = True AndAlso _

Page 117: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

107

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() ElseIf CSTRTransientStateRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = True Then OperationModeToolStripLabel.Text = "CSTR Transient 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 'CSTR Steady State If CSTRSteadyStateRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = False Then OperationModeToolStripLabel.Text = "CSTR Steady 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() 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 #Region "Call ShowGroupBox" Private Sub ShowGroupBox() Call HideAllGroup() Call ShowPictureBox() ReactionGroupBox.Show() ModelGroupBox.Show() Add2ndReactorCheckBox.Show() Reactor1GroupBox.Show() If Add2ndReactorCheckBox.Checked = True Then Reactor2GroupBox.Show() End If End Sub

Page 118: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

108

#End Region #Region "Call ClearComboBox" Private Sub ChemClearComboBox() 'Reactor 1 xTimeComboBox.Items.Clear() y1ReactantConcR1ComboBox.Items.Clear() y2ProductConcR1ComboBox.Items.Clear() 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() If ReactionGroupBox.Visible = True OrElse _ ModelGroupBox.Visible = True OrElse _ Reactor1GroupBox.Visible = True Then BackToolStripButton.Enabled = False CalculateToolStripButton.Enabled = True GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If If GraphGroupBox.Visible = True OrElse _ TableGroupBox.Visible = True Then BackToolStripButton.Enabled = True CalculateToolStripButton.Enabled = False GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If End Sub #End Region

#Region "Declare variables for Chem Kinetics" 'ChemReactor1 Private R1ReactantConc As String Private R1ProductConc As String Private R1SimulationTime As String Private R1Timeinterval As String Private R1Volume As String Private R1FlowRate As String Private R1RetentionTime As String Private R1DilutionRate As String Private R1ConstantK As String Private R1C0 As Double Private R1Cti As Double Private R1P0 As Double Private R1Pti As Double Private R1Time As Decimal Private R1deltaT As Decimal = 0.1 Private R1deltaI As Decimal Private R1V As Double Private R1F As Double Private R1tau As Double Private R1D As Double Private R1ConstK As Decimal 'ChemReactor2 Private R2ReactantConc As String Private R2ProductConc As String Private R2SimulationTime As String Private R2TimeInterval As String Private R2Volume As String

Page 119: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

109

Private R2FlowRate As String Private R2RetentionTime As String Private R2DilutionRate As String Private R2ConstantK As String Private R2C0 As Double Private R2Cti As Double Private R2P0 As Double Private R2Pti As Double Private R2Time As Decimal Private R2deltaT As Decimal = 0.1 Private R2deltaI As Decimal Private R2V As Double Private R2F As Double Private R2tau As Double Private R2D As Double Private R2ConstK As Decimal 'Graph 'Reactor 1 Private numItm As Integer Private xAdd As Double Private y1Add As Double Private y2Add As Double 'Reactor 2 Private numItmR2 As Integer Private xAddR2 As Double Private y1AddR2 As Double Private y2AddR2 As Double 'Calculation 'Reactor 1 Private R1CAs_First As Double Private R1CtiTemp As Double Private R1PtiTemp As Double Private R1CtiSteady As Double Private R1PtiSteady As Double Private R1CtiTempSteady As Double Private R1PtiTempSteady As Double Private R1SteadyTime As Integer Private R1SteadyTimeRun As Integer Private R1ReachSteadyConc As Double 'Reactor 2 Private R2CAs_First As Double Private R2CtiTemp As Double Private R2PtiTemp As Double Private R2CtiSteady As Double Private R2PtiSteady As Double Private R2CtiTempSteady As Double Private R2PtiTempSteady As Double Private R2SteadyTime As Integer Private R2SteadyTimeRun As Integer #End Region #Region "Call ReadReactor1Data" Private Sub ReadReactor1Data() 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)

Page 120: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

110

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 #Region "Call ReadReactor2Data" Private Sub ReadReactor2Data() 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

Page 121: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

111

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 #Region "Call ChemFDtauCalculation" Private Sub ChemFDtauCalculation_Reactor1() Call ReadReactor1Data() If VolumeTextBox.Text <> "" AndAlso FlowRateTextBox.Text <> "" Then R1tau = R1V / R1F ElseIf DilutionRateTextBox.Text <> "" Then R1tau = 1 / R1D ElseIf RetentionTimeTextBox.Text <> "" Then R1tau = R1tau End If End Sub Private Sub ChemFDtauCalculation_Reactor2() Call ReadReactor2Data() If VolumeR2TextBox.Text <> "" AndAlso FlowRateR2TextBox.Text <> "" Then R2tau = R2V / R2F ElseIf DilutionRateR2TextBox.Text <> "" Then R2tau = 1 / R2D ElseIf RetentionTimeR2TextBox.Text <> "" Then R2tau = R2tau End If End Sub #End Region #Region "FindSteadyTime_Reactor1" Private Sub FindSteadyTime_Reactor1() 'Calculate steady state concentration R1CAs_First = R1C0 / (1 + (R1ConstK * R1tau)) 'Find steady state time For j = 0 To 10000 Step R1deltaT If j = 0 Then R1CtiTempSteady = R1C0 R1PtiTempSteady = R1P0 ElseIf j > 0 Then R1CtiSteady = R1CtiTempSteady + ((R1C0 - R1CtiTempSteady) * (1 / R1tau) - R1ConstK * R1CtiTempSteady) * R1deltaT R1PtiSteady = R1PtiTempSteady + ((R1P0 - R1PtiTempSteady) * (1 / R1tau) + R1ConstK * R1CtiTempSteady) * R1deltaT 'Simulation reach the steady state If Math.Round((R1CAs_First / R1CtiTempSteady) * 100, 4) >= 99.9992 Then R1SteadyTime = j 'Exit Exit For End If If R1CtiSteady > 0 Then R1CtiTempSteady = R1CtiSteady Else R1CtiTempSteady = 0 End If If R1PtiSteady > 0 Then R1PtiTempSteady = R1PtiSteady

Page 122: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

112

Else R1PtiTempSteady = 0 End If End If Next 'Calculate circle for Steady state MessageBox.Show( "Steady state concentration of Reactor 1 is " & _ Math.Round(R1CAs_First, 4) & " " & ReactantConcComboBox.Text & ControlChars.NewLine & _ "and achieved at t = " & R1SteadyTime & " " & SimulationTimeComboBox.Text, _ "Messages" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) End Sub #End Region #Region "FindSteadyTime_Reactor2" Private Sub FindSteadyTime_Reactor2() 'Calculate steady state concentration R2CAs_First = R2C0 / (1 + (R2ConstK * R2tau)) 'Find steady state time For j2 = 0 To 10000 Step R2deltaT If j2 = 0 Then R2CtiTempSteady = R2C0 R2PtiTempSteady = R2P0 ElseIf j2 > 0 Then R2CtiSteady = R2CtiTempSteady + ((R2C0 - R2CtiTempSteady) * (1 / R2tau) - R2ConstK * R2CtiTempSteady) * R2deltaT R2PtiSteady = R2PtiTempSteady + ((R2P0 - R2PtiTempSteady) * (1 / R2tau) + R2ConstK * R2CtiTempSteady) * R2deltaT 'Simulation reach the steady state If Math.Round((R2CAs_First / R2CtiTempSteady) * 100, 4) >= 99.9992 Then R2SteadyTime = j2 'Exit Exit For End If If R2CtiSteady > 0 Then R2CtiTempSteady = R2CtiSteady Else R2CtiTempSteady = 0 End If If R2PtiSteady > 0 Then R2PtiTempSteady = R2PtiSteady Else R2PtiTempSteady = 0 End If End If Next 'Calculate circle for Steady state MessageBox.Show( "Steady state concentration of Reactor 2 is " & _ Math.Round(R2CAs_First, 4) & " " & ReactantConcComboBox.Text & ControlChars.NewLine & _ "and achieved at t = " & R2SteadyTime & " " & SimulationTimeComboBox.Text, _ "Messages" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) End Sub #End Region #Region "Calculate Chem Kinetics" 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 ''Check if there's sufficient data '\\\\\\\\\\\\\\ For 1 reactor If Add2ndReactorCheckBox.Checked = False Then 'Reactant If ReactantConcTextBox.Text = "" Then ReactantConcTextBox.Focus() MessageBox.Show( "Reactant Concentration is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress

Page 123: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

113

_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 If CSTRSteadyStateRadioButton.Checked = True OrElse _ CSTRTransientStateRadioButton.Checked = True Then 'Flow rate If FlowRateRadioButton.Checked = True Then 'Volume If VolumeTextBox.Text = "" Then VolumeTextBox.Focus() MessageBox.Show( "Reactor Volume 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 'Constant k If ConstkTextBox.Text = "" Then ConstkTextBox.Focus() MessageBox.Show( "Constant k is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress

Page 124: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

114

_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If End If '1 Reactor ''\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ For 2 reactors If Add2ndReactorCheckBox.Checked = True Then '***************************************************************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 If CSTRTransientStateRadioButton.Checked = True OrElse _ CSTRSteadyStateRadioButton.Checked = True Then 'Flow rate If FlowRateRadioButton.Checked = True Then 'Volume If VolumeTextBox.Text = "" Then VolumeTextBox.Focus() MessageBox.Show( "Reactor Volume 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!" , _

Page 125: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

115

"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 If CSTRTransientStateRadioButton.Checked = True OrElse _ CSTRSteadyStateRadioButton.Checked = True Then 'Flow rate If FlowRateR2RadioButton.Checked = True Then 'Volume If VolumeR2TextBox.Text = "" Then VolumeR2TextBox.Focus() MessageBox.Show( "Reactor Volume 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 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()

Page 126: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

116

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 '\\\\\\\\\\\\Name cannot be empty If ReactantNameComboBox.Text = "" Then ReactantNameComboBox.Focus() MessageBox.Show( "Reactant Name is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If If ProductNameComboBox.Text = "" Then ProductNameComboBox.Focus() MessageBox.Show( "Product Name is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If 'Clear Result ComboBox ChemKineticsPanel.AutoScroll = False Call ChemClearComboBox() ''******************************************************************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() ElseIf Add2ndReactorCheckBox.Checked = True Then ChemTableSplitContainer.Panel2Collapsed = False Call ReadReactor1Data() Call ReadReactor2Data() Call BatchFirstOrder_2Reactor() End If End If 'CSTR Transient State If CSTRTransientStateRadioButton.Checked = True Then If Add2ndReactorCheckBox.Checked = False Then ChemTableSplitContainer.Panel2Collapsed = True Call ReadReactor1Data() Call ChemFDtauCalculation_Reactor1() Call CSTRTransientFirstOrder_Reactor1() ElseIf Add2ndReactorCheckBox.Checked = True Then ChemTableSplitContainer.Panel2Collapsed = False

Page 127: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

117

Call ReadReactor1Data() Call ReadReactor2Data() Call ChemFDtauCalculation_Reactor1() Call ChemFDtauCalculation_Reactor2() Call CSTRTransientFirstOrder_2Reactor() End If End If 'CSTR Steady State If CSTRSteadyStateRadioButton.Checked = True Then If Add2ndReactorCheckBox.Checked = False Then ChemTableSplitContainer.Panel2Collapsed = True Call ReadReactor1Data() Call ChemFDtauCalculation_Reactor1() 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

Page 128: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

118

APPENDIX E

VB CODE FOR SECOND-ORDER CHEMICAL REACTION

#Region "Load event" Private Sub SecondOrder_Load( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles Me.Load 'CAPS-NUM CheckLockKeys() '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

#Region "Call ShowPictureBox" Private Sub ShowPictureBox() 'PictureBox 'Batch If BatchRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = False Then OperationModeToolStripLabel.Text = "Batch" BatchPicturePanel.Show() BatchSeriesPicturePanel.Hide() CSTRPicturePanel.Hide() CSTRSeriesPicturePanel.Hide() ElseIf BatchRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = True Then OperationModeToolStripLabel.Text = "Batch MultiStage" 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 'CSTR Transient State If CSTRTransientStateRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = False Then

Page 129: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

119

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() ElseIf CSTRTransientStateRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = True Then OperationModeToolStripLabel.Text = "CSTR Transient 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 'CSTR Steady State If CSTRSteadyStateRadioButton.Checked = True AndAlso _ Add2ndReactorCheckBox.Checked = False Then OperationModeToolStripLabel.Text = "CSTR Steady 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() 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 #Region "Call ShowGroupBox" Private Sub ShowGroupBox() Call HideAllGroup() Call ShowPictureBox() ReactionGroupBox.Show() ModelGroupBox.Show() Add2ndReactorCheckBox.Show() Reactor1GroupBox.Show() If Add2ndReactorCheckBox.Checked = True Then Reactor2GroupBox.Show() End If End Sub

Page 130: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

120

#End Region #Region "Call ClearComboBox" Private Sub ChemClearComboBox() 'Reactor 1 xTimeComboBox.Items.Clear() y1ReactantConcR1ComboBox.Items.Clear() y2ProductConcR1ComboBox.Items.Clear() 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 "Call EnableCommanButton" Private Sub EnableCommanButton() If ReactionGroupBox.Visible = True OrElse _ ModelGroupBox.Visible = True OrElse _ Reactor1GroupBox.Visible = True Then BackToolStripButton.Enabled = False CalculateToolStripButton.Enabled = True GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If If GraphGroupBox.Visible = True OrElse _ TableGroupBox.Visible = True Then BackToolStripButton.Enabled = True CalculateToolStripButton.Enabled = False GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If End Sub #End Region

#Region "Declare variables for Chem Kinetics" 'ChemReactor1 Private R1ReactantConc As String Private R1ProductConc As String Private R1SimulationTime As String Private R1TimeInterval As String Private R1Volume As String Private R1FlowRate As String Private R1RetentionTime As String Private R1DilutionRate As String Private R1ConstantK As String Private R1C0 As Single Private R1Cti As Double Private R1P0 As Single Private R1Pti As Double Private R1Time As Decimal Private R1deltaT As Decimal = 0.1 Private R1deltaI As Decimal Private R1V As Decimal Private R1F As Decimal Private R1tau As Decimal Private R1D As Decimal Private R1ConstK As Decimal 'ChemReactor2 Private R2ReactantConc As String Private R2ProductConc As String Private R2SimulationTime As String Private R2TimeInterval As String Private R2Volume As String Private R2FlowRate As String Private R2RetentionTime As String

Page 131: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

121

Private R2DilutionRate As String Private R2ConstantK As String Private R2C0 As Double Private R2Cti As Double Private R2P0 As Double Private R2Pti As Double Private R2Time As Decimal Private R2deltaT As Decimal = 0.1 Private R2deltaI As Decimal Private R2V As Decimal Private R2F As Decimal Private R2tau As Decimal Private R2D As Decimal Private R2ConstK As Decimal 'Graph 'Reactor 1 Private numItm As Integer Private xAdd As Double Private y1Add As Double Private y2Add As Double 'Reactor 2 Private numItmR2 As Integer Private xAddR2 As Double Private y1AddR2 As Double Private y2AddR2 As Double 'Calculation 'Reactor 1 Private R1CAs_Second As Double Private R1CtiTemp As Double Private R1PtiTemp As Double Private R1CtiSteady As Double Private R1PtiSteady As Double Private R1CtiTempSteady As Double Private R1PtiTempSteady As Double Private R1SteadyTime As Integer Private R1SteadyTimeRun As Integer Private R1ReachSteadyConc As Double 'Reactor 2 Private R2CAs_Second As Double Private R2CtiTemp As Double Private R2PtiTemp As Double Private R2CtiSteady As Double Private R2PtiSteady As Double Private R2CtiTempSteady As Double Private R2PtiTempSteady As Double Private R2SteadyTime As Integer Private R2SteadyTimeRun As Integer #End Region #Region "Call ReadChemReactor1Data" Private Sub ReadChemReactor1Data() 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

Page 132: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

122

'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 #Region "Call ReadChemReactor2Data" Private Sub ReadChemReactor2Data() 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)

Page 133: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

123

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 #Region "Call ChemFDtauCalculation" Private Sub ChemFDtauCalculation_Reactor1() Call ReadChemReactor1Data() If VolumeTextBox.Text <> "" AndAlso FlowRateTextBox.Text <> "" Then R1tau = R1V / R1F ElseIf DilutionRateTextBox.Text <> "" Then R1tau = 1 / R1D ElseIf RetentionTimeTextBox.Text <> "" Then R1tau = R1tau End If End Sub Private Sub ChemFDtauCalculation_Reactor2() Call ReadChemReactor2Data() If VolumeR2TextBox.Text <> "" AndAlso FlowRateR2TextBox.Text <> "" Then R2tau = R2V / R2F ElseIf DilutionRateR2TextBox.Text <> "" Then R2tau = 1 / R2D ElseIf RetentionTimeR2TextBox.Text <> "" Then R2tau = R2tau End If End Sub #End Region #Region "FindSteadyTime_Reactor1" Private Sub FindSteadyTime_Reactor1() Dim squareRoot As Double squareRoot = Math.Sqrt(1 + (4 * R1ConstK * R1tau * R1C0)) R1CAs_Second = (squareRoot - 1) / (2 * R1ConstK * R1tau) 'Find steady state time For j = 0 To 10000 Step R1deltaT If j = 0 Then R1CtiTempSteady = R1C0 R1PtiTempSteady = R1P0 ElseIf j > 0 Then R1CtiSteady = R1CtiTempSteady + ((R1C0 - R1CtiTempSteady) * (1 / R1tau) - R1ConstK * R1CtiTempSteady ^ 2) * R1deltaT R1PtiSteady = R1PtiTempSteady + ((R1P0 - R1PtiTempSteady) * (1 / R1tau) + R1ConstK * R1CtiTempSteady ^ 2) * R1deltaT 'Simulation reach the steady state If Math.Round((R1CAs_Second / R1CtiTempSteady) * 100, 4) >= 99.9992 Then R1SteadyTime = j 'Exit Exit For End If If R1CtiSteady > 0 Then R1CtiTempSteady = R1CtiSteady Else R1CtiTempSteady = 0 End If

Page 134: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

124

If R1PtiSteady > 0 Then R1PtiTempSteady = R1PtiSteady Else R1PtiTempSteady = 0 End If End If Next 'Calculate circle for Steady state MessageBox.Show( "Steady state concentration of Reactor 1 is " & _ Math.Round(R1CAs_Second, 4) & " " & ReactantConcComboBox.Text & ControlChars.NewLine & _ "and achieved at t = " & R1SteadyTime & " " & SimulationTimeComboBox.Text, _ "Messages" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) End Sub #End Region #Region "FindSteadyTime_Reactor2" Private Sub FindSteadyTime_Reactor2() Dim squareRoot As Double squareRoot = Math.Sqrt(1 + (4 * R2ConstK * R2tau * R2C0)) R2CAs_Second = (squareRoot - 1) / (2 * R2ConstK * R2tau) 'Find steady state time For j2 = 0 To 10000 Step R2deltaT If j2 = 0 Then R2CtiTempSteady = R2C0 R2PtiTempSteady = R2P0 ElseIf j2 > 0 Then R2CtiSteady = R2CtiTempSteady + ((R2C0 - R2CtiTempSteady) * (1 / R2tau) - R2ConstK * R2CtiTempSteady ^ 2) * R2deltaT R2PtiSteady = R2PtiTempSteady + ((R2P0 - R2PtiTempSteady) * (1 / R2tau) + R2ConstK * R2CtiTempSteady ^ 2) * R2deltaT 'Simulation reach the steady state If Math.Round((R2CAs_Second / R2CtiTempSteady) * 100, 4) >= 99.9992 Then R2SteadyTime = j2 'Exit Exit For End If If R2CtiSteady > 0 Then R2CtiTempSteady = R2CtiSteady Else R2CtiTempSteady = 0 End If If R2PtiSteady > 0 Then R2PtiTempSteady = R2PtiSteady Else R2PtiTempSteady = 0 End If End If Next 'Calculate circle for Steady state MessageBox.Show( "Steady state concentration of Reactor 2 is " & _ Math.Round(R2CAs_Second, 4) & " " & ReactantConcComboBox.Text & ControlChars.NewLine & _ "and achieved at t = " & R2SteadyTime & " " & SimulationTimeComboBox.Text, _ "Messages" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) End Sub #End Region

#Region "Calculate Chem Kinetics" 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 ''Check if there's sufficient data '\\\\\\\\\\\\\\ For 1 reactor If Add2ndReactorCheckBox.Checked = False Then 'Reactant If ReactantConcTextBox.Text = "" Then ReactantConcTextBox.Focus()

Page 135: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

125

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 If CSTRSteadyStateRadioButton.Checked = True OrElse _ CSTRTransientStateRadioButton.Checked = True Then 'Flow rate If FlowRateRadioButton.Checked = True Then 'Volume If VolumeTextBox.Text = "" Then VolumeTextBox.Focus() MessageBox.Show( "Reactor Volume 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 'Constant k If ConstkTextBox.Text = "" Then

Page 136: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

126

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 ''\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ For 2 reactors If Add2ndReactorCheckBox.Checked = True Then '***************************************************************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 If CSTRTransientStateRadioButton.Checked = True OrElse _ CSTRSteadyStateRadioButton.Checked = True Then 'Flow rate If FlowRateRadioButton.Checked = True Then 'Volume If VolumeTextBox.Text = "" Then VolumeTextBox.Focus() MessageBox.Show( "Reactor Volume 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

Page 137: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

127

'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 If CSTRTransientStateRadioButton.Checked = True OrElse _ CSTRSteadyStateRadioButton.Checked = True Then 'Flow rate If FlowRateR2RadioButton.Checked = True Then 'Volume If VolumeR2TextBox.Text = "" Then VolumeR2TextBox.Focus() MessageBox.Show( "Reactor Volume 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 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

Page 138: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

128

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 '\\\\\\\\\\\\Name cannot be empty If ReactantNameComboBox.Text = "" Then ReactantNameComboBox.Focus() MessageBox.Show( "Reactant Name is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If If ProductNameComboBox.Text = "" Then ProductNameComboBox.Focus() MessageBox.Show( "Product Name is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If 'Suitable value for Constant k If Val(ReactantConcTextBox.Text) < Val(ReactantConcTextBox.Text) ^ 2 * Val(ConstkTextBox.Text) * 0.1 Then MessageBox.Show( "Chemical Constant k of" & " " & ConstkTextBox.Text & " " & ConstkComboBox.Text & " " & "is not suitable" & " " & _ ControlChars.NewLine & "for given Reactant Concentration of" & " " & ReactantConcTextBox.Text & " " & ReactantConcComboBox.Text _ & ControlChars.NewLine & _ "Please re-enter!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If 'Clear Result ComboBox ChemKineticsPanel.AutoScroll = False Call ChemClearComboBox() '****************************************************************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()

Page 139: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

129

Call BatchSecondOrder_Reactor1() ElseIf Add2ndReactorCheckBox.Checked = True Then ChemTableSplitContainer.Panel2Collapsed = False Call ReadChemReactor1Data() Call ReadChemReactor2Data() Call BatchSecondOrder_2Reactor() End If End If 'CSTR Transient State If CSTRTransientStateRadioButton.Checked = True Then If Add2ndReactorCheckBox.Checked = False Then ChemTableSplitContainer.Panel2Collapsed = True Call ReadChemReactor1Data() Call ChemFDtauCalculation_Reactor1() Call CSTRTransientSecondOrder_Reactor1() ElseIf Add2ndReactorCheckBox.Checked = True Then ChemTableSplitContainer.Panel2Collapsed = False Call ReadChemReactor1Data() Call ReadChemReactor2Data() Call ChemFDtauCalculation_Reactor1() Call ChemFDtauCalculation_Reactor2() Call CSTRTransientSecondOrder_2Reactor() End If End If 'CSTR Steady State If CSTRSteadyStateRadioButton.Checked = True Then If Add2ndReactorCheckBox.Checked = False Then ChemTableSplitContainer.Panel2Collapsed = True Call ReadChemReactor1Data() Call ChemFDtauCalculation_Reactor1() Call CSTRSteadySecondOrder_Reactor1() ElseIf Add2ndReactorCheckBox.Checked = True Then ChemTableSplitContainer.Panel2Collapsed = False Call ReadChemReactor1Data() Call ReadChemReactor2Data() Call ChemFDtauCalculation_Reactor1() Call ChemFDtauCalculation_Reactor2() 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

Page 140: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

130

APPENDIX F

VB CODE FOR SINGLE LIMITING NUTRIENT

#Region "Load event" Private Sub SingleLimitingNutrient_Load( ByVal sender As Object , ByVal e As System.EventArgs) Handles MyBase.Load 'CAPS-NUM CheckLockKeys() '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 ElseIf NumberSubstrateToolStripLabel.Text <> "" AndAlso _ NumberProductToolStripLabel.Text <> "" Then 'For Open File 'Substrate NumberSubstrateComboBox.Items.Clear() NumberSubstrateComboBox.Text = NumberSubstrateToolStripLabel.Text '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

#Region "Call ShowPictureBox" Private Sub ShowPictureBox() 'Batch Picture If BatchRadioButton.Checked = True AndAlso _ Add2ndBioReactorCheckBox.Checked = False Then OperationModeLabel.Text = "Batch" BatchPicturePanel.Show() 'BatchPictureGroupBox.Hide() BatchSeriesPicturePanel.Hide() CSTRPicturePanel.Hide() CSTRSeriesPicturePanel.Hide() CSTRRecyclePicturePanel.Hide() CSTRAddPicturePanel.Hide() ElseIf BatchRadioButton.Checked = True AndAlso _ Add2ndBioReactorCheckBox.Checked = True Then OperationModeLabel.Text = "Batch MultiStage"

Page 141: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

131

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 'CSTR Transient Picture If CSTRTransientRadioButton.Checked = True AndAlso _ Add2ndBioReactorCheckBox.Checked = False Then OperationModeLabel.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() 'CSTRPicturePanel.Hide() CSTRSeriesPicturePanel.Hide() CSTRRecyclePicturePanel.Hide() CSTRAddPicturePanel.Hide() ElseIf CSTRSteadyRadioButton.Checked = True AndAlso _ Add2ndBioReactorCheckBox.Checked = False Then OperationModeLabel.Text = "CSTR Steady 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() 'CSTRPicturePanel.Hide() CSTRSeriesPicturePanel.Hide() CSTRRecyclePicturePanel.Hide() CSTRAddPicturePanel.Hide() ElseIf CSTRTransientRadioButton.Checked = True AndAlso _ Add2ndBioReactorCheckBox.Checked = True Then OperationModeLabel.Text = "CSTR Transient 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() 'CSTRSeriesPicturePanel.Hide() CSTRRecyclePicturePanel.Hide()

Page 142: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

132

CSTRAddPicturePanel.Hide() ElseIf CSTRSteadyRadioButton.Checked = True AndAlso _ Add2ndBioReactorCheckBox.Checked = True Then OperationModeLabel.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() 'CSTRSeriesPicturePanel.Hide() CSTRRecyclePicturePanel.Hide() CSTRAddPicturePanel.Hide() End If 'CSTR Recycle Picture If CSTRRecycleRadioButton.Checked = True Then OperationModeLabel.Text = "CSTR with Biomass Recycle" CSTRRecyclePicturePanel.Show() CSTRRecyclePicturePanel.Location = New Point(ModelGroupBox.Location.X + _ ModelTableLayoutPanel.Location.X + _ BatchPicturePanel.Location.X, _ ModelGroupBox.Location.Y + _ ModelTableLayoutPanel.Location.Y + _ BatchPicturePanel.Location.Y) 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 #Region "Call ShowReactor" Private Sub ShowReactor() If Add2ndBioReactorCheckBox.Checked = True Then Reactor2GroupBox.Show()

Page 143: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

133

ElseIf Add2ndBioReactorCheckBox.Checked = False Then Reactor2GroupBox.Hide() End If End Sub #End Region #Region "Call EnableCommandButton" Private Sub EnableCommandButton() If ReactionGroupBox.Visible = True OrElse _ ModelGroupBox.Visible = True OrElse _ Reactor1GroupBox.Visible = True Then 'Enable Calculate, Graph, Table BackToolStripButton.Enabled = False CalculateToolStripButton.Enabled = True GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If If GraphTabControl.Visible = True OrElse _ TableTabControl.Visible = True Then 'Enable Return, Graph, Table BackToolStripButton.Enabled = True CalculateToolStripButton.Enabled = False GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If End Sub #End Region #Region "Call ClearResultComboBox" Private Sub ClearResultComboBox() 'Reactor1 xTimeComboBox.Items.Clear() y1SubstrateComboBox.Items.Clear() y2BiomassComboBox.Items.Clear() y3ProductComboBox.Items.Clear() y5umaxComboBox.Items.Clear() y6rSComboBox.Items.Clear() y7rX1ComboBox.Items.Clear() y8rPComboBox.Items.Clear() 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

Page 144: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

134

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

#Region "Declare variables" '*********************************************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 Private TtR2 As Decimal Private deltaTR2 As Decimal = 0.1 Private deltaIR2 As Decimal Private VR2 As Decimal Private FR2 As Decimal Private tauR2 As Decimal Private DR2 As Decimal Private FAdd As Decimal '**************************************************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 = "" Private X0_R2 As Decimal Private YxsR2 As Decimal Private rXR2 As Double = 0

Page 145: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

135

Private rX1R2 As Double = 0 Private rDR2 As Double = 0 '*******************************************************Substrate 1 Variables Private subConc As String = "" Private Subumax As String Private SubKd As String Private SubKs As String Private SubkLa As String Private SubDOConc As String Private SubSatDOConc As String Private subLight As String Private subOptLight As String Private SubmS 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 kLa As Double Private mS 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 Private SubR2kLa As String Private SubR2DOConc As String Private SubR2SatDOConc As String Private SubR2mS 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 Private kLaR2 As Double Private SatDOR2 As Double Private mSR2 As Double Private rSR2 As Double = 0 Private rDOR2 As Double Private rIR2 As Double '*******************************************************Product 1 Variables Private ProConc As String = "" Private ProYps As String = "" Private ProInhibitionConst As String Private ProKpg As String Private ProKpng As String Private PromP As String Private ProPm As String Private Pron As String Private Proalpha As String Private ProRefSubstrate 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 Private ProR2Yps As String = "" Private ProR2InhibitionConst As String Private ProR2Kpg As String Private ProR2Kpng As String Private ProR2mP As String Private ProR2Pm As String Private ProR2n As String Private ProR2alpha As String

Page 146: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

136

Private ProR2RefSubstrate As String = "" Private P0_R2 As Decimal Private YpsR2 As Decimal Private kpgR2 As Decimal Private kpngR2 As Decimal Private mPR2 As Decimal Private rPR2 As Double = 0 '********************************************Variables For calculation 'R1 Private Xti As Double Private Sti As Double Private Iti As Double Private Pti As Double Private umaxCal As Double Private StiTemp As Double Private DOtiTemp As Double Private ItiTemp As Double Private XtiTemp As Double Private PtiTemp As Double Private Rpng As Double Private Ss As Double Private Xs As Double Private R1SteadyTime As Double Private R1SteadyTimeRun As Double '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 Private StiTempR2 As Double Private DOtiTempR2 As Double Private ItiTempR2 As Double Private XtiTempR2 As Double Private PtiTempR2 As Double Private RpngR2 As Double Private SsR2 As Double Private XsR2 As Double Private R2SteadyTime As Double Private R2SteadyTimeRun As Double Private RepX As Double Private RepP As Double Private RepS As Double Private RepXR2 As Double Private RepPR2 As Double Private RepSR2 As Double '****************************************************************************Graph 'Reactor 1 Private numItm As Integer Private xTime As Double Private y1Sub As Double Private y2Biomass As Double Private y3Product As Double Private y5umax As Double Private y6rS As Double Private y7rX As Double Private y7rX1 As Double Private y7rD As Double Private y8rP As Double 'Reactor 2 Private numItmR2 As Integer Private xTimeR2 As Double Private y1SubR2 As Double Private y2BiomassR2 As Double Private y3ProductR2 As Double Private y5umaxR2 As Double Private y6rSR2 As Double Private y7rXR2 As Double Private y7rX1R2 As Double Private y7rDR2 As Double Private y8rPR2 As Double #End Region #Region "Read Operation, Substrate, Product Data" #Region "Call ReadOperationData"

Page 147: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

137

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 'Sub1 biomass yield If subYxs = "" Then Yxs = 1 Else Yxs = CDec(subYxs) End If End Sub #End Region #Region "Call ReadOperationDataR2" Private Sub ReadOperationDataR2()

Page 148: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

138

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 'Sub1 mass yield If subR2Yxs = "" Then YxsR2 = 1 Else YxsR2 = CDec(subR2Yxs) End If End Sub #End Region #Region "Call ReadSub1Data" Private Sub ReadSub1Data() 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

Page 149: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

139

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 #Region "Call ReadSubR2Data" Private Sub ReadSubR2Data() 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

Page 150: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

140

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 #Region "Call ReadPro1Data" Private Sub ReadPro1Data() 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 'pro Product Yield If ProYps = "" Then Yps = 1 Else Yps = CDec(ProYps) 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 #Region "Call ReadProR2Data" Private Sub ReadProR2Data() ProR2Yps = SingleData.YpsR2TextBox.Text ProR2Kpg = SingleData.KpgR2TextBox.Text ProR2Kpng = SingleData.KpngR2TextBox.Text ProR2mP = SingleData.mPR2TextBox.Text

Page 151: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

141

'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 #Region "Call FDtauCalculation" Private Sub FDtauCalculation() If VolumeTextBox.Text <> "" AndAlso FlowRateTextBox.Text <> "" Then D = F / V ElseIf DilutionRateTextBox.Text <> "" Then D = D ElseIf RetentionTimeTextBox.Text <> "" Then D = 1 / tau End If End Sub Private Sub FDtauCalculationR2() If VolumeR2TextBox.Text <> "" AndAlso FlowRateR2TextBox.Text <> "" Then DR2 = FR2 / VR2 ElseIf DilutionRateR2TextBox.Text <> "" Then DR2 = DR2 ElseIf RetentionTimeR2TextBox.Text <> "" Then DR2 = 1 / tauR2 End If End Sub #End Region #Region "Call ProNonGrowth" Private Sub ProNonGrowth() If SingleData.ProTypeToolStripLabel.Text = "Growth" OrElse _ SingleData.ProTypeToolStripLabel.Text = "Mix" OrElse _ SingleData.ProTypeToolStripLabel.Text = "" Then Rpng = 0 RpngR2 = 0 ElseIf SingleData.ProTypeToolStripLabel.Text = "NonGrowth" Then Rpng = kpng + mP RpngR2 = kpngR2 + mPR2 End If End Sub #End Region #Region "Call FindSteadyTime_Reactor1" Private Sub FindSteadyTime_Reactor1() Dim deltaS As Double Dim count As Integer If CSTRSteadyRadioButton.Checked = True Then Call SetInitialConcentration() Call FDtauCalculation() Call ProNonGrowth() 'Calculate steady state concentration Ss = Ks * (D + kd) / (umax - (D + kd)) Xs = D * Yxs * Yps * (S0 - Ss) / (Yps * (D + kd) + Yxs * (kpg * (D + kd) + kpng) + mS * Yxs * Yps) For j = 0 To 1000000 Step deltaT 'Calculate inlet feed stream Call ReplaceFeedStreamCal() 'umaxCal

Page 152: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

142

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 deltaS = StiTemp - Sti If Math.Round(deltaS, 3) = 0 Then count = count + 1 End If 'Simulation reach the steady state If Math.Round(Sti / Ss, 3) <= 0.9999 OrElse count > 99 Then R1SteadyTime = j 'Exit Exit For End If 'Assign Value XtiTemp = Xti PtiTemp = Pti If Sti > 0 Then StiTemp = Sti Else StiTemp = 0 End If Next MessageBox.Show( "Steady state concentration of Substrate of Reactor 1 is " & _ Math.Round(Ss, 4) & " " & SingleData.BiomassConcComboBox.Text & ControlChars.NewLine & _ "and achieved at t = " & R1SteadyTime & " " & SimulationTimeComboBox.Text, _ "Messages" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) End If 'CSTR Steady State End Sub #End Region #Region "Call FindSteadyTime_Reactor2" Private Sub FindSteadyTime_Reactor2() Dim deltaSR2 As Double Dim countR2 As Integer If CSTRSteadyRadioButton.Checked = True Then Call FDtauCalculationR2() Call ProNonGrowth() 'Calculate steady state concentration SsR2 = KsR2 * (DR2 + kdR2) / (umaxR2 - (DR2 + kdR2)) For j = 0 To 1000000 Step deltaTR2 'Calculate inlet feed stream Call ReplaceFeedStreamCalR2() '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) XtiR2 = XtiTempR2 + (rXR2 * deltaTR2) + RepXR2 PtiR2 = PtiTempR2 + (rPR2 * deltaT) + RepPR2 StiR2 = StiTempR2 - (rSR2 * deltaTR2) + RepSR2 deltaSR2 = StiTempR2 - StiR2 If Math.Round(deltaSR2, 3) = 0 Then countR2 = countR2 + 1 End If 'Simulation reach the steady state If Math.Round(StiR2 / SsR2, 3) <= 0.9999 OrElse countR2 > 99 Then R1SteadyTime = j 'Exit Exit For End If 'Assign Value

Page 153: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

143

XtiTempR2 = XtiR2 PtiTempR2 = PtiTempR2 If StiR2 > 0 Then StiTempR2 = StiR2 Else StiTempR2 = 0 End If Next MessageBox.Show( "Steady state concentration of Substrate of Reactor 2 is " & _ Math.Round(SsR2, 4) & " " & SingleData.BiomassConcComboBox.Text & ControlChars.NewLine & _ "and achieved at t = " & R2SteadyTime & " " & SimulationTimeComboBox.Text, _ "Messages" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) End If 'CSTR Steady State End Sub #End Region #Region "Call SetInitialConcentration" Private Sub SetInitialConcentration() StiTemp = S0 XtiTemp = X0 PtiTemp = P0 ItiTemp = I0 End Sub #End Region #Region "Call ReplaceFeedStreamCal" Private Sub ReplaceFeedStreamCal() If BatchRadioButton.Checked = True Then RepX = 0 RepP = 0 RepS = 0 ElseIf CSTRTransientRadioButton.Checked = True OrElse _ CSTRSteadyRadioButton.Checked = True Then RepX = -XtiTemp * D * deltaT RepP = (P0 - PtiTemp) * D * deltaT RepS = (S0 - StiTemp) * D * deltaT ElseIf CSTRRecycleRadioButton.Checked = True Then RepX = XtiTemp * (Xr_X * Fr_F - (1 + Fr_F)) * D * deltaT RepS = (S0 - StiTemp) * D * deltaT RepP = (P0 - PtiTemp) * D * deltaT End If End Sub #End Region #Region "Call ReplaceFeedStreamCalR2" Private Sub ReplaceFeedStreamCalR2() If BatchRadioButton.Checked = True Then RepXR2 = 0 RepPR2 = 0 RepSR2 = 0 ElseIf CSTRTransientRadioButton.Checked = True OrElse _ CSTRSteadyRadioButton.Checked = True Then RepXR2 = -XtiTempR2 * DR2 * deltaTR2 RepPR2 = (P0_R2 - PtiTempR2) * DR2 * deltaTR2 RepSR2 = (S0_R2 - StiTempR2) * DR2 * deltaTR2 ElseIf CSTRAddRadioButton.Checked = True Then RepXR2 = -XtiTempR2 * (DR2 + (FAdd / VR2)) * deltaTR2 RepSR2 = (S0_R2 - StiTempR2) * (DR2 + (FAdd / VR2)) * deltaTR2 RepPR2 = (P0_R2 - PtiTempR2) * (DR2 + (FAdd / VR2)) * deltaTR2 End If End Sub #End Region #Region "Call ReplaceRunTime" Private Sub ReplaceRunTime() If CSTRSteadyRadioButton.Checked = True Then Tt = R1SteadyTimeRun TtR2 = R2SteadyTimeRun Else Tt = Tt TtR2 = TtR2 End If End Sub #End Region

Page 154: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

144

#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 'Check if there's sufficient data If Add2ndBioReactorCheckBox.Checked = False Then 'Simulation Time If BatchRadioButton.Checked = True OrElse _ CSTRTransientRadioButton.Checked = True OrElse _ CSTRRecycleRadioButton.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 '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 If ConcFactorTextBox.Text = "" Then ConcFactorTextBox.Focus() MessageBox.Show( "Concentration factor 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 If CSTRSteadyRadioButton.Checked = True OrElse _ CSTRTransientRadioButton.Checked = True OrElse _ CSTRRecycleRadioButton.Checked = True Then 'Flow rate If FlowRateRadioButton.Checked = True Then 'Volume If VolumeTextBox.Text = "" Then VolumeTextBox.Focus() MessageBox.Show( "Reactor Volume 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()

Page 155: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

145

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 ElseIf SingleData.ProTypeToolStripLabel.Text = "NonGrowth" Then If SingleData.KpngTextBox.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 ElseIf SingleData.ProTypeToolStripLabel.Text = "Mix" Then If SingleData.KpgTextBox.Text = "" OrElse _ SingleData.KpngTextBox.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 End If 'Pro Type

Page 156: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

146

'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 End If '1 Pro End If '1 reactor If Add2ndBioReactorCheckBox.Checked = True Then '******************************************************************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 If CSTRSteadyRadioButton.Checked = True OrElse _ CSTRTransientRadioButton.Checked = True OrElse _ CSTRAddRadioButton.Checked = True Then 'Flow rate If FlowRateRadioButton.Checked = True Then 'Volume If VolumeTextBox.Text = "" Then VolumeTextBox.Focus() MessageBox.Show( "Reactor Volume 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

Page 157: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

147

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 ElseIf SingleData.ProTypeToolStripLabel.Text = "NonGrowth" Then If SingleData.KpngTextBox.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 ElseIf SingleData.ProTypeToolStripLabel.Text = "Mix" Then If SingleData.KpgTextBox.Text = "" OrElse _ SingleData.KpngTextBox.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 End If 'Pro Type 'Product Yield If SingleData.YpsTextBox.Text = "" Then MessageBox.Show( "Data is required!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) Call ShowReactor1_HideReactor2() SingleData.ShowDialog()

Page 158: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

148

'///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If 'Pro Yield End If '1 Pro '***************************************************************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 If CSTRSteadyRadioButton.Checked = True OrElse _ CSTRTransientRadioButton.Checked = True OrElse _ CSTRAddRadioButton.Checked = True Then 'Flow rate If FlowRateR2RadioButton.Checked = True Then 'Volume If VolumeR2TextBox.Text = "" Then VolumeR2TextBox.Focus() MessageBox.Show( "Reactor Volume 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 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 'Add flow rate If CSTRAddRadioButton.Checked = True Then If FlowRateAddTextBox.Text = "" Then FlowRateAddTextBox.Focus()

Page 159: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

149

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 ElseIf SingleData.ProTypeToolStripLabel.Text = "NonGrowth" Then If SingleData.KpngR2TextBox.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 ElseIf SingleData.ProTypeToolStripLabel.Text = "Mix" Then 'Kpg If SingleData.KpgR2TextBox.Text = "" OrElse _ SingleData.KpngR2TextBox.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 End If 'Pro Type '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 End If '1 Pro

Page 160: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

150

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

Page 161: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

151

APPENDIX G

VB CODE FOR MULTIPLE LIMITING NUTRIENTS

#Region "Load event" Private Sub _Parent_Load( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles Me.Load 'CAPS-NUM CheckLockKeys() '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() ElseIf NumberSubstrateToolStripLabel.Text <> "" AndAlso _ NumberProductToolStripLabel.Text <> "" Then 'For Open File 'Substrate NumberSubstrateComboBox.Items.Clear() NumberSubstrateComboBox.Items.Add( "2" ) NumberSubstrateComboBox.Items.Add( "3" ) NumberSubstrateComboBox.Items.Add( "4" ) NumberSubstrateComboBox.Text = NumberSubstrateToolStripLabel.Text '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 ElseIf CompSubLabel.Text = "Non-Competitive" Then CompSubComboBox.SelectedIndex = 1 SubSubNoteLabel.Hide() MultipleSubData.Sub2fFactorLabel.Enabled = False MultipleSubData.Sub2fFactorTextBox.Enabled = False ElseIf CompSubLabel.Text = "Substitutable Substrate" Then

Page 162: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

152

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

#Region "Call ShowPictureBox" Private Sub ShowPictureBox() 'Batch If BatchRadioButton.Checked = True Then OperationModeLabel.Text = "Batch" BatchPicturePanel.Show() CSTRPicturePanel.Hide() 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 #Region "Call EnableCommandButton" Private Sub EnableCommandButton() If ReactionGroupBox.Visible = True OrElse _ ModelGroupBox.Visible = True OrElse _ OperationParaGroupBox.Visible = True Then 'Enable Calculate, Graph, Table BackToolStripButton.Enabled = False CalculateToolStripButton.Enabled = True GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If If GraphGroupBox.Visible = True OrElse _ TableGroupBox.Visible = True Then 'Enable Return, Graph, Table BackToolStripButton.Enabled = True CalculateToolStripButton.Enabled = False GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If End Sub #End Region #Region "Call ClearResultComboBox" Private Sub ClearResultComboBox() xTimeComboBox.Items.Clear() y1Sub1ComboBox.Items.Clear() y1Sub2ComboBox.Items.Clear() y1Sub3ComboBox.Items.Clear() y1Sub4ComboBox.Items.Clear() y2BiomassComboBox.Items.Clear() y3Pro1ComboBox.Items.Clear()

Page 163: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

153

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

#Region "Declare variables" '*********************************************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

Page 164: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

154

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 kLa1 As Double Private DO1 As Double Private SatDO1 As Double Private mS1 As Double Private rS As Double = 0 '***********************************************Substrate 2 Variables Private sub2Conc As String = "" Private sub2PreferSub As String Private sub2umax As String Private sub2factor_f As String Private sub2Kd As String Private sub2Ks As String Private sub2mS As String Private S0_2 As Decimal Private KI2 As Decimal Private KEd2 As Decimal Private Sopt2 As Decimal Private umax2 As Decimal Private factor_f As Decimal Private kd2 As Decimal Private Ks2 As Decimal Private kLa2 As Decimal Private DO2 As Decimal Private mS2 As Decimal Private rS2 As Double = 0 '****************************************************Substrate 3 Variables Private sub3Conc As String = "" Private sub3umax As String Private sub3Kd As String Private sub3Ks As String Private sub3mS As String Private S0_3 As Decimal Private KI3 As Decimal Private KEd3 As Decimal Private Sopt3 As Decimal Private umax3 As Decimal Private kd3 As Decimal Private Ks3 As Decimal Private kLa3 As Decimal Private DO3 As Decimal Private mS3 As Decimal Private rS3 As Double = 0 '************************************************************************Substrate 4 Variables Private sub4Conc As String = "" Private sub4umax As String Private sub4Kd As String Private sub4Ks As String Private sub4mS As String Private S0_4 As Decimal Private umax4 As Decimal Private kd4 As Decimal Private Ks4 As Decimal Private kLa4 As Decimal Private DO4 As Decimal Private mS4 As Decimal Private rS4 As Double = 0 '************************************************************************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 = "" Private P0_1 As Decimal Private Yp1s As Decimal

Page 165: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

155

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 = "" Private P0_2 As Decimal Private Yp2s As Decimal Private KpI2 As Decimal Private Pm2 As Decimal Private n2 As Decimal Private alpha2 As Decimal Private kpg2 As Decimal Private kpng2 As Decimal Private mP2 As Decimal Private rP2 As Double = 0 '*****************************************Variables For calculation Private Rf As Double Private f_nonpref As Double '1 Private Xti As Double Private Sti As Double Private Pti As Double Private umaxCal As Double Private StiTemp As Double Private XtiTemp As Double Private PtiTemp As Double Private RepX As Double Private RepS As Double Private RepS2 As Double Private RepS3 As Double Private RepS4 As Double Private RepP As Double Private RepP2 As Double '2 Private minValue As Double Private umaxCal2 As Double Private Sti2 As Double Private StiTemp2 As Double Private Pti2 As Double Private PtiTemp2 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 Private RumaxCal_rX As Double Private RumaxCal_rX1 As Double Private RumaxCal_rX2 As Double Private RumaxCal_rP1 As Double Private RumaxCal_rP2 As Double Private RumaxCal_rS1 As Double Private RumaxCal_rS2 As Double Private RumaxCal_rS3 As Double Private RumaxCal_rS4 As Double Private Rpng_rS1 As Double Private Rpng_rS2 As Double Private Rpng_rS3 As Double Private Rpng_rS4 As Double

Page 166: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

156

Private Yps1 As Double Private Yps2 As Double Private Yps3 As Double Private Yps4 As Double '**********************************************************Graph Private numItm As Integer Private xTime As Double Private y1Sub1 As Double Private y1Sub2 As Double Private y1Sub3 As Double Private y1Sub4 As Double Private y2Biomass As Double Private y3Product1 As Double Private y3Product2 As Double Private y5umax As Double Private y5umax1 As Double Private y5umax2 As Double Private y6rS1 As Double Private y6rS2 As Double Private y6rS3 As Double Private y6rS4 As Double Private y7rX As Double Private y7rX1 As Double Private y7rX2 As Double Private y8rP1 As Double Private y8rP2 As Double #End Region #Region "Call ReadDataFile" #Region "ReadBioOperation File" Private Sub ReadBioOperation() 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

Page 167: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

157

Else D = CDec(DilutionRate) End If 'Biomass Conc If biomassConc = "" Then X0 = 0 Else X0 = CDec(biomassConc) End If 'Sub1 biomass yield If sub1BiomassYield = "" Then Yxs1 = 0.5 Else Yxs1 = CDec(sub1BiomassYield) 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 #Region "ReadSub1Data File" Private Sub ReadSub1Data() 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

Page 168: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

158

#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 #Region "ReadSub3Data File" Private Sub ReadSub3Data() '21 variables sub3Conc = MultipleSubData.Sub3ConcTextBox.Text sub3umax = MultipleSubData.Sub3umaxTextBox.Text sub3Kd = MultipleSubData.Sub3kdTextBox.Text sub3Ks = MultipleSubData.Sub3KsTextBox.Text sub3mS = MultipleSubData.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 #Region "ReadSub4Data File"

Page 169: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

159

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 #Region "ReadPro1Data File" Private Sub ReadPro1Data() 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 'pro1 Product Yield If pro1ProductYield = "" Then Yp1s = 1 Else Yp1s = CDec(pro1ProductYield) 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

Page 170: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

160

#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 'pro1 Product Yield If pro2ProductYield = "" Then Yp2s = 1 Else Yp2s = CDec(pro2ProductYield) 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 #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 End Sub #End Region #Region "Call ReplaceFeedStreamCal" Private Sub ReplaceFeedStreamCal()

Page 171: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

161

If BatchRadioButton.Checked = True Then RepX = 0 RepP = 0 RepP2 = 0 RepS = 0 RepS2 = 0 RepS3 = 0 RepS4 = 0 ElseIf CSTRRadioButton.Checked = True Then RepX = -XtiTemp * D * deltaT RepP = (P0_1 - PtiTemp) * D * deltaT RepP2 = (P0_2 - PtiTemp2) * D * deltaT RepS = (S0 - StiTemp) * D * deltaT RepS2 = (S0_2 - StiTemp2) * D * deltaT RepS3 = (S0_3 - StiTemp3) * D * deltaT RepS4 = (S0_4 - StiTemp4) * D * deltaT End If End Sub #End Region #Region "Call ReplaceumaxCalTerm" Private Sub ReplaceumaxCalTerm() Dim minValue As Double Dim num1 As Double Dim num2 As Double Dim num3 As Double Dim num4 As Double If (NumberSubstrateComboBox.Text = "2" AndAlso _ NumberProductComboBox.Text = "0" ) OrElse _ (NumberSubstrateComboBox.Text = "2" AndAlso _ NumberProductComboBox.Text = "1" ) OrElse _ (NumberSubstrateComboBox.Text = "2" AndAlso _ NumberProductComboBox.Text = "2" ) Then If CompSubComboBox.SelectedIndex = 0 Then 'Interactive Substrate Rf = StiTemp / (Ks1 + StiTemp) * StiTemp2 / (Ks2 + StiTemp2) RumaxCal = umax * Rf RumaxCal2 = 0 ElseIf CompSubComboBox.SelectedIndex = 1 Then 'Find min value num1 = StiTemp / (Ks1 + StiTemp) num2 = StiTemp2 / (Ks2 + StiTemp2) Dim arr(1) As Double arr(0) = num1 arr(1) = num2 Array.Sort(arr) minValue = arr(0) Rf = minValue 'NonInteractive Substrate RumaxCal = umax * Rf RumaxCal2 = 0 ElseIf CompSubComboBox.SelectedIndex = 2 Then 'Substitutable substrate RumaxCal = umax * StiTemp / (Ks1 + StiTemp) RumaxCal2 = factor_f * umax * StiTemp2 / (Ks2 + StiTemp2) * Ks1 / (Ks1 + StiTemp) End If End If '200, 210, 220 If (NumberSubstrateComboBox.Text = "3" AndAlso _ NumberProductComboBox.Text = "0" ) OrElse _ (NumberSubstrateComboBox.Text = "3" AndAlso _ NumberProductComboBox.Text = "1" ) OrElse _ (NumberSubstrateComboBox.Text = "3" AndAlso _ NumberProductComboBox.Text = "2" ) Then If CompSubComboBox.SelectedIndex = 0 Then 'Interactive Substrate Rf = StiTemp / (Ks1 + StiTemp) * StiTemp2 / (Ks2 + StiTemp2) * StiTemp3 / (Ks3 + StiTemp3) RumaxCal = umax * Rf RumaxCal2 = 0 ElseIf CompSubComboBox.SelectedIndex = 1 Then 'Find min value num1 = StiTemp / (Ks1 + StiTemp) num2 = StiTemp2 / (Ks2 + StiTemp2)

Page 172: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

162

num3 = StiTemp3 / (Ks3 + StiTemp3) Dim arr(2) As Double arr(0) = num1 arr(1) = num2 arr(2) = num3 Array.Sort(arr) minValue = arr(0) Rf = minValue 'Substitutable substrate RumaxCal = umax * Rf RumaxCal2 = 0 ElseIf CompSubComboBox.SelectedIndex = 2 Then Rf = 0 'Substitutable substrate RumaxCal = umax * StiTemp / (Ks1 + StiTemp) * StiTemp3 / (Ks3 + StiTemp3) RumaxCal2 = factor_f * umax * StiTemp2 / (Ks2 + StiTemp2) * (Ks1 / (Ks1 + StiTemp)) End If End If '300, 310, 320 If (NumberSubstrateComboBox.Text = "4" AndAlso _ NumberProductComboBox.Text = "0" ) OrElse _ (NumberSubstrateComboBox.Text = "4" AndAlso _ NumberProductComboBox.Text = "1" ) OrElse _ (NumberSubstrateComboBox.Text = "4" AndAlso _ NumberProductComboBox.Text = "2" ) Then 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 ElseIf CompSubComboBox.SelectedIndex = 1 Then 'Find min value num1 = StiTemp / (Ks1 + StiTemp) num2 = StiTemp2 / (Ks2 + StiTemp2) num3 = StiTemp3 / (Ks3 + StiTemp3) num4 = StiTemp4 / (Ks4 + StiTemp4) Dim arr(3) As Double arr(0) = num1 arr(1) = num2 arr(2) = num3 arr(3) = num4 Array.Sort(arr) minValue = arr(0) Rf = minValue 'NonInteractive Substrate RumaxCal = umax * Rf RumaxCal2 = 0 ElseIf CompSubComboBox.SelectedIndex = 2 Then 'Substitutable Substrate RumaxCal = umax * StiTemp / (Ks1 + StiTemp) * StiTemp3 / (Ks3 + StiTemp3) * StiTemp4 / (Ks4 + StiTemp4) RumaxCal2 = factor_f * umax * (StiTemp2 / (Ks2 + StiTemp2)) * (Ks1 / (Ks1 + StiTemp)) End If End If '400, 410, 420 End Sub #End Region #Region "Call FDtauCalculation" Private Sub FDtauCalculation() If VolumeTextBox.Text <> "" AndAlso FlowRateTextBox.Text <> "" Then D = F / V ElseIf DilutionRateTextBox.Text <> "" Then D = D ElseIf RetentionTimeTextBox.Text <> "" Then D = 1 / tau End If End Sub #End Region

Page 173: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

163

#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 If CSTRRadioButton.Checked = True Then 'Flow rate If FlowRateRadioButton.Checked = True Then 'Volume If VolumeTextBox.Text = "" Then VolumeTextBox.Focus() MessageBox.Show( "Reactor Volume 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 '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Substrate Data 'Sub1, Sub2 If NumberSubstrateComboBox.Text = "2" Then 'Data If MultipleSubData.BiomassConcTextBox.Text = "" OrElse _ MultipleSubData.Sub1ConcTextBox.Text = "" OrElse _ MultipleSubData.Sub1Yxs1TextBox.Text = "" OrElse _ MultipleSubData.Sub1umaxTextBox.Text = "" OrElse _ MultipleSubData.Sub1KsTextBox.Text = "" OrElse _ MultipleSubData.Sub2ConcTextBox.Text = "" OrElse _

Page 174: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

164

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 'Sub1Name cannot be empty If MultipleSubData.Sub1NameComboBox.Text = "" Then MessageBox.Show( "Name of substrate 1 is required." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Sub2Name cannot be empty If MultipleSubData.Sub2NameComboBox.Text = "" Then MessageBox.Show( "Name of substrate 2 is required." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Name of Sub1 and Sub2 cannot be the same If StrComp(MultipleSubData.Sub1NameToolStripLabel.Text, MultipleSubData.Sub2NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 2." & ControlChars.NewLine & _ "Please select again!" , _ "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 '2 Substrate 'Sub1, Sub2, Sub3 If NumberSubstrateComboBox.Text = "3" Then 'Data If MultipleSubData.BiomassConcTextBox.Text = "" OrElse _ MultipleSubData.Sub1ConcTextBox.Text = "" OrElse _ MultipleSubData.Sub1Yxs1TextBox.Text = "" OrElse _ MultipleSubData.Sub1umaxTextBox.Text = "" OrElse _ MultipleSubData.Sub1KsTextBox.Text = "" OrElse _ MultipleSubData.Sub2ConcTextBox.Text = "" OrElse _ MultipleSubData.Sub2Yxs2TextBox.Text = "" OrElse _ MultipleSubData.Sub2umaxTextBox.Text = "" OrElse _

Page 175: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

165

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 'Sub1Name cannot be empty If MultipleSubData.Sub1NameComboBox.Text = "" Then MessageBox.Show( "Name of substrate 1 is required." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Sub2Name cannot be empty If MultipleSubData.Sub2NameComboBox.Text = "" Then MessageBox.Show( "Name of substrate 2 is required." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Sub3Name cannot be empty If MultipleSubData.Sub3NameComboBox.Text = "" Then MessageBox.Show( "Name of substrate 3 is required." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Name of Sub1 and Sub2 cannot be the same If StrComp(MultipleSubData.Sub1NameToolStripLabel.Text, MultipleSubData.Sub2NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 2." & ControlChars.NewLine & _ "Please select again!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) MultipleSubData.ShowDialog() Call EnableCommandButton() '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub

Page 176: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

166

End If 'Name of Sub1 and Sub3 cannot be the same If StrComp(MultipleSubData.Sub1NameToolStripLabel.Text, MultipleSubData.Sub3NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 3." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Name of Sub2 and Sub3 cannot be the same If StrComp(MultipleSubData.Sub2NameToolStripLabel.Text, MultipleSubData.Sub3NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 2 and Substrate 3." & ControlChars.NewLine & _ "Please select again!" , _ "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 '3 Substrate 'Sub1, Sub2, Sub3, Sub4 If NumberSubstrateComboBox.Text = "4" Then 'Data If MultipleSubData.BiomassConcTextBox.Text = "" OrElse _ MultipleSubData.Sub1ConcTextBox.Text = "" OrElse _ MultipleSubData.Sub1Yxs1TextBox.Text = "" OrElse _ MultipleSubData.Sub1umaxTextBox.Text = "" OrElse _ MultipleSubData.Sub1KsTextBox.Text = "" OrElse _ MultipleSubData.Sub2ConcTextBox.Text = "" OrElse _ MultipleSubData.Sub2Yxs2TextBox.Text = "" OrElse _ MultipleSubData.Sub2umaxTextBox.Text = "" OrElse _ MultipleSubData.Sub2KsTextBox.Text = "" OrElse _ MultipleSubData.Sub2fFactorTextBox.Text = "" OrElse _ MultipleSubData.Sub3ConcTextBox.Text = "" OrElse _ MultipleSubData.Sub3Yxs3TextBox.Text = "" OrElse _ MultipleSubData.Sub3KsTextBox.Text = "" OrElse _ MultipleSubData.Sub4ConcTextBox.Text = "" OrElse _ MultipleSubData.Sub4Yxs4TextBox.Text = "" OrElse _ MultipleSubData.Sub4KsTextBox.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 'Sub1Name cannot be empty If MultipleSubData.Sub1NameComboBox.Text = "" Then MessageBox.Show( "Name of substrate 1 is required." & ControlChars.NewLine & _ "Please select again!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) MultipleSubData.ShowDialog() Call EnableCommandButton() '///Cancel Progress

Page 177: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

167

_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If 'Sub2Name cannot be empty If MultipleSubData.Sub2NameComboBox.Text = "" Then MessageBox.Show( "Name of substrate 2 is required." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Sub3Name cannot be empty If MultipleSubData.Sub3NameComboBox.Text = "" Then MessageBox.Show( "Name of substrate 3 is required." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Sub4Name cannot be empty If MultipleSubData.Sub4NameComboBox.Text = "" Then MessageBox.Show( "Name of substrate 4 is required." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Name of Sub1 and Sub2 cannot be the same If StrComp(MultipleSubData.Sub1NameToolStripLabel.Text, MultipleSubData.Sub2NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 2." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Name of Sub1 and Sub3 cannot be the same If StrComp(MultipleSubData.Sub1NameToolStripLabel.Text, MultipleSubData.Sub3NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 3." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Name of Sub1 and Sub4 cannot be the same If StrComp(MultipleSubData.Sub1NameToolStripLabel.Text, MultipleSubData.Sub4NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 4." & ControlChars.NewLine & _ "Please select again!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) MultipleSubData.ShowDialog() Call EnableCommandButton() '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False

Page 178: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

168

Exit Sub End If 'Name of Sub2 and Sub3 cannot be the same If StrComp(MultipleSubData.Sub2NameToolStripLabel.Text, MultipleSubData.Sub3NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 2 and Substrate 3." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Name of Sub2 and Sub4 cannot be the same If StrComp(MultipleSubData.Sub2NameToolStripLabel.Text, MultipleSubData.Sub4NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 2 and Substrate 4." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Name of Sub3 and Sub4 cannot be the same If StrComp(MultipleSubData.Sub3NameToolStripLabel.Text, MultipleSubData.Sub4NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 3 and Substrate 4." & ControlChars.NewLine & _ "Please select again!" , _ "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 '4 Substrate '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Product Data '1 Product If NumberProductComboBox.Text = "1" Then '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 ElseIf MultipleProData.Pro1TypeToolStripLabel.Text = "NonGrowth" Then If MultipleProData.Pro1KpngTextBox.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 ElseIf MultipleProData.Pro1TypeToolStripLabel.Text = "Mix" Then If MultipleProData.Pro1KpgTextBox.Text = "" OrElse _ MultipleProData.Pro1KpngTextBox.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

Page 179: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

169

Exit Sub End If End If 'Pro Type '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 'Pro1Name cannot be empty If MultipleProData.Pro1NameComboBox.Text = "" Then MessageBox.Show( "Name of Product 1 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 End If '1 Product '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 ElseIf MultipleProData.Pro1TypeToolStripLabel.Text = "NonGrowth" Then If MultipleProData.Pro1KpngTextBox.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 ElseIf MultipleProData.Pro1TypeToolStripLabel.Text = "Mix" Then If MultipleProData.Pro1KpgTextBox.Text = "" OrElse _ MultipleProData.Pro1KpngTextBox.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 End If 'Pro Type '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

Page 180: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

170

Exit Sub End If 'Pro1 Yield 'Pro1Name cannot be empty If MultipleProData.Pro1NameComboBox.Text = "" Then MessageBox.Show( "Name of Product 1 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 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 ElseIf MultipleProData.Pro2TypeToolStripLabel.Text = "NonGrowth" Then If MultipleProData.Pro2KpngTextBox.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 ElseIf MultipleProData.Pro2TypeToolStripLabel.Text = "Mix" Then If MultipleProData.Pro2KpgTextBox.Text = "" OrElse _ MultipleProData.Pro2KpngTextBox.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 End If 'Pro Type '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 'Ref sub cannot be the same If (MultipleProData.Pro1RefSubToolStripLabel.Text = "1" AndAlso _ MultipleProData.Pro2RefSubToolStripLabel.Text = "1" ) OrElse _ (MultipleProData.Pro1RefSubToolStripLabel.Text = "2" AndAlso _ MultipleProData.Pro2RefSubToolStripLabel.Text = "2" ) OrElse _ (MultipleProData.Pro1RefSubToolStripLabel.Text = "3" AndAlso _ MultipleProData.Pro2RefSubToolStripLabel.Text = "3" ) OrElse _ (MultipleProData.Pro1RefSubToolStripLabel.Text = "4" AndAlso _ MultipleProData.Pro2RefSubToolStripLabel.Text = "4" ) Then MessageBox.Show( "Cannot have the same reference substrate." & ControlChars.NewLine & _ "Please select again!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) MultipleProData.ShowDialog() Call EnableCommandButton() '///Cancel Progress

Page 181: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

171

_MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If 'Pro2Name cannot be empty If MultipleProData.Pro2NameComboBox.Text = "" Then MessageBox.Show( "Name of Product 2 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 'Pro1 and Pro2 cannot have the same name If StrComp(MultipleProData.Pro1NameToolStripLabel.Text, MultipleProData.Pro2NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Product 1 and Product 2." & ControlChars.NewLine & _ "Please select again!" , _ "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 End If '2 Product '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

Page 182: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

172

APPENDIX H

VB CODE FOR INHIBITION MODEL

#Region "Load event" Private Sub _Parent_Load( ByVal sender As Object , ByVal e As System.EventArgs) _ Handles Me.Load Me.AutoScroll = False '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 ElseIf NumberSubstrateToolStripLabel.Text <> "" AndAlso _ NumberProductToolStripLabel.Text <> "" AndAlso _ NumberToxicToolStripLabel.Text <> "" Then 'For Open File 'Substrate NumberSubstrateComboBox.Items.Clear() NumberSubstrateComboBox.Items.Add( "1" ) NumberSubstrateComboBox.Items.Add( "2" ) NumberSubstrateComboBox.Items.Add( "3" ) NumberSubstrateComboBox.Items.Add( "4" ) NumberSubstrateComboBox.Text = NumberSubstrateToolStripLabel.Text '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 ElseIf CompSubLabel.Text = "Competitive" Then 'CompSubComboBox.Enabled = True CompSubComboBox.SelectedIndex = 1 ElseIf CompSubLabel.Text = "Non-Competitive" Then

Page 183: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

173

'CompSubComboBox.Enabled = True CompSubComboBox.SelectedIndex = 2 End If 'Enable Call ClickClickClick() 'Show GroupBox Call ShowGroupBox() End Sub #End Region

#Region "Call ShowPictureBox" Private Sub ShowPictureBox() 'Batch If BatchRadioButton.Checked = True Then BatchPicturePanel.Show() CSTRPicturePanel.Hide() 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 'Enable Calculate, Graph, Table BackToolStripButton.Enabled = False CalculateToolStripButton.Enabled = True GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If If GraphGroupBox.Visible = True OrElse _ TableGroupBox.Visible = True Then 'Enable Return, Graph, Table BackToolStripButton.Enabled = True CalculateToolStripButton.Enabled = False GraphToolStripButton.Enabled = True TableToolStripButton.Enabled = True End If End Sub #End Region #Region "Call ClearResultComboBox" Private Sub ClearComboBox() 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()

Page 184: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

174

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

#Region "Declare variables" '**************************************Operation Parameters Private SimulationTime As String = "" Private TimeInterval As String = "" Private RecycleRatio As String = "" Private ConcFactor 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 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 Private sub1InhibitionType As String = "" Private sub1EdwardConst As String

Page 185: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

175

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 KI1 As Double Private KEd1 As Double Private Sopt1 As Double Private rS As Double = 0 '****************************************Substrate 2 Variables Private sub2Conc As String = "" Private sub2PreferSub As String Private sub2InhibitionConst As String Private sub2umax As String Private sub2Kd As String Private sub2Ks As String Private sub2mS As String Private sub2InhibitionType As String = "" Private sub2EdwardConst As String Private sub2OptSubstrate As String Private sub2ComplementaryType As String = "" Private S0_2 As Decimal Private kd2 As Decimal Private Ks2 As Decimal Private mS2 As Decimal Private KI2 As Decimal Private KEd2 As Decimal Private Sopt2 As Decimal Private rS2 As Double = 0 '**********************************************Substrate 3 Variables Private sub3Conc As String = "" Private sub3Kd As String Private sub3Ks As String Private sub3mS As String Private S0_3 As Decimal Private kd3 As Decimal Private Ks3 As Decimal Private mS3 As Decimal Private rS3 As Double = 0 '*******************************************Substrate 4 Variables Private sub4Conc As String = "" Private sub4Kd As String Private sub4Ks As String Private sub4mS As String Private S0_4 As Decimal Private kd4 As Decimal Private Ks4 As Decimal Private mS4 As Decimal Private rS4 As Double = 0 '**************************************Product 1 Variables Private pro1Conc As String = "" Private pro1ProductYield As String = "" Private pro1InhibitionConst As String Private pro1Kpg As String Private pro1Kpng As String Private pro1mP As String Private pro1Pm As String Private pro1n As String Private pro1alpha As String Private pro1RefSubstrate As String = "" Private pro1InhibitionType As String = "" Private P0_1 As Double Private Yp1s As Double Private kpg1 As Double Private kpng1 As Double Private mP1 As Double Private KpI1 As Double Private Pm1 As Double Private n1 As Double

Page 186: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

176

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 = "" Private P0_2 As Decimal Private Yp2s As Decimal Private kpg2 As Decimal Private kpng2 As Decimal Private mP2 As Decimal Private rP2 As Double = 0 '****************************************************Toxic Variables 'Toxic 1 Private toxic1Conc As String Private toxic1RefSub As String Private toxic1KxI As String Private toxic1InhibitionType As String Private Xe1 As Decimal Private XetiTemp As Decimal Private KxI1 As Decimal 'Toxic 2 Private toxic2Conc As String Private toxic2RefSub As String Private toxic2KxI As String Private toxic2InhibitionType As String Private Xe2 As Decimal Private XetiTemp2 As Decimal Private KxI2 As Decimal '********************************************************Variables For calculation Private RepX As Double Private RepS As Double Private RepS2 As Double Private RepS3 As Double Private RepS4 As Double Private RepP As Double Private RepP2 As Double Private Rf As Double Private Rpng As Double Private Rpng2 As Double Private Rpng3 As Double Private Rpng4 As Double Private RumaxCal As Double Private RumaxCal2 As Double '1 Private Xti As Double Private Sti As Double Private Pti As Double Private umaxCal As Double Private StiTemp As Double Private XtiTemp As Double Private PtiTemp As Double '2 Private Sti2 As Double Private StiTemp2 As Double Private Pti2 As Double Private PtiTemp2 As Double '3 Private Sti3 As Double Private StiTemp3 As Double '4 Private Sti4 As Double Private StiTemp4 As Double Private Rf_S1 As Double Private Rf_S2 As Double Private Rf_S3 As Double Private Rf_S4 As Double

Page 187: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

177

Private Rf_P1 As Double Private Rf_P2 As Double Private Rf_Xe1 As Double Private Rf_Xe2 As Double Private Rpng_rS1 As Double Private Rpng_rS2 As Double Private Rpng_rS3 As Double Private Rpng_rS4 As Double Private Yps1 As Double Private Yps2 As Double Private Yps3 As Double Private Yps4 As Double '**********************************************************Graph Private numItm As Integer Private xTime As Double Private y1Sub1 As Double Private y1Sub2 As Double Private y1Sub3 As Double Private y1Sub4 As Double Private y2Biomass As Double Private y3Product1 As Double Private y3Product2 As Double Private y4Toxic1 As Double Private y4Toxic2 As Double Private y5umax As Double Private y6rS1 As Double Private y6rS2 As Double Private y6rS3 As Double Private y6rS4 As Double Private y7rX1 As Double Private y7rD As Double Private y8rP1 As Double Private y8rP2 As Double #End Region #Region "Call ReadDataFile" #Region "ReadBioOperation File" Private Sub ReadBioOperation() 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

Page 188: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

178

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 'Sub1 biomass yield If sub1BiomassYield = "" Then Yxs1 = 0.5 Else Yxs1 = CDec(sub1BiomassYield) 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 #Region "ReadSub1Data File" Private Sub ReadSub1Data() 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

Page 189: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

179

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 #Region "ReadSub2Data File" Private Sub ReadSub2Data() '21 variables sub2Conc = InhibitionSubData.Sub2ConcTextBox.Text sub2umax = InhibitionSubData.Sub2umaxTextBox.Text sub2Kd = InhibitionSubData.Sub2kdTextBox.Text sub2Ks = InhibitionSubData.Sub2KsTextBox.Text sub2mS = InhibitionSubData.Sub2mSTextBox.Text 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

Page 190: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

180

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 #Region "ReadSub3Data File" Private Sub ReadSub3Data() 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 #Region "ReadSub4Data File" Private Sub ReadSub4Data() sub4Conc = InhibitionSubData.Sub4ConcTextBox.Text sub4Kd = InhibitionSubData.Sub4kdTextBox.Text sub4Ks = InhibitionSubData.Sub4KsTextBox.Text sub4mS = InhibitionSubData.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

Page 191: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

181

mS4 = 0 Else mS4 = CDec(sub4mS) End If End Sub #End Region #Region "ReadPro1Data File" Private Sub ReadBioPro1Data() 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 'pro1 Product Yield If pro1ProductYield = "" Then Yp1s = 0 Else Yp1s = CDec(pro1ProductYield) 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 #Region "ReadPro2Data File"

Page 192: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

182

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 'pro1 Product Yield If pro2ProductYield = "" Then Yp2s = 1 Else Yp2s = CDec(pro2ProductYield) 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 #Region "ReadToxicData File" Private Sub ReadToxicFile() 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

Page 193: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

183

#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 #Region "Call ReplaceFeedStreamCal" Private Sub ReplaceFeedStreamCal() If BatchRadioButton.Checked = True Then RepX = 0 RepP = 0 RepP2 = 0 RepS = 0 RepS2 = 0 RepS3 = 0 RepS4 = 0 ElseIf CSTRRadioButton.Checked = True Then RepX = -XtiTemp * D * deltaT RepP = (P0_1 - PtiTemp) * D * deltaT RepP2 = (P0_2 - PtiTemp2) * D * deltaT RepS = (S0 - StiTemp) * D * deltaT RepS2 = (S0_2 - StiTemp2) * D * deltaT RepS3 = (S0_3 - StiTemp3) * D * deltaT RepS4 = (S0_4 - StiTemp4) * D * deltaT End If End Sub #End Region #Region "Call ReplaceumaxCalTerm" Private Sub ReplaceumaxCalTerm() Dim minValue As Double Dim num1 As Double Dim num2 As Double Dim num3 As Double Dim num4 As Double If CompSubComboBox.SelectedIndex = 0 Then Rf = Rf_S1 * Rf_P1 * Rf_Xe1 * Rf_Xe2 ElseIf CompSubComboBox.SelectedIndex = 1 Then Rf = Rf_S1 * Rf_S2 * Rf_S3 * Rf_S4 * Rf_P1 * Rf_Xe1 * Rf_Xe2 ElseIf CompSubComboBox.SelectedIndex = 2 Then If (Sub2InhibitionTypeLabel.Text = "" OrElse _ Sub2InhibitionTypeLabel.Text = "None" ) AndAlso _ (Sub1InhibitionTypeLabel.Text = "Comp" OrElse _ Sub1InhibitionTypeLabel.Text = "NonComp" OrElse _ Sub1InhibitionTypeLabel.Text = "Andrew" OrElse _ Sub1InhibitionTypeLabel.Text = "Edward" OrElse _ Sub1InhibitionTypeLabel.Text = "Steele" ) Then 'Only S1 is inhibitory, find minValue of S2, S3, S4 num2 = StiTemp2 / (Ks2 + StiTemp2) num3 = StiTemp3 / (Ks3 + StiTemp3) num4 = StiTemp4 / (Ks4 + StiTemp4) Dim arr(2) As Double arr(0) = num2 arr(1) = num3 arr(2) = num4 Array.Sort(arr) minValue = arr(0) Rf = Rf_S1 * minValue * Rf_P1 * Rf_Xe1 * Rf_Xe2

Page 194: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

184

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) Dim arr(2) As Double arr(0) = num1 arr(1) = num3 arr(2) = num4 Array.Sort(arr) minValue = arr(0) Rf = Rf_S2 * minValue * Rf_P1 * Rf_Xe1 * Rf_Xe2 ElseIf (Sub1InhibitionTypeLabel.Text = "Comp" OrElse _ Sub1InhibitionTypeLabel.Text = "NonComp" OrElse _ Sub1InhibitionTypeLabel.Text = "Andrew" OrElse _ Sub1InhibitionTypeLabel.Text = "Edward" OrElse _ Sub1InhibitionTypeLabel.Text = "Steele" ) AndAlso _ (Sub2InhibitionTypeLabel.Text = "Comp" OrElse _ Sub2InhibitionTypeLabel.Text = "NonComp" OrElse _ Sub2InhibitionTypeLabel.Text = "Andrew" OrElse _ Sub2InhibitionTypeLabel.Text = "Edward" OrElse _ Sub2InhibitionTypeLabel.Text = "Steele" ) Then 'Both S1, S2 are inhibitory, find minValue of S3, S4 num3 = StiTemp3 / (Ks3 + StiTemp3) num4 = StiTemp4 / (Ks4 + StiTemp4) Dim arr(1) As Double arr(0) = num3 arr(1) = num4 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 #Region "Call FDtauCalculation" Private Sub FDtauCalculation() If VolumeTextBox.Text <> "" AndAlso FlowRateTextBox.Text <> "" Then D = F / V ElseIf DilutionRateTextBox.Text <> "" Then D = D ElseIf RetentionTimeTextBox.Text <> "" Then D = 1 / tau End If End Sub #End Region

#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 'MessageBox for Multiple Substrate If (NumberSubstrateComboBox.Text = "2" OrElse _ NumberSubstrateComboBox.Text = "3" OrElse _ NumberSubstrateComboBox.Text = "4" ) AndAlso _ CompSubComboBox.SelectedIndex = 0 Then MessageBox.Show( "Cannot have Monod's Model for Multiple Substrate" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub ElseIf NumberSubstrateComboBox.Text = "1" AndAlso _ (CompSubComboBox.SelectedIndex = 1 OrElse _ CompSubComboBox.SelectedIndex = 2) Then MessageBox.Show( "Cannot have Complementary Substrate Model for Single Substrate" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information)

Page 195: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

185

'///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If ''Check if there's suffificent 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 If CSTRRadioButton.Checked = True Then 'Flow rate If FlowRateRadioButton.Checked = True Then 'Volume If VolumeTextBox.Text = "" Then VolumeTextBox.Focus() MessageBox.Show( "Reactor Volume 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 '\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Substrate Data '1 Sub If NumberSubstrateComboBox.Text = "1" Then 'Data If InhibitionSubData.BiomassConcTextBox.Text = "" OrElse _ InhibitionSubData.Sub1ConcTextBox.Text = "" OrElse _ InhibitionSubData.Sub1Yxs1TextBox.Text = "" OrElse _ InhibitionSubData.Sub1umaxTextBox.Text = "" OrElse _ InhibitionSubData.Sub1KsTextBox.Text = "" Then

Page 196: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

186

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 'Sub1Name cannot be empty If InhibitionSubData.Sub1NameComboBox.Text = "" Then MessageBox.Show( "Name of Substrate 1 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 End If '1 Sub '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 'Sub1Name cannot be empty If InhibitionSubData.Sub1NameComboBox.Text = "" Then MessageBox.Show( "Name of Substrate 1 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 'Sub2Name cannot be empty If InhibitionSubData.Sub2NameComboBox.Text = "" Then MessageBox.Show( "Name of Substrate 2 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 'Name of Sub1 and Sub2 cannot be the same If StrComp(InhibitionSubData.Sub1NameToolStripLabel.Text, InhibitionSubData.Sub2NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 2." & 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

Page 197: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

187

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 'Sub1Name cannot be empty If InhibitionSubData.Sub1NameComboBox.Text = "" Then MessageBox.Show( "Name of Substrate 1 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 'Sub2Name cannot be empty If InhibitionSubData.Sub2NameComboBox.Text = "" Then MessageBox.Show( "Name of Substrate 2 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 'Sub3Name cannot be empty If InhibitionSubData.Sub3NameComboBox.Text = "" Then MessageBox.Show( "Name of Substrate 3 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 'Name of Sub1 and Sub2 cannot be the same If StrComp(InhibitionSubData.Sub1NameToolStripLabel.Text, InhibitionSubData.Sub2NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 2." & 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 'Name of Sub1 and Sub3 cannot be the same If StrComp(InhibitionSubData.Sub1NameToolStripLabel.Text, InhibitionSubData.Sub3NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 3." & ControlChars.NewLine & _ "Please select again!" , _ "Message" , _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) InhibitionSubData.ShowDialog()

Page 198: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

188

Call EnableCommandButton() '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If 'Name of Sub2 and Sub3 cannot be the same If StrComp(InhibitionSubData.Sub2NameToolStripLabel.Text, InhibitionSubData.Sub3NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 2 and Substrate 3." & 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 '3 Sub '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 'Sub1Name cannot be empty If InhibitionSubData.Sub1NameComboBox.Text = "" Then MessageBox.Show( "Name of Substrate 1 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 'Sub2Name cannot be empty If InhibitionSubData.Sub2NameComboBox.Text = "" Then MessageBox.Show( "Name of Substrate 2 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 'Sub3Name cannot be empty If InhibitionSubData.Sub3NameComboBox.Text = "" Then MessageBox.Show( "Name of Substrate 3 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

Page 199: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

189

'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 'Name of Sub1 and Sub2 cannot be the same If StrComp(InhibitionSubData.Sub1NameToolStripLabel.Text, InhibitionSubData.Sub2NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 2." & 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 'Name of Sub1 and Sub3 cannot be the same If StrComp(InhibitionSubData.Sub1NameToolStripLabel.Text, InhibitionSubData.Sub3NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 and Substrate 3." & 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 'Name of Sub1 and Sub4 cannot be the same If StrComp(InhibitionSubData.Sub1NameToolStripLabel.Text, InhibitionSubData.Sub4NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 1 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 'Name of Sub2 and Sub3 cannot be the same If StrComp(InhibitionSubData.Sub2NameToolStripLabel.Text, InhibitionSubData.Sub3NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 2 and Substrate 3." & 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 'Name of Sub2 and Sub4 cannot be the same If StrComp(InhibitionSubData.Sub2NameToolStripLabel.Text, InhibitionSubData.Sub4NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Substrate 2 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 'Name of Sub3 and Sub4 cannot be the same If StrComp(InhibitionSubData.Sub3NameToolStripLabel.Text, InhibitionSubData.Sub4NameToolStripLabel.Text) = 0 Then

Page 200: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

190

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 Data If NumberProductComboBox.Text = "1" Then 'Data 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 ElseIf InhibitionProData.Pro1TypeToolStripLabel.Text = "NonGrowth" Then If InhibitionProData.Pro1KpngTextBox.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 ElseIf InhibitionProData.Pro1TypeToolStripLabel.Text = "Mix" Then If InhibitionProData.Pro1KpgTextBox.Text = "" OrElse _ InhibitionProData.Pro1KpngTextBox.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 End If 'Pro Type '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 'Pro1Name cannot be empty If InhibitionProData.Pro1NameComboBox.Text = "" Then MessageBox.Show( "Name of Product 1 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 End If '1 Product '2 Product If NumberProductComboBox.Text = "2" Then '\\\\\\\\\\\\\\\\\\\\\ Product 1

Page 201: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

191

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 ElseIf InhibitionProData.Pro1TypeToolStripLabel.Text = "NonGrowth" Then If InhibitionProData.Pro1KpngTextBox.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 ElseIf InhibitionProData.Pro1TypeToolStripLabel.Text = "Mix" Then If InhibitionProData.Pro1KpgTextBox.Text = "" OrElse _ InhibitionProData.Pro1KpngTextBox.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 End If 'Pro Type '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 'Pro1Name cannot be empty If InhibitionProData.Pro1NameComboBox.Text = "" Then MessageBox.Show( "Name of Product 1 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 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 ElseIf InhibitionProData.Pro2TypeToolStripLabel.Text = "NonGrowth" Then If InhibitionProData.Pro2KpngTextBox.Text = "" Then MessageBox.Show( "Data is required!" , _ "Message" , _ MessageBoxButtons.OK, _

Page 202: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

192

MessageBoxIcon.Information) InhibitionProData.ShowDialog() Call EnableCommandButton() '///Cancel Progress _MainForm.ToolstripprogressBar.Value = _MainForm.ToolstripprogressBar.Minimum _MainForm.ProgressTimer.Enabled = False Exit Sub End If ElseIf InhibitionProData.Pro2TypeToolStripLabel.Text = "Mix" Then If InhibitionProData.Pro2KpgTextBox.Text = "" OrElse _ InhibitionProData.Pro2KpngTextBox.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 End If 'Pro Type '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 'Pro2Name cannot be empty If InhibitionProData.Pro2NameComboBox.Text = "" Then MessageBox.Show( "Name of Product 2 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 and Pro2 cannot have the same name If StrComp(InhibitionProData.Pro1NameToolStripLabel.Text, InhibitionProData.Pro2NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Product 1 and Product 2." & ControlChars.NewLine & _ "Please select again!" , _ "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 Name 'Ref Sub cannot be the same If (InhibitionProData.Pro1RefSubToolStripLabel.Text = "1" AndAlso _ InhibitionProData.Pro2RefSubToolStripLabel.Text = "1" ) OrElse _ (InhibitionProData.Pro1RefSubToolStripLabel.Text = "2" AndAlso _ InhibitionProData.Pro2RefSubToolStripLabel.Text = "2" ) OrElse _ (InhibitionProData.Pro1RefSubToolStripLabel.Text = "3" AndAlso _ InhibitionProData.Pro2RefSubToolStripLabel.Text = "3" ) OrElse _ (InhibitionProData.Pro1RefSubToolStripLabel.Text = "4" AndAlso _ InhibitionProData.Pro2RefSubToolStripLabel.Text = "4" ) Then MessageBox.Show( "Cannot have the same reference substrate." & ControlChars.NewLine & _ "Please select again!" , _ "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 'Ref sub End If '2 Product '\\\\\\\\\\\\\\\\\\\\\\ Toxic Data '1 Xeno Comp If NumberToxicComboBox.Text = "1" Then

Page 203: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

193

'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 'Toxic1Name cannot be empty If InhibitionToxicData.Xeno1NameComboBox.Text = "" Then MessageBox.Show( "Name of Xeno Compound 1 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 End If '1 Xeno Comp '2 Xeno Comp If NumberToxicComboBox.Text = "2" Then If InhibitionToxicData.Toxic1ConcTextBox.Text = "" OrElse _ InhibitionToxicData.Toxic1KITextBox.Text = "" OrElse _ InhibitionToxicData.Toxic2ConcTextBox.Text = "" OrElse _ InhibitionToxicData.Toxic2KITextBox.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 'Xeno1Name cannot be empty If InhibitionToxicData.Xeno1NameComboBox.Text = "" Then MessageBox.Show( "Name of Xeno Compound 1 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 'Xeno2Name cannot be empty If InhibitionToxicData.Xeno2NameComboBox.Text = "" Then MessageBox.Show( "Name of Xeno Compound 2 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 'Xeno1 and Xeno2 cannot have the same name If StrComp(InhibitionToxicData.Xeno1NameToolStripLabel.Text, InhibitionToxicData.Xeno2NameToolStripLabel.Text) = 0 Then MessageBox.Show( "Cannot have the same name for Xeno Compound 1 and Xeno compound 2." & 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 'Xeno Name 'Ref sub cannot be the same If (InhibitionToxicData.Xeno1RefSubToolStripLabel.Text = "1" AndAlso _ InhibitionToxicData.Xeno2RefSubToolStripLabel.Text = "1" ) OrElse _

Page 204: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

194

(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

Page 205: BioMASS v2.0: A NEW TOOL FOR BIOPROCESS SIMULATION

195

REFERENCES

Birol, G., Undey, C., Cinar, A., A modular simulation package for fed-batch fermentation:

penicillin production, Computers and Chemical Engineering, 2002.

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

monosodium glutamate (MSG) process, Journal of Food Engineering, 2004.

Krishnan, M. S., Fermentation kinetics of ethanol production from glucose and xylose by

Recombinant Saccharomyces 1400 (pLNH33), Applied Biochemistry and Biotechnology, 1999.

Nemeth, A., Sevella, B., Development of a new bioprocess for production of 1,3 – propandiol I.:

Modeling of Glycerol bioconversion to 1,3 – propanediol with Klebsiella pneumoniae enzymes,

Appl Biochem Biotechnol, 2008.

Rizzo, D. M., The comparison of four dynamic systems-based software packages: Translation

and sensitivity analysis, Environmental Modeling and Software, 2006.

Pfeifer, M. J., Effect of culture conditions on Xylitol production by Candida guilliermondii FTI

20037, Appl Biochem Biotechnol, 1996.

Shanklin, T., Selection of bioprocess simulation software for industrial applications, Biotechnol

Bioeng, 2000.

Shi, J., Functional Food Ingredients and Nutraceuticals: Processing Technologies (Functional

Foods and Nutraceuticals), 2006.

Yu, X., Biohydrogen production by the hyperthermophilic bacterium Thermotoga Neapolitana,

2007.