Modeling, estimation, and control of biological wastewater treatment plants Qian Chai Faculty of Technology Telemark University College Porsgrunn, Norway April 5, 2008 ii Preface This thesis is submitted in partial ful…llment of the requirements for the degree of philosophiae doctor (PhD) at the Norwegian University of Science and Technology (NTNU) and Telemark University College (TUC). First of all, I am indebted to my main supervisor professor Bernt Lie for o¤ering me the opportunity to study for a PhD degree, for the excellent guidance during this work, for a good number of valuable discussions, for reading and correcting diverse reports, articles, and the drafts of this thesis, and for help in improving my English. Your broad knowledge and excellent capability of disseminating knowledge within modeling and control area have been very useful for me. I am also thankful to you for your friendship and for so many enjoyable trips, café-visits, and parties. My sincere gratitude also goes to my co-supervisor professor Rune Bakke for always being helpful and interested in my work, for the valuable discussions, and for the comments and tips on practical issues of wastewater treatment. I am thankful for your contribution to organize and guide the nitrogen removal project at TUC to put theories into practice. I would like to thank my other co-supervisors professor Tor Lønnestad and professor Steinar Sælid for the participation and support in this work. I really appreciate that you took the time to participate in the meetings and to give useful comments and suggestions to this work. I want to thank professor Peter Fritzson for being my kind host during my short visit to Linköping University, Sweden, in June 2005. I am thankful to Dr. Peter Bunus for many valuable discussions and for tremendous help in the Modelica project. I am also grateful to the PELAB (Programming Environments Laboratory) sta¤ at Linköping University for aiding me with administrative issues and for enjoyable co¤ee breaks. During the case studies of this work, I have obtained a good deal of help and support of many people. I would like to thank Sverre Amrani from BioTek AS, Norway, for providing measurement data of the Duvbacken plant, for sharing process knowledge, and for collaboration on two papers. Thanks to Cristina Sarmiento Ferrero for her contribution through her M.Sc. thesis. I have much to thank the group members of the nitrogen removal project at TUC. Thanks to lecturer Morten Pedersen at TUC for help with building the control box, visiting researchers Dr. Zhiqiang Chen and professor Tao He from China for their assistance on process design issues, PhD fellow Deshai Botheju at TUC for his support on process construction, master students Yuan Song, Shadi Lot…, and Lei Zhao for their contribution on laboratory experiments and LabVIEW program. Research is always depending on a well functioning working environment, fun during coffee breaks as well as serious discussions. In this respect I would like to thanks my colleagues, iii iv PREFACE with whom I have shared many moments. Thanks to assistant professor Finn Haugen for the scienti…c help, for enjoyable conversations, and for invitations to the NI-days seminars. Thanks also to Beathe Furenes and Juan Videla for sharing an o¢ ce with me, for so many fruitful discussions, and for a lot of support during good and hard times, and I really appreciate that Juan o¤ered me to quote from his unpublished report on the Dymola-Matlab interface. Thanks to Marta Dueñas Díez for the interesting discussion on parameter estimation and thank you for the times you have invited me to your parties. Thank you all the nice people contributing to have such a positive working environment and so enjoyable lunch breaks, especially to Nils-Olav Skeie, Kjell Joar Alme, Inger Hedvik Matveyev, Urmila Datta, and Xiaoli Liang. Finally, I would like to thank my dear parents, Jie and Jianxiang, for a lifetime of unlimited love and support. Although we live in two countries with the distance of some thousands of km, your support and encouragement has always inspired me to overcome the di¢ culties in my PhD work. Very special warm thanks to my husband Jon Are for his patience and loving support during all these years. Thanks also to my dear parents-in-law, Astri and Alf, and my little sister, Lu, for their love and support. Stavanger, February 2008 Qian Chai Summary The activated sludge process (ASP), as the most generally applied biological wastewater puri…cation technique, attracts a great deal of attention from the research community in a highly populated, industrialized world. The main objective of this thesis is to investigate methods for e¢ cient development of activated sludge plant models and for possible improvements in process operation and performance through applications of advanced modeling and control techniques. Di¤erent topics in advanced control such as parameter estimation, state estimation, and model predictive control, are addressed, and the methods investigated in this thesis are illustrated with two activated sludge processes, a laboratory-scale nitrogen (N) removal plant and a full-scale phosphorus (P) removal plant: the Duvbacken wastewater treatment plant (WWTP). As model representation is important in control oriented modeling, the object-oriented modeling approach providing open component-based architectures and reuse of components, is suggested in this thesis to achieve a more ‡exible model representation. The models of the N-removal process and the Duvbacken WWTP are developed based on the Activated Sludge Models (ASMs) which are generally accepted as the standard models of activated sludge processes (ASPs). The dynamic models are implemented in the object-oriented modeling language Modelica using the Dymola simulation environment, based on a modi…cation of the Modelica library WasteWater. In order to build a good software development environment, special consideration is given to two Dymola interfaces: the Dymola-Matlab interface provided by Dymola and the Dymola-Python interface developed by the author. The application of the modeling approach in this thesis shows that the combination of Modelica/Dymola for e¢ cient object-oriented modeling and Matlab for further analysis is a powerful tool for control system design. The performances of some widely used state estimation techniques, such as the standard Kalman …lter (KF), the extended Kalman …lter (EKF), the unscented Kalman …lter (UKF), the square-root unscented Kalman …lter (SRUKF), and the moving horizon estimation (MHE), are evaluated with application to the N-removal process. The comparison of these …lters for the N-removal process shows that the SRUKF improves numerical properties of the UKF and provides the best estimation performance, and the discrete-time EKF gives the fastest performance with a satisfactory estimation result. In addition, since a good characterization of the main compositions in the in‡uent is very important to the performance of the ASM models, a method for simultaneously estimating both model state and in‡uent composition (model disturbance) is developed using the discrete-time EKF and illustrated with the Duvbacken WWTP. The …lter has a good convergence property for the observable process based on responses from the simulation model. However, when the …lter is evaluv vi SUMMARY ated based on the experimental data, the performance of the …lter is relatively poor due to unobservability of the system. Additional measurements are therefore needed to render the Duvbacken system locally observable. Parameter estimation of activated sludge plant models is a challenging task, since the models are in general large-scale, nonlinear, and overparameterized. A procedure for parameter identi…ability analysis is discussed and tested with the Duvbacken model. This systematic method proves to be very useful, since it reduces a large number of parameters to a small subset of parameters that can be identi…ed from the available experimental data. The …tting of the model to real data from the industrial plant is not great but satisfactory, especially for those outputs which are important to the plant operation (e.g. concentration of phosphate SPO4 and concentration of total phosphorus TP). Advanced control strategies for the ASP aeration system are suggested with the focus on the MPC algorithm, since MPC provides an optimization-based procedure with an elegant way of handling constraints and with capabilities of removing process disturbances. Both linear and nonlinear MPC techniques are evaluated with the N-removal process, and the simulation results show that the performances of the MPC controllers are satisfactory: the controllers guarantee that the strict e- uent requirements are ful…lled. The nonlinear MPC strategy is also compared with some conventional rule-based controllers, and the MPC controller shows the most reduction of the energy consumption and o¤ers the easiest way to handle the inequality constraints. Finally, recommendations for future research directions are suggested to an N-removal project group at Telemark University College, Norway. Contents Preface iii Summary v Nomenclature xi I 1 Overview 1 Introduction 1.1 Background . . . . . . . . 1.2 Previous work . . . . . . . 1.3 Scope and outline of thesis 1.4 Main contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 4 5 7 2 ASPs for Wastewater Treatment 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Nitrogen removal process . . . . . . . . . . . . . . . . . . . . . 2.2.1 Biological nitrogen removal . . . . . . . . . . . . . . . 2.2.2 The laboratory-scale nitrogen removal plant . . . . . . 2.3 Phosphorus removal process . . . . . . . . . . . . . . . . . . . 2.3.1 Biological phosphorus removal . . . . . . . . . . . . . . 2.3.2 The Duvbacken WWTP . . . . . . . . . . . . . . . . . 2.4 Object-oriented modeling . . . . . . . . . . . . . . . . . . . . . 2.4.1 Modelica and Dymola . . . . . . . . . . . . . . . . . . 2.4.2 Model implementation . . . . . . . . . . . . . . . . . . 2.4.3 Dymola interfaces . . . . . . . . . . . . . . . . . . . . . 2.A dymosimPy — A Python module for Dymola-Python interface 2.A.1 Python vs. Matlab . . . . . . . . . . . . . . . . . . . . 2.A.2 Python fundamentals . . . . . . . . . . . . . . . . . . . 2.A.3 The dymosimPy module . . . . . . . . . . . . . . . . . . 2.A.4 Applications of the dymosimPy module . . . . . . . . . 2.A.5 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 9 11 11 12 15 15 15 16 17 19 19 22 23 24 25 28 32 . . . . . . . . . . . . . . . . . . . . . . . . vii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii CONTENTS 3 State Estimation 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 State estimation techniques . . . . . . . . . . . . . . . . . 3.2.1 Observability and detectability . . . . . . . . . . . 3.2.2 The standard Kalman …lter (KF) . . . . . . . . . . 3.2.3 The extended Kalman …lter (EKF) . . . . . . . . . 3.2.4 The unscented Kalman …lter (UKF) . . . . . . . . . 3.2.5 The square-root unscented Kalman …lter (SRUKF) 3.2.6 Moving horizon estimator (MHE) . . . . . . . . . . 3.3 State estimation of the N-removal process . . . . . . . . . 3.3.1 Performance indices . . . . . . . . . . . . . . . . . . 3.3.2 Results and discussions . . . . . . . . . . . . . . . . 3.A Optimization-based estimation formulated as QP problem 3.A.1 The optimization-based estimation problem . . . . 3.A.2 Standard QP problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 33 35 35 37 37 38 39 41 45 45 46 51 51 51 . . . . . . . . . . . . . 53 53 54 54 56 59 59 60 60 63 63 64 67 75 . . . . . 77 77 78 80 81 82 6 Laboratory Case Study 6.1 Experimental set-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 Recommendations to the N-removal project . . . . . . . . . . . . . . . . . . 6.3 Implementation architecture — future perspective . . . . . . . . . . . . . . . 85 85 88 89 4 Parameter Estimation 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Parameter identi…ability analysis . . . . . . . . . . . . . . 4.2.1 Theoretical background . . . . . . . . . . . . . . . . 4.2.2 Procedure for selecting identi…able parameters . . . 4.3 Estimation of kinetic parameters in the Duvbacken model . 4.3.1 Parameter identi…ability and estimation . . . . . . 4.3.2 Model validation . . . . . . . . . . . . . . . . . . . 4.3.3 Con…dence interval of parameter estimates . . . . . 4.4 Disturbance estimation using the Kalman …lter . . . . . . 4.4.1 State and disturbance estimation . . . . . . . . . . 4.4.2 Observability analysis . . . . . . . . . . . . . . . . 4.4.3 Application to the Duvbacken plant . . . . . . . . . 4.A Structural observability analysis of ASM2d model . . . . . 5 Control Strategies 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Rule-based control strategies . . . . . . . . . . . . . . . 5.3 Model predictive control (MPC) . . . . . . . . . . . . . 5.3.1 Linear MPC for continuously aerated ASP . . . 5.3.2 Nonlinear MPC for intermittently aerated ASP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CONTENTS 7 Conclusions and Future Directions 7.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 Future directions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bibliography II Published and Submitted Papers ix 93 93 95 106 107 Paper A: Systematic Analysis of Parameter Identi…ability for Improved Fitting of a Biological Wastewater Model to Experimental Data 109 Paper B: Parameter Identi…ability Analysis and Model Fitting of a Biological Wastewater Model 131 Paper C: Comparison of state estimation techniques, applied to a biological wastewater treatment process 139 Paper D: Object-oriented Modeling and Optimal Control of a Biological Wastewater Treatment Process 147 Paper E: Optimal control of a biological wastewater treatment process with intermittent aeration 155 Paper F: Predictive Control of an Intermittently Aerated Activated Sludge Process 163 x CONTENTS Nomenclature List of symbols a B C d dk Dk et F f() fd ( ) fk G H H h( ) hd ( ) J Kk KL a L MP MQ MR N N() Nc nd nu nv nw Duration of the aeration cycle Input matrix of a linear system Disturbance matrix of a linear system Aeration time Disturbance vector at time step k Noise covariance matrix of the disturbance model at time step k Observation error at time t, et , yt ytm Process matrix of a linear system State transition function (possibly nonlinear) State transition function of the disturbance model Aeration fraction at the kth aeration cycle Process noise matrix of a linear system Output matrix of a linear system Hessian of the objective function for parameter estimation Measurement function (possibly nonlinear) Measurement function of the disturbance model Objective function Kalman …lter gain Oxygen mass transfer coe¢ cient Measurement noise matrix of a linear system MHE weighting matrix for initial state estimate MHE weighting matrix for process noise MHE weighting matrix for measurement noise Prediction horizon Normal probability distribution The number of aeration cycles Dimension of the disturbance vector dk Dimension of the input vector uk Dimension of the measurement noise vector vk Dimension of the process noise vector wk xi xii NOMENCLATURE nx ny n Pkjk P~kjk Pkjk 1 Pxy Py Q Q Qe Qin Qk ~ Qw k Qrs Qw r R rk Rk S S SA SALK SF SI Sj Skjk Skjk 1 S~kjk SN2 SNH4 SNOX SO2 SOsat2 SPO4 SS Sy t T Th ton;min ton;max to ;min to ;max ua Dimension of the state vector xk Dimension of the output vector yk Dimension of the model parameter vector A posteriori state covariance A posteriori augmented state covariance A priori state covariance Cross covariance between x^kjk 1 and y^kjk 1 Innovation covariance Weighting matrix in linear MPC Process noise covariance matrix of the continuous-time process E- uent ‡owrate In‡uent ‡owrate Process noise covariance matrix at time step k ~ Augmented process noise covariance matrix at time step k, Qw k = diag (Qk ; Dk ) Recycled sludge ‡owrate Wasted sludge ‡owrate Vector of reaction rates Weighting matrix in linear MPC White noise in the disturbance model at time step k Measurement noise covariance matrix at time step k Weighting matrix in linear MPC Sensitivity matrix Fermentation product (acetate) Alkalinity, bicarbonate Readily biodegradable substrate for fermentation Soluble inert organics Dissolved components in the ASMs A posteriori Cholesky factor of state covariance A priori Cholesky factor of state covariance Cholesky factor of augmented state covariance Dinitrogen, released by denitri…cation Ammonium Nitrite plus nitrate Dissolved oxygen Saturated dissolved oxygen concentration Phosphate Readily biodegradable substrates Cholesky factor of measurement error covariance Time Number of available observations Control horizon Minimum air-on period within an aeration cycle Maximum air-on period within an aeration cycle Minimum air-o¤ period within an aeration cycle Maximum air-o¤ period within an aeration cycle State of blower (on/o¤) for aeration system xiii Control input vector at time step k Control input at time t, t 2 f1; : : : ; T g Working volume of the aeration tank Measurement noise vector at time step k Estimator prediction accuracy for state sequence Estimator prediction accuracy for output sequence Process noise vector at time step k T Augmented process noise vector at time step k, w~k , wkT ; rkT Weighting matrix Vector of concentrations in the aeration tank Autotrophic, nitrifying biomass Constrained state estimate Heterotrophic biomass Inert particulate organics Concentrations in the in‡uent Particulate components in the ASMs State vector at time step k T Augmented state vector at time step k, x~k , xTk ; Tk A posteriori state estimate A priori state estimate 1 h T x~kjk A posteriori augmented state vector of UKF, x~kjk , xkjk ; wkjk XPAO Phosphorus-accumulating organisms, PAO XPP Stored poly-phosphate of PAO XPHA Organic storage products of PAO xrs Concentrations in the recycled sludge XS Slowly biodegradable substrates XSS Total suspended solids XSTO Organics stored by heterotrophs yk Controlled output vector at time step k y^kjk 1 A priori output estimate yt Output observed from the real plant at time t m yt Model output at time t Filter parameter of the UKF Collinearity index K msqr Sensitivity measure Model parameter vector 0 Vector of initial parameter values ^ Vector of estimated parameter values Vector of correct parameter values () Condition number of a matrix Sigma point covariance weight of the UKF c Sigma point mean weight of the UKF m State of the disturbance model at time step k k ( ) Largest singular value of a matrix max Smallest singular value of a matrix min ( ) uk ut Va vk Vx Vy wk w~k W xa XA x^con XH XI xin Xj xk x~k x^kjk x^kjk T ; vkjk i T T xiv NOMENCLATURE List of abbreviations ASM ASP COD CSTR DAE DDE DO Dymosim EKF HRT INCOOP IWA KF MHE MPC ODE OPC PDE QP RMSE RSE SNdN SRT SRUKF TN TP TUC UKF WWTP Activated Sludge Model Activated Sludge Process Chemical Oxygen Demand Continuous Stirred Tank Reactor Di¤erential Algebraic Equation Dynamic Data Exchange Dissolved Oxygen Dynamic model simulator Extended Kalman Filter Hydraulic Retention Time INtegrated process COntrol and plantwide OPtimization International Water Association (standard) Kalman Filter Moving Horizon Estimation Model Predictive Control Ordinary Di¤erential Equation OLE for Process Control Partial Di¤erential Equation Quadratic Programming Root Mean Squared Error Root Squared Error Simultaneous Nitri…cation-denitri…cation Sludge Retention Time Sqare-root Unscented Kalman Filter Total Nitrogen Total Phosphorus Telemark University College Unscented Kalman Filter Wastewater Treatment Plant Part I Overview 1 Chapter 1 Introduction 1.1 Background Water is one of our most precious resources, and wastewater treatment is becoming more and more important in a highly populated, industrialized world. Sewage treatment is accomplished most economically by processes with biological oxidation, and among them, the activated sludge process (ASP) is the most generally applied biological wastewater puri…cation technique. This thesis deals with mathematical modeling and process control of ASPs for domestic wastewater treatment. The ASP is typically characterized by: requirement of a proper dynamic model to describe the complex system that incorporate a large number of biological and biochemical processes, uncertain model parameters due to the varying operation, in‡uent, and sludge characteristics of the process, relatively few measurements for the key state variables due to the lack of cheap and reliable sensors and techniques, requirement of advanced control strategies because of the following incentives (see Olsson & Newell (1999) and Olsson et al. (2005)): – the increased public awareness as re‡ected in more stringent regulations is an e¢ cient driving force, – control and optimization can help to minimize the operating costs and get more out of the existing plants, – rejection of large process disturbances, e.g. large variations in the load to the plant requires monitoring and process control, – the current manual control procedures are di¢ cult to use for controlling more complex process alternatives. 3 4 1.2 CHAPTER 1. INTRODUCTION Previous work As for any industrial process, models in biological wastewater treatment have always played an important role in the process design and in the determination of control and operating strategies. The Activated Sludge Models (ASMs) presented by the International Water Association (IWA) (Henze et al. 2000) are generally accepted as the mathematical description of the biochemical processes in the ASP reactors. Model representation is important in control oriented modeling. Traditionally, vendors of control systems have had proprietary/closed systems for model representation. However, a relatively recent trend is software developments supporting open component-based architectures and reuse of components based on object-oriented methods (see Heck et al. (2003)). One object-oriented, general-purpose modeling language is Modelica (Fritzson 2004), with commercial simulation environments such as Dymola from Dynasim (Dynasim 2004). Modelica/Dymola provides important advantages such as suitability for multi-domain modeling, the usage of general equations of physical phenomena, the reusability of model components, and the existence of a WasteWater library containing three ASMs (Reichl 2003). In the early 1970s, Andrews (1974) depicted many potential bene…ts from the development and use of dynamic models for wastewater treatment processes and the incorporation of modern control systems into wastewater treatment plant (WWTP) design. In the last two decades, the application of advanced control techniques has received more and more interest due to the characteristics of ASPs. Advanced control is not the solution to all the problems of ASPs, but it can indeed help to reduce the requirement for long residence time, improve the e- uent water quality, and/or decrease the use of chemicals. In general, the operational objective for a WWTP is to achieve the required e- uent standards with the least operational costs (Olsson et al. 2005). Typically, advanced/modern control theory may include the following concepts (Ray 1981), (Balchen & Mummé 1988): System identi…cation, which determines the model structure and estimates the model parameters (Söderström & Stoica 1989), (Walter & Pronzato 1997), (Ljung 1999). When the model is to be used for process performance evaluation and optimization, it is necessary to have an accurate description of the actual process. Although the ASMs are the state-of-the-art models for ASPs, the model parameters are often required to be adjusted to …t a certain set of data obtained from the real plant. However, a major problem encountered in calibration of ASP models is indeed the lack of identi…ability of the model parameters (Vanrolleghem et al. 1995), (Petersen 2000), (Brun et al. 2002). Parameter identi…ability analysis and estimation is thus an interesting area of research. State estimation. In processes where digital sensors are not available or are expensive, state estimation may be of signi…cant practical importance (Gelb 1992), (Soroush 1998), (Crassidis & Junkins 2004), (Simon 2006). A major bottleneck in the application of advanced monitoring and control strategies for WWTPs lies in the di¢ culty of measuring reactant and product concentrations in a reliable and cost e¤ective manner (Lindberg 1997), (Dochain 2003). Therefore, the application of state estimation techniques in ASPs is of great interest. Optimal control theory, which allows the design of control schemes that are optimal 1.3. SCOPE AND OUTLINE OF THESIS 5 in the sense that the controller performance minimizes some speci…ed cost functional (Bubnicki 2005), (Bequette 2003). The optimal control algorithms belong to the class of model-based control strategies (Brosilow & Joseph 2002). Thus, the development of ASP models motivates the study of applying optimal control theory to the ASP control. However, the optimal control strategy in itself is unsuitable for practical implementation since it is an open-loop solution. Model predictive control (MPC), which is the approach to implement the theory of optimal control on-line, introducing feedback from the process (Rossiter 2003), (Camacho & Bordons 2004), (Seborg et al. 2004). MPC is a proven advanced control technique, suitable for ASPs, especially due to its abilities to systematically handle constraints and to reduce the e¤ects of process disturbances (see Zhao et al. (1994a), Lukasse et al. (1998), Holenda et al. (2007), etc.) 1.3 Scope and outline of thesis The goal of this thesis is to investigate methods for developing and implementing activated sludge plant models in an e¢ cient way to provide a good prediction of process dynamics, and to study possible improvements in process operation and performance through applications of advanced modeling and control techniques. In a broad perspective, the thesis will cover the modeling methodology of ASPs and all the aforementioned topics in advanced control. The modeling and control techniques described in this thesis are in principle applicable to any ASP; as case studies, a laboratory-scale nitrogen (N) removal process and a full-scale phosphorus (P) removal plant: the Duvbacken WWTP, are introduced. The studies focus on the modeling and control of the biochemical processes occurring in the biological reactors, based on the complete ASM models. For a complex system like the ASP, the ASM model is probably the simplest description of the processes in consideration of the predictive purpose of the model, and model reduction of the ASM model is not considered in the thesis. With respect to the control of ASPs, the implementation and testing of controllers is not covered in this work. The developed control strategies are evaluated through simulation studies, since simulations make it possible to e¢ ciently compare the di¤erent control techniques. This thesis is composed of two parts. Part I basically gives an overview of the results obtained in the papers provided in Part II. However, a few results in Part I are not presented in any paper, either because the topics do not …t with the scope of the papers or because the results were not ready at the time of submission or publishing of papers. Chapter 2 gives an introduction to ASPs and to the object-oriented modeling of ASPs. Chapter 3 provides an overview of the state estimation techniques and compares the performances of these techniques applied to a nonlinear ASP. Parameter estimation of the ASPs is described in chapter 4, where both estimation of kinetic parameters and model disturbances are investigated. Chapter 5 presents the process control strategies used for controlling the aeration system of the ASPs. Chapter 6 gives a short introduction to a laboratory case study. Finally, chapter 7 contains conclusions and suggestions for future work. Part II provides six papers published or submitted in conjunction with this thesis: Abstract of Paper A A general description of wastewater treatment based on activated 6 CHAPTER 1. INTRODUCTION sludge is given, with emphasis on the ASM2d model. Next, a systematic approach for experimental parameter identi…ability analysis is described. After a presentation of the wastewater treatment plant at Duvbacken in Gävle, Sweden, the experimental identi…ability of the dynamic model is analyzed. Out of the 45 original parameters in the model, the analysis indicates that with the given experimental conditions, 12 parameters can be identi…ed. Abstract of Paper B This paper carries out the parameter identi…ability analysis with the approach described in Paper A, and …ts the model to experimental data from the Duvbacken plant. The model is implemented in an object-oriented, general-purpose modeling language Modelica, and is executed in Matlab for further analysis. A standard least squares criterion is used in combination with a direct optimization method to calculate the improved parameter estimates, and the adjusted model is validated against experimental data. Abstract of Paper C The problem of optimal state estimation in a biological wastewater treatment process is considered. The standard Kalman …lter (KF) and its extensions: the extended Kalman …lter (EKF) and the unscented Kalman …lter (UKF), are used to estimate the unmeasured state. The prediction of the state with the standard KF is poor due to the high nonlinearity of the process. Thus, the nonlinear estimation approaches are focused, with a comparison between the EKF and the UKF. The simulation results show that the UKF provides slightly better state estimate than the EKF for both an observable process and an unobservable process. Abstract of Paper D This paper deals with optimal control of a biological wastewater treatment process designed to remove nitrogen with simultaneous nitri…cation/ denitri…cation in a single reactor. The objective of the control is to force the total nitrogen concentration to track given set points. The optimization problem is speci…ed and formulated using a quadratic performance index. Dynamic optimization is used in model predictive control (MPC) based on a linearized model. The control strategy is successfully applied to the simulation model of the pilot plant. Abstract of Paper E The optimal control of a nitrogen removal process with intermittent aeration is discussed in order to design the aeration strategy (air-on and air-o¤ periods) which minimizes the energy dissipated by the aeration system, with adherence to the limits of the EU e- uent requirements and the operating constraints. The optimization problem is formulated and used with a receding horizon in nonlinear MPC based on the complete ASM3 model. The simulation results show that signi…cant improvements can be achieved with respect to the initial aeration strategy, with reductions in the energy consumption by 33% for the optimal control over one day and by 16% for MPC over 7 days. Abstract of Paper F The model-based optimal control and predictive control of the intermittently aerated nitrogen removal process is presented. The optimization problem is developed based on the discussion in Paper E. The MPC aeration pro…le guarantees that the plant ful…lls the e- uent requirements at any time over long time periods, and 1.4. MAIN CONTRIBUTIONS 7 signi…cant energy saving is also obtained when comparing MPC to three traditional rule-based control strategies. 1.4 Main contributions The main contributions of this thesis are: Two activated sludge plant models are developed based on standard ASM models: one for the laboratory-scale N-removal plant and one for the Duvbacken P-removal plant. The model implementation in Modelica/Dymola is described, and the possible Dymola interfaces are introduced. Some widely used state estimation techniques, such as standard Kalman …lter (KF), extended Kalman …lter (EKF), unscented Kalman …lter (UKF), square-root unscented Kalman …lter (SRUKF), and moving horizon estimation (MHE), are discussed, and the performances of these …lters are evaluated with application to the N-removal process. The systematic approach to parameter identi…ability prior to parameter estimation (Brun et al. (2002), Dueñas Díez et al. (2006)) is described and applied to the Duvbackenmodel. A methodology for simultaneously estimating state and disturbance in ASPs is developed using the extended Kalman …lter, and the suggested method is illustrated on the Duvbacken WWTP, based on experimental data. Advanced control strategies for the ASP aeration system, based on linear and nonlinear MPC techniques, are suggested, with promising results compared with the traditional rule-based controllers. Some recommendations for future work are suggested for a laboratory N-removal project. 8 CHAPTER 1. INTRODUCTION Chapter 2 Activated Sludge Processes for Wastewater Treatment 2.1 Introduction Wastewater generally contains large quantities of organic matter that results in the depletion of natural oxygen resources in the water. Also, the nutrients in the wastewater, such as nitrogen and phosphorus, may lead to algae growth, which causes oxygen depletion, odor problems, excretion of toxins, etc. Therefore, for wastewater treatment, the main objective is to remove or reduce the content of organic matter, as well as nitrogen (N) and phosphorus (P). A general description of biological wastewater treatment, containing wastewater characterization, wastewater species, biological processes, and wastewater kinetics and dynamic models, is given in Paper A. The strict European Union Guideline Urban Wastewater Directive 91/271/EEC1 (a summary is shown in Table 2.1) came out in 1991, where the limits on e- uent concentrations of total chemical oxygen demand (CODtot )2 , total suspended solids (SS), total phosphorus (TP)3 , and total nitrogen (TN)4 are required. Due to legislation on wastewater treatment, 1 For more information, see http://ec.europa.eu/environment/water/water-urbanwaste/index_en.html. CODtot indicates the total organic carbon in wastewater. The CODtot related to the components in ASM3 is de…ned as (Petersen 2000) 2 CODtot , SI + SS + XI + XH + XSTO + XA . 3 Total phosphorus (TP) includes both soluble phosphorus and particulate phosphorus. The TP related to the components in ASM2d is de…ned as TP , SPO4 + SF iP;SF + SI iP;SI + XPP + XS iP;XS + XI iP;XI + (XH + XPAO + XAUT ) iP;BM : 4 Total nitrogen (TN) is comprised of organic nitrogen, ammonia, nitrite, and nitrate (Metcalf & Eddy 2003). The TN related to the components in ASM3 is de…ned as TN , SNH4 + SNOX + SI iN;SI + SS iN;SS + XI iN;XI + XS iN;XS + (XH;ef f + XA;ef f ) iN;BM : 9 10 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT Table 2.1: E- uent requirements in EU directive 91/271/EEC. Parameters Componenta) E¢ ciencyb) (% of reduction) 3 Chemical oxygen demand (CODtot ) 125 g m 75% Total suspended solids (SS) 35 g m 3 90% 3 Total phosphorus (TP) 2 g m (10; 000–100; 000 p.e.) 80% 1 g m 3 (> 100; 000 p.e.) 80% Total nitrogen (TN) 15 g m 3 (10; 000–100; 000 p.e.) 70 80% 10 g m 3 (> 100; 000 p.e.) 70 80% a) These values of concentration are annual average. b) Either concentration or the percentage of reduction shall apply. One or both parameters are to be applied depending on local conditions. activated sludge plants has been introduced on a large scale. In an activated sludge process (ASP), wastewater is mixed with a bacterial biomass suspension (called an activated sludge) which degrades the pollutants. Depending on the plant design and the speci…c application, an activated sludge plant can achieve biological nitrogen removal and biological phosphorus removal, besides removal of organic matter. The modeling of ASPs is a very active research area, see e.g. Dochain & Vanrolleghem (2001) and Hu et al. (2003) for reviews on the subject. It should be mentioned that there is an essential di¤erence between a WWTP model and an activated sludge model, as discussed in Gernaey et al. (2004). The WWTP model indicates the ensemble of activated sludge model, hydraulic model, oxygen transfer model, and settler model needed to describe an actual plant. The activated sludge model is used to represent the biological (and chemical) reactions taking place in one activated sludge reactor. To date, the most frequently used activated sludge models are the family of Activated Sludge Models (ASMs) developed by the International Water Association (IWA). The Activated Sludge Model No. 1 (ASM1) (Henze et al. 1987) is usually considered as the reference model, which was primarily developed for municipal ASPs to describe the removal of organic carbon substances and nitrogen. With basically the same goals as ASM1, the ASM3 model (Gujer et al. 1999) was developed for nitrogen removal ASPs. The ASM3 model was intended to become the new standard model, correcting a number of defects that have been noticed during the usage of the ASM1 model. In addition, the models including biological phosphorus are the ASM2 model (Gujer et al. 1995) and its extension ASM2d (Henze et al. 1999), which extend the capabilities of ASM1 to represent the dynamics of phosphorus removal. Henze et al. (2000) also mentioned that modeling of phosphorus removal (as mentioned in ASM2 and ASM2d) can be integrated with ASM3 by including additional processes and states. This chapter gives an introduction to the ASP and to the ASM model implementation using an object-oriented modeling method. Two activated sludge processes are studied: one at laboratory scale for N-removal is described in section 2.2, and one at the plant scale for P-removal is described in section 2.3. The object-oriented modeling method using Modelica/Dymola is presented in section 2.4. In addition, appendix 2.A describes a Python 2.2. NITROGEN REMOVAL PROCESS 11 N2 gas Nitrification Denitrification NO3-N NO2-N Influent Effluent Nitrification bacteria NH4-N Denitrification bacteria NO3-N O2 Organic carbon Figure 2.1: Nitrogen transformations in biological treatment processes, based on description in Metcalf & Eddy (2003). tool for a Dymola-Python interface. 2.2 2.2.1 Nitrogen removal process Biological nitrogen removal Nitrogen is removed in these two steps: ammonium (NH4 -N) is …rst oxidized to nitrate (NO3 -N) under nitri…cation; the produced nitrate is then transformed into nitrogen gas (N2 ) under denitri…cation. The nitrogen transformations are schematically shown in Figure 2.1. Hence, all of the biological nitrogen removal processes include an aerobic zone in which nitri…cation occurs. Anoxic condition must also be included to provide denitri…cation to complete the objective of total nitrogen removal by both NH4 -N oxidation and NO3 -N and NO2 -N reduction to nitrogen gas (Metcalf & Eddy 2003). Thus, the approaches for designing anoxic conditions can be categorized as 1. separate anoxic zones which are either spatial distributions in the reactors or separate reactors from aeration zones (Droste 1997), 2. simultaneous nitri…cation-denitri…cation (SNdN) processes where both nitri…cation and denitri…cation occur in the same tank without alternating (in time or in space) aerobic and anoxic conditions (Collivignarelli & Bertanza 1999), or 3. intermittently aerated processes where continuous alternating aerobic-anoxic conditions are created by switching the air on and o¤ in the same tank (Ip et al. 1987), (Nakajima & Kaneko 1991), (Hao & Huang 1996), (Kimochi et al. 1998). 12 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT Influent Qin, xin Aeration tank Air Qin + Qrs Settler Effluent Qeff, xeff Recycled sludge Qrs, xrs Wasted sludge Qw Figure 2.2: Schematic diagram of a typical activated sludge process. Chachuat et al. (2005).) (Adapted from In the last two decades, intermittently aerated ASPs have been developed and widely used for small-sized WWTPs. Compared to conventional ASPs, intermittently aerated ASPs have the following distinctive features: The process o¤ers signi…cant energy savings due to no continuous transport of oxygen to the anoxic phase and high oxygen transfer e¢ ciency during the initial period of aeration (Ip et al. 1987), (Kim et al. 2000). The degree of operational ‡exibility is high because reaction times of nitrifying/denitrifying can easily be adjusted by changing the aeration scheduling, which makes the process better accommodate variable in‡uent loading conditions and suitable for optimization of operational costs (Hao & Huang 1996), (Isaacs 1997) . The single tank con…guration provides space saving, low investments of instruments, and easy plant retro…tting. In this work, mainly the intermittently aerated process is studied. In addition, control of the SNdN process is also considered in subsection 5.3.1. 2.2.2 The laboratory-scale nitrogen removal plant A laboratory-scale N-removal plant is considered in Papers D, E and F, for modeling and control studies of an ASP. The plant was originally built to study the removal of nitrogen from the wastewater of an oil re…nery by Baksaas (1996); later the reactor system was modi…ed and used for municipal wastewater treatment in student projects at Telemark University College. This nitrogen removal process consists of a unique aeration tank with a working volume Va = 40 l and a cylindrical settler located in the aeration tank; the process is schematically shown in Figure 2.2. More details are available in Paper E. Hence, the plant model consists of an aeration tank model and a settler model. 2.2. NITROGEN REMOVAL PROCESS 13 Aeration tank model The derivation of the reactor model is based on mass balances of the wastewater species, which are generally expressed as follows: Accumulation = In‡ow Out‡ow + Reaction. The ASM3 model is used to described the biological processes involved in the aeration tank. The model contains 13 state variables described in Table 2.2. Assuming perfect mixing in the reactor, the mass balance of each component is expressed by a nonlinear ordinary di¤erential equation (ODE), thus the mass balance in the aeration tank results in: dxa Qin xin + Qrs xrs (Qin + Qrs ) xa = + r + e1 AO2 ; dt Va where xin , xrs , xa 2 R13 contain the concentrations in the in‡uent, in the recycled sludge, and in the reactor, respectively; their components are xl = [SO2 ;l SI;l SS;l SNH4 ;l SN2 ;l SNOX;l SALK;l XI;l XS;l XH;l XSTO;l XA;l XSS;l ]T l 2 fin, rs, ag; r 2 R13 is the vector formed by the reaction rates of each component (de…ned in ASM3); e1 is the standard basis for the …rst coordinate in R13 . AO2 describes the oxygen transfer: AO2 = ua KL a SOsat2 SO2 ;a , where KL a is the oxygen transfer coe¢ cient which is a function of the supplied air ‡ow rate, and SOsat2 is the saturated dissolved oxygen concentration (SOsat2 10 g m 3 ). According to the aeration modes of ASPs, the control input of the process may described as: For the continuously aerated ASP, variable ua is chosen 1, and KL a is often considered as control input. For the intermittently aerated ASP, the value of KL a is chosen constant, instead, variable ua is a binary sequence switching between 0 and 1 that represents the state of the blower (on/o¤) aerating the plant. Hence, the control input is the sequence of switching times, i.e., times when the blower switches on/o¤. Settler model The purpose of the secondary settler is twofold: to e¢ ciently separate the solids and liquid — the clari…cation; to rapidly thicken the sludge at the bottom of the settler — the thickening process. Olsson & Newell (1999) points out that dynamic modeling of settlers has received much less attention compared to modeling of the aeration tank, and an elegant solution still evades the activated sludge modelers. In the literature, di¤erent settler models have been introduced mainly based on mass balances and on settling ‡ux theories, see e.g. Jeppsson (1996), Dochain & Vanrolleghem (2001), and Takács et al. (1991). However, for simplicity, the settler is often considered as an ideal settler. We thus assume that 14 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT Table 2.2: State variables of the ASM3 model. State Description Unit Dissolved components ( Sj ) SO2 Dissolved oxygen g O2 m 3 SI Soluble inert organics g COD m 3 SS Readily biodegradable substrates g COD m 3 SNH4 Ammonium gNm 3 SN2 Dinitrogen, released by denitri…cation g N m 3 SNOX Nitrite plus nitrate gNm 3 SALK Alkalinity, bicarbonate mol HCO3 m Particulate components ( Xj ) XI Inert particulate organics g COD m 3 XS Slowly biodegradable substrates g COD m 3 XH Heterotrophic biomass g COD m 3 XSTO Organics stored by heterotrophs g COD m 3 XA Autotrophic, nitrifying biomass g COD m 3 XSS Total suspended solids g SS m 3 3 1. the separation of liquid and solid/particulate phases is perfect and no reaction occurs in the settler, and 2. the sum of all settler out‡ows equals the settler in‡uent ‡owrate. Based on these assumptions, the settler model can be expressed as follows: E- uent concentration Sj;e = Sj;a , Xj;e = 0 Recycled sludge concentration Sj;rs = Sj;a , Xj;rs = Qin + Qrs Xj;a . Qrs + Qw General model In summary, the general model of the dynamic system can be simply described as a set of ODEs: dxa = F (xa ; u; t) , dt in which u is the control input described in modeling of the aeration tank. This simpli…ed expression will be used in the de…nition of the optimization problem in chapter 5. 2.3. PHOSPHORUS REMOVAL PROCESS 15 Aerobic Phase Anaerobic Phase O2 Soluble COD Carbon storage Influent Glycogen Carbon storage Polyphosphate Cell wall Energy and carbon Glycogen Energy Polyphosphate O-PO4 Cell wall CO2 + H2O Cell synthesis Effluent Energy O-PO4 Figure 2.3: Principle of biological phosphorus removal. (Adapted from (Jenkins 2007).) 2.3 2.3.1 Phosphorus removal process Biological phosphorus removal In biological removal of phosphorus, the phosphorus is released under anaerobic conditions and taken up under aerobic/anoxic conditions, see Figure 2.3. 1. In the anaerobic phase, the phosphorus accumulating organisms (PAO) take up carbon sources and produce intracellular polyhydroxylalkanoate (PHA) storage products. The energy needed for this process is derived by the degradation of intracellular polyphosphates, resulting in a subsequent release of orthophosphate (O-PO4 ). Some glycogen contained in the cell is also used. 2. In the subsequent aerobic phase, the stored PHA is metabolized, providing energy from oxidation and carbon for new cell growth. Some glycogen is also produced. Using the released energy, soluble O-PO4 is removed from solution and incorporated into polyphosphates within the bacterial cell. The new biomass with high polyphosphate storage accounts for phosphorus removal. Since biological phosphorus removal is an extremely complex procedure, the mechanisms of phosphorus removal are still under investigation. The mechanisms as currently understood are summarized by the ASM2 and ASM2d models (Henze et al. 2000). 2.3.2 The Duvbacken WWTP Duvbacken is a wastewater treatment plant which is designed to treat the municipal wastewater from 100; 000 people equivalents (p.e.) in the city of Gävle, Sweden, see Figure 2.4. The average feed ‡owrate to the plant is approximately 1; 600 m3 = h. The …rst construction phase was completed in 1967, and consisted of facilities for mechanical and biological treatment according to the activated sludge approach. This plant has been recently modi…ed to mainly remove phosphorus, together with nitrogen and organic matter. The treatment 16 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT Figure 2.4: Aerial photo of the Duvbacken wastewater treatment plant. (Taken from Duvbacken plant lea‡et.) process of the plant consists of grit removal, primary treatment, chemical treatment, biological treatment, and sludge treatment. In this work, we only consider biological treatment of wastewater, including processes for biological reactions and clari…cation. The process layout of the biological treatment stage is described in Paper A, where the process consists of 1 anaerobe step, 3 aerobe steps, and 1 secondary sedimentation step. A dynamic model of the plant is developed, based on the ASM2d model. A minor simpli…cation of the presentation here compared to the full ASM2d, is that we neglect the possibility of phosphorus to bind to metal-hydroxides and the associated chemical processes. In the plant model, each of the 4 reaction steps (anaerobe, aerobe 1–3) is modeled as a perfectly stirred reactor. This leads to 17 states (listed in Table 2.3) in each of the reactors, i.e., in total 68 states for the plant model. The model has 42 parameters, i.e., kinetic parameters of the simpli…ed ASM2d model. For the settler, it is assumed that 99:8% of the sludge in the settler in‡uent is deposited, and the remaining 0:2% of the sludge ‡ows out in the e- uent of the plant. The concentrations of dissolved components (Sj ) in the in‡ow of the settler are equal to the Sj contained in the out‡ows of the settler. 2.4 Object-oriented modeling During the previous decade of research in modeling and simulation, the concept of objectoriented modeling has achieved a prominent position. Many studies have demonstrated that object-oriented concepts can be successfully employed to support hierarchical structuring, reuse, and evolution of large and complex models, independently from the application domain and specialized graphical formalism (Ma¤ezzoni et al. 1999), (Bortolin et al. 2004), (Bastogne 2004). The object-oriented approach to modeling is a credible methodology to deal with complex and heterogeneous systems, while computer simulation is the means to use such methods in 2.4. OBJECT-ORIENTED MODELING Table 2.3: State variables of the AMS2d model. State Description Unit Dissolved components ( Sj ) SO 2 Dissolved oxygen g O2 m 3 SF Readily biodegradable substrate for fermentation g COD m 3 SA Fermentation product (acetate) g COD m 3 SNH4 Ammonium gN m 3 SNO3 Nitrate (plus nitrite) gN m 3 SPO4 Phosphate gP m 3 SI Inert, non-biodegradable organics g COD m 3 SALK Bicarbonate alkalinity mol HCO3 m SN2 Dinitrogen gN m 3 Particulate components ( Xj ) XI Inert, non-biodegradable organics g COD m 3 XS Slowly biodegradable substrate g COD m 3 XH Heterotrophic biomass g COD m 3 XPAO Phosphorus-accumulating organisms, PAO g COD m 3 XPP Stored poly-phosphate of PAO gP m 3 XPHA Organic storage products of PAO g COD m 3 XAUT Autotrophic, nitrifying biomass g COD m 3 XTSS Particulate material as model component g TSS m 3 17 3 practice for assessing the global system performance. For wastewater treatment systems, a very good survey of modeling and simulation tools is provided in Olsson & Newell (1999) and Gernaey et al. (2004). 2.4.1 Modelica and Dymola In 1996 an international e¤ort was initiated for the purpose of bringing together expertise in object-oriented physical modeling and de…ning a modern uniform modeling language; this language was named Modelica. Modelica is an object-oriented, general-purpose modeling language specially designed for representing complex and heterogeneous physical systems (Tiller 2001), (Fritzson 2004). Today, there are at least four commercial simulation environments based on the Modelica language: Dymola, MathModelica System Designer, MOSILAB, and SimulationX, as well as a number of useful tools such as EXITE, TISC, and StateViewer. In addition, the Open Source Modelica (named OpenModelica) is developed by the Programming Environment Laboratory (PELAB) at Linköping University, Sweden. For more information, we refer the reader to the Modelica home page: http://www.modelica.org. In this work, Modelica is used with one of its commercial simulation environments, Dymola from Dynasim (http://www.dynasim.se), as the model representation tool for activated sludge systems. Compared with most other modeling and simulation tools available 18 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT today, such as gPROMS5 and Matlab & Simulink, Modelica/Dymola o¤ers several important advantages: For modeling and simulation in general Object-oriented architecture allows the user to easily modify and reuse of model components. Equation-based modeling supports many di¤erent model descriptions, such as ODEs, di¤erential algebraic equations (DAEs), bond graphs, Petri nets, etc.6 Acausal modeling, meaning that the model’s terminals do not necessarily have to be assigned an input or an output role, enables both simpler models and more e¢ cient simulation. Hybrid DAE systems can present both continuous-time behavior and discrete-time behavior of the model. Class parameters make it possible to parameterize models in a high-level fashion by exchanging submodels or even whole subsystems for a compatible type replacement. The Dymola model editor o¤ers a good intuitive user interface, and the graphical representation of the model is embedded in the Modelica code. For modeling and simulation of activated sludge processes A free Modelica library WasteWater (Reichl 2003) is available, which contains three activated sludge models (ASM1, ASM2d, and ASM3) and several secondary clari…er models. The WasteWater library includes relatively complete components needed for modeling and simulation using ASMs. In addition, with the ‡exibility of the Modelica language, the user can easily extend the speci…c components. Modelica provides ‡exibility to build large plant models. A full wastewater plant usually contains many components. The hierarchical modeling support and available basic models are vital in helping the user to deal with the complexity. It is possible to include measurement data as input or data tables (using the component CombiTimeTable) to the simulator. Since measurement data are not always represented with an equidistant time interval, Dymola provides possibilities to present time tags to each measurement point. 5 gPROMS is an equation-based modeling system designed primarily for chemical process engineering. Currently, Modelica has less support for process models than gPEOMS, but the modeling scope is more general. More detailed comparison of language features between gPROMS and Modelica can be found in Tummescheit (2002). 6 gPROMS includes a notation for partial di¤erential equations (PAEs) in the language, while integration of language constructs for PAEs is still under development in Modelica. 2.4. OBJECT-ORIENTED MODELING 19 Figure 2.5: Model diagram of the laboratory-scale N-removal plant. 2.4.2 Model implementation Although the WWTP is often a very large and complex system, within the Dymola simulation environment, the process model can be easily constructed by dragging, dropping, and connecting components chosen from the WasteWater library. The model diagrams of the laboratory-scale N-removal plant and the Duvbacken P-removal plant are shown in Figures 2.5 and 2.6. More details of the models implementation for these two presented ASPs can be found in Papers E and B, respectively. 2.4.3 Dymola interfaces Dymola o¤ers an open interface to other programs. A well-developed interface exists for Matlab/Simulink (MathWorks 2007), (Dynasim 2004). Recently, a prototype of an interface to LabVIEW version 8.20 is available in Dymola version 6.1 (Dynasim 2007). In addition, the author developed a Dymola-Python interface to execute Modelica models in the Python environment, to test out the possibility. Dymosim –Dynamic model simulator Dymosim – dynamic model simulator – is a stand-alone program that contains the machine code necessary for model simulation with event handling support (Dynasim 2004). When translating a model in Dymola, an executable Dymosim (dymosim.exe) is generated. Dymosim can be compiled with no graphical user interface or as a Windows application with Dynamic Data Exchange (DDE) server capabilities. With the di¤erent operating modes, the dymosim executable can be used for simulation, linearization, and initial value calculation. Moreover, the dymosim executable uses …les to de…ne its inputs and outputs. Figure 2.7 schematically presents the relationship between Dymosim and these …les. The dymosim executable can be independently called from environments other than Dymola. Next, two 20 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT Figure 2.6: Model diagram of the Duvbacken P-removal plant. interfaces to Dymola will be discussed. Dymola-Matlab interface Dymola provides convenient interfaces to Matlab and the popular block-diagram simulator Simulink. This enables the powerful physical modeling capabilities of Modelica to be combined with e¢ cient control system design using Matlab/Simulink. The dymosim executable can be called from Matlab using the function dymosim.m. Execution of the Modelica model in Matlab is described in Paper B. In addition, the model compiled into a dymosim executable can be linearized using the ’-l’modi…er of the dymosim command7 . Matlab allows us to execute the dymosim executable modi…er using a Matlab script function: eval([’! dymosim ’,’-l ’,’dslin.mat’]); Then, the linearized model saved in dslin.mat can be loaded into Matlab using the Dymola add-on m-function tloadlin which loads matrices A,B,C,D and string vectors uname, yname, and xname. For the approaches on how to transform Modelica models into Simulink see Dynasim (2004) and Dempsey (2003). 7 As a stand-alone program, Dymosim accepts command line arguments de…ned in Dynasim (2004). 2.4. OBJECT-ORIENTED MODELING Optional script facility: - load model libraries - set parameters - set start values, etc. 21 Experiment description: - start/stop time - initial values - integration algorithms - parameters, etc. Optional file to define trajectories of input signals script file (*.mos) dsu.txt dsu.mat dsin.txt dymosim.exe ’dymosim -i’ generates a ’dsin.txt’ file ’dymosim -l’ linearizes model at initial values dsres.mat dsres.txt Simulation results dslog.txt Statistics of simulation and debug information dsfinal.txt Final state (same structure as dsin.txt) dslin.mat Linearization results Figure 2.7: Connection of dymosim executable …le and its input and output …les, based on (Videla 2007). Dashed lines mean that the connection is optional. Dymola-Python interface As a dynamic object-oriented programming language, Python may be an alternative tool for prototyping algorithms in advanced control techniques. Compared to Matlab, Python has some clear advantages (Langtangen 2006), such as: the Python environment is completely open and made for integration with external tools, a complete toolbox/module with lots of functions and classes can be contained in a single …le (in contrast to a number of M-…les), object-oriented programming is better developed, the source code is free and runs on more platforms. Unfortunately, Dymola does not have the functionality to support the communication with Python. Thus, a Dymola-Python interface module8 , called dymosimPy, is developed in this work in order to execute a Modelica model and load simulation results in Python. Table 2.4 summarizes the functions in the dymosimPy module. These functions are developed using similar principles as for the Matlab functions o¤ered by Dymola. For instance, the dymosim executable is called by the dymosim function in Python with the command line 8 A module is a …le containing Python de…nitions and statements. 22 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT Table 2.4: Functions in the dymosimPy module. Function Description dymosim Perform simulation of a Modelica model, save and load results parload Load parameter values and names from the Dymola input …le initload Load initial state values and names from the Dymola input …le dymload Load simulation results from a .mat …le dymget Get simulation result of a speci…c single variable tnlist List a string vector with preceding row numbers loadName Load string variables from the Dymola input …le findIndex Find indices of a value in a list setInitialValue Set a list (initial values) in the initialValue array d = dymosimPy.dymosim(exp,x0,p,quiet,file) By running this command, the dymosim executable reads the experiment description from the input …le speci…ed in the file variable, performs simulation, stores the simulation result in dsres.mat, and loads the result into a dictionary9 data structure in Python. A detailed introduction to the dymosimPy module is given in appendix 2.A. 2.A dymosimPy — A Python module for Dymola-Python interface Python is a dynamic object-oriented programming language that can be used for many kinds of software development. Python o¤ers powerful features such as classes, modules, exceptions, dynamic typing and very high level collection data types in a concise, regular, and very readable syntax. Both the Python language and software packages are free, and a huge collection of library components written in or interfaced with Python exists. Hence, Python may be a powerful integration tool for advanced control. It is of interest to develop a DymolaPython interface to call the dymosim executable from the Python environment. Here, a Dymola-Python interface module, called dymosimPy, is developed to execute a Modelica model and load simulation results in Python. Actually, using Python for development of Modelica tools has been the subject of several studies. German National Research Center for Information Technology (GMD) has developed a Modelica translator in the Python-based development environment TRAP (Translator RApid Prototyping) for integration in the Smile10 dynamic simulation environment. An open source research prototype compiler11 for Modelica (a subset of Modelica) is implemented in 9 A dictionary, also called hash or associative array in other computer languages, is a kind of list where the index, referred to as key, can be an arbitrary text. For example, a dictionary can be initialized by de…ning dict = {}; dict[’list’] = [1,2,3]. 10 Smile (http://www.…rst.fraunhofer.de/en/simulation-technology) is an object-oriented dynamic simulation environment developed by Technische Universität Berlin and GMD. 11 More information and the source code can be found on the website http://msdl.cs.mcgill.ca/people/wxu/research.html. 2.A. DYMOSIMPY — A PYTHON MODULE FOR DYMOLA-PYTHON INTERFACE 23 Python with the focus on acausal modeling. The GENSIM project is developing the generic simulation tool MOSILAB (Schmitz 2005) for the analysis of mixed time-continuous/timediscrete (hybrid) models of heterogeneous technical systems. MOSILAB uses the Python language and interpreter as its central mechanism for experiment control. For more information on the Python language, see the Python home page http://python.org and the reference books Lutz & Ascher (2003), Gauld (2000), and Langtangen (2006). However, since Python is nonpro…t, the technical support and documentation of Python are not as good as for other commercial software. 2.A.1 Python vs. Matlab In computational science, Matlab is the de factor standard, and o¤ers a high-level language and an interactive environment for algorithm development, data visualization, data analysis, and numeric computation. As a powerful scripting programming language, Python also o¤ers a number of advantages for scienti…c computing. A comparison of Matlab and Python is described in Langtangen (2006). Matlab and Python have indeed many things in common, including no declaration of variables, simple and convenient syntax, easy creation of GUIs, and gluing of simulation and visualization. Nevertheless, Python has some clear advantageous over Matlab and similar environments: the Python programming language is more powerful, the Python environment is completely open and made for integration with external tools, a complete toolbox/module with lots of functions and classes can be contained in a single …le (in contrast to a number of M-…les), transferring functions as arguments to functions is simpler, nested, heterogeneous data structures are simple to construct and use, object-oriented programming is better developed, interfacing C, C++, and Fortran code is better supported and therefore simpler, scalar functions work with array arguments to a larger extent (without modi…cations of arithmetic operators), the source is free and runs on more platforms. However, Matlab has signi…cantly more comprehensive numerical functionality than Python (linear algebra, ODE solvers, optimization, time series analysis, image analysis, etc.). The graphical capabilities of Matlab are also more convenient than Python, since Python graphics relies on external packages that must be installed separately. Some Python programmers have developed interfaces, e.g. pymat, Mlabwrap, that allows Python programs to use Matlab as a computational and graphics engine. Also, the matplotlib library o¤ers high-quality curve plotting with Matlab-like syntax. A good comparison of how to use Python for those with Matlab knowledge is given in the books Kiusalaas (2005b) and Kiusalaas (2005a).. 24 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT 2.A.2 Python fundamentals Installing Python Simply visit http://www.python.org/download to get the most recent version of Python. If you are running Windows XP, the most well-known Python distribution is ActivePython. ActivePython is a free, all-in-one distribution from ActiveState (http://www.activestate.com). More Python distributions and integrated development environments (IDEs) are introduced in Lutz & Ascher (2003). Some useful Python libraries A large number of extension modules have been developed for Python. A complete list of available modules can be obtained from the PyPI page (http://www.python.org/pypi). Here, two packages are used in the dymosimPy module: Scienti…c Tools for Python (SciPy) is open-source software for mathematics, science, and engineering. The core library is NumPy which provides convenient and fast Ndimensional array manipulation. In this work, the functions loadmat and savemat of the SciPy library are used to read and write data of a Matlab .mat …le. matplotlib is a python 2D plotting library which produces high-quality curve plotting with Matlab-like syntax. De…ning PATH and PYTHONPATH variables Sometimes, the user needs to add two important environment variables: PATH and PYTHONPATH. The operating system searches in the directories contained in the PATH variable to …nd executable …les. Similarly, Python searches modules to be imported in the directories contained in the PYTHONPATH variable. The standard PythonWin has included the default Python path which can be browsed or edited in the menu Tools/Edit Python Path. To use the dymosimPy module, you need to add the location of dymosimPy into the PYTHONPATH variable. When the user has added the dymosimPy module in PYTHONPATH, all the functions in the module can be imported using the command: >>> import dymosimPy Debugging in Python The PythonWin IDE (available with the ActivePython distribution) has a built-in debugger. The debugger supports setting breakpoints and single stepping at the source line level, examining the current context, post-mortem diagnostics, etc.. An introduction to debugging in Python is given on http://www.ferg.org/papers/debugging_in_python.html. Handling …les and text The dymosimPy module directly calls the dymosim executable that uses …les to de…ne its inputs and outputs. In Python, the basic steps of handling …les are as follows: 2.A. DYMOSIMPY — A PYTHON MODULE FOR DYMOLA-PYTHON INTERFACE 25 1. Open the input or output …les A …le is opened by the open function, taking the …lename as …rst argument and a read/write indication as second argument: ifile = open(infilename, ’r’) ofile = open(outfilename, ’w’) # open file for reading # open file for writing The second parameter is optional: ’r’ ’w’ ’a’ ’r+’ ’r+a’ ’b’ read data from the …le write data to the …le (an existing …le with the same name will be replaced) write data to the …le, appending to the end read from and write to (erasing any previous data) the …le read from and write to (appending) the …le read or write binary data The open function creates a Python …le object that you use for reading from or writing to a …le. 2. Read from the input …le and write to the output …le Here are some basic Python methods for …le reading and writing: ifile.read() ifile.readline() ifile.readlines() ofile.write(string) ofile.writelines(list) read a …le’s whole content read a single line from the …le return a list containing all the lines of data in the …le write the contents of string to the …le write a list of lines to the …le 3. Close the …les The …les are closed at the end with the close() method: ifile.close(); ofile.close() When working with binary …les, strings, numbers etc. must be converted into sequences of bytes. To encode/decode binary data, Python provides a module called struct. Text searching and manipulation can often be greatly simpli…ed by utilizing regular expressions which is available through the re module. A basic reference for regular expression syntax in Python is the “Regular Expression HOWTO”(http://www.amk.ca/python/howto/regex). 2.A.3 The dymosimPy module Principle of Dymola-Python interface The Dymola-Python interface is built based on the structure of the Dymola-Matlab interface. More details of the Dymola-Matlab interface are given in Dynasim (2004). The functionality of the dymosimPy module is twofold: Firstly, Dymosim is called as a stand-alone application from Python environment: the experiment description is read from an input …le, one simulation run is performed, the result is stored in an output …le, and the statistics information is saved in another …le. 26 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT Secondly, the simulation result is loaded into Python, and the result for a speci…c simple variable can be obtained. Dymosim is supposed to be executed in Python by a similar command as in DymolaMatlab interface with the following Matlab syntax: d = dymosim(exp,x0,p) where the three input arguments correspond to the three matrices speci…ed in a Dymosim input …le dsin.txt. exp is the experiment setup vector, x0 is the initial state vector, and p is the parameter vector. d is a structure variable containing the simulation result. The input …le as well as the result …le of Dymosim are given in ASCII (human readable) or Matlab binary format. With the executable program alist provided by Dymola, the ASCII and binary form can be transformed into each other, e.g. alist -b dsin.txt temp.mat transforms the ASCII format …le dsin.txt into the Matlab data …le temp.mat. The option -b is used to transform ASCII format to Matlab binary format. According to the functionality, the Dymola-Python interface is built with the following steps (see Figure 2.8): 1. Load the variables of the experimental description from the Dymosim input …le (the default …le is dsin.txt). dsin.txt is a self-explanatory …le with general data structure depicted in Table 2.5. The necessary variables required to run dymosim.exe are Aclass, experiment, initialName, and initalValue. 2. Set the user de…ned input arguments: de…ne exp as the variable experiment, and put x0 and p into the variable initialValue,. 3. Save the modi…ed variables (Aclass, experiment, initialName, initialValue) into a new input …le, e.g. dsin_new.txt. 4. Run dymosim.exe with the command line: dymosim.exe -w dslog.txt dsin_new.txt dsres.mat By running this command, Dymosim reads the experiment description from the …le dsin_new.txt, performs simulation, and stores the simulation results in dsres.mat and the statistics information in dslog.txt. 5. Load the simulation result from dsres.mat and save the result in a dictionary data structure to make it easy to get the simulation result for a speci…c variable. 2.A. DYMOSIMPY — A PYTHON MODULE FOR DYMOLA-PYTHON INTERFACE Table 2.5: Data structures Variable name Size Aclass char(3; 24) experiment double (7; 1) method double (27; 1) settings int (13; 1) initialName char (n; 8) initialValue double (n; 6) initialDescription char (n; 53) n is the number of initial variables. 27 of Dymosim input …le. Description General description Experimental parameters Method tuning parameters Output parameters Name of initial variables Matrix of initial value calculation Description of initial variables Functions in the dymosimPy module The functions of the dymosimPy module are summarized in Table 2.4. All the functions are developed by the author. Some descriptions of the functions in the dymosimPy module are given as follows: dymosim is the main function of dymosimPy. dymosim is called by the command d = dymosimPy.dymosim(exp,x0,p,quiet,file) There are two optional input arguments: quiet indicating whether simulation messages are displayed and file indicating the name of the Dymosim input …le. The function follows the Dymola-Python communication procedure described in Figure 2.8. dymload is used to load simulation results from a Matlab data …le generated by Dymosim. The output dymstr is a dictionary variable containing the following …elds: fname nname ndatamat name description dataInfo data_# name of the Matlab data …le the number of variable names the number of data matrices names of the variables description of the variables dataInfo array data matrices of the variables, # has range from 1 to ndatamat After running dymload, the simulation result of a speci…c variable can be obtained by the dymget function. For a single variable, a column vector containing the data is returned with the command data = dymosimPy.dymget(dymstr,’name’) where dymstr is a dictionary variable introduced above and name is the full variable name. parload and initload are used to load names and values of model parameters and states from the Dymosim input …le. 28 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT Start Existence of dsin.txt? No Error Yes Step 1 Load necessary variables (Aclass, initialName, experiment, initialValue) from dsin.txt Step 2 Set user defined input arguments: define exp as experiment and put x0 and p into initialValue Step 3 Save modified variables (Aclass, experiment, initialName, initialValue) in a new input file (dsin_new.txt) Step 4 Run simulation by calling dymosim.exe: dymosim.exe -w dslog.txt dsin_new.txt dsres.mat Step 5 Load simulation results from dsres.mat End Figure 2.8: Structure of the Dymola-Python interface. tnlist is used to list a string vector, for instance, names of parameters or states, with preceding row numbers. Other functions in dymosimPy, e.g. loadName, findIndex, setInitialValue, are useful for loading and changing variables in the Dymosim input …le. Usually, you can get detailed help for a function by the help command provided in the pydoc module, e.g.: >>> import pydoc >>> help(dymosimPy.dymosim) 2.A.4 Applications of the dymosimPy module Two examples are given below to demonstrate applications of the dymosimPy module. Example 1 (Simulation of a CSTR system model) Consider the classical continuous stirred tank reactor (CSTR) for an exothermic, irreversible reaction, A ! B. In Henson & 2.A. DYMOSIMPY — A PYTHON MODULE FOR DYMOLA-PYTHON INTERFACE 29 Figure 2.9: Model diagram of a CSTR system implemented in Modelica/Dymola. Seborg (1997), the following dynamic model is derived based on the component balance for reactant A and the energy balance : q E dCA = (CAf CA ) k0 exp CA dt V RT dT q ( H) E UA = (Tf T ) + k0 exp CA + (Tc dt V Cp RT V Cp T) where CA is the concentration of A in the reactor, T is the reactor temperature, and Tc is the temperature of the coolant stream. The CSTR system is implemented in Modelica/Dymola, see Figure 2.9. The Modelica model is then simulated in the Python environment using the dymosimPy module. The evolution of the reactor temperature T is shown in Figure 2.10 by manipulating the temperature of the coolant stream Tc . The Python code appears as follows. # Version 1.0, 2006-07-18 # Written by Qian Chai, Telemark University College import dymosimPy from pylab import * # import matplotlib library # Define path and name of the Dymosim input file path = "D:\\Python_Dymola\\testCSTRmodel\\" # \\ denotes \ in Python file = path + "dsincstr.txt" # Define experiment parameters exp = [0, 10, 0, 500, 1e-4, 0, 8] # Define model parameters p, pname = dymosimPy.parload(file) ##dymosimPy.tnlist(pname) 30 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT Figure 2.10: Simulation result of the CSTR system, plotted with the matplotlib library in Python. p[-5] = 305 # the 5th item from the end of p is the manipulated input # Define initial state x0, xname = dymosimPy.initload(file) # Call the dymosim function quiet = 1 d = dymosimPy.dymosim(exp, x0, p, quiet, file) # Get simulation results for specific variables time = dymosimPy.dymget(d,’Time’) T = dymosimPy.dymget(d,’CSTR1.RRate.T’) # Plot results using the matplotlib library plot(time, T, ’k’) xlabel(’time [min]’) ylabel(’Reactor temperature T [K]’) show() Example 2 (Simulation of a nitrogen removal process) Now, we use the dymosimPy module to simulate the N-removal process presented in Paper E. Figure 2.11 shows the simulation result of the concentration of total nitrogen TN when the optimal aeration strategy is applied, i.e., 16 aeration cycles each day. This result is as same as the one we get in the Matlab simulation environment (see Figure 6 in Paper E). The Python program is given as follows: # Version 1.0, 2006-07-18 # Written by Qian Chai, Telemark University College 2.A. DYMOSIMPY — A PYTHON MODULE FOR DYMOLA-PYTHON INTERFACE 31 Figure 2.11: Time evolution of the concentration of TN with 16 aeration cycles each day. import dymosimPy from pylab import * import pydoc help(dymosimPy.dymosim) # general help # Define path and the name of Dymosim input file path = "D:\\Conference\\Tools\\Python_Dymola\\testSIMS06model\\" file = path + "dsin.txt" # Give user-defined input arguments step = 1.0/(60.0*24.0) exp = [0,1,step,0,1E-4,0,8] p, pname = dymosimPy.parload(file) dymosimPy.tnlist(pname) p[1] = 1.0/16.0 # define length of aeration cycle x0, xname = dymosimPy.initload(file) # Call the dymosim function d = dymosimPy.dymosim(exp, x0, p) # Get simulation results time = dymosimPy.dymget(d,’Time’) TNeff = dymosimPy.dymget(d,’eff_TN.TN’) # Plot plot(time, TNeff, ’k’) xlabel(’time [day]’) ylabel(’total nitrogen TN [g/m3]’) 32 CHAPTER 2. ASPS FOR WASTEWATER TREATMENT show() 2.A.5 Conclusions A Python module, named dymosimPy, is developed by the author to build up a convenient communication between Modelica/Dymola and Python. dymosimPy allows the user to simulate Modelica models and load simulation results in the Python environment. However, the functions included in the module are quite basic and limited. In order to carry out more advanced analysis (e.g. linearization, parameter estimation), additional useful functions should be supplemented to the dymosimPy module. Acknowledgement 3 The author would like to acknowledge the valuable suggestions from Dr. V. Siepmann of StatoilHydro, Porsgrunn, Norway on handling …les in Python. Chapter 3 State Estimation 3.1 Introduction This chapter provides an overview of some commonly applied techniques for state estimation of linear, nonlinear, and constrained systems. The following techniques are discussed: standard Kalman …lter (KF), extended Kalman …lter (EKF), unscented Kalman …lter (UKF), square-root unscented Kalman …lter (SRUKF), and moving horizon estimator (MHE). Because of the wide scope of the state estimation problem, the attention will be focused on systematic and exact presentation of algorithms in order to make implementation of the techniques more e¢ cient. The N-removal process described in subsection 2.2.2 is used as case study. To formulate state estimation as a mathematical problem, we consider a dynamic system of the general form xk = f (xk 1 ; uk 1 ; wk 1 ) yk = h (xk ; vk ) ; (3.1) (3.2) where xk 2 Rnx is the state, uk 2 Rnu is the control input, and yk 2 Rny is the controlled output. wk 2 Rnw and vk 2 Rnv represent the process noise and measurement noise, respectively. They are assumed to be zero-mean Gaussian noise processes wk vk N (0; Qk ) and N (0; Rk ) : f (xk 1 ; uk 1 ; wk 1 ) is the (possibly nonlinear) state transition function and h (xk ; vk ) is the (possibly nonlinear) measurement function. The state estimation problem is to determine an estimate of the state x^k given the chosen model structure and a sequence of noisy observations (measurements) fy0 ; : : : ; yk g. The standard KF is the algorithm of choice in state estimation for linear systems. Nonlinear …ltering is more di¢ cult and complex and there are still many research activities for advances and improvement in nonlinear estimation techniques. However, some nonlinear estimation methods have become widespread. In Simon (2006) an overview of the nonlinear estimation techniques, which include nonlinear extensions of the standard KF, unscented 33 34 CHAPTER 3. STATE ESTIMATION …ltering, and particle …ltering, has been given. The EKF is undoubtedly the most widely used nonlinear estimation technique that has been applied in the past few decades. Recently, new variants of the Kalman …lter which approximate the nonlinearity to a higher order have been proposed. Among them, the UKF and SRUKF generates a population of so-called sigma points based on the current mean and covariance of the state, and permits the direct propagation of the mean and covariance through the actual nonlinear system (Julier et al. 1995), (van der Merwe & Wan 2001). These variants of the Kalman …lter are described in a recursion similar in structure to the standard KF. All members of this family of …lters will comply with a structured sequence of 6 steps per iteration, as outlined in Plett (2006a): 1. State estimate time update. The …rst step is to compute a prediction x^kjk 1 of the current xk based on a priori information fy0 ; ; yk 1 g and the system model. 2. State error covariance time update. The second step is to calculate the predicted state estimate error covariance Pkjk 1 based on a priori information and the system model. 3. Estimate system output y^kjk 1 . The third step is to estimate the system output using the a priori state estimate and Equation 3.2. 4. Estimator gain matrix Kk . The fourth step is to determine the estimator gain matrix by evaluating Kk = Pxy;k Py;k1 , where Pxy represents the cross correlation matrix between x^kjk 1 and y^kjk 1 , and Py represents the innovation covariance. 5. State estimation measurement update. The …fth step is to compute the a posteriori state estimate by updating the a priori estimate using the estimator gain and the output prediction error yk y^kjk 1 , i.e., x^kjk = x^kjk 1 + Kk yk y^kjk 1 . 6. State error covariance measurement update. The …nal step computes the a posteriori state error covariance Pkjk . Figure 3.1 illustrates the concept of a state estimator using the Kalman …lter-based techniques. Although the aforementioned Kalman …lter-based techniques are widely used for estimating states of unconstrained systems subject to normally distributed state and measurement noises, many physical systems have states subject to hard constraints, such as non-negative concentrations or pressures. Hence, Kalman …ltering is no longer directly applicable. One solution for determining an optimal estimate is to formulate the estimation problem as the minimization of a weighted quadratic function of the unknown variables subject to the model equations. This formulation allows for the natural addition of inequality constraints. The basic form of the estimation problem is non-recursive, which is easily understandable, but the burden of computing the optimal estimates will become prohibitively large when more and more measurements become available. It is thus necessary to introduce some kind of approximation or simpli…cation in the estimation procedure. Based on the idea of repetitive optimal control as used in predictive control (Sunan et al. 2002), (Qin & Badgwell 2003), (Lie et al. 2005), moving horizon estimation is suggested as a practical approach to implement optimization-based estimation. 3.2. STATE ESTIMATION TECHNIQUES 35 Measured outputs Plant inputs Plant States x u k?1 Time update (Predictor) x! k|k?1 yk Measurement update (Corrector) Estimated states x! k|k State estimator Figure 3.1: Principle of state estimation. The design and application of state observers, also called software sensors 1 , in WWTPs has been an active area over the past decades. The approaches that are relevant to the …eld of WWTPs can be categorized into three groups: Classical observers (e.g. Kalman …lter) are based on the perfect knowledge of the system model and parameters. The EKF has been widely applied in wastewater engineering, e.g. Lindberg (1997), Boaventura et al. (2001), Keesman (2002), Lukasse, Keesman & van Straten (1999b). Asymptotic observers are used to make the model independent of the process kinetics (Perrier et al. 2000), (Dochain 2003). The asymptotic observer requires that the number of measurements is larger than or equal to the number of process reactions. Interval observers can be used for predicting intervals in which the unmeasured variable are guaranteed to belong, if bounds are known for the uncertain inputs and/or parameters (Hadj-Sadok & Gouzé 2001), (Alcaraz-González et al. 2002). 3.2 State estimation techniques 3.2.1 Observability and detectability Observability is a critical property of a system for observer design. An important consequence of the state observability is the ability to reconstruct the time evolution of the state variables from measured variables in an arbitrary …nite time from any initial conditions. In the following, it is assumed that the model is identical to the true system. 1 In the scienti…c literature, the expression of software sensors has largely been used for state and parameter estimation. In fact, a software sensor can be de…ned as an algorithm using state estimation techniques to reconstruct time evolution of the unmeasured states or unknown parameters on the basis of the knowledge of the process dynamics (the dynamic model) and on the (few) available on-line measurements (Dochain 2003). 36 CHAPTER 3. STATE ESTIMATION For simplicity, we shall consider the notion of observability for the linear time invariant system which is described as x k = F xk 1 yk = Hxk . Next we address concepts related to observability, with reference to Chen (1999), Rugh (1996), and Simon (2006). De…nition 4 (Observability) The discrete-time system or the pair (F; H) is said to be observable if for any unknown initial state x0 , there exists a …nite integer k > 0 such that knowledge of the input ui and output yi for all i 2 [0; k] su¢ ces to determine uniquely the initial state x0 . De…nition 5 (Detectability) The discrete-time system or the pair (F; H) is said to be detectable if there exists a matrix M such that xk = (F M H) xk 1 is exponentially stable. The pair (F; H) is detectable if the unobservable part in the observable canonical decomposition is stable, i.e., has eigenvalues either in the left half of the complex plane or inside the unit disk, depending on whether we are dealing with a continuous- or a discrete-time system. If the system is observable, then an observer gain can be found so that the estimated x^ converges to the true state x arbitrarily fast. If the system is detectable, then the convergence of the observer can be guaranteed but the dynamics of the observer can not be assigned arbitrarily. It is well known that the linear system is observable if and only if the observability matrix 0 1 H B HF C B C O=B C .. @ A . nx 1 HF has full column rank, i.e., rank (O) = nx . Another equivalent test for observability is the PBH test. Theorem 6 (PBH observability test) The pair (F; H) is observable if and only if rank has full rank at every eigenvalue H I F of F . For nonlinear systems, the observability analysis is rather complex, and some approaches are introduced in e.g. Sontag (1998), Kurtz & Henson (1998), Dochain & Chen (1992), Bogaerts & Wouwer (2004). 3.2. STATE ESTIMATION TECHNIQUES 3.2.2 37 The standard Kalman …lter (KF) We consider a system that can be represented with a linear time invariant model xk = F xk 1 + Buk yk = Hxk + Lvk : 1 + Gwk 1 Then, the algorithm of the standard KF for state estimation is presented in Table 3.1. Table 3.1: Algorithm of the standard Kalman …lter. Linear state-space model xk = F xk 1 + Buk 1 + Gwk 1 yk = Hxk + Lvk , where wk N (0; Qk ) and vk N (0; Rk ). Initialization: for k = 0, set x0 N x^0j0 ; P0j0 Computation: for k = 1; 2; : : :, compute State estimate time update x^kjk 1 = F x^k 1jk 1 + Buk 1 Error covariance time update Pkjk 1 = F Pk 1jk 1 F T + GQk 1 GT Output estimate y^kjk 1 = H x^kjk 1 1 Kalman gain Kk = Pkjk 1 H T HPkjk 1 H T + LRk LT State estimate meas. update x^kjk = x^kjk 1 + Kk yk y^kjk 1 T Error covariance meas. update Pkjk = (I Kk H) Pkjk 1 (I Kk H) + Kk LRk LT KkT 3.2.3 The extended Kalman …lter (EKF) The EKF linearizes the nonlinear system around the Kalman …lter estimate, and the Kalman …lter estimate is based on the linearized system. The nonlinear model is used for computation of state estimate time update x^kjk 1 and output estimate y^kjk 1 . To reduce the linearization error in the EKF for highly nonlinear systems, some re…ned linearization techniques such as the iterated EKF and the second-order EKF, have been described in Simon (2006) and Crassidis & Junkins (2004). The discrete-time EKF, which considers systems with discrete-time dynamics and discretetime measurements, is given in Table 3.2. However, in practice, many engineering systems are governed by continuous-time dynamics whereas the measurements are obtained at discrete instants of time. We therefore consider a hybrid system as follows dx = f (x; u; w) dt yk = h (xk ; vk ) w (t) N (0; Q) vk N (0; Rk ) : 38 CHAPTER 3. STATE ESTIMATION In steps 1 and 2 of the algorithm of the hybrid EKF, the state estimate and its covariance from time k 1 to time k are integrated as d^ x = f (^ x; u; 0) dt dP = F P + P F T + GQGT ; dt where F = @f @x and G = x ^;u;0 @f @w x ^;u;0 . We begin the integration process with x^ = x^k 1jk 1 and P = Pk 1jk 1 . At the end of the integration we have x^ = x^kjk 1 and P = Pkjk 1 . It should be noticed that the covariance matrix Q of the continuous-time process noise is not identical but related to the discrete-time process noise covariance Qk . An approximation of the relationship can be described in the form of: Qk = (tk+1 tk ) Q, see Grewal & Andrews (2001) and Crassidis & Junkins (2004). At each measurement time, we update the state estimate and the covariance as derived in the discrete-time EKF (steps 3–6). Table 3.2: Algorithm of the discrete-time extended Kalman …lter. Nonlinear state-space model xk = f (xk 1 ; uk 1 ; wk 1 ) yk = h (xk ; vk ), where wk N (0; Qk ) and vk N (0; Rk ). De…nition: Fk = @f @x x ^kjk ;uk ;0 ; Gk = @f @w x ^kjk ;uk ;0 ; Hk = @h @x x ^kjk 1 ;uk ;0 ; Lk = @h @v x ^kjk 1 ;uk ;0 Initialization: for k = 0, set x0 N x^0j0 ; P0j0 Computation: for k = 1; 2; : : :, compute State estimate time update x^kjk 1 = f x^k 1jk 1 ; uk 1 ; 0 Error covariance time update Pkjk 1 = Fk 1 Pk 1jk 1 FkT 1 + Gk 1 Qk 1 GTk 1 Output estimate y^kjk 1 = h x^kjk 1 ; 0 1 Estimator gain Kk = Pkjk 1 HkT Hk Pkjk 1 HkT + Lk Rk LTk State estimate meas. update x^kjk = x^kjk 1 + Kk yk y^kjk 1 T Error covariance meas. update Pkjk = (I Kk Hk ) Pkjk 1 (I Kk Hk ) + Kk Lk Rk LTk KkT 3.2.4 The unscented Kalman …lter (UKF) The UKF is an extension of the traditional Kalman …lter for the estimation of non-linear systems (Julier et al. 1995). Di¤erent from the EKF, the UKF approximates probability distributions by use of the unscented transform. The UKF uses the so-called sigma points and propagates all of them through the system model to numerically estimate the state and the output as well as their covariances. The weights of the sigma points for calculating mean and covariances are de…ned in Table 3.3. The formulations of the UKF is given in Table 3.4, where chol ( ) denotes Cholesky factorization of a matrix, diag ( ) denotes a block diagonal matrix constructed from input arguments, and Ai denotes column i of matrix A. See Julier & Uhlmann (2004), Wan & van der Merwe (2000), and VanDyke et al. (2004) for more details on the algorithm. A recent comparative study of the EKF and the UKF shows 3.2. STATE ESTIMATION TECHNIQUES 39 Table 3.3: Weighting constants of the UKF. p 0 m nx~ + nx~ + i m 2(nx~ + ) i c 0 c nx~ + + (1 2 + ) 2(nx~ + ) nx~ is the size of the augmented state x~kjk (de…ned in Table 3.4), i.e., nx~ = nx + nw + nv . = 2 (nx~ + ) nx~ is a scaling parameter (typically 2 [10 4 ; 1] and = 0). is used to incorporate prior knowledge of the distribution (with Gaussian distribution = 2). that the estimation performance of the UKF is better than the EKF in terms of robustness and speed of convergence, due to the increased time-update accuracy and the improved covariance accuracy of the UKF, see Kandepu et al. (2008). 3.2.5 The square-root unscented Kalman …lter (SRUKF) The unscented Kalman …lter may be used directly for state estimation, but a major drawback of the UKF is its vulnerability for numerical instability. In particular, the state estimation error covariance may lose its positive de…niteness in the update step of the UKF. To overcome this ‡aw, van der Merwe & Wan (2001) introduced the square-root unscented Kalman …lter (SRUKF). This approach has mainly two advantages: 1. The state covariances are guaranteed to be positive semi-de…nite because of the implementation. 2. Compared with the UKF, the SRUKF has an equal computational complexity for state estimation and a lower computational complexity for parameter estimation. Three important linear algebra techniques are used to implement the SRUKF (van der Merwe & Wan 2001), (Plett 2006b): QR decomposition. The QR decomposition algorithm computes two factors Q 2 RN N and R 2 RL N for a matrix A 2 RL N such that A = QR where Q is orthogonal, R is upper-triangular, and L N . An important property of the QR factorization is that R ~ 2 RL L is the upper is related to the Cholesky factor we wish to …nd. Speci…cally, if R ~ T is the Cholesky factor of P = AT A. That is, if R ~= triangular portion of R, then R T qr AT , where qr ( ) performs the QR decomposition and returns the upper-triangular ~ = chol AAT . Thus, the time update of state covariance can be portion of R, then R T p i x0:2nx~ x ^ calculated using a QR decomposition of the compound matrix kjk 1 c kjk 1 x ~ for i = 0; 1; : : : ; 2nx~ , where x0:2n kjk 1 denotes the propagated sigma points with index from 0 to 2nx~ . Cholesky downdating. To use the previous method, the Cholesky downdate, which is denoted as cholupdate ( ), is necessary since the weight 0c may be negative. In addition, the Cholesky downdate is used in the …nal step of the SRUKF. If Kk Sy is a matrix not a vector, downdating is consecutively done using each column of Kk Sy . 40 CHAPTER 3. STATE ESTIMATION Table 3.4: Algorithm of the unscented Kalman …lter. Nonlinear state-space model xk = f (xk 1 ; uk 1 ; wk 1 ) yk = h (xk ; vk ), where wk N (0; Qk ) and vk N (0; Rk ). De…nition: x~ikjk = xikjk T i ; wkjk T i ; vkjk T T Initialization: for k = 0, set x0 N x^0j0 ; P0j0 ; x~0j0 = [^ xT0j0 ; 0; 0]T ; P~0j0 = diag P0j0 ; Q0 ; R0 Computation: for k = 1; 2; : : :, compute h iT Sigma points calculation x ~k 1jk 1 = x^Tk 1jk 1 ; 01 nw ; 01 nv P~k 1jk 1 = diag Pk 1jk 1 ; Qk 1 ; Rk 1 x~0k 1jk 1 = x~k 1jk 1 x~i = x~k 1jk 1 + chol P~k 1jk k 1jk 1 x~ik 1jk 1 State time update xikjk Output estimate i ykjk Covariance time update Estimator gain State meas. update Covariance meas. update 1 = x~k = f xik 1jk 1 chol P~k i 1jk 1 ; uk 1 ; wk 1jk 1 1 1jk 1 ; i i nx~ i = 1; 2; : : : ; nx~ i = nx~ + 1; : : : ; 2nx~ i = 0; 1; : : : ; 2nx~ = h xikjk 1 ; vki 1jk 1 ; i = 0; 1; : : : ; 2nx~ P x~ i i x^kjk 1 = 2n i=0 m xkjk 1 P2n i y^kjk 1 = i=0x~ im ykjk 1 h ih iT P2nx~ i i Pkjk 1 = i=0 c xkjk 1 x^kjk 1 xikjk 1 x^kjk 1 ih iT P x~ i h i i Py;kjk 1 = 2n y y ^ y y ^ kjk 1 kjk 1 i=0 c kjk 1 kjk 1 ih iT P2nx~ i h i i Pxy;kjk 1 = i=0 c xkjk 1 x^kjk 1 ykjk y ^ kjk 1 1 1 Kk = Pxy;kjk 1 Py;kjk 1 x^kjk = x^kjk 1 + Kk yk y^kjk 1 Pkjk = Pkjk 1 Kk Py;kjk 1 KkT 1 3.2. STATE ESTIMATION TECHNIQUES 41 Back-substitution. The estimator gain is calculated more e¢ ciently via back-substitution which can be implemented with Matlab’s ’/’operator. In detail, the SRUKF algorithm for state estimation is described in Table 3.5. 3.2.6 Moving horizon estimator (MHE) Moving horizon estimation that is based on an optimization approach, is an e¢ cient method for state estimation of constrained systems. Rawlings & Bakshi (2006) provide a good review of the recent research on moving horizon estimation, with a focus on advantages and disadvantages of di¤erent estimation techniques. To address the computational e¢ ciency issues posed by MHE, Darby & Nikolaou (2007) introduces a parametric programming approach for the real-time implementation. Compared with other estimation techniques, MHE may provide the following advantages: The formulation of the optimization-based approach allows for the natural addition of inequality constraints on states, noise, and other variables. For nonlinear estimation, the optimization formulation is quite general and has the advantage of using full nonlinear models. MHE has the ‡exibility of incorporating a priori information including the state and noise as well as non-Gaussian variable distributions. Problem statement x is assumed to be initially normally distributed with expectation x^1j0 and covariance P1j0 , i.e., x1 N x^1j0 ; P1j0 . x^1j0 ; P1j0 , Qk , and Rk are assumed to be known2 . It is assumed that we know the following information Ik of the system at the time step k: Ik = x^1j0 ; y1 ; : : : ; yk ; u1 ; : : : ; uk ; where k is the current time (initial value of k is 1). The state estimation problem can be stated as: Given the “guess” of the initial estimate x1 N x^1j0 ; P1j0 and all of the information up to the current time k contained in the measurement sequence fy0 ; : : : ; yk g, obtain the best estimate of the initial state x^1jk and the entire state trajectory x^1jk ; : : : ; x^kjk subject to the process model. 2 This initial state is di¤erent from the previous …lters. x ^1j0 and P1j0 can be obtained from x ^0j0 and P0j0 using the standard EK (or EKF) time update steps. 42 CHAPTER 3. STATE ESTIMATION Table 3.5: Algorithm of the square-root unscented Kalman …lter. Nonlinear state-space model xk = f (xk 1 ; uk 1 ; wk 1 ) yk = h (xk ; vk ), where wk N (0; Qk ) and vk N (0; Rk ). De…nition: x~ikjk = xikjk T i wkjk ; T ; i vkjk T T Initialization: for k = 0, set x0 N x^0j0 ; P0j0 x~0j0 = [^ xT0j0 ; 0; 0]T ; S~0j0 = diag chol P0j0 ; chol (Q0 ) ; chol (R0 ) Computation: for k = 1; 2; : : :, compute h iT Sigma points calculation x ~k 1jk 1 = x^Tk 1jk 1 ; 01 nw ; 01 nv S~k 1jk 1 = diag Sk 1jk 1 ; chol (Qk 1 ) ; chol (Rk 1 ) x~0k 1jk 1 = x~k 1jk 1 x~i = x~k 1jk 1 + S~k 1jk 1 ; i = 1; 2; : : : ; nx~ k 1jk 1 x~ik 1jk 1 i = x~k 1jk 1 ; i = nx~ + 1; nx~ + 2 : : : ; 2nx~ i nx~ State time update xikjk Output estimate = h xikjk 1 ; vki 1jk 1 ; i = 0; 1; : : : ; 2nx~ P x~ i i x^kjk 1 = 2n i=0 m xkjk 1 P2n i y^kjk 1 = i=0x~ im ykjk 1 T T p 1 x1:2nx~ Skjk 1 = qr x ^ kjk 1 c kjk 1 p Skjk 1 = cholupdate Skjk 1 ; j 0c j x0kjk 1 x^kjk 1 ; sign ( 0c ) T T p 1 y 1:2nx~ Sy;kjk 1 = qr y ^ kjk 1 c kjk 1 p 0 Sy;kjk 1 = cholupdate Sy;kjk 1 ; j 0c j ykjk y^kjk 1 ; sign ( 0c ) 1 h i h iT P2L i i i Pxy;kjk 1 = i=0 c xkjk 1 x^kjk 1 ykjk 1 y^kjk 1 Covariance time update Estimator gain i ykjk 1 = f xik S~k 1jk 1 i 1jk 1 ; uk 1 ; wk 1jk 1 i = 0; 1; : : : ; 2nx~ 1 T Kk = Pxy;kjk 1 =Sy;kjk State meas. update Covariance meas. update ; 1 =Sy;kjk 1 x^kjk = x^kjk 1 + Kk yk y^kjk 1 Skjk = cholupdate Skjk 1 ; Kk Sy;kjk 1 ; 1 3.2. STATE ESTIMATION TECHNIQUES 43 Full information estimation In the full information estimation, an estimate of the states can be found by selecting the set f^ x1 ; : : : ; x^k g that maximizes the probability density function p (x1 ; : : : ; xk jy1 ; : : : ; yk ) i.e., with mathematical notation f^ x1 ; : : : ; x^k g = arg max p (x1 ; : : : ; xk jy1 ; : : : ; yk ) : x1 ;:::;xk According to Bayes’rule, the maximum likelihood optimization is solved, and the solution can be posed as the following least squares problem 1 min x1 x1 ;:::;xk 2 1X T i 1X T i + v i MR v i + w M wi 2 i=1 2 i=1 i Q k x^1j0 T MP1 x1 x^1j0 k 1 (3.3) subject to xk = f (xk 1 ; uk 1 ; wk 1 ) yk = h (xk ; vk ) where the weighting matrices are usually chosen as MP1 = P1j01 , MRi = Ri 1 , MQi = Qi 1 and P1j0 , Ri , and Qi are the covariance matrices which re‡ect the con…dence in the initial state estimate, the measurement noise, and the process noise, respectively. Weighting factors MRi and MQi might change with time. Here, we assume they are constants MR and MQ . We refer to this problem as the full information estimator, because we consider all of the available measurements. Moving horizon estimation As the number of measurements grows, the size of the unknown variables increases without bound. In practice, the objective function of the least squares problem at time k can be modi…ed to xk min N ;:::;xk 1 (xk 2 N x^k T N) MPk N (xk N k k 1 1 X T i 1 X T i x^k N ) + v M vi + w M wi ; 2 i=k N i R 2 i=k N i Q subject to xk = f (xk 1 ; uk 1 ; wk 1 ) yk = h (xk ; vk ) ; where N is a constant interval. This optimization problem is therefore called a moving horizon optimal estimation. When the number of available measurements is less than the optimization horizon N , one may use an increasing window length until N measurements 44 CHAPTER 3. STATE ESTIMATION are available. Alternatively, when the problem is unconstrained, e.g., an extended Kalman …lter may be used to give optimal estimates in the initial phase. For MHE, one interesting problem is then how to update x^k N and MPk N . Here, we consider unconstrained systems. In the linear case, the least squares estimation (regardless of horizon size) is equivalent to the standard Kalman …lter under certain choices of the weighting matrices. In the nonlinear case, updating of the weighting matrix MPk N is more complicated than the linear case; and the following methods to update MPk N have been discussed in the literature (Robertson & Lee 1995): 1. Assume that xk N is uniformly distributed over some interval. Then, MPk constraints are used to bound the range of xk N . N = 0 and 2. Assume that the error distribution of the estimates remains approximately constant and MPk N is a …xed weighting matrix. 3. Another possibility is based on the probabilistic interpretation of x^k N jk N 1 and 1 MPk N as the conditional mean and covariance of xk N . Any of the approximate nonlinear …ltering techniques which are based on the propagation of the conditional mean and covariance (e.g. EKF) can be used. In this case, the moving estimator with a horizon size of one (N = 1) will be equivalent to the EKF. However, when N > 1, Haseltine & Rawlings (2005) show that MHE is more robust to poor guesses of the initial state in comparison to the EKF, because it …ts the data in the horizon and uses the full nonlinear model. Constrained state estimation In practice, we may need to constrain the range of variables representing physical quantities. This gives the least squares estimates that are within the speci…ed bounds, which may not be the case for Kalman …lter-based methods. We assume that the state, process noise, and measurement noise satisfy the following constraints x` v` w` xi vi wi xu for k N i k v u for k N i k wu for k N i k 1 where the superscript ` and u stand for the lower bound and the upper bound, respectively. Of course, more complicated constraint formulations are possible. MHE for nonlinear estimation The MHE problem is usually formulated as the following optimization problem xk min N ;:::;xk 1 (xk 2 N x^k T N) MPk N (xk N k k 1 1 X T i 1 X T i x^k N ) + v M vi + w M wi 2 i=k N i R 2 i=k N i Q (3.4) 3.3. STATE ESTIMATION OF THE N-REMOVAL PROCESS 45 subject to xk = f (xk 1 ; uk 1 ; wk 1 ) yk = h (xk ; vk ) x` xi xu v` vi v u w` wi wu : Since the nonlinear state estimation technique is dual to the nonlinear MPC techniques, various discretization strategies and solution procedures used in nonlinear MPC are directly applicable to nonlinear estimation as well (Robertson & Lee 1995). In some cases, solving the described full nonlinear optimization problem may be time-consuming and unable to …nd the global minimum of the criterion. Therefore, a simple suboptimal approximation to the optimal solution of the nonlinear estimation problem described in Equation 3.4 is often applied, see Russell et al. (2000). The approach is to approximate the sequential solution of Equation 3.4 by a succession of linear least squares problems that can be easily solved by the standard quadratic programming (QP) solvers. Appendix 3.A presents the QP formulation for solving linear estimation problems. 3.3 State estimation of the N-removal process This section presents state estimation of the N-removal process by simulation studies. The objective is to compare performances of the EKF, UKF, SRUKF, and MHE for the nonlinear biological WWTP, where the exact models and the statistical information of the stochastic noises, are available to the …lters. In Paper C, the standard KF, EKF, and UKF are presented for state estimation of this process. Since the simulation results show that the prediction of the state with the standard KF is poor due to the high nonlinearity of the process, only the nonlinear estimation techniques are focused on in this section. 3.3.1 Performance indices To analyze the performance of the …lters, the prediction accuracies Vy and Vx are de…ned by the following RMSE (root mean square error) performance criteria Vy = Vx = s r 1 N ny 1 N nx (y N y^N )T (y N y^N ) (xN x^N )T (xN x^N ) 46 CHAPTER 3. STATE ESTIMATION Control input: oxygen transfer coefficient KLa 60 55 50 [d-1] 45 40 35 30 25 20 0 0.5 1 1.5 Time [d] 2 2.5 3 Figure 3.2: Control input for the N-removal process. where N is the prediction horizon and we de…ne the output sequence y N , the estimated output sequence y^N , the state sequence xN , and the estimated state sequence x^N as yN , T ; : : : ; y1T yN T y^N , T ; : : : ; y^1T y^N T xN , xTN ; : : : ; xT1 T x^N , x^TN ; : : : ; x^T1 T ; respectively. The criterion Vx can only be evaluated for simulation studies when the true state sequence xN is known. 3.3.2 Results and discussions Figures 3.2 and 3.3 show the control input and the simulated output variables used to drive the nonlinear state estimation …lters. To compare the di¤erent estimation approaches, the tuning parameters for the EKF, the UKF, and the SRUKF are chosen identical. Three groups of simulations are carried out with same process noise covariances but di¤erent measurement noise covariances given as follows: Qk = diag x2o 10 6 and 8 < diag (yo2 10 8 ) ; in Test I diag (yo2 10 6 ) ; in Test II , Rk = : diag (yo2 10 4 ) ; in Test III where (xo ; yo ) is the operating point. For the UKF and SRUKF, the parameter is also an important tuning parameter, which determines the spread of the sigma points around the current estimate. Here, is chosen to be 1 10 2 which is also used in Paper E. 3.3. STATE ESTIMATION OF THE N-REMOVAL PROCESS 47 Output 1: total nitrogen TN [mg/l] 12 10 8 6 0 0.5 1 1.5 2 2.5 3 2.5 3 Output 2: disolved oxygen SO2 [mg/l] 0.6 0.4 0.2 0 0 0.5 1 1.5 Time [d] 2 Figure 3.3: Simulated output variables for the N-removal process. With the increase of the measurement noise covariance, the UKF generates negative state estimates. Thus, a constrained Kalman …ltering technique described in Simon & Simon (2003) is applied to project the unconstrained state estimate x^ onto the constraint surface. That is, if we have the constraints Bx b, then the constrained estimate can be obtained by solving the problem x^con = arg min (^ xcon x ^con x^)T W (^ xcon x^) such that B^ xcon b; where W is a symmetric positive de…nite weighting matrix and W is set W = I in this work. This inequality constrained problem can be formulated with a QP problem described in 3.A.2 and solved by the QP function in Matlab. The approach of incorporating state constraints into the UKF by projecting the sigma points which are outside the feasible region onto the constraint surface, is also described in Kandepu et al. (2008). For comparison, the root squared errors (RSEs)3 of the states in Test I are shown in Figures 3.4–3.7, where four states that most clearly exhibit the di¤erence of the nonlinear …lters are chosen. With the UKF, the estimation results are quite noisy because of the numerical instability of the UKF. Due to the improved numerical properties, the SRUKF is more robust than the UKF. To give an overview of the …lter performance, the estimation results of the various …lters are summarized in Table 3.6. All computations are performed on a 1:7 GHz Pentium M computer with 1 Gbyte RAM. Table 3.7 shows that the discrete-time EKF is the fastest …lter. For instance, the discrete-time EKF requires about 38% of the computational burden of the unscented …lters, because the calculation of the predictive sigma points in the unscented …lters is time-consuming. q The root squared error (RSE) of the state x at time t is de…ned as: RSEt = (xt the actual value at time t and x ^t is the estimated value at time t. 3 2 x ^t ) , where xt is 48 CHAPTER 3. STATE ESTIMATION 0.04 discrete-time EKF hybrid EKF 0.035 UKF SRUKF 0.03 SS [mg/l] 0.025 0.02 0.015 0.01 0.005 0 0 0.5 1 1.5 2 2.5 3 Time [days] Figure 3.4: Comparison of the estimation error of the concentration of SS in Test I. 0.7 discrete-time EKF hybrid EKF 0.6 UKF SRUKF SNH4 [mg/l] 0.5 0.4 0.3 0.2 0.1 0 0 0.5 1 1.5 2 2.5 3 Time [days] Figure 3.5: Comparison of the estimation error of the concentration of SNH4 in Test I. 3.3. STATE ESTIMATION OF THE N-REMOVAL PROCESS 49 9 discrete-time EKF hybrid EKF UKF SRUKF 8 7 X STO [mg/l] 6 5 4 3 2 1 0 0 0.5 1 1.5 2 2.5 3 Time [days] Figure 3.6: Comparison of the estimation error of the concentration of XSTO in Test I. Figure 3.7: Comparison of the estimation error of the concentration of XA in Test I. 50 CHAPTER 3. STATE ESTIMATION Table 3.6: Performance results of the nonlinear estimation …lters. Method Vy Vx 4 Test I Discrete-time EKF 5:3230 10 1:7368 4 Hybrid EKF 5:3188 10 1:7300 UKF 7:5458 10 4 0:9411 SRUKF 1:7526 10 3 0:3867 MHE (…lter horizon N = 1) 5:3230 10 4 1:7368 Test II Discrete-time EKF 6:9217 10 3 1:7300 Hybrid EKF 6:8751 10 3 1:7230 UKF 5:7945 10 3 1:3613 SRUKF 6:3563 10 3 0:4759 Test III Discrete-time EKF 9:4400 10 2 1:4257 Hybrid EKF 9:4278 10 2 1:4204 UKF(constrained) 1:6680 10 2 2:5377 SRUKF 8:2867 10 2 0:6227 Table 3.7: CPU time for the nonlinear estimation …lters. Discrete-time EKF Hybrid EKF UKF SRUKF MHE CPU time 25 min 34 min 60 min 62 min 28 min In Table 3.6, the di¤erence between the real measurement and the predicted measurement, the criterion V1 , is quite small. Therefore, the estimation error of the state, the criterion V2 , is mainly considered for the comparison of the …lters. The performance results demonstrate that the SRUKF produces the lowest estimation error for all the tests. The UKF is better than the extended Kalman …lters in reducing the estimation errors in Tests I and II, whereas the performance of the UKF becomes poor when taking state constraints into account (see Test III). In fact, to handle state constraints, the MHE estimator is more straightforward and generally preferred. In this work, a horizon size of 1 is used for the MHE with the update of the initial state estimate and the covariance based a …rst-order Taylor expansion (as in the discrete-time EKF). In this case, the MHE produces the identical performance as the discrete-time EKF. For this reason, the MHE result only appears in Test I. Also, the comparison in Table 3.6 shows that the hybrid EKF provides slightly smaller estimation errors than the discrete-time EKF due to the more accurate time updates of the state estimate and the covariance, but the hybrid EKF takes the more CPU time. 3.A. OPTIMIZATION-BASED ESTIMATION FORMULATED AS QP PROBLEM 3.A 51 Optimization-based estimation formulated as QP problem 3.A.1 The optimization-based estimation problem A linear system, approximated in discrete time is given as xk = F xk 1 + Buk yk = Hxk + Lvk : 1 + Gwk (3.5) (3.6) 1 We still assume that the known information Ik = x^1j0 ; y1 ; : : : ; yk ; u1 ; : : : ; uk . Here, we T will introduce the notations for the measurement sequence y k , ykT ; : : : ; y1T , and the T input sequence uk , uTk ; : : : ; uT1 . The estimation problem is then de…ned as 1X T i 1X T i + v i MR v i + w M wi 2 i=1 2 i=1 i Q k 1 x1 min x1 ;:::;xk 2 x^1j0 T MP1 x1 x^1j0 subject to xk = F xk 1 + Buk yk = Hxk + Lvk x` xi xu v` vi v u w` wi wu : 3.A.2 1 k 1 + Gwk (3.7) 1 Standard QP problem This optimization problem can be posed as a quadratic programming (QP) problem of the form min F ( ) = min k s.t. A B k k T kH k = a b k k ` u k The unknown variable 1 2 : is de…ned as k 0 1 xk , @ vk A wk 1 + gT k (3.8) 52 CHAPTER 3. STATE ESTIMATION where xk , xTk ; : : : ; xT1 T vk , vkT ; : : : ; v1T T wk , 1 T wkT 1 ; : : : ; w1T : xk 2 Rnx k 1 ; v k 2 Rnv k 1 ; and wk 1 2 Rnw (k 1) 1 . Matrix H and vector g of Equation 3.8 are determined from the requirement that Jt of Equation 3.7 should equal F ( ) in Equation 3.8. The equality condition A k = a contains the model in Equations 3.5 and 3.6. For the optimization problem de…ned here, inequality B k b is empty, while constrains are ` u contained in and . Thus, the following matrices result ( denotes Kronecker product): H = diag 0nx (k 1) ; MP1 ; Ik MR ; I(k 0 1 0nx (k 1) 1 A; MP1 x^1j0 g = @ 0(k nv +(k 1) nw ) 1 A = a = I(k 1) k I(k 1) Ik Inx yk B H I(k uk 1 1) (3.10) Ik F 0(k 1) k;1 (3.9) MQ ; L 1) nx k nv 0k ny I(k (k 1) nw 1) G ; (3.11) (3.12) : Next, the bounds are given as ` = Ik nx 1 x` ; Ik nv 1 v ` ; I(k u = Ik nx 1 xu ; Ik nv 1 v u ; I(k 1) nw 1 1) nw 1 w` wu T T : To solve the QP problem, the QP solver quadprog of the Optimization Toolbox in Matlab can be used. The solution is in the form of the estimates k T T = x^Tkjk ; : : : ; x^T1jk ; v^kjk ; : : : ; v^1jk ; w^kT T T ^1jk 1jk ; : : : ; w : Chapter 4 Parameter Estimation 4.1 Introduction The ASM models provide a standardized set of basis models with nominal parameter values suggested in publications. However, the various plant operation, in‡uent, and sludge characteristics of full-scale WWTPs require some of the model parameters to be adjusted in order to ensure good predictive capability of the model. In practice, the parameter estimation of the activated sludge plant models are characterized by the following features: The ASM models have many parameters, as compared to the number of available measurements, which makes parameters non-identi…able or poorly identi…able. The outputs are insensitive to the variation of many (possibly nonlinear) combinations of parameters. The numerical algorithms that perform the nonlinear parameter estimation su¤er from convergence problems with large numbers of parameters, due to many local optima. Gathering good experimental data from the full-scale plant is di¢ cult, mainly because of lack of cheap and reliable sensors and techniques for measurement. Clearly, the quality of parameter estimation is directly related to the practical identi…ability of parameters, which refers to the ability to obtain accurate parameter estimates from available experimental data. Therefore, the key question of the identi…ability analysis is de…ned by Dochain et al. (1995) as follows: Assume that a certain number of the state variables are available for measurement; on the basis of the type and quality of available data, can we expect to give a unique value to the model parameters via parameter estimation? The identi…ability analysis performed prior to the parameter estimation can provide answers to the key question. Parameter identi…ability analysis of activated sludge process models has been studied in e.g. Vanrolleghem et al. (1995), Weijers & Vanrolleghem (1997), Lukasse et al. (1997), Brouwer et al. (1997). A good overview of identi…ability of ASM1 53 54 CHAPTER 4. PARAMETER ESTIMATION kinetic parameters and experimental designs is given in Petersen (2000). Recently, a more systematic approach to parameter identi…ability is introduced by Brun et al. (2001) and Brun et al. (2002), with applications in large environmental models and in an ASM2d model. As regards parameter estimation of ASPs, estimation of kinetic parameters has been discussed in Papers A and B using the least square estimation technique. In addition, biological WWTPs are usually subject to large variations in both the in‡uent pollutant concentrations and ‡ow rates, which can strongly a¤ect the operating conditions of the process. However, the large diversity and complexity of the components presented in the process (including biomass) makes it di¢ cult to implement sensors at the entrance of the treatment plant. As a consequence, model-based estimators are applied in WWTPs to estimate the unmeasured input variables (i.e., disturbances from the process control point of view). Some disturbance estimation techniques are introduced in Darouach et al. (1995), Pina & Botto (2006), and Ha & Trinh (2004). In biological process applications, Aubrun et al. (2001) and Theilliol et al. (2003) propose to use the Kalman …lter-based methods to estimate the input at the entrance of anaerobic wastewater treatment processes. In fact, disturbances can be considered as time-varying parameters, and parameter estimation techniques could be applicable to disturbance estimation. Therefore, disturbance estimation is discussed in this chapter in conjunction with parameter estimation. The present chapter describes parameter estimation techniques for ASPs, with particular application to the Duvbacken P-removal plant. Section 4.2 describes the theoretical background and the procedure for parameter identi…ability analysis. Estimation of kinetic parameters in the Duvbacken model and model validation is presented in section 4.3. State and disturbance estimation using the Kalman …lter technique is discussed in section 4.4. In this chapter, the description of parameter identi…ability follows the presentation given in Paper A and the Kalman …lter-based algorithm uses the uniform notation as in chapter 3. 4.2 4.2.1 Parameter identi…ability analysis Theoretical background Least squares estimation A relatively standard method for model …tting is to select the model parameters such that the least squares criterion de…ned as 1X (yt J= 2 t=1 2 Rn T ytm )T (yt ytm ) is minimized, where yt 2 Rny is the output observed from the real plant at time t, ytm 2 Rny is the model output at time t, while T is the number of available observations. That is, based on experimental data (output yt and control input ut , t 2 f1; : : : ; T g), the best parameter estimate ^ is sought in the sense that the model output ytm ^ resembles the real output yt as well as possible. The theoretical background of parameter identi…ability analysis has also been discussed in Paper A. 4.2. PARAMETER IDENTIFIABILITY ANALYSIS 55 Sensitivity and collinearity We introduce the notation 1 0 y1 B C y = @ ... A ; yT 0 1 y1m B C y m = @ ... A yTm 0 1 u1 B C u = @ ... A ; uT 0 1 e1 B C e = @ ... A , eT where et is the observation error yt ytm ; hence y; y m ; e 2 RT ny 1 , and u 2 RT nu 1 . Clearly, model prediction ytm depends on the chosen parameter values. This dependence is quanti…ed by the sensitive row vector s~Tt at time t, de…ned as s~Tt = @ytm = @ @ytm @ 1 @ytm @ n 2 Rny n . We can then build the sensitivity matrix S as 0 1 s~T1 B C S = @ ... A = s~TT s1 sn 2 RT ny n ; i @J @ = i i 1 @y1m @ j @y m B =B @ @ j sj = Assume that we have some a priori estimate/idea criterion J can be minimized by using Newton iteration: @2J @ 2 0 C C 2 RT ny A .. . m @yT @ j of the true value 1 . of . The , i where @J @ @2J @ 2 ny T X X = t=1 i=1 ny T m X X @yt;i = i=1 t=1 m yt;i yt;i m @yt;i @ m @yt;i @ ! = T XX @ t=1 i=1 ny T ny T X X m @yt;i et;i @ ! m @ 2 yt;i et;i 2 . i=1 t=1 @ If is close to the correct parameter , it is common to assume that et will be close to zero on the average and hence use the Gauss-Newton approximation ny T m X X @yt;i i=1 t=1 @ m @yt;i @ ny T X X T et;i i=1 t=1 m @ 2 yt;i @ 2 . Thus, the Newton iterator is reduced to the expression ny T m X X @yt;i i=1 t=1 @ m @yt;i @ T i i = ny T X X i=1 t=1 m @yt;i et;i @ ! , i 56 CHAPTER 4. PARAMETER ESTIMATION and we seek the value ^ such that the equality holds ny T m X X @yt;i i=1 t=1 @ m @yt;i @ T ^ i = ny T X X t=1 i=1 i m @yt;i et;i @ ! i or ST S i ^ = ST e i , (4.1) i where ^ , ^ . Clearly, matrix S must have full column rank r , rank S = n in order to have a unique solution for Equation 4.1. In the simplest case, this requirement fails if sj 0, i.e., output y m is insensitive to parameter j under the given experimental conditions. Furthermore, if ksj k is “small”, y m is weakly sensitive to j , indicating that in practice ^j can not be found. Even when no columns of S are zero, there may be problems with linear dependence among the columns of S. Such a linear dependence is denoted collinearity, and one measure of nearness-to-collinearity in S is the smallest singular value min (S). Since min (S) is an absolute measure of nearness, it is di¢ cult to interpret. To avoid this problem of interpretation, one can either scale S before computing min (S), or else scale min (S) afterwards (Stewart 1987). In the …rst strategy, one possible scaling strategy is to normalize every column in S. For the second strategy, it has become standard practice in linear algebra to scale min (S) by the largest singular value max (S), and present the inverse: this is the condition number (S), which is max (S) (S) = . min (S) In the sequel, a procedure for parameter identi…ability and estimation will be introduced, with special emphasis on two identi…ability measures: sensitivity measure and collinearity index. The …rst is designed to assess individual parameter importance in a least squares parameter estimation context, and the second accounts for the degree of collinearity among parameters for various parameter subset. 4.2.2 Procedure for selecting identi…able parameters As mentioned in section 4.1, calibration of ASM models may be a challenging tasks. ASM models are most often highly complex, and they are usually high-order nonlinear systems incorporating a large number of parameters. In addition, models usually are overparameterized or have poorly identi…able parameters with respect to the available experimental data. Parameter estimation of ASM models is therefore addressed by ad hoc selecting and tuning approaches. The identi…ability procedure described in Brun et al. (2002) seems well suited to WWTPs, since it handles large simulation models and provides systematic selection and tuning of parameter subsets, see also Brun et al. (2001), Dueñas Díez et al. (2006). The approach of Brun and co-workers is rooted in basic linear algebra and least squares parameter estimation, as discussed above. Also, for automated analysis of sensitivity of a large number of parameters, Lund & Foss (2008) present an easily implemented method on parameter ranking by successive orthogonalization, which may be of interest for on-line estimation. 4.2. PARAMETER IDENTIFIABILITY ANALYSIS 57 Figure 4.1 illustrates the general steps in the procedure for parameter identi…ability analysis and estimation. The procedure is composed of three main stages: experiments, identi…ability analysis, and estimation and validation. Here, we give a brief discussion of each of the steps, and more details of the approach can be found in Dueñas Díez (2004) and Dueñas Díez et al. (2006). 1. Experimental design. Designing experiments which provide as much information as possible to determine and estimate the regarded parameters usually reward us with good parameter estimates. 2. Experimental campaign. 3. Prior analysis. Scaling of outputs and parameters is essential. For the numerical analysis to make sense, the quantities should be dimensionless. Thus, it is recommended to use dimensionless, scaled quantities y~t;j = yt;j ; yj ~j = j j where yj is a scale factor with the same physical dimension as yt;j , typically indicating the variation in yt;j or a nominal value, while j is a scale factor with the same physical dimension as j , typically indicating the uncertainty in j . In the sequel, scaling parameters and outputs as part of the preprocessing of the data is highly recommended. 4. Calculate model output. Identi…ability analysis as discussed in this approach requires only simulated model output. 5. Compute sensitivity. Based on the de…nition of sensitivities in 4.2.1, the column sj of the scaled sensitivity matrix S is computed as sj scj ym 0 + ej j ym 0 , j where scj is the proper scaling factor and j is the perturbation value of j . y m 0 and y m 0 + ej j represent the nominal output and the perturbed output, respectively, while ej is column j of the identity matrix I 2 Rn n . 6. Parameter importance ranking. With Equation 4.1, the …rst step is to consider whether the model output is insensitive to any of the parameters, i.e. to compare ksj k for the various parameters j . Brun et al. (2001) propose to scale ksj k by the square-root of the amount of data ny T and introduce the sensitivity measure msqr de…ned as j msqr j 1 ksj k2 , ny T ,p instead of using ksj k2 directly; they also consider other norms ksj k. The strategy is then to sort the various parameters according to the value of msqr . A high value of j msqr means that a change in the parameter j has an important in‡uence on the model j output. 58 CHAPTER 4. PARAMETER ESTIMATION Stage I. Experiments 1. Experimental design 2. Experimental campaign Experimental data Stage II. Identifiability analysis 3. Prior analysis Parameter initial values, range & scale factors Basic simulation 4. Calculate model output 5. Compute sensitivities 6. Parameter importance ranking 7. Assess identifiability of parameter subsets 8. Choose parameter subsets Stage III. Estimation & validation 9. Perform parameter estimation Experimental data Measure of model fit Optimization algorithm 10. Statistical analysis of parameter estimates Figure 4.1: Procedure for parameter identi…ability analysis and estimation. Taken from Dueñas Díez et al. (2006). 4.3. ESTIMATION OF KINETIC PARAMETERS IN THE DUVBACKEN MODEL 59 7. Assess identi…ability of parameter subsets. In considering Equation 4.1, the next step is to look for collinearity. Brun et al. (2001) de…nes a collinearity index K as K 1 , min S~K =r 1 min , T ~ S~K SK where S~K is a T ny K submatrix of S~ containing those columns that correspond to the K parameter subset of . S~ is a slightly modi…ed sensitivity matrix where the columns have been normalized as noted above, and min S~K is the smallest singular value of S~K . A high value of K indicates that the parameter subset K is poorly identi…able even if the individual parameters of K are among the top parameters of the parameter importance ranking. 8. Choose parameter subsets. An identi…able parameter subset is chosen based on the numerical analysis described in steps 3–8. 9. Perform parameter estimation. At this step, the measured data from the real plant are used. Various estimation techniques can be applied, e.g. weighted least squares estimation, maximum likelihood estimation, the Kalman …lter, moving horizon estimation, asymptotic observers, etc., (Crassidis & Junkins 2004), (Gelb 1992), (Lewis 1986), (Dochain & Vanrolleghem 2001). 10. Statistical analysis of parameter estimates. Finally, a statistical analysis should be carried out to analyze the uncertainties of the estimates, and to evaluate the quality of the …tting. 4.3 Estimation of kinetic parameters in the Duvbacken model 4.3.1 Parameter identi…ability and estimation Identi…ability analysis and estimation of the kinetic parameters for the Duvbacken plant are discussed in the Papers A and B. The online measurements of the Duvbacken plant are taken in the period of October 24–29, 2005. The in‡uent characteristics and on-line and o¤-line measurements are given in Paper A. The methodology presented in subsection 4.2.2 is applied to the Duvbacken model, and two studies are carried out: As an initial study before doing parameter estimation based on real data from the plant, we check whether suitable estimates can be obtained based on simulation data with known true parameter values, see Paper A. The model validation result shows that the model …t is satisfactory, especially for those outputs which are important to the plant operation (e.g. SPO4 and TP). However, in that study, the model implementation in Matlab is restrictive with respect to possible input signals, and components of the model are di¢ cult to modify and reuse. 60 CHAPTER 4. PARAMETER ESTIMATION The model is thus rewritten in the more ‡exible modeling language Modelica, as described in section 2.4. The procedure shown in Figure 4.1 is used to analyze the identi…ability again, but this time we use the same in‡uent ‡owrate as in the real plant. Eventually, the selected parameter subset is estimated from real data, see Paper B. Comparing the identi…able parameter subsets obtained in the studies, it can be seen that most parameters in the optimally identi…able parameter set are the same. This con…rms that these parameters are indeed identi…able. Based on the identi…ability analysis, nonlinear least squares estimation is used, with the following optimization criterion ^ = arg min J = arg min 1 eT W e. 2 (4.2) Here, the computation of the model output ytm in the criterion J is based on ballistic simulation, i.e., using multiple-step-ahead prediction errors. This is in contrast to applying recursive estimation techniques (e.g. the Kalman …lter-based approaches), which minimize the one-step-ahead prediction error. To solve the optimization problem, two di¤erent algorithms are applied considering convergence speed of optimization. The Finkel-Kelley Direct optimization algorithm is proven to be more robust but slower than Matlab’s lsqnonlin algorithm. 4.3.2 Model validation Once parameter estimation has been carried out, the model with the estimated parameters should be tested on a new set of experimental data. The measurements taken from the Duvbacken plant over the period of October 17–24, 2005 are used for model validation, with a periodically varying ‡owrate shown in Figure 4.2. A sudden increase of the feed ‡owrate (as well as COD loadings) occurs at the last day, while the oxygen supply to the process is insu¢ cient. This results in the dramatic increasing of the phosphate concentrations, see the solid lines in the last two subplots of Figure 4.3. The simulation results in Figure 4.3 show that the model with the estimated parameters (dashed line) captures the large variations in SPO4 and Ptot , whereas the model with the nominal parameters (dotted line) gives poor prediction. This indicates again the conclusion obtained in the papers: the resulting model gives good prediction of the measurements related to phosphorus. 4.3.3 Con…dence interval of parameter estimates Once the model is …tted to experimental data, we need to …nd out how accurate we have estimated the parameters and conclude whether this accuracy is su¢ cient for our purpose. Typically, the con…dence interval of the parameter estimates are used for assessing the accuracy. A con…dence interval can be obtained by using the relation (Rawlings & Ekerdt 2002): ^ T Hj =^ ^ 2s2 np F (np ; nd np ; ) 4.3. ESTIMATION OF KINETIC PARAMETERS IN THE DUVBACKEN MODEL Feed flow rate Qin [m3/d] 7 x 10 61 4 6 5 4 3 2 1 0 1 2 3 4 Time [days] 5 6 7 SNO3 [mg/l] in return sludge Figure 4.2: Measured ‡owrate of the process feed in the period of October 17–24, 2005. 8 6 4 2 00 1 2 3 4 5 6 1 2 3 4 5 6 00 1 2 3 4 5 6 0.5 0.4 0.3 0.2 0.1 0 1 2 4 5 6 Ptot [mg/l] in effluent SPO4 [mg/l] in effluent SNH4 [mg/l] in effluent 20 15 10 50 3 2 1 3 Time [days] Figure 4.3: Comparison of the model outputs using the estimated parameters (dashed) and using the nominal parameters (dotted) with the real measurements (solid) taken in the period of October 17–24, 2005. 62 CHAPTER 4. PARAMETER ESTIMATION in which is the real value of the parameter, ^ is the estimated value of the parameter, np is the number of estimated parameters, nd is the number of data points, is the desired con…dence level, and F represents the F -distribution which can be read from statistical tables. It should be mentioned that and ^ only consist of the chosen identi…able parameters. H is the Hessian of the objective function in Equation 4.2, and as discussed in 4.2.1, H can be calculated with the following approximate expression T H = SK W SK , where SK is a submatrix of S containing those columns that correspond to the chosen parameter subset K, while W is the weight matrix. s2 is the sample variance 2J ^ 2 s = nd np . For the parameter estimation with 10 estimated parameters, the 95% con…dence interval is: ^ T T SK W SK =^ ^ 1:4178. The con…dence interval is often reported with plus/minus limits, i.e., ^ = ^ can be given as r ~ = 2s2 np F (np ; nd np ; ) H ; (4.3) , in which =^ ~ is the diagonal vector of H where H tion 4.3 is found to be: 0 Kh KX qfe bHET qPP B B B B B B B ^=B B PAO B B KPS;PAO B B KPHA B @ AUT KP;AUT 1 . Then, the corresponding con…dence limits to Equa- 1 0 C B C B C B C B C B C B C B C=B C B C B C B C B C B C B A @ 3:000 0:122 2:889 0:477 1:000 1:000 0:193 0:010 0:852 0:014 1 C C C C C C C C C C C C C C A 0 B B B B B B B B B B B B B B @ 0:076 0:082 0:086 0:133 0:092 0:107 0:102 0:078 0:305 0:108 1 C C C C C C C C: C C C C C C A The most parameters are determined with narrow con…dence intervals. However, some parameters (e.g. KPHA , KP;AUT ) have very wide con…dence intervals. It should be noticed that the con…dence limits can give an overly pessimistic picture since they de…ne a rectangle which can encompass quite a bit more area than the actual con…dence region, as illustrated in Figure 4.4. This is particularly the case when there is a strong correlation between the parameters. 4.4. DISTURBANCE ESTIMATION USING THE KALMAN FILTER S2 63 Confidence interval on S 1 S! 2 + S A Confidence region on S 1 and S 2 jointly Confidence interval on S 2 S! 2 S! 2 ? S A S! 1 ? S A S! 1 S! 1 + S A S1 Figure 4.4: An example of con…dence region and con…dence intervals in two-dimensional case. Adapted from Rawlings & Ekerdt (2002). 4.4 Disturbance estimation using the Kalman …lter To have a good prediction capability of the Duvbacken model, we need information about the input signals. The on-line measurement of the in‡uent ‡owrate of the plant is available, but there are no sensors to measure the in‡uent compositions. Indeed, a good characterization of the COD, nitrogen, and phosphorus components in the in‡uent is very important to the performance of the ASM models (Olsson & Newell 1999). Therefore, in this section, we accept model parameter values provided in the ASMs literatures, and instead estimate the in‡uent compositions. The objective is to develop a method for simultaneously estimating both state and disturbance for the Duvbacken plant. This topic has not been presented in any papers in Part II of the thesis. 4.4.1 State and disturbance estimation The Kalman …lter is widely applied for on-line implementation of state and disturbance estimation. Also, in section 3.3, we have shown that the discrete-time EKF provides fast and satisfactory state estimation for an ASP. Therefore, the discrete-time EKF is the chosen algorithm for state and disturbance estimation here. For the general dynamic system xk = f (xk 1 ; uk 1 ; wk 1 ; dk 1 ) yk = h (xk ; vk ) , a standard approach to disturbance estimation using the Kalman …lter is to augment the state vector x 2 Rnx with the disturbance d 2 Rnd , and to describe the time variance of 64 CHAPTER 4. PARAMETER ESTIMATION disturbances with a state-space model: = fd k 1 + rk = hd ( k ) , k dk 1 where 2 Rn is the state of the disturbance model and rk is white noise. It is assumed that wk , vk , and rk are independent, zero-mean Gaussian noise processes of covariance matrices Qk , Rk , and Dk , respectively, i.e., N (0; Qk ) N (0; Rk ) N (0; Dk ) : wk vk rk The choice of which disturbances to estimate should be guided by an identi…ability analysis, as described in section 4.2. We …rst combine the state and disturbance vectors to form an augmented state such that the dynamics may be represented by x~k , xk = k f xk 1 ; uk 1 ; wk 1 ; hd fd k 1 + rk 1 k 1 yk = h (xk ; vk ) : (4.4) (4.5) Table 4.1 gives the algorithm steps for simultaneous state and disturbance estimation, which correspond directly to the state estimation EKF steps except with larger matrix operations. 4.4.2 Observability analysis Observability analysis for state and disturbance estimation Let us now consider a linear system with unmeasured disturbances dx (t) = F x (t) + Cd (t) dt y (t) = Hx (t) , (4.6) (4.7) in which the disturbance can be described as a state-space model d (t) = Fd (t) dt d (t) = Hd (t) , where 2 Rn is the state of the disturbance model. Then, the system can be rewritten as an augmented system in the form of d~ x (t) = F~ x~ (t) dt ~ x~ (t) , y (t) = H (4.8) (4.9) 4.4. DISTURBANCE ESTIMATION USING THE KALMAN FILTER 65 Table 4.1: Summary of the extended Kalman …lter for simultaneous state and input estimation. Nonlinear state-space model xk f xk 1 ; uk 1 ; wk 1 ; hd k 1 x~ = f~ (~ xk 1 ; uk 1 ; w~k 1 ) = fd k 1 + rk 1 or k k ~ (~ yk = h x k ; vk ) yk = h (xk ; vk ) ; where wk N (0; Qk ) , vk N (0; Rk ) and rk N (0; Dk ). T T ~ We let x~k , xTk ; Tk , w~k , wkT ; rkT , and Qw k = diag (Qk ; Dk ) De…nition: Fk = @ f~ @x ~ ^ x ~kjk ;uk ;0 ; Gk = @ f~ @w ~ ^ x ~kjk ;uk ;0 ; Hk = ~ @h @x ~ ^ x ~kjk 1 ;uk ;0 ; Lk = ~ @h @v ^ x ~kjk 1 ;uk ;0 x ~ x^~0j0 ; P0j0 Initialization: for k = 0, set x~0 N Computation: for k = 1; 2; : : :, compute State time update x~^kjk 1 = f~ x^~k 1jk 1 ; uk 1 ; 0 x ~ x ~ T w ~ T Covariance time update Pkjk 1 = Fk 1 Pk 1jk 1 Fk 1 + Gk 1 Qk 1 Gk ~ x^~kjk 1 ; 0 Output estimate y^kjk 1 = h 1 1 x ~ T x ~ T T Kk = Pkjk Hk Pkjk 1 Hk 1 H k + L k R k Lk State measurement update x^~kjk = x^~kjk 1 + Kk yk y^kjk 1 x ~ x ~ Covariance measurement update Pkjk = (I Kk Hk ) Pkjk Kk Hk )T + Kk Lk Rk LTk KkT 1 (I Kalman gain 66 CHAPTER 4. PARAMETER ESTIMATION x (t) F CHd ~ = H 0 . 2 R(nx +n ) 1 , F~ = , and H (t) 0 Fd According to the PBH observability test (Theorem 6 in section 3.2), this augmented system is said to be observable if 0 1 H 0 ~ H CHd A = nx + n . rank = rank @ sI F (4.10) sI F~ 0 sI Fd where x~ (t) , Before discussing the conditions for meeting Equation 4.10, we need the concept of transmission zeros. De…nition 7 (Transmission zeros) Consider a system (F; C; H) described in Equations H 0 4.6 and 4.7 and its linear pencil (s) = , the transmission zeros1 of the sI F C system are those s such that rank ( (s)) = rank H sI F 0 C < nx + min [ny ; nd ] . Now we consider the rank condition in Equation 4.10. For all s 2 eig (Fd ), where eig (Fd ) denotes the eigenvalues of Fd , in order to ful…ll the rank condition, the matrix H 0 needs to have full rank. Hence, the number of states in the disturbance sI F CHd model should be less than or equal to the number of outputs (i.e. n ny ), and there must not exist any transmission zeros at s 2 eig (Fd ) for the system (F; CHd ; H). For all s2 = eig (Fd ), the n last columns are linearly independent, i.e. rank (sI Fd ) = n . If the H system without disturbance is observable, i.e. rank = nx , then the augmented sI F system is observable. These observation can be summarized in the following theorem: Theorem 8 The augmented system described in Equations 4.8 and 4.9 is observable if the system has the following properties: The original system (F; H) is observable. The number of states in the disturbance model is less than or equal to the number of outputs, i.e. n ny . The system (F; CHd ; H) has no transmission zeros at any s 2 eig (Fd ). Example 9 (Constant disturbance) Let us reconsider the linear state equations 4.6 and 4.7. Now we assume that the disturbance is constant d d (t) = 0. dt 1 In Matlab, the function zero can be used to compute transmission zeros of LTI models. 4.4. DISTURBANCE ESTIMATION USING THE KALMAN FILTER 67 The augmented system becomes d~ x (t) = F~ x~ (t) dt ~ x~ (t) , y (t) = H x (t) F C ~ = H 0 . The augmented 2 R(nx +nd ) 1 , F~ = , and H d (t) 0 0 system is observable if 0 1 H 0 C A = nx + nd . rank @ sI F 0 sI According to Theorem 8, the state equations 4.6 and 4.7 with constant disturbance is observable if where x~ (t) , the original system (F; H) is observable, the number of unknown disturbances is less than or equal to the number of outputs, i.e. nd ny , and the system (F; C; H) has no transmission zeros at s = 0. Structural observability For the nonlinear WWTP model, in order to guarantee the (arbitrarily chosen) exponential convergence of the …lter, the process must be locally observable, i.e., the linearized model must be observable and ful…ll the observability test discussed above. This requires that the measurements must be su¢ cient in number and in their relationship to the predicted states and disturbances. To give a clue that helps us to …nd necessary measurements, a graph approach is performed for structural observability analysis (Lunze 1992). Based on the model structure, one can …nd system observability without knowing the precise system parameters. A system is said to be output-connectable (or output-reachable) if there exists for every state vertex a path from state vertex to at least one output vertex. The reachability test is a necessary condition of investigating the observability. The structure of a system described by ASM2d model is shown in appendix 4.A, with the outputs that are available in practice. We can see that the states SI , SN2 , and XI do not connected to the outputs, thus, the system is unobservable. In other words, to make the system output-connectable, these states have to be considered as available measurements. 4.4.3 Application to the Duvbacken plant Process description As introduced in Dochain & Vanrolleghem (2001), the general mathematical model of the Duvbacken plant can be formulated as dx (t) = f (x (t) ; u (t)) + Cd (t) + w (t) dt y = h (x (t)) + v (t) 68 CHAPTER 4. PARAMETER ESTIMATION where x 2 Rnx is the state, u 2 Rnu is the model input, d 2 Rnd is the disturbance that typically represents the feed composition, and the matrix C is known. The process noise and the measurement noise are assumed to be w (t) N (0; Q) and v (t) N (0; R), respectively. In general terms, disturbance models have to be chosen according to the expected load. In the case of WWTPs, the feed composition of domestic wastewater may typically vary during the course of a day. However, wastewater characteristics vary from plant to plant, and there are quite few measurements taken from the feed. Therefore, an accurate disturbance model is di¢ cult to …nd. It is more realistic to assume a constant disturbance d d (t) = r, dt where r is the white noise. Considering the application of the discrete-time EKF, the augmented model described in equations 4.4 and 4.5 becomes xk f (xk 1 ; uk 1 ; wk 1 ; dk 1 ) = dk dk 1 + rk 1 = h (xk ; vk ) . x~k = yk In contrast to the states x, the additional states d are considered as constants during the propagation phase in the …lter. However, the values of d will be corrected in the update steps of the Kalman …lter algorithms at discrete-time instants. A signi…cant advantage of state augmentation for disturbance estimation is the fact that the algorithm can track time-varying disturbances. A dynamic model of the Duvbacken plant has been described in section 2.3. In the model, each of the 4 steps in the plant (anaerobe, aerobe 1–3) includes 17 states and this gives a model with 68 states. The model input is the volumetric feed ‡owrate Qin , while the feed compositions of 17 variables are the model disturbance. Due to the practical focus of this study, only the 4 most interesting feed concentrations are estimated: readily biodegradable substrate SF;in , fermentation products SA;in , ammonium SNH4 ;in , and slowly biodegradable substrate XS;in . The other feed concentrations are chosen to be constant. In the plant, 13 measurements listed in Table 4.2 are available with the sampling time of 1 min. However, according to the observability analysis in subsection 4.4.2, we …nd that at least the following 16 state variables2 need to be available for measurement to render the Duvbacken system locally observable: In anaerobe reactor: SPO4 , SI , SN2 , SALK , XI , XTSS In aerobe reactor 1: SO2 , SPO4 In aerobe reactor 2: SO2 , SNH4 , SNO3 , SPO4 In aerobe reactor 3: SO2 , SNH4 , SNO3 , SPO4 . Consider the problem of constructing estimates of the unmeasured state variables and disturbances from the available outputs listed in Table 4.2. The resulting augmented system is observable if the conditions in Theorem 8 are ful…lled. It is obvious that the original system is unobservable due to the lack of measurements. Therefore, the augmented system is unobservable as well. In the sequel, we …rst choose to check whether the suitable state and 2 Unfortunately, it is not realistic to measure all these states in practice. 4.4. DISTURBANCE ESTIMATION USING THE KALMAN FILTER Output y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 69 Table 4.2: Measurements of the Duvbacken WWTP. Component Description SNH4 ;a1 Ammonium in outlet of aerobe reactor 1 SNO3 ;a1 Nitrate in outlet of aerobe reactor 1 XTSS;a1 Total suspended solids in outlet of aerobe reactor 1 SO2 ;a2 Dissolved oxygen in outlet of aerobe reactor 2 SNO3 ;a2 Nitrate in outlet of aerobe reactor 2 XTSS;a2 Total suspended solids in outlet of aerobe reactor 2 SO2 ;a3 Dissolved oxygen in outlet of aerobe reactor 3 SNO3 ;rs Nitrate in return sludge chamber XTSS;rs Total suspended solids in return sludge chamber SNH4 ;e Ammonium in e- uent of the plant SPO4 ;e Phosphate in e- uent of the plant TPe Total phosphorus in e- uent of the plant XTSS;e Total suspended solids in e- uent of the plant disturbance estimates can be obtained for the observable process by the simulation study, then the application to the plant based on real data is investigated. Simulation results The proposed estimation approach is evaluated for the observable process based on responses from the simulation model. The input Qin is obtained from the real plant over a 40 h period, and the time evolution of Qin is plotted in Figure 4.5. The feed wastewater composition and the simulation results over the 40 h period for the plant are shown in Table 4.3. 4 4 x 10 3.8 3.6 3.4 Qin [m3/d] 3.2 3 2.8 2.6 2.4 2.2 2 0 5 10 15 20 25 30 35 40 Time [hours] Figure 4.5: Time evolution of the measured feed ‡owrate over a 40 h period. 70 CHAPTER 4. PARAMETER ESTIMATION Table 4.3: Simulated concentrations of ASM2d components. ASM2d components Feed [ g= m3 ] E- uent [ g= m3 ] Recycled sludge [ g= m3 ] SO 2 0:1 2:91 2:91 SF 30 0:47 0:47 SA 20 0:01 0:01 SNH4 25 18:37 18:37 SNO3 0:5 4:05 4:05 SPO4 7 0:03 0:03 SI 30 30:06 30:06 SALK 5 5:79 5:79 2 8:34 8:34 SN2 XI 10 1:50 2436:31 XS 75 0:05 78:10 XH 10 1:98 3231:77 XPAO 0 1:16 1885:27 XPP 0 0:13 215:34 XPHA 0 0:13 215:34 XAUT 0:2 0:06 91:01 XTSS 100 3:76 6120:39 Figure 4.6 shows the good convergence properties of the estimator for the disturbances. Also, the estimation of unmeasured states are plotted in Figure 4.7. Due to the large quantity of the state variables, only some of the states for the last reactor (aerobe reactor 3) are shown in the …gure. The time evolutions of both the unmeasured states and the inputs illustrate the potential of the proposed approach to simultaneously estimate unmeasured states and disturbances. Experimental results Although the system is unobservable based on the experimental data, it is still of great interest to investigate the practical performance of the disturbance estimator. Figure 4.8 shows estimated values of the unmeasured feed concentrations based on real data, in comparison to the disturbance values used in the simulation model. However, since the real value of the disturbance is not known, this makes the initialization and tuning of the …lter more di¢ cult. In order to evaluate the performance of the …lter, the evolution of some key outputs are displayed in Figures 4.9 and 4.10: the real output from the plant (solid line) and the estimated output with the EKF (dashed line). For veri…cation of the disturbance estimate, we also include the model output with nominal disturbance values (dotted line) and the model output after disturbance estimation (dash-dotted line). The comparison of the simulations will indicate whether the model provides smaller prediction errors through disturbance estimation. We can see that the output prediction is quite good using the EKF. However, the estimated disturbances do not provide a signi…cant improvement in the prediction capability of the model outputs. From a practical point of view, it should be stressed that the obtained results are inter- 4.4. DISTURBANCE ESTIMATION USING THE KALMAN FILTER 71 21 36 34 Estimate 3 SA, in [g/m ] 3 SF, in [g/m ] ”True” simulated value 32 20 19 30 18 28 17 ”True” simulated value Estimate 0 10 20 30 40 0 28 10 20 30 40 80 Estimate 27 XS, in [g/m3] SNH4, in [g/m3] ”True” simulated value 26 75 70 ”True” simulated value 25 Estimate 65 0 24 0 10 20 30 40 10 Time [hours] 20 30 40 Time [hours] Figure 4.6: Time evolution of the disturbances for the observable process. 0.2 2.5 ”True” simulated value Estimate 2 SA,a3 [g/m3] 3 SF,a3 [g/m ] ”True” simulated value 1.5 1 0.5 0 10 20 30 0.1 0.05 0 40 1000 Estimate 0.15 0 10 40 ”True” simulated value Estimate 980 XTSS,a3 [g/m3] 3 XPAO,a3 [g/m ] 30 4000 ”True” simulated value 960 940 920 20 0 10 20 Time [hours] 30 40 Estimate 3500 3000 2500 2000 0 10 20 30 40 Time [hours] Figure 4.7: Time evolution of the unmeasured states for the observable process. 72 CHAPTER 4. PARAMETER ESTIMATION 32 22 Model Estimate 31 30.5 30 29.5 0 10 20 30 20.5 20 0 10 20 30 40 30 40 90 25 XS, in [g/m3] SNH4, in [g/m3] 21 19.5 40 30 20 15 Model Estimate 10 5 Model Estimate 21.5 3 SA, in [g/m ] 3 SF, in [g/m ] 31.5 Model Estimate 80 70 60 50 0 10 20 Time [hours] 30 40 0 10 20 Time [hours] Figure 4.8: Estimated values of the disturbances based on the experimental data vs. nominal disturbance values used in the simulation model. 4.4. DISTURBANCE ESTIMATION USING THE KALMAN FILTER 73 SO, a2 [g/m3] 2 1.5 1 0.5 0 0 5 10 15 20 25 30 35 40 0 5 10 15 20 25 30 35 40 0 5 10 15 20 25 30 35 40 SNO3, a2 [g/m3] 6 4 2 0 XTSS, a2 [g/m3] 6000 4000 2000 0 Time [hours] Figure 4.9: Comparison of the outputs in the aerobe reactor 2: experimental data (black, solid), estimated outputs (red, dashed), simulation results with the nominal values for the disturbances (blue, dotted), and simulated results with the estimated values for the disturbances (green, dash-dotted). 0.2 15 0.15 10 SPO4 [g/m3] 20 [g/m3] CHAPTER 4. PARAMETER ESTIMATION SNH4, eff 74 5 0 0.05 0 0 10 20 30 40 0 10 20 30 40 0 10 20 30 40 8 XTSS, eff [g/m3] 0.35 3 TPeff [g/m ] 0.1 0.3 0.25 0.2 7 6 5 4 3 0 10 20 Time [hours] 30 40 Time [hours] Figure 4.10: Comparison of the outputs in the e- uent: experimental data (black, solid), estimated outputs (red, dashed), simulation results with the nominal values for the disturbances (blue, dotted), and simulated results with the estimated values for the disturbances (green, dash-dotted). 4.A. STRUCTURAL OBSERVABILITY ANALYSIS OF ASM2D MODEL 75 esting. Indeed, as it has been pointed out in the introduction, the estimation of the feed concentrations of WWTPs is a very challenging problem. The processes su¤er from a lack of sensors, and their investment and operating costs together with di¢ culties of measuring gas and biomass concentrations limit practical implementation of sensors. The proposed approach allows us to estimate both the unmeasured model states and the disturbances, using a number of available measurements. According to the application of the EKF to the state and disturbance estimation of the Duvbacken process, we would like to draw attention to the following conclusions: The EKF requires that a reliable process model is available and model …tting and validation should preferably be carried out. However, perfect models rarely exist and uncertainty of e.g. initial conditions and kinetics often appear in WWTPs. In this case, observability of the system is particularly important to ensure the dynamics of the EKF to be assigned arbitrarily. To render the Duvbacken system locally observable, the following additional state variables need to be available for measurement based on the measured output listed in Table 4.2: SPO4 , SI , SN2 , SALK , XI , and XTSS in anaerobe reactor, SO2 and SPO4 in aerobe reactor 1, SNH4 and SPO4 in aerobe reactor 2, and SNO3 in aerobe reactor 3. However, measurement of some of the state variables (e.g. SI and SN2 ) is not realistic with today’s technology. The EKF should be carefully tuned in the real-life application, otherwise biased results might appear. The main parameters to tune are the covariance matrices Q and R. Also, the choice of initial value of state error covariance P0 plays an important role in the convergence properties of the EKF. 4.A Structural observability analysis of ASM2d model The structure of the system described by the ASM2d model is illustrated in Figure 4.11. 76 CHAPTER 4. PARAMETER ESTIMATION Dissolved components Particulate components Measurements SO2 XI SF XS SA ySO2 XH SI ySNH4 XPAO SNH4 XPP ySNO3 SN2 XPHA ySPO4 SNO3 XA yXTSS SPO4 XTSS SALK XMeOH XMeP Figure 4.11: Structure of the system described by ASM2d model. Chapter 5 Control Strategies 5.1 Introduction Applying advanced control strategies to ASPs is a challenging task. Compared to other industrial processes, some of the challenges that are particular to the control of the ASP are stated in Olsson & Newell (1999): The disturbances of the ASP are extremely large. The process has signi…cant nonlinearities limiting the usefulness of simple controllers. The process has sti¤ dynamics, i.e., there is a wide range of time constants (from a few minutes to several days). There are few manipulated variables. Sensors do not exist for many states and are expensive for others. The strict EU Directive 91/271/EEC on Urban Wastewater Treatment strongly constraints the maximum pollutant concentrations allowed in the e- uent. For ASPs, many control techniques have been proposed in the literature from classical control (e.g. PID control, cascade control, and ratio control), rule-based control (e.g. knowledge-based control and fuzzy control), model based control (e.g. optimal control, MPC, and adaptive control), to plant-wide control. For a thorough review of the techniques, the reader is referred to Weijers (2000). Also, state-of-the-art of control methods and practical cases for wastewater treatment are presented in Olsson et al. (2005). Some examples of control strategies for ASPs are given in Lindberg (1997), Lukasse, Keesman, Klapwijk & van Straten (1999), and Samuelsson (2005). In this work, MPC is chosen for advanced control of ASPs. MPC is by far the most commonly applied advanced control technique in the chemical process industry (Bequette 2003). The reasons why MPC looks appropriate for control of ASPs are: MPC handles constraints in an optimal fashion. 77 78 CHAPTER 5. CONTROL STRATEGIES The MPC algorithm allows us to anticipate and remove the e¤ects of disturbances. Indeed, disturbances are a major reason why control is required for ASPs. The optimization-based procedure is a natural way of handling multivariable control problems. MPC provides a general framework for complicated processes with time-delays, inverseresponses, and interactions. In this chapter, control strategies of the aeration system for the intermittently aerated ASP introduced in section 2.2 are studied. We consider both simple rule-based controllers in section 5.2 and advanced model-based controllers (e.g. optimal control and MPC) in section 5.3. In the application of MPC, we …rst choose to study linear MPC for a nitrogen removal ASP with continuous aeration in subsection 5.3.1, which provides us with guidelines for further MPC development. Next, nonlinear MPC is considered due to the high nonlinearity of ASPs and discussed in subsection 5.3.2. 5.2 Rule-based control strategies In practice, many rule-based operating modes have been investigated and applied to intermittently aerated ASPs, and can be categorized as open-loop control using …xed lengths of aerobic and anoxic phases, or feedback control using varying phase lengths by establishing a switch point for each phase. The switch point is typically the concentration of dissolved oxygen, nitrate, or ammonia. These rule-based control strategies are often used for evaluation of process performance (Hao & Huang 1996), (Kimochi et al. 1998) and for comparison with advanced model-based control strategies (Isaacs & Thornberg 1998), (Lukasse, Keesman, Klapwijk & van Straten 1999), (Chachuat et al. 2005). In Paper F, three rule-based strategies are presented for the nitrogen removal process with intermittent aeration: …xed lengths of aerobic and anoxic phases, relay control of the blower (on/o¤) state by the upper level of dissolved oxygen (DO) whilst the aeration cycle length is …xed, and relay control of the blower state by the upper and lower bounds of ammonia concentration (SNH4 ). Another widely-used strategy is relay control by both the upper and lower bounds of DO, which is the approach applied to the laboratory process in chapter 6. The reactor is then intermittently aerated to restrict the value of DO between DOmin and DOmax . By the 5.2. RULE-BASED CONTROL STRATEGIES 79 11 10 TN [g/m3] 9 8 7 6 TN 5 max DO zone control 4 0 4 8 12 16 20 24 Time of day [hour] Figure 5.1: Simulation result of the DO zone control strategy: TN in the e- uent. simulation study, the reasonable values of DOmin 1 and DOmax are found to be 0:02 g m 3 and 1:1 g m 3 , which results in the total aeration fraction of 53:95%. The e- uent TN obtained with the DO zone control strategy is shown in Figure 5.1. The controller has a similar performance as the …xed phase length controller and the DO upper level controller shown in Paper F, but the aeration switching frequency is higher (the number of aeration cycles Nc = 129 d 1 ). Common to all these strategies is that the control variable is selected so as to satisfy the following criterion over a 24 h control horizon: min J = X d Th dxa subject to = F (xa ; ua ) dt 0 TNmax TN . The objective is to determine X the aeration pro…le that minimizes the aeration fraction, i.e., the total aeration time ( d) divided by the control horizon (Th ), with adherence to the e- uent limit for the concentration of total nitrogen (TN). The objective function J is a subject to the nonlinear process model dx = F (xa ; ua ). The rule-based control strategies dt handle the usual daily variations of in‡uent ‡owrate and TN load quite well and keep the e- uent TN within the constraint during the 24 h control horizon. However, the rule-based approaches scheduled on a daily basis, are limited in that predetermined time schedules of aeration cycles with …xed phase lengths or …xed values of switch points cannot compensate for unanticipated loading variations (see also Potter et al. (1996)). 1 In practice, the accuracy of the DO measurement may not be guaranteed when the value of DO is getting too low. Thus, the tuning of the DO levels should be performed carefully. 80 CHAPTER 5. CONTROL STRATEGIES Disturbance dk Setpoint y sp,k Control input MPC controller uk Measured output Process yk Figure 5.2: Predictive control scheme. Next, the more advanced MPC controller will be discussed with comparison to the rulebased controllers. 5.3 Model predictive control (MPC) The development of mathematical models for ASPs motivates the application of model-based optimal control, see e.g. Kabouris & Georgakakos (1990), Zhao et al. (1994b), Isaacs (1997), Kim et al. (2000). However, the open-loop optimal control should not be implemented in practice because the open-loop operation is very sensitive to model error and unknown disturbances. The ideal solution is to apply the dynamic optimization on-line with a receding horizon and include feedback in MPC. Figure 5.2 shows the block diagram of MPC. Readers not familiar with MPC may consult one of the many texts on the subject, e.g. Maciejowski (2002), Rossiter (2003), Qin & Badgwell (2003), and Camacho & Bordons (2004). Applications of optimal control and MPC in intermittently aerated ASPs has been the subject of a number of research studies. The MPC technique is studied in Zhao et al. (1994a), Lukasse et al. (1998), Lukasse, Keesman & van Straten (1999a), and Holenda et al. (2007) using simpli…ed models. In recent research, for example Chachuat et al. (2001), Chachuat et al. (2005) and Balku & Berber (2006), some e¢ cient optimization algorithms are investigated for alternating aerobic-anoxic processes based on complete ASMs. In addition, Balku (2007) presents a comparison between conventional and intermittently aerated systems in terms of nitrogen removal and aeration time with an optimization algorithm. For a complicated system like the ASP, a simple model is only possible by neglecting large parts of the process dynamics. Large simpli…cations of dynamics result in poor predictive capability of the model, and the simpli…ed model is often only suitable for the speci…c process. The main hindrance for the implementation of MPC in wastewater treatment has always been the large computational demand for solving the optimization problem in MPC. However, with the increase in speed of computing hardware and improvements in optimization algorithms, interest in application of MPC using complete ASMs is growing. 5.3. MODEL PREDICTIVE CONTROL (MPC) 5.3.1 81 Linear MPC for continuously aerated ASP Application of MPC for a SNdN process with continuous aeration is investigated in Paper D. Linear MPC with constraints, which is a standard technique, is applied as a starting point of the MPC study. For linear MPC, a typical mathematical formulation of the criterion may be, see Hauge (2003): 1X T e Qek+i + uTk+i Ruk+i + 2 i=0 k+i N min uk ;:::;uk+N Jk = uTk+i S uk+i , (5.1) constrained by the de…nitions ek = rk uk = uk yk uk 1 , the linear model of the process, e.g. xk+1 = F xk + Buk yk = Hxk + Duk , and the bounds u`k yk` u`k uk uuk yk yku uk uuk , in which u, y, r, and x are the control input, controlled output, output reference, and state, respectively. The optimization horizon N and the weighting matrices Q, R, and S are the tuning parameters of MPC. The use of the linear model together with the quadratic objective function gives rise to a convex problem (Quadratic Programming, QP) whose solution is well studied with many commercial products available (e.g. the QP solver quadprog of the Optimization Toolbox in Matlab). The state-space model for the controller design in Paper D is generated by the linearization of the process model (based on the ASM3 model) at a steady-state operating point of the plant. The steady-state is reached by assuming constant in‡uent ‡owrate and concentrations, and the reactor condition at the steady-state is also considered initial conditions for the optimization. The objective of the controller is to regulate the concentration of total nitrogen (TN) around a speci…ed set-point by operating on the aeration system. Since the oxygen transfer process can be described with the oxygen mass transfer coe¢ cient (KL a), we choose KL a as the manipulated input, which is constrained to KL a 2 [0; 240] d 1 . Moreover, no process and measurement noises are taken in consideration. The simulation result shows that the performance of the MPC controller is satisfactory: the concentration of TN is controlled to track its set-point with good convergence properties. 82 CHAPTER 5. CONTROL STRATEGIES 5.3.2 Nonlinear MPC for intermittently aerated ASP The main advantage of nonlinear MPC over linear MPC is obviously the possibility of dealing with nonlinear dynamics. In fact, the extension of linear MPC ideas to nonlinear processes is straightforward, at least conceptually. However, there are some di¢ culties derived from the use of nonlinear models such as (Camacho & Bordons 2004): The optimization problem is nonconvex, and its resolution is much more di¢ cult than the QP problem. The di¢ culty of the optimization problem translates into an important increase in computation time. Nonlinear system identi…cation is more di¢ cult than the linear case, and applications of e¢ cient identi…cation techniques, as described in section 4.2, need to be investigated. Some of these problems have partially been solved, and nonlinear MPC is becoming a …eld of intense research, see Henson (1998) and Kouvaritakis & Cannon (2001). For the characteristics of ASPs, application of nonlinear MPC would seem essential for improved performance. There are two main reasons for this: …rst, ASPs are usually highly nonlinear. Secondly, ASPs are hardly ever in steady state, but is subject to transient behavior all the time, because the wastewater in‡uent typically varies both in its ‡owrate and in its composition. In addition, by controlling reaction times of nitrifying and denitrifying in a single tank, the process o¤ers energy savings and low investments of instruments. The most straightforward approach to the nonlinear MPC problem is to retain the formulation of the optimization problem as we have discussed in linear MPC, simply replacing the linear model by a nonlinear one, and rely on suitable optimization methods. Therefore, the optimization problem for the aeration control of the intermittently aerated ASP is formulated as 1 X Nc fk , min J = k=1 f1 ;:::;fNc Nc constrained by the nonlinear process model dxa = F (xa ; ua ) dt and the bounds 1 0 ton;min a to ;max a TNmax TN ton;max fk a to ;min fk 1 . a Here, we consider the value of KL a constant, instead, the aeration fraction fk is de…ned as the manipulated input. Also, fk is constrained to its lower and upper limits depending on maximum and minimum air on/o¤ periods, while the output variable (TN) is controlled to be less than its limit TNmax . As the de…ned problem is a constrained nonlinear optimization 83 80 35 60 30 40 25 20 TN load [g/m3] MPC aeration fraction fk [%] 5.3. MODEL PREDICTIVE CONTROL (MPC) 20 MPC result TN influent concentration 0 0 4 8 12 16 20 24 15 Time of day [hour] Figure 5.3: MPC aeration fraction and TN concentration in the in‡uent vs. time. problem, several powerful commercial solvers (e.g. the SNOPT and the conSolve solvers in the TOMLAB optimization toolbox for Matlab) can be used to solve this kind of problem. The most important source of disturbances is the wastewater in‡uent as described in section 4.4. In order to test the MPC performance under process disturbances, in Paper F, typical daily variations of dry weather conditions are simulated using some weighting functions de…ned in the literature for the in‡uent wastewater ‡owrate and composition. Figure 5.3 illustrates that the variation of the aeration fraction obtained with MPC is closely related to the variation of the feed concentration: the high TN load induces the high aeration fraction, whereas the low TN results in the low aeration fraction. In addition, the simulation over a long-term period (10 d) shows that the MPC controller guarantees that the strict e- uent requirements are ful…lled and the energy saving is lasting. Finally, to con…rm the bene…ts that may be realized using the proposed MPC strategy, comparisons with conventional rule-based controllers introduced in section 5.2 is considered in Paper F, and the MPC controller presents the following advantages: MPC provides most reduction of the aeration time. It is easier to deal with the inequality constraints in both e- uent requirements and operating conditions. The tuning of the MPC controller is relatively easy; in this study, the main tuning parameter is the MPC horizon. In the computation, MPC takes 22 min for a 24 h control horizon. Although this computation time is much longer than the other simple controllers, it is still feasible for the on-line implementation of the MPC controller. 84 CHAPTER 5. CONTROL STRATEGIES Chapter 6 Laboratory Case Study A new laboratory-scale plant was built by an N-removal project group at Telemark University College in 20071 . Unfortunately, the author could only participate in the design and the plant construct phases of the project due to the time limit of the PhD research period. In this chapter, an introduction to the laboratory-scale plant is given, and then some possible future research directions for the project are suggested. 6.1 Experimental set-up The N-removal plant is schematically depicted in Figure 6.1. Experiments are performed on two di¤erent types of reactors: the bio…lm reactor2 (Reactor 1 in the …gure) and the ASP reactor (Reactor 2 in the …gure). Reactor system The reactors are made of Plexiglass, and each reactor has a working volume of 10 l, with 7:7 l of the reactor volume and 2:3 l of the settler volume. The settled sludge in the settler is recycled internally. For both reactors, the sludge retention time (SRT) is maintained at 12 24 d, i.e., the wasted sludge ‡owrate is Qw 2 [0:32; 0:64] l= d. The hydraulic retention time (HRT) is chosen to be HRT 2 [12; 24] h, which results in the in‡uent ‡owrate of Qin 2 [7:7; 15:4] l= d. Sludge and feed wastewater The seeding sludge for the laboratory reactors was taken from the WWTP of city of Risør, Norway. 1 The project group included a number of professors, researchers, and master students at Telemark University College (TUC), as well as two visiting researchers from China. They are professor Rune Bakke, professor Bernt Lie, lecturer Morten Pedersen, associate professor Finn Haugen, PhD fellow Deshai Botheju, Yuan Song, Shadi Lot…, and Lei Zhao. Visiting researchers Dr. Zhiqiang Chen from Harbin Institute of Technology, China, and professor Tao He from Hubei University of Technology, China, has also given tremendous help and many suggestions during their stay at TUC. 2 For the bio…lm reactor system, a new model is required. 85 86 CHAPTER 6. LABORATORY CASE STUDY DO controller DO DO Air valve 1 Air Air valve 2 Waste sludge Settler Settler Waste sludge Carbon Biofilm Effluent Effluent Nutrients Dilution water Magnetic stirrer Magnetic stirrer Feed Reactor 1 Reactor 2 Figure 6.1: Schematic diagram of the laboratory N-removal plant. 6.1. EXPERIMENTAL SET-UP 87 Table 6.1: Composition and ‡owrate of the in‡uent feed for the laboratory study. Feed source Composition Concentration Flowrate Nutrient (nitrogen) source 0:2 l= d (NH4 )2 SO4 4438 mg= l 344 mg= l K2 HPO4 KH2 PO4 344 mg= l Na HCO3 7445 mg= l Carbon source 0:17 l= d Starch (potatoes) 3899 mg= l Yeast extract 100 mg= l Dilution water 8:64 l= d Total feed ‡owrate is 9:01 l= d. The in‡uent feed consists of nutrient source, carbon source, and dilution water. In order to reduce replenishment times for the in‡uent feed, the nutrient and carbon sources are concentrated, and they are stored in two 10 l glass reservoirs. The wastewater in the reservoirs is transferred to the reactors by a peristaltic pump (Cole-Parmer Master‡ex 7520-47) that can be controlled on/o¤ from the PC. An example of the composition and the ‡owrate of the feed wastewater is given in Table 6.1. In this case, the feed wastewater consists of total chemical oxygen demand (COD) of 74 mg= l, total nitrogen (TN) of 21 mg= l, and total phosphorus (TP) of 3 mg= l. Data acquisition and control system The data acquisition system used in this project consists of a computer (2:8 GHz Pentium 4, 512 MB RAM) with an interface card (National Instruments PCI-6024E), a terminal panel, and a user interface software. Signals of the DO sensors (Oxi340 and Oxi340i models, WTW) are sent to the computer through the series port connection. The electric control valves (5821 model, SAMSON) are used to regulate air supply to the reactors, by receiving signals from the controller designed in the control software (LabVIEW version 8.2). The reactors are aerated by intermittent aeration strategies. That is, the air valves are controlled by the upper and lower bounds of DO based on the on-line measurement of DO: the aeration is turned on when DO DOmax and is turned o¤ when DO DOmin . The DO sensors have a 1 min time delay and 1 min sampling time. LabVIEW is also used for real-time database management and real-time display of process variables, as shown in Figure 6.2. O¤-line measurements The in‡uent wastewater samples are collected from the outlet of the feed pipes. E- uent samples for each reactor are taken from the respective e- uent outlet. Process performance variables are rountinely analyzed, included TN, COD, ammonium (SNH4 ), nitrite (SNO2 ), nitrate (SNO3 ), and total suspended solids (XSS ). In addition, pH and temperature are also recorded. 88 CHAPTER 6. LABORATORY CASE STUDY Figure 6.2: Controller screen of the LabVIEW user interface; under development. 6.2 Recommendations to the N-removal project Based on the current research results described in this thesis, recommendations for future research directions of the N-removal project are given, with emphasis on the activated sludge reactor. Modeling 1. First of all, the model of the N-removal process should be developed based on the ASM3 model which may be the best choice in the modeling of the biological processes. The object-oriented modeling approach (see section 2.4) can provide ‡exible and e¢ cient model representation. 2. Once a process model is chosen, the model needs to be validated, not only in a qualitative but also in a quantitative way by comparing its predictive capabilities with data measured from the real system. The systematic approach to parameter identi…ability and estimation, which is presented in chapter 4, can be applied. 3. The developed model can be used for many di¤erent purposes, for instance, system analysis by simulation, process optimization, state estimator, process control, see Dueñas Díez (2004). 4. As only few of the ASM3 components in the feed in‡uent are available by measurement, the unmeasured feed composition can be estimated using the approach proposed in section 4.4. 6.3. IMPLEMENTATION ARCHITECTURE — FUTURE PERSPECTIVE 89 Process control 1. The performance of the zone control strategy based on the available DO measurement, may be improved by considering the time delay of DO sensors. 2. The linear and the nonlinear MPC algorithms described in section 5.3 can be implemented for the ASP to achieve on-line application of the model-based optimal control. 3. When testing MPC on the laboratory plant, the current states must be known. Since we cannot measure all the states, the state estimation techniques discussed in chapter 3 can be used to estimate the model states. In order to implement the aforementioned modeling and process control issues, it is of interest to have an open implementation architecture for e¢ ciently integrating control algorithms and software tools. 6.3 Implementation architecture — future perspective In the EU project INCOOP (INtegrated process COntrol and plantwide OPtimization)3 , an architecture for advanced, model based control is proposed, see Figure 6.3. The reference architecture is developed to give a good software development environment where process control and instrumentation system, process simulator (e.g. gPROMS), optimizer, and algorithm prototyping environment (e.g. Matlab) can be integrated. The main advantages of the architecture are: The architecture is set up in a distributed modular structure, and various modules can easily be added, modi…ed, or removed. A powerful computing tool, such as Matlab, is used to achieve the freedom in algorithmic development. Open communication standards make the integration of di¤erent tools easy. In the wastewater treatment area, Olsson & Jeppsson (2006) point out the motivation of using open architectures for process control: The controllers, I/O and buses are built to accommodate third-party modules and to integrate easily for fast setup. This feature gives facilities the freedom to choose the best and latest technologies from manufacturers without having to stay within product lines or fear product obsolescence. 3 The INCOOP project is an RTD project carried out from 2000–2003 aiming at full integration and realization of the model based control and real time optimization in the process industry. Researchers from chemical process industries (Bayer, Shell International Chemicals, IPCOS Technology, MDC Technology) and academia (Eindhoven University of Technology, Delft University of Technology, RWTH Aachen, and Carnegie Mellon University) have participated in this project; see http://www.lpt.rwth-aachen.de/Research/Completed/co_incoop.php. 90 CHAPTER 6. LABORATORY CASE STUDY Model reduction prototype (Matlab) MPC prototype (Matlab) State Estimation prototype (Matlab) OPC Server Scheduler Optimiser prototype Generic Process Model Simulated Process (gPROMS, Modelica/Dymola) (gPROMS, Modelica/Dymola) Process Instrumentation Process Figure 6.3: Software architecture for advanced control. Redrawing of …gure from INCOOP workshop (INCOOP 2007). 6.3. IMPLEMENTATION ARCHITECTURE — FUTURE PERSPECTIVE 91 The INCOOP architecture provides us with a methodology for e¢ ciently integrating a ‡exible object-oriented modeling approach with advanced control techniques for WWTPs. Let us comment on each of the modules of the architecture. OPC server is used as a key component for building the software environment. As an open connectivity via open standards, OPC (OLE for process control) is widely used in industrial automation. Most of control systems o¤er OPC servers in order to openly communicate with any OPC client, see http://www.opcfoundation.org. In addition, Matlab provides the OPC Toolbox that is an OPC Data Access client application, capable of connecting to any OPC Data Access compliant server (e.g. National Instruments LabVIEW OPC server (Chai 2005)). Dymola version 6.1 also provides an interface to OPC Data Access. Scheduler is used to coordinate the various tools. Generic process model is important for model-based control and optimization. In INCOOP, it is proposed to use gPROMS (PSE 2006); the choice is based on several characteristics for gPROMS, such as strong support for process models and an equation based system which makes it possible to introduce manipulation of the models (e.g. analytic model reduction, linearization). Another general, equation-based modeling language is Modelica. Currently, Modelica has less support for process models than gPROMS, but the modeling scope is more general. Simulated process indicates the same equation-based simulation tools (i.e., gPROMS and Modelica/Dymola). Model reduction includes elimination of nonlinear models, elimination of implicit expressions, reduction of the number of states in the model, etc. The approximate model should be suited specially for the application in the optimization and control modules (modules Optimizer prototype and MPC prototype (Matlab) in Figure 6.3). Optimiser prototype is required to generate optimal control trajectories for the process. E¢ cient algorithms for optimization are necessary to enable the optimization techniques to be applied on-line, and software tools are often used to solve optimization problems. State estimation prototype is used to …nd unmeasured states since optimization of a system requires that the states of the system are available. The common techniques for state estimation have been discussed in chapter 3. MPC prototype is developed to control the process based on the optimized trajectories obtained by optimizer. MPC predicts the future optimal control actions and send them to the plant that includes a primary control system. Process instrumentation is a tool for communication with the process, which enables the use of data from the process and puts out actuator signals to the process. 92 CHAPTER 6. LABORATORY CASE STUDY In this research, Matlab is used as the integration platform due to its support to Dymola and powerful numerical capabilities. Recently, LabVIEW version 8.20 adds a functionality to support the communication with Dymola. With the development of the interface between LabVIEW and Dymola/Modelica, the use of LabVIEW with MathScript4 could be an excellent integration platform. Also, the open source programming language Python described in appendix 2.A, could replace Matlab in a “poor man solution”. 4 MathScript is a new feature for LabVIEW 8 that adds math-oriented, textual programming to LabVIEW, and is generally compatible with m-…le script syntax used by e.g. Matlab. For more information see http://www.ni.com. Chapter 7 Conclusions and Future Directions 7.1 Conclusions The main objective of this thesis has been to investigate possible improvements in operation and performance of activated sludge plants through applications of advanced modeling and control techniques. The activated sludge process (ASP) is generally applied in biological wastewater treatment due to its e¢ cient elimination of organic matter and nutrients such as nitrogen and phosphorus. Although ASPs have been introduced in a large number of studies, there are still many challenges associated with the application of modern modeling methods and control strategies for such processes. Modeling Special emphasis has been put on the investigation of approaches that implement e¢ ciently the complex activated sludge plant models. A laboratory-scale nitrogen removal process and a full-scale phosphorus removal plant: the Duvbacken WWTP, have been used as case studies. For ASPs, the family of Activated Sludge Models (ASMs) presented by the IWA are generally accepted as the standard models of ASPs. The models of the N-removal process and the Duvbacken WWTP have then been developed based on the ASM3 model and the ASM2d model, respectively. The object-oriented modeling approach providing open componentbased architectures and reuse of components, is suggested in this thesis in order to achieve more ‡exible model representation. The object-oriented modeling language Modelica with one of its commercial simulation environments, Dymola, is chosen as model representation tool for activated sludge systems. Special consideration has been given to the Dymola interfaces to other programs, in order to build a good software development environment. Two Dymola interfaces are described: the Dymola-Matlab interface provided by Dymola and the Dymola-Python interface developed by the author, where both Matlab and Python are powerful algorithm prototyping environments for advanced control. Within the Dymola simulation environment, the models of the N-removal process and the Duvbacken WWTP are easily constructed by using the free Modelica library WasteWater. The applications of the modeling approach in this thesis have shown that the combination of Modelica/Dymola for e¢ cient object-oriented modeling and Matlab for further analysis is a powerful tool for control system design. However, currently, information transfer in Dymola-Matlab interaction is via 93 94 CHAPTER 7. CONCLUSIONS AND FUTURE DIRECTIONS …les. It would presumably dramatically decrease the execution time if the simulator could be connected to Matlab as a function. State estimation As regards state estimation and parameter estimation, the attention is focused on the application of the di¤erent estimation techniques to ASPs. An overview of the most generally applied techniques for state estimation such as standard Kalman …lter (KF), extended Kalman …lter (EKF), unscented Kalman …lter (UKF), square-root unscented Kalman …lter (SRUKF), and moving horizon estimation (MHE), has been given, with consideration of systematic presentation of the algorithms for easy implementation. Although these techniques have been widely studied in the literature, the performances of the …lters for the complete ASM models have seldom been discussed. In this thesis, the nonlinear estimation techniques are compared for state estimation of the N-removal process. The comparison results show that the discrete-time EKF gives the fastest performance with a satisfactory estimation result. The slightly variant version of the discrete-time EKF: the hybrid EKF, produces slightly lower estimation errors than the discrete-time EKF due to the more accurate time updates of the state and covariance. Among all the estimation techniques, the SRUKF improves numerical properties of the UKF and provides best estimation performance; and one main advantage of the unscented …lters is the fact that no Jacobian matrices of the system need to be calculated. To handle state constraints, the MHE estimator is most straightforward and generally preferred. When inequality constraints are not considered, the MHE with a horizon size of 1 and with the update of the initial state estimation and the covariance as in the EKF, gives equivalent results to that of the EKF. Parameter estimation The large variations of plant operation, in‡uent, and sludge characteristics of ASPs require some of the model parameters to be adjusted in order to ensure good predictive capabilities of the model. However, parameter estimation of ASP models is a challenging task, since ASP models are in general large-scale, nonlinear, and overparameterized. In this thesis, parameter estimation is carried out for both kinetic parameters of the ASM model and compositions in the in‡uent which is considered model disturbances from the process control point of view. A procedure for parameter identi…ability analysis is discussed and tested with the Duvbacken model. Such a method proves to be very useful, since it reduces a large number of parameters to a small subset of parameters that can be identi…ed from the available experimental data. Estimation of the kinetic parameters is carried out using the least squares method, based on real data taken from the industrial plant. After parameter estimation, the …tting of the model to a new set of experimental data is not great but satisfactory, especially for those outputs which are important to the plant operation (e.g. SPO4 and TP). Since a good characterization of the main compositions in the in‡uent is very important to the performance of the ASM models, a method for simultaneously estimating both model state and in‡uent composition has been developed using the discrete-time EKF. A method to study observability for state and disturbance estimation is discussed. The EKFbased approach is illustrated with the Duvbacken process; however, the Duvbacken system 7.2. FUTURE DIRECTIONS 95 is unobservable due to lack of measurements. As an initial study before doing state and disturbance estimation based on real data from the plant, we check whether suitable estimates can be obtained for the observable process based on responses from the simulation model; and this study shows the estimator has a good convergence property. Next, when the …lter is evaluated based on the experimental data form the real plant, the performance of the …lter is relatively poor. As argued, the lack of the necessary measurements renders the system unobservable. The use of the additional measurements, such as SPO4 , SI , SN2 , SALK , XI , and XTSS in anaerobe reactor, SO2 and SPO4 in aerobe reactor 1, SNH4 and SPO4 in aerobe reactor 2, and SNO3 in aerobe reactor 3, may improve the estimation of states and disturbances, and hopefully the development of measuring technology would give us probabilities to obtain all the necessary measurements. In addition, since the real value of the disturbance is not known, it makes the initialization and tuning of the EKF more di¢ cult. Although the estimation capability of the …lter is limited, the application still demonstrates that the proposed approach provides us with a general methodology to estimate unmeasured states and disturbances using a number of available measurements. Process control The development towards tighter e- uent requirements and better dynamic models have motivated the application of advanced control to ASPs, where the focus has been put on the MPC algorithm because it provides an optimization-based procedure with an elegant way of handling constraints and with capabilities of removing process disturbances. In this thesis, the MPC algorithm has been evaluated with the N-removal process: …rst of all, a linear MPC controller is developed to regulate the concentration of total nitrogen (TN) around a speci…ed set-point by operating on the continuous aeration system. Secondly, the MPC technique using the nonlinear process model is investigated and applied to controlling the intermittent aeration system. The aim of the control is to design an aeration strategy (air-on and air-o¤ periods) which minimizes the energy consumption of the aeration system, with adherence to the EU e- uent standards and the operating constraints. The simulation over a long-term period (10 d) shows that the nonlinear MPC controller guarantees that the strict e- uent requirements are ful…lled and the energy saving is lasting. Finally, to con…rm the bene…ts that may be realized using the proposed nonlinear MPC strategy, comparisons with conventional rule-based controllers used in practice and in the literature, have been carried out, where MPC had the most reduction of the aeration time/energy consumption and o¤ered the easiest way to handle the inequality constraints. Based on the results presented in this thesis, it can be concluded that the application of the nonlinear MPC to the N-removal process is promising. 7.2 Future directions In this work, the particular emphasis has been to study advanced modeling and control techniques for improving performances of ASPs. Although the modeling method and control strategies are evaluated with simulation studies, the implementation of them is straightforward. It is thus of great interest to test the proposed approaches to the laboratory plant and 96 CHAPTER 7. CONCLUSIONS AND FUTURE DIRECTIONS eventually to real full-scale WWTPs. Based on the current research results, the most obvious expectation for future work which might hopefully be carried out by research activities at Telemark University College (TUC), are that: Model development of the activated sludge plant will be improved, with particular emphasis on modeling of settling and clari…cation which is an important element in determining the overall process dynamics. Sensitivity and correlation problems depend strongly on the experiments performed, the measurements taken, and the experimental conditions. Thus, careful experimental designing and reasonable implementation of experiments would help us get promising estimation of model parameters. A more general overview of state estimation techniques will be given. Other estimation techniques such as ensemble Kalman …lter and particle …lter, will also be evaluated. In this work, the MHE has been tested with a horizon size of 1; clearly, it will be of interest to study the behavior of the MHE using a larger horizon size. A general model for describing dynamics of ASP disturbances will be developed. Since the feed composition of domestic wastewater typically varies signi…cantly during the course of a day, the process disturbance is a strong periodic signal. This requires a proper formulation (e.g. an oscillator model) to describe the periodic variation. When applying MPC to the real plant, the estimation techniques are expected to be combined with the control strategy to obtain the unmeasured current states or/and process disturbances, based on the available measurements. Advantages of advanced, model-based controllers over simple rule-based controllers will to be studied further. Besides for nominal performance, di¤erent control techniques will be compared for robustness against model mismatch and large process disturbances. Since lack of cheap and reliable sensors for measurement is a big challenge in parameter and state estimation of WWTPs, investigation of simple and e¢ cient software sensors will be of great interest. It is recommended to cooperate with the sensor technology group at TUC. Bibliography Alcaraz-González, V., Harmand, J., Rapaport, A., Steyer, J., González-Alcaraz, V. & PelayoOrtiz, C. (2002), ‘Software sensors for highly uncertain wwtps: a new approach based on interval observers’, Water Research 36, 2515–2524. Andrews, J. (1974), ‘Dynamic models and control strategies for wastewater treatment processes’, Water Research 8, 261–289. Aubrun, C., Theilliol, D., Harmand, J. & Steyer, J. (2001), ‘Software sensor design for cod estimation in an anaerobic ‡uidized bed reactor’, Water Science and Technoloqy 43(7), 115–120. Baksaas, H. (1996), Analyse av avløpsrenseanlegget på Esso ra¢ neriet, Slagentangen for optimalisering, Master’s thesis, Telemark University College, P.O. Box 203, 3901 Porsgrunn, Norway. Balchen, J. & Mummé, K. (1988), Process control: structures and applications, ISBN 0-44221155-4, Van Nostrand Reinhold, New York. Balku, S. (2007), ‘Comparison between alternating aerobic-anoxic and conventional activated sludge systems’, Water Research 41, 2220–2228. Balku, S. & Berber, R. (2006), ‘Dynamics of an activated sludge process with nitri…cation and denitri…cation: Start-up simulation and optimization using evolutionary algorithm’, Computers and Chemical Engineering 30, 490–499. Bastogne, T. (2004), ‘A multiport diagram for batch system modeling: Methodology and implementation’, Simulation Modelling Practice and Theory 12, 425–449. Bequette, B. (2003), Process control: modeling, design, and simulation, ISBN 0-13-353640-8, Prentice Hall, New Jersey. Boaventura, K., Roqueiro, N., Coelho, M. & Araújo, O. (2001), ‘State observers for a biological wastewater nitrogen removal process in a sequential batch reactor’, Bioresource Technology 79, 1–14. Bogaerts, P. & Wouwer, A. (2004), ‘Parameter identi…cation for state estimation— application to bioprocess software sensors’, Chemical Engineering Science 59, 2465– 2476. 97 98 BIBLIOGRAPHY Bortolin, G., Borg, S. & Gutman, P. (2004), ‘Modeling of the wet end part of a paper mill with dymola’, Mathematics and Computers in Simulation 65, 31–38. Brosilow, C. & Joseph, B. (2002), Techniques of model-based control, ISBN 0-13-028078-X, Prentice Hall PTR, Upper Saddle River, New Jersey. Brouwer, H., Klapwijk, A. & Keesman, K. (1997), ‘Identi…cation of activated sludge and wastewater characteristics using respirometric batch-experiments’, Wat. Res. 32(4), 1240–1254. Brun, R., Kühni, M., Siegrist, H., Gujer, W. & Reichert, P. (2002), ‘Practical identi…ability of ASM2d parameters - systematic selection and tuning of parameter subsets’, Water Research 36(16), 4113–4127. Brun, R., Reichert, P. & Künsch, H. R. (2001), ‘Practical identi…ability analysis of large environmental simulation models’, Water Resour. Res. 37(4), 1015–1030. Bubnicki, Z. (2005), Modern control theory, ISBN 3-540-23951-0, Springer, Berlin. Camacho, E. & Bordons, C. (2004), Model predictive control, ISBN 1-85233-694-3, second edn, Springer, London. Chachuat, B., Roche, N. & Lati…, M. (2001), ‘Dynamic optimisation of small size wastewater treatment plants including nitri…cation and denitri…cation processes’, Computers & Chemical Engineering 25, 585–593. Chachuat, B., Roche, N. & Lati…, M. (2005), ‘Long-term optimal aeration strategies for small-size alternating activated sludge treatment plants’, Chemical Engineering and Processing 44, 593–606. Chai, Q. (2005), Application of the MATLAB OPC Toolbox. Technical report (unpublished), Telemark University College, Norway. Chen, C. (1999), Linear system theory and design, ISBN 0-19-511777-8, 3rd edn, Oxford university press, New York. Collivignarelli, C. & Bertanza, G. (1999), ‘Simultaneous nitri…cation-denitri…cation processes in activated sludge plants: performance and applicability’, Water Science Technology 40(4–5), 187–194. Crassidis, J. & Junkins, J. (2004), Optimal estimation of dynamic systems, ISBN 1-58488391-X, Chapman & Hall/CRC. Darby, M. & Nikolaou, M. (2007), ‘A parametric programming approach to moving-horizon state estimation’, Automatica 43, 885–891. Darouach, M., Zasadzinski, M., Onana, A. & Nowakowski, S. (1995), ‘Kalman …ltering with unknown inputs via optimal state estimation of singular systems’, International Journal of Systems Science 26(10), 2015–2028. Available at http://hal.archives-ouvertes.fr/hal00143941/en/, accessed 1 June 2007. BIBLIOGRAPHY 99 Dempsey, M. (2003), Automatic translation of Simulink models into Modelica using Simelica and the AdvancedBlocks library, in P. Fritzson, ed., ‘Proceedings of the 3rd International Modelica Conference’, Linköping, Sweden, pp. 115–124. Dochain, D. (2003), ‘State and parameter estimation in chemical and biochemical processes: a tutorial’, Journal of Process control 13, 801–818. Dochain, D. & Chen, L. (1992), ‘Local observability and controllability of stirred tand reactors’, Journal of Process Control 2(3), 139–144. Dochain, D. & Vanrolleghem, P. (2001), Dynamical modelling and estimation in wastewater treatment processes, ISBN 1900222 50 7, IWA Publishing, London, UK. Dochain, D., Vanrolleghem, P. & van Daele, M. (1995), ‘Structural identi…ability of biokinetic models of activated sludge respiration’, Wat. Res. 29(11), 2571–2578. Droste, R. (1997), Theory and practice of waste and wastewater treatment, ISBN 0-47112444-3, John Wiley & Sons, USA. Dueñas Díez, M. (2004), Population balance modeling and passivity-based control of particulate processes, applied to the Silgrain process, PhD thesis, Telemark University College, P.O. Box 203, N-3901 Porsgrunn, Norway. Dueñas Díez, M., Fjeld, M., Andersen, E. & Lie, B. (2006), ‘Validation of a compartmental population balance model of an industrial leaching process: The Silgrain(R) process’, Chem. Engng. Sci. 61, 229–245. Dynasim (2004), Dymola Multi-Engineering Modeling and Simulation: Dymola user manual, Dynasim AB, Lund, Sweden. Dynasim (2007), ‘Dymola release notes’. http://www.dynasim.se/update, accessed 10 July 2007. Ferrero, C. (2005), Parameter estimation for model of biological wastewater treatment, Master’s thesis, Telemark University College, Porsgrunn, Norway. Fritzson, P. (2004), Principles of Object-Oriented Modeling and Simulation with Modelica 2.1, IEEE Press, Piscataway, NJ. ISBN 0-471-47163-1. Gauld, A. (2000), Learn to program using Python, ISBN 0-201-70938-4, Addison-Wesley, Upper Saddle River, NJ 07458. Gelb, A., ed. (1992), Applied optimal estimation, ISBN 0-262-20027-9, The M.I.T. Press, Massachusetts. Gernaey, K. V., Loosdrecht, M. C. V., Henze, M., Lind, M. & Jørgensen, S. B. (2004), ‘Activated sludge wastewater treatment plant modelling and simulation: State of the art’, Environmental Modelling and Software 19, 763–783. 100 BIBLIOGRAPHY Grewal, M. & Andrews, A. (2001), Kalman …ltering: theory and proctice using MATLAB, ISBN 0-471-39254-5, second edn, John Wiley & Sons, New York. Gujer, W., Henze, M., Mino, T., Matsuo, T., Wentzel, M. & Marais, G. (1995), ‘The activated sludge model no. 2: Biological phosphorus removal’, Wat. Sci. Tech. 31(2), 1–11. Gujer, W., Henze, M., Mino, T. & van Loosdrecht, M. (1999), ‘Activated Sludge Model No. 3’, Wat. Sci. Tech. 39(1), 183–193. Ha, Q. & Trinh, H. (2004), ‘State and input simulteneous estimation for a class of nonlinear systems’, Automatica 40, 1779–1785. Hadj-Sadok, M. & Gouzé, J. (2001), ‘Estimation of uncertain models of activated sludge processes with interval observers’, Journal of Process Control 11, 299–310. Hao, O. & Huang, J. (1996), ‘Alternating aerobic-anoxic process for nitrogen removal: process evaluation’, Water Environ. Res. 68, 83–93. Haseltine, E. & Rawlings, J. (2005), ‘Critical evalution of extended Kalman …ltering and moving-horizon estimation’, Eng. Chem. Res. 44, 2451–2460. Hauge, T. (2003), Roll-out of model based control with application to paper machines, PhD thesis, Telemark University College, Porsgrunn, Norway. ISBN 82-471-5581-8. Heck, B. S., Wills, L. M. & Vachtsevanos, G. J. (2003), ‘Software technology for implementing reusable, distributed control systems’, IEEE Control Systems Magazine 23 (1), 19–35. Henson, M. (1998), ‘Nonlinear model predictive control: current status and future directions’, Compters and Chemical Engineering 23, 187–202. Henson, M. A. & Seborg, D. E. (1997), Nonlinear Process Control, Prentice Hall PTR, Upper Saddle River, NJ. ISBN 0-13-625179-X. Henze, M., Grady, C. J., Marais, W. G. G. & Matsuo, T. (1987), Activated Sludge Model No. 1, IAWPRC Scienti…c and Technical Report No. 1, London. Henze, M., Gujer, W., Mino, T., Matsuo, T., Wentzel, M. C., Marais, G. V. R. & van Loosdrecht, M. C. M. (1999), ‘Activated Sludge Model No. 2d, ASM2d’, Wat. Sci. Tech. 39(1), 165–182. Henze, M., Gujer, W., van Loosdrecht, M. C. M. & Mino, T. (2000), Activated Sludge Models ASM1, ASM2, ASM2d and ASM3., Vol. 9 of Scienti…c and Technical Report, IWA Publishing. Holenda, B., Domokos, E., Rédey, Á. & Fazakas, J. (2007), ‘Dissolved oxygen control of the activated sludge wastewater treatment process using model predictive control’, Computers and Chemical Engineering . In press. Hu, Z., Wentzel, M. & Ekama, G. (2003), ‘Modelling biological nutrient removal activated sludge systems –a review’, Water Research 37, 3430–3444. BIBLIOGRAPHY 101 INCOOP (2007), ‘Referat fra INCOOP workshop 23-24 jan 2003’. http://www.nt.ntnu.no/users/skoge/prost_mail/latest/0004.html, accessed July 2007. Ip, S., Bridger, J. & Mills, N. (1987), ‘E¤ect of alternating aerobic and anaerobic conditions on the economics of the activated sludge system’, Wat. Sci. Tech. 19(Rio), 911–918. Isaacs, S. (1997), ‘Automatic adjustment of cycle length and aeration time for improved nitrogen removal in an alternating activated sludge process’, Wat. Sci. Tech. 35, 225– 232. Isaacs, S. & Thornberg, D. (1998), ‘A comparison between model and rule based control of a periodic activated sludge process’, Wat. Sci. Tech. 37(12), 343–351. Jenkins, D. (2007), ‘Principle of biological phosphorus removal’, Presentation on IWPCA 89th Annual Conference. Available at http://www.iawpca.org, accessed 31 January 2008. Jeppsson, U. (1996), Modelling aspects of wastewater treatment processes, PhD thesis, Lund Institute of Technology, Lund, Sweden. Available at http://www.iea.lth.se/ielulf/publications/phd-thesis/PhD-thesis.pdf (accessed July 2007). Julier, S. & Uhlmann, J. (2004), ‘Unscented …ltering and nonlinear estimation’, Proceddings of the IEEE 92(3), 401–422. Julier, S., Uhlmann, J. & Durrant-Whyte, H. (1995), ‘A new approach for …ltering nonlinear systems’, American control conference pp. 1628–1632. Kabouris, J. & Georgakakos, A. (1990), ‘Optimal control of the activated sludge process’, Wat. Res. 24(10), 1197–1208. Kandepu, R., Foss, B. & Imsland, L. (2008), ‘Applying the unscented Kalman …lter for nonlinear state estimation’, Journal of Process Control xxx, xxx–xxx. In Press. Keesman, K. (2002), ‘State and parameter estimation in biotechnical batch reactors’, Control Engineering Practice 10, 219–225. Kim, H., McAvoy, T., Anderson, J. & Hao, O. (2000), ‘Control of an alternating aerobicanoxic activated sludge system — part 2: optimization using a linearized model’, Control Engineering Practice 8, 279–289. Kimochi, Y., Inamori, Y., Mizuochi, M., Xu, K. & Matsumura, M. (1998), ‘Nitrogen removal and n2o emission in a full-scale domestic wastewater treatment plant with intermittent aeration’, Journal of Fermentation and Bioengineering 86(2), 202–206. Kiusalaas, J. (2005a), Numerical methods in engineering with MATLAB, ISBN 978-0-52185288-3, Cambridge University Press, Cambridge. 102 BIBLIOGRAPHY Kiusalaas, J. (2005b), Numerical methods in engineering with Python, ISBN 978-0-521-852876, Cambridge University Press, Cambridge. Kouvaritakis, B. & Cannon, M., eds (2001), Nonlinear predictive control: theory and practice, ISBN 0 85296 984 8, The Institute of Electrical Engineers, Stevenage, England. Kurtz, M. & Henson, M. (1998), ‘State and disturbance estimation for nonlinear systems a¢ ne in the unmeasured variables’, Computers Chem. Engng 22, 1441–1459. Langtangen, H. P. (2006), Python scripting for computational science, ISBN 3-540-29415-5, second edn, Springer, Berlin. Lewis, F. (1986), Optimal estimation, ISBN 0-471-83741-5, Jon Wiley & Sons, Georgia. Lie, B., Dueñas Díez, M. & Hauge, T. A. (2005), ‘A comparison of implementation strategies for MPC’, Modeling, Identi…cation and Control 26, 39–50. Lindberg, C. (1997), Control and estimation strategies applied to the activated sludge process, PhD thesis, Uppsala University. Ljung, L. (1999), System Identi…cation. Theory for the User, ISBN 0-13-656695-2, second edn, Prentice Hall, Upper Saddle River, New Jersey. Lukasse, L., Keesman, K., Klapwijk, A. & van Straten, G. (1998), ‘Optimal Control of N-removal in ASPs’, Wat. Sci. Tech. 38, 255–262. Lukasse, L., Keesman, K., Klapwijk, A. & van Straten, G. (1999), ‘A comparison of NH4/NO3 control strategies for alternating activated sludge processes’, Wat. Sci. Tech. 39, 93–102. Lukasse, L., Keesman, K. & van Straten, G. (1997), Identi…cation for model predictive control of biotechnological processes, case study: nitrogen removal in an activated sludge process, in ‘Proc. 11th IFAC Symp. on Syst. Ident.’, Fukuoka, Japan, pp. 1525–1530. Lukasse, L., Keesman, K. & van Straten, G. (1999a), ‘l1-norm optimal control of n-removal in an activated sludge process’, Control Engineering Practice 7, 63–70. Lukasse, L., Keesman, K. & van Straten, G. (1999b), ‘A recursively identi…ed model for shortterm predictions of nh4/no3-concentrations in alternating activated sludge processes’, Journal of Process Control 9, 87–100. Lund, B. & Foss, B. (2008), ‘Parameter ranking by orthogonalization— applied to nonlinear mechanistic models’, Automatica 44, 278–281. Lunze, J. (1992), Feedback control of large scale systems, ISBN 0-13-318353-X, Practice Hall International, Salisbury, England. Lutz, M. & Ascher, D. (2003), Learning Python, ISBN 0-596-00281-5, second edn, O’Reilly Media. BIBLIOGRAPHY 103 Maciejowski, J. (2002), Predictive control: with constraints, ISBN 0 201 39823 0 PPR, Prentice Hall, Harlow, England. Ma¤ezzoni, C., Ferrarini, L. & Carpanzano, E. (1999), ‘Object-oriented models for advanced automation engineering’, Control Engineering Practice 7, 957–968. MathWorks (2007), ‘MATLAB and Simulink http://www.mathworks.com, accessed 10 July 2007. for technical computing’. Metcalf & Eddy, I. (2003), Wastewater Engineering. Treatment and Reuse, fourth edn, McGraw Hill, New York. Nakajima, J. & Kaneko, M. (1991), ‘Practical performance of nitrogen removal in smallscall sewage treatment plants operated in intermittent aeration mode’, Wat. Sci. Tech. 23(Kyoto), 709–718. Olsson, G. & Jeppsson, U. (2006), ‘Plant-wide control: dream, necessity or reality?’, Wat. Sci. Tech. 53(3), 121–129. Olsson, G. & Newell, B. (1999), Wastewater Treatment Systems. Modelling, Diagnosis and Control, IWA Publishing, London. Olsson, G., Nielsen, M., Yuan, Z., Jensen, A. & Steyer, J. (2005), Instrumentation, control and automation in wastewater systems, ISBN 1900222833, IWA publishing, London. Perrier, M., de Azevedo, S., Ferreira, E. & Dochain, D. (2000), ‘Tuning of observer-based estimators: theory and application to on-line estimation of kinetic paramters’, Control Engineering Practice 8, 377–388. Petersen, B. (2000), Calibration, identi…ability and optimal experimental design of activated sludge models, PhD thesis, Department of Applied Mathematics Biometrics and Process Control (BIOMATH), University of Gent, Available at https://archive.ugent.be/retrieve/738/19957980.pdf, accessed 7 June 2007. Pina, L. & Botto, M. (2006), ‘Simultaneous state and input estimation of hybrid systems with unknown inputs’, Automatica 42, 755–762. Plett, G. (2006a), ‘Sigma-point Kalman …ltering for battery management systems of LiPBbased HEV battery packs — Part 1: introduction and state estimation’, Journal of Power Sources 161, 1356–1368. Plett, G. (2006b), ‘Sigma-point Kalman …ltering for battery management systems of LiPBbased HEV battery packs — Part 2: simultaneous state and parameter estimation’, Journal of Power Sources 161, 1369–1384. Potter, T., Koopman, B. & Svoronos, S. (1996), ‘Optimization of a periodic biological process for nitrogen removal from wastewater’, Water Research 30(1), 142–152. PSE (2006), ‘gPROMS’. http://www.psenterprise.com/gproms/, accessed 11 July 2007. 104 BIBLIOGRAPHY Qin, S. & Badgwell, T. (2003), ‘A survey of industrial model predictive control technology’, Control Engineering Practice 11, 733–764. Rawlings, J. & Bakshi, B. (2006), ‘Particle …ltering and moving horizon estimation’, Computer & Chemical Engineering 30, 1529–1541. Rawlings, J. & Ekerdt, J. (2002), Chemical reactor analysis and design fundamentals, ISBN 0-615-11884-4, Nob Hill Publishing, Madison. Ray, W. (1981), Advanced process control, ISBN 0-07-051250-7, McGraw-Hill Book Company, New York. Reichl, G. (2003), ‘WasteWater a library for modelling and simulation of wastewater treatment plants in modelica’, Proceedings of the 3rd International Modelica Conference pp. 171–176. Robertson, D. & Lee, J. (1995), ‘A least squares formulation for state estimation’, Journal of Process Control 5(4), 291–299. Rossiter, J. (2003), Model-based predictive control: a practical approach, ISBN 0-8493-1291-4, CRC Press, Florida. Rugh, W. (1996), Linear system theory, ISBN 0-13-441205-2, 2nd edn, Prentice-Hall, New Jersey. Russell, S., Robertson, D., Lee, J. & Ogunnaike, B. (2000), ‘Model-based quality monitoring of batch and semi-batch processes’, Journal of Process Control 10, 317–332. Samuelsson, P. (2005), Control of nitrogen removal in activated sludge processes, PhD thesis, Uppsala University, Uppsala, Sweden. Schmitz, G., ed. (2005), MOSILAB: development of a Modelica based generic simulation tool supporting model structural dynamics, the 4th International Modelica Conference, the 4th International Modelica Conference, Hamburg. Seborg, D., Edgar, T. & Mellichamp, D. (2004), Process dynamics and control, ISBN 0-47145246-7, second edn, Wiley, New Jersey. Simon, D. (2006), Optimal state estimation, ISBN-13 978-0-471-70858-2, John Wiley & Sons, Hoboken, NewJersey. Simon, D. & Simon, D. (2003), Kalman …ltering with inequality constraints for turbofan engine health estimation, Technical Memorandum NASA/TM–2003-212111, National Aeronautics and Space Administration (NASA), Washington, DC 20546-0001. Söderström, T. & Stoica, P. (1989), System identi…cation, IBSN 0-13-881236-5, Prentice Hall International, New York. Sontag, E. (1998), Mathematical control theory: deterministic …nite dimensional, ISBN 0387-98489-5, 2nd edn, Springer, New York. BIBLIOGRAPHY 105 Soroush, M. (1998), ‘State and parameter estimations and their applications in process control’, Computers & Chemical Engineering 23, 229–245. Stewart, G. (1987), ‘Collinearity and least squares regression’, Statistical Science 2(1), 68–84. Sunan, H., Kiong, T. & Heng, L. (2002), Applied predictive control, ISBN 1-85233-338-3, Springer, London. Takács, I., Patry, G. & Nolasco, D. (1991), ‘A dynamic model of the clari…cation — thickening process’, Wat. Res. 25(10), 1263–1271. Theilliol, D., Ponsart, J., Harmand, J., Join, C. & Gras, P. (2003), ‘On-line estimation of unmeasured inputs for anaerobic wastewater treatment processes’, Control Engineering Practice 11, 1007–1019. Tiller, M. (2001), Introduction to physical modeling with Modelica, ISBN 0-7923-7367-7, Kluwer Academic Publishers, Massachusetts. Tummescheit, H. (2002), Design and Implementation of Object-Oriented Model Libraries Using Modelica, PhD thesis, Lund Institute of Technology, Lund, Sweden. van der Merwe, R. & Wan, E. (2001), ‘The square-root unscented Kalman …lter for state and parameter estimation’. http://speech.bme.ogi.edu/publications/ps/merwe01a.pdf. VanDyke, M., Schwartz, J. & Hall, C. (2004), ‘Unscented Kalman …lter …ltering for spacecraft attitude state and parameter estimation’. Available at http://www.aoe.vt.edu/c̃dhall/papers/AAS04-115.pdf, accessed 31 May 2007. Vanrolleghem, P., van Daele, M. & Dochain, D. (1995), ‘Practical identi…ability of a biokinetic model of activated sludge respiration’, Wat. Res. 29, 11. Videla, J. (2007), Dymola-Dymosim: functionalities and interfaces with external environments. Technical report (unpublished), Telemark University College, Norway. Walter, E. & Pronzato, L. (1997), Identi…cation of Parametric Models from Experimental Data, ISBN 3-540-76119-5, Springer, Berlin. Wan, E. & van der Merwe, R. (2000), The unscented Kalman …lter for nonlinear estimation, in ‘Proc. of IEEE Symposium 2000 (AS-SPCC)’, Lake Louise, Alberta, Canada. Weijers, S. (2000), Modelling, identi…cation and control of activated sludge plants for nitrogen removal, PhD thesis, Technische Universiteit Eindhoven. Weijers, S. & Vanrolleghem, P. (1997), ‘A procedure for selecting best identi…able parameters in calibrating activated sludge model No. 1 to full-scale plant data’, Wat. Sci. Tech. 36(5), 69–79. Zhao, H., Isaacs, S., Søeberg, H. & Kümmel, M. (1994a), ‘A Novel Control Strategy for Improved Nitrogen Removal in an Alternating Activated Sludge Process — Part II. Control Development’, Wat. Res. 28, 535–542. 106 BIBLIOGRAPHY Zhao, H., Isaacs, S., Søeberg, H. & Kümmel, M. (1994b), ‘Nonlinear optimal control of an alternating activated sludge process in a pilot plant’, Journal of Process Control 4(1), 33–43. Part II Published and Submitted Papers 107 Paper A: Systematic Analysis of Parameter Identi…ability for Improved Fitting of a Biological Wastewater Model to Experimental Data This paper was …rst presented at the conference and published in the Proceedings of the Scandinavian Conference on Simulation and Modeling 2005 (SIMS 2005) held in Trondheim, Norway, 13 – 14 October 2005. Extension of the paper was published in Modeling, Identi…cation and Control Volume 27, Number 4, pp. 219 –238. The topic of this paper was studied by Ferrero (2005) in the master thesis during her stay at Telemark University College in spring 2005. The author of this PhD thesis actively participated in the entire process of this study, and further developed applications of the proposed method in her PhD research activities (see Paper B). 109 110 MODELING, IDENTIFICATION AND CONTROL, 2006, VOL. 27, NO. 0, 000–000 Systematic Analysis of Parameter Identiﬁability for Improved Fitting of a Biological Wastewater Model to Experimental Data¶ CRISTINA SARMIENTO FERRERO†, QIAN CHAI†, MARTA DUEÑAS DÍEZ‡, SVERRE H. AMRANI§ and BERNT LIE*† Keywords: ASM2d, identiﬁability analysis, parameter estimation, model ﬁtting In this paper, a general description of wastewater treatment based on activated sludge is given, with emphasis on the ASM2d model. Particular emphasis has been given to make the presentation readable without a too detailed prior knowledge of wastewater treatment. Next, a method for experimental parameter identiﬁability analysis is described. After a presentation of the wastewater treatment plant at Duvbacken in Gävle, Sweden, the experimental identiﬁability of the dynamic model is analyzed. Out of the 45 original parameters in the model, the analysis indicates that with the given experimental conditions, 12 parameters can be identiﬁed. 1. Introduction Water is one of our most precious resources, and wastewater treatment is becoming more and more important in a highly populated, industrialized world. Wastewater contains organic matter and microorganisms, and the microorganisms thus deplete the water for oxygen. Furthermore, nitrogen and phosphorous content leads to algae growth. It is thus of importance to reduce the content of organic matter, as well as nitrogen and phosphorous. There are also safety regulations on the content of microorganisms, as well as on other content in the wastewater. See e.g. Metcalf & Eddy (2003) for an overview of characteristics of wastewater, and treatment of wastewater. Both for design and operation of wastewater treatment plants, it is of interest to develop models of how the plants transform the feed. One characteristic of wastewater feed is its highly varying ﬂow rate and composition (Olsson & Newell 1999). This implies that dynamic models are highly relevant for wastewater treatment plants. One such series of models are the Activated Sludge Models (ASM) (Henze, Harremoës, la Cour Jansen & Arvin 1996), which have been developed to include a description of organic content and decomposition, microorganisms, nitrogen processes, and phosphorous processes. In particular, ASM2d attempts to describe the important processes involved in the transformation of organic matter, nitrogen, and phosphorous (Henze, Gujer, van Loosdrecht & Mino 2000). The ASM models are parametric, and nominal parameter values are suggested in publications. However, the models are based on averages of microorganism and organic matter populations, and wastewater characteristics vary from plant to plant. It is thus necessary to ﬁt the model parameters to experimental data from a speciﬁc wastewater *Corresponding author: [email protected] †Telemark University College, P.O. Box 203, N-3901 Porsgrunn, Norway. ‡Hydro Corporate Research Center, Porsgrunn, Norway. §BioTek AS, Porsgrunn, Norway. ¶An early version of this paper was presented at SIMS 2005, the 46th Conference on Simulation and Modeling, Trondheim, Norway, October 13–14, 2005. 2 Cristina Sarmiento Ferrero et al. stream in order to ensure good predictive properties of a model (Jeppson 1993), (Brun, Kühni, Siegrist, Gujer & Reichert 2002). In this paper, we consider the Duvbacken wastewater treatment plant in Gävle, Sweden, which is designed to treat the municipal wastewater from 100.000 pe1. This plant has recently been modiﬁed to remove phosphorous, nitrogen, and organic matter, primarily using bacteria. In situations where the biology represented by the bacteria struggle to perform according to governmental efﬂuent criteria, chemicals are added as a supplement. The particular emphasis is to study the identiﬁability of parameters in a dynamic model of the plant, based on available experimental data. In this paper, real experimental data were unavailable, and the study is therefore based on simulated data. However, the procedure can be used without modiﬁcation with real data. In section 2 of the paper, an overview of principles for modeling biological wastewater treatment (BWWT) is given. In section 3, basic principles of parameter identiﬁability are discussed. In section 4, a plant at Duvbacken, Gävle, is presented, and a model of the plant is veriﬁed. In section 5, identiﬁability analysis for the Duvbacken model is carried out, and some results of model ﬁtting are given. Finally, some conclusions are drawn. 2. Biological Wastewater Treatment 2.1. Wastewater characterization and treatment Due to the importance of clean water, wastewater treatment is a large and growing industry throughout the world. Microorganisms in water tend to use dissolved oxygen (DO) while consuming organic and inorganic compounds, resulting in harmfully low concentrations of DO to the aquatic environment. Thus, a primary task in wastewater treatment is to remove the oxygen consuming pollutants and their feed. Other pollutants consisting of nitrogen and phosphorous lead to eutrophication, which is the accelerated ageing of lakes and estuaries due to excessive plant and algal growth. It is thus in addition important to remove nitrogen and phosphorous compounds from wastewater. The composition of wastewater depends on its source; important classes of wastewaters are industrial and domestic wastes. The latter, sewage, consists of substances such as ground garbage, laundry water, and excrement. More than 99% of wastewater is water, and about 0.5 g/l is suspended solids such as cellulose and organic matter in the form of fatty acids, carbohydrates, and proteins. The bad odor of sewage stems from protein decomposition under anaerobic2 conditions. Sewage contains a varied population of microorganisms such as bacteria, which must not be mixed into drinking water. Still, microorganisms are useful in transforming dissolved substances into particulate substances which can then be removed from the wastewater. As mentioned, one problem with wastewater is that it contains carbonaceous matter which through chemical reactions depletes water for oxygen. The simplest measure of the content of such matter, is the biochemical oxygen demand (BOD): the BOD is equal to the amount of dissolved oxygen that is consumed by the wastewater when incubated for a speciﬁed length of time at 20°C, typically for 5 or 7 days (BOD5 or BOD7, respectively); BOD measures the oxidation of organic matter. A better measure is the 1 2 pe ⫽ person equivalents. Anaerobic, i.e., without the presence of oxygen or oxides. Systematic Analysis of Parameter Identiﬁability Table 1. 3 Typical composition of domestic waste water, with indication of efﬂuent standards. From Bailey & Ollis (1986). Parameter BOD, mg/l COD, mg/l Suspended solids, mg/l Nitrogen, mg/l Total phosphorous, mg/l Inﬂuent raw wastewater Efﬂuent in an acceptable plant 100 ⫺ 250 200 ⫺ 700 100 ⫺ 400 20 ⫺ 30 6 ⫺ 10 5 ⫺ 15 15 ⫺ 75 10 ⫺ 25 2⫺5 0.2 ⫺ 0.6 chemical oxygen demand (COD), both because it can be measured routinely in a couple of hours3 (Bailey & Ollis 1986), but also because it gives a more accurate measure of the carbonaceous content: COD measures the oxidation of both organic and inorganic matter. Other undesirable components in wastewater are nitrogen, typically in the form of ammonia (NH3), and phosphorous. In addition, wastewater holds both larger objects and readily settleable solids, as well as oil ﬁlms and other components such as heavy metals and toxic organics. Table 1 illustrates typical feed compositions and efﬂuent standards for sewage. A wastewater treatment plant typically consists of two or three stages. In the primary stage, easily separable particles (boulders—ﬂoc particles, etc.) are removed. In the secondary stage, suspended particles and soluble materials are removed, while in the tertiary stage, remaining contaminants (subcolloidal and soluble materials) are removed, the water is treated chemically to remove bacteria, etc. In this paper, we will concentrate on the secondary stage, where the wastewater has a muddy consistence and where oxygen is added. Under such oxygenated conditions, microorganisms thrive, forming an active suspension of biological solids (mostly bacteria) called an activated sludge. 2.2. Wastewater species Essentially, microorganisms metabolize and breed while consuming substrate4. In this process, the microorganisms synthesize and secrete a polysaccharide gel causing the microbes to agglomerate into ﬂocs (Bailey & Ollis 1986). These ﬂocs have a high afﬁnity for suspended matter (substrate, etc.), and ﬂocculation thus enables the removal of microorganisms and substrate through sedimentation. Wastewater contains a large number of microorganisms and substrate, and it is necessary to simplify the description of the components. In the sequel, the components that are detailed are those used in the Activated Sludge Model 2d (ASM2d) (Henze, Gujer, Mino, Matsuo, Wentzel, Marais & van Loosdrecht 1999), (Henze et al. 2000). The structure of the presentation is similar to that of Jeppson (1993), although his is for ASM1. A minor simpliﬁcation of the presentation here compared to the full ASM2d, is that we neglect the possibility of phosphorous to bind to metal-hydroxides, and the associated chemical processes. In the presentation, we will follow the naming conventions of the Activated Sludge Models (ASM), which distinguish between dissolved 3 4 Or in a few minutes using sophisticated instruments. By substrate is meant nutrients (organic and inorganic matter, including oxygen) and energy. 4 Cristina Sarmiento Ferrero et al. component S and particulate component X. Subscripts are attached to distinguish between the various dissolved and particulate components. As wastewater contains a wide variety of e.g. organic matter, a precise model would need to use population balances. In the ASM, average species are considered in order to simplify the models. In the description, S or X (with subscript) refer both to a specie, and to the concentration of the specie. Organic substrate is considered to be either biodegradable, or unbiodegradable. The unbiodegradable matter can be either soluble (small species) or particulate (larger species); in both cases, it is considered inert matter, and named SI and XI, respectively. The biodegradable matter is substrate for the organisms, and can be either soluble (small species/molecules) or particulate (larger species). Particulate biodegradable matter XS is too large to pass through the cell walls of the microorganisms, and must ﬁrst be decomposed—which is time consuming, thus XS is denoted slowly biodegradable substrate. Soluble biodegradable matter is readily biodegradable. ASM2d distinguishes between fermentable biodegradable substrate SF, and the biodegradable fermentation product SA (assumed to be acetate CH3 CO2⫺ in later analysis). In ASM1, there was no distinction between SF and SA, and SS ⫽ SF ⫹ SA was used there. Inorganic substrate consists of small molecules, which are soluble. In addition to oxygen SO2 (O2), these are nitrous components such as nitrogen SN2 (N2), ammonium SNH4 (some ammonia NH3, but mainly ammonium ion NH4⫹ ; assumed to be 100% ammonium ion in stoichiometric computations), nitrogen oxides SNO3 (nitrate NO3⫺ and nitrite NO2⫺ ; for stoichiometric computations assumed to be 100% nitrate), and inorganic soluble phosphorous SPO4 (primarily ortho-phosphates, which are anions of the inorganic chemical compound of phosphoric acid H3 PO4; for stoichiometric computations assumed to consist of 50% H2 PO4⫺ and 50% HPO24 ⫺ ). To facilitate the computation of pH and charge balance, the alkalinity of wastewater is described by SALK (for stoichiometric computations assumed to be bicarbonate HCO3⫺ ). Several types of microorganisms exist in wastewater; all of these are considered to be particulate. Heterotrophic organisms XH require organic compounds as their substrate; they are responsible for hydrolysis5 of slowly biodegradable substrate XS into smaller components, and grow aerobically6 and anoxically7, as well as are active in anaerobic8 fermentation. Autotrophic organisms XAUT require inorganic compounds as their substrate; they are responsible for nitriﬁcation under aerobic conditions, where ammonium SNH4 is oxidized directly into nitrogen oxides SNO3. Finally, there are phosphate-accumulating organisms (PAO), XPAO; these may grow in both anoxic and aerobic environments. In addition to the phosphorous accumulating organisms XPAO mentioned above, two types of cell internal storage products associated with PAO are considered: XPHA includes primarily organic poly-hydroxyalkanoates (assumed to be poly-hydroxy-butyrate (C4 H6 O2)n in stoichiometric computations), and inorganic poly-phosphates XPP (assumed to be 5 Chemical decomposition of matter by the splitting of a bond and the addition of the hydrogen cation H ⫹ and the hydroxide anion OH ⫺ of water. 6 Aerobic ⫽ requires the presence of oxygen; SO2 ⬎ 0. 7 Anoxic ⫽ extracts oxygen from nitrate oxides; SO2 ⬇ 0, SNO3 ⬎ 0. In this process, nitrate NO3 is converted to N2, hence this process is also denoted denitriﬁcation. 8 Anaerobic ⫽ requires the absence of oxygen and nitrate oxides; SO2 ⬇ 0, SNO3 ⬇ 0. Systematic Analysis of Parameter Identiﬁability 5 (K0.33 Mg0.33 PO3)n in stoichiometric computations). The phosphorous contents of XPHA and XPP are not included in XPAO. Finally, since phosphorous removal and precipitation introduces mineral fractions in the wastewater which are not included in the other components, a total suspended solids XTSS is introduced. 2.3. Wastewater processes The overall chemical process taking place in BWWT can be described as (Metcalf & Eddy 2003): 1 (organic material) ⫹ 2O2 ⫹ 3NH3 ⫹ 4PO34 ⫺ → 5(new cells) ⫹ 6CO2 ⫹ 7H2O, where the j-s are stoichiometric coefﬁcients and it is assumed that microorganism enzymes have a catalytic effect on the reaction, but also that microorganisms grow and breed (new cells). Essentially, organic material is transformed into new cells under the consumption of oxygen, ammonia, and phosphorous components, producing water, CO2, and new cells which ﬂocculate and may sediment. In a realistic mathematical model, a more detailed set of stoichiometric reactions must be incorporated. In the following description of the chemical processes taking place between substrate and microorganisms, coefﬁcients j, ij, fj, and Yj constitute a parameterization of the stoichiometric coefﬁcients (Henze et al. 1999); in all chemical reactions below, the parameterized stoichiometric coefﬁcients are positive. Four groups of chemical processes are introduced: Hydrolysis processes (decomposition of slowly biodegradable organic substrate XS), Processes of facultative heterotrophic organisms9 (metabolism and breeding of XH, etc.), Processes of phosphorous-accumulating organisms (involving XPAO and their cell-internal storages XPHA and XPP), and Nitriﬁcation processes (involving SNH4, SNO3, and SN2). A ﬁnal comment before going into the some details of the chemical processes in wastewater treatment: there are some inconsistencies in Henze et al. (1999). As an example, in their Table 3, the stoichiometric coefﬁcients for “Aerobic growth on SF” are given, involving a number of species. However, in their summary Table 11, more species appear to be involved in the “reaction” than in their Table 3. The same is true for other processes. In the discussion below, the species that are discussed in their section “Biological processes, stoichiometry and kinetics” are underlined in the reaction schemes (the main species), while the additional species (as of their Table 11) are kept without underlining, and are given an arbitrary stoichiometric coefﬁcient j. Hydrolysis: The following hydrolysis (decomposition) reactions take place on slowly biodegradable substrate XS, catalyzed by enzymes in three classes of microorganisms, and split into soluble unbiodegradable SI and fermentable SF matter with a splitting factor fSI: XS ⫹ ( ⫺ j, TSS)XTSS → fSI SI ⫹ (1 ⫺ fSI)SF ⫹ j, NH4SNH4 ⫹ j, PO4SPO4 ⫹ j, ALKSALK where, j ⫽ 1 is aerobic hydrolysis (SO2 ⬎ 0), j ⫽ 2 is anoxic hydrolysis (SO2 ⬇ 0, SNO3 ⬎ 0), and j ⫽ 3 is anaerobic hydrolysis (SO2 ⬇ 0, SNO3 ⬇ 0). 9 Facultative ⫽ exhibiting a certain behavior under some environmental conditions, but not under other conditions. 6 Cristina Sarmiento Ferrero et al. Facultative heterotrophic organisms: Facultative heterotrophic organisms metabolize and breed on substrates. Six chemical processes are considered. In oxygen based aerobic growth of XH on fermentable substrate SF: 冉 冊 1 1 SF ⫹ ⫺ 1 SO2 ⫹ 4, NH4SNH4 ⫹ 4, PO4SPO4 ⫹ 4, ALKSALK → XH ⫹ 4, TSS XTSS, YH YH in oxygen based aerobic growth of XH on fermentation products SA: 冉 冊 1 1 SA ⫹ ⫺ 1 SO2 ⫹ 5, NH4SNH4 ⫹ 5, PO4SPO4 → XH ⫹ 5, TSS XTSS ⫹ 5, ALKSALK, YH YH in nitrate based anoxic growth of XH on fermentable substrate SF: 1 ⫺ YH 1 ⫺ YH 1 SF ⫹ SNO3 ⫹ 6, NH4SNH4 ⫹ 6, PO4SPO4 → XH ⫹ SN YH 2.86YH 2.86YH 2 ⫹6, TSS XTSS ⫹ 6, ALKSALK, while in nitrate based anoxic growth of XH on fermentation products SA: 1 ⫺ YH 1 ⫺ YH 1 SA ⫹ SNO3 ⫹ 7, NH4SNH4 ⫹ 7, PO4SPO4 → XH ⫹ SN 2.86YH 2.86YH 2 YH ⫹7, TSSXTSS ⫹ 7, ALKSALK, Under anaerobic conditions (SO2 ⬇ 0, SNO3 ⬇ 0), the heterotrophic microorganisms do not grow. Instead XH catalyze fermentation of SF leading to fermentation products SA: SF ⫹ 8, ALKSALK → SA ⫹ 8, NH4SNH4 ⫹ 8, PO4SPO4. Finally, lysis reactions (decomposition/decay) occur in the heterotrophic organisms, where essentially XH is split into unbiodegradable matter XI and slowly biodegradable substrate XS with a certain splitting factor fXI: XH ⫹ 9, TSS XTSS → fXI XI ⫹ (1 ⫺ fXI)XS ⫹ 9, NH4SNH4 ⫹ 9, PO4SPO4 ⫹ 9, ALKSALK. Phosphorous-accumulating organisms: Organisms XPAO have the potential to accumulate phosphorous in the form of poly-phosphate XPP. Eight chemical processes are considered. Poly-hydroxy-alkanoates XPHA are created from fermentation products SA and stored10: SA ⫹ YPO4 XPP ⫹ 10, TSS XTSS → XPHA ⫹ YPO4SPO4 ⫹ 10, ALKSALK. Poly-phosphates XPP grow aerobically and anoxically: SPO4 ⫹ YPHASO2 ⫹ YPHA XPHA → XPP ⫹ 11, TSS XTSS ⫹ 11, ALKSALK, SPO4 ⫹ ( ⫺ 12, NO3) SNO3 ⫹ YPHA XPHA → XPP ⫹ ( ⫺ 12, NO3) SN2 ⫹12, TSS XTSS ⫹ 12, ALKSALK. 10 In Table 4 of Henze et al. (1999), XPHA is assigned the stoichiometric coefﬁcient 0 by misprint. Systematic Analysis of Parameter Identiﬁability 7 Likewise, the organisms XPAO grow aerobically and anoxically: iPBMSPO4 ⫹ 13, O2SO2 ⫹ 1 YPHA XPHA ⫹ 13, NH4SNH4 ⫹ 13, TSS XTSS ⫹ 13, ALKSALK → XPAO, iPBMSPO4 ⫹ ( ⫺ 14, NO3) SNO3 ⫹ 1 XPHA ⫹ 14, NH4SNH4 ⫹ 14, TSS XTSS → XPAO YPHA ⫹( ⫺ 14, NO3) SN2 ⫹ 14, ALKSALK. Finally, each of the phosphorous particles XPAO, XPP, and XPHA are prone to lysis (decomposition): XPAO ⫹ 15, TSS XTSS → fXIXI ⫹ (1 ⫺ fXI)XS ⫹ 15, PO4SPO4 ⫹ 15, NH4SNH4 ⫹ 15, ALKSALK, XPP ⫹ 16, TSS XTSS ⫹ 16, ALKSALK → SPO4 XPHA ⫹ 17, TSS XTSS ⫹ 17, ALKSALK → SA. Nitrifying organisms: In anoxic processes, autotrophic organisms utilize oxygen from nitrate ions (NO3⫺ , denitriﬁcation), producing nitrogen N2. This nitrate is produced in the nitriﬁcation process, which is a two step process, typically: 2 NH4⫹ ⫹ 3 O2 → 2 NO2⫺ ⫹ 4H ⫹ ⫹ 2 H2 O 2 NO2⫺ ⫹ O2 → 2 NO3⫺ . Since the reaction of nitrite (NO2⫺ ) into nitrate is very fast, nitrite will hardly be present, and it is convenient to operate with a simpliﬁed overall stoichiometric reaction: NH4⫹ ⫹ 2 O2 → NO3⫺ ⫹ 2 H ⫹ ⫹ H2 O. Utilizing the ASM notation, we write this nitriﬁcation process as: (⫺18, NH4) SNH4 ⫹ 4.57 ⫺ YA SO2 ⫹ iPBM SPO4 ⫹ 18, ALK SALK → YA 1 SNO3 ⫹ XAUT ⫹ 18, TSS XTSS YA Also, the autotrophic organisms are prone to lysis: XAUT ⫹ 19, TSSXTSS → fXI XI ⫹ (1 ⫺ fXI) XS ⫹ 19, NH4 SNH4 ⫹ 19, PO4 SPO4 ⫹ 19, ALK SALK. In Henze et al. (1999), two processes for chemical precipitation of phosphates are included; we have neglected these processes in our model. 2.4. Wastewater kinetics and dynamic models A stoichiometric equation for a chemical process is typically written as A A ⫹ B B → C C ⫹ D D ⫹ E E. 8 Cristina Sarmiento Ferrero et al. If A, B, C, D, and E are unrelated, we can not say much more about the stoichiometric coefﬁcients j. However, if A ⫽ NH4⫹ , B ⫽ O2, C ⫽ NO3⫺ , D ⫽ H ⫹ , and E ⫽ H2 O,11 conservation of atoms and charge dictates that A ⫽ k, B ⫽ 2k, C ⫽ k, D ⫽ 2k, and E ⫽ k, where k conveniently can be chosen as 1 (Smith & Missen 1991). We can use conservation of atoms and charge to relate the stoichiometric coefﬁcientsof the ASM2d, hence parametric description of the coefﬁcients i (Yj, fk, il ) can be found; see Henze et al. (1999) for typical parameters. With known stoichiometric equations and coefﬁcients, kinetic rate expressions matter j [ volume · time ] are needed, one for each chemical process. For all rates j, the rate is proportional to the concentration of the involved microorganism: 1. Hydrolysis and heterotroph growth depend on the presence of heterotroph organisms XH, hence ∀j 苸 {1, … , 9}⬊j ⬀ XH. 2. The processes depending on phosphorous-accumulating organisms XPAO have rates ∀j 苸 {10, … , 17}⬊j ⬀ XPAO. 3. Processes governed by nitrifying organisms (autotroph organisms) have rates ∀j 苸 {18, 19}⬊j ⬀ XAUT. Next, the hydrolysis process rates depend on the simultaneous presence of substrate XS and microorganism XH; these rates depend on how well XS covers the surface of XH, hence ∀j 苸 {1, 2, 3}⬊j ⬀ 冦 XS XH → 0 . XS → ⬁ XH XS /XH 0, → KX ⫹ XS /XH 1, Similar rate expressions are used for other processes where microorganisms catalyze transformation of material, e.g. for storage of XPHA (process 10) and aerobic storage of XPHA and XPP (processes 11 and 13). Finally, some switching functions are introduced in order to model how the rates depend on the presence or absence of substrates. As an example, aerobic processes are assumed to depend on the presence of oxygen, hence the rates are made proportional to ∀j 苸 {1, 4, 5, 11, 13, 18}⬊j ⬀ 再 SO2 0, SO2 → 0 → . KO2 ⫹ SO2 1, SO2 → ⬁ On the other hand, for anoxic and anaerobic processes that depend on the absence of oxygen, the rates are made proportional to either ∀j 苸 {2, 3, 6, 7, 8}⬊j ⬀ 再 1, K O2 → 0, KO2 ⫹ SO2 SO2 → 0 SO2 → ⬁ or ∀j 苸 {12, 14}⬊j ⬀ 再 KO2 ⬁, →→ SO2 0, S O2 → 0 . SO2 → ⬁ Similar switching functions are used to model the required presence or absence of nitrate SNO3. 11 The simpliﬁed nitriﬁcation process. Systematic Analysis of Parameter Identiﬁability 9 The full set of process rate equations j are given in Table 7 of Henze et al. (1999). The ﬁnal step in the modeling phase is to formulate specie balances, which typically have the form d mj ⫽ ṁi, j ⫺ ṁe, j ⫹ ṁg, j dt where mj is the accumulated mass of specie j (e.g. SF, XH, etc.), ṁi, j is the mass inﬂux of specie j into a system, ṁe, j is the mass efﬂux of specie j out of a system, and ṁg, j is the mass of specie j generated in a chemical reaction per time unit. For a well mixed system of volume V, 冘 K ṁg, j ⫽ V · k⫽1 k, jk, where K chemical processes are taking place; K ⫽ 19 in our slightly simpliﬁed ASM2d description. In our description, we use either 18 or 17 species, depending on whether we include SS ⫽ SF ⫹ SA or not. Thus, we will have 18 (or 17) differential equation for mass accumulation for each well mixed system volume in our biological wastewater treatment plant. 3. Parameter Identiﬁability 3.1. System, model, and parameter For a system S, assume that we have developed a model structure M with parameter 苸 Rn; the corresponding model is denoted M (). The (parametric) model may be based on a mechanistic understanding of the system S, or be a generic mathematical mapping. By varying over a feasible set , we get a set of models M (), i.e. a model structure M. In reality, the model behavior depends on the experimental conditions K ; K is a description of how an experiment has been carried out, including a sequence of inputs ut 苸 Rnu, t 苸 {1, … , T } to, and outputs yt 苸 Rny, t 苸 {1, … , T } from the real system S. With a given model M () and experimental conditions K , we can compute a model output ymt (M (), K ). We will simplify the notation for the model output to ymt (). With available model structure M () and experimental conditions K , we can attempt to ﬁnd a speciﬁc parameter ˆ which is such that the model output ymt (ˆ ) is close to the system output yt in some sense. To achieve this, we can choose from a set of identiﬁcation methods ⬃ I ; the estimate ˆ will also depend on the chosen identiﬁcation ⬃ ⬃ method ⬃ I . We will simplify the notation and write ymt (ˆ ) as ŷt. Usually, it is assumed that the real system S is an element of the model structure M () and has a true parameter * such that S is (input-output) identical to M (*). It is thus of interest to study whether and to what degree it is possible to ﬁnd the true system parameters * from the given model structure M (), experimental conditions K , and identiﬁcation method ⬃ I . We will denote this study an experimental parameter ⬃ identiﬁability study, since the result depends on the experimental conditions K (and to some degree on ⬃ I ). Another important study could be whether and to what degree * can ⬃ be found from M () if we allow any (conceivable) experimental conditions K ; this we will denote a theoretical parameter identiﬁability study. Clearly, the set of experimentally identiﬁable parameters will be a subset of the set of theoretically identiﬁable parameters. Examples of methods for studying theoretical parameter identiﬁability, are given in e.g. Pohjanpalo (1978) and Holmberg (1982), and in Ljung & Glad (1994); see also Walter & Pronzato (1997). However, for many 10 Cristina Sarmiento Ferrero et al. industrial processes it will be difﬁcult to get accept for carrying out active experiments, and it may be necessary to rely on the natural perturbation in the system. Thus, we may not be able to identify all the theoretically identiﬁable parameters in practice, and the experimental identiﬁability may give a better measure of the parameters which can be found. After a set of identiﬁable parameters have been found, these can be estimated using some identiﬁcation technique ⬃ I . Then, the statistical quality of the model parameters ˆ ⬃ and prediction model ŷt should be studied. Parameter identiﬁability and parameter estimation in mechanistic models has been widely studied in engineering (Bard 1974), (Beck & Arnold 1977), (Walter & Pronzato 1997), (Rawlings & Ekerdt 2002), (Ljung 1999), (Söderström & Stoica 1989). The systematic approach described in Brun, Reichert & Künsch (2001) seems well suited to Biological Waste Water Models, since it handles large simulation models, and provides identiﬁability diagnosis for parameter subsets. In the sequel, some background to the method of Brun et al. (2001) is given. 3.2. Practical identiﬁability analysis We assume that the output yt 苸 Rny ⫻ 1 and the model output y mt ( 兩 K ) are related by yt ⫽ y mt ( 兩 K ) ⫹ et, where et describes model error/uncertainty. Furthermore, both yt and ut are available for t 苸 {1, … , T } (experimental conditions K ) and we introduce the notation y ⫽ ym ( 兩 K ) ⫹ e to describe all the resulting equations; y, y m, e 苸 Rny · T ⫻ 1. With a perfect model structure and the correct parameter vector *, the error e will be e ⬅ 0 and y ⬅ y m (* 兩 K ). In the real world, e is unknown. A possible strategy is to set e ⫽ 0, and hope for a solution such that y ⫽ y m ( 兩 K ). We base the analysis on a linearized approximation of this equation, giving T · ny linear equations in n unknowns: S · ˆ ⫽ y, (1) 䉭 䉭 ⭸ym ˆ ⫺ i, S ⫽ i. ˆ ⫽ ⭸ ⫽ | 䉭 y ⫺ y m( i | K ), S is denoted the model sensitivity. where y ⫽ If no solutionexists, it is common to project y on the column space of S, yR (S), and solve S · ˆ ⫽ yR (S)—this equation always has a solution, which coincides with the solution of the corresponding normal equation from using the least squares method: S T S · ˆ ⫽ S T · y. (2) The chosen method for analyzing the identiﬁability of parameters, is based on Brun et al. (2001), see also Brun et al. (2002), Dueñas Dı́ez, Fjeld, Andersen & Lie (2006). This method is rooted in the linear equation of either equation 1, or 2. Essentially, these equations have a solution if the sensitivity matrix S has full rank. Clearly, if the jth column sj of matrix S is a zero vector, then matrix S exhibits rank loss and parameter j can not be found. Similarly, if 储 sj 储 is “small”, we may expect problems in ﬁnding j. However, even when all columns of S are signiﬁcantly different from zero vectors, we may have problems in ﬁnding if some column is linearly dependent on the other columns. This linear dependence is termed collinearity. Two possible measures of collinearity are the condition number j, and the smallest singular value min(S ). Scaling of outputs and parameters is essential, and it is recommended to use dimensionless quantities ỹt, i ⫽ yt, i /y䊊i and ˜ i ⫽ i /䊊i . In the sequel, it is assumed that such a scaling has been introduced as part of the preprocessing of the data. Systematic Analysis of Parameter Identiﬁability 11 deﬁned as In their method, Brun et al. (2001) consider the sensitivity measure msqr j 䉭 msqr j ⫽ 1 兹nyT 储 sj 储2. (3) Their strategy is then to sort the various parameters according to the value of msqr . If j there is a marked drop in the value of msqr for some j, then they propose to assume that j those parameters with the smallest sensitivity measure can not be found; hence these parameters are removed from the set of tunable parameters. It should be noted, however, that if the sensitivity measure decreases without marked jumps, and if it is within a couple of decades from the largest value, it may be unjustiﬁed to remove a parameter. In typical applications, a set of 10–20 parameters are often retained in the parameter set after the sensitivity screening described above. The chosen measure of collinearity index () is 䉭 () ⫽ 1 1 , ⫽ min(S̃ ) 兹min(S̃ TS̃ ) (4) where S̃ is a slightly modiﬁed sensitivity matrix where the columns have been normalized to unit norm. It should be noted that this measure is not necessarily a good measure of collinearity, see Stewart (1987) and Belsley (1991). Collinearity is a measure of how combinations of parameters interact, thus they propose to consider all possible subsets P of parameters of , and compute the collinearity index for all these possible subsets. Let p be one of these subsets, thus (p) is to be computed for all possible p 苸 P. It follows from basic combinatorics that the number of possible subsets with at least 2 parameters and at most n parameters is #(P) ⫽ 兺ni ⫽ 2 (ni); with n ⫽ 10, #(P) ⬇ 103, and with n ⫽ 20, #(P) ⬇ 106. In their papers, Brun et al. propose that when (p) ⬎ 10, parameter set p should be considered collinear. Thus, all parameter sets p for which (p) ⱕ 10 should be considered for further study, and parameter estimates for these sets p should be computed. The ﬁnal choice of parameters is then based on a statistical analysis of theparameters for which (p) is approximately less than 10. 4. The Duvbacken Plant Model 4.1. Process ﬂow description Wastewater ﬁrst undergoes pretreatment involving removal of coarse particles and primary sedimentation of particles. Referring to Figure 1, the pretreated wastewater together with sludge return enters the anaerobe reactor step consisting of three parallel lines, each line consisting of two separate volumes in series, i.e. the anaerobe reactor step consists of a total of 6 separate volumes—each of which is supplied with mixers. The main purpose of the anaerobic reactor step, is to make conditions suitable for biological phosphorous removal. Aerobe reactor step 1 has the same physical conﬁguration as has the anaerobe reactor step, that is, three parallel lines, each line consisting of two separate volumes. All six volumes are aerated, either by continuous aeration or by intermittent aeration. The air is supplied from three blowers, serving a common air line distributing air to each of the six volumes—which in principle can be controlled independently—where the air enters each volume through about 140 aeration membrane dishes. The outlets from the three parallel lines converge into a common efﬂuent line. 12 Cristina Sarmiento Ferrero et al. Figure 1. Flowsheet of the Duvbacken Waste Water Treatment Plant. As can be seen from Figure 1, it is also possible to bypass a certain portion of the pretreated wastewater directly to aerobe reactor step 2. The reason for this is that efﬂuent from the pre-treatment is rich in readily biodegradable organic matter. Hence, as to enhance denitriﬁcation in aerobe reactor step 2 (if biological nitrogen removal is the goal), bypass of the pretreated wastewater directly to reactor step 2 might be a useful strategy. Aerobe reactor step 2 consists of two rectangular and parallel basins. Each basin is aerated, either continuously or intermittently, and the air is supplied using four ejectors in each basin, distributed equally along the length of the basins. From aerobe reactor step 2, the outlet lines converge into one efﬂuent line which leads to aerobe reactor step 3. Aerobe reactor step 3 consists of fourteen small volumes, conﬁgured as shown in Figure 1. Each volume is aerated, either continuously or intermittently. The air is supplied from blowers, and the air is dispersed in each volume through aeration dishes. From aerobe reactor step 3, the wastewater ﬂows into ten parallel secondary sedimentation basins. The sludge from these basins, is pumped into a sludge chamber. The sludge chamber has two main purposes. Firstly, sludge is returned back to the inlet of the anaerobe reactor step—one sludge return line for each of the three parallel lines. Secondly, sludge is wasted and pumped to the sludge treatment which involves addition of polymer, thickening etc. The reject water from the thickening process is returned back to the plant. 4.2. Flow descriptions and sensors The component concentrations in the inﬂuent to the plant is typically characterized as follows, Table 2. With reference to Table 2, the following comments should be made: • The pretreatment reduces the total phosphorous content considerably due to sludge removal from the primary sedimentation basins. • The pre-treatment reduces the unﬁltered biological oxygen demand with 50. The average volumetric inﬂuent ﬂow rate is 1400–1500 m3/h. The plant has to obey the following governmental efﬂuent requirements: • BOD7 ⬍ 10 mg ⫽ l. • Ptot ⬍ 0.5 mg ⫽ l. Systematic Analysis of Parameter Identiﬁability Table 2. 13 Description of typical inﬂuent concentrations to the Duvbacken Waste Water Treatment Plant. Inﬂuent to plant Parameters Description Units Ptot PO4-P NO3-N NH4-N BOD7 Total phosphorous Phosphate phosphorous Nitrate nitrogen Ammonia nitrogen Biological oxygen demand mg/l mg/l mg/l mg/l mg/l Table 3. After pretreatment Unﬁltered Filtered Unﬁltered Filtered 6.0 205 3.2 3.4 1.0 27.2 69 3.4 99 1.2 2.0 1.4 55 On-line sensors at the Duvbacken Waste Water Treatment Plant. Sensor type Location Sensors Dissolved oxygen SO2 Aerobe reactor step 1, one sensor in each parallel line. Aerobe reactor step 2, two sensors in each basin. Aerobe reactor step 3, 5 sensors in 5 different volumes. — y6 — Nitrate nitrogen SNO3 Outlet of aerobe reactor step 2, one sensor Sludge chamber, one sensor. y4 y8 Ammonia nitrogen SNH4 Outlet of aerobe reactor 1, one sensor. Efﬂuent of the plant, one sensor. y1 y9 Phosphate phosphorous Efﬂuent of the plant, one sensor. — Total phosphorous Efﬂuent of the plant, one sensor. — Dissolved phosphorous SPO4 Outlet of aerobe reactor step 3, one sensor. y10 Total solids XA ⫹ XH ⫹ XPAO Outlet of aerobe reactor step 1, one sensor. Outlet of aerobe reactor step 2, one sensor. Sludge chamber, one sensor Efﬂuent of plant, one sensor. y3 y7 As can be seen, there are currently no governmental requirements regarding the nitrogen contents in the efﬂuent. Table 3 gives an overview of the available on-line sensors of the plant. In addition, inorganic soluble phosphorous SPO4 is measured by off-line laboratory analysis in aerobe reactors 1, 2, and 3; y2, y5, and y10, respectively. 4.3. Model and model veriﬁcation A dynamic model is developed, based on the standard kinetics of the ASM2d model (Henze et al. 1999), (Metcalf & Eddy 2003), (Henze et al. 2000). In the dynamic model, each of the 4 steps in the plant (anaerobe, aerobe 1–3) is modeled as a perfectly stirred reactor. This leads to 17 states in each of 4 stirred volumes, i.e. 68 states. The model has a total of 45 parameters. The states of the model are grouped into the concentration of soluble species Sj and particulate species Xj. The model has 18 potential input variables: total volumetric ﬂow rate q and the composition of the 17 species. In the model ﬁtting, 14 Cristina Sarmiento Ferrero et al. Figure 2. Simulated outputs SNO3, SNH4, SPO4, and SS ⫽ XA ⫹ XH ⫹ XPAO over 7 days, with sludge ages Tsludge ⫽ 6 d (solid, black) and Tsludge ⫽ 2 d (dashed, blue). 10 measurements are available12. Examples of measurements are the concentration of suspended solids SS (i.e. the sum of the microorganisms), the concentration of soluble nitrates SNO3, the concentration of soluble ammonium SNH4, and the concentration of inorganic soluble phosphorous SPO4. The model has been implemented in Matlab, and the calling syntax for running the simulation code and compute the outputs for the plant is [T,Y] ⫽ bioout(s0,x0,q,Sf,Xf,P0) Here, s0 and x0 are the initial state vectors, q is the feed ﬂow rate, Sf and Xf are the feed concentrations of the state variables, and P0 is the parameter vector. The response from the simulator is T which is a vector of time instants where the solution is available, and Y which is the matrix of output responses. Before analyzing the identiﬁability and estimating parameters, it is a good idea to verify that the model gives reasonable responses (Olsson & Newell 1999). Figure 2 depicts the concentrations of SS, SNO3, SNH4, and SPO4 for two different sludge ages in the plant—Tsludge ⫽ 6 d and Tsludge ⫽ 2 d,13 during 7 days of operation. The results are reasonable: • Figure 2 shows that the suspended solids concentration SS is reduced when the sludge age is reduced. This makes sense: less residence time means that less solids is precipitated. 12 13 In this paper, all measurements were assumed to be available every minute. The sludge age is the residence time of the sludge in the reactor system. Systematic Analysis of Parameter Identiﬁability 15 • To observe bio-N operation (nitrogen removal), in general the sludge age should be no less than 6 d. To observe bio-P operation (phosphorous removal), the sludge age should be no less than 2 d. Thus, with a sludge age of 6 d in Figure 2, the system should be on the verge of dropping out of bio-N operation, and with a sludge age of 2 d, the system should be on the verge of dropping out of bio-P operation. • Although bio-N operation may be obtained with a sludge age of 6 d, in the scenarios simulated in Figure 2, the feed contains no autotrophic biomass XAUT, and the concentration of XAUT in the efﬂuent stays below 10 ⫺ 2 mg/l for the entire period of 7 d (not shown). To observe nitriﬁcation, XAUT should have a value around, say, 300 mg/l. Nitriﬁcation would then manifest itself in e.g. a marked decrease in dissolved ammonium SNH4. • Phosphorous removal is observed from e.g. the amount of dissolved phosphorous SPO4. In Figure 2, the concentration of SPO4 starts to increase (after 4 d) in the case of the 2 d sludge age, while it stays low for the higher sludge age. This indicates bio-P operation at a sludge age of 6 d, while the bio-P operation is failing at a sludge age of 2 d. There are some oscillations in some outputs in Figure 2—these are due to oscillating oxygen feed in the aerobe reactors. 5. Identiﬁability Analysis for the Duvbacken Plant Model 5.1. Experimental conditions With our state space based model, we need a set of experimental input signals ut in order to carry out the identiﬁability analysis. Identiﬁability analysis as discussed in this paper, does not require knowledge of the experimental response yt from the real system. However, if we later want to estimate the parameters, then the system response is needed. Here, we use a simulation model implemented in Matlab, with constant inﬂuent ﬂow rate and compositions; the main transients in the system are due to initial values that are not at steady state, and an oscillating strategy for oxygen feed. Although the relatively small perturbation of the system is far from ideal for parameter identiﬁcation, it will serve to illustrate the method for experimental parameter identiﬁability analysis. 5.2. Model sensitivity The sensitivity was found by numerically perturbing the simulation model. First, a nominal output was computed, y mt (0), and reshaped into y m (0) 苸 RnyT ⫻ 1. Then the perturbed output y mt (0 ⫹ ej · j) was computed and reshaped into y m (0 ⫹ ej · j ); ej is column j of the identity matrix I 苸 Rn ⫻ n. Then ﬁnally column sj of the sensitivity S was computed as sj ⬇ y m(0 ⫹ ej · j ) ⫺ y m(0) . j The outputs and parameters were scaled according to recommendations in Brun et al. (2002). 16 Cristina Sarmiento Ferrero et al. Table 4. Parameter importance ranking according to the sensitivity measures. Parameters labeled by an asterisk (*) are considered identiﬁable from the available data. msqr j 14.812 3.9867 3.2385 3.105 2.9954 2.9412 2.9324 2.5858 2.2768 2.2196 1.9906 1.9526 1.326 1.2238 1.1272 1.0583 0.99162 0.95771 0.52842 0.46989 Parameters *PAO q*PP bPAO K *X Kh *H q*fe K *A,PAO bPHA q*PHA KA,HET K *PHA KO2,HYD b*HET KO2,HET *fe KO2,PAO KF K *PS,PAO b*PP Maximum growth rate of PAO Rate constant for storage of XPP Rate for Lysis of XPAO Saturation coefﬁcient for particulate COD Hydrolysis rate constant Maximum growth rate on substrate Maximum rate for fermentation Saturation coefﬁcient for acetate, SA Rate for Lysis of XPHA Rate constant for storage of XPHA (base XPP) Saturation coefﬁcient for growth on acetate SA Saturation coefﬁcient for PHA Saturation/inhibition coefﬁcient for oxygen Rate for Lysis of XH Saturation/inhibition coefﬁcient for oxygen Anoxic hydrolysis reduction factor Saturation/inhibition coefﬁcient for oxygen Saturation coefﬁcient for growth on SF Saturation coefﬁcient for phosphorus in storage of PP Rate for Lysis of XPP Parameter # 30 29 32 8 4 16 17 36 33 28 23 44 7 19 20 6 34 21 38 45 5.3. Sensitivity index ⫽ 储 sj 储2 / 兹nyT was computed. Out of the 45 original The sensitivity measure msqr j parameters, the 20 most sensitive parameters are shown in Table 4. Although the decrease in msqr is gradual, we thus make the deliberate choice of j assuming that parameters 21–45 are not identiﬁable. We assign the nominal parameter value to these parameters, and then continue with collinearity analysis to see which of the 20 parameters with highest sensitivity that we can estimate. 5.4. Collinearity indices and identiﬁable parameters Similarly as to in Brun et al. (2002), the 20 parameters of interest from the parameter sensitivity ranking can be classiﬁed in different groups according to the biological processes to which they belong. The parameters are divided into 4 different groups according to the kind of biological processes they describe: 4 parameters are related to hydrolysis of particulate substrate, 6 parameters are related to heterotrophic organisms, 10 parameters are related to phosphorus-accumulating organisms, and none are related to autotrophic organisms. The distribution of the 20 most sensitive parameters is thus: • Hydrolysis of particulate substrate: KX, Kh, KO2, HYD, fe • Heterotrophic organisms: H, qfe, KA, HET, bHET, KO2, HET, KF • Phosphorus-accumulating organisms: PAO, qPP, bPAO, KA, PAO, bPHA, qPHA, KPHA, KO2, PAO, KPS, PAO, bPP • Autotrophic organisms:— Next, the collinearity index (p) is calculated for all possible subsets of the top 20 parameters. Values for (p) lie in the range 1–11. This is almost within the range of Systematic Analysis of Parameter Identiﬁability 17 (p) ⱕ 10 as proposed by Brun et al. (2002), so our parameters are hardly collinear. However, to illustrate the concept of collinearity, we instead consider parameters to be collinear if (p) ⬎ 5. Here it is found that there are parameter subsets with up to 13 elements which fulﬁll (p) ⱕ 5, whereas subsets with 14 and more elements all have (p) ⬎ 5. Therefore, we consider a maximum of 13 parameters as potentially identiﬁable from the available data. The subset containing the largest number of parameters with the smallest collinearity index (p) ⱕ 5 is selected as the best identiﬁable; and has collinearity index (p) ⫽ 4.27. Experience reported in the literature suggest that parameter bPAO is difﬁcult to estimate, even though the model is sensitive to this parameter (Brun et al. 2002): typically, an unrealistic value of bPAO is found in the parameter estimation. We thus choose to take bPAO out of the set of parameters to estimate. With this simpliﬁcation, (p) drops to 4.20. The chosen ﬁnal subset of 12 parameters consists of 2 parameters related to hydrolysis of particulate substrate, 3 parameters related to heterotrophic organisms, and 7 related to phosphorusaccumulating organisms; these parameters are indicated with an asterisk in Table 4. 5.5. Parameter estimation After ﬁnding an identiﬁable parameter subset based on knowledge of y mt(0 兩 K ), we are ready to estimate the parameters. To do so, we need responses yt, t 苸 {1, … , T } from the plant. As an initial study before doing parameter estimation based on real data from the Gävle plant, we choose to check whether suitable parameter estimates can be obtained based on responses from the simulation model. Thus, the nominal parameters in the ASM2d plant are chosen as the “correct” parameters *, and then some outputs yt (K ) ⫽ y mt (* 兩 K ) are computed. The initial parameter guess 0 was chosen as a 10% increase of *. Some responses yt (K ) are displayed in Figure 2 with a sludge age of 6 d. Clearly, the outputs indicate a relatively stiff system (compare e.g. the slow variation of SNH4 to the rapid variation of SPO4), with relatively little excitation. Hence, difﬁculties may be expected in ﬁnding all parameters. Also, as we have seen, most of the identiﬁable parameters are related to the phosphorous removal, so we would expect that states related to phosphorous can be ﬁtted better to the data. In order to ﬁnd parameter estimates, a weighted least squares criterion is applied ˆ ⫽ arg min J ⫽ arg min eTWe (5) where ˆ contains the optimal parameter values of the parameters marked with an asterisk in Table 4 and the other parameters are chosen as 0, W is block diagonal with Wt in the diagonal blocks, Wt ⫽ diag (1/(y䊊1 )2, … , 1/(y䊊ny)2), and e is the observation error y ⫺ ym (Dueñas Dı́ez et al. 2006). To compute the parameter estimates, the nonlinear least squares algorithm lsqnonlin of the Optimization Toolbox in Matlab is used. Table 5 shows the initial parameter values 0, the “correct” values *, and the estimated values ˆ obtained after minimizing J. 18 Cristina Sarmiento Ferrero et al. Table 5. Comparison of initial and estimated parameter values. Symbol Description 0 ˆ * Unit PAO Maximum growth rate of PAO 0.0322 0.03156 0.0293 h⫺1 qPP Rate constant for storage of XPP 0.0385 0.03876 0.0350 g XPP g ⫺ 1 XPAO h ⫺ 1 KX Saturation coefﬁcient for particulate 0.1100 0.11537 0.1000 COD g XS g ⫺ 1 XH h ⫺ 1 H Maximum growth rate on substrate 0.1513 0.16832 0.1375 g XS g ⫺ 1 XH h ⫺ 1 qfe Maximum rate for fermentation 0.0756 0.03970 0.0688 g SF g ⫺ 1 XH h ⫺ 1 KA, PAO Saturation coefﬁcient for acetate, SA 4.4000 4.42080 4.0000 g COD m ⫺ 3 qPHA Rate constant for storage of XPHA (base XPP) 0.0963 0.10698 0.0875 g XPHA g ⫺ 1 XPAO h ⫺ 1 KPHA Saturation coefﬁcient for PHA 0.0110 0.01125 0.0100 g XPHA g ⫺ 1 XPAO bHET Rate for Lysis of XH 0.0101 0.01049 0.0092 h⫺1 fe Anoxic hydrolysis reduction factor 0.4400 0.45286 0.4000 — KPS, PAO Saturation coefﬁcient for phosphorus 0.2200 0.21772 0.2000 in storage of PP g P m⫺3 bPP Rate for Lysis of XPP h⫺1 0.0050 0.00513 0.0046 Note that for several parameters, 兩 *j ⫺ 0j 兩 ⬍ 兩 *j ⫺ ˆ j 兩. The reason for this is that we are estimating only a subset of the parameters. 5.6. Model validation Validation is the comparison of model output y mt (ˆ 兩 K ⬘) with the real output yt (K ⬘) based on validation data K ⬘, while parameter estimate ˆ is based on training data K . The main reason why the validation data K ⬘ should differ from the training data K is to avoid ﬁtting the model to noise. In this paper, we constructed the training data from an assumed perfect model, yt ⫽ y mt (* 兩 K ), and we choose to use the training data for validation, too. The evolution of some key outputs are displayed in Figure 3: the “real” output yt ⫽ y mt (*) from the biological reactor, and the prediction outputs ŷt ⫽ y mt (ˆ ). For comparison, we also include the model outputs y mt (0), which will indicate how much the model has been improved through parameter estimation. The concentration of SPO4 after parameter estimation (dashed red curve in Figure 3) is quite close to the “real” process output (black, solid line). As argued previously, the model simulates bio-P operation, which can be observed from the time evolution of SPO4. We also argued that due to the bio-P operation, most of the identiﬁable parameters are related to phosphorous removal. Furthermore, more weight has been put on phosphorous removal outputs because of the governmental restrictions on total phosphorous in the efﬂuent. Thus, the model has mainly been adjusted to give good prediction of those measurements which are related to phosphorous. The prediction capabilities of other outputs (e.g. SNH4 and SNO3) are poorer. As argued, the lack of autotrophic biomass (XAUT) in the process leads to poor nitriﬁcation. Consequently, parameters related to the autotrophic (nitrifying) organism group are poorly identiﬁable. However, since there are no government restrictions on the nitrogen outputs, the poor prediction capability of nitrogen outputs is acceptable. Systematic Analysis of Parameter Identiﬁability Figure 3. 19 Comparison of model outputs: yt ⫽ ymt (*) (solid, black), ŷt ⫽ ymt (ˆ ) (dashed, red), and ymt (0) (dotted, blue). 6. Conclusions In this paper, a method for assessing parameter identiﬁability of large scale models based on experimental data is discussed. The method is applied to a model of a biological wastewater treatment plant. First, a general description of wastewater treatment is given, with an introduction to the ASM2d dynamic model. The description is unique in the sense that it does not require much background in biological waste water modeling, apart from a background in basic process modeling. Next, an overview is given of a method for analyzing experimental identiﬁability which has been proposed in the literature. Then, an overview of the Duvbacken wastewater treatment plant in Gävle, Sweden, is given. Finally, the identiﬁability analysis theory is applied to a model of the Duvbacken plant. It should be emphasized that because real experimental data were unavailable, the study has been based on simulated data assuming a perfect model. However, the procedure can be used without modiﬁcation with real data. In the analysis, a model with 45 parameters has been studied. From the experimental identiﬁability analysis, 12 of the parameters were found to be identiﬁable. Some details in the analysis are given. Then these 12 parameters are used in a parameter estimation study, and improved parameters are found using a Matlab routine for nonlinear least squares minimization. After ﬁnding the parameters, the model is validated against the original experimental data. The model ﬁt is not perfect. However, the results are logical from an understanding of the process operation: the model ﬁt is quite good for those outputs that matter in the operation of the plant, and less good in outputs which are less important to the plant operation. Some future work may include: • The current model implementation in Matlab is relatively rigid with respect to possible input signals, and a rewriting of the model in a more ﬂexible modeling language such as Modelica is planned. 20 Cristina Sarmiento Ferrero et al. • Verifying the model more thoroughly for other operating scenarios. • Fitting the model to experimental data for larger initial errors in parameters, and comparing different optimization algorithms, as well as multiple shooting vs. single shooting (used here). • Fitting the model to noisy data/real experimental data. • Including a statistical analysis of the parameters and prediction capabilities of the model. References BAILEY, J. E. & OLLIS, D. F. (1986). Biochemical Engineering Fundamentals, second edn, McGraw-Hill, New York. BARD, Y. (1974). Nonlinear Parameter Estimation, Academic Press, New York. BECK, J. V. & ARNOLD, K. J. (1977). Parameter Estimation in Engineering and Science, Wiley, New York. BELSLEY, D. A. (1991). Conditioning Diagnostics. Collinearity and Weak Data in Regression, John Wiley & Sons, New York. BRUN, R., KÜHNI, M., SIEGRIST, H., GUJER, W. & REICHERT, P. (2002). ‘Practical identiﬁability of ASM2d parameters—systematic selection and tuning of parameter subsets’, Water Research 36(16), 4113–4127. BRUN, R., REICHERT, P. & KÜNSCH, H. R. (2001). ‘Practical identiﬁability analysis of large environmental simulation models’, Water Resour. Res. 37(4), 1015–1030. DUEÑAS DÍEZ, M., FJELD, M., ANDERSEN, E. & LIE, B. (2006). ‘Validation of a compartmental population balance model of an industrial leaching process: The Silgrain(R) process’, Chem. Engng. Sci. 61, 229–245. HENZE, M., GUJER, W., MINO, T., MATSUO, T., WENTZEL, M. C., MARAIS, G. V. R. & VAN LOOSDRECHT, M. C. M. (1999). ‘Activated sludge model no. 2d, ASM2D’, Wat. Sci. Tech. 39(1), 165–182. HENZE, M., GUJER, W., VAN LOOSDRECHT, M. C. M. & MINO, T. (2000). Activated Sludge Models ASM1, ASM2, ASM2d and ASM3., Vol. 9 of Scientiﬁc and Technical Report, IWA Publishing. HENZE, M., HARREMOËS, P., LA COUR JANSEN, J. & ARVIN, E. (1996). Wastewater Treatment. Biological and Chemical Processes, second edn, Springer, Berlin. HOLMBERG, A. (1982). ‘On the parameter identiﬁability of microbial growth models incorporating michaelesmenten type nonlinearities’, Math. Biosci. 62, 23–43. JEPPSON, U. (1993). On the veriﬁability of the activated sludge system dynamics, Tekn. lic. dissertation, Lund Institute of Technology. LJUNG, L. (1999). System Identiﬁcation. Theory for the User, second edn, Prentice Hall, Upper Saddle River, New Jersey. LJUNG, L. & GLAD, S. T. (1994). ‘On global identiﬁability for arbitrary model parameterizations’, Automatica 30(2), 265–276. METCALF & EDDY, I. (2003). Wastewater Engineering. Treatment and Reuse, fourth edn, McGraw Hill, New York. OLSSON, G. & NEWELL, B. (1999). Wastewater Treatment Systems. Modelling, Diagnosis and Control, IWA Publishing, London. POHJANPALO, H. (1978). ‘System Identiﬁability Based on the Power Series Expansion of the Solution’, Mathematical Biosciences 41, 21–33. RAWLINGS, J. B. & EKERDT, J. G. (2002). Chemical Reactor Analysis and Design Fundamentals, Nob Hill Publishing, Madison, Wisconsin. SMITH, W. R. & MISSEN, R. W. (1991). Chemical Reaction Equilibrium Analysis: Theory and Algorithms, Krieger Publishing Company, Malabar, Florida. SÖDERSTRÖM, T. & STOICA, P. (1989). System Identiﬁcation, Prentice Hall International. STEWART, G. (1987), ‘Collinearity and least squares regression’, Statistical Science 2(1), 68–84. WALTER, E. & PRONZATO, L. (1997). Identiﬁcation of Parametric Models from Experimental Data, Springer. Paper B: Parameter Identi…ability Analysis and Model Fitting of a Biological Wastewater Model This paper was presented at the conference and published in the Proceedings of 16th European Symposium on Computer Aided Process Engineering and 9th International Symposium on Process Systems Engineering held in Garmisch-Partenkirchen, Germany, 9 –13 July 2006, pp. 409 –414. 131 132 16th European Symposium on Computer Aided Process Engineering and 9th International Symposium on Process Systems Engineering W. Marquardt, C. Pantelides (Editors) © 2006 Published by Elsevier B.V. 409 (1B1=5D5B !45>D9129<9DI >1<IC9C 1>4 %?45< 9DD9>7 ?6 1 9?<?7931< /1CD5G1D5B %?45< (!+ '!( 2%..% *.!+( !+$ %.+0 (% ' (,& )$0 ,-$.3 *'' " *2 *,-",/)) *,13 $* & *,-",/)) *,13 "/0.!#0 29?<?7931< G1CD5G1D5B DB51D=5>D @<1>D C9DE1D54 1D EF213;5> 9> LF<5 +G545> 9C 45C3B9254 4I>1=93 =?45< 21C54 ?> D85 3D9F1D54 +<E475 %?45< &? 4 +%4 9C 45F5<[email protected] 9> D85 C9=E<1D9?> <1>7E175 %?45<931 1>4 9C [email protected]?BD54 6B?= I=?<1 1 %?45<931 5>F9B?>=5>D 9>D? %1D<12 !D 9C ?6 9>D5B5CD D? 14:ECD D85 @1B1=5D5BC 9> D85 =?45< CE38 D81D D85 45F5<[email protected] =?45< DC 25DD5B D? [email protected]=5>D1< 41D1 6B?= D85 EF213;5> @<1>D !> D89C @[email protected] 1 CICD5=1D93 [email protected]@B?138 6?B @1B1=5D5B 945>D9129<9DI 1>1<IC9C 9C 45C3B9254 CD1>41B4 <51CD CAE1B5C 3B9D5B9?> 9C EC54 9> 3?=29>1D9?> G9D8 1 49B53D [email protected]=9J1D9?> =5D8?4 D? 31<3E<1D5 D85 [email protected]?F54 @1B1=5D5B 5CD9=1D5C 1>4 D85 14:ECD54 =?45< 9C F1<941D54 1719>CD [email protected]=5>D1< 41D1 6B?= D85 9>4ECDB91< @<1>D %53,.$/ +%4 !45>D9129<9DI 1>1<IC9C (1B1=5D5B 5CD9=1D9?> %?45< DD9>7 ,85 3D9F1D54 +<E475 %?45<C +%C 45>54 2I D85 !>D5B>1D9?>1< /1D5B CC?391D9?> !/ 81F5 255> G945<I [email protected]@<954 D? =?45<9>7 1>4 C9=E<1D9?> ?6 G1CD5G1D5B DB51D=5>D @<1>DC //,(C 6?B >9DB?75> & 1>4 @[email protected]?BEC ( B5=?F1< 5B>15I 5D 1< ,85 +%C @B?F945 1 CD1>41B49J54 C5D ?6 21C9C =?45<C G9D8 >?=9>1< @1B1=5D5B F1<E5C CE775CD54 9> @E2<931D9?>C !> @B13D935 8?G5F5B @<1>D [email protected]?> 9>E5>D 1>4 C<E475 381B13D5B9CD93C F1BI 6B?= @<1>D D? @<1>D ,85 =?45< @1B1=5D5BC 1B5 >?D E>9F5BC1< 9> D85 C5>C5 D81D 5F5BI @<1>D 3?E<4 25 =?45<54 EC9>7 D85 C1=5 @1B1=5D5B F1<E5C !D 9C D8EC >535CC1BI D? D D85 =?45< @1B1=5D5BC D? [email protected]=5>D1< 41D1 6B?= 1 [email protected] G1CD5G1D5B CDB51= 9> ?B45B D? 5>CEB5 7??4 @B5493D9F5 @[email protected] ?6 1 =?45< ?G5F5B D85 +%C 8?<4 1 <1B75 >E=25B ?6 @1B1=5D5BC 1>4 65G =51CEB5=5>DC 1B5 1F19<12<5 ,89C B5CE<DC 9> D85 @1B1=5D5BC 259>7 @??B<I 945>D912<5 6B?= [email protected]=5>D1< 41D1 !> D89C @[email protected] G5 3?>C945B D85 EF213;5> //,( 9> LF<5 +G545> G8938 9C 45C97>54 D? DB51D =E>[email protected]< G1CD5G1D5B 6B?= [email protected]@B?H9=1D5<I @5BC?> 5AE9F1<5>DC ,85 @<1>D 9C EC54 D? B5=?F5 29?<?7931< @[email protected]?B?EC @B9=1B9<I EC9>7 213D5B91 1>4 9C 45C3B9254 2I 1> +%4 =?45< 5>J5 5D 1< @B5F9?EC G?B; ?> 1>1<IC9C ?6 @1B1=5D5B 945>D9129<9DI 6?B D89C @<1>D G1C [email protected]?BD54 9> +1B=95>D? 5BB5B? 5D 1< !> D859B G?B; D85 =?45< [email protected]<5=5>D1D9?> 9> %1D<12 G1C B5<1D9F5<I B9794 G9D8 [email protected] D? @?CC92<5 9>@ED C97>1<C ,? 79F5 1> [email protected]> 1>4 5H92<5 =?45< [email protected]>D1D9?> 1 =?B5 75>5B1<@[email protected]?C5 =?45<9>7 <1>7E175 CE38 1C %?45<931 9C 38?C5> 85B5 %?45<931 9C 1> ?2:53D?B95>D54 =?45<9>7 <1>7E175 G9D8 14F1>D175C CE38 1C CE9D129<9DI 6?B =E<D94?=19> =?45<9>7 D85 EC175 ?6 75>5B1< 5AE1D9?>C ?6 @8IC931< @85>?=5>1 D85 B5EC129<9DI [email protected]?>49>7 1ED8?B 5B>D $9589D >? Q. Chai et al. 410 ?6 =?45< [email protected]?>5>DC 1>4 1 895B1B38931< =?45< CDBE3DEB5 B9DJC?> ,85 =?45< 9C D8EC 45F5<[email protected] 9> %?45<931 21C54 ?> =?4931D9?>C ?6 D85 6B55 %?45<931 <92B1BI *5938< 1>4 D85 C9=E<1D9?> 9C 31BB954 ?ED 9> D85 5>F9B?>=5>DC I=?<1 1>4 %1D<12 ,85 @[email protected] 9C ?B71>9J54 1C 6?<<?GC !> C53D9?> D85 [email protected]<5=5>D1D9?> ?6 D85 EF213;5> @<1>D =?45< 9> %?45<931 9C 45C3B9254 !> C53D9?> @1B1=5D5B 945>D9129<9DI 1>1<IC9C 6?B D85 EF213;5> =?45< 9C 31BB954 ?ED 1>4 C?=5 B5CE<DC ?6 =?45< DD9>7 1B5 79F5> 9>1<<I C?=5 3?>3<EC9?>C 1B5 4B1G> 97 %?45< 4917B1= ?6 D85 EF213;5> @<1>D [email protected]<5=5>D54 9> %?45<931I=?<1 ,85 EF213;5> @<1>D 3?>C9CDC ?6 1>15B?25 [email protected] 15B?25 [email protected] 1>4 C53?>41BI C549=5> D1D9?> [email protected] C55 97 %?B5 45D19<C ?6 D85 @<1>D @B?35CC 1>4 ?G [email protected]?> 1B5 79F5> 9> +1B=95>D? 5BB5B? 5D 1< 4I>1=93 =?45< 9C 45F5<[email protected] EC9>7 1 C<978D =?4931D9?> ?6 +%4 G85B5 DG? @B?35CC5C 6?B 385=931< @[email protected]?> ?6 @[email protected] 1B5 >57<53D54 !> D85 4I>1=93 =?45< 5138 ?6 D85 [email protected] 9> D85 @<1>D 1>15B?25 15B?25 K 9C =?45<54 1C 1 @5B653D<I CD9BB54 B513D?B /9D8 CD1D5C 9> 5138 ?6 D85 B513D?BC D89C 79F5C 1 =?45< G9D8 CD1D5C ,85 CD1D5C ?6 D85 =?45< 1B5 [email protected] 9>D? D85 3?>35>DB1D9?> ?6 49CC?<F54 [email protected] 1>4 @1BD93E<1D5 [email protected] ,85 =?45< 81C @?D5>D91<<I 9>@ED F1B912<5C 6554 [email protected]?C9D9?> ?6 F1BI9>7 CD1D5C 1>4 F?<E=5DB93 9>E5>D ?G 1>4 81C ;9>5D93 @1B1=5D5BC 3?>C945B54 6?B @1B1=5D5B 945>D9129<9DI 1>1<IC9C !> D85 =?45< DD9>7 =51CEB5=5>DC 1B5 1F19<12<5 ,85 4I>1=93 =?45< 9C [email protected]<5=5>D54 9> %?45<931 EC9>7 D85 I=?<1 5>F9B?>=5>D I>1C9= /9D89> I=?<1 D85 =?45< 9C 51C9<I 3?>CDBE3D54 2I 4B1779>7 [email protected]@9>7 1>4 3?>>53D9>7 [email protected]?>5>DC 38?C5> 6B?= D85 =?4954 <92B1BI EB9>7 D85 C9=E<1D9?> 1 CICD5= ?6 49665B5>D91< 1<752B193 5AE1D9?>C 9C 5CD12<9C854 2I I=?<1 ,85 ++$ 9>D57B1D9?> @B?354EB5 ?6 I=?<1 9C EC54 D? C?<F5 D85 CICD5= %?B5?F5B I=?<1 @B?F945C 1 3?>F5 >95>D 9>D5B6135 D? %1D<12 CE38 D81D %?45<931 =?45<C 31> 25 51C9<I 5H53ED54 G9D89> %1D<12 ,85 %?45<931 [email protected]@<931D9?> <92B1BI 3?>D19>C B5<1D9F5<I [email protected]<5D5 [email protected]?>5>DC >55454 6?B =?45<9>7 1>4 C9=E<1D9?> EC9>7 +%C !> 1449D9?> G9D8 D85 5H929<9DI ?6 D85 %?4 5<931 <1>7E175 D85 EC5B 31> 51C9<I 5HD5>4 D85 [email protected] [email protected]?>5>DC ,? [email protected]@<I D85 Parameter Identifiability Analysis and Model Fitting of Biological Wastewater Model 411 <92B1BI D? D85 EF213;5> @<1>D D85 6?<<?G9>7 =?4931D9?>C 1B5 =145 4I>1=93 9>E5>D 41D1 <5 9>3<E49>7 D9=5 1>4 9>E5>D ?GB1D5 9C @B?F9454 9> D85 [email protected]?>5>D ,85 9>6?B=1D9?> 9> D85 41D1 <5 9C B514 2I D85 =?4954 [email protected]?>5>D G85B5 9>E5>D [email protected]?C9D9?>C 1B5 45>54 1C 6E>3D9?>C ?6 ,G? ;9>4C ?6 29?<?7931< B513D?BC 1B5 45F5<[email protected] 9> D85 <92B1BI 1>15B ?2545>9DB931D9?> B513D?B 1>4 15B?25>9DB931D9?> B513D?B << D85 15B? 293 B513D?BC 1B5 15B1D54 59D85B 2I 3?>D9>E?EC 15B1D9?> ?B 2I 9>D5B=9DD5>D 15B1D9?> ,85 19B 9C [email protected]@<954 6B?= 2<?G5BC !> D89C @<1>D D8B55 15B1D9?> 3?>DB?< CDB1D5795C 1B5 [email protected]@<954 5B?25 [email protected] [email protected]?9>D 3?>DB?< (! 3?>DB?<<5B 9C EC54 D? ;[email protected] D85 ?HI75> 3?>35>DB1D9?> 1B?E>4 5B?25 [email protected] J?>5 3?>DB?< ,85 B513D?B 9C 15B1D54 2I 9>D5B=9DD5>D 15B1D9?> D? B5CDB93D D85 ?HI75> 3?>35>DB1D9?> 25DG55> 1>4 5B?25 [email protected] 3?>D9>E?EC 3?>CD1>D 15B1D9?> ,85 ?HI75> DB1>C65B 3?56395>D 9C =145 D? 25 @1BD ?6 D85 C<E475 6B?= D85 C5DD<5B 9C B5DEB>54 213; D? D85 9><5D ?6 D85 1>15B?25 [email protected] G89<5 D85 B5=19>9>7 C<E475 9C G1CD54 1>4 @[email protected] D? D85 C<E475 DB51D=5>D ,85 B5DEB> C<E475 ?GB1D5 9C @[email protected]?BD9?>1< D? D85 9>E5>D ?GB1D5 9 5 ,85 G1CD5 C<E475 ?GB1D5 9C EC54 D? =1>[email protected]<1D5 D85 C<E475 175 G8938 9C D85 =?CD 3B9D931< @1B1=5D5B 6?B 13D9F1D54 C<E475 45C97> !> D85 @<1>D =?45< D85 [email protected]< F1<E5 ?6 D85 C<E475 175 9C 1>4 9C [email protected] 5F5BI 8?EBC 21C54 ?> D85 F1<E5 ?6 D85 C<E475 175 ,85 9>9D91< F1<E5C ?6 D85 =?45< 1B5 45>54 9> 1 %?45<931 [email protected] <5 G9D8 <5 5HD5>C9?> 4%#10(,+ ,& 0'% ,$%)(#! *,$%) (+ !0)!" +9>35 %1D<12 81C 1F19<12<5 D??<2?H5C 9D 9C 38?C5> 1C D85 C9=E<1D9?> @<1D6?B= 6?B 945>D9129<9DI 1>1<IC9C 1>4 @1B1=5D5B 5CD9=1D9?> ,85 [email protected]<5=5>D1D9?> ?6 D85 @1B1=5D5B 5CD9=1D9?> 9C 21C54 ?> D85 <51CD CAE1B5C 3B9D5B9?> ?6 D85 =?45< 5BB?B ,85 =?45< 5BB?BE>35BD19>DI [email protected]>DC D85 49665B5>35 25DG55> D85 [email protected]=5>D1< [email protected] 1>4 D85 C9=E<1D54 =?45< [email protected] G9D8 D85 9>@ED C97>1<C 6?B 1>4 G5 9>DB?4E35 D85 >?D1D9?> G89<5 ,85 %?45<931 =?45< 9C [email protected]<54 D? 1> 5H53ED12<5 I=?C9= <5 G8938 31> 25 49B53D<I 31<<54 1C 1> =6E>3D9?> 6B?= %1D<12 5B5 D85 D8B55 9>@ED 1B7E=5>DC [email protected]?>4 D? D85 D8B55 =1DB935C [email protected] 9> 1 I=?C9= 9>@ED <5 9C D85 [email protected]=5>D [email protected] F53D?B 9C D85 9>9D91< CD1D5 F53D?B 1>4 9C D85 @1B1=5D5B F53D?B ,85 [email protected]?>C5 6B?= D85 C9=E<1D?B 9C G8938 9C 1 %1D<12 CDBE3DEB5 3?>D19>9>7 D85 C9=E<1D9?> B5CE<DC $%+0(!"()(05 !+!)5/(/ /5 >554 1 C5D ?6 [email protected]=5>D1< 9>@ED C97>1<C 9> ?B45B D? 31BBI ?ED D85 [email protected]=5>D1< 945> D9129<9DI 1>1<IC9C 5B5 G5 EC5 D85 C1=5 F?<E=5DB93 9>E5>D ?GB1D5 1C 9> D85 B51< @<1>D 4EB9>7 D85 @5B9?4 ?6 '3D?25B K +9>35 D85B5 1B5 >? [email protected]?C9D9?> =51CEB5=5>DC 9> D85 @<1>D 9>E5>D D85 9>E5>D [email protected]?C9D9?>C 1B5 31<3E<1D54 6B?= D85 F1<E5 ?6 21C54 ?> @B?35CC [email protected]>35 ,85 C<E475 175 ?B C?<94C B5D5>D9?> D9=5 +*, 9C D85 B5C945>35 D9=5 ?6 D85 C<E475 9> D85 B513D?B CICD5= Q. Chai et al. 412 /9D8 D85 79F5> =?45< 1>4 [email protected]=5>D1< 3?>49D9?>C 1> [email protected]=5>D1< @1B1=5D5B 945>D9129<9DI CDE4I 9C 31BB954 ?ED 21C54 ?> D85 CICD5=1D93 [email protected]@B?138 45C3B9254 9> BE> 5D 1< C55 1<C? +1B=95>D? 5BB5B? 5D 1< G8? [email protected]@<954 D89C [email protected]@B?138 D? D85 EF213;5> @<1>D &5HD D85 945>D9129<9DI 1>1<IC9C 9C 49C3ECC54 21C54 ?> =51CEB5C ?6 C5>C9D9F9DI 1>4 3?<<9>51B9DI ,$%) /%+/(0(2(05 ,85 C5>C9D9F9DI G1C 6?E>4 2I >E=5B931<<I @5BDEB29>7 D85 C9=E<1D9?> =?45< ?<E=> ?6 D85 - )-$.$0$.3 G1C [email protected] 1C G85B5 9C 3?<E=> ?6 D85 945>D9DI 5B5 C31<9>7 ?6 [email protected] 1>4 @1B1=5D5BC 9C 5CC5>D91< =1DB9H %+/(0(2(05 (+$%4 !> D85 =5D8?4 ?6 BE> 5D 1< D85 - )-$.$0$.3 ( -/, 9C 45>54 1C 'ED ?6 D85 ?B979>1< @1B1=5D5BC D85 =?CD C5>C9D9F5 @1B1=5D5BC 1B5 G85B5 ,))(+%!.(05 (+$(#%/ !+$ ($%+0(!")% -!.!*%0%./ ?<<9>51B9DI 9C 1 =51CEB5 ?6 8?G 3?=29>1D9?>C ?6 @1B1=5D5BC 9>D5B13D D8EC G5 3?>C945B 1<< @?CC92<5 CE2C5DC ?6 D85 @1B1=5D5BC ?6 9>D5B5CD 6B?= D85 @1B1=5D5B C5>C9D9F9DI B1>;9>7 BE> 5D 1< 45>54 D85 *''$) ,$.3 $) 2 1C G85B5 9C 1 CE2=1DB9H ?6 3?>D19>9>7 D8?C5 3?<E=>C D81D [email protected]?>4 D? D85 @1B1=5D5B CE2C5D ?6 9C 1 C<978D<I =?4954 C5>C9D9F9DI =1DB9H G85B5 D85 3?<E=>C 81F5 255> >?B=1<9J54 1>4 45>?D5C D85 C=1<<5CD C9>7E<1B F1<E5 ?6 !> +1B=95>D? 5BB5B? 5D 1< D85 @1B1=5D5BC 1B5 3?>C945B54 D? 25 3?<<9>51B 96 5B5 9D 9C 6?E>4 D81D D85B5 1B5 @1B1=5D5B CE2C5DC G9D8 [email protected] D? 5<5=5>DC G8938 6E<<< G85B51C CE2C5DC G9D8 1>4 =?B5 5<5=5>DC 1<< 81F5 ,85B56?B5 D85 CE2C5D 3?>D19>9>7 D85 <1B75CD >E=25B ?6 @1B1=5D5BC G9D8 D85 C=1<<5CD 3?<<9>51B9DI 9>45H 9C C5<53D54 1C D85 25CD 945>D912<5 D85 3?<<9>51B9DI 9>45H 9C ?G5F5B [email protected]>35 [email protected]?BD54 9> BE> 5D 1< CE775CD D81D @1B1=5D5B 9C 4963E<D D? 5CD9=1D5 /5 D8EC 38??C5 D? D1;5 ?ED ?6 D85 C5D ?6 @1B1=5D5BC D? 5CD9=1D5 !> ?B45B D? 5>CEB5 AE93; 3?>F5B75>35 9> D85 [email protected]?> ?6 D85 5CD9=1D54 @1B1=5D5BC G5 1449D9?>1<<I H D85 <51CD C5>C9D9F5 @1B1=5D5BC 1>4 ,85 38?C5> >1< CE2C5D 3?>D19>C @1B1=5D5BC G9D8 !.!*%0%. %/0(*!0(,+ 6D5B >49>7 1> 945>D912<5 @1B1=5D5B CE2C5D 21C54 ?> ;>?G<5475 ?6 G5 1B5 B514I D? 5CD9=1D5 D85 @1B1=5D5BC ,? 4? C? G5 >554 [email protected]?>C5C 6B?= D85 @<1>D ,85 1F19<12<5 ?><9>5 1>4 ?66<9>5 =51CEB5=5>DC ?6 D85 EF213;5> @<1>D 81F5 255> 9>4931D54 9> +1B=95>D? 5BB5B? 5D 1< 'ED ?6 D85C5 =51CEB5=5>DC D85 [email protected] ?6 9>D5B5CD 6?B =?45< DD9>7 1B5 4?G><?1454 6B?= D85 @<1>D 41D1 C5BF5B 1>4 1B5 3?>F5BD54 D? %1D<12 41D1 <5C ,? >4 @1B1=5D5B 5CD9=1D5C 1 G5978D54 <51CD CAE1B5C 3B9D5B9?> 9C [email protected]@<954 G85B5 9C D85 [email protected]=1< @1B1=5D5B F1<E5 ?6 D85 5CD9=1D54 @1B1=5D5BC <9CD54 9> ,12<5 1>4 D85 ?D85B @1B1=5D5BC 1B5 38?C5> 1C 9C 1 2<?3; 4917?>1< =1DB9H G9D8 D85 [email protected]@[email protected] C31<9>7 613D?BC 5 7 ?>5 ?6 D85 41D1 @?9>DC C55=54 D? 25 1> ?ED<95B C? D85 [email protected]?>49>7 G5978D9>7 Parameter Identifiability Analysis and Model Fitting of Biological Wastewater Model 413 613D?B G1C 38?C5> 1C 'EB 3B9D5B9?> 45C3B925C 1 =E<[email protected] @B5493D9?> 5BB?B 1>4 9D 9C G5<< ;>?G> D81D CE38 1 3B9D5B9?> =1I 81F5 =E<[email protected]<5 =9>9=1 5F5> 6?B <9>51B =?45<C 1=C<?B1 7B1495>D21C54 =5D8?4 CE38 1C %1D<12C =1I D8EC 51C9<I 25 [email protected] 9> 1 <?31< =9>9=E= 1>4 9D 9C C165B D? EC5 1 7<?21< =5D8?4 CE38 1C D85 9>;5<#5<<5I [email protected]=9J1D9?> 1<7?B9D8= 9>;5< ,12<5 [email protected]?> ?6 9>9D91< 1>4 5CD9=1D54 @1B1=5D5B F1<E5C !.!*%0%. in Return Sludge S S NH [mg/l] 4 4 2 0 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 20 in Effluent NO [mg/l] 3 ,$%) 2!)($!0(,+ ,85 5F?<ED9?> ?6 C?=5 ;5I [email protected] [email protected]<1I54 9> 97 D85 B51< [email protected] 6B?= D85 @<1>D 1>4 D85 @B5493D9?>[email protected] ?F5B 41IC ?B [email protected]?> G5 1<C? 9>3<E45 D85 =?45< [email protected] G8938 G9<< 9>4931D5 8?G =E38 D85 =?45< 81C 255> [email protected]?F54 D8B?E78 @1B1=5D5B 5CD9=1D9?> ,85 3?>35>DB1D9?>C ?6 C?<E2<5 @[email protected]?B?EC 1>4 D?D1< @[email protected]?B?EC 16D5B @1B1=5 D5B 5CD9=1D9?> 41C854 1B5 AE9D5 3<?C5 D? D85 B51< 41D1 <D8?E78 C?=5 41D1 @?9>DC C55= D? 25 ?ED<95BC D85 C9=E<1D9?> B5CE<DC C55= D? =1D38 D85 41D1 B51C?>12<I G5<< 33?B49>7 D? B5AE9B5 =5>DC ?6 D85 @<1>D D85 =?45< @B9=1B9<I C9=E<1D5C 29?<?7931< @[email protected]?B?EC B5=?F1< G8938 31> 25 ?2C5BF54 6B?= D85 D9=5 5F?<ED9?> ?6 1>4 C55 1<C? +1B=95>D? 5BB5B? 5D 1< ,8EC D85 =?45< 81C =19><I 255> 14:ECD54 D? 79F5 7??4 @B5493D9?> ?6 D85 =51CEB5=5>DC B5<1D54 D? @[email protected]?B?EC 10 0 in Effluent 2 1 0 0.4 in Effluent Ptot [mg/l] 4 S PO [mg/l] 3 0.3 0.2 Time [days] 97 [email protected]?> ?6 =?45< [email protected] 16D5B @1B1=5D5B 5CD9=1D9?> 41C854 G9D8 D85 B51< 41D1 C?<94 9>3<E49>7 9>9D91< =?45< [email protected] 4?DD54 ,85 @B5493D9?> ?6 ?D85B [email protected] 5 7 D85 3?>35>DB1D9?>C ?6 C?<E2<5 >9DB1D5C 1>4 C?<E2<5 1==?>9E= 1B5 <5CC 7??4 ,89C 9C @B?212<I 4E5 D? D85 <13; ?6 =51CEB5=5>D ?6 D85 9>E5>D [email protected]?C9D9?>C 6B?= D85 B51< @<1>D CE38 D81D D85 9>@ED ?6 D85 =?45< 31>>?D 5H13D<I [email protected]>D D85 414 Q. Chai et al. 381B13D5B9CD93 ?6 D85 [email protected]=5>D1< 9>E5>D 'D85BG9C5 9> D85 +%4 1F5B175 [email protected] 6B?= @[email protected]<1D9?>C 1B5 3?>C945B54 9> ?B45B D? [email protected]<96I D85 =?45<C ,85 CDB?>7 [email protected]<931D9?>C ?6 D85 +%4 =1I 1<C? 31EC5 D85 @??B @B5493D9?> !> 1>I 31C5 D85 =?45< C55=C D? [email protected] D85 =19> 4I>1=93C ?6 D85 CICD5= +9>35 G5 =19><I 3?>35B> ?EBC5<F5C G9D8 @[email protected]?B?EC [email protected] D85 B5<1D9F5<I @??B @B5493D9?> [email protected]<9DI ?6 >9DB?75> [email protected] 9C [email protected]<5 (1B1=5D5B 5CD9=1D9?> 1>4 F1<941D9?> ?6 +%4 9C ?6 [email protected]?BD1>35 96 D85 =?45<C 1B5 D? 25 EC54 6?B @B5493D9?> ?G5F5B D85 @1B1=5D5BC ?6 D85 +%4 =?45< 1B5 ECE1<<I @??B<I 945>D912<5 6B?= D85 1F19<12<5 41D1 !> D89C @[email protected] 1 =5D8?4 6?B 1CC5CC9>7 @1B1=5D5B 945>D9129<9DI ?6 <1B75 C31<5 =?45<C 21C54 ?> [email protected]=5>D1< 41D1 9C 49C3ECC54 ,85 =5D8?4 9C [email protected]@<954 D? 1 =?45< ?6 1 29?<?7931< G1CD5G1D5B DB51D=5>D @<1>D ,85 [email protected]?F54 @1B1=5D5B 5CD9=1D5C 1B5 6?E>4 EC9>7 D85 9>;5<#5<<5I [email protected]=9J1D9?> 1<7?B9D8= 6?B <51CD CAE1B5C =9>9=9J1D9?> 9>1<<I D85 =?45< 9C F1<941D54 1719>CD D85 ?B979>1< [email protected]=5>D1< 41D1 ,85 =?45< D 9C AE9D5 7??4 6?B D8?C5 [email protected] D81D =1DD5B 9> D85 [email protected]?> ?6 D85 @<1>D ?G5F5B D85 D ?6 ?D85B [email protected] 9C <5CC 7??4 ,85 B51C?> 6?B D89C 9C D81D D85 9>E5>D [email protected]?C9D9?>C 81F5 >?D 255> =51CEB54 9>CD514 C?=5 [email protected]?C9D9?>C 21C54 ?> @B?35CC [email protected]>35 81F5 255> EC54 EDEB5 G?B; G9<< 9>3<E45 CD1D9CD931< 1>1<IC9C ?6 D85 @1B1=5D5BC 1>4 @B5493D9?> [email protected]<9D95C ?6 D85 =?45< <C? ?D85B [email protected]=9J1D9?> 1<7?B9D8=C =1I 25 3?=29>54 G9D8 D85 =5D8?4 D? [email protected]?F5 D85 [email protected]?> [email protected] 1>4 133EB13I ?6 @1B1=5D5B 5CD9=1D9?> <D8?E78 D85 9>E5>D [email protected]?C9D9?> 9C 1> [email protected]?BD1>D 9>@ED D? D85 =?45< 9D 9C 4963E<D D? =51CEB5 9> @B13D935 !D =1I D8EC 25 ?6 9>D5B5CD D? H =?45< @1B1=5D5BC 1>4 5CD9=1D5 9>E5>D [email protected]?C9D9?>C 9>CD514 BE> * #P8>9 % +957B9CD E:5B / *59385BD ( 0(B13D931< 945>D9129<9DI ?6 +%4 @1B1=5D5BC CICD5=1D93 C5<53D9?> 1>4 DE>9>7 ?6 @1B1=5D5B CE2C5DC . , - ,# K BE> * *59385BD ( #P>C38 * 0(B13D931< 945>D9129<9DI 1>1<IC9C ?6 <1B75 5>F9B?>=5>D1< C9=E<1D9?> =?45<C . , -*/, - K 1=C<?B1 " '@D9=1< ?>DB?< ?6 1D38 =E<C9?> (?<I=5B9C1D9?> ?6 .9>I< 8<?B945 (8 D85C9C &?BG5791> ->F95BC9DI ?6 +395>35 1>4 ,538>?<?7I I>1C9= 3(*' /'.$)"$) ,$)" * '$)" ) $(/'.$*) I>1C9= $E>4 +G545> 9>;5< '*' +.$($4.$*) '"*,$.#( [email protected] >3CE 54E 45>;5<B5C51B389>45H 8D=< B9DJC?> ( ,$)$+' - *! % .,$ ). * '$)" ) $(/'.$*) 1$.# * '$ ! (B5CC (9C31D1G1I &" !+& 5B>15I # . $??C4B538D % . 5>J5 % $9>4 % "OB75>C5> + 03D9F1D54 C<E475 G1CD5G1D5B DB51D=5>D @<1>D =?45<<9>7 1>4 C9=E<1D9?> +D1D5 ?6 D85 1BD )0$,*)( ).' * ''$)" ) *!.1, K 5>J5 % E:5B / F1> $??C4B538D % % %9>? , .$0. '/" * '- ) .?< ?6 $ ).$ ) #)$' +*,. !/ (E2<9C89>7 *5938< 0/1CD5/1D5B 1 <92B1BI 6?B =?45<<9>7 1>4 C9=E<1D9?> ?6 G1CD5G1D5B DB51D=5>D @<1>DC 9> =?45<931 ,* $)"- *! .# , ). ,).$*)' * '$ *)! , ) @@ K +1B=95>D? 5BB5B? 819 ) E5N1C M5J % =B1>9 + $95 0+ICD5=1D93 1>1<IC9C ?6 @1B1=5D5B 945>D9129<9DI 6?B [email protected]?F54 DD9>7 ?6 1 29?<?7931< G1CD5G1D5B =?45< D? [email protected]=5>D1< 41D1 * '$)" ).$.$*) ) *).,*' !> @B5CC Paper C: Comparison of State Estimation Techniques, Applied to a Biological Wastewater Treatment process This paper was presented at the conference and published in the Proceedings of the 10th International IFAC Symposium on Computer Applications in Biotechnology (CAB - 2007) held in Cancun, Mexico, 4 –6 June 2007, pp. 353 –358. 139 140 10th International IFAC Symposium on Computer Applications in Biotechnology Preprints Vol.1, June 4-6, 2007, Cancún, Mexico COMPARISON OF STATE ESTIMATION TECHNIQUES, APPLIED TO A BIOLOGICAL WASTEWATER TREATMENT PROCESS Qian Chai , Beathe Furenes , Bernt Lie >1 Telemark University College, P.O. Box 203, N-3901 Porsgrunn, Norway Abstract: In this paper the problem of optimal state estimation in a biological wastewater treatment process (WWTP) is considered. The standard Kalman lter (KF) and its extensions: the extended Kalman lter (EKF) and the unscented Kalman lter (UKF), are used to estimate the unmeasured state. The prediction of the state with the standard KF is poor due to the high nonlinearity of the biological WWTP. Thus, the nonlinear estimation approaches are focused, with a comparison between the EKF and the UKF. The simulation results show that the UKF provides slightly better state estimate than the EKF for both an observable c 2007 IFAC process and an unobservable process. Copyright ° Keywords: State estimation, Kalman lter, Wastewater treatment process 1. INTRODUCTION ter gain computation algorithm can be applied. Although the EKF maintains the elegant and computationally ecient recursive update form of the standard KF, the EKF typically works well only in the region where the rst-order Taylor series linearization adequately approximates the nonlinear probability distribution (Crassidis & Junkins 2004). To overcome this limitation, Julier et al. (1995) proposed the unscented Kalman lter (UKF) as an alternative to the EKF in nonlinear estimation. The UKF generates a population of so-called sigma points based on the current mean and covariance of the state, and permits the direct propagation of the mean and covariance through the actual nonlinear system. The applications and comparisons of the EKF and the UKF have been discussed in a number of studies, e.g. Wan & van der Merwe (2000) and Romanenko & Castro (2004). State estimation of dynamic systems is an important prerequisite for safe and economical process operation. There is a wide range of techniques in the literature designed for state estimation in both linear and nonlinear dynamic systems. The Kalman lter (KF) (Kalman 1960) is one of the most widely used methods for state estimation and tracking due to its simplicity and robustness. The standard Kalman lter is the algorithm of choice in state estimation for linear systems. The approach can be used to reconstruct variables that are not measured and to reduce the eect of noise on the available measurements. However, since most practical systems involve nonlinearity of one kind or another, the problem of nonlinear estimation is extremely important. Therefore, the Kalman lter was early on extended in a somewhat ad hoc way to include nonlinear dynamic models in the extended Kalman lter (EKF). For the computation of the lter gain, the EKF simply linearizes the nonlinear models about the current estimate so that the standard Kalman l1 In the last decades, due to the increasingly strict requirements on treated wastewater, the need to monitor systems and automatically control biological wastewater treatment processes (WWTPs) is rapidly increasing. To reconstruct the state of the system from the few available measure- Corresponding author: [email protected] 353 where |n+1 denotes the actual measurement at step n + 1. The Kalman gain Nn is chosen to minimize the a posteriori estimate error covariance Sn|n . Note that the equation for the a posteriori state covariance Sn|n is called the stabilized implementation, because it has better numerical properties than some other frequently used equations for Sn|n , e.g. Sn|n = (L Nn F) Sn|n1 . ments and to control important biological variables, appropriate algorithms have to be developed. Some state estimation algorithms for WWTPs have been described in Dochain & Vanrolleghem (2001), and Olsson & Newell (1999). Also, in Keesman (2002), Boaventura et al. (2001), Lukasse et al. (1999), and Zhao & Kümmel (1995), the EKF has been applied to simplied WWTP models, but the application of the UKF to WWTPs is not studied much in the literature. 2.2 Extended Kalman lter (EKF) The objective of this study is to demonstrate (i) the application of the standard KF, the EKF, and the UKF to state estimation of a biological WWTP and (ii) the dierences in performance of these estimation approaches. As an example, a nitrogen removal process described by the Activated Sludge Model No. 3 (ASM3) (Gujer et al. 1999) is considered. The state estimation is carried out for the complete ASM3 model. For several reasons, state estimation for nonlinear systems is considerably more dicult and admits a wider variety of solutions than the linear problem (Crassidis & Junkins 2004). In this paper, we discuss two dierent approaches to achieve estimation for nonlinear systems: the method of EKF uses the recursive update form of standard KF by linearizing the nonlinear model at each time step, and the method of UKF uses a set of appropriately chosen weighted points to parameterize the means and covariances of probability distributions. The paper is organized as follows. In Section 2, the Kalman lter based state estimation approaches are summarized. In Section 3, the approaches are illustrated on a wastewater nitrogen removal process. The comparison between the EKF and the UKF is shown. Finally, some conclusions are drawn in Section 4. The nonlinear system is described by the stochastic model {n+1 = i ({n > xn > zn ) 2.1 Standard Kalman lter (KF) |n = j ({n > xn > yn ) ¢ ¡ where {1 N { ˆ1|1 > S1|1 , zn N (0> Tn ), and yn N (0> Un ). { ˆ1|1 , S1|1 , Tn , and Un are assumed to be known. To better understand how nonlinear estimators work, it is useful to focus on the linear case rst. A linear system, approximated in discrete time is given as The EKF algorithm can be summarized as the following set of equations: ¡ ¢ { ˆn+1|n = i { ˆn|n > xn > 0 2. STATE ESTIMATION APPROACHES Sn+1|n = Dn Sn|n DWn + Jn Tn JWn ¡ W W Fn+1 Sn+1|n Fn+1 Nn+1 = Sn+1|n Fn+1 ¢ 1 W +Kn+1 Un+1 Kn+1 ¡ ¢¢ ¡ { ˆn+1|n+1 = { ˆn+1|n + Nn+1 |n+1 j { ˆn+1|n > xn+1 > 0 {n+1 = D{n + Exn + Jzn |n = F{n + yn q{ where {n R is the state, xn Rqx is the control input, and |n Rq| is the controlled output. zn Rqz and yn Rqy present the process noise and measurement noise, respectively. They are assumed to be zero-mean Gaussian noise processes zn N (0> Tn ) and yn N (0> Un ). Sn+1|n+1 = (L Nn+1 Fn+1 ) Sn+1|n (L Nn+1 Fn+1 )W W W +Nn+1 Kn+1 Un+1 Kn+1 Nn+1 > where matrices Dn , Jn , Fn , and Kn are dened as the following Jacobians: A standard KF formulation for estimating the process state {, where { is assumed to be initially normally distributed with expectation { ˆ1|1 and covariance S1|1 , is given by: ¯ ¯ Ci ¯¯ Ci ¯¯ > J = n C{ ¯{ˆn|n >xn >0 Cz ¯{ˆn|n >xn >0 ¯ ¯ Cj ¯¯ Cj ¯¯ Fn = > Kn = = C{ ¯{ˆn|n1 >xn >0 Cy ¯{ˆn|n1 >xn >0 Dn = { ˆn+1|n = Dˆ {n|n + Exn Sn+1|n = DSn|n DW + JTn JW ¡ ¢1 Nn+1 = Sn+1|n F W FSn+1|n F W + Un+1 ¡ ¢ { ˆn+1|n+1 = { ˆn+1|n + Nn+1 |n+1 F { ˆn+1|n 2.3 Unscented Kalman lter (UKF) W Sn+1|n+1 = (L Nn+1 F) Sn+1|n (L Nn+1 F) We initiate the UKF by ¡ ¢ ˆ1|1 > S1|1 = {1 N { W +Nn+1 Un+1 Nn+1 > 354 Fig. 1. Model diagram of the nitrogen removal plant implemented in Modelica/Dymola. First, an augmented state is dened as {n d {n = zn = yn { ˆn+1|n = l=0 |ˆn+1|n = l l Zp Yn+1|n > l=0 Hn+1|n = 2q{ ˜ X l=0 Y W Y = (q{˜ + ) S̃n|n Vn+1|n = where = 2 (q £ {˜ + )¤ q{˜ is a scaling parameter (typically 104 > 1 and = 0). Let Yl denote column l of matrix Y . 2q{ ˜ X l=0 h ih iW l l Zfl Yn+1|n |ˆn+1|n Yn+1|n |ˆn+1|n h ih iW l l Zfl Xn+1|n { ˆn+1|n Yn+1|n |ˆn+1|n > where Hn+1|n represents the innovation covariance, and Vn+1|n represents the cross correlation matrix between { ˆn+1|n and |ˆn+1|n . l Next, we dene 2q{˜ + 1 sigma points X̃n|n with corresponding weights Zl as follows: l X̃n|n 0 Zp Zf0 l Zp l l Zp Xn+1|n and the predicted covariances as 2q{ ˜ h ih iW X l l Sn+1|n = Zfl Xn+1|n { ˆn+1|n Xn+1|n { ˆn+1|n The size of { ˜n|n is q{˜ = q{ + qz + qy . Introduce matrix Y as the Cholesky root of (q{˜ + ) S̃n|n : We can now compute the UKF gain Nn+1 as ={ ˜n|n l ={ ˜n|n + Yl X̃n|n 2q{ ˜ X l=0 The mean and covariance of the augmented state vector are { ˆn|n Sn|n 0 0 { ˜n|n = 0 > S̃n|n = 0 Tn 0 . 0 0 0 Un 0 X̃n|n 2q{ ˜ X 1 Nn+1 = Vn+1|n Hn+1|n > l = 1> = = = > q{˜ ={ ˜n|n Ylq{˜ and nally the updated estimates of state and covariance as ¡ ¢ { ˆn+1|n+1 = { ˆn+1|n + Nn+1 |n+1 |ˆn+1|n l = q{˜ + 1> = = = > 2q{˜ = @ (q{˜ + ) ¡ ¢ = @ (q{˜ + ) + 1 2 + = Zfl = [email protected] [2 (q{˜ + )] W Sn+1|n+1 = Sn+1|n Nn+1 Hn+1|n Nn+1 = l = 1> = = = > 2q{˜ Compared with the EKF, the UKF features two main advantages: (i) the UKF avoids the computation of the Jacobian matrices, and (ii) the UKF achieves a third order accuracy in the Taylor series expansion of the statistics of the state, whereas the EKF is at most rst order accurate. where is used to incorporate prior knowledge of the distribution (with Gaussian distribution = 2). l Dene Xn|n to be the vector of the rst q{ elel l , Wn|n to be the vector of the next ments of X̃n|n l l , and Vn|n to be the vector of qz elements of X̃n|n 3. APPLICATION TO A NITROGEN REMOVAL PROCESS l . The predicted sigma the last qy elements of X̃n|n l l points Xn+1|n and Yn+1|n are given by: ³ ´ l l l Xn+1|n = i Xn|n > xn > Wn|n > l = 0> = = = > 2q{˜ ´ ³ l l l > l = 0> = = = > 2q{˜ . Yn+1|n = j Xn+1|n > xn > Vn|n 3.1 Process model In this study, a laboratory-scale nitrogen removal plant is considered. More details of the process are given in Chai et al. (2006). The process model consists of an aeration tank model in which oxygen We then compute the predicted means as 355 12 0.4 10 SNH4 [mg/l] SS [mg/l] 0.45 0.35 0.3 0.25 1 2 0 1 2 Time [days] 6 4 2 3 XA [mg/l] XSTO [mg/l] 0.2 0 260 240 220 200 180 160 140 8 3 55 50 45 40 35 30 25 0 1 2 3 0 1 2 Time [days] 3 Fig. 2. Simulation results of the standard KF (dash-dot), the EKF (dotted), and the UKF (dashed). The solid line represents the true states. is supplied, and a settler model where the sludge is separated from the liquid being treated. ASM3 describes the biological processes involved in the aeration tank. The states of the model are grouped into the concentration of soluble components Vm and particulate components [m . The kinetic and stoichiometric parameter values are taken from the typical parameter values suggested in ASM3 publications. Assuming perfect mixing in the reactor, the mass balance in the aeration tank results in: g{d Tlq {lq + Tuv {uv (Tlq + Tuv ) {d = gw Yd +u + h1 AO2 > 2004) using the Dymola simulation environment (Dynasim 2004), see Figure 1, based on modications of the free Modelica library WasteWater (Reichl 2003). Dymola generates a convenient interface to Matlab such that Modelica models can be executed within MATLAB. 3.2 Results and discussion MATLAB is used for implementation of the estimation approaches. To estimate the state, we need measurements from the plant. As an initial study before doing state estimation based on real data from the plant, we choose to check whether reasonable state estimates can be obtained based on response from the simulation model. where {lq , {uv , {d R13 contain the concentrations in the inuent, in the recycled sludge, and in the reactor, respectively; their components are Observability is an important concept in dynamic systems in general. Observability depends mainly on the choice of measurement variables. In this case, to ensure that the system is fully observable, the following measurement variables are chosen: the concentration of total nitrogen TN in the euent, as well as the concentrations of dissolved oxygen VO2 , dinitrogen VN2 , inert particulate organics [I , and total suspended solids [SS in the aeration tank 2 . The state and measurement vectors are subject to zero mean additive white noise with covariances ³¡ ¢2 ´ Tn = T = diag {o · 103 and ´ ³¡ ¢ 2 Un = U = diag |o · 104 > {o = [VO2 >o VI>o VS>o VNH4 >o VN2 >o VNOX>o VALK>o [I>o [S>o [H>o [STO>o [A>o [SS>o ]W > o {lq, uv, d}; u R13 is the reaction rates of each component (dened in ASM3); h1 is the standard basis for the rst coordinate i R13 .¡AO2 describes ¢ vdw the oxygen transfer: AO2 = NO d VO VO2 >d , 2 where NO d is the oxygen transfer coecient which vdw is the control input variable in this study, and VO 2 is the saturated dissolved oxygen concentration. Assuming that the settler is a perfect splitter, the resulting mass balance equations are as follows: Euent concentration: Vm>e = Vm>d , [m>e = 0 respectively, where ({o > |o ) is the operating point. The chosen noise levels are relatively low in this introductory phase of the study. Larger noise covariances will be considered in future work. Recycled sludge concentration: Vm>uv = Vm>d , [m>uv = Tlq + Tuv [m>d . Tuv + Tz 2 In practice, some of these measurement variables may be dicult to measure; in this study, we assume that they are available. The dynamic model is implemented in the objectoriented modeling language Modelica (Fritzson 356 x 10 -3 0.02 3 SNH4 [mg/l] SS [mg/l] 4 2 1 0 0 1 2 0.005 1 2 3 1 2 Time [days] 3 0.04 XA [mg/l] XSTO [mg/l] 0.01 0 0 3 0.4 0.3 0.2 0.03 0.02 0.01 0.1 0 0.015 0 1 2 Time [days] 0 3 0 Fig. 3. Comparison of the estimation errors of the EKF (dotted) and the UKF (dashed) for the observable process. x 10-3 0.02 SNH4 [mg/l] SS [mg/l] 4 3 2 1 1 2 0.3 0.2 0.1 0 0 0.01 0.005 0 0 0.04 3 XA [mg/l] XSTO [mg/l] 0 0 0.4 0.015 1 2 3 0.03 0.02 0.01 1 2 Time [days] 0 0 3 1 2 Time [days] 3 Fig. 4. Comparison of the estimation errors of the EKF (dotted) and the UKF (dashed) for the unobservable process. Figure 2 illustrates the performances of the standard KF, the EKF, and the UKF. Four unmeasured states, which most clearly exhibit the difference of the estimation results between the EKF and the UKF, are shown in the gure: the concentrations of readily biodegradable substrates VS , ammonium VNH4 , organics stored by heterotrophs [STO , and autotrophic biomass [A . The prediction of the states with the standard KF is poor because of the nonlinear characteristics of the biological WWTP dynamics. Nonlinear estimation is therefore imperative for biological WWTPs. In Figure 2, both the EKF and the UKF track all the states of the process; indeed, the performance of the EKF and the UKF are quite similar. To compare the estimation qualities of the EKF and the UKF, Figure 3 plots the relative squared estimation errors of the lters which are relative to the true states. The result shows that the EKF and the UKF give the similar estimation error for the concentrations of the soluble components (VS , VNH4 ). However, for the concentrations of the particulate components ([STO , [A ), the superior performance of the UKF is clear. In WWTPs, measuring most state variables is either dicult or expensive. This time, we assume that only the concentration of total nitrogen TN in the euent and the concentration of dissolved oxygen VO2 in the aeration tank are the available measurement variables for the nitrogen removal process. By performing observability analysis of a linearized model, we nd that this system is not observable. However, the system is detectable since the dynamics of the lter error is asymptotically stable; detectability guarantees convergence of the lter. Figure 4 depicts the estimation errors of the unobservable process with the EKF and the UKF. By comparing Figure 4 with Figure 3, we nd that the estimation errors of the unobservable process are slightly larger than the observable process for both the EKF and the UKF. With the UKF, the state estimates for the unobservable process are more noisy than for the observable process. However, for the unobservable (but detectable) process, the EKF and the UKF still give reasonable estimates for the unmeasured states. Hence, if the available measurements are adequate for the dynamic system’s requirements, 357 Table 1. Mean estimation errors over 3 days. Method VS Observable process EKF 1=3 × 1034 UKF 7=6 × 1035 Unobservable process EKF 1=5 × 1034 UKF 1=3 × 1034 VNH4 [STO Chai, Q., Bakke, R. & Lie, B. (2006), ‘Objectoriented modeling and optimal control of a biological wastewater treatment process’, Proceedings of the Eighth IASTED International Conference on Control and Applications pp. 218—223. ISBN: 0-88986-553-1. Crassidis, J. & Junkins, J. (2004), Optimal estimation of dynamic systems, ISBN 1-58488391-X, Chapman & Hall/CRC. Dochain, D. & Vanrolleghem, P. (2001), Dynamical modelling and estimation in wastewater treatment processes, ISBN 1900222 50 7, IWA Publishing, London, UK. Dynasim (2004), Dymola Multi-Engineering Modeling and Simulation, Dynasim AB, Lund, Sweden. Fritzson, P. (2004), Principles of Object-Oriented Modeling and Simulation with Modelica 2.1, IEEE Press, Piscataway, NJ. ISBN 0-47147163-1. Gujer, W., Henze, M., Mino, T. & van Loosdrecht, M. (1999), ‘Activated Sludge Model No. 3’, Wat. Sci. Tech. 39(1), 183—193. Julier, S., Uhlmann, J. & Durrant-Whyte, H. (1995), ‘A new approach for ltering nonlinear systems’, American control conference pp. 1628—1632. Kalman, R. (1960), ‘A new approach to linear ltering and prediction problems’, the ASMEJournal of Basic Engineering 82 (Series D), 35—45. Keesman, K. (2002), ‘State and parameter estimation in biotechnical batch reactors’, Control Engineering Practice 10, 219—225. Lukasse, L., Keesman, K. & van Straten, G. (1999), ‘A recursively identied model for short-term predictions of nh4/no3concentrations in alternating activated sludge processes’, Journal of Process Control 9, 87— 100. Olsson, G. & Newell, B. (1999), Wastewater Treatment Systems. Modelling, Diagnosis and Control, IWA Publishing, London. Reichl, G. (2003), ‘WasteWater a library for modelling and simulation of wastewater treatment plants in modelica’, Proceedings of the 3rd International Modelica Conference pp. 171—176. Romanenko, A. & Castro, J. (2004), ‘The unscented lter as an alternative to the EKF for nonlinear state estimation: a simulation case study’, Computers and Chemical Engineering 28, 347—355. Wan, E. & van der Merwe, R. (2000), The unscented Kalman lter for nonlinear estimation, in ‘Proc. of IEEE Symposium 2000 (ASSPCC)’, Lake Louise, Alberta, Canada. Zhao, H. & Kümmel, M. (1995), ‘State and parameter estimation for phosphorus removal in an alternating activated sludge process’, Journal of Process Control 5(5), 341—351. [A 8=5 × 1034 7=6 × 1032 6=4 × 1033 1=5 × 1033 1=4 × 1032 2=2 × 1033 1=5 × 1033 8=9 × 1032 1=2 × 1032 4=4 × 1033 2=5 × 1032 8=4 × 1033 a fully observable system may not be necessary (Crassidis & Junkins 2004). Finally, to give an overview of the estimation capabilities of the EKF and the UKF, the mean estimation errors for the aforementioned states over 3 days are summarized in Table 1. For the most states, UKF provides better state estimation than the EKF for both the observable process and the unobservable process (also see Figures 3 and 4). 4. CONCLUSIONS In this paper, we investigate the use of the standard KF, the EKF, and the UKF in state estimation of a typical biological WWTP and compare the dierences in performance of these estimation approaches. First, the general formulations of the Kalman lter based algorithms are introduced. Then, the performances of the estimation algorithms are evaluated by simulation studies. The estimation results show that state estimation with the linear approach (the standard KF) is poor because of the high nonlinearity of the bioprocess. It is therefore important to exploit nonlinear estimation algorithms for biological WWTPs. For the nitrogen removal process, the UKF provides more accurate estimates than the EKF for both the observable process and the unobservable process (see Table 1), which attests to the power of using the UKF for nonlinear systems. In the computation, the EKF takes 8 min, while the UKF takes 23 min, i.e., the computation time of the UKF is about 3 times longer than that of the EKF. The reason for this is that the calculation of the predicted sigma points in the UKF is timeconsuming for the nitrogen removal model. Nevertheless, since the UKF avoids the computation of the Jacobian matrices, the UKF is simpler to implement than the EKF. REFERENCES Boaventura, K., Roqueiro, N., Coelho, M. & Araújo, O. (2001), ‘State observers for a biological wastewater nitrogen removal process in a sequential batch reactor’, Bioresource Technology 79, 1—14. 358 Paper D: Object-oriented Modeling and Optimal Control of a Biological Wastewater Treatment Process This paper was presented at the conference and published in the Proceedings of the Eighth IASTED International Conference on Control and Applications (CA 2006) held in Montreal, Quebec, Canada, 24 –26 May 2006, pp. 218 –223. 147 148 OBJECT-ORIENTED MODELING AND OPTIMAL CONTROL OF A BIOLOGICAL WASTEWATER TREATMENT PROCESS Qian Chai Telemark University College P.O. Box 203, Kjoelnes ring 56 N-3901 Porsgrunn, Norway email: [email protected] Rune Bakke, Bernt Lie Telemark University College P.O. Box 203, Kjoelnes ring 56 N-3901 Porsgrunn, Norway email: [email protected], [email protected] ABSTRACT This paper deals with optimal control of a biological wastewater treatment process. A pilot plant is designed to remove nitrogen with simultaneous nitri cation/denitri cation in a single reactor. The objective of the control in this paper is to force the total nitrogen concentration to track given set points. The dynamic modeling and start-up simulation of the process are rst presented based on the ASM3 model and the object-oriented modeling language Modelica. Next, the optimization problem is speci ed and formulated using a quadratic performance index. Dynamic optimization is used in model predictive control (MPC) based on a linearized model. The control strategy is successfully applied to the simulation model of the pilot plant. maintain convenient sludge age characteristics and high reaction rates. Speci cally, for nitrogen removal, nitri cation and denitri cation occur simultaneously in the unique aeration tank. Nitrogen is removed in these two steps: ammonium is rst oxidized to nitrate under nitri cation/the aerobic step; the produced nitrate is then transformed into nitrogen gas under denitri cation/the anoxic step [3]. Influent Qin, xin Settler Effluent Qeff, xeff Recycled sludge Qrs, xrs Wasted sludge Qw Figure 1: Schematic diagram of a typical activated sludge process. Introduction The simultaneous nitri cation-denitri cation (SNdN) applications require oxygen control or other types of control methods to assure that both nitri cation and denitri cation occur in a single tank. Most of small size wastewater treatment plants use very simple control strategies (e.g. time control, manual control) or implement more “advanced” controllers such as proportional controllers [4]. Although biological removal of organic matter from wastewater is correctly handled in most cases by means of the aforementioned controls, the nitrogen concentration in the treated wastewater may signi cantly exceed the allowed levels. In this study, a laboratory-scale nitrogen removal plant is considered. The objective is to develop aeration strategies for optimal nitrogen removal by using dynamic optimization methods. The application of dynamic optimization methods requires a suf ciently accurate mathematical model describing the wastewater treatment process. The present work uses the recently developed Activated Sludge Model No. 3 (ASM3) [5]. ASM3 is for the time being considered the best choice in the modeling of the biological processes involved in the activated sludge tank, especially in dealing with the aerobic and anoxic processes in Water is one of our most precious resources, hence wastewater treatment is a large and growing industry throughout the world. Wastewater contains large quantities of organic matter that tends to deplete oxygen in the water. Furthermore, nitrogen and phosphorus content lead to algae growth. It is thus of importance to reduce the content of organic matter, as well as nitrogen and phosphorus. As one of the means of biological treatment, the activated sludge process is commonly used in wastewater treatment [1]. For small-sized wastewater treatment plants which are appropriate for communities of about 10; 000 person equivalents (p.e.) [2], the process generally consists of a single aeration tank in which oxygen is either supplied by diffusers or surface turbines, and a settler where the microbial culture is separated from the liquid being treated, see Figure 1. In the aeration tank, the micro organisms are used to convert the colloidal and dissolved carbonaceous organic matter into various gases and into cell tissue. Because cell tissue has a speci c gravity slightly greater than that of water, the resulting cells can be removed from the treated liquid by gravity settling in the settler. Most of the cells are recycled and mixed with incoming wastewater to 529-052 Air Qin + Qrs KEY WORDS Wastewater treatment; ASM3 model; Optimal control; Predictive control 1 Aeration tank 218 the same tank [6]. To give an open and exible model representation, the general-purpose modeling language Modelica is chosen. Modelica is an object-oriented modeling language with advantages such as suitability for multidomain modeling, the usage of general equations of physical phenomena, the reusability of model components, and a hierarchical model structure [7]. The paper is organized as follows. In section 2, the dynamic model of the nitrogen removal plant is described and implemented in Modelica. In section 3, the optimization problem is speci ed; the optimization method and results are also discussed. In section 4, the optimization method is used in a closed loop by applying model predictive control (MPC). Finally, some conclusions are drawn in section 5. 2 2.1 where xin , xrs , xa 2 R13 contain the concentrations in the in uent, in the recycled sludge, and in the reactor, respectively; their components are xl = [SO2;l SI;l SS;l SNH4 ;l SN2 ;l SNOX;l SALK;l T XI;l XS;l XH;l XSTO;l XA;l XSS;l ] ; l 2 fin, rs, ag; r 2 R13 is the vector formed by the reaction rates of each component (de ned in ASM3); e is a 13-dimensional auxiliary vector with 1 in the rst element and 0 in the other elements of the vector. The mass balance equation contains the additional term AO which describes the oxygen transfer from the diffusers: sat A O = K L a SO SO;a where KL a is the oxygen transfer coef cient which is a sat is the satufunction of the supplied air owrate, and SO sat 10 g= m3 ). rated dissolved oxygen concentration (SO Process Model Nitrogen removal plant model Settler model The pilot nitrogen removal process consists of a unique aeration tank (Va = 40 l) equipped with an air blower with diffuser which provides oxygen, and a mixer which makes the tank behave as continuous stirred tank reactor (CSTR). The settler is a cylindrical pipe located in the aeration tank, where the sludge is either recycled to the aeration tank or extracted from the system. The recycled sludge is proportional to the in uent owrate, i.e. Qrs = 0:8 Qin . The waste sludge owrate Qw is used to manipulate the solids retention time SRT1 , which is the most critical parameter for activated sludge design. The process is operated with constant in uent ow rate (Qin = 96 l= d) and compositions. Hence, the plant model consists of an aeration tank model in which the microbiological processes take place, and a settler model where the liquid and solid phases are separated. General model Aeration tank model Eliminating xrs from Eq. 1 using equations 2 and 3, one can reformulate the dynamic system as a set of ODEs: In this work, the settler is considered a perfect splitter: (i) the sum of the three out ows (ef uent, wasted sludge, and recycled sludge ow rates) equals the settler in uent ow rate; (ii) the ef uent is exclusively constituted of soluble components. The resulting mass balance equations are as follows: Ef uent concentration Sj;e = Sj;a , Xj;e = 0 (2) Recycled sludge concentration Sj;rs = Sj;a , Xj;rs = Qin + Qrs Xj;a . Qrs + Qw (3) dxa = f (xa ; t) . dt ASM3 describes the biological processes involved in the aeration tank. The states of the model are grouped into the concentration of soluble components Sj and particulate components Xj . ASM3 consists of 13 state variables and 36 parameters, see [5] and [8]. The kinetic and stoichiometric parameter values are taken from typical parameter values suggested in ASM3 publications. Assuming perfect mixing in the reactor, the mass balance in the aeration tank results in: 2.2 Model implementation in Modelica The dynamic model is implemented in Modelica using the Dymola simulation environment [9], based on modications of the free Modelica library WasteWater [10]. Compared with most modeling languages available today (e.g. Matlab), Modelica offers important advantages for the implementation of the model. The object-oriented architecture allows the user to move and change a component without modifying the rest of the model, and the components can be reused in various models. Multi-domain capability gives the possibility to easily combine electrical, mechanical etc. models, as well as control systems etc. within Qin xin + Qrs xrs (Qin + Qrs ) xa dxa = + r + eAO dt Va (1) 1 The solids retention time (SRT) is the residence time of the sludge in the reactor system. The simpli ed de nition of the SRT is SRT = Va =Qw : 219 Figure 2: Model diagram of the nitrogen removal plant implemented in Modelica/Dymola. in the same model. The model diagram of the wastewater treatment process is shown in Figure 2. Within Dymola, the model is easily constructed by dragging, dropping, and connecting components chosen from the modi ed WasteWater library. During the simulation, a system of differential algebraic equations (DAE) is established by Dymola. The DASSL integration procedure of Dymola is used to solve the DAE system. Moreover, Dymola generates a convenient interface to Matlab such that Modelica models can be executed within Matlab. An application executing a Modelica model in Matlab is described in [11]. To identify the continuous operation dynamics, simulation of the start-up period of the plant is provided by starting with the aeration tank lled by the incoming wastewater. The in uent wastewater composition is means of simulation. A set point of 10 g m 3 is thus chosen in this study. In this paper, we are concerned with the problem of controlling the total nitrogen (TN) around a speci ed set point (TNsp = 10 g m 3 ) under a set of constraints. We thus consider the oxygen transfer coef cient KL a as control input u 2 Rnu (nu = 1). The output is y = TN 2 Rny (ny = 1) and the state variable is x = xa 2 Rnx (nx = 13). The nonlinear model is linearized about the steady-state conditions indicated in section 2.2, and is discretized with the sampling time Ts = 10 min. The linear, discrete-time model is in the form: xk+1 yk The chosen objective function for the optimization problem is: T xin = [0; 30; 60; 16; 0; 0; 5; 25; 115; 30; 0; 1; 125] : N J= A continuous air supply is employed for 30 days with KL a = 50 d 1 and SRT = 30 d. The simulation results of the start-up operation are shown in Figures 3–5, where the system approaches steady-state after about 20 days. 3 3.1 (4) (5) = Axk + Buk = Cxk : 1X 2 2 2 e + R (KL ai ) + S ( KL ai ) 2 i=1 i (6) where R and S are constant weighting factors. Here, the output error ei is ei = TNsp;i and the control increment Optimal Control (7) TNi ; KL ai is KL ai = KL ai KL ai 1: (8) In addition, the control input is constrained to KL a 2 [0; 240] d 1 . Optimization problem statement Tight requirements have been imposed on the ef uent of wastewater treatment plants by the European Union during the last decade [2]. In particular, nitrogen discharge is strictly regulated in order to reduce the environmental impact of the treated ef uent and to ensure the reliability of the treatment plant. The limit value of the concentration of total nitrogen (TN) is 15 g m 3 for agglomerations of p.e. between 10; 000 and 100; 000. However, an objective of 10 g m 3 is often aimed at to make the plant operation more robust. Furthermore, the mininal value of TN which can be reached for the process is found to be 9:5 g m 3 by 3.2 Optimization method and results The optimization problem described above can be posed as a quadratic programming (QP) problem of the form 1 min F (z) = min z T Hz + cT z (9) z z 2 s.t. Az = a Bz b ` z z zu: 220 XSS XH XI Table 1. Matrices for complete variable set QPformulation. 2400 2200 Concentration [g/m3 ] 2000 1800 A11 = IN; 1 B A15 = IN nx IN; 1 A25 = IN C A41 = IN nu + IN; TNsp = TNsp;1 1600 1400 1200 1000 800 600 400 A 1 Inu TNsp;N T 200 0 0 5 10 15 20 25 where 30 Time [days] KL aT KL aT eT TNT xTa Figure 3: Simulation pro les for suspended solids (XSS ), heterotrophic bacteria (XH ), and inert particulate (XI ). XSTO XA XS SS SI 260 = = = = = (KL a1 ; :::; KL aN ) ; ( KL a1 ; :::; KL aN ) ; (e1 ; :::; eN ) ; (TN1 ; :::; TNN ) ; xTa;1 ; : : : ; xTa;N ; 240 Concentration [g/m3 ] 220 KL a, KL a 2 RN nu 1 ; e, TN 2 RN ny 1 ; and xa 2 RN nx 1 . Matrix H and vector c of Eq. 9 are determined from the requirement that J of Eq. 6 should equal F (z) in Eq. 9. The equality condition Az = a contains the model in Eqs. 4–5 and the de nitions in Eqs. 7–8. For the optimization problem de ned here, inequality Bz b is empty, while constrains are contained in z ` and z u . Thus, the following matrices result ( denotes Kronecker product): 200 180 160 140 120 100 80 60 40 20 0 0 5 10 15 20 25 30 Time [days] Figure 4: Simulation pro les for stored organics (XSTO ), autotrophic bacteria (XA ), slowly biodegradables (XS ), inert soluble (SI ), and readily biodegradables (SS ). SO2 20 SNH4 SN2 SNOX H = c = A SALK TN 18 Concentration [g/m3 ] 16 diag IN R; IN S; IN ny ; 0N ny ; 0N nx 0N (2nu +2ny +nx ) 1 0 1 A11 0 0 0 A15 B 0 0 0 IN ny A25 C C = B @ 0 0 IN ny IN ny 0 A A41 IN nu 0 0 0 T A xa;0 + B KL a0 0(N 1) nx 1 a = 14 ; 0TN 12 10 TNTsp ; 8 KL a0 0(N T 1) nu 1 !T ny 1 ; ; 6 where matrices Aij and TNsp are de ned in Table 1, and xa;0 and KL a0 are known variables. Next, 4 2 0 0 5 10 15 20 25 30 Time [days] Figure 5: Simulation pro les for dissolved oxygen (SO2 ), ammonium (SNH4 ), dinitrogen (SN2 ), nitrite plus nitrate (SNOX ), alkalinity (SALK ), and total nitrogen (TN). = IN nu 1 zu = IN nu 1 KL a` ; 1 IN KL au ; 1 IN T (nu +2ny +nx ) 1 (nu +2ny +nx ) 1 T : To solve the QP problem, QP solver quadprog of the Optimization Toolbox in Matlab is used. The weighting factors R, S are tuning parameters; in this study, we set R = 0 and S = 0:1. To minimize the deviation between the predictor output and the reference, R should be given a small value or 0. Optimal control is considered over a 24 h period, i.e. the horizon is N = 144 when Ts = 10 min. The optimal aeration trajectory for the linearized model is A general introduction to QP formulations and solvers for MPC has been given in [12]. Based on their presentation, we rst de ne the vector of unknowns z as: z T = KL aT ; z` KL aT ; eT ; TNT ; xTa ; 221 4 depicted in Figure 6. The corresponding ef uent concentrations of total nitrogen TN, chemical oxygen demand COD, and dissolved oxygen SO2 are shown in Figure 7. For comparison, we also include the simulation results by using the optimal input sequence KL a to the nonlinear Modelica model, which will indicate whether the optimal control is valid for the nonlinear process model. Model Predictive Control (MPC) Model based predictive control (MPC) changes the open loop optimal control problem of the previous section into a closed loop solution. In order to apply MPC to the model of the pilot plant, we need state estimation to get the current states from measurements. However, in this initial study, it is assumed that a perfect model of the pilot plant is available without any disturbances, and that all state variables are available. Based on these assumptions, the state estimation is not considered in this work. An approach to nonlinear moving horizon state estimation using an activated sludge model, is described in [13]. More introductions of theoretical and practical issues associated with MPC technology can also be found in [12], [14], and [15]. The concentration of TN is controlled to track the set point. Moreover, as another requirement on the ef uent of wastewater treatment plants, COD should be less than 125 g m 3 . This ef uent criterion is satis ed in Figure 7. Hence, the optimal input sequence gives satisfactory control results for both the linearized model used in Matlab and the nonlinear Modelica model. However, open loop operation as described above is very sensitive to model error and unknown disturbance. 50 45 KLa [1/day] 50 KLa [1/day] 45 40 35 40 30 35 25 30 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time [days] Figure 8: Evolution of KL a for the MPC over 1 day. 25 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 12 Time [days] 11.5 TN [g/m3] Figure 6: Evolution of KL a for the optimal control over 1 day, based on a linearized model. 11 10.5 10 9.5 12 0 0.1 0.2 0.3 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.4 0.5 0.6 0.7 0.8 0.9 1 TN [g/m3] 11.5 30.26 11 COD [g/m3] 10.5 10 9.5 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 30.24 30.22 30.26 COD [g/m3] 30.2 30.24 Time [days] Figure 9: MPC simulation results with prediction horizon N = 15. 30.22 30.2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 The prediction horizon N is an important tuning parameter for optimization results. Since the larger N , the closer the MPC solution approaches the full horizon optimal solution, a large N is desirable. On the other hand, N should be as small as possible because 1) the computational burden increases dramatically with N , and 2) larger N requires inclusion of more-steps-ahead predictions and hence more uncertainty. To investigate the effect of N in this application, the controlled process is simulated for N ranging from 5 to 30 sampling intervals. The simulation results show that increasing N increases the MPC accuracy SO2 [g/m3] 0.6 0.4 0.2 0 -0.2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time [days] Figure 7: Comparison of TN, COD, and SO2 for the QP optimal control in Matlab (dashed), with the simulation results by injecting the optimal input into the nonlinear Modelica model (solid). 222 and the computational burden. Speci cally, Figures 8 and 9 indicate the results with the prediction horizon N = 15. The MPC controller performance is satisfactory: the concentration of TN is controlled at its set point, while the concentration of COD is in conformity with the EU ef uent standard. 5 [3] I. Metcalf & Eddy, Wastewater Engineering. Treatment and Reuse, 4th ed. New York: McGraw Hill, 2003. [4] B. Chachuat, N. Roche, and M. Lati , “Dynamic optimisation of small size wastewater treatment plants including nitri cation and denitri cation processes,” Computers & Chemical Engineering, vol. 25, pp. 585–593, 2001. Conclusion [5] W. Gujer, M. Henze, T. Mino, and M. van Loosdrecht, “Activated Sludge Model No. 3,” Wat. Sci. Tech., vol. 39, no. 1, pp. 183–193, 1999. In this paper, the use of a dynamic optimization method to design an optimal aeration strategy for small-size wastewater treatment plants is discussed. The method is applied to a simulated pilot nitrogen removal plant including simultaneous nitri cation-denitri cation. A dynamic model describing the pilot plant is rst developed based on the ASM3 model and is implemented in Modelica with the modi ed WasteWater library. The dynamic start-up simulation of the plant is pursued in order to evaluate the normal operating conditions. Then, the determination of the optimal aeration pro le for the system is accomplished by both the open loop optimal control and the closed loop operation (MPC). The optimal controllers are designed to maintain the total nitrogen concentration TN at prespeci ed levels by acting on the oxygen transfer coef cient KL a. We formulate the optimization problem using the state space model of the process, and pose it as a QP problem with a complete set of variables [12]. The performances of the control strategies are evaluated by simulation studies. The simulation results show that the concentration of TN is controlled to track the set point. Thus, the controller performance is satisfactory. In this work, the optimal control strategy has been applied to a simulation model. In the future, the strategy will be tested on the laboratory model. To get the current state based on the measurements from the real process, application of a state estimation approach (e.g. Kalman lter) in MPC is planned. Also, the convergence capabilities of the optimization method may be studied. In addition, current operating modes are given over short time horizons (24 h period). However, since the in uent ow rate and compositions are likely to exhibit large variations from one day to the other, additional studies are required to analyze long term effects of optimization. [6] S. Balku and R. Berber, “Dynamics of an activated sludge process with nitri cation and denitri cation: Start-up simulation and optimization using evolutionary algorithm,” Computers & Chemical Engineering, 2005, in Press. [7] P. Fritzson, Principles of Object-Oriented Modeling and Simulation with Modelica 2.1. Piscataway, NJ: IEEE Press, 2004, iSBN 0-471-47163-1. [8] M. Henze, P. Harremoës, J. la Cour Jansen, and E. Arvin, Wastewater Treatment. Biological and Chemical Processes, 2nd ed. Berlin: Springer, 1996. [9] Dynasim, Dymola Multi-Engineering Modeling and Simulation. Lund, Sweden: Dynasim AB, 2004. [10] G. Reichl, “WasteWater a library for modelling and simulation of wastewater treatment plants in modelica,” Proceedings of the 3rd International Modelica Conference, pp. 171–176, 2003. [11] Q. Chai, S. Amrani, and B. Lie, “Parameter identi ability analysis and model tting of a biological wastewater model,” Accepted by ESCAPE-16 and PSE'2006, 2006. [12] B. Lie, M. Dueñas Díez, and T. A. Hauge, “A comparison of implementation strategies for MPC,” Modeling, Identi cation and Control, vol. 26, pp. 39–50, 2005. [13] E. Arnold and S. Dietze, “Nonlinear moving horizon state estimation of an activated sludge model,” Large Scale System: Theory and Applications. 9th IFAC/IFORS/IMACS/IFIP symposium, pp. 554–559, 2001. References [1] K. V. Gernaey, M. C. V. Loosdrecht, M. Henze, M. Lind, and S. B. Jørgensen, “Activated sludge wastewater treatment plant modelling and simulation: State of the art,” Environmental Modelling and Software, vol. 19, pp. 763–783, 2004. [14] S. J. Qin and T. A. Badgwell, “A survey of industrial model predictive control technology,” Control Engineering Practice, vol. 11, pp. 733–764, 2003. [15] T. Ziehn, G. Reichl, and E. Arnold, “Application of the Modelica Library WasteWater for Optimization Purpose,” Proceedings of the 4th International Modelica Conference, pp. 351–356, 2005. [2] B. Chachuat, N. Roche, and M. Lati , “Long-term optimal aeration strategies for small-size alternating activated sludge treatment plants,” Chemical Engineering and Processing, vol. 44, pp. 593–606, 2005. 223 Paper E: Optimal Control of a Biological Wastewater Treatment Process with Intermittent Aeration This paper was presented at the conference and published in the Proceedings of the Scandinavian Conference on Simulation and Modeling 2006 (SIMS 2006) held in Helsinki, Finland, 27 –29 September 2006, pp. 44 –49. 155 156 % ,% "" )%+ $%)# &!-)*!+0 '$$ '/ ')*),&& ').0 [email protected]>-/@ : @45? <-<1> @41 ;<@59-8 /;:@>;8 ;2 - .5;8;35/-8 [email protected]@1> @>[email protected]:@ <>;/1?? [email protected] 5:@1>[email protected]@1:@ -1>[email protected];: 5? 05?/A??10 5: ;>01> @; 01?53: @41 -1>[email protected];: [email protected]>[email protected] -5>;: -:0 -5>;P <1>5;0? C45/4 95:595F1? @41 1:1>3E 05??5<[email protected] .E @41 -1>[email protected];: [email protected] [email protected] -041>1:/1 @; @41 [email protected]? ;2 @41 1QA1:@ >1=A5>191:@? -:0 @41 ;<1>[email protected]:3 /;:[email protected]>-5:@? )41 0E:-95/ 9;018 5? G>[email protected] <>1?1:@10 .-?10 ;: @41 /@[email protected] (8A031 ";018 #; (" -:0 @41 ;.61/@;>51:@10 9;0185:3 8-:3A-31 ";0185/- #[email protected] @41 ;<@[email protected];: <>;.819 5? 2;>[email protected] -:0 A?10 [email protected] - >1/105:3 4;>5F;: 5: 9;018 <>105/@5B1 /;:@>;8 "% )41 [email protected];: >[email protected]? ?4;C @[email protected] ?53:5G/-:@ 59<>;B191:@? /-: .1 -/451B10 [email protected] >1?<1/@ @; @41 5:[email protected] -1>[email protected];: [email protected]>[email protected] [email protected] >10A/@5;:? 5: @41 1:1>3E /;:?A9<@5;: .E 2;> @41 ;<@59-8 /;:@>;8 ;B1> ;:1 0-E -:0 .E 2;> "% ;B1> 0-E? 1EC;>0? ;<@59-8 /;:@>;8 9;018 <>105/@5B1 /;:@>;8 "% ";0185/- #)'$*)$# ,[email protected]@1> @>[email protected]:@ 5? [email protected]@5:3 9;>1 -:0 9;>1 [email protected]@1:@5;: 5: - 45348E <;<[email protected] 5:[email protected]>5-85F10 C;>80 ); 59<>;B1 [email protected]> [email protected] [email protected] 5? 59<;>@-:@ @; >19;B1 :[email protected]>51:@? ?A/4 -? :[email protected]>;31: -:0 <4;?<4;>A? 2>;9 [email protected]@1> ;C1B1> 0A1 @; @41 5:/>1-?5:38E [email protected]>5/@ >1=A5>191:@? ;: @>[email protected] [email protected]@1> @41 ;<1>[email protected];: ;2 @41 <>;/1?? 5? /4-881:35:3 2;> 9-:E ?9-88 [email protected]@1> @>[email protected]:@ <8-:@? 2;> 1/;:;95/-8 -:0 @1/4:5/-8 >1-?;:? @ 5? @41>12;>1 ;2 5:@1>[email protected] @; -<<8E -0B-:/10 /;:@>;8 @1/4:5=A1? @; /;:2;>9 @; @41 @[email protected] 1QA1:@ >1=A5>191:@? -:0 @; ?-B1 ;<1>[email protected];: /;[email protected]? )41 -/@[email protected] ?8A031 <>;/1?? (% 5? @41 9;[email protected] 31:1>-88E -<<8510 .5;8;35/-8 [email protected]@1> @>[email protected]:@ [email protected];0 ;> ?9-88?5F10 [email protected]@1> @>[email protected]:@ <8-:@? C45/4 ->1 -<<>;<>[email protected] 2;> /;99A:[email protected]? ;2 -.;[email protected] <1>?;: 1=A5B-81:@? 5:@1>[email protected]@1:@ -1> [email protected];: (%? ->1 C5018E A?10 )41 <>;/1?? 31:1> -88E /;:[email protected]? ;2 - ?5:381 -1>[email protected];: @-:7 [email protected] -8 ;>>1?<;:05:3 [email protected];> 1>:@[email protected]:; @1>:[email protected]:3 -1>;.5/-:;D5/ /;:[email protected];:? .E [email protected]/45:3 @41 ?A<<8510 -5> ;: -:0 ;P -:0 - [email protected]@81> C41>1 @41 95/>;.5-8 /[email protected]>1 5? ?1<->[email protected] 2>;9 @41 85=A50 .15:3 @>[email protected] ?11 53A>1 ";[email protected] ;2 @41 /[email protected]>1 5? >1/E/810 -:0 95D10 [email protected] 5:/;95:3 [email protected]@1> @; 9-5:@-5: /;:B1:51:@ ?8A031 -31 /4->-/@1>[email protected]/? -:0 4534 >1-/@5;: >[email protected]? (<1/5G/-88E :[email protected]>;31: 5? >19;B10 5: @41?1 @C; [email protected]<? -99;:5A9 5? G>[email protected] ;D505F10 @; :[email protected]>[email protected] A:01> :[email protected]>5G/[email protected];:@41 -1>;.5/ [email protected]< @41 <>;0A/10 :[email protected]>[email protected] 5? @41: @>-:?2;>910 5:@; :[email protected]>;31: 3-? A:01> 01:[email protected]>5G/[email protected];:@41 -:;D5/ [email protected]< ? - 2-/@ -1>[email protected];: /;:@>;8 5? ;2 3>[email protected] 59 <;>@-:/1 ?5:/1 -: 5:?AO/51:@ -9;A:@ ;2 05??;8B10 ;DE31: C;A80 59<-5> @41 ;[email protected];: <>;/1?? -:0 1B1:@A-88E 81-0 @; .5;9-?? [email protected] C41>1-? @;; 9A/4 05??;8B10 ;DE31: 9-E /-A?1 @41 ?8A031 @; [email protected]@81 <;;>8E : [email protected];: ?5:/1 @41 -1>[email protected];: 5: 0A/1? M ;2 @41 38;.-8 1:1>3E /;:?A9<@5;: -:0 ?A.?1=A1:@8E ;<1>[email protected]:3 /;[email protected]? ;2 - @>[email protected]:@ <8-:@ 4-/[email protected] [email protected] -8 1D/1??5B1 -1>[email protected];: 5? A:01?5>-.81 2>;9 -: 1/;:;95/ <;5:@ ;2 B51C : @45? <-<1> ;<@59-8 /;:@>;8 ;2 @41 -1>-[email protected];: ?E? @19 5? /;:?501>10 @; 59<>;B1 @41 1O/51:/E -:0 Influent Qin, xin Aeration tank Air Qin + Qrs Settler Effluent Qeff, xeff Recycled sludge Qrs, xrs Wasted sludge Qw 53 (/[email protected]/ 05-3>-9 ;2 - @E<5/-8 -/@[email protected] ?8A031 <>;/1?? >[email protected] ;2 -: (% [email protected] 5:@1>[email protected]@1:@ -1>[email protected];: A?10 2;> >19;B-8 ;2 :[email protected]>;31: 2>;9 0;[email protected]/ [email protected] [email protected]> )41 ;.61/@5B1 ;2 @41 /;:@>;8 5? @; 01?53: -: -1>[email protected];: [email protected]>[email protected] -5>;: -:0 -5>;P <1>5;0? C45/4 95:595F1? @41 1:1>3E 05??5<[email protected] .E @41 -1>[email protected];: [email protected] [email protected] -041>1:/1 @; @41 [email protected]? ;2 @41 1QA1:@ >1=A5>191:@? -:0 @41 ;<1>[email protected]:3 /;:[email protected]>-5:@? )41 -<<>;-/4 A?10 5? .-?10 ;: 0E :-95/ ;<@[email protected];: [email protected];0? )41 -<<85/[email protected];: ;2 0E:-95/ ;<@[email protected];: [email protected];0? >1=A5>1? - ?AO /51:@8E -//A>[email protected] [email protected]@5/-8 9;018 01?/>5.5:3 @41 [email protected]@1> @>[email protected]:@ <>;/1?? )41 <>1?1:@ C;>7 A?1? @41 /@[email protected] (8A031 ";018 #; (" A61> [email protected] -8 (" 5? 2;> @41 @591 .15:3 /;:?501>10 @41 [email protected] /4;5/1 5: @41 9;0185:3 ;2 @41 .5;8;35/-8 <>;/1??1? 5:B;8B10 5: @41 -/@5 [email protected] ?8A031 @-:7 1?<1/5-88E 5: 01-85:3 [email protected] @41 -1>;.5/ -:0 -:;D5/ <>;/1??1? 5: @41 ?-91 @-:7 -87A 1>.1> ); 35B1 -: ;<1: -:0 H1D5.81 9;018 >1<>1?1:@[email protected];: @41 31:1>-8<A><;?1 9;0185:3 8-:3A-31 ";0185/- 5? /4;?1: ";0185/- 5? -: ;.61/@;>51:@10 9;0185:3 8-:3A-31 [email protected] -0B-: @-31? ?A/4 -? [email protected]@E 2;> [email protected];9-5: 9;018 5:3 @41 A?-31 ;2 31:1>-8 [email protected];:? ;2 <4E?5/-8 <41 :;91:- @41 >[email protected] ;2 9;018 /;9<;:1:@? -:0 - 451>->/45/-8 9;018 [email protected]>A/@A>1 >[email protected]?;: %'$(( "$! : @45? [email protected] - 8-.;>[email protected];>E?/-810 :[email protected]>;31: >19;B-8 <8-:@ 5? /;:?501>10 )41 <>;/1?? /;:[email protected]? ;2 A:5=A1 -1>[email protected];: @-:7 [email protected] - C;>75:3 B;8A91 )41 @-:7 5? 1=A5<<10 [email protected] -: -5> .8;C1> [email protected] 05PA?1>? C45/4 <>;B501 ;DE31: -:0 - 95D1> 9-75:3 @41 @-:7 .14-B1 -? /;:@5:A;A? [email protected]>>10 @-:7 >1-/@;> ()' )41 [email protected]@81> 5? - /E85:0>5/-8 <5<1 8;/[email protected] 5: @41 -1>[email protected];: @-:7 [email protected] - B;8A91 ;2 C41>1 @41 ?8A031 5? [email protected]> >1/E/810 @; @41 -1>[email protected];: @-:7 ;> [email protected]>-/@10 2>;9 @41 [email protected] )41 >1/E/810 ?8A031 5? <>;<;>@5;:-8 @; @41 5:HA1:@ H;C>[email protected] 51 )41 [email protected] ?8A031 H;C>[email protected] 5? A?10 @; 9-:5<[email protected] @41 ?8A031 >[email protected]:@5;: @591 C45/4 5? @41 9;[email protected] />[email protected]/-8 <->[email protected]> 2;> -/@[email protected] ?8A031 01?53: )41 )41 ?59<85G10 01G:[email protected];: ;2 @41 5? 2;> @41 ;B1>-88 <>;/1?? 5? 9-5:@-5:10 [email protected] ? -: 5:[email protected] [email protected] @41 <>;/1?? 5? -??A910 @; .1 ;<1>[email protected] [email protected] /;:[email protected]:@ 5:HA1:@ H;C >[email protected] -:0 /;9<;[email protected];:? E0>-A85/ >[email protected]:@5;: @591 ;2 @41 <>;/1?? 5? /4;?1: @; .1 )4A? @41 5:HA1:@ H;C >[email protected] 5? )41 <8-:@ 9;018 /;:[email protected]? ;2 -: -1>[email protected];: @-:7 9;018 -:0 - [email protected]@81> 9;018 )41 9;018? 4-? .11: 05?/A??10 5: [email protected] 5: ;A> <>1B5;A? C;>7 4-5 -771 !51 )41 (" 9;018 01?/>5.1? @41 .5;8;35/-8 <>;/1??1? 5:B;8B10 5: @41 -1>[email protected];: @-:7 )41 [email protected]@1? ;2 @41 9;018 ->1 3>;A<10 5:@; @41 /;:/1:@>[email protected];: ;2 ?;8A.81 /;9<;:1:@? -:0 <-> @5/[email protected] /;9<;:1:@? ??A95:3 <1>21/@ 95D5:3 5: @41 >1-/@;> @41 9-?? .-8-:/1 5: @41 -1>[email protected];: @-:7 >[email protected]? 5: C41>1 /;:@-5: @41 /;:/1:@>- @5;:? 5: @41 5:HA1:@ 5: @41 >1/E/810 ?8A031 -:0 5: @41 >1-/@;> >1?<1/@5B18E @415> /;9<;:1:@? ->1 5? @41 B1/@;> 2;>910 .E @41 >1-/@5;: >[email protected]? ;2 1-/4 /;9<;:1:@ 01G:10 5: (" 5? - 0591:?5;:-8 -AD585->E B1/@;> [email protected] 5: @41 G>[email protected] 18191:@ -:0 5: @41 ;@41> 18191:@? ;2 @41 B1/@;> )41 9-?? .-8-:/1 [email protected];: /;:@-5:? @41 [email protected];:-8 @1>9 C45/4 01?/>5.1? @41 ;DE31: @>-:?21> 2>;9 @41 05PA?1>? C41>1 5? @41 ;DE31: @>-:?21> /;1O/51:@ C45/4 5? - 2A:/@5;: ;2 @41 ?A<<8510 -5> H;C >[email protected] -:0 5? @41 [email protected]>[email protected] 05??;8B10 ;DE31: /;:/1:@>[email protected];: ! )41 B->5-.81 5? - .5:->E ?1=A1:/1 [email protected]/45:3 [email protected]: -:0 -:0 >1<>1 ?1:@? @41 [email protected]@1 ;2 @41 .8;C1> ;:;P -1>[email protected]:3 @41 <8-:@ @ 5? -??A910 @[email protected] @41 .8;C1> 5? ;: [email protected] @591 : @45? C;>7 @41 [email protected]@81> 5? /;:?501>10 - <1>21/@ ?<[email protected]@1> ?11 4-5 -771 !51 )41 >1 [email protected]:3 9-?? .-8-:/1 [email protected];:? ->1 -? 2;88;C? QA1:@ /;:/1:@>[email protected];: '1/E/810 ?8A031 /;:/1:@>[email protected];: : ?A99->E 18595:[email protected]:3 2>;9 [email protected];: A?5:3 [email protected];:? -:0 ;:1 /-: >12;>[email protected] @41 0E:-95/ [email protected] -? - [email protected] ;2 $? 53 ";018 05-3>-9 ;2 @41 :[email protected]>;31: >19;B-8 <8-:@ 59<8191:@10 5: ";0185/-E9;8- #[email protected]>;31: >19;B-8 5? -/451B10 .E [email protected]/45:3 @41 .8;C1> ;: -:0 ;P >[email protected]:3 5: [email protected]>:[email protected]:3 -1>;.5/ -:;D5/ /;:[email protected];:? 5: @41 -1>[email protected];: @-:7 1:/1 @41 /;:@>;8 B->5-.81 @[email protected] 5:HA1:/1? @41 ;<1>- @5;: ;2 @41 <8-:@ 5? @41 ?1=A1:/1 ;2 [email protected]/45:3 @591? 51 @591? C41: @41 .8;C1> [email protected]/4 ;:;P : @41 ";0185/- 9;018 @41 /;:@>;8 B->5-.81 5? 01G:10 -? -: 5:<[email protected] B->5-.81 C45/4 5? >1-0 2>;9 @41 [email protected] E9;8- G81 ?-B5:3 @41 @>-61/@;>51? ;2 5:<[email protected] ?53:-8? -:0 @41 /;9<; :1:@ 5? A?10 @; 31:1>[email protected] .;;81-: ?53:-8 .-?10 ;: @41 ?1=A1:/1 ;2 [email protected]/45:3 @591? $%)"! $#)'$! (+!%!1+!'& ()'$% *++%&+ )41 -1>[email protected];: <>;/1?? /-: .1 ?11: -? - ?A//1??5;: ;2 /E/81? C41>1 1-/4 /E/81 /;:[email protected]? ;2 -: -5>;: <1>5;0 2;88;C10 .E -: -5>;P <1>5;0 51 @41 <1>5;0 [email protected]: @C; /;:?1/[email protected] [email protected]>@? ;2 @41 .8;C1> ?11 53A>1 ;> - 35B1: ;<@[email protected];: 4;>5F;: C1 -??A91 @[email protected] @41>1 ->1 -1>[email protected];: /E/81? : @41 @4 -1>[email protected];: /E/81 5? @41 0A>[email protected];: ;2 @41 /E/81 -:0 5? @41 81:[email protected] ;2 @41 [email protected] /E/81 51 @41 -5>;: <1>5;0 )41 -1>[email protected];: 2>-/@5;: C45/4 5? 01G:10 -? 5? ;[email protected]: 5:@>;0A/10 5:[email protected] ;2 1:/1 @41 -1>[email protected];: @591 /-: .1 ;<@595F10 .E 9-:5<[email protected]:3 -:0 2;> : ;>01> @; -B;50 - %!/ !&+) ()')%%!& <>;.819 @[email protected] 9-E /;9<85/[email protected] @41 ?;[email protected];: [email protected] 5? ?A<<;?10 @[email protected] @41 :A9.1> ;2 /E/81? 5? 7:;C: ;> - ?<1/5G10 5: [email protected];: @41 81:[email protected] ;2 -1>[email protected];: /E/81? ->1 9-01 /;:[email protected]:@ )41 [email protected] ;2 ;<@595F10 <->[email protected]>? 5? @41: >10A/10 2>;9 @; <->[email protected]>? 8?; @; >10A/1 @41 /;9<[email protected]@5;:-8 1P;>@ @41 ;<@[email protected];: 5? /->>510 ;[email protected] ;B1> ?4;>@@1>9 4;>5F;:? 13 Nc cycles kth cycle ak dk State of the blowers )41 0E:-95/ 9;018 5? 59<8191:@10 5: ";018 5/- A?5:3 @41 E9;8- [email protected];: 1:B5>;:91:@ E:-?59 ?11 53A>1 .-?10 ;: 9;05G /[email protected];:? ;2 @41 2>11 ";0185/- 85.>->E '15/48 E9;8- 31:1>[email protected]? - /;:B1:51:@ 5: @1>2-/1 @; "[email protected] ?A/4 @[email protected] ";0185/- 9;018? /-: .1 1D1/[email protected] [email protected]: "[email protected] : -<<85/[email protected];: 1D1 /[email protected]:3 - ";0185/- 9;018 5: "[email protected] 5? 01?/>5.10 5: 4-5 9>-:5 !51 On Off Time horizon Th Time 53 %->[email protected]>? ;2 @41 -1>[email protected];: /E/81? !+ - ,%+ &% )41 ;.61/@5B1 ;2 @45? [email protected] 5? @; [email protected]>95:1 @41 -1>[email protected];: <>;G81 @[email protected] 95:595F1? @41 1:1>3E /;: ?A9<@5;: (5:/1 @41 1:1>3E /;:?A9<@5;: 5? 9-5:8E 01/5010 .E @41 -1>[email protected];: @591 ;2 @41 <>;/1?? 1:1>3E ;<@[email protected];: 5? @41>12;>1 -/451B10 .E 95:595F5:3 @41 -1>[email protected];: @591 )4A? @41 ;.61/@5B1 2A:/@5;: 5? 01G:10 -? @41 @;@-8 -1>[email protected];: @591 05B5010 .E @41 @591 4;>5F;: 5? - 0591:?5;:81?? B->5-.81 -:0 /-: .1 ?11: -? @41 38;.-8 -1>[email protected];: 2>-/@5;: ;B1> @41 ;<@[email protected];: 4;>5F;: @41 ?9-881> @41 38;.-8 -1>[email protected];: 2>-/@5;: @41 81?? @41 1:1>3E /;:?A9<@5;: %(,# +. &%*+) %+* "-D59A9 >1?50A-8 /;:/1:@>[email protected];:? ->1 59<;?10 5: ;>01> @; /;<1 [email protected] @41 * 1QA1:@ [email protected]:0->0? ;: /4195/-8 ;DE31: 019-:0 ?A?<1:010 ?;850? -:0 @;@-8 :[email protected]>;31: ! ! ! : @45? C;>7 C1 -??A91 @[email protected] @41>1 ->1 :; <->@5/ [email protected] /;9<;:1:@? 5: @41 1QA1:@ 8?; @41 [email protected] ;2 5? 31:1>-88E 1-?58E [email protected]?G10 -? 8->31 <->@ ;2 @41 .5;013>-0-.81 ;>3-:5/ /->.;: 5? /;:?A910 0A>5:3 01:[email protected]>5G/[email protected];: [email protected]? -?10 ;: @41?1 /;:?501>[email protected];:? ;:8E @41 /;:[email protected]>-5:@ ;: 5? @41>12;>1 /;:?501>10 5: @41 ;<@[email protected];: <>;.819 : <>-/@5/1 ?1B1>-8 /;:[email protected]>-5:@? ->1 01G:10 @; 1:?A>1 @41 [email protected] ;2 @41 /;9<[email protected] -1>[email protected];: [email protected]>[email protected]? -:0 @; <>1B1:@ @41 .8;C1> 2>;9 0-9-3 5:3 )41 /;:[email protected]>-5:@? /;:[email protected] ;2 59<;?5:3 95:59A9 -:0 9-D59A9 -5>;: <1>5;0? -:0 95:59A9 -:0 9-D59A9 -5>;P <1>5;0? [email protected]: -: -1>[email protected];: /E/81 ,[email protected] >121>1:/1 @; 4-/[email protected] [email protected] -8 C1 01G:1 !" -:0 1:/1 @41 .;A:0->E /;:[email protected];:? 2;> @41 -1>- @5;: -:0 :;:-1>[email protected];: ?1=A1:/1? ->1 (+!%!1+!'& %+ ' & )*,$+* )41 >[email protected]:3 ;<@[email protected];: <>;.819 5? ?;8B10 .E @41 ?;8B1> 5: @41 )$"! ;<@595F- @5;: @;;8.;D 2;> "[email protected] ?;8B1? 31: 1>-8 /;:[email protected]>-5:10 :;:85:1-> ;<@[email protected];: <>;.819? [email protected] @41 (/[email protected]@7;C?75 ?1=A1:@5-8 =A-0>[email protected]/ <>; 3>-995:3 (&% [email protected];0 ;> @41 -:%;C188 (&% [email protected];0 : @45? C;>7 @41 (/[email protected]@7;C?75 (&% 5? A?10 .1/-A?1 ;2 [email protected]? [email protected]> /;:B1>31:/1 ); 501:@52E @41 /;:@5:A;A? ;<1>[email protected];: 0E:-95/? [email protected];: ;2 @41 [email protected]>@A< <1>5;0 ;2 @41 <8-:@ 5? <>;B5010 .E [email protected]>@5:3 [email protected] @41 -1>[email protected];: @-:7 G8810 .E @41 5:/;95:3 [email protected]@1> )41 5:HA1:@ [email protected]@1> /;9<;[email protected];: 5? : 5:@1>[email protected]@1:@ -5> ?A<<8E 5? 19<8;E10 [email protected] 51 -:0 2;> : @41 ?1=A18 @41 -1>[email protected];: [email protected]>[email protected] ;2 [email protected];: C588 .1 >121>>10 @; -? @41 !&!+!$ )+!'& *+)+0 )41 [email protected] -<<>;-/41? [email protected] [email protected]@1 [email protected]> -.;[email protected] 0-E? : @45? C;>7 @41 [email protected] [email protected]@1 /;:/1: @>[email protected];:? ->1 /;:?501>10 5:[email protected] /;:[email protected];:? 2;> @41 ;<@[email protected];: 005:3 :[email protected]? -:0 C1 [email protected] @41 .;A:0->51? 2;> @41 -1>[email protected];: /E/81 0A>[email protected];: )41: @41 :A9.1> ;2 /E/81? [email protected] .1 /;: [email protected]>-5:10 @; C41>1 -:0 ->1 @41 A<<1> -:0 8;C1> .;A:0 ->51? ;2 5: :[email protected] >1?<1/@5B18E >;9 :[email protected]? -:0 @41 .;A:0->51? 2;> @41 -1>[email protected];: 2>-/@5;: /-: .1 2;>[email protected] A?5:3 @C; 5:[email protected]? '+ $ /+ &% ')&#$ : ?A99->E @41 0E:-95/ ;<@[email protected];: <>;.819 ;: - 35B1: @591 4;>5F;: /-: .1 [email protected]@10 -? !" [email protected] : @45? /-?1 @41 <>;.819 5? - /;:[email protected]>-5:10 :;: 85:1-> ;<@[email protected];: <>;.819 C45/4 /;:@-5:? @41 :;:85:1-> 9;018 59<8191:@10 5: ";0185/- 5>[email protected] @41 ;<@59-8 :A9.1> ;2 -1>[email protected];: /E/81? 5? ?;[email protected] .E /;9<[email protected]:3 ;<@59-8 -1>[email protected];: <>;G81? 2;> @41 B-8A1? ;2 35B1: 5: : [email protected] ;B1> - ;<@[email protected];: 4;>5F;: )41 /;>>1?<;:05:3 B-8A1? ;2 ;.61/@5B1 2A:/@5;: ->1 ?4;C: 5: 53A>1 )41 38;.-88E ;<@59-8 B-8A1 ;2 5? 2;A:0 @; .1 [email protected] @41 8;[email protected] B-8A1 ;2 ;C1B1> ;:1 ;2 @41 9-6;> 05O/[email protected]? 1:/;A:@1>10 5: ?;8B5:3 @41 ;<@[email protected];: <>;.819 5? @41 8->31 -9;A:@ ;2 %* @591 >1=A5>10 (5:/1 @41 /;9<[email protected]@5;: @591 5:/>1-?1? [email protected] @41 :A9.1> ;2 A:7:;C: B->5-.81? 5:B;8B10 5: @41 ;<@[email protected];: <>;.819 - ?9-88 5? 01?5>-.81 : @45? [email protected] 5? /4;?1: @; .1 [email protected] @41 ?1/;:0 8;[email protected] B-8A1 ;2 51 @41 81:[email protected] 2;> 1-/4 -1>[email protected];: /E/81 5? ;> ?;91 B-8A1? ;2 2;> 1D-9 <81 @41 ;.61/@5B1 2A:/@5;: 5:/>1-?1? 0>[email protected]/-88E )41 >1-?;: 2;> @45? 5? @[email protected] @41 ;<@[email protected];: <>;.819 4-? :; ?;[email protected];: C41: @ ?4;A80 -8?; .1 :;@5/10 @[email protected] @41 (&% -83;>[email protected] 5? - 8;/-8 ;<@[email protected];: [email protected];0 ;:B1>31:/1 @; @41 38;.-8 ?;[email protected];: ;2 @41 <>;.819? /-: :;@ .1 3A->-:@110 (5:/1 @41 0E:-95/ 9;018 5? :;:85:1-> @41 <>;.819? 9-E 5:0110 [email protected] ?1B1>-8 8;/-8 95:59- )41 ;<@59-8 -1>[email protected];: <>;G81 -:0 @41 /;>>1?<;:0 5:3 [email protected]@1 ;2 @41 .8;C1> ->1 01<5/@10 5: 53A>1 )$"! 5? - <;C1>2A8 ;<@[email protected];: @;;8 2;> "[email protected] ;P1>5:3 -.;[email protected] :A91>5/-88E >;[email protected] -83;>[email protected]? 2;> 85:1-> 05?/>[email protected] :;:85:1-> 38;.-8 ;<@[email protected];: -:0 /;:[email protected]>-5:10 :;:85:1-> <->[email protected]> [email protected]@5;: ;> 9;>1 5:2;>[email protected];: ?11 @41 )$"! 4;91 <-31 @; 9;018 1>>;> -:0 A:7:;C: [email protected]>.-:/1? )41 501-8 ?;[email protected];: 5? @; -<<8E @41 0E:-95/ ;<@595F- @5;: [email protected] - >1/105:3 4;>5F;: 5: 9;018 <>105/@5B1 /;:@>;8 "% C45/4 /4-:31? @41 ;<1:8;;< ;< @59-8 /;:@>;8 5:@; - /8;?108;;< ?;[email protected];: 60 Objective function J [%] 55 50 45 40 35 "$! %')+ $#)'$! "% 0 10 20 30 40 50 60 70 80 90 100110120130140150 Number of aeration cycles Nc [d-1] 53 $.61/@5B1 2A:/@5;: B? :A9.1> ;2 /E/81? ;> @41 :;:85:1-> <>;/1?? 9;018 :;:85:1-> "% 5? >1=A5>10 2;> ;<@59A9 <1>2;>9-:/1 (A:-: [email protected] -8 : ;>01> @; -<<8E "% @; @41 9;018 ;2 @41 <58;@ <8-:@ C1 :110 [email protected]@1 [email protected]@5;: @; [email protected] @41 /A>>1:@ [email protected]@1? 2>;9 91-?A>191:@? <>;95 :1:@ <>;.819 [email protected] :;:85:1-> "% 5? @[email protected] [email protected]@1 [email protected]@5;: .1/;91? 9;>1 /;9<85/[email protected] C41: @41 9;018 5? :;:85:1-> )4A? 5: @45? 5:[email protected] [email protected] [email protected] 5? -??A910 @[email protected] - <1>21/@ 9;018 ;2 @41 <58;@ <8-:@ 5? -B-58-.81 [email protected];[email protected] -:E [email protected]>.-:/1? -:0 @[email protected] -88 [email protected]@1 B->5-.81? ->1 -B-58-.81 -?10 ;: @41?1 -??A9<@5;:? @41 [email protected]@1 [email protected]@5;: 5? :;@ /;:?501>10 5: @45? C;>7 : -<<>;-/4 @; [email protected]@1 [email protected]@5;: 2;> - 8->31?/-81 [email protected]@1> @>[email protected]:@ [email protected] 5? 01?/>5.10 5: )1::; *>;:1: 9;05G10 [email protected]:010 -89-: [email protected]> 5? -8?; A?10 5: [email protected]@1 [email protected]@5;: 2;> - [email protected]@1> @>[email protected]:@ 9;018 5: 11?9-: Optimal aeration fraction (fk) 50 40 30 % 20 10 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.7 0.8 0.9 1 State of the blower on off 0 0.1 0.2 0.3 0.4 0.5 0.6 Time [days] 53 $<@59-8 -1>[email protected];: <>;G81 [email protected] TN [g/m3] 10 TNmax 9 8 7 6 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.4 0.5 0.6 0.7 0.8 0.9 1 COD [g/m3] 150 CODmax 100 50 0 0 0.1 0.2 0.3 Time [days] 53 '[email protected]? ;2 @41 ;<@[email protected];: [email protected] @41 /;:/1:@>[email protected];:? ;2 -:0 )41 /;>>1?<;:05:3 1QA1:@ /;:/1:@>[email protected];:? ;2 -:0 ->1 ?4;C: 5: 53A>1 QA1:@ /;: [email protected]>-5:@ ;2 -8C-E? >19-5:? 5:-/@5B1 ?; @45? /;:[email protected]>-5:@ 4-? .11: >19;B10 2>;9 @41 ;<@595F- @5;: <>;.819 )41 ;<@[email protected];: >[email protected]? 019;: [email protected]>[email protected] @[email protected] @41 38;.-8 -1>[email protected];: 2>-/@5;: ;2 51 !" ;2 -1>[email protected];: @591 - 0-E 5? ?AO/51:@ @; 1:?A>1 @41 1QA1:@ /;:[email protected]>-5:@? ;B1> ;9 <->10 [email protected] @41 5:[email protected] -1>[email protected];: [email protected]>[email protected] 35B1: 5: [email protected];: @41 1:1>3E /;:?A9<@5;: 5? >10A/10 .E $:1 ;2 @41 /4->-/@1>[email protected]/? ;2 [email protected]@1> @>[email protected] 91:@ <>;/1??1? 5? @41 C501 B->[email protected];:? 5: @41 H;C>[email protected] -:0 /;9<;[email protected];: ;2 @41 5:HA1:@ [email protected] [email protected]> )41?1 B->[email protected];:? ->1 @41 9;[email protected] 59<;>@-:@ ?;A>/1 ;2 <>;/1?? [email protected]>.-:/1? ;C1B1> @41 ;<1: 8;;< ;<1>[email protected];: -? 01?/>5.10 -.;B1 5? B1>E ?1:[email protected] )41 0E:-95/ ;<@[email protected];: 01?/>5.10 5: (1/@5;: 5? A?10 5: "% [email protected] - >1/105:3 4;>5F;: )41 <>105/@5B1 4;>5F;: 5? /4;?1: @; .1 @41 ?-91 4;>5F;: -? 5: ;<@59-8 /;:@>;8 51 -1>[email protected];: ?-9<81? <1> 0-E )41 "% [email protected];: >[email protected]? ->1 ?4;C: 5: 53A>1? -:0 )41 /;9<[email protected]@5;: ;2 ;B1> 0-E? 2;> /E/81? - 0-E [email protected] "% E5180? -: -B1>-31 B-8A1 ;2 @41 -1>[email protected];: 2>-/@5;: ;2 )45? B-8A1 5? 8->31> @4-: @41 ;:1 ;[email protected]:10 ;B1> - <1>5;0 5: ;<@59-8 /;:@>;8 )41 45341> -1>[email protected];: 2>-/@5;: >[email protected]? 5: @[email protected] @41 1QA1:@ /;:/1:@>[email protected];:? ;2 5? 4180 [email protected] 8;C1> B-8A1? M ! @4-: @41 1QA1:@ /;:[email protected]>-5:@ ! )45? ?1195:38E 05?-<<;5:@5:3 >[email protected] 2;> "% /-: .1 1D<8-5:10 -? 2;88;C? 0A1 @; @41 <1>5;05/ ;<1>[email protected];: @41 [email protected]@5;:->E ;<@59-8 [email protected]>1 ?1=A1:/1 ;2 C588 8;;7 ?5958-> @; 53A>1 -:0 C588 :1B1> >1-/4 ?;91 [email protected] [email protected]@1L N @41>1 C588 -8C-E? .1 ?;91 5:[email protected] [email protected]>-:?51:@L 5: )41 -1>[email protected];: [email protected]>[email protected] 2;> "% <>;B501? - >10A/ @5;: 5: 1:1>3E /;:?A9<@5;: .E /;9<->10 @; @41 5:[email protected] -1>[email protected];: [email protected]>[email protected] 5: [email protected];: C4581 9;>1 @4-: 2A8G885:3 @41 [email protected]>5/@ 1QA1:@ >1=A5>1 91:@? [email protected] -:E @591 #;:85:1-> "% 5? -: ;<@[email protected];:.-?10 [email protected]>5-.81 /;:[email protected]>-5:10 /;:@>;8 @1/4:5=A1 A?5:3 - :;:85:1-> 0E:-95/ <>;/1?? 9;018 2;> @41 <>105/@5;: ;2 @41 <>;/1?? ;[email protected]<[email protected]? ;2 - [email protected]@1 [email protected]@5;: -<<>;-/4 13 -89-: [email protected]> 5: "% 5? <8-::10 )41 <>;.819 ;2 ;B1>2A8G885:3 @41 /;:[email protected]>-5:@? [email protected] "% C588 .1 2A>@41> [email protected] 510 : [email protected];: ?5:/1 @41 5:HA1:@ H;C >[email protected] -:0 /;9<;[email protected];: ->1 85718E @; [email protected] 8->31 B->[email protected];:? [email protected] 5? ;2 5:@1>[email protected] @; [email protected] @41 <1>2;>9-:/1 ;2 @41 /;:@>;881> [email protected] 9;018 1>>;> -:0 [email protected]>.-:/1? MPC aeration fraction (fk) 55 50 % 45 40 0 1 2 3 4 Time [days] 5 6 ''#( 7 COD [g/m3] TN [g/m3] 53 B;[email protected];: ;2 -1>[email protected];: 2>-/@5;: 2;> @41 "% ;B1> 0-E? 10 9.5 9 8.5 8 7.5 7 0 TNmax 1 140 120 CODmax 100 80 60 40 20 0 1 2 2 3 4 5 6 7 3 4 Time [days] 5 6 7 53 "% [email protected];: >[email protected]? ;B1> 0-E? $#!*($#( # *)*' ,$' : -1>[email protected];: /;:@>;8 [email protected]>[email protected] 2;> - ?9-88?5F10 :5 @>;31: >19;B-8 (% 5? 01B18;<10 5: @45? <-<1> 0E:-95/ 9;018 01?/>5.5:3 @41 <58;@ <8-:@ 5? G>[email protected] 01B18;<10 .-?10 ;: @41 (" 9;018 -:0 5? 59<81 91:@10 5: ";0185/- A?5:3 - 9;05G10 85.>->E )41: ;<@[email protected];: ;B1> - 4;>5F;: 5? 05?/A??10 )41 ;<@[email protected];: <>;.819 5? 2;> [email protected] -? - /;:[email protected]>-5:10 :;:85:1-> ;<@[email protected];: <>;.819 C45/4 5? ?;8B10 .E @41 ?;8B1> ;2 @41 )$"! ;<@[email protected];: @;;8.;D #[email protected] @41 ;<@[email protected];: [email protected];0 5? A?10 [email protected] - >1/105:3 4;>5 F;: 5: "% .-?10 ;: @41 :;:85:1-> <>;/1?? 9;018 )41 [email protected];: >[email protected]? ?4;C @[email protected] ?53:5G/-:@ 59 <>;B191:@? /-: .1 -/451B10 [email protected] >1?<1/@ @; @41 5:[email protected] -1>[email protected];: [email protected]>[email protected] [email protected];: [email protected] >10A/ @5;:? 5: @41 1:1>3E /;:?A9<@5;: .E 2;> @41 ;<@59-8 /;:@>;8 ;B1> ;:1 0-E -:0 .E 2;> @41 "% ;B1> 0-E? : @45? C;>7 -: ;<@59-8 /;:@>;8 [email protected]>[email protected] 4-? .11: -<<8510 @; - [email protected];: 9;018 : @41 [email protected]>1 @41 [email protected]>[email protected] C588 .1 @[email protected] ;: @41 8-.;>[email protected];>E <8-:@ )41 ;<@59-8 [email protected]>[email protected] 9-E -8?; .1 -<<8510 @; 8->31 [email protected]@1> @>[email protected]:@ <>;/1??1? [email protected] 9;>1 /;9 <81D 9;018? ;> - /;9<81D 9;018 @41 /;9<[email protected] @5;: @591 ;2 ;<@[email protected];: <>;.819 9-E 5:/>1-?1 C45/4 5? :;@ 1D<1/@10 2;> ;:85:1 59<8191:@[email protected];: ;2 @41 /;:@>;8 [email protected]>[email protected] #1B1>@4181?? @41 /;9<A @[email protected];: @591 /-: .1 >10A/10 .E 01B18;<5:3 - ?59<85 G10 9;018 :@;A8-? ;> .E ?59<852E5:3 @41 ;<@[email protected];: <>;.819 : "% @41 /A>>1:@ [email protected]@1 [email protected] .1 7:;C: ); [email protected] @41 /A>>1:@ [email protected]@1 2>;9 91-?A>191:@ [email protected] ;2 @41 >1-8 <>;/1?? -<<85/[email protected];: :@;A8-? (()'/!%+!'& ' $) *$ 0&%!$ *0*+%* (# ?5-9 %458-01<45- -87A ( 1>.1> ' IE:-95/? ;2 -: -/ @[email protected] ?8A031 <>;/1?? [email protected] :[email protected]>5G/[email protected];: -:0 01:[email protected]>5G/[email protected];: (@->@A< [email protected];: -:0 ;<@5 [email protected];: A?5:3 1B;[email protected];:->E -83;>[email protected] '% (,+)* %!$ &!&)!& : %>1?? 4-/[email protected] ';/41 # [email protected] " I!;:[email protected]>9 ;<@59-8 -1>[email protected];: [email protected]>[email protected]? 2;> ?9-88?5F1 [email protected]>:[email protected]:3 -/@[email protected] ?8A031 @>[email protected] 91:@ <8-:@?J %!$ &!&)!& & )'**!& M 4-5 & 9>-:5 ( !51 %->[email protected]> 501:@[email protected] -:-8E?5? -:0 9;018 [email protected]@5:3 ;2 .5;8;35/-8 [email protected]@1> 9;018 !& I%>;/1105:3? ;2 @4 A>;<1-: (E9<;?5A9 ;: ;9<[email protected]> 5010 %>;/1?? :35:11>5:3 -:0 @4 :@1>:- @5;:-8 (E9<;?5A9 ;: %>;/1?? ([email protected]? : 35:11>5:3J 8?1B51> ->95?/4%->@1:75>/41: 1>9-:E << M ((# 4-5 & -771 ' !51 I$.61/@ ;>51:@10 9;0185:3 -:0 ;<@59-8 /;:@>;8 ;2 - .5;8;35/-8 [email protected]@1> @>[email protected]:@ <>;/1??J )'!&* ' + ! + &+)& +!'&$ '&)& '& '&+)'$ & (($! +!'&* << M (# E:-?59 0%'$ ,$+!&!&)!& ' $!& & !%,$+!'& E:-?59 !A:0 (C101: >[email protected]?;: % )!&!($* ' "+)!&+ '$!& & !%,$+!'& .!+ '$! %>1?? %5?/[email protected] # (# A61> , 1:F1 " "5:; ) B-: !;;?0>1/[email protected] " I/@[email protected] (8A031 ";018 #; J + ! M 11?9-: I(@[email protected] -:0 <->[email protected]> [email protected] @5;: 5: .5;@1/4:5/-8 [email protected]/4 >1-/@;>?J '&+)'$ &!&)!& )+! M '15/48 I,[email protected],[email protected]> - 85.>->E 2;> 9;0 1885:3 -:0 [email protected];: ;2 [email protected]@1> @>[email protected]:@ <8-:@? 5: 9;0185/-J )'!&* ' + ) & +)&+!'&$ '$! '&)& << M (A:-: 5;:3 ) 1:3 ! ( ($! ()!+!- '&+)'$ (# (<>5:31> !;:0;: )1::; ' *>;:1: % I(@[email protected] [email protected]@5;: 2;> - 8->31?/-81 [email protected]@1> @>[email protected]:@ ?E? @19J ,+'%+! M Paper F: Predictive Control of an Intermittently Aerated Activated Sludge Process This paper has been accepted for publishing in the proceedings of the 2008 American Control Conference held in Seattle, Washington, USA, 11 –13 June 2008. 163 Predictive Control of an Intermittently Aerated Activated Sludge Process Qian Chai and Bernt Lie Abstract— This paper presents model-based optimal control and predictive control of a biological wastewater treatment process with intermittent aeration. The objective of the control is to design an aeration strategy which minimizes the energy consumption induced by the aeration system, with adherence to the EU effluent standards and the operating constraints. The developed optimization problem is used with a receding horizon in nonlinear MPC based on the complete ASM3 model. The MPC aeration profile guarantees that the plant fulfills the effluent requirements at any time over long time periods. Significant energy saving is also obtained when comparing MPC to three traditional rule-based control strategies. I. I NTRODUCTION Due to legislation on wastewater treatment, especially the strict EU Guideline Urban Wastewater Directive 91/271/EEC, there are strong incentives to upgrade existing wastewater treatment plants in order to comply with the effluent standards and to reduce operation costs. The activated sludge process (ASP) is the most generally applied biological wastewater treatment method. In the classical biological treatment systems, aerobic nitrification and anoxic denitrification are maintained in separated zones. In the last two decades, intermittently aerated ASPs have been developed in a way through which the aerobic and anoxic zones are periodically exchanged [1], [2]. The intermittently aerated ASP generally consists of a single aeration tank with alternating aerobic-anoxic conditions by switching the supplied air on and off, and a settler where the microbial culture is separated from the liquid being treated. Most of the culture is recycled and mixed with incoming wastewater to maintain convenient sludge age characteristics and high reaction rates. The alternating aerobic-anoxic technique can easily be applied to the existing nitrogen removal plants with nitrogen removal efficiencies of 70− 90% [3]. Compared to the classical biological treatment processes, the intermittently aerated ASP offers significant energy savings and easy plant retrofitting. An important feature of the intermittently aerated ASP is its flexible control ability, which makes the process better accommodate variable influent loading conditions and makes it suitable for optimization of operating costs [2]. Generally, control of the aeration system is of great importance since (i) the concentration of dissolved oxygen is directly related to nitrogen removal and (ii) the energy consumption of the aeration system is the main operating cost. Corresponding author: [email protected]; tel: +47 35575169. Address: Telemark University College, P.O. Box 203, N-3901 Porsgrunn, Norway. Process control of ASPs is a challenging task since the processes are characterized by large disturbances, significant nonlinearities, and stiff dynamics. To date, in many municipal treatment plants, the lengths of aerobic and anoxic phases are typically fixed or scheduled daily using a plant’s supervisory control and data acquisition system. A more advanced control approach is rule-based feedback control, which uses varying phase length by establishing a switch point for each nitrification/denitrification phase. Since the on-line monitoring of ammonia and nitrate is difficult, some indirect measurements of ammonia and nitrate (e.g. oxidation-reduction potential (ORP), pH, dissolved oxygen (DO)) are commonly used to control ASPs [4]. Recently, with the development of mathematical models, particularly the Activated Sludge Models (ASMs) [5], application of optimal control has been the subject of a number of studies [6], [7], [8], [9]. Moreover, the application of MPC in the intermittently aerated ASPs has been studied in [10], [11], and [12] using simplified models, but the application of MPC with the complete ASM models is not studied much in the literature. In this paper, optimal control of the aeration system is considered for improving the efficiency and reliability of an intermittently aerated ASP, used for removal of nitrogen from domestic wastewater. The objective of the control is to design an aeration strategy (air-on and air-off periods) which minimizes the energy dissipated by the aeration system, with adherence to the limits of the effluent requirements and the operating constraints. In Section II, the configuration and dynamic model of the nitrogen removal plant are described. In Section III, the optimization problem is formulated, and the optimization method and results are discussed. In Section IV, special emphasis is placed on using dynamic optimization in MPC with a receding horizon for a usable online implementation and to show the long-term effects of the optimal aeration strategy. In Section V, the simulation results of MPC are compared to three traditional control strategies for nitrogen removal in the intermittently aerated ASP. Finally, some conclusions are drawn in Section VI. II. P ROCESS C ONFIGURATION AND M ODELING A. Process configuration In this study, a model of a laboratory-scale nitrogen removal plant is considered. The process consists of a unique aeration tank (Va = 40 l) and a cylindrical settler (Vset = 2.5 l). More details of the process are given in [13]. The sludge retention time (SRT) for the overall process is maintained at 15 d. The influent wastewater to the plant is 2 Weighting functions flow rate composition 1.5 1 0.5 0 0 2 4 6 8 10 12 14 16 18 20 22 24 Time of day Fig. 1. Typical daily variations of inlet wastewater flow rate and composition, taken from [14]. primarily domestic wastewater. The average influent flow rate (Qin ) is 96 l/ d which gives a hydraulic retention time (HRT) of 10 h, and the average total chemical oxygen demand (CODin ) and total nitrogen (TNin ) concentrations are 260 g m−3 and 25 g m−3 , respectively. Typical daily variations of dry weather conditions are simulated using weighting functions defined in [14] for both inlet wastewater flow rate and composition, see Fig. 1. B. Process model The plant model consists of an aeration tank model and a settler model. The complete Activated Sludge Model No. 3 (ASM3) describes the biological processes involved in the aeration tank. The states of the model are grouped into the concentration of soluble components Sj and particulate components Xj . Assuming perfect mixing in the reactor, the mass balance in the aeration tank results in: dxa Qin xin + Qrs xrs − (Qin + Qrs ) xa (1) = dt Va +r + e1 AO2 , where xin , xrs , xa ∈ R13 contain the concentrations in the influent, in the recycled sludge, and in the reactor, respectively; their components are xl = [SO2 ,l SI,l SS,l SNH4 ,l SN2 ,l SNOX,l SALK,l XI,l XS,l XH,l XSTO,l XA,l XSS,l ]T , l ∈ {in, rs, a}; r ∈ R13 is the vector formed by the reaction rates of each component (defined in ASM3); e1 is the standard basis for the first coordinate in R13 ; and AO2 describes the oxygen transfer: ¡ sat ¢ AO2 = ua · KL a SO − SO2 ,a , (2) 2 where KL a is the oxygen transfer coefficient which is a sat function of the supplied air flow rate, and SO is the 2 sat saturated dissolved oxygen concentration (SO2 ≈ 10 g m−3 ). Variable ua is a binary sequence switching between 0 and 1 and represents the state of the blower (on/off) aerating the plant. It is assumed that the blower is on at time t = 0. Fig. 2. Model diagram of the intermittently aerated ASP implemented in Modelica/Dymola. Here, the control variable that influences the operation of the plant is the sequence of switching times, i.e., times when the blower switches on/off. For simplicity, the settler is often considered a perfect splitter, thus the settler model can be expressed as follows: Effluent concentrations are Sj,eﬀ = Sj,a , Xj,eﬀ = 0 (3) Recycled sludge concentrations are Sj,rs = Sj,a , Xj,rs = Qin + Qrs Xj,a . Qrs + Qw (4) In summary, the general model of the dynamic system can be simply described as a set of ODEs: dxa (5) = F (xa , ua , t) . dt The dynamic model is implemented in the object-oriented modeling language Modelica [15] using the Dymola simulation environment [16], see Fig. 2, based on the modified Modelica library WasteWater [17]. Dymola generates a convenient interface to Matlab such that Modelica models can be executed within Matlab. An application executing a Modelica model in Matlab is described in [18]. III. O PTIMIZATION P ROBLEM A. Definition of optimization problem The aeration process can be seen as a succession of cycles where each cycle consists of an air-on period followed by an air-off period, i.e. the period between two consecutive starts of the blower, see Fig. 3. For a given optimization horizon Th , let there be Nc aeration cycles. In the kth aeration cycle, ak is the duration of the cycle and dk is the length of the duty cycle, i.e. the air-on period. The aeration fraction fk , which is defined as fk = dk /ak , is often introduced instead of dk . Hence, the aeration time can be optimized 65 N c cycles th Objective function [%] k cycle ak dk State of the blowers On 60 55 50 45 Off 40 Time horizon T h Fig. 3. Time Fig. 4. by manipulating ak and fk for k = 1, · · · , Nc . In order to avoid a mixed integer programming problem that may complicate the solution, let the number of cycles Nc be fixed. In addition, the length of the aeration cycles are made constant, a = Th /Nc . The set of optimized parameters is then reduced from 2×Nc to Nc parameters. Also, the optimiation horizon is chosen to be 24 h. 1) Objective function: The objective of this study is to determine the aeration profile that minimizes the energy consumption. The energy consumption is mainly decided by the aeration time of the process, and the extra power comsumption induced by starting the aeration system is neglected. Energy optimization is therefore achieved by minimizing the aeration time. Thus, the objective function J is defined as the total aeration time divided by the total optimization time: XNc a · fk k=1 J= . (6) Th 2) Inequality constraints: The inequality constraints are defined in order to cope with the EU effluent standards on chemical oxygen demand COD, suspended solids SS, and total nitrogen TN: ≤ CODmax = 125 g m−3 ≤ SSmax = 35 g m−3 ≤ TNmax = 10 g m−3 . (7) (8) (9) In this work, we assume that there are no particulate components in the effluent (SSeﬀ ≡ 0). Also, the COD constraint is generally easily satisfied as a large part of the biodegradable organic carbon is consumed during denitrification stages. Based on these considerations, only the constraint on TNeﬀ is therefore considered in the optimization problem. To ensure the feasibility of the computed aeration strategies and to prevent the blower from damage, constraints on the aeration and non-aeration sequences are introduced: ton,min toﬀ,min ≤ a · fk ≤ ton,max ≤ a · (1 − fk ) ≤ toﬀ,max , 20 30 40 50 60 70 80 90 100 110 120 130 140 150 Number of aeration cycles Parameters of the aeration cycles, based on [19]. CODeﬀ SSeﬀ TNeﬀ 0 10 (10) (11) Objective function J vs. number of cycles Nc . where we define ton,min = toﬀ,min = 5 min and ton,max = toﬀ,max = 2 h with reference to [19]. To decide the constraints for the number of cycles Nc , we first get the constraints of the aeration cycle duration a by adding inequalities 10 and 11: ton,min + toﬀ,min ≤ a ≤ ton,max + toﬀ,max . (12) Then, Nc must be constrained to Th Th ≤ Nc ≤ au a (13) where au and a are the upper and lower boundaries of a in inequality 12, respectively. 3) Optimization problem: Finally, the dynamic optimization problem on a given optimization horizon Th can be stated as: XNc a · fk 1 XNc k=1 = fk (14) min J = k=1 f1 ,...,fNc Th Nc dxa s.t. = F (xa , ua , t) dt 0 ≤ TNmax − TNeﬀ ton,min ton,max ≤ fk ≤ a a toﬀ,max toﬀ,min 1− ≤ fk ≤ 1 − . a a B. Optimization methods and results The resulting optimization problem is solved by the SNOPT solver in the TOMLAB1 optimization toolbox for Matlab. SNOPT is a fast and robust solver for solving large-scale nonlinear optimization problems with a sequential quadratic programming (SQP) algorithm [20]. First, simulation of the start-up period of the plant is done using an intermittent air supply with KL a = 72 d−1 , Nc = 15 d−1 (i.e. a = 1.6 h), and fk = 0.6 for k = 1, . . . , Nc . 1 For more information, http://www.tomlab.biz. see the TOMLAB (15) home page TNeff [g/m3] 70 50 40 30 20 optimal control MPC 10 0 0 4 8 12 16 Time of day [hour] 20 24 Fig. 5. Evolution of aeration fraction fk for open-loop optimal control (solid) and for MPC (dotted) over 24 h. CODeff [g/m3] Aeration fraction fk [%] 60 10 9 8 7 6 TNmax optimal control MPC 0 4 8 12 16 20 24 8 12 16 20 24 150 100 CODmax 50 0 0 4 Time of day [hour] Fig. 6. Results of optimal control (solid) and MPC (dotted) over 24 hours: the effluent concentrations of TN and COD. The system approaches steady state after about 30 days according to simulation, see also [21]. In this work, the steady state concentrations are used as the initial conditions, and are used for all control strategies here so that the obtained results can be compared. The optimal number of aeration cycles Nc is sought by computing optimal aeration profiles for the values of Nc ∈ [6, 144] d−1 given in inequality 13 over a 24 h optimization horizon. The corresponding values of the objective function J are given in Fig. 4. The optimal value of Nc is found to be 24 with the lowest value of J = 40.05%, i.e. the length for each aeration cycle is 1 h. The values of objective function have large variations when Nc > 60 d−1 , because the SQP algorithm may easily be captured in local minima with the increasing number of unknown optimization variables. The optimal aeration strategy for 24 cycles a day is represented in Fig. 5 in solid line. The corresponding effluent concentrations of TN and COD are shown in Fig. 6 (solid lines). The effluent constraint on COD always remains inactive, so this constraint has been removed from the optimization problem. The optimization results demonstrate that the total aeration fraction of 40.05%, i.e. 9 h 37 min of aeration time a day, is sufficient to ensure the effluent constraints over 24 h. IV. M ODEL P REDICTIVE C ONTROL The nonlinear optimal control strategy described above is an open-loop operation which is very sensitive to model errors and unknown disturbances. For a usable online implementation, a nonlinear MPC is applied to change the openloop optimal control into a closed-loop solution. In order to apply MPC to the model of the pilot plant, we need state estimation to get the current unmeasured states from measurements. In this simulation study, it is assumed that all states are available, therefore the state estimation is not considered here. The study of state estimation of a similar nitrogen removal process is described in [22]. The constrained nonlinear optimization defined in Section III is used in MPC with a receding horizon. The MPC horizon is an important tuning parameter for optimization results. In this study, the MPC horizon is tuned to be 4 aeration cycles. The MPC aeration fraction and simulation results over 24 h are shown in Figs. 5 and 6 with dotted lines. We note that the optimal aeration strategy is closely related to the variation of the feed concentration: the high TN load (see Fig. 1) induces the high aeration fraction (e.g. between 8:00 and 20:00), whereas the low TN load results in the low aeration fraction. Compared with optimal control, the TN concentration with MPC increases faster at the beginning due to the shorter MPC horizon. The application of MPC leads to a total aeration fraction of 43.46% over a 24 h period. This value is larger than the one obtained in optimal control (J = 40.05%). The higher aeration fraction results in that the effluent concentration of TN is held at lower values (8.5– 9.5 g m−3 ) than the effluent constraint 10 g m−3 , see Figs. 6 and 7. This seemingly disappointing result for MPC can be explained as follows: due to the periodic operation, the stationary optimal future sequence of fk will look similar to the solid line in Fig. 5, and will never reach some “steady state” — there will always be some initial “transient” in fk . Also, MPC is applied over a long simulation horizon to guarantee that the effluent requirements are fulfilled and the energy saving is lasting, see Fig. 7. The computation of the optimal fk over 10 days (for 24 cycles a day) yields a total aeration fraction of 46.42% and more than fulfills the strict effluent requirements at any time. V. C OMPARISON BETWEEN MPC AND RULE - BASED C ONTROL In this section, the MPC controller developed above is compared with the traditional rule-based control strategies for intermittently aerated ASPs. The rule-based control strategies used in practice and in the literature can be categorized as (1) open-loop control using fixed lengths of aerobic and anoxic phases, or (2) feedback control using varying phase lengths by establishing a switch point for each phase. The switch point is typically the concentration of dissolved TABLE I C OMPARISON BETWEEN RULE BASED CONTROL STRATEGIES AND MPC. Aeration fraction fk [%] 100 80 Controller 60 40 20 3 TNeff [g/m ] 0 2 4 6 Tim e [days] (a) 8 9 8 TN m ax M PC 7 0 2 4 6 8 10 3 150 100 C O D m ax M PC 50 0 0 2 4 6 Tim e [days] (b) 8 Fixed phase 48.61% DO based 53.12% SNH4 based 47.59% MPC 43.46% Tuning parameters −1 Nc = 60 d f = 48.61% Nc = 50 d−1 DOmax = 1.64 g m−3 SNH4 ,max = 7.9 g m−3 SNH4 ,min = 7.4 g m−3 Nc = 24 d−1 fk , k = 1, . . . , Nc CPU time for simulating 24 h 39 s 20 s 30 s 22 min 10 10 6 CODeff [g/m ] 0 Criterion 10 Fig. 7. MPC simulation results over 10 days: (a) MPC aeration fraction and (b) the corresponding effluent concentrations of TN and COD. oxygen, nitrate, or ammonia [23], [24]. In this work, three rule-based control strategies are compared with MPC: fixed phase length, oxygen based control, and ammonia based control. The comparison is carried out by simulation using the sequence of aeration/non-aeration times as the control input and the TN concentration as the primary output. The objective of control strategies is to minimize the aeration time of the process while satisfying the effluent constraints. Evaluation criterion J is described in Equation 6. The applied rule-based controllers are described as follows: • Fixed phase length control: In this controller, the lengths of aerobic and anoxic phases are fixed. We assume that there are Nc aeration cycles for a given optimization horizon 1 d; then the length of aeration cycles 1d a is N . The controller thus has 2 tuning parameters: the c number of cycles Nc each day and the aeration fraction f , which are found to be Nc = 60 d−1 and f = 48.61% by minimizing J over 1 d. • Oxygen (DO) based control: In practice, a wellaccepted technique is to turn the aeration system on and off based on the online measurement of DO concentration. In [19], an oxygen based controller is designed as: each aeration cycle has a constant duration 1d of a = N and the aeration system is stopped when c the DO concentration reaches DOmax . In this study, to fulfill the effluent constraints, Nc and DOmax are tuned to be 50 d−1 and 1.64 g m−3 , respectively. • Ammonia (SNH4 ) based control: The aeration system can also be controlled by the upper and lower bounds of SNH4 based on the measurement of SNH4 (see [25]): the aeration is turned on when SNH4 ≥ SNH4 ,max and is turned off when SNH4 ≤ SNH4 ,min . In fact, large values of SNH4 ,max and SNH4 ,min will result in lower aeration consumption, since ammonia is oxidized to nitrate under the aerobic step. To make the control results comparable, SNH4 ,max and SNH4 ,min are tuned to be 7.9 g m−3 and 7.4 g m−3 because SNH4 varies within this region when using the MPC solution. A comparison of MPC with the rule-based controllers is given in Table I. All computations are performed on a 1.7 GHz Pentium M computer with 1 Gbyte RAM. The values of criterion J show that MPC provides the shortest aeration time, whereas the DO based controller is least satisfactory. We find that MPC achieves 18.2% (i.e., 2.3 h) aeration reduction each day in comparison to the DO based control. Compared to the fixed phase length and SNH4 based control, which have similar J values, MPC reduces the average aeration time by up to 10.6% and 8.7%. Although the computation time of MPC is much longer than the simpler controllers, it is still feasible with on-line implementation of an MPC controller. Fig. 8 presents the TN concentrations obtained with all these control strategies. It is seen that the performances of the optimally tuned fixed phase length controller and DO based controller are similar, e.g., the aeration switching frequencies are high for both controllers, and the SNH4 based controller is designed to mimic the performance of MPC. It should be noticed that the fixed phase length strategy is limited in that predetermined fixed aerobic and anoxic phases cannot compensate for unanticipated loading variations (e.g. rain/storm events). Although feedback is utilized for the DO and SNH4 based control strategies, the tuning of the parameters are rather sensitive and must be performed carefully. In summary, the MPC presents the following advantages: 1) MPC provides the most reduction of the aeration time. 2) It is easier to deal with the inequality constraints in both effluent requirements and operating conditions. 3) MPC handles disturbances (e.g. load changes) in a more natural way. 11 TNmax 10 TNeff [g/m3] 9 8 7 fixed phase length DO based control SNH4 based control MPC 6 5 4 0 4 8 12 16 Time of day [hour] 20 24 Fig. 8. Comparison of effluent TN concentrations obtained with rule based control strategies and with MPC. VI. C ONCLUSIONS AND F UTURE W ORK In this paper, an optimal control strategy for a small-sized nitrogen removal ASP is developed to reduce the energy consumption induced by the aeration system, with adherence to the limits of the effluent standards. The optimization problem is formulated as a constrained nonlinear optimization problem, which is solved by the SNOPT solver of the TOMLAB optimization toolbox. Then, the optimization method is used with a receding horizon in nonlinear MPC based on the complete ASM3 model. The application of MPC over a long simulation horizon (10 d) is discussed, and the MPC aeration profile guarantees that the plant fulfills the tight EU effluent requirements at any time. Based on the same control objective as MPC, traditional rule-based control strategies, such as fixed phase length, DO based, and SNH4 based control are discussed using well-tuned controller parameters. The comparison between the rule-based controllers and MPC shows that better aeration profiles, with reductions of energy consumption of up to 18.2%, could be obtained by applying MPC. In the present study, the predictive control strategy has been applied to a simulation model. The plan is to test the strategy on the laboratory plant in the future. It is also of interest to study the applications of MPC to full-scale industrial plants. R EFERENCES [1] S. Ip, J. Bridger, and N. Mills, “Effect of alternating aerobic and anaerobic conditions on the economics of the activated sludge system,” Wat. Sci. Tech., vol. 19, no. Rio, pp. 911–918, 1987. [2] O. Hao and J. Huang, “Alternating aerobic-anoxic process for nitrogen removal: process evaluation,” Water Environ. Res., vol. 68, pp. 83–93, 1996. [3] J. Nakajima and M. Kaneko, “Practical performance of nitrogen removal in small-scall sewage treatment plants operated in intermittent aeration mode,” Wat. Sci. Tech., vol. 23, no. Kyoto, pp. 709–718, 1991. [4] M. Fuerhacker, H. Bauer, R. Ellinger, U. Sree, H. Schmid, F. Zibuschka, and H. Puxbaum, “Approach for a novel control strategy for simultaneous nitrification/denitrification in activated sludge reactors,” Wat. Res., vol. 34, no. 9, pp. 2499–2506, 2000. [5] M. Henze, W. Gujer, M. C. M. van Loosdrecht, and T. Mino, Activated Sludge Models ASM1, ASM2, ASM2d and ASM3., vol. 9 of Scientific and Technical Report. IWA Publishing, 2000. [6] H. Kim, T. McAvoy, J. Anderson, and O. Hao, “Control of an alternating aerobic-anoxic activated sludge system — part 2: optimization using a linearized model,” Control Engineering Practice, vol. 8, pp. 279–289, 2000. [7] H. Zhao, S. Isaacs, H. Søeberg, and M. Kümmel, “Nonlinear optimal control of an alternating activated sludge process in a pilot plant,” Journal of Process Control, vol. 4, no. 1, pp. 33–43, 1994. [8] B. Chachuat, N. Roche, and M. Latifi, “Optimal aeration control of industrial alternating activated sludge plants,” Biochemical Engineering Journal, vol. 23, pp. 277–289, 2005. [9] S. Balku and R. Berber, “Dynamics of an activated sludge process with nitrification and denitrification: Start-up simulation and optimization using evolutionary algorithm,” Computers and Chemical Engineering, vol. 30, pp. 490–499, 2006. [10] S. Weijers, Modelling, identification and control of activated sludge plants for nitrogen removal. PhD thesis, Technische Universiteit Eindhoven, 2000. [11] H. Zhao, S. Isaacs, H. Søeberg, and M. Kümmel, “A Novel Control Strategy for Improved Nitrogen Removal in an Alternating Activated Sludge Process — Part II. Control Development,” Wat. Res., vol. 28, pp. 535–542, 1994. [12] L. Lukasse, K. Keesman, and G. van Straten, “l1-norm optimal control of n-removal in an activated sludge process,” Control Engineering Practice, vol. 7, pp. 63–70, 1999. [13] Q. Chai and B. Lie, “Optimal control of a biological wastewater treatment process with intermittent aeration,” in Proceedings of SIMS 2006 conference, pp. 44–49, September 2006. Helsinki, Finland. [14] S. Isaacs and D. Thornberg, “A comparison between model and rule based control of a periodic activated sludge process,” Wat. Sci. Tech., vol. 37, no. 12, pp. 343–351, 1998. [15] P. Fritzson, Principles of Object-Oriented Modeling and Simulation with Modelica 2.1. Piscataway, NJ: IEEE Press, 2004. ISBN 0-47147163-1. [16] Dynasim, Dymola Multi-Engineering Modeling and Simulation: Dymola user manual. Lund, Sweden: Dynasim AB, 2004. [17] G. Reichl, “WasteWater a library for modelling and simulation of wastewater treatment plants in modelica,” Proceedings of the 3rd International Modelica Conference, pp. 171–176, 2003. [18] Q. Chai, S. Amrani, and B. Lie, “Parameter identifiability analysis and model fitting of a biological wastewater model,” in Proceedings of 16th European Symposium on Computer Aided Process Engineering and 9th International Symposium on Process Systems Engineering, (Garmisch-Partenkirchen, Germany), pp. 409–414, Elsevier, July 2006. ISSN: 1570-7946. [19] B. Chachuat, N. Roche, and M. Latifi, “Long-term optimal aeration strategies for small-size alternating activated sludge treatment plants,” Chemical Engineering and Processing, vol. 44, pp. 593–606, 2005. [20] P. Gill, W. Murray, and M. Saunders, User’s Guide for SNOPT 5.3: A Fortran Package for Large-scale Nonlinear Programming. Stanford Systems Optimization Laboratory, December 1998. [21] Q. Chai, R. Bakke, and B. Lie, “Object-oriented modeling and optimal control of a biological wastewater treatment process,” Proceedings of the Eighth IASTED International Conference on Control and Applications, pp. 218–223, 2006. ISBN: 0-88986-553-1. [22] Q. Chai, B. Furenes, and B. Lie, “Comparison of state estimation techniques, applied to a biological wastewater treatment process,” in Proceedings of 10th International IFAC Symposium on Computer Applications in Biotechnology, (Cancùn, Mexico), pp. 353–358, June 4–6 2007. [23] T. Potter, B. Koopman, and S. Svoronos, “Optimization of a periodic biological process for nitrogen removal from wastewater,” Water Research, vol. 30, no. 1, pp. 142–152, 1996. [24] S. Isaacs and D. Thornberg, “Rule based control of a periodic activated sludge process,” Water Science & Technology, vol. 38, no. 3, pp. 281– 289, 1998. [25] L. Lukasse, K. Keesman, A. Klapwijk, and G. van Straten, “A comparison of NH4/NO3 control strategies for alternating activated sludge processes,” Wat. Sci. Tech., vol. 39, pp. 93–102, 1999.

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement