development of a bayesian belief network for anaerobic ... · development of a bayesian belief...

168
Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in conformity with the requirements for the degree of Master of Applied Science Graduate Department of Civil Engineering University of Toronto Clcopyright by Brbn S. G. E. Sahely, 2000

Upload: nguyenthien

Post on 16-Apr-2018

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Development of a Bayesian Belief Network for

Anaerobic Wastewater Treatment

Bnan S.G.E. Sahely

A thesis subrnitted in conformity with the requirements for the degree of Master of Applied Science Graduate Department of Civil Engineering

University of Toronto

Clcopyright by Brbn S. G. E. Sahely, 2000

Page 2: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

National Library I*l of Canada Bibliothéque nationale du Canada

Acquisitions and Acquisitions et Bibliographie Senices services bibliographiques 395 Wellington StrW 395, nre Wellington ûlîawaON K 1 A W OcrawaON K1AON4 CanaQ Canada

The author has granted a non- L'auteur a accordé une licence non exclusive Licence ailowing the exclusive permettant a la National Library of Canada to Bibliothèque nationale du Canada de reproduce, loan, distribute or sell reproduire, prêter, distribuer ou copies of this thesis in microform, vendre des copies de cette thèse sous paper or electronic formats. la forme de microfiche/film, de

reproduction sur papier ou sur format électronique.

The author retains ownership of the L'auteur conserve la propriété du copyright in this thesis. Neither the droit d'auteur qui protège cette thèse. thesis nor substantial extracts h m it Ni la thèse ni des extraits substantiels may be printed or othenivise de celle-ci ne doivent être imprimés reproduced without the author's ou autrement reproduits sans son permission. autorisation.

Page 3: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

"Development of a Bayaian Belief Network for

Anaerobic Wastewater Treatment"

Brian S. G. E. Sahely

Master of Applied Science, 2000 Graduate Department of Civil Engineering

University of Toronto

ABSTRACT

A Bayesian belief network (BBN) was developed to determine the most probable

causes of failure for an anaerobic sequencing batch reactor (ANSBR) attempting to

achieve a COD removal eficiency andor a methane production rate greater than 85 %

and 12 L/d, respectively. The BBN could also be used in prognosis mode to increase

operational efficiency and to design experiments. This expert system would rninimize

the technical expertise required during the operation of an anaerobic treatment system

with its extremely compiex microbiological community.

The Bayesian belief network consisted of nodes representing variables, and arrows

representing cause-effect relationships between the variables. The conditional

probabilities were calculated using an ANSBR mode1 developed previously at the

University of Toronto. By comparing the probabilities of the States before and after the

introduction of evidence (using Bayes' Theorem), the most likely causes andor effects

could be detennined, with the best suggestions for system adjustments.

Page 4: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

ACKNOWLEDGEMENTS

1 wish to thank GOD for HIS guidance throughout my research. 1 thank my direct

supervisor, Dr. David M. Bagley, for his expertise and suggestions towards the

development of my thesis. 1 also thank him for being patient throughout Our long

meetings and being able to meet on very short notice. 1 thank my second reader

Dr. Brenda McCabe for offering her expertise on Bayesian belief networks.

1 must thank both supervisors' graduate students for theu assistance whenever it was

required. A special thanks to Yale and Mike for their assistance with the ANSBR model,

and to Hrodny for her assistance with creating a Visual Basic application of the belief

network in prognosis mode. A special thanks to Vernon Walling for his assistance with

C prograrnming concepts, and to Dr. C. Kennedy for his assistance with some Statistical

concepts. including Monte Carlo Simulation.

1 wish to thank my family Solomon, Nahia, Bichara and Leah Sahely for their support

and guidance throughout my research.

1 would also like to thank al1 my fnends who accompanied me on the intemet into the

"wee hours" of the moming while 1 was doing my research. A special thanks to my

fnend and won to be sister-in-law, Halla Rahme, who constantly echoed the words "Go

Bnan Go!", everyday on ICQ.

Finally, 1 would like to acknowledge the scholarship provided by the University of

Toronto during this research.

iii

Page 5: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

TABLE OF CONTENTS

ACKNO WLEDGMENTS

TABLE OF CONTENTS

LIST OF TABLES

LIST OF FIGURES

LIST OF SYMBOLS AND ABBREVIATIONS

L . INTRODUCTION

2. LITERATURE REVIEW 2.1 Anaerobic Wastewater Treatrnent

2.1.1 Anaerobic Seguencing Batch Reactor ( ANSBR) 2.1.2 ANSBR Model

2.2 Bayesian Belief Networks (BBNs) 2.2.1 StnictureofBBNs 2.2.2 Conditional lndependence 2.2.3 Bayes' Theorem 2.2.4 Example of BBN 2.2.5 Limitations of BBNs

2.3 Software for Ba esian Analysis 2.3.1 HUGMX 2.3.2 Microsofl O Belief Network (MSBN~")

3. DEVELOPMENT OF THE BAYESIAN BELIEF NETWORK Anaerobic Wastewater Treatment Technology Variables Relationships Structure of the Bayesian Belief Network States of the Variables Probabilities 3 -6.1 Total Number of Probabilities 3 5 . 2 Conditional Probabilities 3.6.3 Prior Probabilities Equilibrium State with no Evidence introduced into the Network Program Developed for Prognosis of BBN Future Expansion of the BBN 3.9. i Variables and Relationships

Page . . 11

. . . 111

i v

vi

vi i

viii

1

4 4 4 9 9 9 13 14 14 17 19 19 2 1

22

Page 6: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

TABLE OF CONTENTS CONT'D

3.9.2 States of the Variables 3.9.3 Probabilities

4. TESTING THE ROBUSTNESS OF THE BAYESIAN BELEF NETWORK 73 4.1 Overview of Evaluation Process 73 4.2 Predictive Toot 73 4.3 Diagnostic Tool 79

4.3.1 Analysis Criteria for Diagnosing Upsets 79 4.3.2 Diagnosing Upsets in the ANSBR 79

4.4 Application of the BBN 92 4.5 PriorProbabilities 102

5. DISCUSSION 1 O8

6. CONCLUSIONS 112

7. RECOMMENDATIONS 113

8. REFERENCES 115

APPENDICES 118

Appendix A Appendix B Appendix C

Appendix D Appendix E Appendix F Appendix G Appendix H

Probability Calculations Input Files of the ANSBR Model Description of the Input and Output Files for the Probability Programs Structural Layout of Probability Programs Program Developed for Prognosis of BBN Gas Flow Rate Calculations Simulation Conditions More Diagnostic Results of the BBN

Page 7: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

LIST OF TABLES

Probabilities for the network in Figure 2.2 Beliefs of three different equilibrium States

Reactor conditions at startup and stability 28 Operating Conditions of a Stable Reactor 29 Varying Alkalinity while keeping other parameters in Table 3.2 constant 3 1 Varying COD influent while keeping other parameters in Table 3.2 constant 34 Varying twic while keeping other parameters in Table 3.2 constant 36 Varying FIC time while keeping other parameters in Table 3.2 constant 3 8 Varying V& while keeping other parameters in Table 3.2 constant 4 1 Percentage distribution of MLVSS used for simulations 4 1 Varying MLVSS while keeping other parameters in Table 3.2 constant 43 Varying pH while keeping other parameters in Table 3.2 constant 45 States of the variables 48 Total number OP probabilit ies required for the BBN 54 Conditional Probabil ities 56 Stable simulator reactor conditions for which the conditional probabilities were calculated Prior Probabilities Variables in the network in Figure 3.15

Selected Prognosis Results of t he BBN Sclected Diagnostic Results of the BBN Simulation results of an ANSBR Summary of Diagnostic Results in Table 4.2 Changing Prior Probabilities in the BBN

Input files of the ANSBR model Input parameters as a function of tqci,, FIC time and Vfl, Description of NPUT and OUTPUT files in Figure 3.13 Description of INPUT and OUTPUT files in Figure C 1 Input files for Batch 1 Input files for Batch 2 Selected parameters to be entered into ANSBR model to produce Table 4.3 154 More Diagnostic Results of the BBN 157 Summary of Diagnostic Results in Table H. 1 158

Page 8: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

LIST OF FIGURES

Page

Stages in an Anaerobic Sequencing Batch Reactor Segment of a belief network for an .4NSBR Three types of connections in Bayesian networks Example of cyclic network for anaerobic wastewater treatment Creating the network in Figure 2.2 using HUGM LITE 5.3 Creating the network in Figure 2.2 using MSBN 1 .O0 1

Plot of COD removal efficiency vs. time for 9 cycles of a aartup reactor Plots of parameters vs. Alkalinity Plot of pH vs. Alkalinity at different cycles Plots of parameters vs. COD influent Plots of parameters vs. twci, Plots of parameters vs. F;C time Plot of pH vs. F/C time at 10 cycles and Alkalinity at 1000 mg/L Plots of parameters vs. Vfl, Plots of parameters vs. MLVSS Plots of parameters vs. pH Bayesian Belief Network for Anaerobic Sequencing Batch Reactor Two subsets of Bayesian belief network in Figure 3.1 1 Programs used for calculating the conditional probabilities in the BBN Probabilities at Equilibrium State with no Evidence introduced into the BBN Expanded Bayesian Belief Network for Anaerobic Sequencing Batch Reactor

Flow Chart for diagnosing the most probable cause(s) of upsets

Single program used for calculating the conditional probabilities in the BBN

vii

Page 9: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

LIST OF SYMBOLS AND ABBREVIATIONS

SymboV Abbreviation

Apolymer Al k. ANN ANSBR Batch 1

Batch 2

BBN Cpoly mer C h rate CO2 COD COD infl. COD effic. csm DAG F/C time Gasflo wrat e H2

MLVSS

ncyrlc

Org. load Q, Qr I C H 4 RBES seff s f SRT Stension Temp.

Definition

water absorbing polymers alkalinity added to wastewater entering a reactor artificial neural network anaerobic sequencing batch reactor set of variables grouped together: child variable being pH, and parent variables being Alk., COD infl., tqci,, F/C time and Vr/V,. set of variables grouped together: children variables being COD eflic. and C h rate, and parent variables being COD infl., t,,,, V&, MLVSS, and pH. Bayesian belief network cationic polymer methane production rate carbon dioxide chemical oxygen demand influent COD COD removal eficiency continuous stirred tank reactor directed, acyclic graph ratio of feed time to cycle time recycle gas flow rate hydrogen mixed liquor volatile suspended solids (active mass of microorganisms inside the reactor) number of cycles Organic loading recycle gas flow rate recycle liquid flow rate moles of methane produced in ANSBR model nile-based expert sydm effluent COD in ANSBR model influent COD in ANSBR model solids retention time surface tension temperature decant time fil1 time react time settte time cycle time fil1 volume

Page 10: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

vr

v s

vflr VFA VSS Xi Xtot

react volume settle volume ratio of fil1 volume to react volume volatile fatty acid volatile suspended solids bacteria specific to substrate i MLVSS

Symbols for the ANSBR mode1 can be found in Bagley and Brodkorb (1999).

Synonyms for Bayesian belief networks (BBNs) include:

Bayes nets Bayesian networks belief network causal probabilistic network (CPN)

P(AIBAC) is read as probability of A given B and C

Page 11: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

1. INTRODUCTION

In wastewater treatment, anaerobic processes are generally prefemed to aerobic

processes when trying to treat wastewater containing high chemical oxygen demand

(COD). Advantages of anaerobic processes include the elimination of aeration costs,

recovery of methane, and the production of significantly less excess biomass. A main

disadvantage of anaerobic treatment of wastewater, however, is the more cornplex

rnicrobiological community acting in the system. Thus anaerobic systems require greater

technical expertise during ~peration.

Typically the operator monitors certain parameters. When upsets occur, diagnostic

input of an expert in anaerobic wastewater treatment is required before the operator

makes the necessary changes to restore balance. On-line, real-time twls to detect

problems as they occur, diagnose the most probable causes, and make adjustments would

minimize this requirement and increase operational eflïciency. Barnett and Andrews

(1993) stated that "operators and process experts could use such a system to assist in

trouble-shooting, enabling more consistent and reliable operation, and management

would find it valuable as a resource for planning, design, and evaluation."

On-line sensors have been deveioped to continuously monitor key parameters, thus

replacing the role of the operator. These sensors include an on-line gas meter, pH meter.

ancilor an on-line bicarbonate alkalinit y (BA) monitoring instrument that was developed

by Hawkes et ai. ( 1 993). Guwy et al. (1 997) combined neural networks with the latter

instrument in a fluidised-beâ anaerobic digester, demonstrating that they have developed

a system to monitor and control BA, and hence pH in the digester. However, they

showed that the control ofthese panuneters was not suficient to prevent changes in other

Page 12: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

parameten that were monitored, including carbon dioxide concentration, gas production

rate, hydrogen concentration, and volatile fatty acid concentrations. Therefore, even

though on-line monitoring and control instruments are being developed, their uses are

limited until a sophisticated multiparameter controller can incorporate information fiom

such parameters and suggest high-level control actions that would result in optimum

performance (Guwy et ai., 1997). A multiparameter controller could be developed using

some fom of artificial intelligence (AI) diagnostic system. Relevant types of AI systems

include nile-based expert systems (RBESs), artificial neural networks (ANNs), and

Bayesian belief networks (BBNs).

Bayesian belief networks, fira developed at Stanford University in the 1970s

(McCabe et al., 1 998), are probabil istic knowledge-based expert systems. They are

graphically represented as nodes representing variables, and arrows representing cause-

effect relationships between the variables. Conditional probabilities of the states of the

variables are developed for each combination of parent states. They are preferred over

RBESs and ANNs because modifications could be continuously made wit hout any major

adjustments of the entire system. The other two systems require retraining of the entire

system whenever modifications are made. In addition, unlike the other two systems, a

BBN developed for wastewater treatment would visually show the parameters involved

and their relationships. Kence, the BBN would give an insight about the wastewater

treatment process. Finally, BBNs are bi-directional. The same network could be used

diagnostically to detemine causes to specific problems and predictively to increase

operaîional eficiency and design experiments. It can readily compare the probabilities of

events before and afier the introduction of evidence (using Bayes' Theorem) and update

Page 13: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

its diagnosis or prediction. Large anaerobic wastewater treatment plants can be operated

more eficiently if this expert system is well designed and properly integrated with an

intelligent process control system that is fully computerized.

Although BBNs have gained in popularity over the past decade, with applications in

fields such as medicine, software development, and construction management

(Heckerman et al., 1995; McCabe et al., 1998). they have not been examined extansively

for wastewater treatment. Only one reference in the literature (Chong and Waliey, 1996)

describes the use of BBNs for the diagnosis of faults in an aerobic wastewater treatment

plant. No application to anaerobic treatment has been conducted.

The main objective of this research is to develop a Bayesian belief network for

anaerobic wastewater treatment, specifically the amerobic sequencing batch reactor

(A NSBR) .

Page 14: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

2. LITERATURE3 REVIEW

2.1 Anaerobic Wastewater Tmatment

2.1.1 Anaerobic Sequencing Batch Reactor (ANSBR)

There are many different anaerobic (absence of oxygen) treatment systems that have

been developed including anaerobic digesters, upflow packed bed reactors, upflow

anaerobic siudge biankets (UASBs), and anaerobic sequencing batch reactors ( AVSBRs).

The latter system uses the same vesse1 for both the reacting and settling phases of the

wastewater (Schmit and Dague, 1993; Dague and Pidaparti, 1992). The ANSBR, which

was developed and patented by Dague and CO-workers at Iowa State University (U.S.

patent Number 5,185,079; Feb. 9, 1993), is relativeiy easy to operate and flexible

(Fernandes et al., 1993). Presently, a 12 L ANSBR is being tested at the laboratory

facilities in the Department of Civil Engineering at University of Toronto.

Treatment of wastewater using the ANSBR occurs in four stages as show in Figure

2.1 : fill, react, settle, and decant .

Fil1 React

Figure 2.1 Stages in an Anaerobic Sequencing Batch Reactor

Page 15: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

The contaminant concentration in wastewater to be treated anaerobically is usually

expressed as chernical oxygen demand (COD) which is the amount of oxygen required to

stabilize the organic matter in the wastewater using a strong oxidant such as dichromate.

The main goal of wastewater treatment plants is to reduce the COD to a regulation value

in the effluent.

Dunng the fiil stage, the wastewater is added to the reactor untii it is &il. The amount

of wastewater that is added to the reactor is known as the fil1 volume (Vf). The full liquid

volume in the ANSBR is called the react volume (Vr). The contents are mixed by either

recycled liquid (QI!) or gas flow (Qd dunng the react phase, during which the

microbiological degradation of the organic compounds occurs anaerobically to produce

different gases including methane gas which could be used as fuel or as part of Q,. Note

that the first two stages can be combined by using a continuous feed when tilling the

reactor, rather than using a slug feed. The time used for filling the reactor is called the

feed or fil1 time (tf).

During the settle stage, the recycle flow is tumd off, and the biomass settles under

quiescent conditions. Two layers are observed at the end of this stage: the biomass layer

and the supematant (liquid layer above the solid layer). Dunng the decant stage, the

supernatant is drawn fiom the reactor, thus completing one full cycle &,le), which can

then be repeated. A complete cycle (tqcl,) is the sum of the fil1 time (td, react time (t,),

settle time (t,) and decant time (td). The COD concentration of the supematant at the end

of this stage should be at or below the desired level. The percentage difference berneen

the influent and the effluent COD is known as the COD removal efficiency.

Page 16: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

The hydraulic retention time (HRT) and organic loading, which are important factors

in wastewater treatment, are defined as,

Organic loading = (COD influent x ViN,) (2.2) f cycle

A main disadvantage of anaerobic treatment of wastewater is the complex

microbiological community acting in the system. Brodkorb (1998) gives a detailed

explanation of this complex system. A bief summary of the anaerobic degradation of

glucose (a rapidly acidieing substrate) is as follows:

Glucose is convened to volatile fatty acids (VFAs) such as propionic, butyric, lactic

and acetic acid by bacteria known as acidogew. This process is known as

actdoge~iesis.

The VFAs are then converted to acetic acid by bacteria known as acetogws. This

process is known as acetogenesis.

Dunng the two processes above, hydrogen and carbon dioxide are produced.

Methane is produced from acetic acid or hydrogen and carbon dioxide by bactena

known as methanogens. T b process is known as rnethanogenesis.

Bacteria that convert acetic acid to methane are called açeticlastic mcfhogens.

0 Bacteria that convert hydrogen and carbon dioxide to methane are called

hydrogenotrophic methanogens.

Dmeasing the cycle time (kTcl.), increasing the fil1 volume to react volume ratio

(V&) and increasing the influent concentration (COD influent) increases the organic

loading on an ANSBR (Equation 2.2). If the loading is too high, and the reactor is fed a

rapidly acidifying substrate such as glucose, then the volatile fatty acid (VFA) production

Page 17: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

rate may exceed the VFA consumption rate. As a result, the pH would decrease which

would inhibit both the hydrogenotrophic and aceticlastic methanogens. Inhibition of

hydrogenotrophic methanogens will cause the hydrogen partial pressure inside the reactor

to increase. This would then inhibit the consumption of propionic and butyric acid to

actetic acid, thus increasing the amount of VFAs in the reactor. Inhibition of aceticlastic

methanogens will cause the acetic acid concentrations to dso increase. In both cases, pH

will funher decrease, exacerbating the problem. The end result would be an increase in

the amount of VFAs (COD) in the wastewater effluent, hence a reduction in the COD

removal efficiency, and a reduction in the amount of methane produced.

Two methods of controlling the pH inside the reactor include adding alkalinity to the

influent, and increasing the ratio of feed time to cycle tirne (FK time). Adding alkalinity

to the influent would increase the pH of the ANSBR. This will buffer the system against

upsets fiom extra VFA production. Additionally, Shizas (2000) showed experimentally

that longer fil1 times for a given cycle time (i.e., longer F/C time) could improve the

performance of an ANSBR treating a rapidly acidifying substrate such as glucose.

Increasing this parameter slows substrate consumption and M A production, allowing

VFA removal to occur suficientiy fast to prevent the pH probiems mentioned above.

The mass of the bactena in the wastewaterheactor is known as the mixed-liquor

volatile suspended solids (MLVSS). Increasing the MLVSS concentration would

increase the anaerobic degradation rate of the substrate. This would increase the COD

removal efficiency of the reactor, and thus increase the amount of methane being

produced.

Page 18: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Granulation, which is an important factor in ANSBR techwlogy, is the process

whereby granules of bacteria form, hence increasing the settleability charactenstics of the

biomass during the settling stage. This would decrease the amount of bactena that

overtlows in the wastewater effluent, and hence increase the amount of bacteria

remaining in the reactor after a complete cycle. That is, granulation increases the solids

retention rime (SRT) of bacteria which is defined as the mass of microorganisms in the

reactor divided by the mass of microorganisms rernoved (wasted or overflow) from the

reactor after each cycle.

Granulation also minimizes the distance between organisms that can act in synergy to

reduce soluble substrates (Guwy et al., 1997). The layered structure of granules is

usually modeled as a core of methanogenic bacteria surrounded by an imer shell of

acetogens and hydrogen-consuming microorganisms, with a final outer shell of

acidogenic bacteria (MacLeod et al., I W O ) . Going from the outside to the inside of the

granule, acidogenesis occurs, followed by acetogenesis, and then methanogenesis. Since

the hydrogen removing microorganisms (hydrogenotrophic methanogens) would be in

close proximity to the hydrogen producing microorganisms (acidogens and acetogens),

hydrogen consumption rate would be increased, thus preventing an increase in the

hydrogen partial pressure inside the reactor, and hence the problems of low COD removal

efficiency and methane proâuction rate as described earlier.

There are many factors that affect granulation including recycled gas/ liquid flow

rate, organic loading (Grotenhuis et al., 199 1 ), surface tension (Thaveersi et al., 1995),

temperature (Wu et al., 1995), minerals such as calcium (Mahoney et al., 1987), water

absorbing polymers (Imai et al., 1997), and cationic polymers (Wirtz and Dague, 1996).

Page 19: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

2.1.2 ANSBR Model

Bagley and Brodkorb (1999) developed a model to simulate the COD removal of

wastewater in an ANSBR. With this model, time-consuming and expensive experiments

do not need to be done when information conceming the performance of an ANSBR is

needed. Bagley and Brodkorb (1999) stated that "the model explicitly considers the

dittèrent microbial populations within an anaerobic community, predicts the formation

and consumption of intermediate products as a function of hydrogen partial pressure,

predicts system pH, and considers inhibition due to pH and hydrogen partial pressure."

2.2 Bayesian Bdief Networks (BBNs)

DifTerent terminologies for Bayesian belief networks (BBNs) are Bayes nets, causal

probabilistic networks (CPNs), Bayesian networks or simply belief networks (Jensen,

1999).

2.2.1 Structure of BBNs

A Bayesian belief network is comprised of two parts: a qualitative part and a

quantitative part. The qualitative part consist of nodes, representing variables of the

domain, and arcs or arrows between these nodes, representing causeîffect or parent-

child relations in the domain. Figure 2.2 shows a simple segment of a belief network that

could be developed for an ANSBR. This example is provided to help explain the

concepts of BBNs. The variables in this network are:

Alk. (A): Akalinity(mg/LasCaCO~)

F/C time (F): Feedkycle tirne

pH (P): pH

Page 20: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Figure 2.2 Segment of a bdief network for an ANSBR

As seen by the direction of the arrows, alkalinity and feedkycle tirne both affect pH,

and are considered parents of pH. Because there is no arc between alkalinity and

feed/cycle time, these variables are assumed to not influence each other directly, and thus

are conditionall y independent.

The qualitative part also consists of the states of the variables. Variables can have as

many states as desirable. However, as the number of states increases. the complexity of

the network ais0 increases. For the network in Figure 2.2, each variable is binary (has

two states): low (L) and high (H).

The first issue to be considered in the quantitative part of a belief network is the

definition of the states, i.e., what is low and high. For example, the ranges for low and

high alkalinity need to be defined:

Low alkalinity: O - 3000 mg/L as CaC03.

High alkalinity: 3000 - 5000 mg& as CaCO3.

Page 21: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

The nea step is to determine the pior probabilities, and conditional probabilities of

the states of the variables for each combination of parent states. Prior (or unconditioned)

probabilities are required for the states of the variables that have no parents, i.e., orphans.

Referring to the example in Figure 2.2, these variables are AUc. and F/C time. For

wastewater treatment, the pnor probabilities represent a summary of the evidence prior to

any event. For example, given the records of an existing AVSBR in operation, what is

the probability of alkalinity being in a high state, before operating the reactor? This

information would be detennined by examining operating records. Hence, prior

probabilities are specific to different reactors.

Table 2.1 .A shows the pnor probabilities for the network in Figure 2.2. These were

assumed for illustration purposes. Table 2.1 .A shows that the prior probability of

alkalinity being high for the example is 70%. This means that most of the time (> 50%)

the reactor was operated in a high state (> 3,000 mg/L as CaC03) of alkalinity.

Table 2.1 .B shows the conditional probabilities, which are the probabilities of the

states of the children variables for each combination of parent states. Referring to the

example in Figure 2.2, there is only one child variable, pH. Table 2.1 .B shows that if a

high alkalinity and a low F/C time are both observed, and everything else known is

irrelevant for pi-?, then the probability of observing a high pH is 0.40, i.e.. P(high pH 1

high alkalinity and low FIC time) = 0.40. Using the symbols developed for this example

the previous statement can be rewritten as P(P=H 1 A = H A F=L) = 0.40 [P(AIBAC) is

read as the probability of A given B and Cl.

The conditional probabilities in Table 2.1 .B were aiso assumed for illustration

purposes. They are normally determined from expert opinion, where questionnaires are

Page 22: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

sent out to experts asking them to estimate the conditional probabilities. However,

experiments and computer models could also be used to calculate the conditional

probabilities.

Table 2.1 Probabilities for the network in Figure 2.2.

A. Prior Probabilities

Alkalinity (mgK as CaC03) (A) l F/C tirne (F)

B. Conditional Probabilities

Low High

0.3 O. 7

PB (Pl

" These values were assumed for illustration purposes.

b w

High

The sum of the probabilities of the states of a variable must add to 1 .O. This can be

used as a strategy when calculating probabilities of the states, because for a variable with

two states, only the probability of one state needs to be known. The other probability is

sirnply calculated by subtracting its value fiom 1 .O. Likewise, a variable with three states

only needs calculations of the probability of two of the states. In Table 2.1 .B, this is

demonstrated by obse~ng that P(pH=Low) + P(pH=high) = 1 .O for any combination of

Alkalinity (A)

parent S.

0.95 0.05

Low FIC time (F)

L

High F/C time (F)

Low

0.40 0.60

Low High High I

0.60 0.40

0.05 0.95

Page 23: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

2.2.2 Conditional Independence

Figure 2.3 shows three types of connections found in a BBN. In the serial

connection, A, B and C are conditionally dependant, i.e., A affects B, and B affects C. A

change in A would affect C. However, if the state of B is known, then A and C become

independent of each other. A and C are said to be d-separuted given B.

Diverging connections act similarly to senal connections. h change in B wiii affect

A, C and D. However, if A is known, it d-separates B, C and D from each other, making

them conditionally independent.

The converging connection acts in reverse. If no evidence is entered for A or any of

its descendents, then B, C and D are conditionally independent. In other words, if the

state of C was known, it would not affect the probability of the States of B or D.

However, if the state of A or any of its descendents is known, then B, C and D become

conditionally dependent. This is referred to as d-cottnection.

A. Serial Connection

B. Divergiag Connection C. Converging Connedion

Figure 2.3 Thm types of connections in Bayesian networkr (Jensen, 1996)

Page 24: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

2.2.3 Baya' Theorem

Bayesian belief networks use Bayes' theorem to update probabilities when evidence

is obtained:

Equation 2.3 could be written in the context of other variables as:

If A and B are variables with states Ai. . . . .. A,,, and Bi. . . . .. B.. respectively, the

probability of an event Ai, can be calculated by summing al1 of the joint probabilities of

Ai with each of the events of B, such that

This process is known as marginalization. Given the probability relationship,

Equations 2.3, 2.5 and 2.6 can be combined to give

Additional information concerning the concepts of Bayesian networks and Bayes'

theorem is found in Jensen (1 996).

2.2.4 Exampk of BBN

Because Bayesian belief networks have not been widely used for wastewater

treatrnent, an example of how BBNs could be used will now be given. Equilibnum state

1 in Table 2.2, shows the probabilities of the states of the variables before evidence is

Page 25: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

introduced into the network in Figure 2.2. Equilibnurn state means that if the

probabilities are recalculated, then the same vaiues would be obtained unless evidence

(probability of the state of a variable) is added to the network. The probabilities were

calculated using probability calculus (Appendix A) and backchecked using HU GIN^

and M S B N ~ (two BBN software).

Equilibrium state I in Table 2.2 shows that given the information already known

about the network in Figure 2.2, the probability of achieving high state of pH is 68%.

Because this value is greater than 5096, the ANSBR can be said to be operating with a

high state of pH most of the tirne. Note that the probabilities of the states of t he parent

parameters (Alk. and FIC tirne) are identical to the prior probabilities in Table 2.1 .A.

These would change only if evidence is introduced into the network influencing the

cenainty of their child variable (Le., pH).

Table 2.2 Beliefs of t h m different quilibrium states'

Aikalinitv (A) Low 0.30 High o. 70

F/C time (FI 1 Low 1 0.30

PH (P) Low 0.32 Hïah 0.68

Equilibrium State 2 I 3

If it is dixovered that pH is low, which is unfavourable for any waaewater treatment

process, then the belief network in Figure 2.2 could be used to detemine the most

Page 26: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

probable cause(s) for this upset. Entenng evidence that P(pH =L) = 1.0 into the belief

network (Equilibrium state 2 in Table 2.2.). the updated probabilities of the States of the

other variables could be calculated using Bayes' theorem (Equation 2.3) and probability

calculus. An example of the calculations follows,

P(A=L) = 0.30 (Table 2.2: Equilibnum state 1)

P(P=L) = 0.32 (Table 2.2: Equilibrium state 1)

Using the definit ion of marginalization described in Section 2.2.3 (considering al1 the

joint probabilities of pH=L and Alk.=L),

P(P=LIA=L) = P(P=LIA=L A F=L) P(F=L) + P(P=LIA=L A F=H) P(F=H)

= 0.95 x 0.3 + 0.4 x 0.7 (Table 2.1)

P(P=LIA=L) = 0.565

Substituting Equations 2.9. 2.10 and 2.12 into Equation 2.8,

P(A=LIP=L) = 0.565 x 0.30 / 0.32 = 0.53 (Table 2.2: equilibrium state 2)

A similar calculation is done for P(F=LIP=L).

Equilibrium state 2 in Table 2.2, shows that the network increased the probability in

both alkalinity and feed/cycle time being low. However, there is a much larger increase

in P(F=L) compared to P(A=L), when compared to equilibrium state 1, Le., 36% and

23%, respectively. Therefore, the network diagnoses low F/C time to be the moa

probable cause of the low pH., and so feedkycle time should be increased to correct this

upset.

Page 27: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

If another piece of evidence is introduced into the network, such as the feedlcycle

time actually being high and pH still being low, the network increases the probability that

Alk. is low by 24% (cornparhg Equilibrium states 2 and 3 in Table 2.2), making low

alkalinity the most probable cause with a 77 % probability (Appendix A). Therefore,

alkalinity should be increased to increase pH to a high state, given that feedfcycle time is

in a high state.

2.2.5 Limitations of BBNs

A limitation of BBNs is that cyclic logic in the networks is not allowed, i.e., Bayesian

belief networks are Jirecfe<l. acyciic graphs (DAG). Figure 2.4 shows an example of a

cyclic network that could be developed for anaerobic wastewater treatment. As described

in Section 2.1.1, inhibition of hydrogen-consuming bacteria could result in an increase in

hydrogen partial pressure to a level that could inhibit the acid-consuming bacteria. This

would result in an increase in the volatile fatty acid concentrations, which could result in

a decrease in pH to a level that would inhibit the hydrogen-consuming bacteria even

more, hence repeating the cycle of effects. Since BBNs do not allow cyclic networks,

ways of overcoming this probiem would have to be investigated if this situation is ever

considered.

In principle, the more information (e.g. variables, states) supplied to a belief network,

the more accurate it would become. However, this also means that the network would be

more complex, requiring a greater effon to wnmc t , evaluate, test, and maintain. To

decrease the computational difficulties associated with BBNs, the number of states of the

variables should decrease (minimum number is two states) as the number of variables in

Page 28: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Figure 2.4 Example o f cyclic network for anierobic wastewater treatrnent

the network increase. Pradhan et al. (1996) conducted a series of experiments on a set of

belief networks (a total of 448 nodes and over 900 arcs) for medical diagnosis in liver and

bile disease, and found no significant differences in the diagnostic performance of the

belief networks when simplifying from quatemary to binary States.

Probabilities can be subjected to sources of bias and inaccuracy (Pradhan et al.,

1996). For example, when using expert opinion to detemine the probabilities, the expert

may not have the experience that is tmly representative of the technology for which the

BBN is being designed. In addition, a network requiring probabilities with greater

precision than an expert cm actually provide would be unsuitable for its purposes. If

experiments or models are used to determine the probabilities, the data may be obtained

from a sample that deviates seriously fiom the characteristics of the population for which

the BBN is being developed (Korver and Lucas, 1993). Limited sample sizes can also

Page 29: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

lead to random errors (Pradhan et al., L996), and of course, inaccurate models would lead

to incorrect probabilities.

To test the robustness of a belief network, different scenarios need to be considered,

with the results examined. However, depending on the magnitude of the belief network,

it could be time-consuming to test every single possible scenario. Therefore, refinements

of the probabilities wouid have to be made over time as the network is

testedfimplemented and minor discrepancies are formed, or as real data upon which

probabilities can be based, are collected.

2.3 Sofhvare for Bayaian Analysis

The network in Figure 2.2 is a very simple one and so updating the probabilities of

the States of the variables as evidence is introduced into the network is not a dificult or

time-consuming task. However, networks are nomially more complex and so

computational tools/sofiware are needed to evaluate belief networks as quickly and

correctly as possible.

2.3.1 EIUGM'"

H U G M ~ ' is a program which is very easy to use for anyone who wishes to construct

an expert system based on Bayesian belief networks. As evidence is introduced into the

network, the new equilibrium state is calculated by the click of an icon. For this project,

HUGIN LITE 5.3 (Email: [email protected]) was used to construct and evaluate the

knowledge-based expert system on anaerobic wastewater treatment. The results of the

example in the previous section were confimed using this software. Figure 2.5 shows

Page 30: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

one o f the windows in the HUGM LITE program that was used to create the network in

Figure 2.2.

With the full version of this software, one can copy and paste data between this

software and other Windows based programs. In addition, one can combine this software

with Visual Basic to produce an executable program that would analyze the created BBN

in prognosis mode.

Figure 2.5 Cmting the network in Figure 2.2 using EUGM LlTE 5.3

20

Page 31: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

2.3.2 Microsoft O Belief Network ( M S B N ~ ~ )

Microsofl O Belief Network (E-mail: [email protected]), also known as

MSBN~' , is another program which is easy to use to constmct an expert system based on

BBNs. For this project, the results of the final network were backchecked using this

software. Due to the availability of the executable niII version 1 .O0 1 and since the

funaion interface contained in MSBN32.DLL is accessible from Visual Basic, MSSN~''

was combined with Visual Basic to produce an executable program that analyzed the

created BBN in prognosis mode.

A main disadvantage of this software is that one cannot copy and paste probability

values between this software and other Windows based prograrns. Finally, entering

probabilities into the network in the full MSBN" version (entering numbers into pie

charts) is much more time consurning than in the HUGIN LITE 5.3 software (entering

numbers into tables similar to the format in Table 2.1). Figure 2.6 shows one of the

windows in the MSBN program that was used to create the network in Figure 2.2.

Figure 2.6 Crerting the network in Figure 2.2 usiag MSBN 1.001

Page 32: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

3. DEVELOPMENT OF THE BAYESIAN BELIEF NETWORK

3.1 Anaerobic Wastewater Treatment Technology

As mentioned previously, the main objective of this research was to develop a

Bayesian belief network for an ariuerobic sequencing batch reactor ( A N S W . Bagley

and Brodkorb (1999) developed a mode1 to simulate the treatment of wastewater in an

ANSBR, thus avoidinp the need for time-consuming and expensive experirnents when

information conceming the performance of an ANSBR was needed. The variables and

relationships in the belief network may not be general to al1 anaerobic systems, but the

procedure used for the development of the network could nevenheless be applied to any

anaerobic wastewater treatment sy stem.

The BEN was designed to diagnose upsets in a 12 L stable ANSBR after every cycle.

Stable means that the reactor is operating under steady state conditions. Upsets that were

of concem were low COD removal efficiency and low methane production rate ("low" to

be defined later). Glucose was the substrate to be treated. It was assumed that the

temperature remained constant at approximately 2 1°C, and the settle and decant times

were preset at 1 .5 and O. 5 hours. respective1 y.

3.2 Variables

The first step in designing the Bayesian belief network was to identify the variables.

For this project, only the parameten that could be easily controlled/measured by a

wastewater operator (or an on-line control system) were considered as variablednodes for

the network. For example, acetic acid, which is an important intermediate produa in the

anaerobic degradation of substrates was not considered as a variable in the network

Page 33: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

because it is not easily measured by a wastewater operator. In addition, to the best

knowledge of the author, no on-line control system has been developed to measure acetic

acid concentration. Furthermore, because the network conditional probabilities were to

be calculated using the ANSBR model developed by Bagley and Brodkorb (1999), the

variables chosen must be calculated in the model. Finally, because the complexity of a

BBN increases as the number of variables increases, only the most important parameters

for the fùnctioning of an ANSBR were entered in the network.

Keeping these strategies in mind, extensive literature research on ANSBRs was done

to determine the most important parameters in ANSBR technology. The parameters

chosen were reviewed by an expert, Dr. D. M. Bagley, at the University of Toronto, and

are show below.

Alkalinih IAlk.1- alkalinity that is added to the wastewater as it enters the reactor

expressed in units of mg/L as CaC03. Alk. could be controlled by adding sodium

bicarbonate or calcium carbonate to the incoming wastewater steam. Alk. is represented

by SNMET influent in the ANSBR model, and is expressed in units of mg/L as CaC03.

Ç c - concentration of the wastewater entering the reactor

expressed in units of mg CODIL. COD infl. could be controlled by increasing/decreasing

the recycled flow, and hence the dilution factor of the incoming wastewater Stream. In

the case of a laboratory sa le reactor, the concentration could be controlled by adjusting

the concentration of the substrate added to the reactor. COD id. is represented by Sr

influent in the ANSBR model, expressed in units of mg CODIL.

Page 34: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Cycle time (&&) - sum of the fill, react, settle and decant time expressed in units of

hours. t q c i e could be controlled by adjusting the duration of the fil1 and react stages. The

following fomulas were used to calculate the fil1 and react times, represented by tr and t ,

respectively, in the ANSBR model, and expressed in units of hours.

The settle time (t,) and decant time (td) were preset to 1 .S and 0.5 hours. respectively.

Feed/cvck time IFIC tirne) - ratio of the fil1 time to the total cycle time. FM: time could

be controlled by adjusting the duration of the fil1 stage for a specific cycle time.

Equations 3.1 and 3.2 were used to calculate tf and tr in the ANSBR model given FIC

time.

VmN, (V&) - ratio of the fiIl volume to the react volume. VrN, could be controlled

by adjusting the settled volume (V, = V, - Vf) of the MLVSS in the reactor and the

volume of the incoming wastewater added to the reactor.

The following formulas were used to calculate the fil1 and settled volumes (Vr and V,),

in the ANSBR model, expressed in units of litres.

Vf = V N r X 12

v, = 12 - Vf

assuming, hl1 volume of reactor, V, = 12 L.

Page 35: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Mixeû liauor volatile susnended solids IMLVSS) - mass of the bacteria in the full

reactor's volume (V, = 12 L) expressed in units of mg VSS/L. MLVSS could be

controlled by adjusting the sludge retention time (SRT) - adjusting the sludge removal

(overfiow and wast ing) rate fiom the reactor.

Increasing granulation also increases SRT, which increases MLVSS concentration.

Because an increase in MLVSS concentration is observed during the tint stages of

granule development, and a decrease in MLVSS concentration is observed during granule

breakup (Wirtz and Dague, 1996)' MLVSS concentration could be viewed as an

indication of granulation (which cannot be calculated in the ANSBR model) in the

Bayesian belief network.

MLVSS is represented by Xtot in the ANSBR model, and expressed in units of mg

CODL in settled volume (V,). In the model, Xtot is also divided into the most important

groups of microorganisms in the reactor (Bagley and Brodkorb. 1999).

Given the concentration of MLVSS in the settled volume (V,) expressed in units of

mg COD/L, the concentration of MLVSS in the full reactor's volume (V,) expressed in

units of mg VSS/L, cm be calculated as.

MLVSS (mg VSSL in Vr) = MLVSS (mg C O D L in V,) x 5.65 g VSSB g COD x (1 -VIN,)

Rearranging Equation 3.5 gives,

MLVSS (mg CODA in V.) = MLVSS (ma VSStL in Vr) x 8 a CODl5.65 a VSS 1 -V&

- pH of the treated effluent as it leaves the reactor. pH is represented by pH in the

ANSBR model.

Page 36: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

COD removal ef'iiciencv (COD cfFir.) - percentage (%) removal of COD h m the

influent to the effluent, defined as

COD effic.(%) = [CODinfluent - CODeffluent) x 100 CODinfluent

CODeffluent is calculated fiom Ses in the ANSBR rnodel, expressed in units of mg

C& production rate (CH4 rate) - average methane production rate over the entire cycle

expressed in units of Wd. and calculated as

C& rate (L/d) = CODinfluent (g CODR) x 24 hourdd 100 x t,,!, (hours)

x ViN, x COD effic. (%) x 0.35 L CH..JgCOD

x Reactor volume (L)

where, reactor volume = 12 L.

3.3 Relationships

Once the variables were identified, the relationships between them had to be

determined. Because the network was designed to diagnose upsets in a stable ANSBR

aiter one cycle was completed, whether a variable affects another variable after operating

a stable renciorjor one cycle had to be considered. For example, from expert knowledge

it was concluded that COD influent affects pH &er operating a stable ANSBR for one

cycle. However, there was uncertainty of whether COD influent would also affect

MLVSS.

From expert knowledge, MLVSS, pH, CH( rate and COD effic. were considered to be

the only possible children variables (having parent nodes) in the network. Additionally,

Page 37: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Alk.. COD infl., t,,., FIC time, V&, MLVSS, and pH were considered to be the only

possible parent variables. Hence, the cause-eRect relationships between Alk., COD infl.,

tqc,,, FIC time, V N , , MLVSS, and pH on MLVSS, pH, Ctt, rate and COD efic. were

investigated, keeping in mind that cyclic networks are not allowed in BBNs (Section

2.2.5)

The cause-eflects relationships were verified using the .4NSBR mode1 (Bagley and

Brodkorb, 1999). Using an earlier version (it has since been updated) of the ANSBR

model (8/2 1/99), steady state of a simulation reactor was achieved. Table 3.1 shows the

initiai conditions of an unstable reactor that was simulated under the conditions in Table

B. I (Appendix B) for nine cycles (conservative) to achieve stability. Figure 3.1 shows

that the COD removal eficiency decreased to approximately 84%- and then increased

after approximately 110 hours, hence stability. Table 3.2 shows the operating conditions

of the stable simulator reactor in Table 3.1, that produced the following results after

running one cycle: MLVSS = 12.35 1 mg V S S L in 12 L, pH = 6.80,

C h rate = 12.30 L/d, and COD efic. = 86.12%.

To check the cause-effect relationships in the BBN, the variables in Table 3.2 were

kept constant in the ANSBR model while changing the parent variable of interest and

observing its effects on the possible children variables afier one cycle (Tables 3.3 to

3. IO).

Before analyzing the results in Tables 3.3 to 3.10, the format by which the possible

children variables (MLVSS, pH, C)L rate and COD effic.) were calculated and recorded

must be describeci. MLVSS was caiculated by taking the last output value of Xtot

Page 38: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.1 Reactor conditions at startup and stabiütya

1 parameter 1 Startuplunrtable 1 Stability after 9 cyeks ] Soluble components (mg CODIL)

0.6 i

0.07 9 30 4

1

810 0.006 399 60 O

2499 1

2980 1

2980

'~eadily degradable carbohydrate, Sc '~eadily fennentable substrate, Sf Slowly degradable soluble substrate, S, Inert organic compund, Si c ce tic acid, Sa Propionic acid, S, ~act ic acid. SI Butyric acid, Sb '~issolved methane, Sm '~issolved hydrogen, Sh '~otal dissolved carbonate, Stol Alkalinity as CaC03, SN.NET Alkalinity as CaC03, SA

r

O O O O O O O O O 0 O

2500 O

Particulate Components (mg CODL in settld volume) 1239 5 165 5499 2166 6277 292 249 1 1385

iodegr gr ad able component of lysed biomass, X, hert component of lysed biomass, Xi '~eterotrophic-hydrolytic organisms, Xf '~ropionic acid acetogens, X, . Lactic acid acidogens, XI Butyric acid acetogens, Xb Aceticlastic methanogens, X, Hydrogeno trop hic methanogens, Xh

978 5076 3686 2171 5402 236 1674 1005

Cas Partial Pressures (atm) O

0.513 I

0.433 0.027

1

F~ydrogen, han^ P C H ~ Carbon dioxide, PCm Water vapour, PH20 ~ o t a l atmospheric, P.4TM , a Asbr-inih file in ANSBR model.

0.0001 0.523 0.45 0.027

1

Page 39: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

time (hm)

Figure 3.1 Plot of COD remval effiiency vs. t h e for 9 cycles of a startup mctor (conditiom in Tabk 3.1)

Table 3.2 Operating Conditions of a Stable Reactor*

. * I

Settle volume, V, 1 8.4 L

Mode1 Parameter Alkalinity added to influent, SNmn infl. Glucose substrate, Sf Biodegradable component of lysed biomass, X, Inert component of lysed biomass, X, Heterotrophic-h ydrolytic organi sm s, XI Propionic acid acetogens, X, Lactic acid acidogens, XI Butyric acid acetogens, Xb Aceticlastic methanogens, X, Hydrogenovophic methanogens, Xh Fil1 volume. VF

Fn-$me, tr 1 7.2 hours 1

Value 3000 mg/L as CaC03

8500 mg CODL 1239 mg CODL 5 165 mg CODIL 5499 mg CODL 2 166 mg CODL 6277 mg CODL 292 mg CODA 249 1 mg CODL 1385 mg CODL

3.6 L

React time. L 1 8.8 hours 1

- - I

number of cycles, n-k 1 1 a Alk = 3000 mfi as CaC03, F/C time = 0.40, t,.+le = 18 hours

1

- - - - 3 .

Settle time, t. Decant time. t

V& = 0.30, COD infl. = 8500 mg& MLVSS = 12,119 mg VSSL in 12 L

1 .5 hours 0.5 hours

Page 40: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

(expressed in units of mg CODA in V.) in the model, and using Equation 3.5 to calculate

MLVSS in units of mg VSSL in 12 L. pH was the last output value of pH in the model.

COD effic. was calculated using Equation 3 -7. The last output value of Sen in the model

was used in Equation 3.7. Finally, CH4 rate was calculated by using Equation 3.8. Now

the results in Tables 3.3 to 3.10 could be analyzed.

Varying Alkalinity

Table 3.3 shows the results for varying alkalinity while keeping the other parameters

(Table 3.2) constant. The stable simulation reactor was mn for one cycle. The results are

plotted in Figure 3.2. From expert knowledge, alkalinity should only affect pH directly

and not the other children variables. However, the plots in Figure 3.2 show ihat alkalinity

appears to have no effect on any of the child variables including pH. Now alkalinity

could be defined as,

Alkalinity = 1.23E-3 x Pcm

Dr1

whete, Alkalinity = mg/L as CaCO3

PCo2 = Partial pressure of carbon dioxide, atm

[KI = IO-^^, m o n

Rearranging Equation 3.9, and taking the log of both sides,

pH = log [Mc/( 1 . t 3 E-3 x Pcot)]

Thetefore, pH is direaly proportional to log [Alk]. Because pH increases on a

logarithmic scale (thus slowly) as alkalinity increases, the effects of alkalinity on pH

were not significant aiter running the stable simulation reactor for one cycle.

Page 41: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.3 Varying Alkafini@ while kceping other panmcten in Table 3.2 constant

MLVSS 1 CH4 rate COD emr. I

Figure 3.3 shows the effects of alkalinity on pH for different cycles. For two cycles,

pH decreased dramatically as alkalinity decreased. The reason is because of the dilution

(and hence lag) factor. For example, if the reactor's alkalinity was 3.000 mg/L as CaCO3

and 500 mg/L as CaC03 was added to the reactor, and V O , was 0.3, then after one cycle

the reactor's alkal inity should have been approximatel y 2,250 mgR as CaC03 ([~OOOXO. 7

+ 500x0.3]/1 .O), subtracting the alkalinity that was consumed and assuming constant

rnixing (CSTR). After two cycles of adding alkalinity of 500 mg@ as CaC03, the

reactor's alkalinity should have been approximately 1.725 mg/L as CaCO3 ([22SOxO. 7 +

500x0.3]/1 .O). Hence, the arnount of alkalinity, available for preventing a low pH,

decreased as the number of cycles increased as show in Figure 3.3, where pH reached an

extremely low value of 3.52 after six cycles of adding an alkalinity of 500 mg/L as

Page 42: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 43: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Figure 3.3 Plot of pH vs. Alkaiinity at different cycles

CaC03 in each cycle. Hence, it was concluded that alkalinity is a parent variable of pH,

but NOT a parent of MLVSS, CH4 rate, and COD effic..

l

6 ncycle = 1

B ncycle = 2 1 , A ncycle = 4

0 ncycle = 6

8 - (

Vurying COD influent

Table 3.4 shows the results for varying the COD influent while keeping the other

parameters constant. These results are ploned in Figure 3.4. It was discovered that as

COD influent increased, MLVSS did not increase significantly (values remained between

12,000 and 12,500 mg VSSL).

The reason for the low COD removal efficiency for COD influent < 3,000 mg/L is

because of the "bleeding out" of the initial COD (1,253 mg/L) in the reactor. For COD

infl. > 12,000 mg/L, an increase in COD influent increased the organic loading (Equation

2.2) such that the rapidly acidiQing glucose substrate results in the production of VFAs

that cannot be removed at the sarne rate that they are being produced.

7

6

5 -

s4 3 -

1

A A rn * $ ! a 7 I -

1 m 1

4 a

4- --.

Page 44: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.4 Vaying COD inment while keeping other parameters in Table 3.2 constant

Therefore, the pH decreased, which in turn inhibited the methanogenic activity and thus

the removal of VFAs from the reactor, resulting in a decrease in the COD removal

eficiency. Generally, as COD influent increased, the COD removal eficiency decreased

due to the increased organic loading. However, the amount of substrateAoading available

for conversion to methane increased. Hence, it was concluded that COD influent is a

parent variable of pH, CH4 rate, and COD eflic., but NOT a parent of MLVSS.

Varying tcy&

Table 3.5 shows the results for varying tqci, while keeping the other parameten

constant. These results are plotted in Figure 3 -5 . Varying changed the organic

loading (Equation 2.2) and hence gave the same conclusions as those derived for varying

the COD influent. That is, tqCe is a parent of pH, C& rate, and COD effic., but NOT a

CH4 rate

(wd)

O. 14 0.9 1 4.07 7.20 10.17 12.30 14.44 17.28 18.45 23.69

Simulations

1 2

n

3 4 . 5

I

COD e f k . (%)

I

16.51 54.1 1 80.75 I

85.67 m

86.47 86.12 85.96 85.72 73.22 70.50

COD infi. (ni&)

500 1 O00 3000 5000 7000

1

MLVSS (mg VSSk in V,)

12120 12131 12181 1224 1 12304 12351 12396 12454 12403 12424

PB

6.91 6.90 6.89 6.87 6.84 6.80 6.76 6.70 5.06 4.6 1

6 7 8

I

9 10

8500 10000 12000 15000 20000

Page 45: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 46: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.5 Varying t ,, while keeping other paraneten in Table 3.2 constant

COD effic. ('w Simulations

1 2

I

3

parent of MLVSS. This is evident in the plots in Figure 3.5. Note that increasing COD

influent increased the organic loading (Equation 2.2). while increasing ty,i, decreased the

organic loading. This is the reason for the different shapes in Figures 3.4 and 3.5.

respectively. Table 8.2 shows the values that were used in the mode1 as varied

(fiorn Equations 3.1 and 3.2).

V w n g F/C time

Table 3.6 shows the results for varying FIC time while keeping the other parameters

constant. The stable simulation reactor was nui for one cycle. The results are plotted in

Figure 3.6. From expert knowledge and experiments (Shizas, 2000), F/C time should

only affect pH directly and not the 0 t h children variables.

*wk (houn)

4 8 12

MLVSS (mg VSSk in V,)

12264 12332 12359

PH

5.91 6.5 1 6.75

CH, rate

(wd)

42.0 1 24.13 17.73

Page 47: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 48: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.6 Varying FIC time while keeping otha parameten in Table 3.2 constant

Simulations

However, the plots in Figure 3.6 show that F/C time appears to have no effect on any

of the daughter variables including pH, due to the stable conditions of the simulation

reactor and the high alkalinity (3.000 mg/L as CaCOs in Table 3.2) that was provided to

the reactor.

When alkalinity was changed to 1.000 mg/L and 10 cycles were run, F/C time was

discovered to affect pH greatly as seen in Figure 3.7. Hence, it was concluded that F/C

time is a parent variable of pH, but NOT a parent of MLVSS, CI& rate, and COD effic..

Table B .2 shows the values that were used in the mode1 as F/C tirne varied (fiom

Equations 3.1 and 3.2).

Page 49: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 50: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

0.00 0.20 0.40 0.60 O. 80

FIC time

Figure 3.7 Plot o f pH vs. WC time at 10 cycles and Alkaliniîy at 1000 mg/L

V a m g V/V,

Table 3.7 shows the results for varying Vfl, while keeping the other parameters

constant. These results are plotted in Figure 3.8. Increasing VBV, increases the organic

loading (Equation 2 3 , and hence gave the same conclusions as those derived for varying

the COD influent. That is, Vfl, is a parent of pH, Ctl, rate. and COD efic., but NOT a

parent of MLVSS. This is evident in the plots in Figure 3.8.

Table B.2 shows the values of Vf and V, that were used in the mode1 as VdV, varied

(using Equations 3.3 and 3.4). Because the MLVSS concentration in Table 3 -2 was kept

constant at approximately 12.1 19 mg VSS/L in 12 L, Equation 3.6 was used to calculate

the MLVSS concentration in units of mg CODL in V, as Vfl', varied (Le., settled

volume changed). For example, if V e r changed Eiom 0.3 to O. 5, and MLVSS is kept

constant at 12,119 mg VSSL in 12L, then MLVSS in the settled volume (V,) would

Page 51: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.7 Varyiag Y#, while keeping other parameters in Table 3.2 constant

have changed From 24.5 14 mg CODL to 34,3 19 mg CODIL, respectively (fiom Equation

3 3). In addition, the percentage distribution of MLVSS (Table 3.8) was kept constant for

al1 the simulations where Vf l , varied.

Simulations L

Table 3.8 Percentage distribution of MLVSS used for simulations

Vfl,

t

MLVSS Component

C.

Xs L

Xi Xf Xp Xl Xb Xa

L

Xh

Xtot (mg CODIL) in V: r

Xtot (mg VSSL) in 12 L

MLVSS (mg VSSL in V,)

" Simüar to the values in Table 3 -2. Calculated using Equation 3.6 and Vfl, = 0.3.

-

mg CODIL in V,'

1239 5165 5499 2166 6277 292

249 1 1385

245 14 121 19 A

PH

% distribution

5.05 21 .O7 22.43 8.84

25.61 1.19 ,

10.16 5 -65

CHJ rate

(wd) COD emc.

(%)

Page 52: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 53: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Voryt#g ML. vss

Table 3.9 shows the results for varying MLVSS while keeping the other parameten

constant. These results are plotted in Figure 3.9. From expert knowledge, MLVSS

should affect C h rate and COD efic., but not pH in a stable reactor. This was verified

fiom the plots. Figure 3.9.A showed that dramatic increases in MLVSS did not

significantiy affect pH, since as MLVSS changed From 6,238 to 35,170 mg VSSL in 12

L (Table 3.9). the pH values stayed within the range 6.68 to 6.95. The other two figures

showed that as MLVSS increased, the anaerobic degradation rate of substrate increased,

which increased the COD efic. of the reactor, and thus increased the C h rate as well.

Hence, it was concluded that MLVSS is a parent variable of CH4 rate and COD efic.. but

NOT a parent of pH.

Because VINr was kept constant at 0.3 (Table 3.2). Equation 3.6 was used to

calculate the MLVSS concentration in units of mg CODL in V,, as the MLVSS

concentration in units of mg V S S L in V, (12 L) varied. In addition. the percentage

Table 3.9 Varying ML VST wbile keeping other panmeten in Table 3.2 constant

Simulations MLVSS

(mg VSSn in V,) PH CH, rate

(Ud) COD eflic.

(%)

Page 54: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 55: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

distribution of MLVSS (Table 3.8) was kept constant.

V H n g pH

Table 3.10 shows the results for varying pH while keeping the other parameters

constant. These results are ploned in Figure 3.10. From expert knowledge, pH should

affect C& rate and COD effic., but not MLVSS in a stable reactor. This was verified

from the plots. Figure 3.10.A showed that dramatic increases in pH did not significantly

affect MLVSS. As pH changed from 4.0 to 9.0 (Table 3. IO), the MLVSS values stayed

within the range 12,182 to 12,35 1 mg V S S L in 12 L.

The other two plots in Figure 3.10 showed that as the pH value moved away from 7.0,

the inhibition constant increased which resulted in a lower COD removal eficiency and

methane production rate. Hence, it was concluded that pH is a parent variable of C h

rate and COD effic., but NOT a parent of MLVSS.

Tabk 3.10 VaryingpH while keeping other paramettn in Table 3.2 constant

Simulations 1

L

1

PB

4.00

MLVSS (mg VSSR. in V,)

12182

CH, rate

(ud)

8.73

COD effic. (%)

I

61.15

Page 56: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 57: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

3.4 Structure of the Bayaian Belief Network

Figure 3.1 1 shows the variables and the cause-effect relationships in the Bayesian

belief network that was designed for an anaerobic sequencing batch reactor (ANSBR).

As shown, the variables were represented by nodes, while the relationships between the

variables were represented by arrows/arcs pointing from the parent to the child variable

(Le., cause to effect). Note that no cyclic networks were produced.

LEGEND

Alk. - Alkalinity (mgR. as CaC03) MLVSS - mixeû liquor volatile suspended Cl& rate - methane production rate (Ud) solids (mg VSSL in 12 L) COD effic. - COD removal efficiency (%) pH - pH COD infl. - influent COD (gL) kClC - cycle tirne (houn) FIC time - feed timekycle time vflr - VmNreact

Figure 3.11 Bayesian Bdief Nehvork for Aiaerobic Scquencing Batch Reactor

Page 58: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

3.5 States of the Variables

The third step in designing the Bayesian belief network for anaerobic wastewater

treatment was to create anci define the states of the variables, including the ranges of the

states. The states of the variables were defined as low, medium and high as shown in

Table 3.1 1.

As discussed in Section 2.2.5, Pradhan et ai. (1996) conducted a series of expenments

on a set of belief networks (a total of 448 nodes and over 900 arcs) for medical diagnosis

in liver and bile disease, and found no significant effect when simplifjhg from

quatemary to binary states. Hence, to reduce the complexity of the network, al1 of the

variables, excluding tqc!, and COD influent, had only two states: low and high as seen in

Table 3.1 1. Only tTclc and COD influent had three states to increase the options of

operating the ANSBR.

Table 3.1 1 States of the variables

Md. 1 1 5000-12000 1 12-24 1 1 1 I

1 Out~ut Parameters 1

, Low 3.0-6.5 <85

1

< 12

Page 59: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

The ranges of the states were detennined from literature review, engineering

calculations, expert judgement, and preference.

Alkdiniîy

Because methanogenic microorganisms are inhibited below pH levels of 6.5 (Speece,

1996), a pH > 6.7 (0.2 safety factor) was desired inside the ANSBR. The headspace in an

ANSBR treating glucose was assumed to be 50% CO*. Therefore, to maintain pH > 6.7,

the alkalinity requirement is approximately 3,100 mg/L as CaCO3 (from Equation 3.9).

Hence, O to 3,000 mg/L was chosen as the low range for alkalinity, while 5,000 mg/L was

set as the upper boundary for the high range due to the high costs associated with adding

chemicals to a reactor.

COD injlluent

To increase the options of operating the ANSBR, COD influent had three states: Iow.

medium and high. The medium range was defined as the normal operating range. The

highest reported organic loading treatable by ANSBRs receiving non fat dry milk and

sucrose was 12 g/L/d (Sung and Dague, 1995; Wirtz and Dague, 1996). Kennedy et al.

(1 99 1) were able to load an ANSBR with granulated sludge up to 9 g CODIWd using a

soluble sucrosdacetate substrate, while Shizas (2000) was able to load an ANSBR up to

3 gRJd using glucose. A hydraulic retention tirne (Equation 2.1) of 1 day was commonly

used. Hence, the COD influent in these reactors were approximately 12,9, and 3 g/L,

respectively. Therefore, the medium range was defined as 5,000 to 12,000 mg&.

Page 60: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

The lower bound was set to 10 mg/L (instead of O) to provide some substrate (COD)

in the wastewater to ueat. The upper bound was set to 24,000 mg/L to ensure that the

organic loading would not be too high. Therefore, the lower and upper ranges were

defined as 10 to 5,000 m u , and 12,000 to 24,000 mg/L, respectively.

If COD influent was 24,000 mgL, Vnlr, = 0.55 (maximum value in Table 3.1 I ) and

b,~, = 8 hours (minimum value in Table 3.1 1). then the maximum oqanic ioadiny that

the ANSBR could possibly receive is 39.6 gWd, which exceeds the maximum organic

loading of 19 BRJd ever treated by a lab-scale ANSBR (Angenent and Dague, 1995).

*cy&

To increase the options of operating the ANSBR, t,ic had three States: low, medium

and high. Shizas (2000) worked on cycle times of 12 and 24 hours while varying the FIC

time and initial substrate concentration. He discovered that for identical F/C times at the

same loading rate, shorter cycle t imes wit h lower initial substrate concentrations

improved reactor performance. Hence, the medium range was defined as 12 to 24 hours.

This was considered to be the normal operating range.

To ensure that the organic loading is not too high, the lower bound of t,i. was set to

8 hours. The upper bound of &* was set to 48 hours to ensure that the methane

production rate would not be tw low (Equation 3.8). Therefore, the lower and upper

ranges were defined as 8 to 12 houn and 24 to 48 hours, respectively.

Page 61: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

F/C time

Shizas (2000) ran experiments on an ANSBR with FIC time of 0.25, 0.42 and 0.75.

He discovered that longer fil1 times for a given cycle time improved the performance of

the reactor when treating a rapidly acidifying substrate such as glucose. Winz and Dague

(1996) ran experiments with FIC time as low as 0.02, while Schmit and Dague (1993)

used a FiC time of 0.0 1. Hence, the lower bound was set as 0.0 1, which is indicative of

"shock loading".

Given the minimum value of t+, to be 8 hours (Table 3.1 1). FIC time could not be

greater than 0.75, otherwise the settle and decant time would be less than the preset sum

of 2 t u s (Section 3.1). A FIC time of 0.40 was selected as the middle range. Therefore,

the lower and upper ranges were defined as 0.01 to 0.40, and 0.40 to 0.75, respectively.

v/v, Various researchers have used different values of Vfl, when operating an ANSBR.

For example, Shizas (2000) used a value of 0.50. while Dague and Pidaparti (1992) used

a value of 0.167. The lower and upper state ranges were defined as 0.05 to 0.30, and 0.30

to 0.55, respectively, to incorporate these extremes in different ranges.

In a real system, ViN, cannot be chosen without considering the settleability of the

MLVSS concentration being used. The greater the value of VdV,, the smaller the value

of VS and hence, the volume occupied by the settled solids. That is, for a large MLVSS

concentration, the greater the value of V&, the more difficult it would be to compact the

settled solids into the reactor, without solids overflowing in the effluent.

Page 62: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

M vss

The lower and upper ranges of MLVSS were defined as 5,000 to 20,000 and 20,000

to 10,000 mg VSSL in 12 L, respectively. The lower bound of 5,000 mg& was used

because the reactor must contain some MLVSS to function. The upper bound of 40,000

mg/L was selected to ensure settleability. Finally, 20,000 mg VSSL was preferred as

the middle range.

PH

The methanogenic rnicroorganisms in anaerobic wastewater treatment systems are

susceptible to inhibition due to pH levels below approximately 6.5 in the system (Speece,

1996). Figure 3.10 showed that as the pH deviated from 7.0, C h rate and COD efic.

both decreased. The pH effects at 6.5 were similar to that at 7.5. Since a treatment

system would work best within this range, high pH range was defked as 6.5 to 7.5. Low

pH range was defined as 3.0 to 6.5 since the pH levels in the ANSBR mode1 never went

below 3.0.

COD temoval eflciency

The lower and upper bounds were set as O and 100%, respectively. An ANSBR with

a COD removal eficiency of 85% (using Equation 3.7) was considered to be performing

satisfactorily and hence, low and high COD effic. ranges were defined as O to 85%, and

85 to 100%, respectively.

Page 63: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

CH4 rate

The middle range values for COD infl., tqCie, Vfl, and COD efic. were 8,500 mfl ,

18 hours, 0.3, and 85 %, respectively (Table 3.14). Using Equation 3.8, the middle range

value of methane production rate in a 12 L reactor was calculated to be 1 2.1 Lld.

Therefore, the lower and upper ranges were defined as less than and greater than 12 Ud,

respeaiveiy. This shows how calculaiions couid be done to determine appropriate ranges

for methane production rate. However, in reality, the ranges for this parameter could

simply be chosen as those that are required to produce a specified methane production

rate to satisfy the fuel requirements of a wastewater treatment plant.

3.6 Probabilities

The founh step in designing the Bayesian belief network for anaerobic wastewater

treatment was to determine the pmbabilities for al1 the nodes. For those variables that do

not have parents, the probabilities, referred to as priorprobabilities, were predicted,

while for those having parents, the probabilities, referred to as condirionalprobabilities,

were calculated using the ANSBR mode1 developed by Bagley and Brodkorb (1999).

3.6.1 Total Number of Probabilities

The total number of probabilities (prior and conditional) required for the BBN was

446 (Table 3.12). Because the sum of the probabilities of the States of a variable should

add up to 1.0 (that is, if P W V S S = low] = 0.2, then P[MLVSS = high] = 1 - 0.2 = 0.8),

only 224 probabilities needed to be determined (Table 3.1 2).

Page 64: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 65: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

3.6.2 Conditional Probabilities

The next step in designing the Bayesian belief network for anaerobic wastewater

treatment was to determine the conditional probabilities - that is, the probabilities of the

states of the children variables (pH. COD effic.. and CH4 rate) for each combination of

parent states as show in Table 3.13. The combinations are referenced 1 to 72. For

exampie, consider Reference f l and the low state of COD eFFic.. This can be interpreted

as the probability of obtaining a low state of COD removal eficiency given low states of

COD infl., t,~,, V&, MLVSS and pH (as defined in Table 3.1 1). is 0.83.

The conditional probabilities in Table 3.13 were calculated by running a minimum of

10 simulations using the ANSBR model for each combination using random unifonnly

distributed input values (within the range of states of the input variables), and then

calculating the percentage of the output values (probabilities) that were in the different

states of the output variables. To obtain a minimum of 10 simulations for every

combination, a minimum of 720 (= 10 x 72) simulations was run. Prograrns developed in

C code and combined with the existing ANSBR model were designed to automate the

simulations (with different random numbers in each combination), and calculate the

conditional probabilities. To avoid the number of simulations generated for each

combination being less than I O (which is possible since the input variables' values were

randomly generated), a total of 8,610 simulations were generated (i.e., 12 x 10 x 72).

This provided a minimum nurnber of simulations for any given combination of 85 (Table

3.13), and a maximum of 144 (as compared to the average expected number of 120).

Page 66: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.13 Conditional Pmbabilitks

I A = COD influent 1 1 L

A = COD innuent i l L

- -

'Total # o f simulations 1 134 1 i2i 1 112 1 107 1 100 1 113 1 125 1 117 1

L

Ref. # 17 18 19 20 2 1 22 23 24 Combinat ion WFLLL LHLLH WEWII, LüLHH WMLL LHHLH LüHHL LHHHH

r

- 1

(D = MLVSS, E = pH) 1 High 1 0.19 1 0.60 1 0.31 1 0.85 1 0.11 1 0.77 1 0.30 1 0.87 K L

CH, rmte tD=MLVSS. E = D M

PH @ = ML, E = WC tirne) COD emc @=MLVSS, E=pH) 1 High 1 0.29 0.80 0.36 0.83 0.28 ' 0.84 0.36 [ 0.85

Imw Hiah

1 O

Imw W h ,

0.95 0.05

1 O

O 1

Where O and 1 are nota the actuai values 0.01 and 0.99 were used, respectiveiy.

1 CH, me

0.98 0.02

0.99 0.01

1 O

Law 1 0.71

1 O

b w

0.88 O. 12

1 O

O

1 1

1 O ,@ = MLVSS, E = pH)

0.20

I O O

O 1

1 O

0.64 1 0.17

1 O

1 O

O

- !

1 O

0.72 1 0.16

O 1

, 0.64 1 0.15

O

1 O 1

O 1

Page 67: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.13 Coaditioaal Probrbikities Cont'd '

1 A = COD influent 1 1 M 1 B=t- c = v p ,

D E

Total # of simulvtians Ref. #

Combination

1

Total # of simulations 94 123 115 1 07 131 1 08 125 1 32 Ref. # 33 34 3 5 36 37 38 39 40

A = COD influent B = tw*

- .- - .- - -- CH, n t e 6 w 0.90 0.78 0.90 0.8 1 040 - 0.11 0.46 0.14

-

@ = MLVSS, E = pH) Higb 0.10 0.22 O. 10 O. 19 0.60 0.89 0.54 0.86

L

- -

M M

J

L

1

Total IV of simulatioar 1 Rel. #

Combinatioa

fI

PH

L L I H

128 4 1

MHLU

-

(D = MLVS$ E = pH) 1 EUgh 0.48 1 1 0.53 1 1 0.25 I 0.42 I

L H

110 25

MLUL

, Law

L

106 29

MLHLL

L

110 27

MLLHL

H

110 26

MLLLH

H

, 108 30

- MLHLH

H -~

134 28

MLLHH

L

11 1 3 1

MLHHL

1

IO0 1 135

O Cf) = AIL, E = FIC tirne)

a Where O and 1 are noted, the acniol values 0.0 1 and 0.99 were used, nqxctively.

0.85 j 0.15

CH, race @=MLVSS, E = p H )

H

115 32

MUMH

42 MHLLH

1

O

0.64 0.36

1 O

LQW Hkh

1

43 MHWIL

O

COD cffic 1 LQw 1 0.52 1 O 1 0.47

136 46

MHHLH

106 34

MHLHH

High 0.94

O. 75

116 35

MHHWI

L 1 1 O

0.73 0.27

1 -I

L 1 1 1

O 1 0.58

1 O

129 47

MHHHL

O

1 I

O

0.99 0.0 1

0.99 0.01

142 48

MHEMH

0.95 0.05

0.06 O 1 O O I

Page 68: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.13 Conditional Probabilitia Cont'd

I A = COD influent H I

I A = COD influent 1 1 H

1 I

Total CI of simulations 112 120 113 123 144 139 , 121 104 Ref. # 65 66 67 68 69 70 71 72

Combination HHLU HHLLH HHLtEL HHLKH HHHLL HHHLA HHHEiL EMHHH

' Where O and 1 are notai, the actual values 0.01 anJ 0.99 were usci, reqxctively.

Page 69: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Note that even though the probability values O and 1 may be calculated by the programs,

0.0 1 and 0.99, respectively, should be entered into the Bayesian software since a

probability value of O means that a particular situation is never possible.

Two sets of programs were developed to calculate the conditional probabilities for the

two subsets of the belief network in Figure 3.1 1. Figure 3.12 shows the subsets, which

were defined as Batch 1 and Batch 2 (each batch haviny the same parent variables).

Batch 1: Child variable being pH, and parent variables being Alk., COD infl.. tqcle,

F/C tirne and Vfl,.

Butch 2: Children variables being COD effic. and C h rate, and parent variables

being COD infl., tNCle, V&, MLVSS, and pH.

Figure 3.13 shows the structure of the programs that were developed to produce the

conditional probabilities in Table 3.13. The applications generated included:

genmrnrxxe - generates random numbers within the States of the input variables.

Simnprograrn.exe - allows the ANSBR model (simulator) to read the random numbers

generated fiom gennum.exe, and then generates values to be read by

the next application. Note that a newer version of the ANSBR

model (1 8/09/99) was used to calculate the conditional probabilities.

rea&irnmt.exe - reads the output values fiom Simnprogram.exe, and then calculates

the conditional probabilities for the BBN.

The number at the end of the name of the applications symbolizes the batch number.

The structure of the programs is similar for both batches. Figure C. 1 in Appendix C

combines al1 three prograrns in Figure 3.13 into one program, 0neprogranr.exe.

Page 70: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

A. Batch 1

B. Batch 2

Figure 3.12 Two su bsets of Bayesian belici network in Figure 3. L 1

Page 71: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

gennum2.ese

- generates fullgen2.out randorn 1

numbers

- altered simulatur reads the random numbers and

Asbrqrc. in Asbr-kin. in Asbr-sto. in

Figure 3. I l Prograns u s d for cakulating tbe conditional probabilities in the BBNs (Batch 1 prognms do not inclide the valumout file. Table C.1 describes the input and output files)

Page 72: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

ANSBR M d 1 Input Files

The ANSBR model input files Asbr-infin, Asb-n-in, Asbrgrcin, and Asb-o.in

in Figure 3.13 are similar to those in Table B. 1 in Appendix B. The Bayesian belief

network was designed for a stable reactor with the conditions in Table 3.14 (Asbr-ini.in

file), which were different fiom the conditions of the stable reactor in Table 3.1. The

reactor conditions in Table 3.1 (iMLVSS = 12,119 mg VSSL in 12 L) were used to verifi

the cause-effect relationships in the network. Mer continuous iterations of the network,

the middle range of MLVSS was changed fiom 12,000 mg/L to 20,000 mg/L. Therefore,

the conditional probabilities were calculated for a stable simulator reactor (produced as in

Section 3.2.2) in Table 3.14 with MLVSS being approximately 20,000 mgk. Table 3.14

is the Asbr-ini. in file in Figure 3.13.

Table 3.14 Stable simulator reactor conditions

for which the conditional probabilities w e n cakulateda

a Asbr-ini.in file in ANSBR model.

PH20 PATM

0.027 1

Page 73: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Fullgen. outfile

The output file,fullgen..oui, in Figure 3.13 contains the random numbers generated for

the input variables. These numbers are transfomed into the correct fonn to be read by

Simnprogram.exe. This file also shows the number of simulations that were generated

for each combination as shown in Table 3.11.

Ptob. outfile

The output file, prob.out, in Figure 3.13 contains the conditional probabilities to be

entered into Bayesian software such as HUGIN".

3.6.3 Prior Probabilities

The next nep in developing the BBN for the ANSBR was to determine the prior

probabilities, for the variables that have no parents. These variables are Alk., COD infl.,

t,,., FIC tirne, Vfl, and MLVSS. For the ANSBR prior pmbabilities represent a

summery of the evidence pior io any cycle. For example, given the records of an

existing ANSBR in operation, what is the probability of cycle time being in a medium

state, before operating the reactor? This information would be determined by examining

operating records. Hence, prior probabilities are specific to different reactors. Because a

mode1 was used to represent a lab-scale ANSBR, the pnor probabilities in Table 3.15

were chosen specitic for this project.

Page 74: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.15 Prior Probabilities

Through an iterative process, the prior probabilities in Table 3.1 5 were chosen by the

following strategy:

1. The states of the variables that were favourable for producing a more eficient

operating ANSBR were given the highest probability value (> 50%). This means that

most of the time the reactor was operated in these states. For example, since Shizas

(2000) showed that higher FIC time improves the performance of an ANSBR, it was

decided that the ANSBR would operate with a FIC time in the high range most (70%)

of the time.

2. The prior probabilities were adjusted such that the probability of achieving COD

removal efficiency > 85% and CI& rate > 12Lld at equilibrium state with no

evidence introduced into the network was greater than 50%. Therefore, the ANSBR

would be perfonning satisfactonly most of the time.

3. Because changing the prior probabilities changed the ranking of the probable causes

of an upset (Section 4.9, they were adjusted so that the most suitable ranking to the

designer of the network was chosen.

States

Low Medium Hinh

Alk

0.30

0.70

infl.

O. 10 0.60 0.30

F/C timc

0.30

O. 70

tmck

0.20

v p , 0.50

MLVSS

0.20

O. 80 0.60 O. 20 0.50

Page 75: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

3.7 Equilibrium State with no Evidcnce introduced into the Nehvork

Once the Bayesian belief network was designed for an ANSBR, the network was then

constructed in the Bayesian soflware, HUGLN~". Figure 3.14 ("Window Screen" in

HU GIN^) shows the beliefs of the states of the variables with no evidence introduced

into the network. These values were confirmed using M S B N ~ . As seen, the

probabilities of achieving COD efic. > 85Y0 and Cl& rate > 12 Lid, were 87.1 and

55.2%. respectively. Therefore, the simulated ANSBR was performing satisfactorily

most of the time. An interesting observation is the extremely high probability (88.3%) of

achieving a high state of pH (6.5 - 7.5). which is important for the efficient operation of

an ANSBR.

Note that the probabilities of the states of the operational (parent) parameters are

identical to the prior probabilities in Table 3.15. These would change only if evidence is

introduced into the network influencing the certainty of one of their children variables

(e.g., C h rate is low).

3.8 Program Developed for Prognoais of BBN

The main goal of this project was to develop a BBN to diagnose upsets in a stable

ANSBR. However, the network could also be used to predict the likely effects (e.g., low

COD removal efficiency) of a cause (e.g., high if used in the predicting (fonvard)

mode. For example, if bc,, is in a high state, the probability of achieving COD removal

efficiency > 85% was calculated to be 94.5 % (an increase fiorn 87.1 % before evidence

was introduced), while that for achieving methane production rate > 12 Ud was

cdculated to be only 27.4 % (a large decrease From 55.2 % before evidence was

Page 76: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

44.81 Low

10.00 Low 60.00 Ye&im 30.00 tibh

FCtLne (FUime) 30.00 Low 70.00 Hl(lh

(nrcw

60.00 Meaium

Figure 3.14 Pmbabilities at Equilibrium State with no Evidence introduced into the BBN

Page 77: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

introduced). Hence, it could be concluded that giving the definition of the states of the

variables in Table 3.1 1 for the ANSBR, and given the pt-ior probabilities of the

operational parameters, a high state of twcJ, would generally increase the probability of

high COD removal efficiency occumng most of the time (> 50%). However, the

probability of high methane production rate generally decreases. Even though the

existing hi SBR rnodei predicts the effects of çhanging operational variables, the BBN

network would be specific to the ANSBR that it was designed for, and so questions about

the significant effects of changing an operational variable could be answered with the

click of a few buttons in HUGM" or MSBN*"

The network developed in M S B N ~ ' ~ was combined with Visual Basic to produce a

user-fiiendly executable program that analyzes the BBN in prognosis (predictive) mode.

Appendix E shows a printout of the prograrn. The "Entering Evidence" window screen

shows the state "unknown" for each variable, which simply means that no evidence is

known about that variable. Clicking on a circular icon next to the state of any variable is

interpreted as entering evidence into the network about that variable. The "Results"

window screen produces the updated probabilities of the states of COD removal

eficiency and methane production rate.

3.9 Future Expansion of the BBN

For this project, only the variables that could be represented in the existing ANSBR

model were used in the network, because the goal was to use the model to calculate the

conditional probabilities. Since modifications could be made to a BBN without any

Page 78: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

major adjustments of the entire system, the network could easily be expanded to include

other variables.

3.9.1 variables and Relationships

Figure 3.15 shows an expanded version of the network. The variables in the network

are listed in Table 3.16. There are twelve additional variables including organic loading,

granulation, recycle gas flow rate, enhancement, surface tension, temperature, minerals

such as calcium, water absorbing polymers, cationic polymers, sludge wasting, inhibition

(extemal), and dilution.

t,,~,. V& and COD infl. affect the organic loading (fiom Equation 2.2) of a reactor.

Therefore, to reduce the arnount of arrows in the network, the first three variables could

be linked to an organic loading node.

The granulation node in Figure 3.1 5 is attached to the pH node since granulation

increases the hydrogen consumption rate (hydrogen removing microorganisms are in

close proximity to the hydrogen producing organisms). This prevents an increase in the

hydrogen partial pressure inside an ANSBR, and hence the problems of increased VFAs

and lowered pH.

A steady recycled gas flow rate pennits constant mixing of the contents inside the

reactor without breaking up the granules, hence increasing granulation. Section 2.1 - 1

mentioned other factors that enhance granulation. These factors include surface tension,

temperature, minerals such as calcium, water absorbing polyrners and cationic polymers.

The actual enhancements are attached to an enhancement node to decrease the

number of parents of the granulation node. The process of inseriing intermediate

Page 79: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Figure 3.15 Expandcd Bayesian &licf Network for Anaerobic Ssqucncing Bitch Rcactor

Page 80: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 3.16 Variabla in the network in Figure 3.15

1 Sym bol 1 Variable 1 Units 1

1 CODeffic. 1 COD removal efficiency 1 VO 1

Alk. Apolyrner

r

CH, rate

1 F/C tirne 1 Feedlcvde time 1 1

1

Alkalinity Water absorbing polymen Methane production rate

COD infl. C pol ymer Dilution

Enhancement

m g L as CaC03 mol/L or g/L

Lld

influent COD Cationic polymers

Dilution Enhancement

Gasflowrate Granulation Inhibition

mol/L or g/L

-

Minerals 1

MLVSS

Recycle gas flow rate Granulation Inhibition

Org. load L

off

1 f wc~e 1 Cycle time 1 hours 1

ml/ min ,

mm J

moVL or a/L rninerals

rnixed liquor volatile suspended solids

Sludge wasting S tension

moüL or ZJL mg V S S L in V,

Organic loading oH

collection nodes is called divorctng the nodes, Le., separating the parents fiom the child.

This would decrease the complexity of the network. Organic loading also affects

granulation.

Increasing granulation and decreasing sludge wasting would increase the sludge

retention time of an ANSBR and hence, increase MLVSS (Section 2.1.1). Inhibitory

compounds such as heavy metals in the incoming wastewater could inhibit the activity of

the organisms inside the reactor, thus decreasing COD removai ef'fxiency and methane

B/Ud

Sludge wasting Surface tension

Temp.

VdY

rndrnin mN/m

Temperature V filVVreact

O C

Page 81: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

production rate. Increasing the recycle flow into the reactor would increase the dilution

of the incoming wastewater strearn and hence, decrease COD influent.

If these new variables could be represented in a Future version of the ANSBR model,

then their relationships between the nodes in the network would be venfied using the

model as in Section 3.2.2. Another variable that could still be added to the BBN

includes equipment failure (e.g., pump breakdown).

3.9.2 States or the Variables

The states of the variables could be low, medium and high, or low and high. The

inhibition variable could have the states, present and absent, if the presence of a

compound, regardless of its concentration (hence, low and high states are not

appropriate), would inhibit MLVSS. The states of two variables, granulation and recycle

gas flow rate, are discussed below.

Grumlariofr

Generall y, granular sludge consias of roughly sphencal grains, approximately 1 to 3

mm in diameter (Hulshoff Pol et al., 1986). Banik et al. (1997), were able to grow

granules in an ANSBR with typical diameters between 1 .S and 2.5 mm, while Yan and

Tay (1 997) were able to grow granules wit h typical diameters betwem 1 .O and 4.0 mm,

with an average of 2.6 mm. Hence, low and high granulation ranges could be defined as

< 2.6 mm, and > 2.6 mm, respectively .

Page 82: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

By adjusting the biogas recirculation rate, the mixing intensity that was maintained in

an ANSBR operated by Sung and Dague (1995) was at an energy gradient (G) of 100 s-'.

Using this G value, the recycle gas flow rate was calculated to be 1093 &min

(Appendix F). Note that if the flow rate is tw high, then the granules could be broken

up, while if the flow rate is too low, then the rate of granulation development would be

lessened due to the reduced contact between the biomass to form granules. Hence, more

research needs to be done to determine appropriate ranges of the States of this variable.

3.9.3 Probabilities

The prior probabilities would be determined as in Section 3.6.3. The conditional

probabilities would have to be determined by expert knowledge and/or experiments

unless the new variables could be represented in the ANSBR model as in Section 3.6.2.

if expert knowledge is the met hod used, then the probabilities would be estimated using

knowledge about anaerobic wastewater treatment in an ANSBR. These probabilities

would be adjusted during the testing of the robustness of the network until an accurate

network is achieved.

Page 83: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

4. TESTING TECE ROBUSTNESS OF THE BAYESIAN BELIEF NETWORK

4.1 Ovetview of Evaluation Process

Once the Bayesian belief network in Figure 3.1 1 was designed and developed in the

BBN software, it had to be evaluated. To test the performance of the belief network, the

ANSBR simulator was perturbed until upsets occurred. Upsets were defined as COD

rernoval etriciency < 85%, andor CI& rate c 12 L'd. The BBN was then used to

diagnose the most probable cause@), and actions were taken to correct the upsets. The

results were then observed to determine if the network was perfonning satisfactory.

Before evaluating the application of the BBN to diagnose upsets in the ANSBR

simulator, the following were done:

Evidence about the states of the operational variables was introduced in the network,

and the prognosis results were checked for logical flaws.

A flow chart was presented to assist the reader when diagnosing the most probable

cause@) of upsets in the ANSBR. Evidence of upsets in the ANSBR was introduced

into the network, and the diagnostic results were checked for logical flaws.

Mer analyzing the performance of the Bayesian belief network, the prior

probabilities were changed to show how the capabilities of the belief network changed.

4.2 f redictive Tool

Table 4.1 shows selected prognosis results of the BBN. It shows how the Bayesian

belief network could be used as a predictive tool to detemine the effects of changing the

operational parameters in the ANSBR Case Ong. shows the probabilities of the

Page 84: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 4.1 Sdceteâ Pmgmosis Rmults of the BBN

Optmtional Varia bla Output Variabks A k COD infl. F/C timc V/Vr MLVSS pH COD cfft. CH, rate

# Lowl Aigh ~ o w l Md. 1 High L O W ~ ~ c d . 1 High Lowl Higb b w l High L O W ~ Wgh ~ o w l t l i g h - ~ o w l High LOW~ Hi@

1 Unlavourrblt and favourablt conditions Cor CHI rate

1 Unfavounblc and favourable conditions for COD removal eîlicicncv

The bold areas show where evidence is introduced into the belief network.

Page 85: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

variables at the equilibrium state (identical to the probabilities in Figure 3.14) when no

evidence is introduced into the network. Equilibriurn state means that if the probabilities

are recalculated, then the same values would be obtained unless evidence is introduced in

the network. As seen, the probability of achieving high states of COD removal eficiency

and C& rate (as defined in Table 3.11) were 87.1% and 55.2%, respectively. Because

these values were greater than S0%, the simulator ANSBR can be said to be operating

eficiently most of the time. When evidence of the state of a variable is introduced into

the network, the network would irpdate the probabilities of the states of the variables and

would be in a new equilibrium state.

Cases #l to #14 show the prognosis results when evidence was introduced (entered as

100%) into the network about the states of the individual operational variables. Case

Orig. shows that a high state of V& was calculated to occur 50% of the time (prior

probability). That is, if the records were kept for 100 cycles of operating the ANSBR,

then 50 cycles were operated with ViNr > 0.3. If the effects of operating VIN, > 0.3 on

the next cycle were to be detemined, then it means that VfN, would definitely be high,

and so the probability of Vfl , being high would be 100%. Case #12 shows that when

VrN, is high, the probability of COD removal eficiency being high (> 85%) decreases

fiom 87.1 to 78.9 %, but the probability of C b rate being high (> 12 Wd) increases fiom

55.2 to 76.8%. An interesting observation is that the probability of COD removal

efficiency being high decreased, but is still greater than 50%. This result occurred

because the prior probabilities were favourable for high COD removal eficiency, given

high VIN,. The fact that COD removal eficiency decreased from 87.1% (Case Orig.) to

785% (Case #IO), means that generally (for most of the combinations of the states of the

Page 86: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

operational parameten), increasing Vfl, wouM decrease COD removal eficiency (but

not necessarily below 85%). Therefore, the BBN could be used to determine the effects

of changiiig the operational parameters in an ANSBR.

Cases #1 to #14, show that for the prior probabilities in Case Orig., changing

evidence about the states of the operational parameters individually. did not decrease the

probabiiity of high COD removal rficiency below 50%. However, Cases #3,#S, and

# I 1, showed that low COD influent, high kT,i,, and low V/V, would most likely cause

C h rate to decrease to < 12 L/d.

Cases # 1 to # 1 4 show that the following states of the operational variables are

generally unfavourable for achieving high COD removal eficiency (note that this is

based on the small probabilit y changes but still reasonable):

low alkalinity, which is logical because a low alkalinity allows the pH in the reactor

to decrease to levels which inhibit the activity of the microorganisms in the reactor as

discussed in Section 2.1.1.

high COD influent, low t,,,,, and high Vfl,, which are expeaed because they

produce a high organic loading which could affect the COD removal emciency as

discussed in Section 2.1.1.

low F/C time, which makes sense because low F/C time means more shock loading,

and so the VFA production rate would exceed the VFA consumption rate and hence

pH would decrease, producing the same effects as low alkalinity.

low MLVSS, which follows theory because fewer microorganisms in the reactor

decreases the rate of substrate (COD) removal.

Page 87: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Cases # 1 to #14 also show that the following states of the operational variables are

generall y unfavourable for achieving high C h rate:

low alkalinity, which is logical because a low alkalinity allows the pH in the reactor

to decrease to levels which inhibit the activity of the methanogens in the reactor as

discussed in Section 2.1 . 1 .

low COD influent, high tqcle, and low ViiVr, which are expected because they

produce a low organic loading which could affect the C h rate as shown in Equation

3.8.

low FIC time, which makes sense because low F/C tirne rneans more shock loading,

and hence pH decreases producing the same effects as low alkalinity.

a low MLVSS, which follows theory because fewer microorganisms in the reactor

decreases the rate of substrate (COD) conversion to methane.

Case # l S in Table 4.1 shows the combination of the states of the operational

parameters that would most likely produce the lowest C& rate - P(C& rate < 12 Ud) =

99.0%. Case #16 shows the combination of the states of the operational parameters that

would most likely produce the highest C h rate - P(C& rate > 12 U d ) = 99.0%. These

results combine the prognosis results from Cases 1 to 14. and are logical.

Case #17 shows the combination of the states of the operational parameters that

would most likely produce the lowest COD removal eficiency - P(C0D removal

efficiency < 85%) = 97.9?/0. Case #18 combines the states of the operational parameters

that were defined as favourable fkom the prognosis results in Case #l to #M. The

probability of achieving high COD removal eficiency is 98.5%. However, it was

discovered that if alkalinity, F/C time, and MLVSS were al1 in a high state, and V&, was

Page 88: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

in a low state, and the organic loading increased by increasing COD influent andfor

decreasing tqcle, then the COD removal efficiency would likely increase. For example. if

COD influent is in a medium state and bel, is in a high state, Case #18 shows the

probability of achieving high COD removal eficiency to be 98.5%, while if COD

influent increases to a high state and tqcl, decreases to a medium state, the network

increases the probability of high COD removal eficiency ro 98.7% (Case #19). This is

because the operational variables were in states such that a higher organic loading (more

substrate being available to the microorganisms per litre) in the reactor, would increase

the growth and activity of the microorganisms.

Therefore, it should be carefully noted that when using the BBN as a predictive tool

to determine the effects of changing the operational parameters in the ANSBR (which

would be rnanually done by the ANSBR's operator), that the states ofall the operational

panmeters should be entered as evidence into the network. This is because different

combinations of the states of the operational parameters could produce diflerent results

(the microbiological community in an anaerobic treatment system is very cornplex).

Case #20 shows that increasing the organic loading even more, by decreasing to

a low state, the network decreases the probability of achieving high COD removal

efficiency to 96.5% (still very high), but increases the probability of achieving C& rate >

12 Ud to 92.0%. Therefore, Case #20 shows the states of the operational variables that

produced the highest belief in COD removal eficiency > 85% and C h rate > 12 Lld, at

the same tirne. These states include high alkalinity, high COD influent, low tqc1, high

F/C time, low Vm, and high MLVSS.

Page 89: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

It is thus evident that the Bayesian belief network could be used as a predictive tool to

detennine the effects of changing the operational parameters in the ANSBR. No logical

flaws were discovered in the network.

4.3 Diagnostic Tool

The Bayesian belief network could also be used as a diagnostic tool to diagnose

upsets in the ANSBR. Evidence of upsets and of the states of the operational variables

was introduced into the network, and the diagnosis results were checked for logical flaws.

4.3.1 Analysis Criteria For Diagnosing Upsets

Figure 4.1 shows a flow chan to assist the reader when diagnosing the most probable

cause(s) of upsets.

4.3.2 Diagnosing Upsets in the ANSBR

Evidence of upsets and of the states of the operational variables was introduced into

the BBN, and the diagnostic results were checked for logical flaws (Table 4.2). Using

these diagnostic results, actions would be taken to correct causes of upsets in a perturbed

ANSBR simulator (Section 4.4).

Case Orig. is the equilibrium state of the network with no evidence introduced.

When evidence is introduced into the BBN, the flow chart in Figure 4.1 can be used to

determine the most probable cause@) for upset. Table 4.2 shows selected diagnostic

Page 90: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Enter evidence into BBN. Determine the probabilities of the states of the variables for the new equilibrium state (state n). Calculate the increase in probability of the states of the variables (except medium state of COD infl. and tvcle) between the previous (n - 1) and new (n) equilibrium states.

More than 1 variable has a That variable is the most -1 pmbability incresse > 4%? probable cause.

w

1 Compare the probability increasei for these variables.

Increase in probability > 4%? '

The difference in probability increase Variable with the highest

between the variables > 4%? probability increase is the most probable cause.

No b Next page

Calculate the increase in probability of the states of variables between previous (n - 2, n - 3, etc.) and new (n) equilibrium states.

Increase in probability > 4%? I/ The variable with the highest probability at the existing equilibrium state is the most probable cause.

Figure 4.1 Fîow Cbart for diagnosing the most probable caure(s) of upsets

No No

Are the probabilities identical? 1

Ycs

Choose the variables in the following order: F/C time, V f l , b c i * MLVSS, COD infl.. and Alk..

Page 91: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Increase in probability > 4%? 1 Calculate the increase in probability of the states of variables between previous (n - 2, n - 3, etc.) and new (n) equilibriurn states.

More than 1 variable has a That variable is the most probability increase > 4%? probable cause.

Other information (e-g.. variables) needs to be added to the BBN.

=

Figure 4.1 Cont'd Flow Chart for diagnosing the most probable cause@) of upsets

Increase in probability > 4%?

Yes

. No . No Yts

Variable with the highest probability increase is the most probable cause.

Y a * + The difference in probability increase between the variables > 4%?

Page 92: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 93: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

results. The nomenclature A, B, C and D represent the diagnostic results for different

types of upset :

A - COD removal eficiency is low.

0 B - C h rate is low.

C - Both COD removal efficiency and C h rate are low.

D - pH is low.

Upset - Low COD nmovul enciency

Case A 1 - No other evidence introchrced

Case Al shows the diagnostic results if a low state of COD removal eficiency is

observed in the ANSBR. Comparing the probabilities in Case Orig. to Case Al, there

were increased expectations of unfavourable states for achieving high COD removal

eficiency: low alkalinity (30.0 to 37.1%). high COD influent (30.0 to 59.9%), low teCie

(20.0 to 37.3%), low FIC time (30 to 43.9%). high VdV, (50.0 to 8 1.5%), and low

MLVSS (20 to 30.4%), which are al1 logical as discussed in Section 4.2.

The probability of pH being low also increased fiom 11.7 to 68.8% which is expected

because low alkalinity and F/C time, and high organic loading (high COD influent, low

tnçic and high V&) decrease pH as discussed in Section 2.1 - 1 . Note that the pH

probabilities are not of great concem because it is an intermediate variable and is

controlled only by its parents.

A very interesting observation was that the network increased the probability of

achieving a high C h rate. Before explaining this phenornenon, it is important to

remember that d l the results in Table 4.2 are specific to how the ranges and States of the

Page 94: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

variables (important for calculating the conditional probabilities), and the prior

probabilities were al1 defined. Explaining the reasons for the increase in the probabilities

of the unfavourable states of the operational parameters due to low COD removal

eflkiency is known as diagnosic reasonirig (explaining the cause of the effect). To

explain the reason for the increase in the C h rate given low COD removal efficiency,

diagnostic reasoning followed by prediCtive rtiuso~li~~g (explaining the effect of the cause)

would have to be examined. Earlier it was discovered that a low COD removal efficiency

could be caused by a high organic loading produced by high V$V,, high COD influent

and low t,~,. Using predictive reasoning, a high organic loading would increase the C h

rate unless the negative effects of pH and MLVSS on C h rate are large enough to

decrease the CHJ rate, which was not the case.

The probabilities of the unfavourable states that increased the most when evidence

was introduced that COD removal efficiency were low alkalinity (7.1%), high COD

influent (29.9%), low kyci. (17.3%), low FIC time (13.9%), high VINr (3 1.5%), and low

MLVSS (10.4%). Because the probability increase of high V& is within 4% that of

high COD influent, then following the flow chaxt in Figure 4.1, high VtWr is the moa

probable cause of low COD removal eficiency, since the probability of high VdV,

(8 1.5%) is greater than that of high COD influent (59.9%). Therefore, the firn step to be

taken to solve the problem of low COD removal efficiency would be to decrease V&.

The other probable causes (in decreasing order of importance) for low COD removal

efficiency, given that no other evidence is introduced into the network, are high COD

influent, low F/C time, low low alkalinity, and low MLVSS.

Page 95: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Case A2 - Evidertce of high Vfl,

If it is decided that Vfl, must be high to keep a high organic loading (as will be seen

in Section 4.4), then evidence is introduced into the network that VF: is high. Case A2

in Table 4.2 shows that the only probability increase greater than 4% was high COD

influent (59.9% to 67.1%). Therefore, COD influent should be decreased to decrease the

organic loading, and hence increase COD removal efficiency.

Case A3 -- Evidence of medium C1OD injucnt

Case A3 shows the diagnostic results if COD removal efficiency is low and evidence

is introduced that Vfl, is high, and COD influent is in a medium state. Comparing Case

A2 to A3, the network increased the expectations of low alkalinity (38.2 to 49.3%), low

tLyci.(37.3 to 49.1%), low FIC time (45.2 to 55.9./0), and low MLVSS (30.4 to 38.7%).

Because the difference in probability increase between these variables were within 4%,

the increase in probabilities fkom Case A 1 to Case A3 should be compared. Table 4.2

shows that the network increased the probabilities of low alkalinity, low t,,le, low FIC

time and low MLVSS by 12.2, 1 1.8. 12.0 and 8.3%. respectively. Once again, the

difference in probability increase were al1 within 4%. and so the increase in probabilities

of the variables fiom Case Orig. to Case A3 should be compared. Table 4.2 shows that

the network increased the probabilities of low alkalinity, low t,i,, low FIC time and low

MLVSS by 19.3, 29.1, 25.9, and 1 8.7%, respectively. Because the difTerence in

probability increase between low bClC and low FIC time was within 4%, the probabilities

of these aates in the present equilibrium state. Case A3, were then compared. The

probability of low (49.1%) was lower than that of low FIC time (55.9%) in Case A3.

Page 96: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Therefore, if COD removal efficiency is low and evidence is introduced that Vflr is high

and COD influent is in a medium state, then F/C time should be increased.

Case A4 - Evidence of high F C tirne

Case A4 shows the diagnostic results if COD removal eficiency is low and evidence

is introduced that VtNr is high, COD influent is in a medium state, and FiC time is high.

Comparing Case A3 to A4, the network decreased the probability of low alkalinity (49.3

to 45.2%), but increased the probabilities of low tLTCi,(49. 1 to 63.6%) and low MLVSS

(38.7 to 49.6%). That is, the network increased the probabilities of low tecl, and low

MLVSS by 1 4.5 and 1 O.9%, respective1 y. Because the difference in probabilit y increase

was less than 4%. the increase in probabilities of these two variables, from Case A2 to A4

should be compared. Table 4.2 shows that the network increased the probabilities of low

tqci. and low MLVSS by 26.3 and 19.2%. respectively. Therefore, tvCl, should be

increased.

Case A5 - Evidence ojmediicm t,ic

Case A5 shows the diagnostic results if COD removal eficiency is low and evidence

is introduced that Vfl, is high COD influent is in a medium state, F/C time is high, and

t,ie is in a medium state. Comparing Case A4 to A5, the network decreased the

probabilities of the remaining two operational variables, Le., low alkalinity (45.2 to

35.5%) and low MLVSS (49.6 to 44.2%). Therefore, the increase in probabilities from

Case A3 to AS should be compared. Table 4.2 shows that the network decreased the

Page 97: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

probability of low alkalinity by 13.8%, but increased the probability of low MLVSS by

5.5%. Therefore, MLVSS should be increased.

Case A6 - Evidence of high ML VSS

Case A6 shows the diagnostic results if COD removal efficiency is low and evidence

is introduced that V& is high, COD influent is in a medium state, F/C time is high, tLy,i.

is in a medium state, and MLVSS is high. Comparing Case A5 to A6, the network

increased the probability of low alkalinity (35.5 to 37.6%).

Because the probability increase was less than 4%, the increase in probability

between previous equil ibrium States was then compared (starting wit h the most recent

one) and the existing equilibnum state (Case A6). Comparing Case Orig. to A6, the

network increased the probability of low alkalinity (30 to 37.6%). Therefore. alkalinity

should be increased.

If increasing alkalinity still does not tix the problem, then other variables, such as

granulation or inhibition, need to be added to the network.

Upset - L m CH4 rate

Case BI - No othrr evidence i n t r d ~ c e d

Case B 1 shows the diagnostic resuits if a low state of C h rate is observed in the

ANSBR. Comparing the probabilities in Case Orig. to Case B 1, there were increased

expeaations of low COD influent (10.0 to 20.7%), high tqCir (20.0 to 32.4%), and low

Vfl, (50.0 to 74.1%)- which are logical since low COD influent, high b,ic, and low

Vfl, produce a low organic loading which could decrease the C h rate < 12 Ud.

Page 98: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

The increase in the probabilities of the unfavourable states (as discussed in Section

4.2) of the other operational variables (low alkalinity, low FIC time, and low MLVSS)

were less than 4%. This means that for the existing stable ANSBR, organic loading is the

most important factor affecting the C& rate. Equation 3.8 shows that as organic loading

increases C h rate increases unless COD removal eficiency is low enough to cause a

decrease in CI& rate. Case B 1 in Table 4.2 shows that the probability of achieving COD

removal eficiency > 85% is extremely high (92.6%). suggesting that organic loading

being low is the most probable cause of Ctç rate < 12 Ud.

Because the increased expectation of low VIN, is much greater than the other

variables, the first step to be taken to solve the problem of low C& rate, would be to

increase Vfl,. The other probable causes in decreasing order of importance for low CH4

rate, given that no other evidence is introduced into the network are high t,,~,, and low

COD influent.

Case B2 - Evidmce of htgh VINr

If VIN, is actually high, then the network increases the probability of tqCi, being high

(32.4 to 45.1%) and COD influent being low (20.7 to 37.5%). Comparing both variables

we observe a greater probability increase for low COD influent (16.8%) than for high

kYcli. (12.7%). Hence, COD influent should be increased.

Case 8 3 - Evidence of mediun, COD influent

If COD influent is actually medium, then the network incteases the probability of

tqCi king high (probability increase > 4%). Hence, bc,, should be decreased.

Page 99: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Case B-I - Evidence of medium t,,,

If tWs is actually medium, then the network increases the probability of FIC time

being low (probability increase > 4%). Hence, FIC time should be increased.

Caîe B5 - Eviderice ofhigh F C fime

If FM: time is actually high, the network does not increase the probabilities of the

unfavourable states of the other two remaining operational variables (low alkalinity and

low MLVSS). Therefore, other variables, such as granulation and inhibition, need to be

added to the network to properly diagnose C h rate c 12 Lld in the ANSBR, if COD

influent and tLyc~, are in a medium state, and. FIC time and V$V, are in a high state.

Upsets - L m COD removal effieiency und low CH4 rate

Case Ci - No other evidence introdlmd

Case C 1 in Table 4.2 shows the diagnostic results if low states of both CH( rate and

COD removal efficiency are observed in the ANSBR at the same time. Cornparhg the

probabilities in Case Orig. to Case C 1, there were increased expectations of low

alkalinity, low F/C time and low MLVSS which are logical since the states of these

variables could produce a COD removal efficiency < 85%, and hence, a CH4 rate < 12

L/d. There was also an increased expectation of low COD influent, which is also logical

since it produces a low organic loading which could decrease the C h rate < 12 Ud.

Since the increased expectation of low COD influent is much greater than the other

variables, the tirst step to be taken to solve the problem of low COD removal efficiency

and low C& rate occumng at the same time, would be to increase COD influent. The

Page 100: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

other probable causes in decreasing order of importance for low COD removal eficiency

and low C h rate given that no other evidence is introduced into the network, are low F/C

time, low MLVSS, and low alkalinity.

Case C2 - Evidence of medium state of COD influent

if COD influent is actually in a medium state, the network decreases the probabilities

of high tqCle and low MLVSS, but increases the probabilities of low alkalinity, low F/C

time, and high VdV,. The probability increases for low F/C time and high VdV, were

greater than 4% of the probability increase of iow alkalinity (comparing Cases C I and

C2). However, because the difference in probability increase between low F/C time and

high V& was within 4%, the increase in probabilities of these two variables from Case

Orig. to C2 were compared, with the conclusion that FIC time should be increased.

Case C3 - Evidmce of high F C tirne

If F/C time is in a high state, the network increases the probabilities of high &,le and

low Vfl,. Cornparhg both variables we observe a greater probability increase for low

V N , than for high bck. Hence, Vfl, should be increased.

Case C4 - Evidence of high b>'gl.;

If Vfl , is actually high, then the network increases the probabilities of low alkalinity

and high tqcic. Because the difference in probability increase was within 4%, the

probability increase of the States of both variables were compared between Cases C2 and

C4, with the conclusion that should be decreased.

Page 101: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Case CS - Evidence of medium t-

If tqc1e i s actually in a medium state, then the network does not increase the

probabilities of either low alkalinity or low MLVSS greater than 4% (comparing Case C4

to CS). Comparing Case C3 to C5, the difference in probability increase between these

two variables was less than 4%. Comparing, Case C2 to CS, the increase in probability

of oniy MLVSS was greater than 4%. Therefore, MLVSS should be increased.

Case C6 - Evidence ojhigh ML k'SS

Case C6 shows that if MLVSS is high, the network increases the probability of low

alkalinity. However, since the increase in the probability was less than 4%. the increase

in the probability between previous equilibriurn States (staiting with the most recent one)

and the existing equilibrium state (Case C6) was cornpared. Comparing Case C3 to C6,

the network increased the probability of low alkalinity greater than 4% (34.2 to 42.1%).

Therefore, alkalinit y should be increased .

LmvpH

Even though pH is an intermediate variable, the probable causes of achieving a low

pH could be obtained fiom using the BBN. Case Dl shows that the moa probable causes

of low pH in descending order are high COD influent, high V&, low F/C time, low

alkalinity, and low bcic (fiom the Analysis Criteria in Section 4.3. l), which are al1

logical .

0 High V&, high COD influent, and low bcie produce a high organic loading which

could cause the pH to decrease (Section 2.1.1).

Page 102: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

a Low alkalinity allows pH in the reactor to decrease.

a Low F/C time means shock loading, and so the VFA production rate would exceed

the VFA consumption rate causing the pH to decrease (Section 2.1.1).

It is thus evident that the Bayesian belief network could be used as a diagnostic tool

to diagnose upsets in the AVSBR. No logical fiaws were discowred. In addition, each

of the operational parameters were diagnosed as possible causes of some of the upsets.

This shows that al1 of the variables in the network are important for ANSBR technology

and that the cause-eRect relationshi ps in the network are correct.

There were however, certain combinations of the States of the variables for which the

BBN could not diagnose any possible cause of upset. Therefore, other information (e.g.,

additional variables) needs to be added to the belief network.

4.4 Application of the BBN

The main way of evaluating any Bayesian beliefnetwork is to apply it to the system

for which the network was designed. and analyze its performance. To test the

performance of the belief network, the ANSBR sirnulator was perturbed until upsets

occurred. Without any bias, the ANSBR simulator was run using different values of the

operational parameten and the following were recorded: pH, COD removal efkiency

and Ci& rate. Note that the pH was recorded, but because it is an intermediate in the

BBN, it is controlled by the operational parameten.

The BBN was then useâ to diagnose the most probable cause(s) of upsets, and actions

were taken to correct the upsets. For example, if a low cycle time was the most probable

Page 103: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

cause of an upset, then increasing the cycle time to a value in medium state could

properly correct the upset. The results were then observed to determine if the network

was performing satisfactory.

Table 4.3 shows the simulation results for different operational conditions (randornly

chosen). They were grouped according to the different types of upsets that occurred.

Table 4.4 shows a summary of the diagnostic results in Table 4.2 that were applied to this

section.

A. Upset - COD renioval efficicncy is lm, V/V, 0.3

Run #1 in Table 4.3 shows the stable ANSBR simulator performing satisfactorily.

The COD removal eficiency is 97.4% (> 85%) and the methane production rate is 14.5

Ud (> 12 Ud). Run # 2 shows the upsets that occurred when the operational parameters

were changed. As seen, the COD removal eficiency decreased to 54.8% (< 85%).

Case Al in Table 4.4 shows that when evidence was introduced into the BBN that COD

removal effkiency is low, the network diagnosed high V$V, to be the most probable

cause of upset. Hence, the situation could be solved by decreasing V/Vr. However, if it

was decided that VIN, must be fixed at 0.5 to keep a high organic loading, then evidence

would be introduced into the network that V& would remain high (> 0.3). When this

was done, the network predicted that COD influent was in a high state (Case A2). But

from Run #2, COD influent was actually in a medium Gate (8,000 m@). So this extra

piece of evidence was entered into the network, and it predicted that F/C tirne was low

(Case A3).

Page 104: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 4.3 Simulation Results of an ANSBR'

Run #

A. Upset - COD removal efticiency is low, V f l , > 01

1 I 2 1 3 I 4 1 5 I 6 Operational Variables

pH C

COD effic. (N)~

CH, rate ( ~ d ) '

Operl Alk. (mg/L as CaC03) 1 2000

Alk. (mfl as CaC03) COD infl. (mglL)

tvCk (hours) F/C time

L

V f l r MLVSS (mg/L)

1 Run #

COD infl. (mfl) 15000

t w ~ c (hours) 18

Out~ut Variables

3500

10000 18

0.50 0.25

20143

100

8000

18 0.10

0.50

6000

7.0

91.4

14.5

A. Upset - COD removal efficiency is low, Vfl, < 0.3 7 I 8 I 9 1 10 I 11 I 12

I FIC time 1 0.25

MLVSS (m@) 1 20143 ou

1 00 8000

18

0.75

0.50

6000

4.2

54.8

13.2

COD effic. (%lb CH, rate (Lld)' 24.5

tional Variables too0 I loo I loo I loo I loo

,

100

8000 18

0.75

0.50

25000

4.6

66.5

16.0

.nut Variables I

" Using ANSBR model (Bagley and Brodkorb, 1999). The ranges of the states of the variables are in Table 3.1 1. Table G. 1 in Appendix G shows the selected parameters to be entered into the ANSBR model.

b Using Equation 3.7.

Using Equation 3.8.

LOO 1 1000 14

0.50

0.50

25000

6.6

97.6

23.5

4000

11000 14 0.50

0.50

25000

5 .O

76.4

31.9

7.0

95.0

39.7

Page 105: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 4.3 Conted Simulation Results of an ANSBR'

1 B. U ~ s e t - CHA rate is low 1 1 rn w

1

I Run # 1 13 1 14 1 15 1 16 1 7 1 18 1 19

1 C. Upsets - COD nmoval efliciency and CH4 1 D. Prognosis 1

Operational Varia bits

1 rate are low 1 Results 1

Alk. (mg/L as CaC03) COD id. (ma)

1

tqC* (hours) FIC t ime

L

VdY I

MLVSS (m*) I

I Run # 1 2 0 1 2 1 1 22 1 23 1 24 1 25 1 26 1

3500

10000 18

0.50 O. 15

20143

" Using ANSBR model (Bagley and Brodkorb, 1999). The ranges of the States of the variables are in Table 3.1 1 . Table G. 1 in Appendix G shows the selected parameters to be entered into the ANSBR model.

b Using Equation 3.7.

' Ushg Equation 3 -8.

Output Variables

Operational Variables

3500 10000

18 0.50

0.35

20143

pH 1

COD effic. (%lb CH, rate (L/d)'

3500 3000

18

0.50 0.35

20143

7.0

96.3

11.9

1 O0

6000 18

0.45 0.50

25000

L

Alk. (mg/L as CaCO,) COD i d . (mglL)

t q C k (heurs) FIC time Wh

MLVSS ( m a ) r

7.0

97.2

8.7

1 O00

6000 18

O. 75

O. 50

6000 Output Variables

3500

7100 22

O. 10 0.35

20143

7.0

97.2

12.0

1 O0

6000 18

0.45 0.50

6000

1 O0 4000 18.0

0.10 0.50

6000

4000

8500 36

0.575 O. 175 30000

7. O

97.4

20.2

1000

6000 18

O. 10 O. 50

6000

4000

18000 18

0.575 0.175

30000

pH COD effic. (%lb CH, rate (Ud)C

3500 7100

22 0.75 0.35

20143

7.0

95.6

6 8

6.7

94.5

9. 3

4.6

56.5

10.5

5.0

58.8

7.6

6.8

98.3

9.6

1000

5500 22

0.75 0.35

10000

5000

5500 22

0.75 0.35

40000

6.7

8&4

Id4

7.0

98.5

4.1

7.0

98.7

8.7

4.7

64.0

11.8

6.7

98.2

26s

Page 106: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 4.4 Summary of Diagnostic Results in Table 4.2'

A. Upset - COD nmoval efbiency b low A l 1 COD effic. = L 1 Vfl, = H 1 Decrease Vf l r

Case #'

1 A4 1 F/C time = H 1 fwcie = L 1 Increase tWl, 1

Evidence entend into BBW

A2 I

A3

- --

1 A5 1 twle = M 1 MLVSS = L 1 tncrease MLVSS 1 A6 1 MLVSS = H 1 Alk. = L 1 Increase Alk.

B. U~set - CH, rate is low

Diagnosed (most probable) cause of upset

V W , = H COD id. = M

CH, rate = L 1 V f l , = L 1 Increase VtNr 1

Action that should be taken to correct upset

1 COD id. = L 1 Increase COD infl. 1

COD infl. = H F K time = L

1 B3 1 COD i d . = M 1 f w ~ c = 1 Decrease twCle 1

Decrease COD i d . Increase F/C time

I CI 1 COD effic. = L, CH^ rate = L T COD infi. = L 1 Increase COD infl. 1

F/C time = L 1 Increase F/C time 1

Other variables need to be added to the Bayesian belief network to diagnose this combination of evidence

B4

B5

CS 1 tFie = M 1 MLVSS = L 1 lncrease MLVSS 1

Cm U~sets - COD removal e ~ c i e n w and CHI rate are low

- -

tV1, = M

F/C time = H

L

C2 C3 C4

" Low = L, Medium =M, and High = H. The ranges of the States of the variables are in Table 3.1 1.

b Case # is similar to that in Table 4.2.

COD i d . = M FIC time = H

Vfl, = H

The evidence is cumulative. For example, Case A3 should be interpreted as COD effic. = L, Vfl, = H, and COD id. = M.

F/C time = L

VW, = L twcle = H

I

Increase F/C time Increase Vfl ,

I

Decrease tW1,

Page 107: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Run #3 shows that increasing FJC time to 0.75 increased COD removal efficiency and

the methane production rate to 66.5% and 16.0 L/d, respectively. So evidence was then

introduced into the network that F/C time was high, and the BBN predicted that bci. was

low (Case A4). But tqci, was actually in a medium state (18 hours). This extra piece of

evidence was entered into the network, which then predicted that MLVSS was low (Case

As). Run ii 4 shows that increasing MLVSS to 25,000 mg/L increased the COD removal

efficiency and the methane production rate to 97.6% (> 85%) and 23.5 L/d (> 12 L/d),

respective1 y.

Run #5 shows that the COD removal efficiency decreased (from 97.6 to 76.4%) when

COD influent increased to 1 1,000 m@, and tqci, and FJC time decreased to 14 hours and

O. 5, respectively. The BBN diagnosed low alkalinity as the most probable cause (Case

A6). Run #6 shows that increasing alkalinity to 4,000 mg/L (as CaCO3), increased COD

removal efficiency to 95.0%.

A. Upset - COD mnoval effienry is low, V', < 0.3

Run #7 in Table 4.3 shows the upset that occurred for a different set of operational

conditions. COD removal efficiency decreased to 62.2% (< 85%). As seen earlier, Case

Al in Table 4.4 shows that when evidence was introduced into the BBN that COD

removal efficiency is low, the network diagnosed V& > 0.3 to be the most probable

cause of upset. Run #8 shows that decreasing V t N , to 0.25 (rather than fixing it at OS),

increased COD removal eficiency to 95% (>85?40).

Run $9 shows that decreasing Alk., COD infl., b l e , and F/C time to 100 mg&

1 1,500 mg/L, 8 hours, and 0.10 decreased the COD removal eficiency to 77.04/0. When

Page 108: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

evidence was introduced into the BBN that the COD removal efficiency and V& are

low, the network diagnosed COD infl. to be low (Case H2 in Table H.2 in Appendix H).

But COD influent was in a medium state (1 1,500 mg/L). When more evidence was

introduced into the BBN that the COD influent is in a medium state, the network

diagnosed t,~, to be low (Case H3). Run # 10 shows that increasing tqctc to 14 hours.

increased the COD removal efliciency to 92.4%.

Run # 1 1 shows that increasing COD influent to 24,000 mg& decreased the COD

removal effciency to 75.9%. When evidence was introduced into the BBN that the COD

removal efficiency and VINr are low, and COD influent is actually in a high state, the

network diagnosed F/C time to be low (Case H4). Run # 1 2 shows that increasing F/C

time to 0.70 increased the COD rernoval efficiency to %.~P/o.

B. Upset - CH4 rate i s lm

Run # 13 in Table 4.3 shows the upsets that occurred for a different set of operational

conditions. C& rate decreased to 8.7 Ud (< 12 Vd). Case BI in Table 4.4 shows that

when evidence was introduced into the BBN that methane production rate is low. the

network diagnosed low Vfl, to be the most probable cause of upset. Therefore, Vflr

should be increased. Run # 14 shows that increasing VdV, to 0.35 increased the methane

production rate to 20.2 L/d (> 12 Lfd).

Run # 1 5 shows that decreasing COD influent from 10,000 to 3,000 mg& decreased

the methane production rate from 20.2 to 6.8 L/d. When evidence was introduced into

the BBN that the methane production rate and V& are low, the network diagnosed COD

Page 109: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

influent to be low (Case B2 in Table 4.4). Run #14 shows that increasing COD influent

back to 10,000 m@, increased the methane production rate back to 20.2 Lld.

Run # 16 shows that the methane production rate decreased to 1 1.9 L/d when COD

influent, tqci,, and F/C time changed to 7,100 mg/L, 22 hours, and 0.1, respectively. The

BBN diagnosed high tvcd, as the most probable cause (Case 83) . But from Run #16, &cl,

was actually in a medium state (22 hours). So this exqra piece of evidence was entered

into the network and it predicted that F/C time was low (Case 84). Run #17 shows that

increasing F/C time to 0.75 increased the methane production rate to 12.0 Wd.

Run #18 shows that the methane production rate decreased to 9.3 L/d when alkalinity,

COD influent, and MLVSS decreased to 1,000 mg& 5,500 mg/L, and 10,000 rng/L,

respectively. The BBN was not able to diagnose anything as a probable cause of the

methane production rate < 12 Lld, given that COD influent and t-1, are in medium states,

and FIC time and V f N , are in high states (Case BS). Run # 19 shows that the methane

production rate increased only to 9.6 Lfd (ail1 < 1 2 L/d) when alkalinity and MLVSS

increased to 5,000 mg/L and 40,000 mg/L (maximum allowable valtcts according fo

Table 3.11). respectively. Therefore, it was logical for the network not to diagnose low

alkalinity and MLVSS as probable causes of the upset in Run #18. This shows that other

variables need to be added to the belief network to diagnose the problem if this set of

conditions ever occurred.

C Upseî - COD rrmmd eflciency and CH, ratc anc /m

Run #20 in Table 4.3 shows the upsets that occurred for a different set of operational

conditions. COD effic. and C h rate decreased to 58.8% (< 85%) and 7.6 Wd (< 12 Wd),

Page 110: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

respectively. Case Cl in Table 4.4 shows that when evidence was introduced into the

BBN that both COD efic. and C b rate are both low, the network diagnosed low COD

influent to be the most probable cause of upsets. Therefore, COD infl. should be

increased. Run #2 shows that increasing COD influent from 4,000 to 8,000 mgL,

increased C h rate to 13.2 Wd (> 12 Wd), but decreased COD efic. to 54.8% (c 85%).

Therefore, evidence should be introduced into the network that ody COD efic. < 8596,

which was discussed already for Run #3.

Run #2 1 in Table 4.3 shows the upsets that occurred for a different set of operational

conditions. COD efic. and CH, rate changed to 56.5% (< 85%) and 10.5 L/d (< 12 L/d),

respectively. Case C2 shows that when evidence was introduced into the BBN that COD

effw. and C h rate are low, and COD infl. is in a medium state (6,000 mg/L), the network

diagnosed low FIC time to be the rnost probable cause of upset, and hence FIC time

should be increased. Run #22 shows that increasing FIC time to 0.75, increased COD

effic. and Ci-& rate to 88.4 (> 85%) and 16.4 L/d (> 12 Ud), respectively.

Run #23 shows that COD effic. and C h rate decreased to 64.0% and 1 1.8 L/d,

respectively, when alkalinity and FIC time changed to 100 mg/L and 0.45, respectively.

Case C3 shows that the network diagnosed low VIN, as the rnost probable cause of the

upsets. But if Vfl , was 0.5, Case C4 diagnosed high twcie as the most probable cause of

the upsets. Hence, Q*, should be decreased. But if was fixed at 18 hours (medium

state), Case CS diagnosed low MLVSS to be the most probable cause of upsets. Run #24

shows that increasing MLVSS to 25,000 mglL, increased COD effic. and C h rate to

98.2% (> 85%) and 16.5 L/d (> 1 2 Vd), respectively .

Page 111: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

0. Rognosis Resulîs

Table 4.1 showed how the Bayesian belief network could be used as a predictive tool

to determine the effects of changing the operational parameters in the ANSBR. For

example, Case #2 in Table 4.1 showed that increasing alkalinity should most likely

increase COD removal efficiency and methane production rate, which was observed

when comparing Runs US and $6 in Tabie 4.3.

Runs #7 and #8 showed that decreasing Vfl , and hence, decreasing the organic

loading, increased COD removal efficiency and decreased methane production rate which

were already determined fiom Case #11 in Table 4.1.

From the prognosis results in Section 4.2, it was discovered that if alkalinity, FIC

time, and MLVSS were al1 in a high state, and Vfl, was in a low state, and the organic

loading increased by increasing COD influent and/or decreasing tLy,i,, then the COD

removal efficiency could increase (comparing Cases # 1 8 and # 19 in Table 4.1 ). As

explained, this could be due to more substrate being available to the microorganisms (per

litre) in the reactor, hence increasing the growth and activity of the microorganisms. This

shows the complexity of the microbiological community acting in an anaerobic

wastewater treatment system.

Runs #25 and #26 in Table 4.3, which are representative of Cases #18 and # 19,

respectively, in Table 4.1, verify this observation. The operational parameters were

assigned the average values of the states just mentioned. For example, Run #25 shows

MLVSS to be 30,000 mg/L which is the average of the range of high state of MLVSS

(20,000 to 40,000 mg/L). The organic loading for Run #25 was 0.99 N d , and COD

removal eficiency and methane production rate were 98.5% and 4.1 Ud, respectively.

Page 112: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Run #26 shows that when the organic loading increased to 4.2 g/L/d, by increasing COD

influent to 18,000 mgL and decreasing tTCii, to 18 hours, the COD removal efficiency

and methane production rate both increased to 98.7% and 8.7 Wd, respectively.

Therefore, the BBN predictions for Case # I 8 and # 19 in Table 4.1 were logical.

This section showed how the Bayesian belief network could be used to diagnose

simulated upsets, and how specific actions could be taken to properly correct the upsets.

It also showed how the network could be used to determine the effects of changing the

operational parameters in the ANSBR. Other cases were examined and the network

appeared to perfom logically. It was impossible however, to check every scenario.

Hence, checking the accuracy and suitability of the network would have to be a

continuous process where errors would have to be corrected as they are observed.

4.5 Prior Probabilities

As mentioned in Section 3.6.3, for the ANSBR, prior probabilities represent a

summary of the evidence pnor to any cycle. For example, given the operating records of

an existing ANSBR in operation, what is the probability of MLVSS being in a high state,

before operating the reactor? Hence, prior probabilities are speci fic to different reactors.

However, they can be changed to achieve diagnostic results that are more suitable to the

designer of the BBN for the ANSBR.

Table 4.5 shows different sets of prior probabilities that were chosen for the BBN.

The probabilities of the States of pH, COD efic. and C& rate (with no evidence

introduced into the network), given the different sets of prior probabilities are shown.

The prior probabilities were changed to show how the capabilities ofthe belief network

Page 113: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

changed. Pnor #1 is identical to Case Orig. in Table 4.1 and 4.2. As seen, the

probability of achieving COD removal eficiency > 85% and C& rate > 12 L/d were

87.1 % and 5 5 -2%. respectively . Because these values were greater than 50%, the

simulator ANSBR can be said to be operating satisfactorily most of the time.

Priors #2 to #4, show a different set of prior probabilities for which the states of the

variables (high Nk., medium COD infl., medium t , i , , high F/C time, low V n r , and

high MLVSS) that were favourable for producing a more efficient operating ANSBR

(high COD efic.) were given the highest probability (> 50%). As seen, the probability of

achieving high state of COD removal eficiency (> 85%) was greater than 50%, but the

probability of achieving a high state of C h rate (> 12 Lld) was less than SOVO. This

means that if the operational parameters (with states defined in Table 3.1 1) in an ANSBR

were operating with the pnor probabilities in Pt-iors #2 to #4, then most of the time

(> 50%). the rnethane production rate would have been less than 12 Wd. For example, if

an ANSBR was run for 100 cycles, and the states of the operational parameters were

occurring with the prior probabilities in Prior #2 (e.g., MLVSS was between 20.000 and

40,000 mg& for 90 cycles), then it is likely that C)4 rate would have been less than 12

Ud for about 66 cycles. Prior #5, gave similar results when the prior probabilities of the

states of the operational variables were distributed equally. Therefore, the operational

parameters (with states defined in Table 3.1 1) should be operating with the prior

probabilities in Pnor $1, so that the simulator ANSBR c m be operating satisfactorily

(COD removal eficiency > 85% and CHi rate > 12 Lld) most of the tirne.

Page 114: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 4.5 Changing Prior Probrbilities in the BBN a

" Numbers represent probabilities. Equilibrium state of BBN with no evidence introduced.

b identical to Case Orig. in Tables 4.1 and 4.2.

1 ri or

The ranking of the diagnostic results of the BBN could also change for different sets

Output Parameters DH I COD ellic. I CH4 rate

of pnor probabilities. For example, using the set of prior probabilities in Prior #1, the

network diagnosed low V& to be the most probable cause of obtaining CH4 rate <

12 Lld (Case B 1 in Table 4.4), while using the set of prior probabilities in Prior #5, the

network diagnosed low COD influent to be the most probable cause of this upset. The

ranking of the diagnosed causes of the upset are different for both sets of prior

probabilities. Therefore, if increasing COD influent is preferable to increasing V&,

then the designer of the belief network would choose the sets of prîor probabilities in

Page 115: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Pnor #5, to change the ranking of the diagnostic results in the Bayesian belief network.

Note however, that the operational parameters should practically still be operating with

the pnor probabilities in Prior # I V so that the simulator ANSBR cm be operating

satisfactonly most of the tirne.

There are other examples for which the ranking of the diagnostic results of the BBN

changed for different sets of prior probabilities. For example, using the set of prior

probabilities in Pnor #l , the network diagnosed low FM: time to be the most probable

cause of obtaining COD removal eficiency c 85%, given high VBV, and medium COD

influent (Case A3 in Table 4.4). However, using the set of pnor probabilities in Pnor #4.

the network diagnosed low tq,,, to be the most probable cause of this upset, given the

same evidence. Additionally, using the set of prior probabilities in Pnor $1. the network

diagnosed high Vfl , to be the rnost probable cause of obtaining COD removal efficiency

< 85%. while using the set of prior probabilities in Prior #2. the network diagnosed low

COD influent, given the same upset (food for increased growth and activity of

microorganisms i s needed).

When using the BBN to determine the effects of changing the nates of the operational

parameters in a specific ANSBR, the actual pnor probabilities should be used. Pnor #6

shows a set of prior probabilities for which the States of the variables that were

unfavourable for producing a high COD removal efficiency wcre given a probability

greater than 50%. For example, the pnor probability of MLVSS being low was 80%.

compared to 20% in Pnor #l . Case #S in Table 4.1 showed for Pnor #l, that when the

probability of high COD influent was increased fiom 30 to 100%. the probability of high

COD removal eficiency decreased fiom 87.1 to 74.2%. An interesting observation was

Page 116: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

that the network decreased the probability of COD removal efficiency being high, but

still predicted an extremely high chance of COD removal eficiency being high (74.2%).

This was because the prior probabilities were favourable for high COD removal

eficiency, given high COD influent. Now, when the probability of high COD influent

was increased from 33% (Prior #6 in Table 4.4) to 10W. the probability of high COD

removal eficiency decreased frorn 6 1.7 to 38.8%. Not only did the network decrease the

probability of COD removal eficiency being high, but it also predicted an extremely low

chance of COD removal eficiency being high (38.8%). This shows that the prior

probabilities in Prior #6 (unlike those in Prior #1) were unfavourable for high COD

removal eficiency, given high COD influent.

It is thus evident that when using prior probabilities to determine the effects of

changing the states of the operational parameters in a specific ANSBR, the actual prior

probabilities should be used, unless evidence (entered as 100?40) of al1 the operational

parameters are entered at the same time, and the effects of changing the evidence are

observed. For example, Case # 17 in Table 4.1 showed that evidence was entered into the

BBN about the states of the variables: alkalinity, tGyci,, F/C time. and MLVSS are low.

and COD influent and Vfl, are high. The probability of high COD removal eficiency

was 2.2%. Case # 1 8 in Table 4.1 showed the results when evidence about the states of

the variables changed: alkalinity, tqci,, F/C tirne, and MLVSS are high; COD influent is

medium; and, Vfl , is low. The network drarnatically increased the probability of high

COD removal eficiency to 98.5%. The results for Cases #17 and #18 would be identical

for any sets of prior probabilities since evidence of al1 the operational parameten were

entered at the same time into the belief network.

Page 117: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

If the Bayesian belief network was to be applied to an existing large scale operating

ANSBR, then afier running the first 100 cycles, the probabilities of the States of the

operational parameters would be recorded, and entered into the Bayesian belief network

as the prior probabilities. M e r every cycle of operating the ANSBR, the prior

probabilities could be updated. Nevertheless, the designer of the BBN could change

those prior probabilities, so as to change the ranking of the diagnostic results of the BBN

that was most suitable. However, the designer should use the actual pnor probabilities

when trying to determine the effects of changing the operational parameters in the

ANSBR (using the BBN for prognosis). It is thus evident that different pnor

probabilities could change the capabilities of the belief network.

Page 118: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

5. DISCUSSION

The network proved to be a useful tool as it was able to properly diagnose upsets in

an ANSBR simulator operating under different conditions, thus allowing specific actions

to be taken to properly correct the upsets. There were a few cases however, where the

Bayesian belief network (BBN) failed to diagnose anything as the most probable cause of

upset given a cenain combination of evidence. So other variables such as granulation

and sludge wasting need to be added to the network. Hence, the diagnostic capabilities of

BBNs are limited to the expert knowledge (e.g., variables) included in the network. A

major advantage ofusing BBNs is that nodes could be added sirnply to the network, thus

allowing modifications of the network to be made without requiring major adjustments.

In the reconstruction process, relationships between the variables may need to be added

or deleted.

The number of states of the variables could be increased to provide greater options of

operating the parameters. For exarnple, since influent concentration, cycle time and fil1

to react volume ratio al1 affect organic loading, and the first two variables have three

states with the middle one being the "normal operating" state, the latter variable could be

assigned three states. Hence, fil1 to react volume ratio could have low, medium (normal

operating) and high states. Additionally, alkalinity could have fhe states to control the

amount of chernicals that is added to the reactor, and hence, unnecessary costs. However.

increasing the number of states increases the complexity of the network. This concern

should not limit the development of the BBN, if models are used to determine the

conditionsi probabilities, since increasing the number of states simply requires changing

the coding in the models.

Page 119: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

The ranges of the states could be changed, to suit specific ANSBR systems. For

example. if an ANSBR system is being used to maximire the methane production rate,

the upper range of the fil1 to react volume ratio could increase fiom 0.55 in this project to

0.75, to allow for a higher organic loading. Additionally, the operator of an ANSBR may

find adding alkalinity of 5,000 m f l to the ANSBR to be too costly. Hence, the upper

range for alkalinity could be decreased to 4.000 m a .

In this project, when perturbing the ANSBR simulator to produce upsets, it was

dificult to obtain COD removal eficiency < 85% and methane production rate < 12 L/d,

at the same time. It was analyzed that given the expert knowledge in the BBN.

decreasing the organic ioading generally increased the COD removal efficiency, but

generally decreased the methane production rate, and vice versa. Therefore. achieving a

low state of methane production rate should not be used to predict that the COD removal

eficiency of any ANSBR is in a low state, unless the states and ranges of the states of al1

the parameters are defined such that there is definitely a positive correlation between the

two variables (having three states of fil1 to react volume ratio would assist this goal).

COD removal eficiency and methane production rate should remain in the BBN, because

the main objective of an ANSBR could be to achieve a COD removal eficiency > 85%.

Additionally, a minimum methane production rate (e-g., at least 12 Lld for the simulated

lab-scale ANSBR) could be required to cost effectively provide fuel to the treatment

plant.

Prior probabilities represent a summary of the operating records of an ANSBR prior

to any cycle, and so are specific for different ANSBR systems. However, they could be

adjusted to change the ranking of the diagnostic results of the BBN to be most suitable to

Page 120: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

the designer of the BBN. When using the network to determine the effects of changing

the operational parameters in an ANSBR (prognosis), the actual pnor probabilities should

be used.

For this project, the conditional probabiiities were calculated using an ANSBR model

developed previously at the University of Toronto. Nonnally, these probabil ities are

determined €rom expert opinion, where questionnaires are sent out to expens asking thern

to estimate the conditional probabilities. The conditional probabilities could also have

been determined from experiments. Not only did using the model Save time for

calculating the conditional probabilities, but it also allowed the States and ranges of the

variables to change at any time throughout the project without requiring a lot of effon to

recalculate the probabilities.

As newer versions of the ANSBR model are available. the conditional probabilities

should be recalculated. If new variables are added to the network at a time when t hey

still cannot be represented in the model, then the conditional probabilities would have to

be determined from expert opinion and/or experiments.

One of the limitations of the Bayesian belief network is the accuracy of the ANSBR

mode1 that was used to calculate the conditional probabilities. If the model is inaccurate,

then the conditional probabilities that were calculated using the model could be

inaccurate. The performance of the BBN should be evaluated similarly to how the

ANSBR model is evaluated. The BBN should be used to diagnose upsets in the

performance of a lab-scale ANSBR being tested at the University of Toronto. In

addition, the network should be evaluated as a predictive tool to detemine the effects of

changing the operational parameters in the l a b - d e ANSBR.

Page 121: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

The best method for testing the robustness of the Bayesian belief network is by the

continuous use of it, because depending on the magnitude of the belief network, it could

be time-consuming to test every single possible scenario. As the network is used for

practical applications, erron might be discovered which would require correction.

Maintenance of the BBN is an ongoing process.

Even if the BEN was robust after evaluating its peFformance on a lab-scâle XVSBR,

errors might be discovered when applying it to large-scale ANSBR systems. The

performance of any BBN is specific to the ANSBR for which the network was designed.

For example, the BBN in this project was designed for a simulated ANSBR to treat only

glucose. The constituents of the wastewater treated by different large-scale ANSBR

systems would Vary. Therefore, the BBN would have to be designed separately for each

ANSBR system especially if different ranges of the States of the variables are used.

Page 122: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

6. CONCLUSIONS

A Bayesian belief network (BBN) was developed to diagnose upsets in an anaerobic

sequencing batch reactor (ANSBR), thus allowing specific actions to be taken to propaly

correct the upsets. The expert system was designed to predict the most probable cause(s)

for COD removal effciency lower than 85 % andor a methane production rate lower

than 12 Lid, in a simulatzd W S B R . The BBN could also be used as a predictive tool to

determine the effects (on COD removal efliciency and methane production rate) of

changing the operational parameters in the ANSBR.

The BBN can readily compare the probabilities of events before and afier the

introduction of evidence and update its prognosis or diagnosis. The parameters that could

be controlled to correct upsets and increase ANSBR efficiency included alkalinity,

influent concentration, cycle time, feed to cycle time ratio, fil1 to react volume ratio and

mixed liquor volatile suspended solids.

The diagnosis and prognosis capabilities of BBNs are limited to the expert knowledge

(e.g.? variables, probabilities) provided to the network. Incorrect information entered into

the network could produce incorrect results. It was discovered that other variables such

as granulation and sludge wasting should be added to the BBN to increase its capabilities.

Finally, because BBNs contain expert knowledge about specific systems. ihey should be

designed separately for eac h ANSBR sy stem.

Page 123: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

7. RECOMMENDATIONS

The following recommendations are made for ongoing work in this area:

Expand the network by adding variables such as granulation and sludge wasting.

If new variables are added to the network at a time when they still cannot be

represented in the model, then determine the conditional probabilities by expert

opinion andor experirnents.

Increase the number of states of feed to cycle tirne ratio and al kalinity to increase the

options of operating these parameters.

If it is required that a high state of methane production rate is a surrogate of a high

state of COD removal eficiency, then the Bayesian belief network should be

redesigned to make sure that there is a positive correlation between these two

parameters.

As newer versions of the ANSBR model are available, recalculate the conditional

probabilities and re-evaluate the network.

Continue to use the network to diagnose and correct upsets in an ANSBR simulator,

and make appropriate adjustments to the network where required.

Use the Bayesian belief network to diagnose upsets in a lab-scale ANSBR used to

treat glucose, and make appropriate adjustments to the network where required.

The network predicted that if 3000 mgL < Alkalinity as CaCOi < 5,000 m a , 12 g L

< COD influent < 24 g/L, 8 hours < tycl, < 12 hours, 0.40 < F/C tirne < 0.75,0.05 <

V& < 0.30, and 20,000 mg/L < MLVSS < 40,000 mg& then the COD removal

efficiency and methane production rate combined should be at their maximum value.

Page 124: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Hence, perfonn expenments with the operational parameters within these ranges to

check this hypothesis.

9. Use the Bayesian belief network to determine the effects (on COD removal eficiency

and methane production rate) of changing the operational parameters in a lab-scale

reactor ANSBR, and make appropriate adjustments to the network where required.

10. Develop on-line tools to automatically masure al1 the variables in the network afier

each cycle and automatically make adjustments to these variables when prompted.

1 I . Integrate both tools with the Bayesian belief network to develop an artificial

intelligence (Ai) system.

Page 125: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

8. REFERENCES

Angenent, L.T. and Dague, R.R. 1995. A Laboratory-Scale Cornparison of the UASB

and ASBR Processes. 50" Purde Industrial Waste Conference Proceedings, Ann

Arbor Press, Inc. Chelsea, MI. 365-377.

Bagley, D.M. and Brodkorb, T.S. 1999. Modeling Microbial Kinetics in an Anaerobic

Sequencing Batch Reactor - Mode1 Development and Experimental Validation.

Water Environ. Res. 7 1 (7): 1 3 20- 1 3 3 2.

Banik, G.C.; Ellis, T.G.; and Dague, R.R. 1997. Structure and Methanogenic Activity of

Granules from an ASBR Treating Dilute Wastewater at Low Temperatures. Wuf. Sci.

Tech. 36(6-7): 14% 156.

Bamett, M. W. and Andrews, J.F. 1993. Expert systern for anaerobic-digestion - process

operation J. Elniror. Elig.., 1 18(6): 949-963.

Brodkorb, T.S. 1998. Dynamic Simulation of microbial kinetics in an anaerobic

sequencing batch reactor. M. Eng ~ E ~ S I S , Graduate Department of Civil Engineering,

University of Toronto, Toronto, Ontario, Canada.

Chong, H.G. and Walley, W. J. 1996. Rule-based versus probabilistic approaches to the

diagnosi s of fault s in wastewater treatment processes. Artrficid Intelligence in

Engineering 1, pp. 265-273.

Dague, R.R. and Pidaparti, S.R. 1992. Anaerobic Sequencing Batch Reactor Treatment of

S w ine W astes. &fh Purdue InrhrstriuI W m e Corference Pruceedings, Lewis

Publishers, Inc. Chelsea, MI. 75 1-760.

Fernandes. L.; Kennedy. K.J.; and Ning, 2. 1993. Dynamic Modelling of Substrate

Degradation in Sequencing Batch Anaerobic Reactors (SBAR). Waf. Res. 270 1):

i619-1628.

Grotenhuis, J.T.C.; Kissel, J.C.; Plugge, C.M.; Stams, A.J.M.; and Zehnder, A.J.B. 1991.

Role of Substrate Concentration in Particle Size Distribution of Methanogenic

Granular Sludge in UASB Reactors. Wat. Res. 25(1): 2 i -27.

Guwy, A. J.; Hawkes, FR.; Wilcox, S.J.; and Hawkes, D.L. 1997. Neural Network and

on-off control of bicarbonate alkalinity in a fluidised-bed anaerobic digester. Wut.

R ~ s . 3 l(8): 20 19-2OZ.

Page 126: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Hawkes, F.R.; Guwy, A.G.; Roui, A; and Hawkes, D.L. 1993. A new instrument on on-

line measurement of bicarbonate dkalinity. Wa. Res. 27: 167- 170.

Heckerman, D.; Mamdani, E.H.; and Wellman. M.P. 1995. Real world applications of

bayesian networks. Communications of the ACM, 3 8(3): 24-26.

HulshoRPol, L.W.; van de Worp, J.J.M.; Lettinga, G.; and Beverloo, W.A. 1986.

Physical Characterization of Anaerobic Granular Sludge. In Anaerobic Treatment. A

Grown-Up Technology. Aquatech '86. Amsterdam, The Netherlands. 89- 10 1.

Imai, T.; Ukita, M.; Liu, S.; Sekine, M.; Nakanishi, H.; and Fukagawa, M. 1997.

Advanced Start Up of UASB Reactors by Adding of Water Absorbing Polymer. Wut.

Sci. Tech. 36(6-7): 399-406.

Jensen, F.V. 1996. An Introduction to Bayesian Networks. Springer-Verlang

New York, Inc., 175 Fiflh Ave, New York, W .

Jensen, F.V. 18 May 1999, posting date. A Brief Overview of the Three main Paradigms

of Expert Systems. [Oniine.] htt~://www. hunin.dk/hu~intro. [29 March 2000, iast day

accessed. ]

Kennedy, K.J.; Sanchez, W.A.; Harnoda, M.F.; and Droste, R.L. 199 1. Performance of

Anaerobic Sludge Blanket Sequencing Batch Reactors. Ra. J. Wuter Pollirt. Control

Fed 63(1): 75-83.

Korver, M. and Lucas, P.J.F. 1993. Converting a rule based expert system into a belief

network. Medical ln$iormatics, 1 8 : 2 1 9-24 1 .

MacLeod, F.A.; Guiot, S.R.; and Costerton, J.W. 1990. Layered Structure of Bactenal

Aggregates Produced in an Upflow Anaerobic Sludge Bed and Filter Reactor. Applied

and Environmenta/ Microbiology , 5 6(6): 1 598- 1 607.

Mahoney, E.M.; Varangu, L.K.; Cairns, W.L.; Kosaric, N.; and Murray, R.G.E. 1987.

The Effect of Calcium on Microbial Aggregation During UASB Reactor Start-Up.

Wat. Sci. Tech. (19): 249-260.

McCabe B.; AbouRizk S. M.; and Goebel, R. 1998. Belief Networks for Construction

Performance Diagnostics. Jmrnal of Compting in Civil Eng»eering, Apnl, 93-100.

Met cd f & Eddy, hc. 1 99 1. Wastewater Engineering: Treamient, Disposal, Reuse, 3"

Edition. McGraw-Hill, Inc., Toronto.

Pradhan, M.; Henrion, M.; Provan, G.; Favero, B.D.; and Huang, K. 1996. The

Page 127: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

sensitivity of belief networks to imprecise probabilities: an experimental

investigation. Art~ficial Intelligence, 85(1-2): 363 -397.

Schmit, C.G. and Dague, R.R 1993. Anaerobic Sequencing Batch Reactor Treatment

of Swine Wastes at 20°C, 25'C, and 3 5°C. 4gh Picrdue Industriai Waste Conjerence

Proceedings, Lewis Publishers, Inc. Chelsea, MI. 541-549.

Shizas, 1. 2000. Start-Up of a Laboratory-Scale Anaerobic Sequencing Batch Reactor

Treating Glucose. M. A. S. c mesis, Graduate Department of Civil Engineering,

University of Toronto, Toronto, Ontario, Canada.

Speece, R.E. 1996. Anaerobic Biotechnology for Industrial Wastewaters. Archae Press.

Nashville, TN.

Sung, S. and Dague, R.R 1995. Laboratory Studies on the Anaerobic Sequencing Batch

Reactor. Water Environ. Res. 67(3 ) : 294-3 0 1.

Thaveersi, J. ; Daffonchio, D.; Liessens, B.; Vandermeren, P.; and W. Verstraete. 1995.

Granulation and Sludge Bed Stability in Upflow Anaerobic Sludge Bed Reactors in

Relation to Surface Thermodynamics. Appl. Environ. Microbiol. 6 l(10): 368 1-3686.

Wirtz, R.A. and Dague. R.R. 1996. Enhancement o f Granulation and Start-Up in the

Anaerobic Sequencing Batch Reactor. Water Environ. Res. 68(5): 883 -892.

Wu, W-M.; Jain, M.K.; Thiele, J.H.; and Zeikus, J.G. 1995. Effect of Storage on the

Performance of Methanogenic Granules. Wat. Res. 29(6): 1445- 1452.

Yan, Y-G. and Tay, J-H. 1997. Characterisation of the Granulation Process during

UASB Start-Up. War. Res. 3 l(7): i 573- 1580.

Page 128: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

APPENDICES

Page 129: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

APPENDIX A

Probabilitiy

Calculations

Page 130: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

C a l c u i a t i n ~ P b ~ = 81 and PlnH = LI for E u m ~ i t in Section 2@2,4

To determine the probability of pH = H, the joint probabilities of al1 the parents must be

considered. Therefore,

P(P=H) = F(F-HIA=H d = L ) P(A=H) P(F=L)

+ P(P=H(A=H A F=H)P(A=H) P(F=H)

+ P(P=H(A=L A F=L) P(A=L) P(F=L)

+ P(P=H(A=L A F=H) P(A=L) P(F=H)

Using the values from Table 2.1,

P(P=H) =[0.4 x 0.7 x 0.31 + [0.95 x 0.7 x 0.71

+ (0.05 x 0.3 x 0.31 + [0.6 x 0.3 x 0.71

= 0.68

P(P=L) = 1.0 - 0.68 = 0.32

Therefore, P(pH=H) = 0.68, and P(pH = L) = O.32for Equilibrium state 1 in Table 2.2.

Page 131: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Calculatian PfAlk. = Ll given DB=L and FIC time =EI for Exam~ie in Section 2.2.4

The sample calculation below incorporates the principle of independence. Using

Equation 2.4:

P(P=LIA=L A F=H) = 0.40 (Table 2.1) (A.3)

To calculate P(A=LIF=H), it is observed that A and F are independent since there are no

direct links between them. Thus,

P(A=LIF=H) = P(A=L) = 0.3 (Table 2.1)

To detennine P(P=LlF=H), the joint probabilities of al1 the parents must be considered.

Therefore,

P(P=L[F=H) = P(P=LIF=H A A=L) P(A=L) + P(P=LIF=H A A=H) P(A=H) (AS)

= 0.40 x 0.3 + 0.05 x 0.7 (Table 2.1)

P(P=LlF=H) = O. 155

Substituting Equations A.3, A.4 and A.6 into Equation A.2,

P(A=LIP=L A F=H) = 0.40 x 0.3 1 0.1 55 = 0.77

Hence, P(A = LP = L A F=H) = 0.7 7/or Equilibrium state 3 in Table 2.2.

Page 132: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

APPENDIX B

Input Files of the

ANSBR Mode1

Page 133: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table B.1 Input files of the ANSBR model

A. Influent wastwater concentration values (Asbr-infin file in ANSBR model)

B. Input fde for process vdues (Asb~grcin file in ANSBR model)

Ixs 1 O I

nc cle

[not 1 O I

Page 134: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table 5.1 Cont'd Input files of the ANSBR model

C. Input füe for kiatttic constants (Asbr-kin.in fik in ANSBR model)

D. Input file for stoichiometric cdculations (Asbt-sto.in fik in ANSBR model)

El khss

fbsi 0.09

1 bxfi 1 0.02 1 1 ivss 1 1.416 1 l fscs

Yaba 0.8 Yhba 0.2

muxba Ksba

1 bxba i 0.01 1

Page 135: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table B.2 Input panmeters as a function of hck, FIC time and V/V,

B. Varying FIC time C. Varying V(V,

(hours) (hours) (hours) h

Page 136: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

APPENDIX C

Description of Input and Output Files

for the Probability Programs

Page 137: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

- generates random numbers

- reads the random numbers and prints ouput values using an alfered version of the simulator

- rends the aupur vnlues and cnlculates the

Figure Cl Single program used for calclilating the conditional probabilities in the BBN. (Batch 1 program does not inelude the valucs.out M. Table C.2 describes the input and output fdn)

Page 138: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Tabk C.1 Description of INPUT and OUPUT files in Figure 3.13

Files

gensim. in

arrays. in

valuesS. out

Description

Constant values to be read by gennuml .exe or gemum2.exe. See Tables C.3.A & C.4.A. Constant values to be read by gennuml .exe or ge~um2.exe. See Tables C.3.B & C.4.B. Output random numbers from gennum 1 .exe or gemum2.exe in the exact form to be read as an iNPUT FILE for simnprograml .exe or simnprograrn2.exe. Output random numbers fiom gennum 1 .exe or ge~um2.exe. ~ h i s file contains headings; random numbers for input variables A to E; and numbers transforrned into the correct form to be read by Simnprogram.exe. The last set of numbers are those in gensimh. This file also contains the number of simulations generated for each combinat ion. Constant values to be read by Simnprograml .exe or Simnprogram2. exe. See Tables C.3.C & C.4.C. Constant values to be read by Simnprogram 1 .exe or Simnprogram2. exe. Input file, INFLUENT W ASTEW ATER concentration values. Constant values to be read by Simnprogram 1 .exe or Simnprogram2. exe. Input file for IMTIAL REACTOR concentration values. Constant values to be read by Simnprogram 1 .exe or Simnprograrn2exe. Input file for PROCESS values. Constant values to be read by Simnprogram 1 .exe or Simnprogram2. exe.

- -

input file for KINETIC constants. Constant values to be read by Simnprogram l .exe or

input- file for STOICHIOMETRIC calculations. Output values from simnprograml .exe or simnprogram2.exe. in the exact form to be read as an INPUT FILE fcrr readsimout l .exe or readsimout2. exe. Constant values to be r a d by readsimout L .exe or readsimout2.exe. See Tables C.3.E & C.4.E. Output values fiom readsimout 1 .exe or readsimout2.exe. ~robabilities to be entered into the Bayesian mtwork in the Bayesian software. Actual COD effic. and C a rate values r a d f?om readsimout2.exe only. This file contains headings.

Page 139: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table C.2 Description of MPUT and OUPUT Nes in Figure Cl

Files

gensim. in

fûllgen. out

Description

Constant values to be read by Oneprograml .exe or Oneprogram2.exe. See Tables C.3.D & C.4.D. Constant values to be read by Oneprogram 1 .exe or Oneprogram2.exe. See Tables C.3.B & C.4.B. Constant values to be read by Oneprograml .exe or Oneprogram2.exe. input file, INFLUENT W ASTEW ATER concentration values. Constant values to be read by Oneprogram 1 .exe or 0neprogramZ.exe. Input file for IMTIAL REACTOR concentration values. Constant values to be read by Oneprogrml .exe or Oneprogram2.exe. Input file for PROCESS values. Constant values to be read by Oneprograml .exe or Oneprogram2.exe. Input file for KINETIC constants. Constant values to be read by Oneprograml .exe or Oneprogram2exe. Input file for STOICHIOMETRIC calculations. Output random numbers fiom Oneprogram 1 .exe or Oneprograd. exe. Similar to that file in Table C. 1. Output random numbers fiom Oneprograml .exe or Oneprogram2. exe. Similar to that file in Table C. 1. Output values fkom Oneprograml .exe or Oneprogram2.exe. Similar to that file in Table C. 1. Output values frorn Oneprograrn 1. exe or Oneprogram2. exe. Probabilities to be entered into the Bayesian network in the Bayesian software. Similar to that file in Table C. 1. Actual COD efic. and CH4 rate values nom Oneprogram2.exe only. This file contains headings. Similar to that file in Table C. 1.

Page 140: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table C.3 lnput files for ûutch 1 lnput noder: COD infi.= A, tcyck = B, WNr = C, Alk. = D, FIC tirne = E

A. lnput fiîe: M e g 1 .in

6. lnput filer: constg1 .in & constol .in

1 3 stateA # of states 2 3 4 6 6

1

1.5 1 ts lsettle time (hm) I

3 2 2 2

1 O 5000

-

2 3

10 . - . . - - -

11 1 19.23 1 PXI 1% distribution of XI 1

2

3.05 1 PXb 1% distribution of XD

state6 statec state0 stateE

ALowLaw ALowHigh

120 12

. . . - - . - ml- -2157 1 PXb 1% distribution of Xb 1

# of states # of states I

# of states A

# of States ,

Cow range for A

seed

4 1 0.5

Seed number factor

Vt

a arraysize = factor State A State B State C State D SMe E

To calculate arraysizea Reador total volulme (L)

td

13 14

decant tirne (hi's)

18.3 . 8.98

PXa PXh

% distribution of Xa % distribution of Xh

Page 141: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table C.3 Contad lnput files for Batch 1 lnput noder: COD infl.= A, tcyck - 6, VfNr - C, Alk. = O, F/C time + €

Output node: pH - F, "Futun node (iCH4 for now)" = Ga

C. lnput fik: arnysl .in

1 r 1 1

1 1 120 1 factor ITO calculate arraysizeb L

#

arraysize = factor rn State A rn State B * State C rn State D rn State E

Value

2 r

3 4 5

1

; , 6

Variable

3 3 2 2 2

0. Input file: mteol .in

Definition

# 1

1 2 3

I

4 8 6

r

7 L

8

sîateA stateB stateC

# of states .# of states # of dates

a Programs wre designeci to accomodate twa output nodes.

Valw

3 3 2 2 2 2 2

1 O 5000

stateO stateE

Varirbk

stateA stateB stateC stateD date€ stateF stateG

ALowlow ALowHigh

# of states # of states

Definition

# of states l

# of states l

# of states 1

,# of dates # of states # of dates

1

# of states Low range for A

Page 142: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

tabk C.3 Cont8d Input nies for Batch 1 Input nodes: COD infi.= A, tcyclr = 8, VfNr = Cl Alk. = Dl FIC time = E

Output no-: pH = F, "Futucr node (iCH4 for now)" = Ga

E. Input fib: Mater1 .in

1 # 1 Value 1 Variable 1 Definition

a Program was designed to accomodate two output nodes. b arraysize = factor State A State B State C State D * State E

Page 143: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table C.4 lnput files for Ektch 2 lnput noa i : COD infl.= A, tcycle = 8, WNr = C, MLVSS = D, pH = E

A. Input file: stateg2.in

B. lnput files: constg2.in & consto2.in

Definition # 1 Value I

1 2 3 4 6 6 7

# I Vahm 1 Variable 1 Mnition 1 r I

Variable

3 3

2 3 4

StateA States

S 6 7 8 9 10 11 12 13 14

# of states # of sîates

2 2 2

10 5000 5000 12000

120 12 0.5

a anaysize = factor * Stiita A State 9 *late C Ostate D State E

1.5 0.4 6.45 7.86 33.76 3.05 19.23 2.37 18-30 8.98

siatec StateO stateE

ALowLow ALowHigh AMedlow AMedHiqh

factor Vt td

# of states 1

# of states # of states Low range for A ,

Medium range for A

To calculate arraysizea Reactor total volulme (L) decant time (hrs)

ts FC PXs PXi PXf PXp PX1 PXb PXa PXh

settte tirne (hm) constant F/C time % distribution of Xs % distribution of Xi % distribution of Xf l

% distribution of Xp I

% distribution of XI ,% disîriôution of Xb % distribution of Xa % distribution of Xh

Page 144: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table C.4 Cont'd lnput files for Batch 2 lnput nodes: COD infi.= A, tcycb + 6, WNr = C, MLVSS = D, pH = E

Output node: COD e i c . = F, CH, rate = G

C. lnput file: arnys2.in

1 I 1

1 1 120 1 factor [TO calculate arra ysizea 1

I

D. Input file: stateo2.in

Definition # 1

2 3 4 S

1

Valw 1 Variable

3 3 2 2

f L

2 3 4 5

6 1 2

16 17 18 18 20 21 22 23 24 25 26

, 27 28

stateA States statec stateD

3 3 2 2 2

' arraysize = factor State A a a t e B Sate C State O State E

# of states ,

# of states # of states # of states

stateE

0.30 0.55 5000 20000

0 O 20000 40000

. 3.0 6.5 O 0

8.5 7.5 O 85 O 0

85 100 0 12 O0

# of states

stateA stateB statec .

stateD stateE

# of states # of states 1

# of states # of states # of states

CHighLow CHighHigh DLowLow DLowHigh DMedLow DMedHigh DHi~hLow DHiqhHigh ELowLow ELowHiqh EMedLow EMedHigh EHighLow EHighHigh FLowLow F LowHigh

High range for C ,

Low range for D ,

Medium range for O d

.High ranqe for O l

Low ranqe for E 3

Medium ranqe for E HQh range for E Low rame for F

12 1000 1 GHighLw GHiqhHigh High range for G

FMedLow FMedHigh FHighLow FHighHigh GLowLow GLowHiqh GMedLow GMedHiqh

rMedium range for F High range for F Low rame for G Medium range for G l

Page 145: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Tabk C.4 Cont'd Input files for Batch 2 Input nodes: CO0 infi.= A, tcycle = 6, VfNr = C, MLVSS = D, pH = E

Output node: COD effic. = F, CH, rate = G

E. Input fik: stWar2.in 2

L -

2 120 factor To calculate arraysizea '

Definition #

# of states 1

# of states # of states # of states

3 4 . S 6

Value Variable

I

3 3 2 2

stateA States statec date0

Page 146: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

APPENDIX D

Structural Layout of

Probability Programs

Page 147: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

This pro- generates r d o m mrmbers for 5 input nodes. Batch 1: COD inJI. = A, tcycle = B. VrNf = C, Alk. = LI. F C time = E

Batch 2: COD i@. = A, tcycle = B. Vr/Vf = C, ML VSS = D, pH = E. Maimum # of states = 3. Minimum # of stutes = 2.

1. Define variables.

2. SUBROUTINE: ScanConstu?tts~ Scan constants tiom the input file constgin. See Table C.3.B and C.4.B.

3. SUBROUTINE: ScanStates() Scan constants fiom the input file stategin. See Table C.3.A and C.4.A.

4. SUBROUTIAE GetRàndomO O This sub-routine generates random numbers for each input variable.

These numbers are then converted in the correct form for the simulator to read using certain formulas'.

0 Both sets of numbers (before and aiter conversion) are to be printed in the output file fullgen.out with headings. Only the last set of numben (for the simulator to read) is to be printed in the output file gernsin.in with no headings.

O The number of simulations produced for each combination is then to be counted.

5 . SUsiloUï7NE: C hec ki ng() Making sure that a minimum of 10 simulations for each combination is produced. If NOT, it notifies the user and exits the pro-.

6. SUBROU77NE: Simcount() Printing the number of simulations for each combination.

7. MAIN PROGRAM: int main (void) Opening the file constg.in. Opening the file stateg.in. Opening the file fbllgen.out. Opening the file gensim. in. ScanConstant@. ScanStateN). Headings to be pnnted in the fullgen.in file. Loops GetRandomO. The amount of random numbers needed to be generated for each variable is arraysize ( = stateA*stateB8stet&*a~eDtststeE*fa~r). C hec kingo. Simcounto. Closing files.

Page 148: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Vf = Vfl/VrsVt (Equation 3.3) V r = V t - V f (Equation 3.4) tr = tcycle - (td + ts) - tf (Equation 3.2) Sf = COD infl. Xs = PXs*Xtot/100.0 (P means percentage distribution) Xi = PXi*Xtot/lOO.O Xf = PXftXtot/100.0 Xp = PXp*xtot/1oo.o X1= PM+Xtot/100.0 Xb = PXb*Xtot/100.0 Xa = PXa*Xtot/100.0 Mi = Pxh*Xtot/100.0

Batch 1: COD infl = A, tcycle = B. ViVf = C, Aik. = D, Fr C tirne = E.

SNANET = Alk. tf = FM: time * tcycle (Equation 3.1 ) Xtot = (constantXtot*8.0/5.65)/( 1 - VWr) (Equation 3 -6)

h t c h 2: COD infl. = A, /cycle = B. VrT#f = C, MZ VSS = D, pH = E.

a pH = pH (input node) a tf = constantF/C time * tcycle

Xtot = (MLVSS*8.0/5.65)/(1 - VWr) (Equation 3.1 ) (Equation 3.6)

Page 149: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Lavout of Simnrironram\main.c

This program allows the simuiator to read the random m b e r s generatedfiom the previms program. and then generates mrm bers of the output variables. which are to be

ariulyzed by the next program to produce condirima& probabiiities for the Bayesian rw twork.

1. Define variables.

2. SUBROUTINE: ScanArraySze() Scans constants tiom the input file arrays.in. See Table C.3 .C and C.4.C.

3. SUBROUUNE: Sirnulalor() Scans the random numbers from the output file (gensim.in) of the previous program, and assigns them new variables2 to be read by the altered ANSBR simulator. The altered simulator nins and prints out values of the output variables on the user screen and also into the output file, sim. in.

4. MAiN PROGRAM: int main (void) Opening the file arrays.in. Opening the file gemsin.in. Opening the file sim.in ScanArraySize(). Loops the subroutine Simulatofl). The amount of loops to be done is arraysize ( = stateA*stateB*stateC*stateD*stateE*factor). Closing files.

' ~ e w va ria b la

prop[2] = b 1 = Vf prop[3] = b2 = Vs prop[l2] = b4 = tf prop[l4 = b5 = tr yinflî] = b6 = Sf yini[l5] = b7 = Xs yini[l6]= b8 = Xi yini[l7] = b9 = Xf yini[l8] = bl0 = Xp yini[l9] = bll = X1 yini[20] = b 12 = Xb yini[2 l ] = b 1 3 = Xa yini[22] = b 14 = Mi

Barch 1: yinfll3]= b3 = SNANET; Batch 2: prop[35] = b3 = pH

Page 150: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

This program read the ottrput from the simulator program and generates the conditional probabiliîies requiredfor the Buyesian neiwork.

Batch 1: COD inj% = A, tcycie = B. Wf = C, A L = D, FiC h t e = E, pH = F, "Ftiture n0deMH-f" = G

Batch 2: COD infl = A. tcycle = B. Vr/Vf = C, MLVSS = D, pH = E. COD eflc. = F. CHI rate = G

Mminrum # of states = 3. Minimum d of states = 2.

1. Define variabies.

2. SUBRO U TINE: ScanStatesO Scan constants fiom the input file staterh. See Table C.3 .E and C.4.E.

3. SUBROUTINE: GetRmdomO This sub-routine generates random numbers for each input variable. Note that the same random numbers are regenerated as that for gennum.exe so that the probabilities could be calculated in this program. Scans the values fiom the output file (sim.in) of the previous program and calculates the values of the output variables (in the correct form) using cenain formulas3.

0 The number of simulations produced for each combination (including output variables) is then to be counted.

4. SUBROUTINE: Probabilit y() Making sure than an error does not occur when there are oniy two states. For any input variable, since the denominator of any combination with medium state in it would be zero and you cannot divide by zero, the denominator is made equal to 10, so that 0/10 = O (little trick). Headings to be printed in the prob.out file. Calculating the probabilities and printing them out in the order of variable F: Low, Medium, High, and then Variable G: Low, Medium, High, into the output file prob.out.

5. MAIN PROGRAM: int main (void) Opening the file stater.in. Opening the file sim.in. Opening the file prob-out. Opening the file values2.out (only in readsimout2exe). ScanStates(). Headings to be printed in the fÙl1gen.in file. Loops GetRandomO. The amowt of random numbers needed to be generated for each variable is arraysize ( = stateA*stateB*stateC*stateD*stateE*factor). Probabilityo.

Page 151: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

0 Closing files.

COD effic. = (1 -(SefVfA))* 100.0 (Equation 3.7)

CI& rate = ((fN1000.0)*fC*21.0* 12.0*0.3SC ( 1 - (Sett7fA)))hB (Equation 3.8)

where, fA = COD influent, tB = t,~,, fC = V f l , and Seff is COD effluent.

Page 152: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Lavout of Ontnrwram\main.~

Thisprogram generates random nunabers for 5 input nodes; runs the simuiato* to produce values for the outpat nodes; a d then generates the conditio~iai probabilities

reptred for the Bayesiati network. Batch I : COD infl. = A, tcycle = B, Vr/Vf = C, Alk. = D, FJ C time = E,

pH = F, ''Future nodeirCHI" = G Batch 2: COD in$ = Al tcycle = B. Vr,YJ = C, ML YSS = D, pH = E.

COD eDc. = F, CH4 rate = G Maximum s of states = 3. Minimum rt ofstates = 2.

1. Define variables.

2. SUBRO UT'NE: ScanConstants~ r Scan constants from the input file consto.in. See Table C.3 .B and C.4.B.

3. SUBRO UTINE: ScutiStates~ Scan constants from the input file stateain. See Table C.3 .D and C.4.D.

4. SUBROUTlNE: GetRandom() 9 This sub-routine generates random numbers for each input variable.

These numbers are then converted in the correct form for the simulator to read using certain formulas'.

9 Both sets of nurnbers are to be pnnted in the output file fullgen.out with headings. Only the last set of numbers (for the simulator to read) is to be printed in the output file gemsin. in wit h no headings.

5 . SUBROUTTNE: Simu fator() Assigns the random numbers generated fiom the output file (gemsinin) to new variables2 to be read by the altered ANSBR simulator. The simulator mns and prints out values of the output variables on the user screen and also into the output file, sim. in. The values of the output variables (in the correct fom) are then calculated using certain formulas3.

6. SUBROUUNE: Countingo The nurnber of simulations produced for each combination is counted.

7. SUBROUï7NE: Checkhg0 Making sure that a minimum of 10 simulations for each combination is produced. If NOT, it notifies the user and exits the program.

8. SUBROUï7NE: Simcount() Printing the number of simulations for each combination.

Page 153: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Making sure than an error does not occur when there are only two States. For any input variable, since the denorninator of any combination with medium state in it would be zero and you cannot divide by zero, the denominator is made equal to 10, so that 011 0 = O (little tnck). Headings to be printed in the prob.out file.

O Calculating the probabilities and printing them out in the order of variable F: Low, Medium, High, and then Variable G: Low, Medium, High, into the output file prob-out.

9. MAIN PROGRAM: int main (void) Opening the file consto.in. Opening the file stateain. Opening the file fullgen.out . Opening the file gensimh. Opening the file prob.out. Opening the file simin. Opening the file values2 .out (on1 y in Oneprogram2. exe). ScanConstants(). Sanstates(). Headings to be printed in the fullgen-in file. Loops GetRandom(), Simulator(), Countingo. The amount of random nurnbers needed to be generated for each variable is arraysize ( = stateA*stateB*stateC*stateD*stateE* factor). Checkingo. S imcounto. Probability O. Closing files.

Vf = VWr*Vt (Equation 3.3) Vr=Vt-Vf (Equation 3.4) tr = tcycle - (td + ts) - tf (Equation 3.2) Sf = COD infl. Xs = PXstXtot/lOO.O (P means percentage distribution) Xi = PXi* Xtot/lOO.O Xf = PXf'@Xtot/100.0 Xp = PXp*xtot/1oo.o X1= PM*Xtot/100.0 Xb = PXb*xtot/10o.o Xa = PXa*xtot/1oo.o Mi = PXh*xtot/100.o

Page 154: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Batch 1: COD inj. = A, tcycle = B. Vr/Vf = C. Alk. = D. F/C time = E. pH = F, "Future node/rCHJ " = G

SNANET=A.ik. tf = F/C time * tcycle Xtot = (constantXtot*8.0/5.65)/(1 - V w r )

(Equation 3.1) (Equation 3.6)

Batch 2: COD in#! = A. tcycle = B, Vr/Vf = C, ML VSS = D, pH = E, COD effic. = F, C h rate = G.

0 pH = pH (input node) 0 tf = constantF/C time * tcycle

Xtot = (MLVSS*8.0/5.65)/(1 - VWr) (Equation 3.1 ) (Equation 3 -6)

' ~ e w variables

b l = Vf b2 = Vr b4 = tf b5= tr b6 = S f b7 = Xs b8 = Xi b9 = Xf blO = Xp b l l =XI b12 = A% b13 = Xa b14 = Mi

Batch 2:

COD effic. = (1 -(SetDfA))* 100.0 (Equation 3.7)

CH4 rate = ((fA/1000.0)*E*24.0* l2.O*O.35* ( 1 - (SefDfA)))/tB (Equation 3.8)

where, fA = COD influent, tB = &le, fC = V y , and Seff is COD effluent.

Page 155: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

APPENDIX E

Program Developed for

Prognosis of BBN

Page 156: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 157: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 158: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 159: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 160: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in
Page 161: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

APPENDIX F

Gas Flow Rate Calculations

Page 162: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Calculatinn O, - m c k us flow rate at atmosohcric nmsurg

From Metcalf & Eddy (M&E),

P = Ci2p/1000 (Equation 6-3 in M&E)

P = KQ, ln [(h+10.33)/10.33] (Equation 6- 12 b in M&E)

where, P = power dissipated (kW) G = mean velocity gradient (s") p = dynamic viscosity (Nslm') V = flocculator volume (m3) K = constant = 1.689 Q, = gadair flow rate at atmospheric pressure (m31min) h = air pressure at the point o f discharge expressed in feet of water (m)

Combining both equations,

Now, ~ ( ~ ~ 0 ~ = 0.97% x 10.' Nslrn2 v = 12 L = 0.012 m3 K = 1.689 G = 100 s-l h = height of liquid in the ANSBR (tigure below) in Shizas (2000)

= volumefarea = 0.0 12 m3/ ( x x 0.25 x 0.1 s2) m2 = 0.679 m

Using Equation F. 1,

Hence, Q, = 1093 &min.

Page 163: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

APPENDIX G

Simulation Conditions

Page 164: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table G.1 S d e c t d parameten to be entend into ANSBR mode1 to produce Table 4.3

#'

1 ,

2 3 4 5 6 7 8

L.

9 10

L

11 L

12 13

L

14 15

1

16 17

1

18 1

19 20 21

r

22 23 24 25

l

26

a Run #

VINr

0.25 O. 50 O. 50 O. 50 O. 50 O. 50 0.45 0.25 0.25 0.25 0.25 0.25 O. 15 0.35 0.35 0.35 O. 3 5 0.35 0.3 5 O. 50 0.5 0.5 0.5 0.5

0.175 O. 175

refers to Run

Vf(L)

3 .O0 6.00 6.00 6.00 6.00 6.00 5.40 3 ,O0 3 .O0 3 .O0 3 .O0 3 -00 1.80 4.20 4.20 4.20 4.20 4.20 4.20 6.00 6.00 6.00 6.00 6.00 2.10 2.10

# in Table

V. (L)

9.00 6.00 6.00 6.00 6.00 6.00 6.60 9.00 9.00 9.00 9.00 9.00 10.20 7.80 7.80 7.80 7.80 7.80 7.80 6.00 6.00 6.00 6.00 6.00 9.90 9.90

4.3.

F/C time

0.50 0.10 0.75 0.75 0.50 O. 50 0.25 0.25 0.10 0.10 O. 10 O. 70 0.50 O. 50 0.50 0.10 0.75 0.75 0.75 O. 10 O. 10 0.75 0.45 0.45 O. 58 0.58

18.00 18.00 18.00 18.00 14.00 14.00 18.00 18.00 8.00 14-00 14.00 14.00 18.00 18.00 18.00

, 22.00 22.00 22.00 22.00 18.00 18.00 18.00 18.00 18.00 36.00 18.00

tf (houn)

9.00 1.80 13.50 13.50

-

7.00 7.00 4.50 4.50 0.80 1.40 1.40 9.80 9.00 9.00 9.00 2.20 16.50 16.50 16.50 1.80 1.80 13.50 8.10

t, (hours)

7.00 14.20 2.50 2.50 5 .O0 5 .O0 11 .50 1 1.50 5.20 10.60 10.60 2.20 7.00 7.00 7.00 17.80 3.50 3.50 3.50 14.20 14.20 2.50 7.90

8.10 20.70 10.35

7.90 13.30 5.65

Page 165: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table G.l Cont'd Selcetcd panmeten to be entend into ANSBR model to produce Table 4.3

B. MLVSS distribution for diffenat combinations of Vfl, and MLVSS

Parameters -7K-tbT

Mi 3661

Xtot (mg CODL

in VI) 40744

Xtot (mg VSSiL

in12L) 20143

Page 166: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

APPENDIX H

More Diagnostic Results of the BBN

Page 167: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Tabie H.1 More Diagnostic Results of the BBN '

1 Owrrtiond Variables II 1

COD removd effwkncy i s low 18.5 100 100 100

1

Hl H2 H3 H4

81.5 O O O

62.9 67.5 69.6 61.4

37.1 32.5 30.4 38.6

23.5 20.4 100 O

16.7 51.7

O

- O

59.9 27.9

O

100

37.3 37.3 26.6 48.3

8.5 48.1 4.4 11.9

30.4 30.7 26.6 30.4

54.2 14.6 69.0 39.8

68.8 26.9 31.9 68.1

69.6 69.3 73.4 69.6

43.9 37.9 30.4

31.2 73.1 68.1 32.0

m

56.1 62.1 69.6

58.241.80

100 100 100 100

O O O O

25.7 74.4 76.7 28.0

74.3 25.6 23.3 72.0

Page 168: Development of a Bayesian Belief Network for Anaerobic ... · Development of a Bayesian Belief Network for Anaerobic Wastewater Treatment Bnan S.G.E. Sahely A thesis subrnitted in

Table E.2 Summary of Diagnostic Results in Table H.la

Case #'

b Case # is sirnilar to that in Table H. 1.

Upset - COD removal etriciency is low

' The evidence is cumulative. For example, Case H3 should be interpreted as

Evidenct entercd into

BBN'

COD effic. = L, Vflr = L, and COD id. = M.

Decrease Vfl ,

increase COD id. lncrease tqCle

Increase FIC time

I

Hl

H2

H3 . H4

Diagnosd (most probable) cause of upset

"LW = L, Medium =M, and High = H. The ranges of the States of the variables are in Table 3 . 1 1

Action thrt should be taken to conrît upset

COD effic. = L VdV, = L

COD id. = M , COD id. = H

Vflr = H COD id. = L

teycir = L FIC time = L