Você está na página 1de 86

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques.

Thesis submitted in partial fulfillment of the Requirements for the degree of

Master of Science in Technology


in

Instrumentation Engineering
By (Signature)

NITHIN VARGHESE NINAN


(Register Number: 122539010)

Under the guidance of (Signature) Dr. R Suresh HOD, Department of Chemical Engineering R V College of Engineering Bangalore

MANIPAL UNIVERSITY, MANIPAL

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques.
Thesis submitted in partial fulfillment of the Requirements for the degree of

Master of Science in Technology


in

Instrumentation Engineering
By

NITHIN VARGHESE NINAN


(Register Number: 122539010)

Examiner 1 Signature: Name:

Examiner 2 Signature: Name:

MANIPAL UNIVERSITY, MANIPAL

CERTIFICATE
This is to certify that this thesis work titled

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques.
Is a bonafide record of the work done by NITHIN VARGHESE NINAN Reg. No. 122539010 In partial fulfillment of the requirements for the award of the degree of Master of Science in Technology in Instrumentation Engineering under Manipal University, Manipal and the same has not been submitted elsewhere for the award for any other degree

(Signature) Guide Name: Shivajith C K Assistant Mangaer Biotech Automation Sartorius Stedim India Pvt. Ltd. Bangalore

ACKNOWLEDGEMENT

Under the esteem guidance of our project guide professor Dr. R Suresh, HOD Department of Chemical Engineering, R V College of Engineering, Bangalore, a detail study on Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques and its applications to various models has been studied as well as simulation has been done. We are very thankful for his wholehearted co-operation without which this project could not have been completed. I take this opportunity to express my sincere thanks and acknowledge the support received from, Shivajith C K, Assistant Manager, Sartorius Stedim Biotech Pvt. Ltd., for his valuable guidance and granting the permission to carry out the project at Sartorius Stedim Biotech Pvt. Ltd.

DECLARATION

I hereby declare that the entire work presented in this project was carried out by me under the guidance of Dr. R Suresh, HOD Department of Chemical Engineering, R V College of Engineering, Bangalore, and no part of it has been submitted for any degree or diploma in any institution previously. In keeping with the general practice of reporting scientific observations due acknowledgements have been made wherever the work described is based on the findings of other investigators. Any omissions, which might have occurred by oversight or errors in judgment, are regretted.

Date:

(Signature) Nithin Varghese Ninan Register Number: 122539010 Instrumentation Engineering, Batch 1

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Index
Contents
1. Abstract .................................................................................................................... 3 1.1 Problem Definition .................................................................................. 3 2. Introduction ........................................................................................................... 5 2.1 Process Definition................................................................................................. 5 2.1.1 Activated Sludge Processes ................................................................ 9 2.1.2 Biological Nutrient Removal .............................................................. 10 2.2 First Order Plus Dead Time Modelling ............................................................ 14 2.5 The BNR Process ............................................................................................... 19 3. Literature survey ................................................................................................ 24 3.1 Fuzzy Logic Control ........................................................................................... 24 3.1.1 Fuzzy If-Then Rule ............................................................................ 24 3.1.2 Fuzzy Reasoning ............................................................................... 25 3.2 Artificial Neural Networks .................................................................................. 26 3.2.1 Multi-Layer Perceptron ...................................................................... 28 3.2.2 Back-Propagation Learning Algorithm ............................................... 30 3.3 Integration of Fuzzy Logic and Neural Networks ........................................... 33 4. System Identification, Modelling and Simulation ............................................. 36 4.2 Development of FOPDT Models ........................................................... 41 5.Fuzzy Logic Controller Design ............................................................................. 44 5.1 Fuzzy Logic Controller Selection .......................................................... 44 5.2 Development of the Fuzzy Logic Controller .......................................... 44 6. A Brief History of Industrial MPC ........................................................................ 47 6.1 Principle of MPC .................................................................................. 52 6.2 Constraints ........................................................................................... 53 6.3 The Receding Horizon .......................................................................... 54 6.4 Optimization Problem ........................................................................... 57 6.5 Models .................................................................................................. 58 7 Tuning of the MPC-controller ............................................................................. 60 7.1 Sampling time T .................................................................................. 60 7.2 Prediction horizon P ............................................................................ 60 7.3 Control horizon M ................................................................................ 61 7.4 Weighting matrices of in- and outputs: u and y ............................. 61 8. The filter in MPC ................................................................................................... 61 8.1 First order filter .................................................................................... 62 8.2 Kalman filter ....................................................................................... 63 8.3 Extended Kalman filter ....................................................................... 63 9. State of art of MPC for WWTPs......................................................................... 65 9.1 Linear MPC ........................................................................................ 65 9.2 Nonlinear MPC ................................................................................... 66
Manipal Global Education Services Pvt. Ltd., Bangalore Page | 1

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

10. Dynamic Matrix Control ..................................................................................... 66 11. Implementation of MPC in MATLAB ................................................................ 70 11.1 MATLAB code .................................................................................... 70 11.2 OUTPUT IN MATLAB WINDOW ........................................................ 75 11.3 INFERENCE....................................................................................... 77 12. Conclusions ......................................................................................................... 79 13. Bibiliography ........................................................................................................ 80

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 2

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

1. Abstract
1.1 Problem Definition
The biological nutrient removal (BNR) stage of a wastewater treatment plant is a biochemical system requiring regulation of the dissolved oxygen (DO) concentration of the bioreactor. Typically, these processes are very slow and incorporate nonlinearities, significant dead time and many sources of disturbances, making them a challenge to control. Eective control of the BNR process leads to better quality euent that is eventually discharged into bodies of water. In addition, significant energy is used by large air blowers that supply process air to the bioreactors. Accordingly, a cost-savings can be realized in achieving good control of the BNR process in the form of energy conservation. Due to the length of time it takes to observe changes in a BNR bioreactor, system simulation is particularly well suited for developing a controller for the process. The BNR process is highly complex from a first principles modelling perspective, incorporating many variables of which some must be estimated, in addition to nonlinearities (Brdys and Maiquez, 2002). A first order plus dead time (FOPDT) modelling approach is proposed that drastically simplifies the modelling of the bioreactor and is based on the results of step tests performed on a subject bioreactor. By reason of the large degree of uncertainty inherent in the BNR process, a fuzzy logic controller (FLC) is proposed for the DO concentration in the bioreactor, as fuzzy logic lends itself particularly well to these types of systems. In addition, the FLC provides the capabilities of dealing with nonlinearities and non-symmetry in the final control element, as well as being able to be implemented as a simple lookup table. This project thesis provides a brief overview of Model Predictive Control (MPC).A brief history of industrial model predictive control technology has been presented first followed by a some concepts like the receding horizon, moves etc. which form the basis of the MPC. It follows the Optimization problem which ultimately leads to the description of the Dynamic Matrix Control (DMC).The MPC presented in this report is based on DMC. After this the application summary and the limitations of the existing

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 3

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

technology has been discussed and the next generation MPC, with an emphasis on potential business and research opportunities has been reviewed. Finally in the last part we generate Matlab code to implement basic model predictive controller and introduce noise into the model. We have also taken up some case studies like Swimming pool water temperature control and helicopter flight control etc. by applying the MPC controller on these models. Originally developed to meet the specialized control needs of power plants and petroleum refineries, MPC technology can now be found in a wide variety of application areas including chemicals, food processing, automotive, and aerospace applications Its reason for success is many, like it handles multivariable control problems naturally. But the most important reason for its success is its ability to handle constraints. Model predictive control (MPC) refers to a class of computer control algorithms that utilize an explicit process model to predict the future response of a plant. At each control interval an MPC algorithm attempts to optimize future plant behavior by computing a sequence of future manipulated variable adjustments. The first input in the optimal sequence is then sent into the plant, and the entire calculation is repeated at subsequent control intervals. The basic MPC controller can be designed with proper restrictions on the prediction horizon and model length. The prediction horizon has to be kept sufficiently larger than control horizon. But after applying to many other applications we find as the complexity increases then we need techniques other than DMC like generalized predictive control (GPC) which are better.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 4

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

2.

Introduction

2.1 Process Definition


In managed wastewater systems, wastewater is collected and routed through sewer systems to wastewater treatment plants. These plants vary in size and configuration but the function of all wastewater treatment plants remains the same, which is to produce a wastewater stream that can be safely discharged back into the environment and minimize the solid waste that is produced. A process flow diagram for a typical wastewater treatment plant is given in Fig. 2.1. As shown, wastewater enters the plant from the sewer where it is coarsely screened and degritted. The euent then flows to the primary clarifiers to allow initial sedimentation to occur. The settled sludge, known as primary sludge, is usually dewatered using centrifuges or sludge presses before disposal or stabilization. Following primary clarification, the euent flows to the aeration cells, or bioreactors, where it is aerated and retained to allow time for the biochemical reactions to take place which reduce suspended solids through oxidation (Grady et al., 1999). Following aeration, the euent flows to secondary clarifiers where a second stage of sedimentation occurs. The sludge that settles to the bottom of the secondary clarifiers is known as activated sludge. Activated sludge is a concentrated slurry (Grady et al., 1999), of which a portion is usually fed back to the aeration cells and a portion is wasted. The sludge destined for the aeration cells is referred to as return activated sludge (RAS) and the wasted sludge is referred to as waste activated sludge (WAS). The final stage of wastewater treatment is typically disinfection, either by ultraviolet light (UV) or chlorination. It is known that waters containing a low concentration of DO produce harmful aquatic eects. Wastewater euent consists of a large portion of soluble organic material (SOM), which serves as a nutrient source for aquatic microorganisms that consume oxygen as part of their metabolic cycle, reducing the available DO. Since these microorganisms can survive at lower concentrations of DO than higher life forms, an ecosystem is developed which distresses and precludes the latter. Wastewater also contains nitrogen and phosphorous, which act as nutrients and lead to the proliferation of aquatic vegetation in downstream bodies of water (Grady et al., 1999). This process is known as eutrophication and also leads to a reduction in DO.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 5

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Fig 2.1: Process flow diagram for a typical wastewater plant. There are four basic categories of pollutants in wastewater: soluble organic matter (SOM), insoluble organic matter (IOM), soluble inorganic matter (SIM) and insoluble inorganic matter (IIM). There are two basic types of unit operations found at wastewater treatment plants: physical unit operations and biochemical unit operations. Physical unit operations consist of activities like screening, degritting and sedimentation. Biochemical unit operations typically occur in a bioreactor where wastewater is exposed to microorganisms, resulting in biochemical reactions. In wastewater treatment, preliminary physical unit operations are usually carried out first (screening and degritting) to remove large objects and IIM followed by sedimentation (primary clarification). After sedimentation, the remaining IOM settles to the bottom of the basin and exits as underflow for

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 6

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

further treatment and/or disposal. The euent (overflow) then carries the soluble material to the next stage of treatment. Wastewater, in general, contains a very low concentration of reacting pollutants. As a result, biochemical unit operations are used on the wastewater stream at this stage as these types of operations are more ecient at low concentrations of reacting constituents (Grady et al., 1999). During the biochemical operations, the soluble material is converted into more benign forms such as gaseous nitrogen and car-bon dioxide. Further, during growth, the microorganisms capture the remaining IOM allowing it to be settled and removed during later physical unit operations (Grady et al., 1999). The unit operations of a typical wastewater plant are shown in Fig. 2.2. In a bioreactor, the primary characteristic of the biochemical environment for fostering microbial growth is the terminal electron acceptor (Grady et al., 1999). The three dierent types of electron acceptors used are: oxygen, organic compounds and inorganic compounds. If sucient quantities of DO are supplied to the bioreactor it is said to be aerobic. Anaerobic environments are those in which the electrode potential is highly negative and the terminal electron acceptors are the organic compounds carbon dioxide and sulfate. Environments in which nitrites and/or nitrates are the primary terminal electron acceptors are referred to as anoxic. In these environments, the electrode potential is higher and growth is more ecient than anaerobic environments due to the nitrite and/or nitrate contribution. However, aerobic environments remain the most ecient for microbial growth. The biochemical environment maintained in a bioreactor has a significant impact on the eectiveness of the treatment and dierent types of wastewater warrant dierent applications of biochemical environments. There are many dierent bioreactor configurations and the physical configuration of the bioreactor impacts the eectiveness of the operation. The two major classes of bioreactors are suspended growth and attached growth. The suspended growth type bioreactor requires sucient mixing to maintain suspension of the microorganisms, followed by a unit operation to remove the suspended biomass. In attached growth type bioreactors the microorganisms are grown as a biofilm solid surface. This discussion focuses on suspended growth bioreactors as the process under study is of this type.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 7

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Fig 2.2: Unit operations of a typical wastewater plant. Suspended growth bioreactors are implemented in several ways including the continuous stirred tank reactor (CSTR), the sequencing batch reactor (SBR) and the perfect plug-flow reactor (PFR). In a CSTR, the influent wastewater continuously flows through the bioreactor. Sucient mixing is provided to maintain a well-mixed and uniform environment, which aids in maintaining a constant average physiological state (Grady et al., 1999). Often a sedimentation stage follows the CSTR and the underflow slurry (secondary sludge) is recycled back to the bioreactor. CSTRs can be cascaded in series

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 8

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

to achieve additional operational flexibility. In a SBR, the wastewater does not flow continuously through the bioreactor. Instead a fixed volume of wastewater is reacted to completion at a time. These types of reactors are particularly flexible as the biochemical environment can be highly controlled to suit the quality of the wastewater. In a PFR, the constituents of the fluid flow through the bioreactor without mixing and in the same order in which they enter.

2.1.1 Activated Sludge Processes


The ASP is a well-known and extensively deployed method of secondary wastewater treatment that is capable of achieving a good quality euent. Activated sludge uses aerobic suspended growth of microorganisms to remove SOM from wastewater. The ASP primarily consists of the bioreactor and secondary clarification processes. The basic principle behind activated sludge is that when microorganisms are exposed to SOM, they will consume and reduce it. The microorganisms must be provided with sucient DO, which they require to survive and must be kept in a suciently suspended state to achieve good results. Both of these goals are met by introducing process air into the pre-treated wastewater stream. This can be done in a variety of ways including diused aeration, jet aeration and surface aeration. Diused aeration involves lining the bottom of the aeration basins with a diuser grid and forcing process air through the grid, usually utilizing large blowers. This method diuses air bubbles of varying sizes into the wastewater stream. Jet aeration utilizes aspirating devices that require the wastewater to be pumped through an ejector that mixes air into the pumped water stream. Surface aeration operates by pumping water into the air, after which the falling water contacts the water surface causing air to be mixed with the wastewater. Generally, diused aeration is suited for large, deep aeration basins, whereas jet aeration is suitable for smaller tanks and surface aeration is suitable for shallow aeration basins as the mixing is primarily concentrated at the surface. In ASPs, the aeration stage occurs in basins where the primary biochemical operations take place. The euent from the bioreactor is known as mixed liquor. Following aeration, a clarification stage takes place, which

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 9

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

allows for sedimentation of the microorganisms to occur. The settled microorganisms can then be recycled in concentration (i.e., RAS) back into the bioreactor and/or wasted (i.e., WAS). A schematic of the ASP is shown in Fig. 2.3. There are numerous configuration options for ASPs, which generally vary the geometric characteristics of the bioreactor itself. The trade-os between the various configurations are usually driven by capital cost requirements, eciency and operational complexity. Two of the more popular bioreactor configurations are called conventional activated sludge (CAS) and step-feed activated sludge (SFAS). The geometric characteristics of these configurations are shown in Fig. 2.4.

Fig 2.3: Simplified view of the activated sludge process. (Adapted from Grady et al. (1999))

2.1.2 Biological Nutrient Removal


Much of wastewater is human waste, containing nutrients and bacteria. In wastewater, the term nutrient generally refers to nitrogen and phosphorus, as these elements when deposited in bodies of water provide nutrition to lifeforms present in the water. This process is also known as eutrophication. The United States Environmental Protection Agency (EPA) oers the following description of how eutrophication aects surface water: Nitrogen and phosphorus are the primary causes of cultural eutrophication (i.e., nutrient enrichment due to human activities) in surface waters. The most recognizable manifestations of this eutrophication are algal blooms that occur during the summer. Chronic symptoms of over-enrichment include low dissolved oxygen, fish kills,

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 10

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

murky water and depletion of desirable flora and fauna. In addition, the increase in algae and turbidity increases the need to chlorinate drinking water, which, in turn, leads to higher levels of disinfection by-products that have been shown to increase the risk of cancer. Excessive amounts of nutrients can also stimulate the activity of microbes, such as Pfiesteria, which may be harmful to human health (US Environmental Protection Agency, 2007).

Fig 2.4: Two types of activated sludge processes. (a) Conventional activated sludge; (b) Step-feed activated sludge. (Redrawn from Grady et al. (1999)) Accordingly, a process that is capable of enhanced nitrogen and phosphorus removal is highly desirable. This is the goal of the BNR process, which uses the principles of the ASP, but through advanced bioreactor configuration is able to achieve higher levels of nitrogen and phosphorus removal. The history of the BNR process is interesting and deserves a brief discussion. Nitrogen and phosphorus removal technologies were developed separately, but con-currently, in the 1960s. During this time, developers of the processes were evaluating the use of various bioreactor zones and

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 11

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

configurations and their eects on euent quality. The bioreactor zones under study were aerobic (sucient oxygen), anaerobic (absence of oxygen and nitrates) and anoxic (absence of oxygen with presence of nitrates). Much research was dedicated to configurations that would yield good nitrogen removal, however, due to the high costs, both capital and operational, biological nitrogen removal processes received very little commercial attention. Whereas biological nitrogen removal processes were receiving much academic attention but little commercial attention, biological phosphorus removal was a phenomenon that was actively being observed in plugflow bioreactors that were uniformly aerated. This method of aeration yielded low DO concentration levels at the front of the process creating anaerobic zones which are now known to be crucial to biological phosphorus removal. While it is now known that biological reactions are largely responsible for the phosphorus removal, this was a point of controversy during initial development of the process. These two processes have since been integrated into a single process today which is referred to as biological nutrient removal. The framework for the BNR process was first introduced by Barnard (1975), who purported the concepts which form the basis for BNR. The first concept is that appropriate use of anoxic and aerobic zones as well as nitrate recirculation form a single operational and cost-eective approach to nitrogen removal. The second concept is that sucient removal of nitrate in the anoxic zone results in phosphorus removal. Using these concepts, various bioreactor configurations have been designed and implemented. The general BNR process is depicted in Fig. 2.5. The importance of the dierent zones in BNR is based on the terminal electron acceptor. The terminal electron acceptor in the aerobic zone is oxygen, in the anoxic zone it is nitrate-N and in the anaerobic zone where neither oxygen nor nitrate-N are present, it is carbon dioxide and sulfate (Grady et al., 1999). It is the alternating physiological environments created by the BNR bioreactor configuration that provide

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 12

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Fig 2.5: Process flow diagram for the BNR process. (Redrawn from Grady et al.(1999)) enhanced removal of nitrogen and phosphorus in the euent. In general, the aerobic zone provides SOM removal similar to the ASP, whereas the anaerobic zone provides phosphorus removal and the anoxic zone provides nitrogen removal. Biological nitrogen removal requires the use of both nitrification and denitrification processes. Nitrification occurs in aerobic zones where ammonia is converted first to nitrites and then to nitrates. Denitrification occurs in the anoxic cells when heterotrophic bacteria convert nitrate-N to nitrogen gas using nitrate-N as the terminal electron acceptor as they oxidize SOM. The nitrification and denitrification processes follow the nitrogen cycle, which is depicted in Fig. 2.6. Biological phosphorus removal involves the enrichment of the bioreactor zone with phosphorus accumulating organisms (PAOs). In the anaerobic zone, due to the lack of oxygen and nitrate-N, and the relatively short retention time, oxidation of SOM by heterotrophic bacteria does not occur. However, fermentation by these organisms will occur, resulting in the production of volatile fatty acids (VFAs). The VFAs are then transported and stored in the PAOs as polyhydroxyalkanoic acids (PHA) which are then used in cellular growth and the reformation of polyphosphate from the inorganic phosphorus found in the euent. With the phosphorus trapped in the PAOs it can then be settled and removed (Grady et al., 1999).

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 13

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Fig 2.6: Graphical representation of the nitrogen cycle exploited in the BNR process.

2.2 First Order Plus Dead Time Modelling


The response of a process to a step input provides a method of characterizing and subsequently modelling the process. Step testing the process involves inducing a step change in the process, usually performed by a setpoint change, and observing the response. Many processes, when step tested in this fashion, exhibit a first order response but with a time lag. The transfer function of a first order process can be modified to include a time lag. This type of model is known as a first order plus dead time (FOPDT) model. Many processes can be modelled in this fashion. From the response of the process to a step input, the three parameters that comprise a FOPDT model can be

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 14

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

surmised. These parameters are the steady-state process gain K, dead time TD and time constant . A graphical representation of the FOPDT model is shown in Fig. 2.7. The FOPDT model transfer function G(s) is expressed in the Laplace domain as

where K is the steady-state process gain Cs/m; Cs is the ultimate process response; m is the step input; is the time constant; and TD is the dead time (Smith and Corripio, 1985). When a process is step tested in this way, the response observed from the feedback sensor represents the lumped response of the process, the actuator and the feedback sensor The model obtained can then be used in a simulation of the process and provides the complete response of the system, including the dynamics of the sensor, the actuator and the process itself.

2.3

Fuzzy Logic Control

Introduced by Zadeh (1965), fuzzy set theory is a form of mathematics that is used to represent approximate knowledge. Contrary to crisp, bivalent logic, where quantities take on values of one (true) and zero (false), fuzzy logic provides a method of evaluating logical expressions where quantities can take on continuous values between zero and one. This fuzzy as opposed to crisp representation of the data lends fuzzy logic its power to evaluate approximate reasoning. A brief introduction to fuzzy logic and its application to control are provided as background to the proposed solution. Fuzzy logic provides a method of utilizing approximate reasoning to solve problems and is derived from the way that people approach problem-solving. People generally think in fuzzy terms, i.e., a person might say the

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 15

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Step

Process Response

m(t)

Cs t (t) C
Manipal Global Education Services Pvt. Ltd., Bangalore Page | 16

0.632 Cs

0 TD t Fig. 2.7: Graphical representation of a FOPDT model. (Adapted from Smith and Corripio (1985)) temperature outside is very hot, or the meat is slightly undercooked. Fuzzy logic aords the ability to use fuzzy descriptors or linguistic variables to define the inputs and output of the fuzzy system. In the above examples, the terms very and slightly are referred to as linguistic hedges and form part of the linguistic variable. The linguistic variables are then used in the formation of a rule base that is used to evaluate the output of the fuzzy system with respect to fuzzy sets (fuzzy inputs and outputs of the system). The way in which the linguistic variables are used to provide approximate reasoning is through the use of membership functions. Membership functions are used to define the degree of which a linguistic variable describes the state of the fuzzy element under study. When the set of all possible values that a fuzzy element can take on (i.e., the universe of discourse) is plotted, geometric areas of the set are assigned to one of the linguistic variables. Fuzzy logic operations are then used to evaluate the output of the fuzzy

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

system with respect to the rule base and the linguistic variables. Fuzzy rules generally take the form of an if-then statement, or an implication. For example, if A and B then C, where A, B and C are fuzzy objects, and where both A and B are conditions and C is the action. Accordingly, a method of evaluating these types of fuzzy expressions is required. Fuzzy logic operations are analogous to bivalent operations. The fuzzy operations complement, union and intersection correspond to the bivalent logic operations NOT, AND and OR. In bivalent logic, the implication of one set by another set is evaluated as the union of the first set with the complement of the second set. Bivalent logic implication is also extended for use in fuzzy logic. Implication, however, in the case of fuzzy logic, requires that connectives be expressed in terms of the membership functions for the corresponding sets. Fuzzy logic implication has been interpreted in several ways including Larsen implication, Mamdani implication, Zadeh implication, Dienes-Rescher implication and Lakasiewicz implication. The Mamdani implication has been selected for this work due to its wide acceptance. The expressions for fuzzy complement, union and intersection are given as (Karray and De Silva, 2004)
A

(x) = 1

A(x);

x X;
B(x)];

A B(x)

= max[ A(x); = min[ A(x);

x X; x X;

AB(x)

B(x)];

respectively, where X is the universe of discourse; x is the variable in X; A and B are fuzzy sets; A and B are membership functions of A and B, respectively; A is the membership function representing the fuzzy complement of A; AB is the membership function representing the union of A and B; and membership function representing the intersection of A and B.
AB

is the

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 17

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Fuzzy implication has been interpreted in multiple ways, however, since Mamdani implication is selected for this work, the Mamdani implication is provided which is given as (Karray and De Silva, 2004)
AB(x)

= min[ A(x);

B(y)];

x X; y Y;

(2.2)

where X and Y are the universes of discourse for A and B, respectively; y is the variable in Y ; and AB is the membership function representing A implies B. The above equations can then be used to develop the compositional rule of inference (CRI), which allows for the full evaluation of the if A and B then C expressions making up the rule base. Since both the AND and implication operations can be realized as min functions, and since the rules are joined using OR connectives, the membership function of the entire rule base is determined by (Karray and De Silva, 2004) (2.3) R(a; b; c) = max min[ Ai (a); Bi (b); Ci (c)]; i where R is the overall membership function for the rule base; i is the rule index; Ai, Bi and Ci are fuzzy sets; a, b and c are the variables in Ai, Bi and Ci, respectively; and Ai , Bi and Ci are membership functions of Ai, Bi and Ci, respectively. These equations are necessary for evaluating the fuzzy relationships that form the system. Linguistic variables are assigned to the membership functions making up the fuzzy set. The areas where the membership functions overlap is what specifically characterizes fuzzy logic, where the boundary between system states is not precisely defined and is partially composed of multiple states. Typical fuzzy membership functions are shown in Fig. 2.8. The figure depicts the membership function for a variable x. The linguistic variables for x are High, Okay and Low. Areas A, C and E are the parts of the fuzzy set that are exclusively High, Okay and Low, respectively. However, parts B and D are part High and Okay and part Low and Okay, respectively

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 18

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

High 1

Okay

Low

(x)

0.5

X A B 0 -1 -0.8 -0.6 -0.4 -0.2 0 x 0.2 0.4 0.6 0.8 1

C D

Fig. 2.8: Typical fuzzy membership functions. illustrating the fuzzy relationships. Membership functions can be constructed in several ways. Common types include Gaussian (as in Fig. 2.8), triangular and trapezoidal, but others exist. Fuzzy control is particularly well adapted to processes that are well understood by an expert. The expert assists in the development of the fuzzy rule base which describes in literal terms how the process is controlled. From the fuzzy rule base, membership functions are developed that characterize the relationships between the linguistic variables. Finally, fuzzy operations are carried out to evaluate the fuzzy expressions. Utilizing the fuzzy logic components described, a complete fuzzy inference system (FIS) can be constructed.

2.5 The BNR Process


The particular wastewater process under study is the BNR stage. As mentioned previously, BNR is an enhanced form of the ASP used in wastewater treatment. These processes are microbiological in nature and require regulation of the environment of the microorganisms contained in the bioreactor. The actual configuration of the bioreactor under study is show in Fig. 2.10.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 19

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Fig. 2.10: Process flow diagram for the bioreactor configuration. The process and instrumentation diagram (P&ID) for the process is shown in Fig. 2.11. The P&ID shows the major components of the process control system and their control signals to and from the industrial controller (programmable logic controller). As shown in Fig. 2.11, a header pipe carries the supply air to the FCVs controlling the airflow to each bioreactor cell. The process air is supplied by a team of blowers operating in a lead/lag configuration, whereby they are brought online sequentially as required. In this scheme, the blowers have full voltage non-reversing (FVNR) motors and the airflow through each blower is controlled by a FCV on its suction side. The blower system operates to keep a constant air pressure in the supply header through an independent control loop. The work in this paper focuses on developing a controller for the bioreactor FCVs. DO concentration of the aeration cells is a critical parameter in the overall control of the BNR process. The organisms in the bioreactor require a sucient supply of oxygen to act eectively and there is a band of control required. If too little oxygen is supplied the organisms are suocated. Conversely, if too much oxygen is supplied settling problems may occur later in the treatment process, in addition to wasted energy (Turmel et al., 1998). The dynamics that aect the DO inside of a bioreactor are complex and in some models the number of parameters involved exceeds sixty (Brdys and Maiquez, 2002). BNR is a specialized form of the ASP. Many approaches to controlling

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 20

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Fig. 2.11: Bioreactor process and instrumentation diagram. ASPs consider the entire process of which DO regulation is one component. In attempting to control the entire ASP automatically, elaborate mathematical models of the process must be constructed, which consist of many variables that cannot be measured and must be estimated. Furthermore, in many plants, certain parts of the ASP are controlled manually by the plant operations sta that monitor critical parameters on a daily basis. Samples of the wastewater are taken daily and analyzed in an oine laboratory. Accordingly, as much of the information collected is of a very coarse resolution, it does not lend itself to incorporation for automatic control of the system. The DO concentration of the bioreactor, however, is typically monitored continuously and it is highly desirable to be maintained at a specified setpoint. Meeting this goal helps to produce a good quality euent and minimize operating costs. For this reason, this work focuses specifically on controlling the bioreactor DO concentration without regard for the remainder of the BNR process. Manual changes in the parameters of the BNR process made by plant sta undoubtedly change the bioreactor dynamics, however, the goal of this work is to characterize the bioreactor process and develop worst-case conditions, which embody these potential changes in dynamics and subsequently test the controller according to the range of

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 21

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

process dynamics. For the purpose of controller design and simulation, an actual BNR bioreactor, is step tested and FOPDT models of the process are developed. The FOPDT modeling approach allows the direct incorporation of experimental data obtained from the actual plant into the simulation and design of the controller. While this method has the drawback of relying only on a snapshot of the process dynamics at a given point in time, it has the advantage of not having to rely on elaborate mathematical models of the ASP, which incorporate many assumptions and variables that cannot be measured. To address the fact that only a snapshot of the process is being evaluated, the bioreactor is tested under two separate conditions, a low wastewater flow condition and a high wastewater flow condition through the bioreactor. The objective of this experiment is to capture the dynamics of the process during each event to observe the process dynamics under these conditions and subsequently develop worst-case models for testing the controller performance. In wastewater plants, often, very little process instrumentation is available to assist in the control decisions of a bioreactor. In addition, it is very desirable to deploy a low maintenance, robust controller, that requires very little operator intervention for long-term, sustained operation. With this in mind, the work in this thesis focuses on developing a FLC for the bioreactor FCVs requiring only feedback of DO concentration and returning the required FCV stem position. In addition, as the dynamics of each cell of the bioreactor are dierent, one could develop individually tuned controllers for each cell, however, as simplicity, robustness and low-maintenance are the ultimate goal of this work, a single controller is developed that adequately controls each of the bioreactor cells under wide ranging and proposed worst-case process conditions. Finally, to ensure the controller is easy to realize in an industrial controller, an algorithm is developed to approximate the control surface of the optimal FLC as a lookup table. The lookup table can be implemented in any programmable logic controller (PLC) and is ideal for fast computation. The final result of this work is to be able to input one or more FOPDT pro-

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 22

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

cess models and return a lookup table representing an optimal fuzzy control surface, optimized for an individual system or several systems concurrently. This technique can then be used to tune the controller optimally across its entire operational range, providing that FOPDT models of the process at its operational extremes can be obtained.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 23

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

3.

Literature survey

3.1 Fuzzy Logic Control


Based on Zadehs theory of fuzzy sets, the concept of fuzzy logic has been successfully applied to the control of industrial processes particularly those that are ill-defined but which can be successfully controlled by human operators. The basic idea of this approach is to incorporate the experience of human operators in the design of the controllers. The value of the inputs and outputs need not be numerical and may be expressed in natural language. Most commonly, a fuzzy logic model includes a mapping of input values to output values using simple IF-THEN statements, such as IF room temperature is high, THEN supply more cool air to the room. These types of mappings permit the incorporation of expert knowledge with the fuzzy logic model.

3.1.1 Fuzzy If-Then Rule


Assuming there are two inputs, x and y , to the system and the output is z . An example of a fuzzy if-then rule is: If x is Ai and y is Bi , then z is Ci . where x , y and z are linguistic variables, Ai , Bi and Ci characterized

are fuzzy sets

by membership functions. Another form of fuzzy if-then rule, T-S type proposed by Takagi and Sugeno (1985), has fuzzy sets involved only in the antecedent. If x is Ai and y is Bi , then z = c0i + c1i x + c2i y where the consequent of the rule is a linear function of the input variables. A simpler form is extensively used, which is actually a zero order T-S fuzzy rule. If x is Ai and y is Bi , then z = zi where zi is a crisply defined number. Through the use of linguistic labels and membership functions, a fuzzy if-then rule can easily capture the essence of humans experience. Fuzzy if-then

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 24

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

rules form the core of the fuzzy inference system to be introduced below.

3.1.2 Fuzzy Reasoning


Fuzzy reasoning is an inference procedure used to derive conclusions from a set of fuzzy if-then rules and one or more conditions. The steps of fuzzy reasoning performed by fuzzy inference systems are (Shaw, 1998): Compare the input variables with the membership functions in the antecedent to obtain the membership values of each linguistic label (fuzzification). Combine the membership values on the antecedent to get firing strength (weight) of each rule. Generate the qualified consequent of each rule depending on the firing strength. Aggregate the qualified consequent to produce a crisp output (defuzzification).

3.1.3 Fuzzy Inference System


Basically, a fuzzy inference system is composed of four functional blocks as shown in Fig. 3-1 (Jang, 1993):

Knowledge Base

Input (Crisp) Fuzzification

Data Base

Rule Base Defuzzification

Output (Crisp)

(Fuzzy)

Decision-Making Unit

(Fuzzy)

Fig. 3-1 Basic fuzzy inference system A fuzzification interface which transforms the crisp inputs into degrees of match with linguistic values. A knowledge base which contains a number of fuzzy if-then rules and

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 25

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

defines the membership functions of fuzzy sets used in the fuzzy rules. A decision-making unit, sometimes referred to as an inference engine, which performs the interface operations on the rules. A defuzzification interface which transforms the fuzzy results into crisp outputs. Depending on the types of fuzzy reasoning and fuzzy if-then rules employed, fuzzy inference systems can be classified into different types: Mamdani fuzzy inference system: The overall fuzzy output is derived by applying max operation to the qualified fuzzy outputs (each of which is equal to the minimum of firing strength and the output membership function of each rule). The centroid of area, bisector of area and mean of maximum are normally used to obtain the final crisp outputs from the fuzzy outputs. Takagi-Sugeno fuzzy inference system: This system is applicable for Takagi-Sugeno type rules. The final outputs are the weighted average of each rules outputs. When the consequent of rules are crisp value, the overall outputs are the weighted average of each rules crisp outputs. The following features have effect on the performance of fuzzy logic controllers (FLCs) (Pedrycz, 1989). Scaling factors for input and output variables. Membership functions of fuzzy sets. Setting of fuzzy rules.

3.2 Artificial Neural Networks


One of the most important capabilities of an artificial neural network (ANN) is that it can be trained to do a mapping between input and output variables by adjusting a set of weights and thresholds of a connectionist model based on

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 26

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

training examples. It attempts to achieve good performance through massive interconnections of simple computational elements or neural units. An artificial neural network model is characterized by its architecture, its processing algorithm and its training algorithm. The network architecture specifies the arrangement of neural connections while the type of units is characterized by the activation function used. For a given architecture, the neural network is used in two different modes: the processing mode and the training mode. In the processing mode, the processing algorithm specifies how the neural units compute the outputs for any set of inputs and for a given set of weights. The training algorithm specifies how the neural network adapts its weights for all training patterns (Haykin, 1999). With respect to the architecture, four main types of neural networks can be distinguished: Layered feed-forward neural networks, where a layer of neurons receive inputs only from the neurons from the previous layer, such as multi-layer perceptrons. Recurrent neural networks, where the inputs to neurons are the nets previous outputs as well as inputs from external sources. Laterally connected neural networks, which consist of feedback input units and a lateral layer consisting of such neurons that are laterally connected to their neighbors. Hybrid networks, which combine two or more of the above features.

The training algorithms for neural networks can be classified into supervised learning and unsupervised learning. In supervised learning, the networks are presented with a set of example input-output pairs and trained to implement a mapping that matches the examples as closely as possible. In contrast, for unsupervised learning, the networks are presented with only the input samples, and learned to group these samples into classes that have similar feature.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 27

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

3.2.1 Multi-Layer Perceptron


The multi-layer perceptron (MLP) is the most used and studied artificial neural network. According to the Kolmogorov theorem (Kolmogorov, 1957), a threelayer perceptron can be trained to approximate any non-linear function. Thus, the MLP can be a suitable tool for obtaining good approximate solutions in complicated mapping problems. A MLP is formed from interconnections of many basic neurons and are typically of the structure shown in Fig. 3-2. As shown in Fig. 3-2, in addition to the necessary input layer and output layer, there is also a hidden layer. This structure is referred to as a three-layer network in this work because it has three layers of nodes. However, it has only two layers of processing elements, the hidden layer and the output layer.
Hidden Layer Input Layer Output Layer

Fig 3-2 Simple architecture of a multi-layer perceptron In these layers, each neuron in a layer is connected to neurons in the previous and in the next layer, but it is not connected to any neuron in the same layer. These connections between neurons have their adjustable weights, which are adjusted during the training process. The inputs to each processing neuron are multiplied by their corresponding weight and the weighted sum is then acted upon by an activation function before the output.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 28

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

x0 = 1 w0

wi xi

f ()

w
n
n

Fig. 3-3 Structure of a neuron Fig. 3-3 shows the structure of a single neuron. The function of the neuron can be described by: = wi xi y = f ( ) (2-2) where y is the output of the neuron, xi , i = 0,K, n are the n inputs to the neuron, wi , i = 0,K, n are the weights connecting the input xi to the neuron, and f () is the activation function which operates on the weighted sum of input, v . Typically, in addition to the inputs, a bias input is also added. If x0 is used as the bias input, it is normally set to a constant value of 1 and the bias is adjusted during training through adjustment of the bias weight w0 . The following activation functions are commonly used: Threshold function: (2-1)

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 29

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

1, f () = 0,

0 (2-3) <0

Sigmoid function (shown in Fig. 2-4): 1 (unipolar) f () = 1 +e

(2-4)

1ev or, (bipolar) f (v) = 1+ e


v

(2-5)

f () 1 1

f ()

-1

(a) Unipolar

(b) Bipolar

Fig. 3-4 Sigmoid functions

3.2.2 Back-Propagation Learning Algorithm


The MLP is a supervised-training neural network, that is, its training process requires training pairs consisting of the input vectors and the corresponding desired output vectors. Upon each presentation of a training pair, the

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 30

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

connecting weights are adjusted to reduce the difference between the target or desired outputs and the actual outputs of the network. The training set, comprising many training pairs, is presented to the neural network repeatedly until the error decrease below the desired level. Study of different learning algorithms is always a very active area of the research in artificial neural networks. To date, many algorithms have been developed, among which the back-propagation (BP) algorithm is the most widely used. Before the BP algorithm is derived, the following notations are introduced: ylj ( p) net lj ( p) wlji ( p) d j ( p) j ( p) Nl L P
l

:output

of the jth node in layer l for the pth training example net input to

: the jth node in layer l for the pth training example : weight connecting the ith node in layer l 1 to the jth node in layer l for the pth training example : desired response of the jth output node for the pth training example : local gradient for jth node in layer l for the pth training example : number of nodes in layer l : number of layers : number of training examples

The nodes in the first layer only transmit the inputs to the second layer. Referring to Fig. 2-3, the output of a node in layer l , for l 2 , is given by ylj ( p) = f (net lj ( p)) where
l net j ( p) =

(3-6)

N
l1

w ji ( p) yi

l 1

( p)

(3-7)

i=0

For the special cases, we have yi1 ( p) is the ith component of the input vector to the network y0l1 ( p) =1, and wlj0 ( p) is the bias weight f () is the activation function. BP uses a gradient search technique to find the network weights that minimize an objective function. The objective function to be minimized is

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 31

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

usually the average squared error function:


J av = 1

J ( p)

(3-8)

P p=1

where J ( p) is the total squared error at the output layer for the pth example:
N

J ( p) =

1 2

(d j ( p) y j ( p))

(3-9)

j=1

where NL is the number of nodes in the output layer. The weights of the network are determined iteratively according to: wlji ( p +1) = wlji ( p) + wlji ( p) (3-10)
J ( p ) w ji ( p) =
l

w ji ( p)

(3-11)

where is a positive constant called the learning rate. To implement this algorithm, an expression for the partial derivative of J ( p) with respect to each weight in the network is developed. For an arbitrary weight in layer l , this can be computed using the chain rule:

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 32

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

wlji ( p) = lj ( p) yil 1 ( p)

(3-17)

where the kth neuron in the l +1 layer is connected to the jth neuron. Finally, the correction wlji ( p) is defined by: The above equations comprise the back-propagation learning algorithm. At the beginning of the training process, all the connecting weights are usually initialized to some small random values. The learning rate can be fixed or adaptively chosen in a number of ways. The process of computing the gradient and adjusting the weights is repeated until the output error decrease to some specified level. The multi-layer perceptron can be used as a universal approximator, a classifier or a regression machine.

3.3 Integration of Fuzzy Logic and Neural Networks


Fuzzy logic and neural networks have been briefly overviewed in the previous sections. Table 3-1 lists the characteristics of fuzzy logic and neural networks. It can be seen that fuzzy logic and neural networks have several characteristics in common. For example, both are model-free function estimators that can be adjusted or trained for improved performance. However, each has its own advantages. The advantages of fuzzy logic over neural network are its tolerance for imprecision and explicit knowledge

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 33

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

representation. On the other hand, neural networks offer other advantages such as the ability to learn and to generalize from these. In this regard, it is believed that the integration of fuzzy logic and neural networks can leverage the advantages of the two individual techniques. Table 3-1 Characteristics of fuzzy logic and neural networks (Medsker, 1995) Properties of intelligent systems Function estimators Trainable, dynamic Improvement with use Parallel implementation Numerical Tolerance for imprecision Explicit knowledge representation Adaptive Optimising Interpolative Tolerance for noise Fuzzy logic Neural Networks

Research in the use of fuzzy logic with neural networks has been progressing at a rapid pace during the last few years. The integration of fuzzy logic and
Manipal Global Education Services Pvt. Ltd., Bangalore Page | 34

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

neural networks can be viewed from different perspectives. In terms of applications, numerous studies have been done on the improvement of control systems, conventional or fuzzy, by use of the neural technology. Other applications modify neural networks, supervised or unsupervised, with fuzzy techniques to improve their performance. The main approaches to integration of fuzzy logic and neural networks can be summarized as follows: fuzzy connectionst expert system, neural networks for designing and tuning fuzzy systems, FAM (fuzzy associative memory), FCM (fuzzy cognitive map) and FNN (fuzzy neural networks).

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 35

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

4. System Identification, Modelling and Simulation


The bioreactor under study is relatively slow to respond and generally it is not desir-able to develop the controller by experimenting with the actual process. Therefore, in order to develop the proposed FLC and further optimize it, modelling the system is necessary to facilitate simulation. One of the objectives of this work is to develop a controller that is robust enough to perform well for multiple process models, several of which are modelled directly from raw process step testing data and two that represent worst-case scenarios. If this objective can be met then the controller is likely robust enough to provide good performance in spite of less than perfect modelling. However, given the diculty in tuning the proposed controller in the field, several potential sources of error are incor-porated into the models including a nonlinear FCV, continuous random disturbances and low-pass filtering of the feedback signal.

4.1 Bioreactor Step Testing


As mentioned, FOPDT models provide a realistic approach to system identification for the purpose of system modelling. Much of the previous work in modelling a bioreactor for the purpose of DO control system simulation has been con ducted using analytical models derived from mass-balance equations. The analytical models attempt to incorporate the vast physical, biological and chemical properties present in a bioreactor, but for practical use often require several variables to be estimated. Development of FOPDT models through step testing is chosen for this work due to the realistic nature of the technique. Through step testing the actual bioreactor under study, the response of the actual process to a step input is observed and characterized. In FOPDT modelling, higher order systems are characterized by a first order approximation plus a transport lag. The three parameters of the FOPDT model (time constant, steady-state process gain and dead time) are actually a lumping together of many of the actual parameters of the process. The purpose is to fit the process response to a curve that is simpler to express. In turn, this means that it is more dicult to capture the operational ranges of the process to understand the process capability, since the parameters of the model are an abstraction of the actual process parameters. One of the

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 36

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

drawbacks to FOPDT modelling through step testing is that the process response is only observed under the operating conditions present during testing, while the process may respond dierently under alternative operating conditions. Thus, in some cases it is advantageous to observe and subsequently model the process response under multiple operating conditions to understand the process. In the case of the bioreactor under study, there are many process parameters that aect the response of the system. These include but are not limited to the physical dimensions of the bioreactor and its associated piping and components, pressure in the process air header, flow rate of the wastewater, quality of the secondary sludge, flow rate of the RAS, flow rate of the WAS, OUR in the bioreactor, quality of the wastewater, temperature of the wastewater, temperature of the process air, etc. There are many more but these are examples of the actual process parameters that would need to be considered in any analytical model of the bioreactor. By contrast, step testing presents a simple, but eective method of obtaining a reasonably accurate model. This is especially valid for large, slow processes that do not need to be controlled precisely, but need to perform reasonably well over a wide range of process conditions. It was determined through consultation with the Operators of the bioreactor that one of the most important factors in the performance of the bioreactor is the rate of wastewater flow. During times of high flow, the wastewater does not have the same retention time in the bioreactor and also the high flows tend to change the dynamics of the organisms in the bioreactor. Therefore, in order to characterize the process, two conditions are selected to provide two types of models that establish a worst-case operational range of the system. The process conditions selected for this purpose are when the bioreactor is experiencing low or normal wastewater flow rates and when it is experiencing high wastewater flow rates, such as during a storm or melt event. Therefore, each of the three cells is step tested during both low flow and high flow conditions, giving the following specific conditions: cell 1 low flow (C1LF), cell 2 low flow (C2LF), cell 3 low flow (C3LF), cell 1 high flow (C1HF), cell 2 high flow (C2HF) and cell 3 high flow (C3HF). The experimental step testing data is plotted in Fig. 4.1.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 37

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

The process and instrumentation diagram (P&ID) for the bioreactor shown in Fig. 2.11 depicts the team of blowers which supply process air to a common header. The common header is shared between two bioreactors and it makes a constant header pressure available to the cells through a modulating, electrically actuated valve. The operates in such a way that blowers are brought online according to the demand for air, as sensed by a pressure of the bioreactors team of blowers and taken oine transmitter on the

common header. One important point to consider in this test scenario is that if the system dynamics change significantly and a blower needs to be brought online or taken oine during the test, it could potentially cause a significant undesirable disturbance to the system and compromise the test data. The blower control system is not part of this work, however, it is important to understand how it works in order to appreciate how the step testing is carried out. The blowers are full-voltage non-reversing (FVNR) motors. The airflow through each blower is controlled by modulating an electrically actuated valve on the suction side of the blower. The operational regime of the blower system is such that if the demand for process air is reduced beyond a certain threshold, then blowers must be taken oine or they will automatically shut down due to electrical current limitations, possibly causing an undesirable disturbance. Hence, if the bioreactor FCVs are closed for step testing, it will cause this very situation and as the valves are opened, and demand for process air increases, blowers will be brought online causing step changes in the header pressure.
6 4.8 3.6 DO (mg/L) 2.4 1.2 45 Plant Flow (MLD) 36 27 18 9

30

60 Time (min.) (a)

90

120

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 38

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

1.5 1.2 0.9 DO (mg/L) 0.6 0.3 30 60 Time (min.) (b) 90


Cell 1 Cell 2 Cell 3 Plant Flow

75 Plant Flow (MLD) 60 45 30 15 120

Figure 4.1: Plant flows during bioreactor step testing. (a) Low flow condition; (b) High flow condition. In addition, if the blowers are brought online, and then are taken oine again, they have a ten minute restart inhibit period before they can be brought online again. The situation described above is mitigated by testing only one of the two bioreactors and utilizing the second bioreactor to assist in manually controlling the conditions of the process air header to ensure that blowers are not brought online or taken oine during testing. It is noted that this method in conjunction with the existing blower control loop produces a very stable header pressure. The step testing data is plotted with the header pressure in Fig. 4.2, showing a header pressure setpoint of 55 kPa being tracking very tightly. The step testing is completed by first closing the FCVs for the selected bioreactor. Each cell is then tested individually by opening the FCV to 100%. The response of the DO concentration in the bioreactor is measured by DO transmitters and is recorded in the supervisory control and data acquisition (SCADA) system. The step test results are shown in Fig. 4.1 and 4.2. From the results it can be generalized that when the flow is low, the process has a higher gain. An important characteristic of a system where multiple processes are present is whether the processes interact. Interacting processes typically require a decoupling mechanism for the controllers to avoid fighting each other. In the
Manipal Global Education Services Pvt. Ltd., Bangalore Page | 39

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

case of the bioreactors in this work, they are designed such that wastewater flows in one direction and there are baes between the aeration cells that allow only a few inches of water to flow over to the next cell. This design minimizes the backflow of oxygen from downstream aeration cells. 6
4.8 DO (mg/L) 3.6 2.4 1.2 30 60 Time (min.) (a) 90 60 Pressure (kPa) Pressure (kPa) 48 36 24 12 120

1.5 1.2 DO (mg/L) 0.9 0.6 0.3 30 60 Time (min.) (b) 90


Cell 1 Cell 2 Cell 3 Pressure

60 48 36 24 12 120

Fig. 4.2: Header pressure during bioreactor step testing. (a) Low flow condition; (b) High flow condition. The step testing is completed in the order of the most downstream cell to the least downstream cell. This means that once a cell is tested, because it cannot interact with upstream cells, it can be returned to service. This is demonstrated by the results in that during both tests, when cell 3 is tested in isolation, no response is observed in cells 1 and 2. Since the DO does not migrate to upstream cells, the cells do not interact. One might presume that as the wastewater flows downstream it carries
Manipal Global Education Services Pvt. Ltd., Bangalore Page | 40

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

with it some DO, however, the test results do not indicate this. During the low flow step testing, each cell is returned to service after it is tested. However, during the high flow step testing, cell 1 and cell 3 are inadvertently returned to service for a brief period while step testing cell 2. The results indicate that the contribution of DO from cell 1 and cell 3 to cell 2 during this period is negligible, and that very little DO flows upstream or downstream to adjacent cells.

4.2 Development of FOPDT Models


From the step testing data, the values for the FOPDT model parameters for each process are extracted. There are methods to characterize the response graphically in a piecewise fashion by observationally extracting the dead time and steady-state process gain and then deriving the time constant. However, for the purpose of this work, in order to generate the models as accurately as possible, the models are simulated and tuned to match the step test process reaction curves as closely as possible. The FOPDT model step responses are plotted with the actual step test process reaction curves in Fig.s 4.3 and 4.4. While the data collected during step testing is not perfect due to the number of disturbances inherent in the process, the FOPDT models produce step response curves that match the actual process reaction curves very well. Two proposed worst-case models are developed by inspecting the process models obtained experimentally and the use of two assumptions. The two assumptions are that increasing process gain leads to decreased stability and that increasing dead time leads to decreased stability. The time constant of the process is varied to provide two extremes, one when the time constant is relatively fast and one when it is relatively slow. The largest time constant is doubled and the smallest time constant is halved to create the two scenarios. The other two parameters, process gain and dead time, are doubled for each scenario to create the two worst-case scenarios at opposite extremes of the operational range of the bioreactor. The selected values for the parameters of the process and worst-case FOPDT models are shown in Table 4.1.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 41

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Table 4.1: Selected values for the parameters of the FOPDT models. process gain; TD: dead time; : time constant Condition Cell 1 Low Flow Cell 2 Low Flow Cell 3 Low Flow Cell 1 High Flow Cell 2 High Flow Cell 3 High Flow Worst-Case Slow Worst-Case Fast K (mg/L/%) 0.0420 0.0265 0.0520 0.0135 0.0059 0.0092 0.104 0.027 TD (min.) 0.67 1.30 3.50 3.50 0.67 0.67 7 7 (min.) 13.10 10.63 12.00 11.85 7.68 4.13 26.200 2.065

K:

4.5 3.6 (mg/L) DO 0.9 2.7 1.8


Data Model

16 Time (min.) (a)

24

32

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 42

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

3 2.4 (mg/L) DO 0.6 9 (b) 18 Time (min.) 27 36 6 4.8 (mg/L) DO 1.2 22 33 Time (min.) (c) Fig. 4.3: FOPDT model step responses for each bioreactor cell for the low flow condition. (a) Cell 1; (b) Cell 2; (c) Cell 3. 11 44 3.6 2.4 1.8 1.2

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 43

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

5.Fuzzy Logic Controller Design


In this section the proposed FLC design is introduced and a similarly tuned PID controller is used as a benchmark for assessing the performance of the hand tuned FLC. The controllers are step tested in simulation and the results are compared. Converting the FLC into a lookup table and subsequent simulation is also treated in this section.

5.1 Fuzzy Logic Controller Selection


The BNR process is nonlinear with strong coupling of process variables (Liu et al., 2006). Further, control decisions must be made to regulate the DO concentration in the bioreactor without complete knowledge of the state of the biochemical system. These characteristics strongly suggest the use of soft computing methods that are known for their capabilities in overcoming these issues (Karray and De Silva, 2004). Fuzzy logic allows systems that are ill-defined or dicult to define analytically to be approximated in a useful way by incorporating human knowledge (Karray and De Silva, 2004). Additionally, fuzzy logic provides a flexible framework for dealing with nonlinearities. Another attractive feature of a FLC is that the FIS is a control surface that maps the FLC inputs to its outputs. This surface can be approximated as a lookup table, making it wellsuited for implementation in an industrial controller. For these reason, a fuzzy based approach is selected. One potential drawback of FLCs themselves is that they can be computationally expensive to execute. In the case of this work, however, the system itself is quite slow with a sampling period of 0.33 minutes. This type of system can easily tolerate the additional computation time to execute the FLC.

5.2 Development of the Fuzzy Logic Controller


The FLC developed manipulates the stem position (% open) of the FCV supplying air to the bioreactor cell based on feedback of the DO concentration in that cell. The FLC has two inputs, the error in DO concentration and the rate of change of DO concentration, and one output, the FCV opening/closing velocity.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 44

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

A fuzzy system is composed of a fuzzy rule base (linguistic variables that describe the state of the system under given conditions) and membership functions which de-fine to what degree a particular measurement belongs to a particular state of the system. The Mamdani method for fuzzy inference, which defuzzifies the output vari-able by finding the centroid of the membership function, is selected, as it is widely accepted and conducive to human input. The following are the five simple rules that form the fuzzy rule base for the proposed controller: 1. IF DO Concentration is Okay THEN FCV Velocity is No Change 2. IF DO Concentration is High THEN FCV Velocity is Close Fast 3. IF DO Concentration is Low THEN FCV Velocity is Open Fast 4. IF DO Concentration is Okay AND DO Rate of Change is Positive THEN FCV Velocity is Open Slow 5. IF DO Concentration is Okay AND DO Rate of Change is Negative THEN FCV Velocity is Close Slow The fuzzy membership functions for the FLC input and output variables are shown in Fig. 5.1.
Degree of membership 1 High 0.8 0.6 0.4 0.2 0 1 0.5 0 DO Error None 0.5 1 Okay Low

Degree of membership

1 Negative 0.8 0.6 0.4 0.2 0 0.1 0.05

Positive

0 DO Rate of Change

0.05

0.1

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 45

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Degree of membership

1 Close Fast 0.8 0.6 0.4 0.2 0 1

Close Slow

No Change

Open Slow

Open Fast

0.5

0 Velocity

0.5

Fig. 5.1: FLC fuzzy membership functions. (a) Input variable: error in DO concentration; (b) Input variable: rate of change of DO concentration; (c) Output variable: FCV opening/closing velocity.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 46

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

6. A Brief History of Industrial MPC


This section presents an abbreviated history of industrial MPC technology. Control algorithms are emphasized here because relatively little published information is available on the identification technology. The development of modern control concepts can be traced to the work of Kalman in the early 1960's, who sought to determine when a linear control system can be said to be optimal [, ]. Kalman studied a Linear Quadratic Regulator (LQR) designed to minimize an quadratic objective function. The process to be controlled can be described by a discrete-time, deterministic linear state-space model:

represents process inputs, or manipulated variables; The vector describes output measurements. The vector represents process states. The state vector is defined such that knowing its value at time k and future inputs allows one to predict how the plant will evolve for all future time. Much of the power of Kalman's work relies on the fact that this general process model was used. The objective function to be minimized penalizes squared input and state deviations from the origin and includes separate state and input weight matrices and to allow for tuning trade-offs:

where the norm terms in the objective function are defined as follows:

Implicit in the representation is the assumption that all variables are written in terms of deviations from a desired steady-state. The solution to the LQR

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 47

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

problem was shown to be a proportional controller, with a gain matrix computed from the solution of a matrix Ricatti equation:

The infinite prediction horizon of the LQR algorithm endowed the algorithm with powerful stabilizing properties; it was shown to be stabilizing for any reasonable linear plant (stablizable and detectable) as long as the objective function weight matrices Q and R are positive definite. A dual theory was developed to estimate plant states from noisy input and output measurements, using what is now known as a Kalman Filter. The combined LQR controller and Kalman filter is called a Linear Quadratic Gaussian (LQG) controller. Constraints on the process inputs, states and outputs were not considered in the development of LQG theory. Although LQG theory provides an elegant and powerful solution to the problem of controlling an unconstrained linear plant, it had little impact on control technology development in the process industries. The most significant of the reasons cited for this failure include :

constraints process nonlinearities model uncertainty (robustness) unique performance criteria Cultural reasons (people, education, etc.)

It is well known that the economic operating point of a typical process unit often lies at the intersection of constraints []. A successful industrial controller must therefore maintain the system as close as possible to constraints without violating them. In addition, process units are typically complex, nonlinear, constrained multivariable systems whose dynamic behavior changes with time due to such effects as changes in operating conditions and catalyst aging. Process units are also quite individual so that development of process models from fundamental physics and chemistry is difficult to justify economically. Indeed the application areas where LQG theory had a more immediate

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 48

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

impact, such as the aerospace industry, are characterized by physical systems for which it is technically and economically feasible to develop accurate fundamental models. Process units may also have unique performance criteria that are difficult to express in the LQG framework, requiring time dependent output weights or additional logic to delineate different operating modes. However the most significant reasons that LQG theory failed to have a strong impact may have been related to the culture of the industrial process control community at the time, in which instrument technicians and control engineers either had no exposure to LQG concepts or regarded them as impractical. This environment led to the development, in industry, of a more general model based control methodology in which the dynamic optimization problem is solved on-line at each control execution. Process inputs are computed so as to optimize future plant behavior over a time interval known as the prediction horizon. In the general case any desired objective function can be used. Plant dynamics are described by an explicit process model which can take, in principle, any required mathematical form. Process input and output constraints are included directly in the problem formulation so that future constraint violations are anticipated and prevented. The first input of the optimal input sequence is injected into the plant and the problem is solved again at the next time interval using updated process measurements. In addition to developing more flexible control technology, new process identification technology was developed to allow quick estimation of empirical dynamic models from test data, substantially reducing the cost of model development. This new methodology for industrial process modeling and control is what we now refer to as Model Predictive Control (MPC) technology. In modern processing plants the MPC controller is part of a multi-level hierarchy of control functions. It is often difficult to translate the control requirements at this level into an appropriate conventional control structure. In the MPC methodology this combination of blocks is replaced by a single MPC controller. Although the development and application of MPC technology was driven by

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 49

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

industry, it should be noted that the idea of controlling a system by solving a sequence of open-loop dynamic optimization problems was not new. Propoi, for example, described a moving horizon controller in 1963 []. Lee and Markus anticipated current MPC practice in their 1967 optimal control text: One technique for obtaining a feedback controller synthesis from knowledge of open-loop controllers is to measure the current control process state and then compute very rapidly for the open-loop control function. The first portion of this function is then used during a short time interval, after which a new measurement of the function is computed for this new measurement. The procedure is then repeated. There is, however, a wide gap between theory and practice. The essential contribution of industry was to put these ideas into practice on operating units. Out of this experience came a fresh set of problems that has kept theoreticians busy ever since. Many methods and approaches to control have been developed during the last few decades. A couple of them are applied on wastewater treatment plants. Recently, a lot of attention is paid to Model Predictive Control, which is well suited as a control approach to the operation of enhanced nitrogen removal plants for various reasons: 1. MPC inherently deals with interaction, lag times and non minimum phase systems. MPC is a MIMO control law that compensates inherently for interaction. This Is very useful because most enhanced nitrogen removal plants need to be controlled with a MIMO-controller with a considerable interaction present. Because MPC contains a model of the plant, it can deal in direct way with non-minimum phase systems and lag times. FOT example: in a pre-denitrification plant an inverse response is present for the internal recirculation flow to the effluent nitrate concentration. 2. MPC integrates feedback and feed forward. For wastewater treatment, feed forward for the influent flow, and ammonia and COD concentrations can be added in a direct way to the controller: the

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 50

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

internal model can get information of measured disturbances beforehand. 3. Models for enhanced nitrogen removal plants are available. 4. MPC is a time domain control law. Wastewater engineers are used to deal with systems in the time domain, this makes MPC more comprehensible to them than other advanced control theories which are frequency domain control laws. 5. Availability of new sensors . This new sensors make it possible to directly measure the outputs of concern in enhanced nitrogen removal plants. In the past, dissolved oxygen in the wastewater was controlled instead of the nitrogen, because the nitrogen could not be measured directly. If the dissolved oxygen was controlled for a certain set point, the nitrogen removal was performed quite well, but not as good as we want it to be. 6. MPC has excellent constraint handling capabilities. Because of the prediction by the internal model, MPC can anticipate for future constraint violations on the inputs as well as for the outputs. Like for every control law, there are also disadvantages of MPC: 1. MPC is a linear control law. In the standard MPC theory, the internal model is based on linear step response or state space models. The processes of wastewater treatment however are nonlinear processes. 2. MPC is a non-adaptive control law. The model used internally in the controller is, in the standard MPC theory, not updated, while wastewater treatment plants have changing characteristics depended on load, temperature etc. 3. Robust stability is not guaranteed for MPC. Robust stability can only be proven for infinite prediction horizons. 4. MPC requires larger computation times than most other control strategies. This means that sampling time cannot be taken high. Disadvantages 1 and 2 could be cancelled by using other internal models, but this will increase the computation times, therefore a new disadvantage is introduced by doing this. Disadvantage 3 cannot be cancelled, but an approach can be found to determine (approximately) the robust stability of MPC with finite prediction horizons. Disadvantage 4 is not a problem for the

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 51

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

control of wastewater treatment because wastewater treatment is a slow process. The choice has been made to use MPC because of the possibilities of constraint handling; this is an important property for wastewater treatment. It is chosen to use linear internal models because of the limitation of computation times. This means that the linear MPC-controller has to be tuned in such way that the disadvantages of the controller being linear and non adaptive are cancelled as much as possible.

6.1 Principle of MPC

Model Predictive Control is a control law which uses a prediction of the system outputs to control the system. This prediction is performed by using a Fig 6.1 Closed-loop system with inputs and outputs as used by the MPCtoolbox of Matlab model of the system. At every time step the controller computes a prediction of the future outputs P time steps ahead. The parameter P is called the prediction horizon. By using this prediction, the controller determines the control moves for an interval of M time steps. The parameter M is called the control horizon. Only the first calculated control move is implemented. This

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 52

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

procedure is repeated at each sampling time. This is called the receding horizon principle, the controller uses only the control moves for the next time step. The prediction horizon P and control horizon M are important tuning parameters.

6.2 Constraints
MPC can be divided into linear and nonlinear MPC. Linear MPC uses a linear model for both prediction of the outputs as optimization of the inputs. Nonlinear MPC can use a nonlinear model for each of these two steps. Examples of nonlinear MPC are: Compute a new linear model at every time step. The free response is determined in a nonlinear way, the forced response by the inputs in a linear way. Make the prediction of the outputs at every time step by a nonlinear model (free response) and add the responses of the inputs linearly. The main reason to choose for MPC as a control law are the excellent constraint handling capabilities of MPC. Three kinds of constraints can be applied: 1. Minimum- and maximum-constraints on the controlled inputs. These constraints describe problems like saturation of inputs, e.g. a maximum amount of oxygen that can be provided by the aerator of a pre-denitrification plant. 2. Maximum constraints for the change-rate of the inputs. E.g. for wastewater the change-rate of the amount of oxygen added to a predenitrification plant by the aerators is limited, it cannot be applied on the system step-wise. 3. Minimum- and maximum-constraints on the outputs. A finite range of the outputs, like the concentration of nitrate, which cannot become negative and also has a maximum value, can be described by constraints of this type. If constraints are applied to the system, they are constraints of the minimization of the optimization problem. Adding a constraint means that the controller already takes this limitations into account. If the inputs are only cut

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 53

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

off at "forbidden values", at the moment they are computed to exceed the constraints, the computation of the inputs is less optimal then it could be. Constraints on the outputs will keep the system outputs nearby the linearization outputs and so the closedloop system will probably become more stable because the model-plant mismatch is smaller if the disturbances are not too large. Adding Constraints will not prevent the system from becoming unstable because of parameter variation. A disadvantage of adding constraints is that the quadratic problem solved by the MPC-algorithm might become unfeasible.

6.3 The Receding Horizon

The receding horizon idea

Fig6.1 The receding horizon concept showing Optimization Problem The figure shows the basic idea of predictive control. In this presentation of the basics, we confine ourselves to discussing the control of a single-input, single-output (SISO) plant. We assume a discrete-time setting, and that the current time is labeled as time step k.at the current time the plant output is y(k), and that the figure shows the previous history of the output trajectory. Also shown is a set point trajectory, which is the trajectory that the output should follow, ideally. The value of the set-point trajectory at any time t is denoted by s(t).

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 54

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Distinct from the set-point trajectory is the reference trajectory .This starts at the current output y(k), and defines an ideal trajectory along which the plant should return to the set-point trajectory, for instance after a disturbance occurs. The reference trajectory therefore defines an important aspect of the closed-loop behavior of the controlled plant. It is not necessary to insist that the plant should be driven back to the set-point trajectory as fast as possible, although that choice remains open. It is frequently assumed that the reference trajectory as fast as possible, although that choice remains open. It is frequently assumed that the reference trajectory approaches the set point exponentially, which we shall denote Tref , defining the speed of response. That is the current error is (k) =s (k)-y(k) Then the reference trajectory is chosen such that the error i steps later , if the output followed it exactly, would be (k+i)=exp(-iTs/Tref) *(k) = i *(k) where Ts is the sampling interval and =exp(-Ts/Tref).(note that 0<<1). That is , the reference trajectory is defined to be r(k+i|k)=s(k+i)-(k+i) =s(k+i)- exp(-Ti/Ts) * (k) The notation r(k+i|k) indicates that the reference trajectory depends on the conditions at time k,in general. Alternative definitions of the reference trajectory are possible For e.g. , a straight line from the current output which meets the set point trajectory after a specified time . A predictive controller has an internal model which is used to predict the behaviour depends on the assumed input trajectory (k+i|k) (i=0,1,,Hp-

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 55

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

1) that is to applied over the prediction horizon, and the idea is to select that input which promises best predicted behaviour.We shall assume that internal model is linear ; this makes the calculation of the best input relatively straightforward. The notation rather than u here indicates that at time step k we only have a prediction of what the input at time k+i may be; the actual input at that time,u(k+i),will probably be different from (k+i|k).Note that we assume that we have the output measurement y(k) available when deciding, the value of the input u(k).This implies that our internal model must be strictly proper , namely that according to the model y(k) depends on the past inputs u(k-1),u(k-2), , but not on the input u(k). In the simplest case we can try to choose the input trajectory such as to bring output at the end of the prediction horizon, namely at time k_Hp , to the required value r(k + Hp). In this case we say, using the terminology of richalet,that we have a single coincidence point at time k+Hp. There are several input trajectories {(k|k),(k+1|k),,(k+Hp-1|k)} which achieve this , and we could choose one of them , for example the one which requires smallest input energy. But is usually adequate , and in a fact preferable, to impose some simple structure o the input trajectory, parameterized by a smaller number of variables. The figure shows the input assumed to vary over the first three steps of the prediction horizon, but to remain constant thereafter: (k|k)=(k+1|k)==(k+Hp-1|k).In this case there is only one equation to be satisfied --- (k+Hp|k)=r(k+Hp|k)--- there is a unique solution . Once a future input trajectory has been chosen , only the first element of that trajectory is applied as the input signal to the plant . That is , we set u(k)= (k|k), where u(k) denotes the actual input signal applied. Then the whole cycle of output measurement is repeated, prediction, and input trajectory determination is repeated., one sampling interval later: a new output measurement y(k+1) is obtained ;a new reference trajectoryr(k+i|k+1)(i=2,3,,) is defined ; predictions are made over the horizon k+1+I,with i=1,2,Hp; a new trajectory (k+1+i|k+1),with i=0,1,,Hp1) is chosen; and finally the next input is applied to the plant : u(k+1)= (k+1|k+1).Since the horizon prediction remains of the same length as before,

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 56

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

but slides along by one sampling interval at each step this way of controlling a plant is often called a receding horizon strategy

6.4 Optimization Problem


The term optimization implies a best value for some type of performance criterion. This performance criterion is known as an objective function. Here, we first discuss possible objective functions, then possible process models that can be used for MPC. OBJECTIVE FUNCTIONS Here, there are several different choices for objectives functions. The first one that comes to mind is a standard least-squares or quadratic objective function. The objective function is a sum of squares of the predicted errors (differences between the set points and model-predicted outputs) and the control moves (changes in control action from step to step) A quadratic objective function for a prediction horizon of 3 and a control horizon of 2 can be written = (Rk+1 Uk+1^2

k+1)^2 + ((Rk+2 k+2)^2 + (Rk+3 k+3)^2 + w Uk^2 + w

Where

represents the model predicted output ,r is the set point, U is the

change in manipulated input from one sample to the next ,w is a weight for the changes in the manipulated input, and the subscripts indicate the sample time (k is the current sample time ). For a prediction horizon of P and a control horizon of M,the least Squares objective function is written = (Rk+1 k+1)^2 + w Uk+1^2 Another possible objective function is to simply take a sum of the absolute values of the predicted errors and control moves.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 57

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

For a prediction horizon of 3 and a control horizon of 2, the absolute value objective function is = | (Rk+1 k+1) | + | (Rk+2 k+2) | + | (Rk+3 k+3) | + w| Uk| + w| Uk+1| Which has the following general form for a prediction horizon of P and a control horizon of M: = | (Rk+1 k+1)| + w | Uk+1| The optimization problem solved stated as a minimization of the objective function, obtained by adjusting the M control moves, subject to modeling equations (equality constraints), and constraints on the inputs and outputs. Min Least-squares formulations are by far the most common objective functions in MPC. Least squares yields analytical solutions for unconstrained problems and penalizes larger errors(relatively) more then smaller errors. The absolute value objective function has been used in a few algorithms because linear programming (LP) problem results. LPs are routinely solved in largescale scheduling and allocation problems. For example, an oil company often uses an LP to decide how to distribute oil to various refineries and to decide how much and what product to produce at each plant .The LP approach is not useful for model predictive control, because the manipulated variable moves often hop from one extreme constraint to another.

6.5 Models
Many different types of models are possible for calculating the predicted values of the process outputs, which are used in evaluating at discrete steps , it makes sense to use discrete models for the output prediction . Here , we review step and impulse response models both of which are used in common MPC algorithms.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 58

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

FINITE STEP RESPONSE FSR models are obtained by making a unit step input change to a process operating at steady state. The model coefficients are simply the output values at each time step. Here , si represents the step response coefficients for the ith sample time after the unit step input change. If a non-unit step change is made, the output is scaled accordingly. The step response model is the vector of step response coefficients, S=[ s1 s2 s3 s4 s5 . . . sN] Where the model length N is long enough so that the coefficients values are relatively constant (i.e. the process is close to a new steady state ). FINITE IMPULSE RESPONSE Another common form of model is a finite impulse (FIR). Here , a unit pulse is applied to the manipulated input, and the model coefficients are simply the values of the outputs the ith impulse response coefficients. There is a direct relationship between step and impulse response models: Hi=Si-Si-1 Si=hj The impulse response coefficients are simply the changes in the step response coefficient at each time step. Similarly , step response coefficient is the sum of the impulse response coefficients to that point. It should be noted that there are two major limitations to step and impulse response models. They can only be used to represent open-loop stable processes, and they require a large number of parameters (model coefficients ) compared to state space and transfer function models.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 59

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

7 Tuning of the MPC-controller


This section will treat the tuning of MPC. In the former sections, already some of the tuning-parameters of MPG were mentioned: The sampling time T, The length of prediction horizon P The length of control horizon M The weighting matrices of in- and outputs: u and y

For all tuning parameters, some rules of thumb will be given and the effect of the parameter on the closed-loop behavior will be discussed. Because there are a lot of parameters that can be used for tuning, there is no direct way of tuning. Tuning rules, like Ziegler-Nichols or Cohen-Coon for PID-controllers, do not exist for MPC. Engelen developed a systematic tuning procedure for MPC. This procedure is an engineering approach, it does not guarantee an optimal solution, but can be used instead of the usual trial-and-error way of tuning.

7.1 Sampling time T


The sampling time is normally chosen five times faster than the fastest time constant in the system. Otherwise, the internal model would normally not be able to predict the future behavior well. The product of the sampling time T, and the prediction horizon P is the prediction horizon in time units. This means that if the system is stiff, the prediction horizon must be chosen very large to predict both fast and slow dynamics. Because computation times are limited, this is not suitable; therefore there have to be a trade-off between the fast and the slow dynamics. A smaller sampling time will probably give a more stable behavior since the controller intervenes more often.

7.2 Prediction horizon P


The length of the prediction horizon is the number of time steps for which the controller will determine future behavior. The prediction horizon should always be chosen larger than the inverse response, larger than the dead time and larger than the maximum time constant of the system to predict the system behavior well. By choosing a larger prediction horizon the controller becomes less aggressive and more stable.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 60

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

7.3 Control horizon M


The length of the control horizon can be chosen from 1 to P, larger than P makes no sense, and a length of 1 is necessary to speak of a controller. Van der Meulen claims that the length of the control horizon should be chosen between 6 and 5 of the length of the prediction horizon. By increasing the control horizon, the controller becomes more aggressive and less stable.

7.4 Weighting matrices of in- and outputs: u and y


By choosing the weighting matrices u and y it is not the absolute value which is important, but the relative rate of the weighting matrices. This rate indicates how large the controller efforts are allowed to become to realize the desired trajectory. The rate of the weightings within matrix u indicates which control move is restricted the most. The rate of the weightings within matrix y indicates which output has to meet the desired output the best. If the weightings in matrix u are much smaller than those in matrix y, the controller will derive large control moves to achieve the desired outputs.

8. The filter in MPC


A filter is generally used for corrections of Model errors System noise Measurement noise The MPC-controller derives the prediction of the outputs by using a linear model. This model cannot describe exactly the true system, A mismatch between the plant and the model will always be present, for instance because of linearization errors, dynamic behavior that is not included in the model, or parametric variations. Therefore the goal of the filter in MFC is to update the prediction of the system by using the outputs of the system. Because the noise must not be passed through, the filter also has to remove the noise. For this filter, possible choices are: the first order filter, the Kalman filter and the extended Kalman filter

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 61

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

8.1 First order filter


By a first order filter the model output is updated by adding a part of the difference between the outputs of the plant and the model to the model output. In a formula, this can be written as:

Where, F

is the filter gain is the a-posteriori model output: an estimation of the output at time t = k, based on information of time t = k - 1 is the a-posteriori model output: an estimation of the output at time t = k,, based on information of time t = k is the measured output of the plant at time k

The filter has an integrating effect. The difference between the outputs of the system and the model becomes equal to zero after some time. How long it takes to become zero depends on the value of the filter constant.

Fig.8.1 Schematical picture of the Kalman filter F is a diagonal matrix of filter constants for every output. This filter constant has to lie in between O and 1. If the filter constant is equal to 1, the filter is a zero order filter: the full difference between the outputs of the model and the system is added to the model prediction. If the system contains measurement noise, this is also completely added to the model prediction, which is unwanted. The filter constant equal to O means that the measurements are

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 62

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

not used at all for the model prediction. Therefore, the filter constant must be chosen in relation with the measurement noise.

8.2 Kalman filter


A Kalman filter compares the plant output with the output of the model and corrects the system states for this difference after weighting it:

Where, is the measured output of the plant at time k is the a-priori estimated model-output is the a-posteriori estimated state is the a-priori estimated state is the Kalman-gain matrix

By the a-posteriori estimated states of the model at time k , the MPCalgorithm can make a prediction of the (a-priori) outputs of the model for time k + 1. The computation of the Kalman filter-gain is done by using the Ricattiequation, it is depended of the covariances of the system noise Q and of the measurement noise R. The Kalman filter is a useful filter for removing zero-mean white noise from the plant outputs . However, this filter is not useful for the type of controller investigated in this paper: linear MPC on a nonlinear plant, because the Kalman filter can lead to an off-set if: The initial conditions of model and plant differ The plant has to deal with unmeasured disturbances e There is a model-plant mismatch Because the standard kalman filter is not adequate, the extended Kalman filter is used in the MPC controller.

8.3 Extended Kalman filter


The extended Kalman filter is a Kalman-filter which is extended with an extra state: the 'output disturbance. This output disturbance can be regarded as the estimation of the static deviation of plant- and model-outputs.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 63

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Fig.8.2 Schematical picture of the extended Kalman filter with output disturbances The extra states z(k) are step wise disturbances of the output. The number of added states can therefore not be larger than the number of outputs. The state-space model of a process with output disturbance can be written as:

The model output is:

The Kalman filter gain Kext

is

computed in the same way as the normal

Kalman-gain matrix. The matrix Kext has two parts: the original Kalman-gain matrix and a gain-matrix for the output disturbance. If the original Kalman-gain matrix is equal to zero, the extended Kalman filter is similar to the first order filter. It is known that a first order filter can deal well with model-plant mismatch. This means that the extended Kalman filter can probably deal with model-errors as well as the first-order filter can. If the original Kalman filter part of the extended Kalman filter is not equal to zero, the extended Kalman filter can handle model-errors as well as noise.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 64

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

9. State of art of MPC for WWTPs


Recently, research has been done on MPC for enhanced nitrogen removal by the Systems and Control group of the Faculty of Applied Physics at the TUE by under direction of Weijers. Other institutes are doing research on this subject as well. In this paragraph a short overview is given, which will probably be not complete, but gives an impression of the knowledge gathered by the systems and control group on this specific subject.

9.1 Linear MPC


It was examined how MPC based on step-response models and without constraints could control a pre denitrification plant. Here it was found that the weight of the manipulated inputs is the most important tuning parameter for this system. The MPC-controller designed in this study controls the activated sludge installation well for external disturbances on the input, where the control actions remained small enough to stay in the linearized zone. But because there was a discrepancy between model and plant (no disturbance model was added), disturbances could not compensated completely by the controller. It was also found that if a change of setpoint was imposed, the controller became unstable. In a next study it was found that instability occurred if a too large setpoint change was imposed for the pre denitrification plant. This instability occurred because of an introduction of an addition right-half plane zero in the system, which were not present in the linearized model. This results were examined further with state space models. Then state-space MPC for a carrousel was examined. From results obtained by application of different control objectives it was concluded that the controller objective function is of great importance regarding robustness and performance of the overall system. It was observed that giving the system more freedom will not always lead to a better performance due to the limited validity of the linearized internal model. Recommendations on improving the stability done in these studies can be summarized by three points: Use an other internal (nonlinear) model. Examine the effect of constraints on the manipulated inputs to keep the controller from computing physical unrealistic values.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 65

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Find a criterion for tuning MPC that ensures (robust) stabiiity

9.2 Nonlinear MPC


The above results are all obtained with linear MPC. Keesman and Haarsma have examined a different approach for robust MPC with a nonlinear internal model. The linearization of the system is repeated every time it receives a new setpoint, thus it does not have stability problems because of linearization errors. The method used in this research is described by Prett and Garcia. It gives, directly, a robust control law, without analyzing the stability of the controlled system itself.

10. Dynamic Matrix Control


Engineers at Shell Oil developed their own independent MPC technology in the early 1970's, with an initial application in 1973. Cutler and Ramaker presented details of an unconstrained multivariable control algorithm which they named Dynamic Matrix Control (DMC) at the 1979 National AIChE meeting and at the 1980 Joint Automatic Control Conference. In a companion paper at the 1980 meeting Prett and Gillette described an application of DMC technology to an FCCU reactor/regenerator in which the algorithm was modified to handle nonlinearities and constraints. Neither paper discussed their process identification technology. Key features of the DMC control algorithm include: linear step response model for the plant

quadratic performance objective over a finite prediction horizon future plant output behavior specified by trying to follow the set point as closely as possible optimal inputs computed as the solution to a least-squares problem

The linear step response model used by the DMC algorithm relates changes in a process output to a weighted sum of past input changes, referred to as input moves. For the SISO case the step response model looks like:

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 66

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

The move weights are the step response coefficients. Mathematically the step response can be defined as the integral of the impulse response; given one model form the other can be easily obtained. Multiple outputs were handled by superposition. By using the step response model one can write predicted future output changes as a linear combination of future input moves. The matrix that ties the two together is the so-called Dynamic Matrix. Using this representation allows the optimal move vector to be computed analytically as the solution to a least-squares problem. Feed forward control is readily included in this formulation by modifying the predicted future outputs. In practice the required matrix inverse can be computed off-line to save computation. Only the first row of the final controller gain matrix needs to be stored because only the first move needs to be computed. The objective of a DMC controller is to drive the output as close to the set point as possible in a least-squares sense with a penalty term on the MV moves. This is equivalent to increasing the size of the diagonal terms in the square solution matrix prior to inversion. This results in smaller computed input moves and a less aggressive output response. As with the IDCOM reference trajectory, this technique provides a degree of robustness to model error. Prett and Gillette formalized this concept mathematically by defining move suppression factors designed to penalize excessive input movement. Move suppression factors also provide an important numerical benefit in that they can be used to directly improve the conditioning of the numerical solution. Cutler and Ramaker showed results from a furnace temperature control application to demonstrate improved control quality using the DMC algorithm. Feedforward response of the DMC algorithm to inlet temperature changes was superior to that of a conventional PID lead/lag compensator. In their paper Prett and Gillette described an application of DMC technology to FCCU reactor/regenerator control. Four such applications were already completed and two additional applications were underway at the time the paper was written. The overall FCCU control system was implemented in a

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 67

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

multi-level hierarchy, with a nonlinear steady-state FCCU model at the top. At the start of each optimization cycle, parameters in the nonlinear model were estimated so as to match model predictions with measured steady-state operating data. The calibrated nonlinear model was then perturbed numerically to generate partial derivatives of each process output with respect to each process input (the matrix of partial derivatives is known as the Jacobian matrix in numerical analysis). The partial derivatives were then used in a Linear Program (LP) to compute a new economic optimal operating point for the FCCU, subject to steady-state process constraints. The optimal process input and output targets were then passed to a DMC algorithm for implementation. As soon as the DMC controller moved the unit to the new steady state the optimization cycle was repeated. This separation of the control system into constrained steady-state optimization and dynamic control is quite similar to the structure described by Richalet et al. and has since become standard in industrial control system design. The DMC algorithm had the job of moving from the system from one optimal steady-state to another. Although the LP solution provided optimal targets for process inputs and outputs, dynamic disturbances could potentially cause the DMC algorithm to move inputs away from their optimal steady-state targets in order to keep outputs at their steady-state targets. Since moving one input away from its optimal target may be much more expensive than moving another, the control system should determine this trade-off in a rational way. The DMC algorithm was modified to account for such trade-offs by including an additional equation for each input in the process model. The new equation required that the sum of all moves for a particular input should equal the total adjustment required to bring that input to its optimal steady-state target. This allowed the inputs some freedom to move dynamically but required that the steady-state input solution be satisfied in a least-squares sense, with tradeoffs determined by the appropriate objective function weights. Prett and Gillette described additional modifications to the DMC algorithm to prevent violation of absolute input constraints. When a predicted future input came sufficiently close to an absolute constraint, an extra equation was added

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 68

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

to the process model that would drive the input back into the feasible region. These were referred to as time variant constraints. Because the decision to add the equation had to be made on-line, the matrix inverse solution had to be recomputed at each control execution. Prett and Gillette developed a matrix tearing solution in which the original matrix inverse could be computed offline, requiring only the matrix inverse corresponding to active time variant constraints to be computed on-line. The initial IDCOM and DMC algorithms represent the first generation of MPC technology; they had an enormous impact on industrial process control and served to define the industrial MPC paradigm. Summarizing the main steps involved in implementing DMC on a process are as follows: 1. Develop a discrete step response model with length N based on

sample time t. 2. Specify the prediction(P) and control (M) horizons.NPM 3. Specify the weighting on the control action(w=0 if no weighting on the control action(w=0 if no weighting). 4. All calculations assume deviation variable form, so remember to convert to/from physical units.

The effect of all these tuning parameters is now discussed for SISO systems. Model-length and sample-time selection are independent. The model length should be approximately the settling time of the process, that is, the time required to reach a new steady state after a step input change. For most systems, the model length is roughly 50 coefficients. The sample time is usually on the order of one tenth the dominant time constant, so the model length is roughly the settling time of the process. Prediction and control horizons differ in length. Usually, the prediction horizon is selected to be much longer than the control horizon. This is particularly true if the control weighting factor is selected to be zero. Usually, if

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 69

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

the prediction horizon is much longer than the control horizon, the control system is less sensitive to model error. Often P=20 or so , while M=1-3. Control weighting is often step to zero if the prediction horizon is much longer the control horizon. As the control horizon is increased, the control moves tend to become more aggressive so larger weight is needed to penalize the control moves.

11. Implementation of MPC in MATLAB


Consider the bioreactor problem. The continuous state space model is given by A= [ -2.4048 0; 0.8333 -2.2381]; B= [7;-1.117] C= [0 1] D= [ 0 ] Where the measured state (output) is the dissolved oxygen and the manipulated input is the aeration rate.

11.1 MATLAB code


%initialization of parameters P=10;%prediction horizon M=1;%control horizon N=50;%model length w=0.0;%weight ysp=1;%output set point from 0 timesp=1;%time of set point change delt=0.1;%sampling time interval tfinal=6;%final simulation time noise=0; %define time tvec=0:delt:tfinal; ksp=fix(timesp/delt); kfinal=length(tvec); %define set point vector

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 70

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

r=[zeros(1,ksp),ones(1,(kfinal-ksp))*ysp]; %////////////////define plant as 'SISO' LTI object////////////////////////


c=input('enter plant in 1.statespace 2.transferfunction 3.polezero 4.frquencyresponse');

if c==1 a=input('enter A matrix'); b=input('enter B matrix'); c=input('enter C matrix'); d=input('enter D matrix'); plant=ss(a,b,c,d); elseif c==2 nump=input('enter numerator coefficients'); denp=input('enter denomenator coefficients'); plant=tf(nump,denp); elseif c==3 zero=input('enter zeroes'); pole=input('enter poles'); K=input('enter gain'); plant=zpk(zero,pole,K); elseif c==4 resp=input('enter response'); freq=input('enter frequencies'); plant=frd(resp,freq,'Units','Hz'); end plant=tf(plant); %plant=s/(s*s - 1.4*s +0.45),it is continous %define plant parameters here % nump=[1]; % denp=[1,-1.4,0.45]; % plant=tf(nump,denp); %discretize the plant plant=c2d(plant,delt); %//////////////////define model here//////////////////////////////////// %assumption plant = model model=plant; % [numm,denm,tm]=tfdata(plant);

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 71

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

numm = get(model,'num'); numm = numm{:}; % Get numerator polynomial denm = get(model,'den'); denm = denm{:}; % Get denominator polynomial numm %define step response coefficient matrix s=step(model,0:delt:N*delt); %define free response i.e. Sp matrix for past control moves for i=1:P for j=1:N-2 if(i+j<=N-1) Sp(i,j)=s(i+j); else Sp(1,j)=0; end end end %define forced response i.e. Sf matrix for future and control moves for i=1:P for j=1:M if i+1-j>0 Sf(i,j)=s(i+1-j); else Sf(i,j)=0; end end end Sf % obtain W matrix W=w*eye(M,M); %obtain Kmat where Kmat=(Sf'*Sf + W)^-1*Sf' Kmat=inv(Sf'*Sf + W)*Sf'; %piant initial conditions ndenm=length(denm)-1;

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 72

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

nnumm=length(numm)-1; umpast=zeros(1,nnumm); ympast=zeros(1,ndenm); % uu=zeros(1,kfinal); % yy=zeros(1,kfinal); % xinit=zeros(1,size( % nump=[zeros(1,ndenp-nnump-1),nump]; % Pad numerator with leading zeros % numm=[zeros(1,ndenm-nnumm-1),numm]; uinit=0; yinit=0; %initialize input vector u=ones(1,min(P,kfinal))*uinit; u dist(1)=0; y(1)=yinit; % x(:,1)=xinit; dup=zeros(1,N-2); for k=1:kfinal [m,p]=size(Kmat); for i=1:p if k-N+i>0 uold(i)=u(k-N+i); else uold(i)=0; end end dvec=dist(k)*ones(1,p); rvec=r(k)*ones(p,1); y_free=Sp*dup' + s(N)*uold'+dvec'; E=rvec-y_free; delup(k)=Kmat(1,:)*E; if k>1

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 73

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

u(k)=u(k-1)+delup(k); else u(k)=delup(k)+uinit; end %plant equations umpast=[u(k),umpast(1,1:length(umpast)-1)]; y(k+1)=-denm(2:ndenm+1)*ympast'+numm(2:nnumm+1)*umpast'; ympast=[y(k+1),ympast(1:length(ympast)-1)]; %model prediction if k-N+1>0 ymod(k+1)=Sf(1,1)*delup(k)+Sp(1,:)*dup'+s(N)*u(k-N+1); else ymod(k+1)=Sf(1,1)*delup(k)+Sp(1,:)*dup'; end %disturbance compensation dist(k+1)=y(k+1)-ymod(k+1); %additive disturbance compensation %put input change into vector of past control moves dup=[delup(k),dup(1,1:N-3)]; end %stairs plotting for input(zero order hold) and setpoint [tt,uu]=stairs(tvec,u); [ttr,rr]=stairs(tvec,r); figure(1) subplot(2,1,1) plot(ttr,rr,'--',tvec,y(1:length(tvec))) ylabel('y'); xlabel('time'); title('plant output'); subplot(2,1,2) plot(tt,uu) ylabel('u'); xlabel('time');

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 74

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

11.2 OUTPUT IN MATLAB WINDOW


enter plant in 1.statespace 2.transferfunction3.polezero 4.frquencyresponse1 enter A matrix[-2.4048 0;0.8333 -2.2381] enter B matrix[7;-1.117] enter C matrix[0 1] enter D matrix[0] numm = 0 Sf = 0 -0.0751 -0.0940 -0.0768 -0.0376 0.0137 0.0704 0.1281 0.1840 0.2362 u= 0000000000 -0.0751 0.1001

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 75

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

Fig. 11.1 Output after applying MPC

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 76

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

11.3 INFERENCE
Effect of prediction horizon: If we have a fixed control horizon, then it is seen that choosing a smaller prediction horizon results set point being achieved in smaller time .However the shorter prediction horizon is more sensitive to model uncertainty.

Fig 11.2

Output after applying MPC with P=15

As seen in figure when P=15 requires much more control action compared to P=10. But still we find that prediction horizon does not have appreciable effect for this case .The performance for this case is roughly the same for P=10 and P=15.However there is a lower limit to the length of the prediction horizon below which it results in an unstable system. Here it is P=3. This is not due to

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 77

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

any model error, since we have assumed a perfect model in these simulations. If the prediction horizon is too short, the initial step response coefficients dominate. Since these are negative while the later coefficients are positive (corresponding to a positive process gain), the predictive is really in error. The effect is the same as using a PID controller with a controller gain that is the wrong sign. Effect of model length: Choosing a smaller model length does not capture the complete dynamics of the process. This results in a model error and poor performance.

Fig.11.3 Output after applying MPC with N=70 we find that N=50 gives better results than N=70.the performance degrades sharply as N increases.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 78

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

12. Conclusions
Although the fuzzy controller is robust, it may not be optimal for all operating conditions. The fuzzy controller was found not to have optimum performance, and even severely degraded performance, when the membership functions or fuzzy rules are not chosen properly. Incorporating a self-tuning capability to the fuzzy controller is one way to ensure the controller always operates at its most optimal configuration. Self-learning or tuning can be achieved by integrating the fuzzy logic control with neural networks. For the systems investigated in this thesis, it seems that using MPC with a normal tuning procedure gives a rather stable closed-loop system. Investigating various values of the tuning parameters, filters and constraints for MPC did not show measures that seemed to improve the stability drastically. This can be explained by the fact that the systems under investigation in this thesis are stable systems with slow dynamics without things like inverse dynamics, dead times etc. So, as stated in the former point, the uncertainty of the closed-loop system, and therefore its stability, is almost completely determined by the change of the system from its point of linearization. Since it is observed that the effect of measures like filters and constraints are little, they should be used for their main goals. The filter should be used for noise reduction. The constraints can be useful in case an unstable situation occurs because of such parameter variations that the required set point cannot get reached. The stability of linear MPC seems to be determined by the model-plant mismatch between the internal model and the true plant. Moving from the point of linearization gives a model-plant mismatch due to the linearization errors. This effect is increased if there is a mismatch in the parameters, since at other values of the parameters the system has other steady states. In that case the point of linearization is left even more. The direct model-plant mismatch caused by the parameters however is quite small. Therefore it might be concluded that the limitations of linear MPC lie in the linearity of the process, and indirectly in the uncertainty of the parameters. But since the determination of the robust stability bounds as performed in this thesis is too conservative, this conclusion is maybe too premature.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 79

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

13. Bibiliography
1. Aguilar-Lopez, R. (2008). Robust generic model control for dissolved oxygen in activated sludge wastewater plant. Biochemical Engineering Quarterly 22(1), 7179. Chemical and

2. Azwar, M. A. Hussain and K. B. Ramachandran (2006). The study of neural network-based controller for controlling dissolved oxygen concentration in a sequencing batch reactor. Bioprocess and Biosystems Engineering 28(4), 251265. 3. Barnard, J. L. (1975). Biological nutrient removal without the addition of chemicals. Water Research 9(5), 485490. 4. Belchior, C. A., R. Araujo and J. Landeck (2010). Adaptive fuzzy control of the dissolved oxygen concentration in an activated sludge process. In: Proceedings of the IEEE Conference on Emerging Technologies and Factory Automation. Bilbao, Spain. pp. 169173. 5. Brdys, M. A. and J. D. Maiquez (2002). Application of fuzzy model predictive control to the dissolved oxygen concentration tracking in an activated sludge process. In: Proceedings of the 15th IFAC World Congress. Barcelona, Spain. 6. Chotkowski, W., M. A. Brdys and K. Konarczak (2005). Dissolved oxygen con-trol for activated sludge processes. International Journal of Systems Science 36(12), 727736. 7. Duzinkiewicz, K., M. A. Brdys, W. Kurek and R. Piotrowski (2009). Genetic hybrid predictive controller for optimized dissolved-oxygen tracking at lower control level. IEEE Transactions on Control Systems Technology 17(5), 11831192.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 80

Optimization of Bioreactor Controls using Model Predictive and Neuro Fuzzy Control Techniques

Nithin Varghese Ninan

8. M.V. Kothare, V.Balakrishnan, and M. Morari. Robust constrained model predictive control using linear matrix inequalities. Automatica , 32(10):1361-1379, 1996. 9. G.P. de Kruijf. Modellering Van de Afvalwaterzuiveringsintallatie Venlo Met Het I A W Q Model No . Eind-hoven University of Technology, faculty of applied physics, systems and control group, 1997. 10. J. H. Lee and M. Morar. State-space interpretation of Model Predictive Control 1992. Published on internet. 11. J. H. Lee and Z. H. Yu. Tuning of model predictive control for robust performance. Computers Chem . Engng , 18(1):15-37, 1994. 12. G.J.C.C.M. Leenheers. Parameteridentificeerbaarheid En Schattingen Voor Het I A W Q Model No . 1 . Eind-hoven University of Technology, faculty of applied physics, systems and control group, 1996.

Manipal Global Education Services Pvt. Ltd., Bangalore Page | 81

Você também pode gostar