Real-time Control of Combined Water Quantity & Quality in Open Channels Real-time Control of Combined Water Quantity & Quality in Open Channels Proefschrift ter verkrijging van de graad van doctor aan de Technische Universiteit Delft op gezag van de Rector Magnificus prof. ir. K.C.A.M. Luyben, voorzitter van het College voor Promoties, in het openbaar te verdedigen op Woensdag 09 Januari 2013 om 10:00 uur door Min XU civiel ingenieur geboren te China Dit proefschrift is goedgekeurd door de promotor: Prof.dr.ir. N.C. van de Giesen Copromotor Dr.ir. P.J.A.T.M. van Overloop Samenstelling promotiecommissie: Rector Magnificus, Prof.dr.ir. N.C. van de Giesen, Dr.ir. P.J.A.T.M. van Overloop, Prof.dr.ir. B. Schultz, Prof.dr.ir. H.H.G. Savenije, Prof.dr.ir. G.S. Stelling, Dr.ir. G. Belaud, Dr.ir. C.O. Martinéz, Prof.dr.ir. J. Hellendoorn, voorzitter Technische Universiteit Delft, promotor Technische Universiteit Delft, copromotor UNESCO-IHE Technische Universiteit Delft Technische Universiteit Delft SupAgro, Montpellier, France Universitat Politècnica de Catalunya, Barcelona Technische Universiteit Delft, reservelid This research was performed at the Section of Water Resources Management, Faculty of Civil Engineering & Geosciences, Delft University of Technology, and has been financially supported by IBM Ph.D. Fellowship Award. c 2013 by Min Xu Copyright Published by: VSSD, Delft, The Netherlands ISBN: 978-90-6562-310-2 All rights reserved. No part of the material protected by this copyright notice may be reproduced or utilized in any form or by any means, electronic, or mechanical, including photocopy, recording or by any information storage and retrieval system, without written permission of the publisher. This thesis was written using LATEX. Key words: hydrodynamic model, model reduction, model predictive control, open channel flow, operational water management, real-time control, water quantity, water quality Summary Fresh water supply and flood protection are two central issues in water management. Society needs more and more fresh water and a safe water system to guarantee a better life. A more severe climate will result in more droughts and extreme storms. As a consequence, salt water intrusion will increase. Therefore, clean and fresh water is becoming scarce. Potentially, there lies a severe conflict between people’s demands and what nature can provide. In practice, water systems are complex. Both water quantity and quality criteria must be served. Moreover, water is normally used as a multi-functional resource. For example, water in a reservoir is used for irrigation, power generation, flood protection and reclamation. These objectives are usually in conflict most of the time and it is not easy for people to cope with these contradictions. Smart regulation of water systems is essential not only from the world-wide water issue perspective, but also from the specific water problem aspect. Real-time control is a powerful tool to help people with accurate regulation of water systems. In practice, water quantity control is extensively studied, but fully integrated water quantity and quality control has hardly been touched. Moreover, in order to deal with multi-objectives in a water system, advanced control techniques, such as model predictive control (MPC), are often required which require extensive computational resources. This brings forward two research questions: 1. What is the possibility of controlling both water quantity and quality in a water system? 2. In MPC, what is the possibility to reduce the computational burden in order to make the control implementation possible? In this PhD thesis, a case of polder flushing in real-time is selected for the first research question, which includes both water quantity and quality problems.The task is to flush polluted water out of the polder with clean water i ii Summary while keeping water levels close to the setpoints. Instead of manual operation which is often applied in practice, control systems were designed with feedback control and MPC. In MPC, different types of internal models were applied ranging from a linear reservoir model to hydrodynamic models. The different control performance of the two controllers were compared. We conclude that real-time control is possible to maintain both water quantity and quality at the same time in a one dimensional water system model. Furthermore, MPC performs much better than the classic feedback control in controlling the water quality when operational limits are very strict. In MPC, using different internal models will also result in different control performance, affecting both control effectiveness and computation time. Being an advanced control technique, MPC is playing a more and more important role in controlling water systems. The computational burden is the main barrier for MPC implementation. In this PhD thesis, we propose a control procedure of MPC with a model reduction technique, Proper Orthogonal Decomposition (POD), in order to speed up the computation. POD is able to reduce the order of states and disturbances, and speed up the matrix operation in MPC. In a test case, we concluded that MPC using the reduced model is a good trade-off between control effectiveness and computation time. Therefore, the proposed MPC procedure is considered as a successful method for MPC implementation. Min Xu August 2012 in Delft Contents Summary i List of Tables vi List of Figures viii 1 Introduction 1.1 Water quantity & quality management in 1.1.1 Current situation . . . . . . . . . 1.1.2 Modelling of open channel flow . 1.2 Real-time control of open channels . . . 1.2.1 General introduction . . . . . . . 1.2.2 Real-time control methods . . . . 1.3 Model predictive control . . . . . . . . . 1.4 Model reduction . . . . . . . . . . . . . . 1.5 Objective of the study . . . . . . . . . . 1.6 Outline of the thesis . . . . . . . . . . . open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 2 5 5 6 10 12 13 14 quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 18 21 21 23 26 26 29 29 30 31 channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Real-time control of combined water quantity & 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . 2.2 Method . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 Forward estimation . . . . . . . . . . . . . 2.2.2 Model predictive control . . . . . . . . . . 2.3 Test Case . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Case setup . . . . . . . . . . . . . . . . . . 2.3.2 MPC setup . . . . . . . . . . . . . . . . . 2.3.3 Classical control setup . . . . . . . . . . . 2.4 Results . . . . . . . . . . . . . . . . . . . . . . . . 2.5 Conclusions and discussions . . . . . . . . . . . . 3 Control effectiveness Vs computational efficiency in model iii iv Contents predictive control 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Model predictive control of open channel flow . . . . . . . . . 3.2.1 State-space model formulation with Kalman filter . . . 3.2.2 Optimization Problem . . . . . . . . . . . . . . . . . . 3.3 Process model formulation . . . . . . . . . . . . . . . . . . . . 3.3.1 State-space model formulation with SV model . . . . . 3.3.2 State-space model formulation with RSV model . . . . 3.3.3 State-space model formulation with ID model . . . . . 3.4 Test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.1 SV model setup . . . . . . . . . . . . . . . . . . . . . . 3.4.2 RSV model setup . . . . . . . . . . . . . . . . . . . . . 3.4.3 ID model . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.4 MPC performance indicators . . . . . . . . . . . . . . . 3.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.1 Results of RSV model accuracy and model complexity 3.5.2 Results of control effectiveness and computational efficiency in MPC . . . . . . . . . . . . . . . . . . . . . . 3.6 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Reduced models in model predictive control controlling water quantity & quality 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Model reduction on combined open water quantity and quality model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Combined open water quantity and quality model . . . 4.2.2 Model reduction on combined water quantity and quality model . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Model predictive control of combined water quantity and quality 4.3.1 Optimization problem formulation . . . . . . . . . . . . 4.3.2 Optimization problem formulation using reduced model 4.4 Test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.1 Reduced model performance . . . . . . . . . . . . . . . 4.5.2 MPC performance under the reduced model . . . . . . 4.6 Discussions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 Conclusions and future research . . . . . . . . . . . . . . . . . 35 36 37 37 39 41 41 42 45 45 48 48 48 49 50 50 51 55 57 57 61 61 63 65 65 68 69 74 75 75 81 83 5 Model assessment in model predictive control 85 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 5.2 Model predictive control of open channel flow . . . . . . . . . 88 Contents 5.3 5.4 5.5 v 5.2.1 Open channel flow model . . . . . . 5.2.2 Generic MPC formulation . . . . . 5.2.3 QP-based model predictive control 5.2.4 SQP-based model predictive control Test case . . . . . . . . . . . . . . . . . . . Results . . . . . . . . . . . . . . . . . . . . 5.4.1 Results of control performance . . . 5.4.2 Results of computational time . . . Conclusions and future research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 89 90 92 95 96 97 102 104 6 Conclusions and future research 107 6.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 6.2 Future research . . . . . . . . . . . . . . . . . . . . . . . . . . 109 A Time-varying state-space model over prediction horizon 123 B Combined water quantity and quality state-space model formulation 125 C Reduced model verification using extrapolated scenario of lateral flows 129 D Linearization of hydraulic structures 133 List of Symbols 137 Acknowledgements 143 About Author 145 Publications 147 vi Contents List of Tables 2.1 2.2 2.3 2.4 2.5 Target values of water level and concentration Locations of laterals in each reach . . . . . . . Lateral flow in each reach . . . . . . . . . . . Penalties in the objective function of MPC . . Gain factors of PI control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 27 28 29 30 3.1 3.2 3.3 3.4 Canal geometric parameters . . . . Parameters for Kalman filter design Weighting factors . . . . . . . . . . Overall performance of MPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 47 48 54 4.1 Lateral flow scenario for reduced model generation (step changes happen between 8 and 10 hours of simulation) . . . . . . . . . Lateral flow scenario for reduced model verification (step changes happen between 5 and 8 hours of the simulation) . . . . . . . Lateral flow scenario for testing the reduced model performance (step changes happen between 3 and 6 hours of the simulation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . Gain factors of the PI control . . . . . . . . . . . . . . . . . . Weighting factors in MPC for all reaches and structures . . . . 4.2 4.3 4.4 4.5 5.1 5.2 5.3 . . . . . . . . . . . . . . . . . . . . . . . . 71 72 73 74 74 Performance indicators of both SQP-based MPC and QPbased MPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Computational time components in both QP-based MPC and SQP-based MPC executions . . . . . . . . . . . . . . . . . . . 102 Number of model executions per control step in linear and nonlinear MPC . . . . . . . . . . . . . . . . . . . . . . . . . . 103 C.1 Lateral flow scenario for reduced model verification (step changes happen between 5 and 8 hours of the simulation . . . . . . . . 130 vii viii List of Tables List of Figures 1.1 1.2 1.3 1.4 Lock exchange with a 2DV model . . . . . . . . . . . . . . . Open channel water quantity and quality using a 1D model . Structure disgram of feedback control of an actual system . . Structure diagram of model predictive control of an actual system (van Overloop 2006) . . . . . . . . . . . . . . . . . . Local control of a drainage canal . . . . . . . . . . . . . . . Local control of a drainage canal with decouplers . . . . . . Centralized control (LQR) of a drainage canal . . . . . . . . Centralized control (MPC) of a drainage canal . . . . . . . . Structure diagram of model predictive control of an actual system using a LTV model . . . . . . . . . . . . . . . . . . . . . . 3 3 6 . . . . . 7 8 8 9 9 . 19 2.7 2.8 2.9 Schematic view of a Dutch polder . . . . . . . . . . . . . . . Schematic diagram of “Forward Estimation” and MPC on both water quantity and quality . . . . . . . . . . . . . . . . Canal reach schematization . . . . . . . . . . . . . . . . . . Schematic view of staggered 1D grid . . . . . . . . . . . . . Block diagram of MPC . . . . . . . . . . . . . . . . . . . . . Longitudinal profile of canal reaches with geometric characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Flow through structure . . . . . . . . . . . . . . . . . . . . . Water level deviations from the targets . . . . . . . . . . . . Average concentration deviations from the targets . . . . . . 3.1 3.2 3.3 3.4 3.5 3.6 3.7 Canal reach schematization . . . . . . . . . . . . . Longitudinal profile with different flow conditions . Upstream Flow Condition for MPC Test . . . . . . Upstream Flow Condition for Reduced Model . . . Model accuracy Vs model complexity . . . . . . . . Model level difference between SV and RSV model Gate flow with different prediction models . . . . . 1.5 1.6 1.7 1.8 1.9 2.1 2.2 2.3 2.4 2.5 2.6 ix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 . . . . 20 21 23 24 . . . . 27 31 32 32 . . . . . . . 41 46 47 49 51 52 53 x List of Figures 3.8 Water level with different prediction models . . . . . . . . . . 53 3.9 Computational efficiency with different models . . . . . . . . . 55 3.10 Computational time in each part of total control process with different models . . . . . . . . . . . . . . . . . . . . . . . . . 56 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.1 5.2 5.3 5.4 5.5 5.6 Work flow of MPC controlling a water system using model reduction technique . . . . . . . . . . . . . . . . . . . . . . . . Reduced water level states (I) and concentration states (III) projected back to the original order, and the water level differences (II) and concentration differences (IV) between the reduced model and the original model . . . . . . . . . . . . . . Reduced water quantity disturbances (I) and quality disturbances (III) projected back to the original order, and the water quantity disturbance differences (II) and water quality disturbance differences (IV) between the reduced model and the original model. . . . . . . . . . . . . . . . . . . . . . . . . . . Root mean square error of the reduced model on water quantity and quality (interpolated scenario) . . . . . . . . . . . . . Controlled water levels (I) and uncontrolled concentrations (II) using the reduced model; controlled water levels (III) and uncontrolled concentrations (IV) using the full model (Experiment A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Control flows (I) using the reduced model and (II) using the full model (Experiment A) . . . . . . . . . . . . . . . . . . . . Controlled water levels (I) and concentrations (II) using the reduced model; controlled water levels (III) and concentrations (IV) using the full model (Experiment B) . . . . . . . . . . . . Control flows (I) using the reduced model and (II) using the full model (Experiment B) . . . . . . . . . . . . . . . . . . . . Objective function value of MPC using reduced and full models QP-based MPC controlling a water system . . . . . . . . . . . SQP-based MPC controlling a water system . . . . . . . . . . Two experiments . . . . . . . . . . . . . . . . . . . . . . . . . Convergence of objective function values of the QP-based MPC scheme at control steps 1, 13, 67, 115, and 193 . . . . . . . . . Evolution of the predicted water levels and discharges of QPbased MPC over 30 iterations at the first control step . . . . . Comparison of objective function values between SQP-based MPC and QP-based MPC (10 iterations are only applied at the first control step) . . . . . . . . . . . . . . . . . . . . . . . 60 76 77 78 79 80 81 82 83 91 93 96 98 98 99 List of Figures Percentage difference in objective function values between SQPbased MPC and QP-based MPC with 10 initial iterations in experiment (a) . . . . . . . . . . . . . . . . . . . . . . . . . . 5.8 Controlled water levels in SQP-based MPC and QP-based MPC without iterations . . . . . . . . . . . . . . . . . . . . . 5.9 Controlled discharge in SQP-based MPC and QP-based MPC without iterations (Upstream inflow is plotted to indicate the downstream flow trends) . . . . . . . . . . . . . . . . . . . . . 5.10 Number of iterations used in SQP optimization . . . . . . . . xi 5.7 6.1 100 101 101 104 Schematic view of MPC controlling both surface water quantity and quality using reduced models . . . . . . . . . . . . . . 111 C.1 Root mean square error of the reduced model on water quantity and quality (extrapolated scenario) . . . . . . . . . . . . . 129 C.2 Reduced water level states (I) and concentration states (III) projected back to the original order, and the water level differences (II) and concentration differences (IV) between the reduced model and the original model . . . . . . . . . . . . . . 131 C.3 Reduced water quantity disturbances (I) and quality disturbances (III) projected back to the original order, and the water quantity disturbance differences (II) and water quality disturbance differences (IV) between the reduced model and the original model . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 xii List of Figures Chapter 1 Introduction 1.1 1.1.1 Water quantity & quality management in open channels Current situation Water is a natural resource that is closely related to the life of human beings. Important water functions are drinking water supply, water recreation, irrigation, etc. In terms of water use, two criteria need to be met: quantity and quality. However, the amount of fresh water that is suitable for use is limited. Maintaining a healthy water condition, not only in water quantity but also in water quality, is extremely important for the existence and development of a society. In the past, people were paying attention to water quantity issues, typically for flood and drought protection [1] [2]. Water delivery for irrigation is another quantity issue [3] [4]. However, due to the economic and social development of societies, water is polluted more and more, especially in developing countries. For example, in 2009 water was polluted in the Taihu lake, eastern China, and caused algae blooming over a long period. This largely influenced the water supply of the region and caused a huge economic loss. Water quality management is becoming a hot issue. Moreover, as climate changes, severe situations, such as drought, flooding and salt water intrusion, will occur more often [5], and clean water is getting scarce. Ideally, water quantity and quality needs to be considered at the same time in the operation of a water system. However, in some cases they can be 1 2 Chapter 1. Introduction in conflict with each other. Salt water intrusion in estuaries is an example. During dry periods, more water is required for human consumption as well as for agriculture. However, due to low river discharges, salt water can intrude further upstream and affect the fresh water intake. Such conflicts require more efficient and effective measures. People recognize water quality problems and try to find solutions. Most water quality management is on a strategic level, for example limiting the pollution emission from a legislation perspective [6]. This strategic measure can control the behavior of human beings, and have some effects to a certain degree. However, it can not eliminate the non-human pollution, for example the polluted runoff from farm lands after fertilization. In this case, the pollution problem still needs to be solved as much as possible while considering the water quantity requirements. This research focuses on the situation when pollution is already in the system, and on how to transport, dilute and remove the pollution using operational water management. 1.1.2 Modelling of open channel flow In order to properly manage both water quantity and quality, it is important to understand how water and pollution behave. Nowadays numerical models are popular tools to mimic the real world. In practice, water systems are always in three dimensions that requires 3D models to fully describe the dynamics. Based on the accuracy, complexity and research focuses, some less important components or elements can be neglected and models can be reduced to lower dimension. For example, Figure 1.1 [7] shows a simulation results of a lock exchange with a two dimensional model (horizontal and vertical). In open channels, one dimensional models are often accurate enough under certain assumptions, e.g. Figure 1.2 [8] illustrates a one dimensional water quantity and quality model result during the control of flushing. According to modelling objectives and characteristics of a water system, different models can be used to describe the flow dynamics. Typical models include reservoir models, hydrodynamic models and transport models for water quality. Reservoir models are simple mass balances which contain little dynamics. Therefore, they are normally used for overall management of reservoirs. Reservoir models usually have much less state variables than hydrodynamics models, which results in fast computation. Some of the reservoir models are linear. Because of these advantages, they are also used in model-based control of water systems, such as [9] [10]. 1.1. Water quantity & quality management in open channels Figure 1.1: Lock exchange with a 2DV model Figure 1.2: Open channel water quantity and quality using a 1D model 3 4 Chapter 1. Introduction Some researchers adjusted the basic reservoir model and generated an IntegratorDelay (ID) model [11] and an Integrator-Delay-Zero(IDZ) model [12] to fulfill the requirements of irrigation canal automation, where water transport is characterized by delays in the canal reaches. The ID model splits the canal into a uniform flow part and a back water part, which are characterized by the delay and storage, respectively. This model development made great contribution to canal automation and various applications have been conducted using this model over the last 15 years such as [13] [14]. One of the limitations of the ID or IDZ model in model-based control is that it is restricted to small flow fluctuations, in order to avoid nonlinear changes in delay and storage. Although reservoir models are widely applied, detailed depiction of flow dynamics requires hydrodynamic models. Therefore, these hydrodynamic models are used to simulate the real world. They need a certain scheme to discretize the mathematical equations in space and time. A commonly used hydrodynamic model is the one dimensional Saint-Venant equations. For water quality modelling, the one dimensional transport equation is widely used. Most of the 1-dimensional hydrodynamic models need to fulfill the Courant condition which is required to achieve a stable simulation [15]. In general, an explicit scheme needs a small time step which increases computation time. Many models use implicit or semi-implicit schemes which fulfill the stability condition with a larger time step. Some schemes result in unconditionally stable, such as the Preissmann scheme with an adapted time integration parameter [16], a staggered conservative scheme [17]. This is very important in the models used for real-time control purposes, where the control time step is normally much larger than the simulation time step. The disadvantage of using these implicit or semi-implicit models is the wave damping, although, usually waves need to be filtered anyway in real-time control to avoid aliasing [18]. In this research, the substances considered in water quality control are assumed to be conservative or at least conservative during the research period. Typical conservative substances are salinity, nitrate and phosphate, etc. 1.2. Real-time control of open channels 1.2 1.2.1 5 Real-time control of open channels General introduction Water systems are usually managed to fulfill certain requirements in operation, such as maintaining water levels in a river for shipping or flood protection, keeping water clean in reservoirs for recreation or drinking water supply. Such operations used to be implemented manually. However, the conventional manual operations are characterized by lack of accuracy and it is difficult to meet the increasing criteria of water management, especially in complex water networks with multiple control objectives. As clean water is becoming scarce and severer situations occur more often, increased efficiency is required in operational water management. Real-time control becomes important to mitigate the effect of critical situations and in this way reduce damages. Real-time control emerged from industry and has been applied to water management since 1970s. The first real-time control applications in water management were in controlling irrigation canals, due to the requirements of efficient water delivery [19],[20],[21],[22]. Although there has been much research on reservoir operations earlier, such as [23] [24], they mainly focused on long-term or mid-term operation which is typically at the management level. Real-time control as considered in this research applies as short-term operational water management, namely in the order of minutes or hours depending on the system under investigation. Recently, short-term real-time control has become popular in river operation such as flood protection. There is already extensive research on water quantity control, especially in irrigation canal automation, such as [25] [26] [27]. However, the combined water quantity and quality control is seldom studied. One of the important reasons is the limited availability of real-time water quality measurements. This is a necessity for real-time control implementation. Since water quality is becoming more and more important and real-time water quality measurements are available nowadays, researchers recently pay more attention to water quality control. In this research, real-time measurements are assumed to be available for both water quantity and quality. 6 Chapter 1. Introduction 1.2.2 Real-time control methods Reactive versus Predictive Real-time control contains many control methods, which can be classified differently based on the criteria under concern. Malaterre et al. [28] made a classification of control algorithms from the perspectives of both civil and hydraulic engineers (controlled variable) and control engineers (control logic). The classification of control logic is extended and a distinction is made between reactive (feedback) control and predictive control based on the information used by the controller. Control actions in a reactive control are based on the current system information, while predictive control uses future system predictions to generate control actions, often employing some form of optimization. A structure diagram of feedback control is shown in Figure 1.3. The key element is to properly select gain factors in the feedback controller. Figure 1.3: Structure disgram of feedback control of an actual system A typical reactive control in operational water management is Proportional Integral (PI) control, where the control action is a function of the state deviation and its integral. The advantages of PI control is that the control formulation is very simple and the controller is usually very stable with proper gain factors. Linear Quadratic Regulator (LQR) is another reactive control, which is categorized into optimal control because optimization is applied to find the feedback gain factors. A typical predictive control is Model Predictive Control (MPC). The control method was only introduced in water management about 10 years ago [29]. MPC is considered as an advanced control technique, because it uses a pre- 1.2. Real-time control of open channels 7 diction model (internal model) to anticipate the future system behavior and applies an optimization algorithm to generate optimal control actions over a finite prediction horizon. Advantages of MPC are that it can pre-react on future system changes based on the system prediction. This is very important for example in flood protection to reduce the flood peak by pre-releasing water, in order to create extra storage. Physical and operational constraints can also be taken into account within the optimization. [30] On the other hand, the large disadvantage of MPC is the relatively large computation time. MPC is an online control method that performs the optimization at every control step. MPC implements only the first control action over the prediction horizon. Figure 1.4 shows the structure diagram of model predictive control on an actual system. Figure 1.4: Structure diagram of model predictive control of an actual system (van Overloop 2006) Local versus Centralized Open channels are usually divided into several reaches by hydraulic structures, such as sluices, weirs and pumps. Each reach can form its own subsystem where the structure tries to maintain that system. Based on the way of generating control actions, controllers can be categorized into local control and centralized control. In local control, each control structure is used to control the local state, and controllers do not communicate with each other. Figure 1.5 illustrates the control of a drainage canal using local controllers. 8 Chapter 1. Introduction Because of the inter-connection between neighboring reaches, the operation of one structure will influence the neighboring reaches and cause water level oscillations. Therefore, when using local control for the entire canal, it is difficult to achieve a good performance. Figure 1.5: Local control of a drainage canal In order to reduce the influence of local operations, decouplers are often required to connect the separate reaches and let the local controllers communicate with each other. The decoupler is a type of feedforward control. Local control of a drainage canal with decouplers is shown in Figure 1.6. By sending the control information of the structure downwards, the downstream structure reacts not only on the water level in control but also on the upstream flow change. In this way the oscillations can be minimized. Notice that the local control with decouplers is still considered as local control. Figure 1.6: Local control of a drainage canal with decouplers In centralized control, information is sent to each individual structure from a centralized calculation on a central computer. The information can be either direct control inputs, such as pump flows or weir crest levels, or indirect control signals, such as optimal gain factors used to calculate the control inputs in LQR. Figure 1.7 shows a centralized control of a drainage canal using LQR. 1.2. Real-time control of open channels 9 Figure 1.7: Centralized control (LQR) of a drainage canal Model predictive control is an example of providing direct control inputs in centralized control. In principle, MPC can be either local or centralized control, depending on the control configurations. However, because of the advantage of optimization, MPC is often used to control the entire system. Alternatively, part of a system with several control structure is used but normally a higher level optimization is used that negotiates among different MPCs. This is called Distributed Model Predictive Control (DMPC), which is out of the scope of this thesis. In this case, the decoupling is already taken into account within the optimization. The influence of operating one hydraulic structure generates compensating actions for other structures. Figure 1.8 illustrates a centralized control of a drainage canal using MPC. Figure 1.8: Centralized control (MPC) of a drainage canal This thesis focuses on MPC controlling combined water quantity and quality in open channels. PI control is used for comparison and to give insight into 10 Chapter 1. Introduction the advantages of MPC. 1.3 Model predictive control As can be seen in Figure 1.4, MPC includes several components such as objective function, internal model, optimization. In operational water management of open channels, a typical objective of water quantity control is to minimize the water level deviations from the setpoints, while for water quality management, it is important to keep water as “clean” as possible and control the solute concentration below a certain criterion for use. In practice it is also important to consider the wear and tear of hydraulic structures, which means that the structure settings need to be adjusted as smoothly as possible, i.e. minimizing the changes of structure settings. In feedback control, these goals are realized through proper tuning of gain factors, while MPC formulates them into an objective function. A quadratic objective function is often used in MPC to cope with both positive and negative deviations. The internal model in MPC is used to predict the future dynamics of a system, based on which optimization generates the optimal control actions over a finite prediction horizon. Therefore, the accuracy1 of the internal model directly influences the control effectiveness2 . Based on the type of internal models in use, MPC can be categorized into linear MPC (LMPC) and nonlinear MPC (NMPC). In this thesis, the implementation of different internal models is discussed, both linear and nonlinear. These models can be either very simple and run fast with low accuracy, or very complex which are accurate but computationally expensive. This thesis also provides a reduced model where accuracy and computational burden lie between simple and complex models. A traditional MPC formulation is to use a linear time-invariant state-space model (LTI). This problem can be efficiently solved through Quadratic Programming (QP) and guaranteed global optimal solutions can be found [31]. In operational water management, this LTI model can be reservoir models for both water quantity and quality. The ID model developed by Schuurmans et al. [11] is widely used in open channel flow control. However, when the system under investigation is highly nonlinear, linear models are not repre1 means the quality of being correct or true. Here the accuracy only describes the model performance 2 means producing the results that are wanted or intended. The effectiveness only describes the behavior of a controller 1.3. Model predictive control 11 sentative anymore. The Saint-Venant equations and transport equation are typical nonlinear models for water quantity and quality. It is necessary to use nonlinear models and consider NMPC which iteratively solves an optimization problem through a nonlinear optimization algorithm, e.g. Sequential Quadratic Programming (SQP). In NMPC, optimal solutions from the optimization are not guaranteed global optimal and the computation time is usually very high due to the numerical calculations of the gradients of the objective function [32]. A nonlinear model can still be linearized with a dedicated discretization scheme. It can then be transformed into a linear state-space model format but with time-variant coefficients that are state-related. From a control perspective, the model is called a linear time-variant state-space model (LTV). The LTV model in MPC is linear at each control time step, but it is actually nonlinear over a finite prediction horizon. However, due to the efficient calculation of Quadratic Programming, the application of a LTV model in QP-based MPC can integrate the advantages of using accurate hydraulic models and efficient optimization with guaranteed global optimum. In this thesis, the scheme is developed by introducing a procedure called “Forward Estimation” before the execution of MPC. Figure 1.9: Structure diagram of model predictive control of an actual system using a LTV model 12 Chapter 1. Introduction The “Forward Estimation” is basically a simulation model, which is used to estimate the time-variant coefficients of the internal model used in MPC. The simulation is executed over the prediction horizon. The “Forward Estimation” works with the currently observed states and the control inputs from the previous control step. In conventional MPC application, the optimal control actions over the prediction horizon are not implemented except the first one, however, they are used in the “Forward Estimation” in LTV model of MPC. The adjusted MPC diagram with the implementation of a LTV model is illustrated in Figure 1.9. 1.4 Model reduction Although a QP problem can be solved efficiently, the formulation of the optimization problem will still be computationally intensive when the hydraulic models are spatially discretized with fine grids. To solve this issue, model reduction techniques are necessary to reduce the model order. However, it is very important that the reduced model can still maintain the required model accuracy. Model reduction has emerged since the 1950’s. The main applications are in the field of signal analysis, image processing, control engineering, etc [33]. Recently, some contributions have appeared in the field of water management, e.g. [34] and [35] for groundwater modeling, [36] for tsunami forecasting and [37] for fluid control. Model reduction can be either data driven, building a model by fitting the data through a machine learning process, or model driven, using a mathematical model, to calculate the reduced model [34]. Proper Orthogonal Decomposition (POD) is one of the most popular and widely applied model driven reduction techniques to reduce the model order by calculating basis functions. POD can be applied not only to linear models, but also to nonlinear models, e.g. [38], [39]. The calculation of the basis functions is the key process of POD. Liang et al. [40] provides an extensive explanation of three POD methods: Karhunen-Loeve Decomposition (KLD), Singular Value Decomposition (SVD), Principal Component Analysis (PCA), and proves the equivalence of these three methods. In this thesis POD incorporated with a snapshot method is applied to generate the reduced state-space model for both water quantity and quality in this thesis. The snapshot approach takes snapshots of an off-line simulation model, which 1.5. Objective of the study 13 includes combined Saint-Venant equations and transport equation for water quantity and quality, and forms a correlation matrix. Based on the most “energetic” eigenvalues of the correlation matrix, the method generates basis functions and formulates a reduced model. Each snapshot is a column vector containing states, which are water levels and solute concentrations. The snapshot approach has already been applied by several researchers in the field of water management, such as [37], [41] and [36]. These studies focused on water quantity, while in this thesis combined water quantity and quality is studied. Moreover, the reduced model is implemented in MPC and the influence on the control performance3 is analyzed. 1.5 Objective of the study The thesis covers three main objectives: 1. The research addresses the importance and the possibility of real-time control techniques in controlling both surface water quantity and quality. Feedback control and model predictive control are the control methods studied for this purpose. 2. Model predictive control is selected as the main focus of the study, because of its predictive and optimization capabilities, by which a high control performance can be achieved. Since the prediction model in MPC has a large influence on the control performance regarding control effectiveness and computation time, the second objective is to develop a model reduction technique for MPC for a tractable real-time implementation. The MPC performance using the reduced models is analyzed. 3. Nonlinear model predictive control is studied in order to cope with the nonlinearity of the prediction model. This study is intended to complete the study of model predictive control with different prediction models in order to illustrate the control effectiveness and control accuracy. Moreover, this study provides insight into the accuracy of the proposed model reduction technique in MPC. This thesis focuses on man-made open channels. Note that all the case studies in this thesis are virtual. However, the theory and methods on control and 3 means how well or badly one performs a particular job or activity. It is a general expression. In this thesis, it includes model accuracy, control effectiveness and computation time. 14 Chapter 1. Introduction modelling can be extended to real water systems. 1.6 Outline of the thesis According to the above objectives, the thesis is organized as follows: In Chapter 2, the possibility of controlling combined water quantity and quality is studied. Both PI control and MPC are applied to control the flushing of a polder system, which can be considered as a one-dimensional system. The PI control is coupled with a decoupler. The MPC uses linear reservoir models for both water quantity and quality. The control performances of the two controllers are compared. In Chapter 3, MPC uses more complex hydrodynamic models to improve the control performance. Because of the model complexity and the heavy computation burden, a model reduction technique is necessary to reduce the model order in the model predictive controller. The hydrodynamic model is linearized through a discretization scheme. The model is formulated into a linear time-varying state-space model for the implementation of linear MPC. A “Forward Estimation” procedure is introduced to estimate the linear timevarying parameters. Hence, this chapter studies the possibility of applying model reduction in MPC and provides a method to solve a linear time-varying system in linear MPC. This chapter also analyzes the degree of computational time reduction. A detailed comparison with the ID model and the linearized Saint-Venant model is studied. For simplicity, only water quantity is considered with one canal reach. In Chapter 4, the model reduction technique is applied to both a hydrodynamic model and a transport model in MPC for water quantity and quality control, respectively. In order to illustrate the control performance, the linearized models without reduction is executed in MPC as well. Chapters 3 and 4 show that open channel flow can be controlled by MPC using complex dynamic models through model reduction. The control performances are compared with the full linearized dynamic models, which serve as the reference case. In this comparison, the “Forward Estimation” and the optimization algorithm are kept the same. The influence of the internal model to both control accuracy and computation time is analyzed. The “Forward Estimation” will introduce errors or uncertainty in the internal model and reduce the control accuracy. For the complete analysis of MPC controlling open channel flow, a nonlinear MPC is applied to solve the control 1.6. Outline of the thesis 15 problem. In Chapter 5, a nonlinear MPC had been studied using the full linearized Saint-Venant model. Since the linear time-varying system is actually nonlinear over the prediction horizon, a nonlinear optimization algorithm is necessary to tackle the problem without applying the “Forward Estimation”. In other words, the linear time-varying parameters are solved internally in the optimization instead of externally in linear MPC. The nonlinear MPC is considered as a benchmark for the control performance. However, the computation time of nonlinear MPC using numerical gradients of the objective function is unacceptable. This computation time issue is not considered in this chapter. It is suggested for future research to solve this issue by analytically providing the gradient, which requires intensive mathematical analysis. In Chapter 6 the main findings and conclusions of the thesis are summarized and the possible future research is elaborated. 16 Chapter 1. Introduction Chapter 2 Real-time control of combined water quantity & quality Abstract This chapter1 presents the initial study on real-time control of combined water quantity and quality. In open water systems, keeping both water depths and water quality at specified values is critical for maintaining a “healthy” water system. Many systems still require manual operation, at least for water quality management. When applying real-time control, both quantity and quality standards need to be met. In this chapter, an artificial polder flushing case is studied. Model Predictive Control (MPC) is developed to control the system. In addition to MPC, a “Forward Estimation” procedure is used to acquire water quality predictions for the simplified model used in MPC optimization. In order to illustrate the advantages of MPC, classical control [Proportional-Integral control (PI)] has been developed for comparison in the test case. The results show that both algorithms are able to control the polder flushing process, but MPC is more efficient in functionality and control flexibility. 1 based on: Xu. M., van Overloop. P.J., van de Giesen. N.C. and Stelling. G.S. Real-time control of combined surface water quantity and quality: polder flushing. Water Science and Technology. 61(4):869-878, 2010 17 18 2.1 Chapter 2. Real-time control of combined water quantity & quality Introduction Quantity and quality are the main characteristics to describe a water system. Much research has been devoted to how to optimize the water usage. For example, in irrigation systems, various real-time control methods have been applied to operate water systems efficiently [28], [13], [42]. For water quality, research on real-time control has only been conducted for sewer systems or urban waste water systems [43], [44], [45]. For water quality issues in rivers and open canals, more attention has been paid to modeling [46], [47], to simulate pollution transport and provide measures or strategies for reducing pollution. As will be shown here, real-time control for water quality can also be used to manage such systems. Many rivers and canals have water quality problems caused by pollution. Here, a polder system is considered. Figure 2.1 shows a schematic view of a typical Dutch polder. It is a terrain of low-lying areas that is surrounded by dikes. Within the low-lying areas, there lie many polder ditches that are inter-connected through hydraulic structures, such as weirs and sluices. Outside the polder, surrounding the low-lying areas, storage canals are situated. Those storage canals have higher elevations and provide space for the extra water from the polder storage during wet periods. The storage canals also supply fresh water to polders during dry periods. The polder system is only connected to the outside through man-operated devices. Water levels in both polder ditches and surrounding storage canals are maintained close to given target levels by operating hydraulic structures in order to maintain certain ground water levels in the polder, and avoid dike breaks in the storage canal [48]. Water quality is an issue in a polder system, because many nutrients from fertilizers, such as nitrate or phosphate, drain into the ditches. In summer, surface water quality can also deteriorate due to saline seepage and drainage water from greenhouses [48]. In polder water management, water quantity and quality control is separated. For water quality control, a certain fixed flushing strategy is used at a specific time interval, for example once every three days depending on the system. This fixed strategy is based on the worst case scenario with respect to pollution that could occur throughout the entire year. This strategy is not only overly conservative, but also inefficient. Any disturbances between two moments of flushing will make the flushing strategy less efficient, sometimes even insufficient. For example, many nutrients from fertilizers quickly drain into the ditches after heavy rainfall and deteriorate the water quality. In this situation, the flushing strategy should be modified to cope with the 2.1. Introduction 19 Figure 2.1: Schematic view of a Dutch polder disturbances. Therefore, real-time control could be used, based on real-time water quality measurements. [49] provides an overview of some techniques of monitoring water quality in realtime, such as measuring salinity, temperature, nutrients, dissolved oxygen, turbidity, pH, etc. Water quality sensors are able to continuously collect the measurements in the order of seconds and they can even work in turbid water conditions, for example the MBARI ISUS nitrate sensor [50]. Furthermore, real-time control can take water quantity and quality into account at the same time. Many control methods are available for water quantity control, especially for irrigation systems [28]. The present study provides a guideline for extending control theory to water quality as well. In this polder flushing situation, several canal reaches are controlled (multiple variable control) and multiple objectives (water level and quality control) are formulated. Optimization could be subject to certain constraints, such as pump capacities, limitations on changing gate position and limitations on water level and water quality fluctuations. Therefore, an advanced control technique, Model Predictive Control (MPC), is considered [51]. In order to implement MPC on water quality, a so-called “Forward Estimation” is required to predict the control 20 Chapter 2. Real-time control of combined water quantity & quality variables for each reach over the prediction horizon. These predictions are part of the inputs of a simplified model used in MPC. The “Forward Estimation” is performed outside the MPC optimization. A schematic diagram of the implementation procedure is shown in Figure 2.2. The innovation of this research is the joint application of this control method on water quantity and quality in an integrated framework. This chapter is organized as follows: Section 2.2 introduces the water quantity and quality control method, including the “Forward Estimation” procedure and the MPC scheme. A test case is setup in section 2.3 to test the proposed control method. In order to demonstrate the MPC control performance, it is compared with a classical feedback control. Section 2.4 shows the comparison results between MPC and feedback control. The advantages and disadvantages of each control methods on combined water quantity and quality are in section 2.5. Figure 2.2: Schematic diagram of “Forward Estimation” and MPC on both water quantity and quality 2.2. Method 2.2 2.2.1 21 Method Forward estimation The “Forward Estimation” is regarded as a pre-simulation of flow and pollution transport. It uses two linear approximations of the Saint-Venant equations and the one dimensional advection-dispersion transport equation to predict the inflow and outflow concentrations along with the average concentration in the canal reaches. The prediction covers the entire prediction horizon based on the optimized control flows from the previous optimization. These partial differential equations used in the “Forward Estimation” are demonstrated in Equations 2.1, 2.2 and 2.3. For the transport equation, instantaneous complete cross-sectional mixing is assumed [52]. During the canal flushing processes, the pollution is assumed to be conservative. The schematization of a canal reach is shown in Figure 2.3 to illustrate the variables. Figure 2.3: Canal reach schematization ∂Af ∂Q + = ql ∂t ∂x (2.1) ∂Q ∂(Qv) ∂η Q|Q| + + gAf +g 2 =0 ∂t ∂x ∂x Cz RAf (2.2) ∂(Af c) ∂(Qc) ∂ ∂c + = (KAf ) + ql cl ∂t ∂x ∂x ∂x (2.3) where Af is the cross sectional area [m2 ], Q is the flow [m3 /s], ql is the lateral inflow per unit length [m2 /s], v is the mean velocity [m/s], which equals Q/Af , η is the water depth above the reference plane [m], Cz is the Chezy coefficient [m1/2 /s], R is the hydraulic radius [m], which equals Af /Pf 22 Chapter 2. Real-time control of combined water quantity & quality (Pf is the wetted perimeter [m]) and g is the gravity acceleration [m/s2 ], K is the dispersion coefficient [m2 /s], c is the average concentration [kg/m3 ], cl is the lateral flow concentration [kg/m3 ], t is time and x is horizontal length. [52] provides equations to calculate the longitudinal dispersion coefficient K: W 2v2 K = 0.011 dm us p us = gRSb (2.4) where W is the mean width [m], dm is the mean water depth [m], us is the shear velocity [m/s], and Sb is the bottom slope of the canal [−]. A spatial discretization of the Equations 2.1, 2.2 and 2.3, has been developed in the form of a staggered conservative scheme in combination with a first order upwind approximation [53], [17]. In the staggered grid, the values of ∗ vi at point i and ∗ ci+1/2 at point (i + 1/2) are missing (see Figure 2.4). An upwind approximation is applied to achieve those values according to the flow direction. Qi−1/2 − Qi+1/2 dAf,i = + ql,i dt ∆x (2.5) dvi+1/2 1 Q̄i+1 ∗ vi+1 − Q̄i ∗ vi Q̄i+1 − Q̄i + ( − vi+1/2 ) dt ∆x ∆x Āf,i+1/2 vi+1/2 |vi+1/2 | ηi+1 − ηi +g +g =0 ∆x Cz2 R (2.6) Qi−1/2 ∗ ci−1/2 − Qi+1/2 ∗ ci+1/2 dAf,i ci 1 = + (Ki+1/2 Āf,i+1/2 ci+1 dt ∆x ∆x2 −(Ki+1/2 Āf,i+1/2 + Ki−1/2 Āf,i−1/2 )ci + Ki−1/2 Āf,i−1/2 ci−1 ) + ql,i cl,i where: Q̄i = ∗ vi = Qi−1/2 + Qi+1/2 2 vi−1/2 vi+1/2 (Q̄i ≥ 0) (Q̄i < 0) Āf,i+1/2 = ∗ ci+1/2 = (2.7) Af,i + Af,i+1 2 ci ci+1 (Qi+1/2 ≥ 0) (Qi+1/2 < 0) 2.2. Method 23 Figure 2.4: Schematic view of staggered 1D grid The integration scheme in time is based on the theta method [17]. The equations are connected with each other, giving rise to tri-diagonal matrices. A schematic view of the staggered 1-dimensional grid is shown in Figure 2.4. Note that the water system is simulated with the same model as the “Forward Estimation” 2.2.2 Model predictive control Model Predictive Control (MPC) has been developed in industrial engineering since the 1970s. MPC has recently been introduced in water management, mainly for controlling water levels in the system. For example van Overloop[29] applied MPC on various open channel systems, and Wahlin and Clemmens [14] used MPC to control water levels in branching canal networks. A block diagram of MPC describes the process (see Figure 2.5). Extending this method to combined water quantity and quality control appears promising. MPC needs a model to predict the future behavior of a system. The commonly used models for describing the dynamics of water quantity and quality in a shallow water system are Saint-Venant equations and the advectiondispersion transport equation. However, these are non-linear partial differential equations, and make controller design and implementation a difficult task. From a control point of view, it is potentially attractive to design a controller with a linear approximation of the non-linear system model [31]. 24 Chapter 2. Real-time control of combined water quantity & quality Figure 2.5: Block diagram of MPC In this research, a discrete time-varying state-space model is used in order to cope with the varying parameters over the prediction horizon. Current research on linear time-varying model in real-time control can be found in [54] [55]. The model can be described as: xk+1 = Ak xk + Buk uk + Bdk dk y(k) = Cx(k) (2.8) where: x is the state vector, u is the input vector, d is the disturbance vector, A is the state matrix, Bu is the control input matrix, Bd is the disturbance matrix, C is the output matrix and y is the output, k is the time step index. The equations are structured into matrices and can be solved with for example MATLAB. Many linear approximations have been developed for the Saint-Venant equations, especially for irrigation canals. A canal reach is divided into several segments and a state estimator or observer is used to estimate the hydraulic information for each segment [56], [57]. However, such approximations are not appropriate for MPC due to the fact that MPC uses online (real-time) optimization, and the use of many segments increases the computational power requirements considerably. This problem is compounded if the same linearization procedure for the water quality model is added. Therefore, a simplified model is needed, provided it can preserve the main system characteristics. [11] developed an Integrator Delay (ID) model, which is a lumped parameter model. The ID model captures the main dynamics of water transport and assumes two elements in a canal reach: uniform flow part, mainly characterized by its delay time, and a backwater part, characterized by its surface area. The equation description is as follows: 2.2. Method 25 deη dη 1 = = [Qin (t − τ ) − Qout (t)] dt dt As (2.9) where eη is water level deviation from target level [m], which has the same derivative as the water level η when the target level is constant. Qin and Qout are inflow and outflow [m3 /s], As is the backwater surface area [m2 ] and τ is the delay time in the uniform flow part [s]. For a simplified water quality model, Tomann and Mueller [58] provide a lake model as a completely mixed system which maintains the mass balance. This model assumes that the outflow concentration is equal to the concentration in the lake. If the model is applied to a long canal and the control step is short, this assumption is invalid. Therefore, the model should be modified to a non-mixed system with the calculation of the average concentration of the lake and the outflow concentration. In this case, the calculation is possible when applying the “Forward Estimation”. Then the water quality mass balance can be written as: d(V c) = Qin (t)cin (t) − Qout (t)cout (t) dt (2.10) Substituted with the flow mass balance, Equation 2.10 becomes: dec dc 1 = = [Qin (t)(cin (t) − c(t)) − Qout (t)(cout (t) − c(t))] dt dt V (2.11) where V is the water volume in the reach [m3 ], ec is the average concentration deviation from the target concentration [kg/m3 ], which has the same derivative as the average concentration c when the target concentration is constant, cin and cout are inflow and outflow concentrations [kg/m3 ]. For MPC, an objective function J is used to describe the goal of controlling combined water quantity and quality. Both water level and concentration need to be maintained to their target values. In addition, the control flow needs to be adjusted as smoothly as possible. The objective function is formulated as follows: nr X n X 2 k 2 ∗ ∗k 2 Wx,η (ekη )2 + Wx,c (ekc − e∗k min J = min { c ) + Wu (∆Qc ) + Wu,c (ec ) } j=1 k=1 (2.12) 26 Chapter 2. Real-time control of combined water quantity & quality ∗k ec ≤ 0 ∆Qc,min ≤ ∆Qkc ≤ ∆Qc,max subject to: Qp,min ≤ Qkp ≤ Qp,max where: n is the number of steps in the prediction horizon and nr is the total number of canal reaches, ∆Qc is the change of control flow (both for gate and pump) [m3 /s], Wx,η , Wx,c and Wu are the penalties for eη , ec and ∆Qc separately. e∗c is a virtual variable as soft constraint [kg/m3 ] introduced to restrict ec . The introduction of the soft constraint is due to the restriction that water quality control should be deactivated when water is clean (below target concentration). van Overloop [29] points out that soft constraints are implemented as extra penalty when the state or input violates the limitation. ∗ is the penalty on virtual inputs. Its value is extremely small, which Wu,c ∗ ∗k makes the term of Wx,c ec almost equal to zero, no matter what the value ∗k of ec is. Qp is the pump flow [m3 /s]. The constraints on ∆Qc and Qp are regarded as hard constraints (physical constraints) that can never be violated. 2.3 Test Case 2.3.1 Case setup To demonstrate the potential of the method, an artificial but realistic polder flushing test case is studied, which consists of four canal reaches, separated by 3 in-line gates. The reaches have different water quality contents at the beginning, but the average concentrations are all below water quality target concentrations. The target values of water quantity and quality are listed in Table 2.1. The canal characteristics are shown in Figure 2.6. Table 2.1: Target values of water level and concentration Reach 1 Reach 2 Reach 3 Reach 4 Target level (m) -0.4 -0.8 -1.4 -1.8 Target concentration (kg/m3 ) 0.7 0.7 0.7 0.7 Each canal reach was divided into 100 segments for spatial discretization, thus 10 meters per segment. The pollution is assumed to be conservative or at least conservative during the flushing period, for example, in the case of salinity control. At each time step, the dispersion coefficient K at each 2.3. Test Case 27 Figure 2.6: Longitudinal profile of canal reaches with geometric characteristics discretized velocity point is estimated through Equation 2.4. The canal introduces fresh water from a storage canal through Gate 1, and a pump is used to lift water out of the system at the other end. Each reach has several polluted lateral inflows. Their initial locations, flows and concentrations listed in Tables 2.2 and 2.3. These laterals are disturbances to the system. Table 2.2: Locations of laterals in each reach Distance to reach head (m) Reach Lateral 1 Lateral 2 Lateral 3 1 400 700 No third lateral 2 300 700 No third lateral 3 200 500 900 4 500 800 No third lateral The total simulation time is 20 hours and the controller executes once every 4 minutes. During the simulation, the concentration of the second lateral in the second reach is increased from 1.4 kg/m3 to 5.6 kg/m3 (a step change) after 5 hours and keeps constant afterwards. Other lateral concentrations and flows remain the same. This disturbance is assumed to be known in advance or can be predicted. The selection of which lateral concentration increases is chosen randomly. Which exact disturbance scenario is used, is assumed to be irrelevant for the evaluation of real-time control. This case demonstrates how real-time control corrects for water quality disturbances while water quantity criteria are still maintained. The total system is modeled and tested in MATLAB. Chapter 2. Real-time control of combined water quantity & quality 28 Reach 1 2 3 4 Table 2.3: Lateral flow in each reach Lateral 1 Lateral 2 Lateral 3 Discharge Concentration Discharge Concentration Discharge Concentration (m3 /s) (kg/m3 ) (m3 /s) (kg/m3 ) (m3 /s) (kg/m3 ) 0.02 1.0 0.03 1.2 No third lateral 0.02 1.2 0.03 1.4 No third lateral 0.04 0.9 0.02 1.5 0.03 1.8 0.02 1.5 0.04 1.0 No third lateral 2.3. Test Case 2.3.2 29 MPC setup The internal model and the objective function are in accordance with those in Section 2.2.2. In the state space model, x includes the water level deviations and concentration deviations from their setpoints as well as flows on the delayed time steps; u includes the flow changes of each structure and the virtual inputs e∗k c (≤ 0) of each canal reach, which is used to switch on/off the water quality control; d includes all the lateral flows. The pdiscrete delay steps in the model are estimated by the travelling time (Lc /( gAf /Wt + v)) [59], divided by the control time step and rounded upwards, where Lc is the canal length [m], Af is the cross sectional area [m2 ], Wt is the top width [m], g is the gravity acceleration [m/s2 ] and v is the mean velocity [m/s]. The calculation results in 2 delay steps with a 4 minutes control time step for each reach. The MPC controller uses a 4-hour prediction horizon. When MPC detects the lateral concentration change within the prediction horizon, it should adjust the flow at the present control step. There are no specific rules for tuning MPC. van Overloop [29] provides a method for obtaining a set of starting penalties for the objective function using MAVE estimate. Further tuning can be followed through trial-anderror. Table 2.4 displays the penalties used in this case. Table 2.4: Penalties in the objective function of MPC Reach 1 Reach 2 Reach 3 Reach 4 Wx,η Wx,c ∗ Wu,c Wu 2.3.3 1 (0.28)2 1 (0.58)2 1 (1.0×1010 )2 1 (0.28)2 1 (0.58)2 1 (1.0×1010 )2 1 (0.28)2 1 (0.58)2 1 (1.0×1010 )2 1 (0.28)2 1 (0.58)2 1 (1.0×1010 )2 Gate 1 Gate 2 Gate 3 Gate 4 Gate 5 1 (0.61)2 1 (0.61)2 1 (0.61)2 1 (0.61)2 1 (0.61)2 Classical control setup Proportional-integral control (PI) is a commonly used control method in water management. It is relatively simple and robust with respect to disturbances. Researchers have applied PI controllers on irrigation and river water systems for water level control [59], [27]. The reason for applying PI control in this case is to compare its performance with MPC and to illustrate the advantage of the more advanced control method, MPC. The principle behind PI control is a simple equation 2.13 30 Chapter 2. Real-time control of combined water quantity & quality ∆Qkc = Kp [ek − ek−1 ] + Ki ek (2.13) where k is a discrete time index, ∆Qc is the required flow change for a certain structure [m3 /s], Kp and Ki are proportional and integral gain factors, e is water level deviation from a given target level [m]. This method can be extended to water quality control by defining e as the water quality deviation from target value. In this polder flushing case, Gate 1 (inflow to the system) is linked to the water quality variable in the most polluted reach. The remaining gates and the pump apply local upstream control [28] on water levels in each reach with decouplers. The decoupler is considered to be a feedforward control, which has the function of counteracting the influence of flow interactions between neighbouring canal reaches [59], [13]. In this case, the decoupler sends the upstream gate flow information directly to all structures and avoids flow interactions between neighbouring reaches. Thus, it avoids extra water level fluctuations. Researchers have made important contributions to select proper gain factors for PI control, for example, [60]. In simple situations, such as in this test case, a trial-and-error method can be used. Table 2.5 displays the selected gain factors of PI control. Gain factor Kp Ki 2.4 Table 2.5: Gain factors of PI control Reach 1 Reach 2 Reach 3 Reach 4 0.65 6.31 6.84 6.31 0.06 0.48 0.46 0.48 Pump 8.21 0.49 Results The simulation results of using both PI control and MPC are shown in Figures 2.7 through 2.9. In these figures, gate and pump flows, water level deviations and average pollutant concentration deviations from their target values are demonstrated. Figures 2.7(a) through 2.9(a) are the results of PI control and Figures 2.7(b) through 2.9(b) are for MPC. It is clear that with a step change in water quality, both controls can stabilize water levels and restore water quality back to their target values. They move the system from one steady state to another. 2.5. Conclusions and discussions 31 With PI control, Gate 1 reacts when the step change happens. This is the moment when the water quality deteriorates. Due to the decoupling, water level controllers take actions at the same time and decrease the water level at the end of each pool. Figures 2.8(a) and 2.9(a) show that water levels can be efficiently maintained with PI control, but water quality deteriorations in reach 3 and 4 are relatively high. When MPC is applied, it can adjust the system in advance due to the prediction (a 4-hour prediction in this case). When MPC detects lateral concentration increases within the prediction horizon, it increases clean water inflow and thus decreases the concentration first. Figure 2.7(b) shows this earlier response when comparing with PI control result in Figure 2.7(a). In this case, when the actual lateral change occurs, there is more leeway for concentration increase. This is a significant difference from PI control where the concentration peak is much higher. Figure 2.9(a) and 2.9(b) demonstrate this difference. Figure 2.8(b) show that MPC can also control water levels within a relatively safe margin. (a) PI (b) MPC Figure 2.7: Flow through structure 2.5 Conclusions and discussions This chapter explored the innovation of combined surface water quantity and quality control. A polder flushing strategy was studied based on real-time control. Regarding the results of applying PI control and MPC, the following conclusions can be drawn. 1. Both PI control and MPC are able to maintain water levels and restore water quality back to their target values during canal flushing. 32 Chapter 2. Real-time control of combined water quantity & quality (a) PI (b) MPC Figure 2.8: Water level deviations from the targets (a) PI (b) MPC Figure 2.9: Average concentration deviations from the targets 2.5. Conclusions and discussions 33 2. PI control and MPC performances are different. PI control takes late action, while MPC takes advantage of the prediction, which leads to smaller concentration deviations and a better flushing strategy. 3. The incorporation of a “Forward Estimation” process, proposed in Figure 2.2, is proved to be a feasible procedure when applying simplified water quantity and quality models for MPC. Based on the above comparison between MPC and PI control in the canal flushing case, three aspects can be considered for discussion. 1. Functionality: PI control is much simpler than MPC and it uses less computational power. Although it can stabilize the system relatively well, this setup of PI control (the first gate controls water quality and the rest maintains water levels) has limited functionality. It is specifically designed for canal flushing. If there is water scarcity in the system while water quality is not a problem, this setup is unable to supply water downstream, because the first gate is not programmed to maintain water quantity. In contrast, MPC is a multi-objective control system for both water quantity and quality, and it is designed to optimize flows in any situation. From this viewpoint, it has more functionality than PI control. 2. Control flexibility: MPC is able to consider system constraints that may be present within the optimization, for example, the maximum allowed pollution concentration. Because MPC can react in advance based on the prediction, extra leeway can be created before the real concentration peak arrives. This is extremely important, especially when water quality deviation margins are small and the constraints are easily violated. The constraint violation may be unavoidable or be mitigated through very tight control when applying PI control. 3. Implementation difficulty: It is not sufficient for MPC to only use measurements. MPC needs a proper model to predict the future behavior. In reality, it is difficult to obtain all the information required by the model, such as to anticipate the lateral flow and its concentration. Therefore, other models are needed to generate these inputs first, for example a rainfall-runoff model coupled with a water quality model. Since PI control reacts only when deviations occur, measurements are enough to fill the controller. This makes the implementation of PI control much easier. 34 Chapter 2. Real-time control of combined water quantity & quality Chapter 3 Control effectiveness Vs computational efficiency in model predictive control Abstract This chapter1 presents a study on the control effectiveness and computational efficiency using reduced Saint-Venant models in MPC. Model predictive control (MPC) of open channel flow is becoming an important tool in water management. The complexity of the prediction model has a large influence on the MPC application in terms of control effectiveness and computational efficiency. The Saint-Venant equations, called SV model in this chapter, and the Integrator Delay (ID) model are either accurate but computationally costly, or simple but restricted to allowed flow changes. In this chapter, a reduced Saint-Venant (RSV) model is developed through a model reduction technique, Proper Orthogonal Decomposition (POD), on the SV equations. The RSV model keeps the main flow dynamics and functions over a large flow range but is easier to implement in MPC. In the test case of a modeled canal reach, the number of states and disturbances in the RSV model is about 45 and 16 times less than the SV model, respectively. The computational time of MPC with the RSV model is significantly reduced, while the controller remains effective. Thus, the RSV model is a promising means to balance the control effectiveness and computational efficiency. 1 based on: Xu. M., van Overloop. P.J. and van de Giesen. N.C. On the Study of Control Effectiveness and Computation Efficiency of Reduced Saint-Venant Model in 35 36 3.1 Chapter 3. Control effectiveness Vs computational efficiency in MPC Introduction More and more attention is being paid to increase the efficiency of water delivery and usage and decrease spilling of water. From an operational water management point of view, proper real-time control techniques can help achieve this goal. Most of the research and applications of diverse control techniques on open channel flow were originally designed for irrigation systems, for example [61], [26] and [14]. Model predictive control (MPC) is one of the most advanced control techniques, as it can deal with setting an optimal trade-off between water level deviations from the target level and flow changes while taking their physical limitations (constraints) into account. The drawback of this methodology is the heavy computational demand. With the improvements of both hardware and software, the application of MPC became practically possible. Advances in hardware, in terms of computer capacities, are outside the scope of this research. Software improvements can be achieved through faster optimization algorithms or through the reduction of model complexity. Model reduction is the focus of this research. MPC requires a prediction model to estimate the dynamic system behavior over a prediction horizon. Different prediction models have different model accuracy and complexity. In general, it can be stated that the larger the model complexity, the higher the model accuracy. However, the model accuracy and complexity influence the control effectiveness in terms of control goal achievement in the closed-loop implementation, and computational efficiency regarding the computational time in delivering an accurate solution of the constraint optimization problem in MPC. The trade-off between model accuracy and complexity is the central consideration of this research. The Integrator Delay (ID) model [11] is a commonly used prediction model for MPC in water management. The model is usually linearized around the average flow condition and only has a small number of states depending on the number of controlled water levels and delay steps. However, due to the linearization, it is limited to small flow changes. In contrast with the ID model, the Saint-Venant (SV) equations accurately calculate the system dynamics over the full range of flow conditions, but this mathematical model includes many states. It is extremely computationally costly when used in MPC. Therefore, we propose a reduced Saint-Venant (RSV) model developed in [62]. The model captures the main dynamics of the SV model, but the number of states and disturbances is significantly reduced. Additionally, the Model Predictive Control of Open Channel Flow. Advances in Water Resources. Volume 34(2):282-290, 2010 3.2. Model predictive control of open channel flow 37 RSV model does not have the limitation of small flow change as long as the coherent flow structure is detected through snapshots of the full set of states in an off-line simulation. This chapter compares the RSV model and control performance with the SV model and ID model. It extends previous work by Xu and van Overloop [62] with more realistic flow conditions. In addition, the number of terms in the disturbance vector is reduced, which further reduces the computational time. The chapter is structured as follows: After briefly introducing MPC for open channel flow, three different MPC prediction models are discussed with focus on the RSV model. Then the different model and control performances are evaluated through a test case. Finally, based on the results, the conclusion that the RSV model is a promising means to balance the trade-off between control effectiveness and computational efficiency is drawn. 3.2 Model predictive control of open channel flow When controlling open channel flow, a common goal is to keep a specific water level at a target level by smoothly adjusting the controllable structures, for example weirs, gates and pumps. Additionally, the control actions for the structures need to remain within the physically possible capacities, such as maximum gate opening or maximum pump capacity. MPC solves this goal as an optimization problem, formulated as an objective function subject to certain constraints. The objective function should capture the future dynamic behavior which can be described by a prediction model (internal model). Physical disturbances, such as rain inflows or off-take flows to water users, can also be included in the model. Finally, an optimization technique is required to calculate the optimal control actions. The whole process runs with a finite prediction horizon, and only the first optimal control action is applied in each closed loop step (receding horizon). Figure 2.5 on page 24 shows the diagram of the MPC structure. 3.2.1 State-space model formulation with Kalman filter From a control point of view, it is convenient to structure the prediction model into a state-space formulation. The model could be either linear time 38 Chapter 3. Control effectiveness Vs computational efficiency in MPC invariant or linear time variant depending on whether the state matrix, control matrix, and disturbance matrix are fixed or change over time. A linear model can make the controller design easier. A linear time variant state-space formulation is shown in Equation 2.8 on page 24: In open channel flow control, the state vector x contains the states of water level deviation from the target level, the control input vector u is the change of control flow, and the disturbance vector d can include physical disturbances, e.g. rain inflow or lateral flow, and terms generated from discretization when constructing the state-space model. Since the states only contain water level deviations, when substituting flows at time step index k + 1 from the momentum equation into the continuity equation, all the flow related terms at time step index k of the discretization of the Saint-Venant equations, are constructed into the disturbance vector. Output y is the same as the state vector x in this case and the output matrix C is an identity matrix. Note that a non-linear system can be approximated by a linear time variant model. As a prediction model of MPC, the Saint-Venant model or reduced SV model in this case are linearized at specific flow conditions of each time step over the prediction horizon. The values of matrices A, Bu and Bd over the prediction horizon can be estimated by running the prediction model with the optimal control actions of the previous time step. This is referred to as “Forward Estimation” in [8]. The “Forward Estimation” is a pure Saint-Venant model simulation and there is no control involved. The state-space model in equation 2.8 on page 24 assumes that the complete system states xk are known. In practice, it is not possible to measure all states. For example, water levels in an irrigation system are measured typically only at the most upstream and downstream end of each canal reach, which represent the first and last values in the state vector xk , while the intermediate water levels are unmeasured. The test case in this chapter has the same set of measurements. Therefore, a proper estimation of unmeasured states is needed based on a limited number of measured values. The Kalman filter [63] is a commonly used estimator. It assumes a certain initial model error ε and independent white noise with a normal distribution on both measurements p(wmeas ) ∼ N (0, σ12 ) and the model p(wmodel ) ∼ N (0, σ22 ). Because the model states are correlated, when updating the measured model states with the measurements, the unmeasured states can be updated as well [63]. The estimator equation is given as follows, driven by the error between meak sured output ym and corresponding model state xk . The model state xk is replaced by the updated estimation x̂k : 3.2. Model predictive control of open channel flow x̂k = xk + LK [ym (k) − Hm xk ] 39 (3.1) where Hm is the measurement matrix, LK is the optimal Kalman gain, which represents the relative importance of measurements against model calculation. Its calculation is based on the measurement noise covariance RN which T ), measurement matrix Hm , and a priori model error equals E(wmeas wmeas − covariance Pk . Here E means expectation. Before measurements are available, the model runs to calculate the a priori Pk− , which equals APk−1 AT , where A is the state (system) matrix, Pk−1 is a posteriori model error covariance which is calculated from the previous step, T ). Before and QN is the model noise covariance which equals E(wmodel wmodel starting, P0 is calculated by assuming a constant model error ε in this case, which equals E(εεT ). After the measurements are available, LK is calculated T T as Pk− Hm (Hm Pk− Hm + RN )−1 , then the states are updated with equation 3.1 and Pk is also updated for the next calculation of the a priori model error covariance, which equals to (I − LK Hm )Pk− with I the identity matrix. 3.2.2 Optimization Problem According to the control goal, MPC formulates the objective function J to minimize the water level deviation from the target level and the change of structure flow along the prediction horizon n. A typical minimization of a quadratic function is the result shown in Equation 3.2, which can be solved with the “quadprog” function in MATLAB [64]: min J = min{ U U n n X X [(x̂k )T Wx x̂k ] + [(∆Qkc )T Wu ∆Qkc ]} k=0 subject to: (3.2) k=1 x̂k+1 = Ak x̂k + Buk uk + Bdk dk ∆Qc,min ≤ ∆Qkc ≤ ∆Qc,max where n is the number of prediction steps, Wx and Wu are the weighting factors on x̂ and ∆Qc , respectively. Note that ∆Qc is the change of control flow in open channel flow notation, which represents the control notation uk in equation 2.8 on page 24. Assuming the downstream water level of a canal reach is controlled, Wx only penalizes on this controlled water level deviation from the target level. Qc is the control flow, which is constricted between the minimum and maximum flow of Qc,min and Qc,max . 40 Chapter 3. Control effectiveness Vs computational efficiency in MPC When replacing the model 2.8 on page 24 with the estimated state x̂ into the objective function 3.2 and minimizing J with respect to the control action U (or ∆Qc ) over the prediction horizon, the problem becomes: ∂J 1 = HU + f min J = min( U T HU + f U + gc ) =⇒ U U 2 ∂U (3.3) where H is the Hessian matrix and f is the Jacobian matrix. These matrices are calculated as the input of the optimization algorithm: (Assume the number of controls, e.g. the number of control gates, is nu ) T H = 2(Bu,n Qx,n Bu,n + Ru,n ) dimension : (n · nu ) × (n · nu ) T f = 2((x̂k )T ATn + DnT Bd,n )Qx,n Bu,n dimension : 1 × (n · nu ) (3.4) Note that all the matrices except x̂k are over the prediction horizon labelled by the subscript 0 n0 . The calculation of these large matrices is presented in Appendix A, after deleting the subscript 0 r0 in the variable notation. Although the appendix is formulated for the reduced model, the procedure fits the general MPC internal model generation. In MPC, the total control process time contains the optimization time itself, the time to build up the input matrices of optimization (H and f ) and their related matrices (An , Bu,n , Bd,n ), the time to call prediction models which is determined by the model complexity and the rest of some process time related to the matrix size. The first two time consumption are discussed below. First of all, from the matrices dimension in equation 3.4, it is easily verified that matrices H and f in different models have the same dimensions, separately, as long as the number of control inputs nu and the number of time steps over the prediction horizon are the same. Thus, H and f related matrix operations in MPC will not influence the optimization time. The optimization time with different models will only be affected by the search space and the initial search point. The time to build up the large matrices over the prediction horizon (An , Bu,n , Bd,n , H and f ) may differ significantly with different models. Because building up these matrices contains a lot of matrix multiplication (see Appendix A, without subscript 0 r0 ) and the matrix size, mainly determined by 3.3. Process model formulation 41 the number of states and disturbances in this case, largely influences the matrix multiplication time, it is necessary to decrease the matrix size by means of model reduction, in order to reduce the computational time. 3.3 Process model formulation Open channel flow is commonly described by the Saint-Venant equations. They consist of the mass and momentum conservation equations, which are expressed in Equations 2.1 on page 21 and 2.2 on page 21. An example of an open canal is schematized in Figure 3.1 with major variables. Figure 3.1: Canal reach schematization 3.3.1 State-space model formulation with SV model The SV model is usually not used as the prediction model in MPC because of the costly computation to achieve an accurate prediction, but it is the basis of the RSV model. The SV model presented here is used to test the model and control performance with the RSV model. Following Stelling and Duinmeijer [17] and Xu et al. [8] the spatial discretization of the Saint-Venant equations uses the staggered grid scheme listed in equation 2.5 on page 22 and 2.6 on page 22, and the integration scheme in time is based on the θ method, e.g. η n+θ = θη n+1 + (1 − θ)η n in equation 2.6 on page 22. The scheme is regarded as fully implicit when θ equals 1 and fully explicit when θ is 0. The fully implicit scheme normally has large wave damping especially when large time steps are used. Accurate results can be achieved when taking θ as 0.55 [65]. The advection term in equation 2.6 on page 22 is calculated explicitly by first-order upwinding. Substituting equation 2.6 on page 22 into 2.5 on page 22 and writing them into the state-space format considering that the control input is the change of gate flow (∆Qc ), we obtain: 42 Chapter 3. Control effectiveness Vs computational efficiency in MPC ak1,1 ak1,2 0 0 0 k ak2,2 ak2,2 a2,3 0 0 ... ... ... 0 0 0 akl−1,l−2 akl−1,l−1 akl−1,l 0 akl,l 0 0 akl,l−1 0 0 0 0 0 0 .. . k+1 + ∆Qc + 0 1 1 0 .. . 0 0 0 0 ∆t k ∆x Wt,l 0 0 0 0 1 1 0 0 0 .. . . . . .. . . . . 0 0 0 0 1 0 0 0 0 0 1 êk+1 1 êk+1 2 .. . k+1 êl−1 k+1 êl Qk+1 c −bk1 bk1 − bk2 .. . k bl−2 − bkl−1 bkl−1 ∆t Qk+1 W k ∆x in êk1 êk2 .. . = I l+1,l+1 k êl−1 k êl Qkc t,l (3.5) where ê equals the water level from the Kalman estimator minus the target water level, Qin is the inflow of the reach, Qc is the outflow (structure flow) of the reach, ∆Qc is the change of outflow, ∆t is the control time, ∆x is the spatial increment, l is the number of spatial discretization point, Tw,i (k) is the top width at calculation points i at time step k, ai,j and bi are functions of variables that change over time and are estimated by the “Forward Estimation” [63]. By multiplying the inverse of the first matrix on both sides of Equation 3.5, it gives the linear time-varying state-space model format as Equation 2.8 on page 24. Note that the Kalman filter in Equation 3.1 is usually required to estimate the unmeasured values along the canal reach. 3.3.2 State-space model formulation with RSV model In order to cope with the computational burden in MPC with the SV model, a much simpler prediction model needs to be developed, containing less states and disturbances. Model reduction is an important tool to reduce model order, which can be formed as z = Φzr . z and zr are column vectors in original and reduced domain separately. The key process of generating the reduced vector is to calculate the basis function Φ. In linear algebra, this is formulated as an over-determination problem, which can be solved based on the least square error between the original and projected vectors. Proper orthogonal decomposition (POD) is a known model reduction technique, e.g. 3.3. Process model formulation 43 [37] [41] and [36]. A snapshot method is usually incorporated into POD to capture the coherent flow structure. In addition, POD calculates an orthogonal matrix Ψ of the basis function: ΨT Φ = I. Then the reduced vector becomes: zr = ΨT z. Sirovich [66] pointed out that the eigenvectors of the spatial correlation matrix (kernel matrix) are a linear combination of the snapshots and formulated the basis functions as: φi = M X αji zj (3.6) j=1 where φi is the ith eigenvector of the kernel matrix, zj is the j th snapshot, M is the number of snapshots, and αji is a coefficient. According to Sirovich [66], the coefficient αji is selected from the eigenvector of the correlation matrix CR, assuming that M independent snapshots z1 , z2 , . . . , zM are taken from an off-line simulation of a high-order model, the SV model in this case. Each snapshot is a column vector containing N states that are the water level deviations from a target level in the open channel flow model: CRi,j = 1 T (z zj ) M i (3.7) Finally, the number of the basis functions in use is selected based on the m largest eigenvalues of the correlation matrix CR, and the combinations of φi formulates the basis function matrix Φ with a dimension of N × m. The snapshots can be taken on both states and disturbances considering the state-space model formulation. Therefore, the full states x̂(k) from the Kalman estimator and the disturbances d(k) become a function of the reduced states x̂r (k) and reduced disturbances dr (k), respectively, with respect to the basis function matrix Φ1 (N × m1 ) and Φ2 (N × m2 ): x̂(k) = Φ1 x̂r (k) d(k) = Φ2 dr (k) (3.8) Substituting Equation 3.8 into state-space model 2.8 on page 24, it becomes: x̂r (k + 1) = Ar (k)x̂r (k) + Bu,r (k)u(k) + Bd,r (k)dr (k) ŷ(k) = Cr x̂r (k) (3.9) 44 Chapter 3. Control effectiveness Vs computational efficiency in MPC where Ar (k) = ΨT1 A(k)Φ1 , Bu,r (k) = ΨT1 Bu (k), Bd,r (k) = ΨT1 Bd (k)Φ2 , Cr = CΦ1 , Ψ1 is orthogonal with Φ1 (ΨT1 Φ1 = I), Ψ2 is orthogonal with Φ2 (ΨT2 Φ2 = I), and I is the identity matrix. Ar (k) has a dimension of m1 × m1 , Bu,r (k) is m1 × nu , and Bd,r (k) is m1 × m2 . If m1 N and m2 N , the model order is significantly reduced. Because of the connection between states and disturbances through the statespace model formulation, reducing the order of disturbance decreases not only the disturbance accuracy itself, but also the state accuracy. Therefore, we suggest reducing the number of disturbances to an acceptable tolerance while the number of disturbances is always higher than the number of states. The overall state-space model over the prediction horizon is described in Appendix A. The same “Forward Estimation” procedure described by Xu et al. [8] can be used to calculate the time varying matrices: Ar (k). . . Ar (k + n − 1), Bu,r (k). . . Bu,r (k + n − 1) and Bd,r (k). . . Bd,r (k + n − 1), based on the optimal solution of the previous step. For the application of the reduced model to MPC (see Figure 2.5 on page 24 for MPC procedure), the “internal model” calls the SV model first, then the basis functions are used to generate the RSV model over the prediction horizon by calculating time-varying matrices of Ar , Bu,r and Bd,r . Although this introduces an extra procedure of generating the reduced model, the MPC is expected to take much less process time due to the time reduction in matrix multiplication with the reduced model. Note that the Kalman filter in Equation 3.1 is usually required to estimate the unmeasured values along the canal reach. Because of model reduction, the objective function used by the RSV model predictive control is changed when substituting the reduced states function in Equation 3.8 into the objective function 3.2 n n X X k T k min J = min{ [(x̂r ) Wx,r x̂r ] + [(∆Qkc )T Wu ∆Qkc ]} ∆Qc ∆Qc k=0 subject to: (3.10) k=1 k k x̂k+1 = Akr x̂kr + Bu,r uk + Bd,r dk r k ∆Qc,min ≤ ∆Qc ≤ ∆Qc,max where Wx,r = ΦT Wx Φ. The Hessian and Jacobian matrices are calculated by substituting the reduced model in equation 3.9 into the objective function 3.10. 3.4. Test case 3.3.3 45 State-space model formulation with ID model In order to compare the control effectiveness and computational efficiency with the RSV model, the commonly used ID model is presented here as the ultimate simplification of open channel flow. The mathematical expression of the ID model is a mass balance combined with a water travelling delay: ek+1 = ek + ∆t k−kd [Qin − Qkc ] As (3.11) where e is the water level deviation from the target water level at the downstream end of the canal reach [m], ∆t is the control time [s], As is the storage area in the backwater part [m2 ], Qin is the upstream inflow [m3 /s], Qc is the downstream control flow of a structure [m3 /s], k is the time step [−], kd is the number of delay steps [−], which equals the delay time τ [s] divided by the control time ∆t and kd is always rounded up to be conservative. The ID model requires the determination of the two pool properties: delay time and storage area. They are pre-determined with a hydraulic model simulation through a standard procedure, which uses a small step flow change on the upstream side and a constant downstream flow, following [11] and [29]. A Kalman filter is not necessary for the ID model, since the downstream water level in the model is directly measured in practice. Due to the linearization, the ID model is inaccurate over the entire simulation period. Figure 3.2 shows water level profiles with different flow conditions. The two pool properties, especially the storage area in the backwater part, are significantly different under the three flow conditions. This is a disadvantage of the ID model. 3.4 Test case The test canal reach has a total length of 4, 000m with a downstream gate flow controlling the upstream water level of the gate to −3.2m (negative value means below mean sea level). The upstream flow trajectory shown in Figure 3.3 is considered as a known physical disturbance and used to test the MPC controller with three models. The maximum downstream gate flow is assumed to be 4m3 /s. Note that a virtual gate is used here, which only forces a certain discharge instead of gate opening. It works as a pump. No 46 Chapter 3. Control effectiveness Vs computational efficiency in MPC Figure 3.2: Longitudinal profile with different flow conditions lateral flow was considered. The canal geometric parameters are listed in Table 3.1. Length (m) 4000 Table 3.1: Canal geometric parameters Upstream Bed Bed Slope Bed Width Side Slope Chezy level (m) tan(β) (m) tan(α) (s1/2 /m) -1.42 1:1000 1 1:1.5 45 Each of the simulations continue for 20 hours with a time step of 2 seconds. The θ coefficient in time integration of the simulation model is set to 0.55, in order to avoid strong wave damping and keep the model accurate. But the θ is set to 1 for the SV and RSV model in MPC prediction model, in order to avoid model instability with large control time step of 240 seconds. Water level measurements are assumed only to be available at the upstream and downstream end of the reach. For the Kalman filter design, when using SV and RSV models, we assume that both the measurements and the model have normal distributed white noise and the model also has a certain initial error. In addition, the two measurements have the same white noise. The parameters are listed in Table 3.2. 1 -1.4 means the elevation is 1.4 meter below mean sea level. 3.4. Test case 47 Figure 3.3: Upstream Flow Condition for MPC Test Table 3.2: Parameters for Kalman filter design Measurement noise model noise Initial model error p(wmeas )(m)1 p(wmodel )(m)1 ε(m) 2 2 N (0, 0.001 ) N (0, 0.0005 ) 0.01 The three implementations of MPC have the same control setup, for example the same weighting factors, the same control time step ∆t of 240 seconds with a prediction horizon of 2 hours. This gives a prediction length n of 30 steps. The weighting factors on water level deviation from the target level (Wx ) and change of gate flow (Wu ) are selected according to the MAVE factor that represents the Maximum Allowed Value Estimate [29]. The maximum allowed water level deviation from the target level (assumed 10cm) and the maximum gate flow (4m3 /s) are used as the reasonable initial guess of MAVE factors. Because the states and control input are in units of m and m3 /s, by taking the reciprocal of the squared MAEV factors, the objective function can be normalized. It is allowed to make some additional tuning on the penalties through trial-and-error. The tuned weighting factors are listed in Table 3.3. 12 The unit of m on noise is for mean and standard deviation, and the noise variances have a unit of m2 48 Chapter 3. Control effectiveness Vs computational efficiency in MPC Table 3.3: Weighting factors Wx Wu Weighting factor 400 4 3.4.1 SV model setup The SV model is spatially discretized into 500 calculation points with a space step ∆x equal to 8 meters. With the 30 prediction steps, the controller gives 15,531 (501 × 31) present and future states in total. In order to use the change of flow for the control input, an extra state Qc is added to the state, (see Equation 3.5). The optimization problem was unsolvable on a 32-bit computer due to the memory limit. It was tractable on a 64-bit computer with an 8 Gb internal memory. From another perspective, this shows the heavy calculation burden of large matrix multiplication and the importance of model reduction. 3.4.2 RSV model setup In order to generate the RSV model, the SV model was simulated with the upstream flow trajectory Qin according to Figure 3.4, and the downstream water level was kept to the target water level through feedback control of the downstream gate. During the simulation, 100 independent snapshots were taken on both states and disturbances. The state basis function was formulated by the 10 eigenvectors corresponding to the 10 dominant eigenvalues of the state correlation matrix, and the disturbance basis function used 30 corresponding eigenvectors of the disturbance correlation matrix. The number of eigenvectors in use was found by trial-and-error in this research. 3.4.3 ID model The model is linearized around the average flow condition of 3.04m3 /s. With a ±0.1m3 /s step change in upstream flow, the test system is estimated with 8 delay steps (kd ) with 240 seconds control time and 7,600m2 storage area (As ), through the downstream water level response, according to the description in section 3.3.3. 3.4. Test case 49 Figure 3.4: Upstream Flow Condition for Reduced Model 3.4.4 MPC performance indicators After the test of three implementations of MPC, the control performance needs to be analyzed. According to Clemmens et al. [67], several performance indicators can be used to examine the water level error and gate discharge, which represent the overall MPC behavior. Maximum Absolute Error (MAE) is one of the water level indicators, which concerns the percentage of maximum absolute water level deviation from the target level against the target level. The calculation is as follows: M AE = max(yt − ytarget ) ytarget (3.12) where: yt is controlled water level at time t, ytarget is the target water level. Integrated Absolute Discharge Change (IAQ) is an indicator of the change of gate discharge which reflects the tear and wear of the gate along the whole simulation. IAQ is calculated as follows: 50 Chapter 3. Control effectiveness Vs computational efficiency in MPC IAQ = t2 X (|Qc,t − Qc,t−1 |) − |Qc,t1 − Qc,t2 | (3.13) t=t1 where: Qc,t is gate discharge at time step t, t1 and t2 are the initial and final time step respectively. 3.5 Results This part is intended to demonstrate the results of model accuracy and complexity, control effectiveness, and computational efficiency. It shows the advantages of using the RSV model in MPC compared to the other two models. It is assumed that the SV model is the most accurate one in describing the open channel flow and the MPC is the most effective with the SV model under the same control parameter setup. It is noticed that there is always a trade-off between the MPC control effectiveness and computational efficiency. 3.5.1 Results of RSV model accuracy and model complexity As model complexity increases, the model accuracy is expected to increase. This principle is reflected in Figure 3.5 which shows the influence of both state and disturbance reduction on model accuracy. The figure is produced by the flow condition in Figure 3.4. Figure 3.5 is a semi-logarithmic plot with the model accuracy on the y-axis, calculated by the sum of least square water level errors along the canal reach between the projected high-order model and the SV model over the 20-hour simulation period. Here the projected high-order model means an SV model converted back from the RSV model. The model complexity is represented by the number of states and disturbances. Figure 3.5 can be used as a selection reference of the number of eigenvectors (number of states or disturbances) in use. In each disturbance scenario of Figure 3.5, the model accuracy has an exponential change first with respect to the number of states and stays flat under a certain number-of-disturbance threshold. This implies that the number of states in selection should be on 3.5. Results 51 Figure 3.5: Model accuracy Vs model complexity the skewed line. When the number of states remains unchanged, reducing the order of disturbance decreases the model accuracy. The result of the RSV model (after projecting onto the high-order model) is presented in Figure 3.6. It shows the water level difference along the canal reach between the RSV model and the SV model. The accuracy of the RSV model is outstanding, with an insignificant water level difference of less than ±3mm from the SV model. 3.5.2 Results of control effectiveness and computational efficiency in MPC Control effectiveness Because of the change of objective function in the RSV model predictive control, it is unfair to compare the control effectiveness with different models through the objective function values. Instead, it is more interesting to compare the closed-loop optimization results, since it reflects how effective the controller acts exactly on the water system. The MPC results with different models are shown in Figures 3.7 and 3.8 for the controlled downstream gate flow (Qc ) and the controlled water level. 52 Chapter 3. Control effectiveness Vs computational efficiency in MPC Figure 3.6: Model level difference between SV and RSV model In Figure 3.7, the upstream flow (Qin ) is also presented, which works as a known physical disturbance on the canal reach. Figure 3.7 clearly shows the downstream gate flow constraint of 4m3 /s and demonstrates the advantage of MPC in prediction. Because of the flow limit, the gate flow increases in advance to decrease the water level to create extra storage. For example, the fast water level drop at about 800 minutes simulation time (the 2.4×104 point on the x-axis) in Figure 3.8 is due to the prediction of the peak flow (dashed green line) in Figure 3.7. This is a common feature of MPC regardless of the prediction model type. According to Figure 3.8, the overall MPC performance with the three models is good. The water level is controlled around the target level with a maximum deviation of 4cm. But the controlled water level with the RSV model follows the SV model track better and is more accurate than the ID model. Figure 3.8 obviously shows that the controlled water level in the ID model (dotted black line) shifts towards the right, which means the overall delay steps in the ID model are overestimated. In addition to the fixed storage area, the water level fluctuates more in the ID model than in the other two models. The performance indicators of Maximum Absolute Error (MAE) and Integrated Absolute Discharge Change (IAQ) with three different models are 3.5. Results 53 Figure 3.7: Gate flow with different prediction models Figure 3.8: Water level with different prediction models 54 Chapter 3. Control effectiveness Vs computational efficiency in MPC presented in Table 3.4. This table demonstrates the overall performance of MPC with three different models. The results are equivalent to the expectation that the SV model is the most accurate, the RSV model follows the SV model track well and they both outperform the ID model significantly. SV RSV ID Table 3.4: Overall performance of MPC Maximum Absolute Value Integrated Absolute Discharge Change (MAE3 ) (%) (IAQ) (m3 /s) -0.60 13.55 -0.63 13.53 -1.23 16.33 Computational efficiency The computational efficiency in MPC is reflected by the computational time. Figure 3.9 shows the time spent in the control process with different prediction models. The control process time of using the SV model and RSV model includes the “Forward Estimation” and Kalman filter as well. The figure shows that the computational speed of the RSV model is more than 8 times faster than that of the SV model. The control process time of using the ID model is extremely low in Figure 3.9. The most important reason is that the ID model is much simpler than the other two and has much less states and disturbances. Besides, the controller only calls the ID model once per control step, while the other two models are called n times per control step (n is the number prediction steps) within the controller and the “Forward Estimation”, and 120 times per control step (simulation steps between two control steps) in the Kalman filter. Most of the control process time of using the SV model is spent on the state matrix, control matrix, and disturbance matrix related matrix multiplication over the prediction horizon. Figure 3.10 shows an example of the influence of the matrix size on the control process time. It points out that building up the state matrix, control matrix and disturbance matrix over the prediction horizon in MPC takes 77.3% of the total control process time with the SV model in this case, while it only takes 0.3% with the RSV model due to the reduced matrix size. Most of the time taken (97.7%) with the RSV model is shifted to call the prediction model within the controller, the “Forward Estimation”, and the Kalman filter. The rest of the process time is also 1 MAE is negative because the target level is negative 3.6. Conclusions 55 Figure 3.9: Computational efficiency with different models reduced significantly, since many calculations are related to these large matrix multiplications. As discussed in Section 3.2.2, the optimization time is only affected by the search space and the initial search point. Figure 3.10 shows that the difference in optimization time consumption with three models is insignificant. In addition, the optimization time is relatively short because the control problem is very simple in this case. 3.6 Conclusions This chapter explored the application of a model reduction technique on model predictive control. The idea and procedure of proper orthogonal decomposition, implemented with the snapshots method, were illustrated as an effective way of generating a reduced model. The reduced model RSV is very accurate in describing the flow dynamics. It keeps the model structure of the SV model, overcomes the limitations of the ID model, and functions properly over the entire flow range. The generated RSV model is also efficient for large scale problems, in terms of the number of states and disturbances. Both implementations of MPC with the SV model and RSV model need a Kalman filter to estimate the unmeasured states. Thus extra computational 56 Chapter 3. Control effectiveness Vs computational efficiency in MPC Figure 3.10: Computational time in each part of total control process with different models time is added to the system, but it is rather limited. Compared with the MPC using the SV model, the RSV model significantly reduces the computational time by reducing the matrix size. Although this computational time is higher than the ID model, it is very acceptable. Therefore, it can be concluded that the reduced model is capable of balancing the control effectiveness and computational efficiency in MPC, and the POD model reduction technique is applicable to the MPC prediction model. In addition, the flow condition used for MPC in Figure 3.3 has different ranges and change frequencies from Figure 3.4 for generating the RSV model. This shows that the RSV model can deal with extrapolated flow conditions, once the coherent flow structures are determined. While the approach is very effective, MPC with the RSV model could still be improved by speeding up the SV model calculation. This will dramatically decrease the MPC calculation time, since 97.7% of the control process time is spent on calling the prediction model, although the absolute time consumption is small. This may be done by optimizing the computer code or changing to a lower level (faster) programming language. Chapter 4 Reduced models in model predictive control controlling water quantity & quality Abstract This chapter1 studies the application of complex models in MPC to control both water quantity and quality. However, because of the online optimization of MPC, the computational time becomes an issue. In order to reduce the computational time, a model reduction technique, Proper Orthogonal Decomposition (POD), is applied to reduce the model order. The method is tested on a Polder flushing case. The results show that POD can significantly reduce the model order for both water quantity and quality with high accuracy. The MPC using the reduced model performs well in controlling combined water quantity and quality in open water channels. 4.1 Introduction Over the last decades, many control techniques and operation rules have been developed to manage water systems for both water quantity and quality. Most of the research concerns river and reservoir operation. For ex1 based on: Xu. M., van Overloop. P.J. and van de Giesen. N.C. Model reduction on model predictive control of combined water quantity and quality. Environmental Modelling & Software. 2012. (Accepted) 57 58 Chapter 4. Reduced models in MPC controlling water quantity & quality ample, Kerachian and Karamouz [68], Dhar and Datta [69], Shirangi et al. [70] and Chaves and Kojiri [71] used a Genetic Algorithm (GA) together with water quality simulation models either physically-based or data-driven Neural Network (NN) model, to manage the water quality in river-reservoirs; Mujumdar and Saxena [72] and Chaves et al. [73] applied Stochastic Dynamic Programming (SDP) to regulate both water quantity and quality in rivers and reservoirs under uncertainty. These control techniques are normally based on mid-term or long-term operation (daily to monthly). One of the intrinsic reasons is that water quality processes are generally characterized by longer time scales compared to water quantity, therefore, it is often difficult to account for water quality when designing a short-term (real-time) controller. Over the last decades, also many real-time control methods have been developed for short-term water system operation (minutes to hourly) over the last decades. However, most of the research in this field concern operation of irrigation and drainage canals and rivers, for example [13], [74], [26], [14] and [75]. In these applications, only water quantity is maintained by controlling water levels. In general, water quality is managed through manual operation, for example Dutch polder canals are usually manually operated every couple of days, depending on the system under investigation, in order to flush out the pollution. One of the reasons that combined water quantity and quality management in real-time has not taken off in the past is related to the unavailability of real-time water quality measurements. Real-time control requires continuous measurement within each control step. The traditional laboratory measurement of water quality is not feasible and affordable in real-time application. However, real-time water quality control will receive more attention with the development of real-time water quality measurement [49]. Recently, different real-time control methods have been applied to water quality management in canal systems. For example, Litrico et al. [76] used an adaptive control method to control canal discharge by adjusting hydraulic structures to restrict algae development. Augustijn et al. [77] applied dynamic control to prevent salt intrusion in a lake that was modeled as open channel flow. Xu et al. [8] applied a model predictive control technique to generate an optimal flushing strategy and maintain both water quantity and quality in a polder system. Real-time control is starting to play an important role in operational water management of open water channels. Among different real-time control methods such as Proportional Integral (PI) control, Linear Quadratic Reg- 4.1. Introduction 59 ulator (LQR), Model Predictive Control (MPC) has important advantages in controlling water systems. It uses an internal model to predict the future system behavior over a finite prediction horizon, and generates optimal control actions through optimizing an objective function at every control step. Constraints can also be taken into account in the optimization [51]. MPC is completed by a predictive model that provides a prediction of the system’s disturbances. Because of the prediction, MPC can take anticipatory actions before undesired changes happen. Our research focuses on the application of MPC controlling both water quantity and quality in open channels. According to the authors knowledge, Xu et al. [8] were first to use MPC to control combined water quantity and quality. They applied simple reservoir models in MPC to maintain water levels and average solute concentrations in a drainage canal. That research showed the possibility of controlling combined water quantity and quality with MPC. However, that research had two drawbacks. First, the internal model for water quality was a reservoir model that assumed complete mixing. Therefore, only the average concentration in the canal reaches could be considered. Second, the research scenario was very simple with water quality change at only one lateral while all the lateral discharges remained unchanged. These two issues of [8] were the main trigger for this research. For water quality control in a canal system, more complex and physics-based models are required to capture the main dynamics. Subsequently, the control targets can be located at the places where water quality needs to be controlled. In addition, it is of importance to analyze the control behavior under more realistic scenarios, for example, with both water quantity and quality changes in all laterals. MPC solves control problems online, which means that it generates optimal solutions over a finite prediction horizon of which only the first one is implemented in closed loop. Optimization in MPC requires major computational resources. This requirement restricts the real-time implementation of MPC using models that are accurate but complex. Xu et al. [78] applied a model reduction technique, Proper Orthogonal Decomposition (POD), for the Saint-Venant equations to reduce model order. POD was used to balance control effectiveness with computation time. The research by Xu et al. [78] was conducted for water quantity control on a single canal reach without lateral flows. The method looks promising for controlling combined water quantity and quality using complex models with more realistic scenarios in MPC. The control process includes two steps that are illustrated in Figure 4.1. Model reduction, often referred to as model emulation, is a well-established 60 Chapter 4. Reduced models in MPC controlling water quantity & quality Figure 4.1: Work flow of MPC controlling a water system using model reduction technique research field. Model emulation is an efficient way of describing the essential natural processes in a system as compact as possible by an emulator with the least possible computational burden. Because of this characteristic it is especially useful for application in optimization routines [79] [80]. Emulation modeling can be categorized for both static and dynamic models. Ratto et al. [79] gave intensive literature review on both types. Castelletti et al. [81] provided a general framework on both data-based and model-based dynamic emulation modeling, and summarized 6 steps for the emulation procedure. Model emulation is also widely used for sensitivity analysis which evaluates robustness of complex models, such as [82] [83]. In this Chapter, POD model reduction is implemented to generate a reduced model of the combined Saint-Venant equations and general transport equation, based on snapshots of water quantity and quality states taken from an offline simulation. As such, it is categorized as a model-based dynamic emulation modeling technique. The reduced model can be verified through other scenarios. The reduced model is then used as the internal model in MPC. The main innovation of this research is to implement complex water quantity 4.2. Model reduction on combined open water quantity and quality model 61 and quality models in MPC using a model reduction technique. MPC algorithms can not be directly implemented without a robustness study. However, there has been intensive research on the robustness of linear and nonlinear MPC algorithms. For example, Pannocchia et al. [84] developed a Partial Enumeration MPC, a suboptimal controller, controlling a nonlinear system, and proved the stability of the MPC algorithm. Marruedo et al. [85] Pannocchia et al. [86] Pannocchia et al. [87] Pannocchia et al. [88] proved the stability and robustness of nonlinear MPC algorithms applying suboptimal solutions to the system under certain assumptions. Given this previous research, it is assumed that applying the MPC algorithm controlling combined water quantity and quality is permitted, although the robustness and stability analysis is not the focus of this research. The chapter is organized as follows. Section 4.2 introduces a combined water quantity and quality model and its discretization, and describes the method of using POD to generate a reduced model. In Section 4.3, MPC is introduced to control a water system. It focuses on the formulation of control objectives on combined water quantity and quality, and the state-space model formulation with the reduced model. In Section 4.4, a polder flushing case is demonstrated. Section 4.5 presents the reduced model results and the MPC performance using the reduced model. Section 4.6 discusses the main issues in controlling combined water quantity and quality. The conclusions are drawn in Section 4.7. 4.2 Model reduction on combined open water quantity and quality model In this section, we describe the combined open water quantity and quality model and the use of Proper Orthogonal Decomposition to reduce the model. The reduced model will be implemented in Model Predictive Control to reduce computation time. 4.2.1 Combined open water quantity and quality model The open water quantity and quality model can be described by the SaintVenant equations and the general transport equation [89] [58] as in equations 2.1 on page 21, 2.2 on page 21 and 2.3 on page 21: 62 Chapter 4. Reduced models in MPC controlling water quantity & quality The discretization of equations 2.1 on page 21, 2.2 on page 21 and 2.3 on page 21 are extensively described in [8] and the discretized version can be structured as a linear time-varying state-space model which is commonly used in model-based control techniques, such as [90] [91]. Appendix A provides a detailed description of the discretization and the state-space model formulation. From a control perspective, the general format of the linear time-varying state-space model can be seen in 2.8 on page 24: Using the state-space model formulation, the combined water quantity and quality equations for a canal reach with upstream and downstream hydraulic structures can be written as: ā1,1 ā1,2 0 0 ā2,2 ā2,2 ā2,3 0 ... ... 0 0 0 āl,l−1 āl,l 0 −− −− −− −− 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ekη,i,1 ek η,i,2 . .. ekη,i,l + = I2l,2l − − −− ekc,i,1 ek c,i,2 .. . k e c,i,l | | 0 0 0 0 | 0 0 | 0 0 + −− −− | b̄1,1 b̄1,2 | b̄2,1 b̄2,2 ... | 0 | 0 0 c̄1,1 0 0 0 .. .. . . 0 0 0 c̄l,1 −− −− d¯1,1 0 0 0 .. .. . . 0 0 0 d¯l,1 0 0 0 0 −− 0 b̄2,3 ... b̄l,l−1 ek+1 0 η,i,1 k+1 e 0 η,i,2 .. . 0 k+1 eη,i,l 0 −− − − −−− k+1 0 ec,i,1 0 ek+1 c,i,2 .. 0 . k+1 b̄l,l ec,i,l Qk+1 c,1 Qk+1 c,2 + I2l,2l dkη,i,1 dkη,i,2 .. . k dη,i,l −−− dkc,i,1 dkc,i,2 .. . dkc,i,l (4.1) where i represents the ith canal reach, l is the total number of discrete points of each reach. For example, ekη,i,l and ekc,i,l are the water level and concentration deviations from their targets at lth discrete point of ith reach at time step k. Qkc,1 and Qkc,1 are the upstream and downstream flows, controlled by the structures, at the reach at time step k. ā, b̄, c̄ and d¯ are the time-varying 4.2. Model reduction on combined open water quantity and quality model 63 coefficients, dη and dc are the water quantity and quality disturbances, respectively. Comparing the notations in equation 4.1 with the general state-space model notation, it is noticed that: xki = [ekη,i,1 , · · · , ekη,i,l , ekc,i,1 , · · · , ekc,i,l ]T and dki = [dkη,i,1 , · · · , dkη,i,l , dkc,i,1 , · · · , dkc,i,l ]T , however, the control input is the conk+1 T trol flow, and we use uQ for differentiation. Thus, ukQ,i = [Qk+1 c,1 , Qc,2 ] . Equation 4.1 is used to generate the reduced model and the complete model constraints will be formulated in Section 4.3.2 where the control input vector uses the change of control flow. ¯ are known a-priori. They are The time-varying coefficients (ā, b̄, c̄ and d) velocity, water level or concentration related, which change at every time step. The calculation of the time-varying coefficients is referred to “Forward Estimation”, which executes the Saint-Venant and transport model over the prediction. The “Forward Estimation” uses the optimal control information over the prediction horizon from the previous control step. This can also be considered as model approximation. The disturbances (dη and dc ) include physical and virtual disturbances, the latter being necessary to numerically formulate the control problem. Physical disturbances can be uncontrolled lateral discharges and pollution concentrations in this test case. Virtual disturbances are the terms emerging from the discretization of the Saint-Venant equations and the transport equation. All calculations of the coefficients and variables are formulated in Appendix A. Multiplying the inverse of the first matrix on both sides of Equation 4.1 results in a linear time-varying state-space model. Note that considering a linear time-varying (non-linear) model as a linear model has significant advantages in optimization problems, due to convexity when combined with a quadratic objective function. 4.2.2 Model reduction on combined water quantity and quality model Model reduction reduces model order or dimension to decrease computational requirements while maintaining sufficient model accuracy and relevant system dynamics. The idea of model reduction can be tracked back to [92]. Since then, model reduction has been largely adopted in various fields, such as signal analysis, image processing, control engineering, etc [33]. Recently, some contributions have appeared in the field of water management, e.g. [34] and [35] for groundwater modeling, [36] for tsunami forecasting and [37] for fluid control. 64 Chapter 4. Reduced models in MPC controlling water quantity & quality Model reduction can be either data driven, building a model by fitting the data through a machine learning process, or model driven, using a mathematical model, to calculate the reduced model [34]. Recently, Castelletti et al. [93] [94] applied data-driven dynamic emulation modeling for the optimal management of environmental systems. Proper Orthogonal Decomposition (POD) is one of the most popular and widely applied model driven reduction techniques to reduce the model order by calculating basis functions. POD can be applied not only to linear models, but also to nonlinear models, e.g. [38], [39]. The calculation of the basis functions is the key process of POD. Liang et al. [40] provides an extensive explanation of three POD methods: Karhunen-Loeve Decomposition (KLD), Singular Value Decomposition (SVD), and Principal Component Analysis (PCA), and proves the equivalence of these three methods. This chapter applies POD with a snapshot method to generate the reduced state-space model for both water quantity and quality. The snapshot approach has already been applied by several researchers, such as [37], [41] and [36]. The approach takes snapshots of an off-line simulation model and forms a two-point spatial correlation (kernel) matrix. Each snapshot is a column vector containing states, which are the water level and concentrations deviations from their targets, in a combined water quantity and quality model. Siade et al. [34] provides a method to select the optimal snapshot set for a groundwater model. In our research, we try to take as many snapshots as possible from the off-line simulation, in order to cover a wide flow range. For example the range between 1 per 1000 year drought flow and 1 per 1000 year flooding flow. Then the normal scenarios falling in this range can rely on the reduced model generated by such a scenario. The time step of the off-line simulation uses the control time step which is relatively large, in the range of 2 minutes to 1 hour for real-time operation. The full model is executed only once for generating the reduced model. Taking more snapshots will not significantly increase the computation time. Sirovich [66] pointed out that the basis functions are formed by taking the most dominant eigenvectors of the kernel matrix, which are a linear combination of the snapshots: φi = M X αji zj (4.2) j=1 where φi is the ith eigenvector of the kernel matrix, zj is the j th snapshot, M is the number of snapshots, and αji is a coefficient, which is selected from 4.3. Model predictive control of combined water quantity and quality 65 the eigenvector of the correlation matrix CR (M × M dimension) [66]: CRi,j = 1 T (z zj ) M i (4.3) Finally, the number of the basis functions in use is selected based on the m dominant eigenvalues of the correlation matrix CR, and the combinations of φi forms the basis function matrix Φ with a dimension of N × m. Xu et al. [78] analyzes the relationship between the reduced model accuracy and the number of reduced states which were selected through trial-and-error. Furthermore, snapshots can be taken of disturbances as well, when considering the disturbances as a vector. The same procedure as for the state reduction can be used. Therefore, the original states xk and disturbances dk become a function of the reduced states xkr and reduced disturbances dkr , respectively, with respect to the basis function matrix Φ1 (N × m1 ) and Φ2 (N × m2 ): xk = Φ1 xkr dk = Φ2 dkr (4.4) The basis functions are formulated in such a way that the original vector and the projected vector have the least square error [36]. When equation 4.4 is substituted into the state-space model 2.8 on page 24, we obtain: k k xk+1 = Akr xkr + Bu,r uk + Bd,r dkr r (4.5) k k where Akr = ΨT1 Ak Φ1 , Bu,r = ΨT1 Buk , Bd,r = ΨT1 Bdk Φ2 , Ψ1 is orthogonal with Φ1 (ΨT1 Φ1 = I), Ψ2 is orthogonal with Φ2 (ΨT2 Φ2 = I), and I is the identity k k matrix. Akr has a dimension of m1 × m1 , Bu,r is m1 × nu , and Bd,r is m1 × m2 . If m1 N and m2 N , the model order is significantly reduced. 4.3 4.3.1 Model predictive control of combined water quantity and quality Optimization problem formulation In the combined water quantity and quality control of open channel problems, the most general goal is to keep both the water level and the concentration 66 Chapter 4. Reduced models in MPC controlling water quantity & quality at the end of a canal to reach at their target values, with as few control flow changes as possible. A quadratic objective function is normally formulated in MPC in order to deal with both positive and negative deviations of the variables [29]. An advantage of using a quadratic optimization formulation with a linear model is the guarantee of a convex optimization problem and, thus, a definite global optimum [31]. Besides these common goals, extra limitations are added to the objective. First, when the water is clean, water quality control should be turned off; Second, when the water level lies outside the maximum and minimum allowed water level limits, water quantity control dominates and the only objective then becomes bringing the water level back to the water level limit. These two additional goals are achieved by adding soft constraints to the objective function [29]. We first provide the minimization of the objective function in equation 4.6 and then describe the soft constraints in detail later on. J =P ns s=1 min P n−1 j=0 ∆Qk+1 c,s nr X n−1 X k+j+1 T { [(ek+j+1 η,i,l ) Weη,i eη,i,l i=1 j=0 (k+j+1)∗ T + (ek+j+1 − eη,i η,i,l (k+j+1)∗ ) Weη,i,l −e∗η,i (ek+j+1 − eη,i η,i,l (k+j+1)∗ T + (ek+j+1 − ec,i c,i,l + ) (k+j+1)∗ (k+j+1)∗ T ) We∗η,i eη,i (eη,i (k+j+1)∗ T + (ec,i + (k+j+1)∗ ) Wec,i (ek+j+1 − ec,i c,i,l ) nr X n−1 X (k+j+1)∗ ) We∗c,i ec,i ] T k+j [(∆Qk+j c,s ) W∆Qc,s ∆Qc,s ]} i=1 j=0 (4.6) k+j+1 k+j x = Ak+j xk+j + Buk+j uQ + Bdk+j dk+j eη,i,min ≤ e(k+j+1)∗ ≤ eη,i,max j = 0, · · · , n − 1 subject to: i = 1, · · · , nr e(k+j+1)∗ ≤ 0 k+j Qc,s,min ≤ Qc,s ≤ Qc,s,min s = 1, · · · , ns where nr is the number of canal reaches, ns is the number of controlled structures, n is the prediction horizon, eη,i,l is the water level deviation from the target value at the last discretization point of the ith reach, with Weη,i as its weighting factor, e∗η,i and e∗c,i are the virtual inputs for water level and concentration at the reach necessary for the soft constraints, with We∗η,i and 4.3. Model predictive control of combined water quantity and quality 67 We∗c,i as their weighting factors, respectively, eη,i,l − e∗η,i and ec,i,l − e∗c,i are the virtual states introduced as soft constraints, with Weη,i,l −e∗η,i and Wec,i as their weighting factors, ∆Qc,s is the change of control flow at sth structure having a weighting factor of W∆Qc,s . eη,i,min and eη,i,max are the minimum and maximum allowed water level deviations of the ith reach, respectively, Qc,s,min and Qc,s,min are the sth minimum and maximum allowed control flows. In the model equality constraints over the prediction horizon, xk = [xk1 , · · · , xknr ], k+1 k k k ukQ = [Qk+1 c,1 , · · · , Qc,ns ] and d = [d1 , · · · , dnr ]. Here the disturbance vector d is supposed to be known or can be calculated from a prediction model. The first limitation on water quality control is solved by introducing the virtual variable e∗c,i over the prediction horizon. When the value of the water quality parameter in a canal reach is higher than the target value, namely ec,i,l > 0, the virtual variable should be set to zero to keep the water quality control goal in the objective function. When ec,i,l ≤ 0, the water quality control goal should be switched off, which is realized by setting e∗c,i = ec,i,l . Therefore, the virtual variable changes within the prediction horizon according to the water quality condition and the inequality constraint e∗c,i ≤ 0. The change of the virtual variable e∗c,i is implemented by adding an extra term (k+j+1)∗ (k+j+1)∗ T to the objective function and setting its weighting ) We∗c,i ec,i (ec,i factor We∗c,i to a value that is near zero, 1.0 × 10−20 in this case. In such a way, e∗c,i can be given any value in the optimization. This does not affect the value of the added term itself but does influence the water quality control of ec,i,l − e∗c,i . The second limitation of the upper and lower water level bounds is solved in the same way as the water quality control by adding an extra term (ek+j+1 − η,i,l (k+j+1)∗ (k+j+1)∗ k+j+1 )T Weη,i,l −e∗η,i (eη,i,l ) to the objective function. The only eη,i − eη,i k+j+1 T difference is that the term (eη,i,l ) Weη,i ek+j+1 for water quantity control η,i,l always remains active over the control horizon. The virtual variable e∗η,i is constrained between the bounds. The weighting factor on the virtual variable e∗η,i is also set to 1.0 × 10−20 in order to allow the change of the virtual variable. However, the weighting factor Weη,i,l −e∗η,i on the virtual state (k+j+1)∗ ek+j+1 − eη,i is set to a large value, 1.0 × 1010 in this case, to avoid the η,i,l water level exceeding the maximum and minimum allowed limits. When the water level stays within the bounds, the virtual state is always zero and does not influence the control goal. When the water level exceeds the bounds, the virtual state dominates the other control goals because of the large weighting factor, bringing the water levels back within the bounds. 68 Chapter 4. Reduced models in MPC controlling water quantity & quality 4.3.2 Optimization problem formulation using reduced model Because the model used in MPC is the reduced model, the variables in the original objective should be adapted to the reduced states. Therefore, the objective function is changed by substituting the reduced function of Equation 4.4 into the objective function: J = Pn s s=1 min P n−1 k+1 j=0 ∆Qc,s { nr X n−1 X k+j+1 T T [(ek+j+1 η,r,i,l ) (Φ1 Weη,i Φ1 )eη,r,i,l i=1 j=0 (k+j+1)∗ T + (ek+j+1 − eη,i η,i,l (k+j+1)∗ ) Weη,i,l −e∗η,i (ek+j+1 − eη,i η,i,l (k+j+1)∗ (k+j+1)∗ T + (ek+j+1 − ec,i c,i,l (k+j+1)∗ T + (eη,i + nr X n−1 X ) Wec,i (ek+j+1 − ec,i c,i,l (k+j+1)∗ ) We∗η,i eη,i (k+j+1)∗ T + (ec,i ) ) (k+j+1)∗ ) We∗c,i ec,i ] T k+j [(∆Qk+j c,s ) W∆Qc,s ∆Qc,s ]} i=1 j=0 (4.7) k+j+1 k+j k+j k+j k+j k+j uQ + Bd,r + Bu,r d = Ak+j x r x r (k+j+1)∗ eη,i,min ≤ e ≤ eη,i,max j = 0, · · · , n − 1 subject to: i = 1, · · · , nr e(k+j+1)∗ ≤ 0 k+j Qc,s,min ≤ Qc,s ≤ Qc,s,min s = 1, · · · , ns k+j+1 where eη,r,i,l is the reduced water level deviation from the target at the end th of the i reach at j th prediction step of control time step k. In addition, one of the control objectives is to minimize the number of changes in the flow as little as possible in order to save energy and reduce wear and tear. Therefore, the control flow Qk+j+1 in the model is split into Qk+j c,s c,s k+j+1 k+j k+j+1 and ∆Qc,s , namely, Qk+j+1 = Q + ∆Q . The control variable is c,s c,s c,s k+j+1 k+j the change of control flow ∆Qc,s and Qc,s goes into the states. Moreover, according to the control objectives, two soft constraints are introduced. Thus, two virtual inputs and states are added to the prediction model. Finally, the time-varying state-space model constraints in MPC become: 4.4. Test case xrk+j+1 k+j+1 uQ (k+j+1)∗ − eη,i ek+j+1 η,i,l (k+j+1)∗ ek+j+1 − ec,i c,i,l k+j Bu,r 1 + k+j Bu,η,i,l k+j Bu,c,i,l 69 k+j k+j x 0 0 B Ak+j r u,r r k+j 0 1 0 0 u Q = k+j k+j k+j k+j Aη,i,l Φ1 Bu,η,i,l 0 0 eη,i,l − eη,i k+j k+j k+j Ac,i,l Φ1 Bu,c,i,l 0 0 ek+j c,i,l − ec,i k+j 0 0 B d,r uk+j+1 ∆Q 0 0 e(k+j)∗ + k+j0 dk+j r η,i −1 0 Bd,η,i,l Φ2 (k+j)∗ e k+j c,i 0 −1 Bd,c,i,l Φ2 (4.8) k+j+1 ,··· , where u∆Q is the vector of change of control flows: uk+j+1 = [∆Qk+j+1 c,1 ∆Q k k+j+1 T ∆Qc,ns ] . Therefore, the control input vector u in equation 2.8 on page 24 T k∗ k∗ T becomes [(uk+1 ∆Q ) eη,i eη,i ] . 4.4 Test case The test canal in this chapter is a virtual example of a polder system. It has 4 reaches with 5 structures controlling both water levels and concentrations at the downstream side of each reach. The canal has a trapezoidal cross section. The structures are four gates in series and one pump at the end of the canal. All control structures have a maximum flow capacity of 1.2m3 /s. The first gate can introduce clean water from a storage canal with a concentration of 0.4kg/m3 . The schematic view is shown in Figure 2.6 on page 27 with geometric parameters. The target values for both water quantity and quality control are listed in Table 2.1 on page 26. Each of the reaches is discretized into 100 spatial increments, so there are 800 states in total for both water level and concentration states. The same number applies for the disturbances. Optimizing such a complex model over 30 prediction steps in this case can presently not be accomplished in an online setting. Several laterals at each reach flow into the canal with different discharges and concentrations. Their locations are presented in Table 2.2 on page 27. The processes of the experiments include two steps as shown in Figure 4.1 “Model Reduction” block and “Model Predictive Control” block. Both steps react on certain scenarios of lateral flow changes, as shown in Tables 4.1 and 4.2 for reduced model generation and verification, and Table 4.3 for MPC test using the reduced model. For simplicity, a step change in all lateral 70 Chapter 4. Reduced models in MPC controlling water quantity & quality discharges and concentrations is assumed for the three scenarios. However, the three step changes are different in magnitude and happen at different time instances and over different durations. In practice, lateral flow scenarios can be produced by certain rainfall-runoff models and normally do not contain step changes. In the “Model Reduction” block of Figure 4.1, a feedback control (Proportional Integral (PI) control) is used in an offline simulation to maintain the downstream water level and concentration in each reach close to their target values. The most upstream gate is related to the highest concentration among the reaches, and the other structures use upstream control on water levels. The PI control is shown in Equation 4.9: ∆Qkc = Kp (ek − ek−1 ) + Ki ek (4.9) where ek is the water level or concentration deviation from the target in a reach at time step k, Kp and Ki are the proportional and integral gain factors, which are selected by trial-and-error and shown in Table 4.4. A decoupler introduced by [59], [13] is used between the gates, which adds the downstream gate flow to the upstream gate for each canal reach in order to avoid counteracting disturbances from local controllers between neighboring reaches. The offline simulation takes 20 hours with a simulation time step of 4 minutes. At each step, a snapshot is taken in this case, thus 300 snapshots in total. With the POD model reduction technique, the model is reduced to 20 states in total (for both water levels and concentrations, no controlled release and virtual states) and 30 disturbances. These values were found with trial and error. The “Water System” in Figure 4.1 is represented by the mathematical model in Section 4.2.1. The test case was simulated for 20 hours with a simulation time step of 1 minute. In the “Model Predictive Control” block of Figure 4.1, the MPC has a control time step of 4 minutes with a prediction horizon of 2 hours. Note that this means that, during the simulation, MPC executes the optimization over 2 hours at each 4 minute interval and implements only the first control actions, which are kept constant in the simulation for 4 minutes. In order to distinguish and analyze the interactive and non-interactive effects between water quantity and quality control, the first experiment (Experiment A) turns off the water quality control by setting up the weighting factor on the water quality state to extremely small values. The second experiment (Experiment B) switches on the water quality control and compares the control performance with the first experiment. The weighting factors in MPC Table 4.1: Lateral flow scenario for reduced model generation (step changes happen between 8 and 10 hours of simulation) Lateral 1 Lateral 2 Lateral 3 Reach Discharge Concentration Discharge Concentration Discharge Concentration (m3 /s) (kg/m3 ) (m3 /s) (kg/m3 ) (m3 /s) (kg/m3 ) 1 0.02 to 0.08 1.0 to 1.6 0.03 to 0.09 1.2 to 1.8 No third lateral 2 0.02 to 0.08 1.2 to 1.8 0.03 to 0.09 1.4 to 2.0 No third lateral 3 0.04 to 0.10 0.9 to 1.5 0.02 to 0.08 1.5 to 2.1 0.03 to 0.09 1.8 to 2.4 4 0.02 to 0.08 1.5 to 2.1 0.04 to 0.10 1.0 to 1.6 No third lateral 4.4. Test case 71 Chapter 4. Reduced models in MPC controlling water quantity & quality 72 Table 4.2: Lateral flow scenario for reduced model verification (step changes happen between 5 and 8 hours of the simulation) Lateral 1 Lateral 2 Lateral 3 Reach Discharge Concentration Discharge Concentration Discharge Concentration (m3 /s) (kg/m3 ) (m3 /s) (kg/m3 ) (m3 /s) (kg/m3 ) 0.02 to 0.07 1.0 to 1.5 0.03 to 0.08 1.2 to 1.7 No third lateral 0.02 to 0.07 1.2 to 1.7 0.03 to 0.08 1.4 to 1.9 No third lateral 0.04 to 0.09 0.9 to 1.4 0.02 to 0.07 1.5 to 2.0 0.03 to 0.08 1.8 to 2.8 0.02 to 0.07 1.5 to 2.0 0.04 to 0.09 1.0 to 1.5 No third lateral 1 2 3 4 Table 4.3: Lateral flow scenario for testing the hours of the simulation) Lateral 1 Reach Discharge Concentration (m3 /s) (kg/m3 ) 1 0.02 to 0.06 1.0 to 1.4 2 0.02 to 0.06 1.2 to 1.6 3 0.04 to 0.08 0.9 to 1.3 4 0.02 to 0.06 1.5 to 1.9 Lateral 2 Discharge Concentration (m3 /s) (kg/m3 ) 0.03 to 0.07 1.2 to 1.6 0.03 to 0.07 1.4 to 1.8 0.02 to 0.06 1.5 to 1.9 0.04 to 0.09 1.0 to 1.4 Lateral 3 Discharge Concentration (m3 /s) (kg/m3 ) No third lateral No third lateral 0.03 to 0.07 1.8 to 2.2 No third lateral reduced model performance (step changes happen between 3 and 6 4.4. Test case 73 74 Chapter 4. Reduced models in MPC controlling water quantity & quality Table 4.4: Gain factors of the PI control Gate 1 Gate 2 Gate 3 Gate 4 Gate 5 Kp 4.5 4.5 4.5 4.5 4.5 Ki 0.05 0.45 0.45 0.45 0.45 are listed in Table 4.5. Table 4.5: Weighting factors in MPC for all reaches and structures 1 2 3 4 5 1 1 1 1 Weη,i (0.2)2 (0.2)2 (0.2)2 (0.2)2 1 1 1 1 Weη,i,l −e∗η,i (1.0×10−5 )2 (1.0×10−5 )2 (1.0×10−5 )2 (1.0×10 −5 )2 1 1 1 1 1 Wec,i (A) (1.0×1010 )2 (1.0×1010 )2 (1.0×1010 )2 (1.0×1010 )2 1 1 1 1 2 Wec,i (B) (0.2)2 (0.2)2 (0.2)2 (0.2)2 1 1 1 1 We∗η,i (1.0×1010 )2 (1.0×1010 )2 (1.0×1010 )2 (1.0×1010 )2 1 1 1 1 We∗c,i (1.0×1010 )2 (1.0×1010 )2 (1.0×1010 )2 (1.0×1010 )2 1 1 1 1 1 W∆Qc,s (0.02)2 (0.02)2 (0.02)2 (0.02)2 (0.02)2 The different control methods are tested in closed loop on the model of the polder system that acts as real-world. In this off-line setting, it is possible to simulate the Model Predictive Controller that uses the full model, but the simulation time is much larger than real-time. 4.5 Results This section presents the reduced model accuracy for both water quantity and quality models, and the results of MPC control performance using the reduced model. In order to demonstrate these two criteria, the reduced model is compared with the full model. MPC using the reduced model is compared with the MPC using the full model. All the model and control parameters are set the same in the comparisons. 1 2 the values are used in water quantity control (A) the values are used in combined water quantity and quality control (B) 4.5. Results 4.5.1 75 Reduced model performance The reduced model is validated with a different lateral scenario and the performance can be analyzed by projecting the reduced model states and disturbances back to the original order as illustrated in Figures 4.2 and 4.3. Figure 4.2 (I and III) shows that the downstream water levels in all reaches are well controlled at their targets with feedback control. The concentration in the last reach is around the target while the concentrations in upstream reaches are always below the targets because of the flushing. Figure 4.2 (II and IV) also demonstrates that water levels and concentrations between the reduced model and the original model have a maximum difference in the order of only 10−3 m and 10−2 kg/m3 , respectively. This means that the reduced model is representative for the original model and can capture the relevant system dynamics well. The same results occur in the disturbance vector for both water quantity and quality, which has a maximum difference in the order of 10−2 , as shown in Figure 4.3 (II and IV). However, each reach has a different model error. Another way to demonstrate model accuracy is to use the Root Mean Square Error (RMSE), which describes the spread of the reduced model to the original model. Figure 4.4 illustrates the RMSE of both water levels and concentrations. The results show a high accuracy of the reduced model on both water quantity and quality, and they are consistent with the model comparisons in Figures 4.2 and 4.3. 4.5.2 MPC performance under the reduced model The reduced model can approximate the full dynamic model with a validation scenario according to the results in 5.1. It is expected that MPC will have a good control performance using this reduced model. Figures 4.5 to 4.8 show the closed-loop MPC performance for both Experiment A and Experiment B in comparison with MPC using the full model. All the figures indicate the advantage of anticipation in MPC using the prediction. Water quantity control only In Experiment A, there is only water quantity control. The concentrations are uncontrolled and they are only a consequence of the water quantity control. Figure 4.5 shows the controlled water levels and the subsequent concen- 76 Chapter 4. Reduced models in MPC controlling water quantity & quality Figure 4.2: Reduced water level states (I) and concentration states (III) projected back to the original order, and the water level differences (II) and concentration differences (IV) between the reduced model and the original model 4.5. Results 77 Figure 4.3: Reduced water quantity disturbances (I) and quality disturbances (III) projected back to the original order, and the water quantity disturbance differences (II) and water quality disturbance differences (IV) between the reduced model and the original model. 78 Chapter 4. Reduced models in MPC controlling water quantity & quality Figure 4.4: Root mean square error of the reduced model on water quantity and quality (interpolated scenario) trations using both reduced and full models. The controlled water levels in Figure 4.5 (I and III) show a decrease in all reaches before 180 minutes. This is because of the prediction of the increase of lateral discharges, thus prereleasing occurs. The phenomenon is a result of the control flows in Figure 4.6, where the flows of downstream structures increase to release more water, while the flows of upstream structures decrease to introduce less water. In this way, extra space is created in the canal for the coming high flow. Because each canal reach has a different model error, the influence on the control performance is expected to be different. This difference is clearly illustrated in Figure 4.5, where the water level deviations in (I) are widely spread among the four reaches comparing to (III). However, the water levels are well maintained and the steady-state condition is reached. Combined water quantity and quality control In Experiment B, water quality control is added to control both water level and concentration at the downstream end of each reach. Figures 4.7 and 4.8 illustrate the control performance on water level, concentration and control flow. All variables have similar trajectories compared to the water quantity control in Experiment A but show different magnitudes. The water levels in Figure 4.7 (I) also indicate the pre-releasing at the beginning. After pre-releasing, the peak flows come from the laterals with high discharges and concentrations. The upstream gate tries to reduce the discharge in order to let lateral flows raise the water level to the target. 4.5. Results 79 Figure 4.5: Controlled water levels (I) and uncontrolled concentrations (II) using the reduced model; controlled water levels (III) and uncontrolled concentrations (IV) using the full model (Experiment A) However, this action will deteriorate the water quality and the water quality control requires pumping out more polluted water and introducing clean water. Therefore, the water level drops after rising to a certain level when the water quality control dominates. When water quantity dominates again, the controller tries to raise the water levels. This rotation of control dominance causes the water level fluctuations. After 360 minutes, when lateral flows are turned back to the original values, the control flows are still relatively high as shown in Figure 4.8 and the water levels have a large drop due to the gradual change of the control flows. This is the same phenomenon as found in the results of water quality control. In the end, the system returns back to the targets. In Figure 4.8 (I), the control flows show a similar pattern as the water quantity control in Figure 4.6 (I), but with larger magnitudes during the period of lateral flow change. That is because of the added water quality control, 80 Chapter 4. Reduced models in MPC controlling water quantity & quality Figure 4.6: Control flows (I) using the reduced model and (II) using the full model (Experiment A) which requires releasing more polluted water downstream and introducing more relatively clean water upstream. Because of the large increase of the downstream flows, the upstream flows can not decrease too much due to the water quantity control. These controlled flows introduce more clean water and lead to a relatively low concentration increase, especially in reaches 1 and 2 (comparing Figure 4.7 (II) with Figure 4.5 (II)). However, because of the large amount of polluted lateral flow and because the concentration difference among reaches are small, especially in reaches 3 and 4, the magnitude on reducing the concentration peak is limited. On the other hand, the flushing process is faster in combined water quantity and quality control due to the relatively larger flows, and water becomes clean a bit earlier compared to the water quantity Experiment A. When comparing the MPC results using two different models, we notice that the control flows using the reduced model are smaller compared to those using the full model in Figure 4.8, which indicates an underestimation of the states in the reduced model. The high discharges of the full model result in a faster flushing as shown in Figure 4.7 (II and IV). Moreover, the water level deviations spread even more widely in Figure 4.7 (I) because of the added water quality control, but they are still well controlled. In Figure 4.8, it can be noticed that flow conditions at the end of the control experiments are different. The controlled discharges when using the full model are larger than the initial steady state conditions and the concentration in the last reach is below the target value, which leads to “over-flushing”. However, from a control perspective, the problem is solved properly by MPC using both models. Figure 4.9 shows the objective function values of both 4.6. Discussions 81 Figure 4.7: Controlled water levels (I) and concentrations (II) using the reduced model; controlled water levels (III) and concentrations (IV) using the full model (Experiment B) controllers. After 600 minutes, both objectives return to zero and the optimization problem is solved. The reason of this “over-flushing” is due to the switch-off of the water quality control when water is clean, while discharge is still too high. 4.6 Discussions Water quantity and quality are the two major objectives in this research. They are formulated in a single objective function by assigning different weighting factors to each objective. However, conflicts may easily exist among the objectives. For example in Experiment B, water quantity control tries to decrease the control flow of the first gate because the lateral inflows will raise the water level. However, from a water quality control 82 Chapter 4. Reduced models in MPC controlling water quantity & quality Figure 4.8: Control flows (I) using the reduced model and (II) using the full model (Experiment B) point of view, more clean water needs to be introduced into the system, because more polluted lateral inflows will deteriorate the water quality situation. Thus, the first gate flow should increase. The relative importance of water quantity and quality control in the objective function decides the increase or decrease of the control flows. It can be noticed that the magnitudes of scenarios used for model verification in Table 4.2 and MPC test in Table 4.3 are lower than the ones used for reduced model generation in Table 3. This is intended to let the model reduction scenario cover the entire flow range in the MPC test. In this case, the snapshots taken in the off-line simulation of model reduction capture the main flow dynamics. Appendix B illustrates a situation where the step change of lateral flows is higher than the one used for the reduced model generation. The results show that the difference between the reduced and original model is around 10 times larger for both state and disturbance vectors, when the same number of reduced states and disturbances are used. This is due to the flow dynamics that are not captured in the snapshots. Therefore, it is strongly recommended that the model reduction scenario covers the flow and concentration ranges as widely as possible. This chapter demonstrates the possibilities of controlling combined water quantity and quality using a reduced model. In the test case the control locations are selected at the downstream end of each reach. Attention is needed when the system starts at zero flow and the water is clean and at target. Because water transport takes time, the polluted lateral flow may have already deteriorated the water quality too much before the pollution reaches the downstream side and is detected by the controller. In this case, 4.7. Conclusions and future research 83 Figure 4.9: Objective function value of MPC using reduced and full models the average water quality should be considered or the control point/sensor should be located close to the most polluted lateral point. Because of the differences in scenarios and locations of the control targets, the comparison between this research and Xu et al. (2010a) is only addressed in a qualitative manner. In both cases, the water system can be properly controlled. However, in the present research, more complex water quantity and quality models are applied in MPC using complex scenarios. Thanks to the model reduction, the system can be controlled in real-time. In addition, the location of the control target can be set more flexibly here due to the spatial discretization. 4.7 Conclusions and future research This chapter studies combined water quantity and quality control and provides a model reduction technique to implement complex high order models in Model Predictive Control. The research demonstrates that the extension of MPC to control both water quantity and quality control using complex models is possible. According to the comparison between the two experiments, water quantity 84 Chapter 4. Reduced models in MPC controlling water quantity & quality and quality control may conflict. However, the optimization in MPC can deal with the conflicts and finds the optimal solutions for all objectives. Thanks to the prediction of the flow dynamics in MPC, the water system can respond to the known water quantity and quality disturbances in advance and create extra space for the upcoming problems. Proper Orthogonal Decomposition is an efficient model reduction method to reduce the model order for both water quantity and quality. From a state-space model perspective, the number of states and disturbances can be significantly reduced while maintaining high accuracy. Because the reduced model can capture the main flow structure, it can be used as the prediction model in MPC to reduce the computational time. With model reduction, MPC could be run in real-time, whereas this was not possible with the full model. According to the discussion above, some future research can be performed. 1) The computation of Pareto fronts can be useful, in order to assess the trade-off between water quantity and quality objectives. 2) In reality, there are significant uncertainties in both data (lateral scenarios) and prediction models used. It is worth to incorporate uncertainty analysis of real-world applications and the adoption of robust MPC. 3) From an organization point of view, it could be also interesting to split the optimization in two agents, responsible for either water quantity or water quality management at different locations. Instead solving the central problem at once, the two agents need to collaborate in a distributed model predictive control configuration to come to a global optimum. Chapter 5 Model assessment in model predictive control Abstract This chapter1 presents a comparison between linear and nonlinear model predictive control. Model predictive control (MPC) is a model-based control technique that uses an optimization algorithm to generate optimal control actions. Based on the model used in optimization, MPC approaches can be categorized as linear or nonlinear. Both classes have advantages and disadvantages in terms of control accuracy and computational time. A typical linear model in open channel water management is the Integrator Delay (ID) model, while a nonlinear model usually refers to the Saint-Venant equations. In earlier work, we proposed the use of linearized Saint-Venant equations for MPC, where the model is formulated in a linear time-varying format and time-varying parameters are estimated outside of the optimization. Quadratic Programming (QP) is used to solve the optimization problem. However, the control accuracy of such an MPC scheme is not clear. In this chapter, we compare this approach with an MPC scheme that uses Sequential Quadratic Programming (SQP) to solve the optimization problem. Because the estimation of the time-varying parameters is integrated in the optimization in SQP, the solutions from SQP-based MPC are expected to be superior to the solutions of QP-based approach. However, SQP can be computationally expensive. A simulation experiment illustrates that the QPbased MPC approach using a linearized Saint-Venant model has an accurate 85 86 Chapter 5. Model assessment in model predictive control approximation of the control performance of SQP. 5.1 Introduction Over the last decade, model predictive control (MPC) of open channel flow has been a subject of extensive study [95],[96],[29],[97],[98],[99]. MPC is a model-based control technique that uses an optimization algorithm to generate optimal control actions. Advantages of MPC are that it predicts the future system dynamics, therefore being able to take into account future known disturbances. It can also deal with constraints within the optimization. Based on the type of model used in the optimization, MPC approaches can be categorized as linear or nonlinear. The focus of MPC in open channel water management is mainly on efficient water delivery in irrigation systems, and river operations for flood or drought prevention. A common feature of the existing research is that, typically, linear models are used for predicting the system dynamics, such as the reservoir model and the classical Integrator Delay (ID) model in [95],[96],[29],[97],[98]. Under certain assumptions, these linear models can approximate the nonlinear system dynamics well. The MPC optimization problems when using such linear models are easy and fast to solve. Moreover, guaranteed global optimal solutions can be found. A nonlinear model can normally include more system dynamics than a linear one. This extra information in the nonlinear model may increase the control accuracy in MPC. However, due to the use of such a nonlinear model, the optimization problem can become non-convex and hard to solve. Indeed, this is the case when using the Saint-Venant equations. Theoretically, a guarantee for finding the global optimum for nonlinear optimization can not often be given [32]. Since the optimal action needs to be taken within a prescribed time period in real-time control, computational time is important in achieving the optimum. Unfortunately, such a nonlinear MPC scheme can be very time consuming, e.g., due to the CPU-intensive model executions for the numerical calculation of gradients of a Lagrangian function with respect to the control variables, especially in the areas where these gradients are flat. This computational complexity in MPC using such a nonlinear model was also stated by Barjas Blanco in [99]. Therefore, they used a series of reservoir models instead. 1 based on: Xu. M., Negenborn. R.R., van Overloop. P.J. and van de Giesen. N.C. De Saint-Venant equations-based model predictive control of open channel flow. Advances in Water Resources. Volume 49:37-45, 2012. 5.1. Introduction 87 Some researchers use adjoint sensitivity analysis to speed up the nonlinear optimization by analytically calculating the gradients of the Lagrangian function with respect to the control variables [100],[101]. This is attractive for making such an MPC implementation feasible in real-time control, but it needs extensive analytical analysis of the nonlinear model and its derivatives beforehand. Moreover, any change to the control problem requires a new analytical derivation. For these reasons, the adjoint sensitivity analysis is not conducted in this thesis. Instead, in [78], we proposed an MPC scheme using linearized Saint-Venant equations in a time-varying format to approximate the nonlinear dynamics. The scheme requires a much more complex discretization and mathematical formulation of the equations than the reservoir model in [99]. This MPC scheme solves the optimization problem with a standard Quadratic Programming (QP) solver, which considers the model constraints as linear. The MPC approach in [78] is found to be the most accurate for comparison with MPC using an Integrator Delay model and a Reduced Saint-Venant model. The proposed method formulates the Saint-Venant equations as a linear time-varying state-space model. It uses a “Forward Estimation” to estimate the time-varying parameters outside of the optimization, based on the optimal solutions over a prediction horizon from the previous control step. However, due to the lack of information at the last prediction step, the optimal solutions in the previous control step are not optimal anymore in the present step. Therefore, it is unclear what the performance of this QP-based MPC controller is. The purpose of this work is to explore the accuracy of the control procedure of [78] by comparing the results with an MPC controller that formulates Sequential Quadratic Programming (SQP) problems and solves the entire time-varying Saint-Venant equations within the optimization. According to Schittkowski [102], SQP is a state-of-the-art method for solving nonlinear programming problems. Here the MPC scheme using this method is called SQP-based MPC. In this Chapter, we focus on the performance assessment of the two MPC schemes in terms of water level deviations from the target and the control actions. Because of the integrated calculation of the time-varying parameters within the optimization, the solutions from SQP-based MPC are expected to be superior to the solutions of QP-based approach, given sufficient computation time. It is the question how the two methods compare in terms of computational time and control accuracy. Regarding the control accuracy, the SQP-based MPC can be used as a benchmark. In addition, for the QPbased MPC, iterations are added between the “Forward Estimation” and the “Quadratic Programming” blocks, in order to compensate the influence of 88 Chapter 5. Model assessment in model predictive control the lack of information at the last prediction step. Therefore, another goal of this work is to investigate the significance of this influence. This Chapter is organized as follows. Section 5.2 describes the main components of MPC, including the open channel flow modeling and the optimization problem formulation. It summarizes the QP-based MPC scheme using the linearized Saint-Venant model and introduces the SQP-based MPC scheme. Section 5.3 introduces the test case used to compare the control performance between the two MPC schemes. A detailed demonstration of the results is given in Section 5.4 and conclusions and future research are given in Section 5.5. 5.2 Model predictive control of open channel flow Model predictive control has a general structure which uses an internal model to predict future system dynamics over a finite prediction horizon and solves a constrained optimization problem with a certain optimization algorithm. MPC uses online optimization, which means the optimization is conducted at every control time step and only the first control action over the prediction horizon is applied to the system. A typical MPC control problem in open channel water management is to maintain a water level far downstream of a control structure at the end of the canal reach. In the following sections, we discuss the main components of MPC for such a system: internal model and optimization. 5.2.1 Open channel flow model In order to control the open channel flow with MPC, the dynamics of the system need to be properly defined in the internal model of the controller. Open channel flow dynamics is usually described by the Saint-Venant equations, which contain the mass and momentum conservations [89] shown in Equations 2.1 on page 21 and 2.2 on page 21 According to Stelling and Duinmeijer [17], the Saint-Venant equations can be spatially discretized with staggered grids. A semi-implicit scheme is applied to the time integration, where the advection term in the momentum equation is explicitly discretized by a first-order upwind method. The friction term is linearized by using |Q| explicitly. All other terms are implicit. In this way, 5.2. Model predictive control of open channel flow 89 the Saint-Venant equations are linearized at every time step. Substituting the velocities of step n + 1 from the discretized version of Equation 2.2 on page 21 into Equation 2.1 on page 21, the water levels can be calculated with a tri-diagonal system, and the velocities are updated with the calculated water levels through the momentum Equation 2.2 on page 21. The detailed discretization of the Saint-Venant equations can refer to Equation 3.5 on page 42. In general, there is no specific format for the model constraints in MPC. However, in QP-based MPC, the internal model is usually formulated as a linear state-space system. Due to the inter-connection between water levels and velocities, the Saint-Venant equations are approximated by a linear statespace model that is time-varying as shown in Equation 2.8 on page 24 5.2.2 Generic MPC formulation Typically, an MPC problem in open channel water management solves the minimization of a quadratic objective function, subject to linear or nonlinear model equality constraints and linear inequality constraints on the control inputs. The reason to use a quadratic objective function is to balance both positive and negative variations of states and control inputs, such as water level deviations from the target level and the change of controlled structure flow. The formulation can then be written for a certain control time step k: k k min J(X , U ) = min { X k ,U k X k ,U k n−1 X j=0 (x k+j+1 T ) Wx x k+j+1 + n−1 X (uk+j )T Wu uk+j } j=0 (5.1) subject to: hi (X k , U k ) = 0 i = 1, · · · , me ri (X k , U k ) ≤ 0 i = 1, · · · , mi where J represents a quadratic objective function, X k+1 = [xk+1 , · · · , xk+n ]T and U k = [uk , · · · , uk+n−1 ]T are the states and control inputs over the prediction horizon with a length of n, hi and ri are the ith equality and inequality constraints, respectively, me is the number of equality constraints, mi is the number of inequality constraints, Wx and Wu are diagonal matrices representing the weighting factors on the state x and the control input u, respectively. 90 Chapter 5. Model assessment in model predictive control In open channel flow system, typically the state xk+j+1 = η k+j+1 − ηt is the water level deviation from the target level (ηt ) and the control input uk+j = − Qck+j−1 is the change of structure flow, where Qc is the controlled Qk+j c structure flow. The downstream water level of a canal reach is assumed controlled, and Wx only penalizes the controlled water level deviation. The equality constraints reflect the dynamics of the system, e.g. the Saint-Venant equations in this case. The structure flow Qc is restricted typically between the minimum and maximum flows of Qc,min and Qc,max as the inequality ≤ Qc,max . Note that both equality and constraints, namely Qc,min ≤ Qk+j c inequality constraints are over the prediction horizon n. According to the type of model constraints, the obtained optimization problem can be solved with different solvers. For example, if the model constraints are linear, Quadratic Programming (QP) can be use. If the model constraints are nonlinear, Sequential Quadratic Programming (SQP) can be used. In this chapter, Equation 2.8 on page 24 is a linear time-varying system with proper discretization. It is a linear approximation of partial differential equations at each time step with time-varying parameters. However, the equation is actually nonlinear over a finite horizon, which exactly needs to be considered in MPC as the internal model. In the following sections, we discuss two methods to estimate the time-varying parameters in MPC. 5.2.3 QP-based model predictive control QP-based MPC is intended to solve a quadratic optimization problem subject to linear constraints. Xu et al. [78] approximates the linear time-varying Saint-Venant model over the prediction horizon as a linear model. Figure 5.1 shows the work flow of the QP-based MPC controlling a water system. In this MPC scheme, the time-varying parameters of Ak , Buk and Bdk are calculated outside of the optimization solver and estimated through a “Forward Estimation” procedure. “Forward Estimation” simulates the Saint-Venant equations over a finite prediction horizon based on the previous optimal solutions which, in this Chapter, are the optimal gate flows over the prediction horizon. However, due to the control step change from k − 1 to k, the optimal flow of the last prediction step is missing. Therefore, the optimal solutions at step k − 1 are not optimal any more at step k with the new system information of the last prediction step. This lack of system information is severe for the very first control step when no previous optimal solutions are available at all. In order to handle this drawback and increase the control accuracy, 5.2. Model predictive control of open channel flow 91 iterations between the blocks of “Forward Estimation” and “Quadratic Programming” can be included in the procedure. In practice, not all the water levels are measured along a canal. Therefore, a standard Kalman filter [63] is used to estimate the unmeasured water levels with a limited number of measurements. Figure 5.1: QP-based MPC controlling a water system When the model Equation 2.8 on page 24 over a prediction horizon is substituted into the objective function 5.1 with calculated Ak , Buk and Bdk , the optimization problem can be written as: 1 min J(U k ) = min[ (U k )T H k U k + (f k )T U k + gc ] Uk Uk 2 (5.2) ≤ Qc,max j = 0, · · · , n − 1 subject to: Qc,min ≤ Qk+j c where H is the Hessian matrix, f is the Jacobian matrix and gc is a constant matrix. 92 Chapter 5. Model assessment in model predictive control Because the constrained model is linear with pre-determined and fixed time varying parameters of Ak , Buk and Bdk , the Hessian and the Jacobian can be analytically calculated with one model run over the prediction horizon [29]. Therefore, there is no need for extra model executions for the gradient comparing to numerical calculation, which saves a large amount of computational time, especially when iterations are used within the optimization. But the MPC procedure does need (niter + 1) × 2n model executions for the “Forward Estimation” to estimate the time varying parameters and for the calculation of the Hessian and Jacobian, where niter is the number of iterations between the “Forward Estimation” and “Quadratic Programming”. The optimization problem of Equation 5.2 is a typical quadratic programming problem, which is in our case solved by the standard MATLAB function “quadprog” [103]. 5.2.4 SQP-based model predictive control In the SQP-based MPC approach, a specific model format is not required. However, because of the linear time-varying state-space model setup for the QP-based MPC, this model setup is also applied in a SQP-based MPC scheme. Figure 5.2 illustrates the work flow of an SQP-based MPC controlling the same water system as in Section 5.2.3. Compared to QP-based MPC, the “QP-based MPC” block in Figure 5.1 is replaced by “SQP-based MPC”. In this scheme, the entire model over a finite prediction horizon is integrated in a sequence of QP sub-problems, which are solved by a QP optimization solver until the objective function value converges. Because the time-varying parameters are calculated internally in the optimization, the solutions are guaranteed to be optimal. In Sequential Quadratic Programming (SQP), the objective function is required to have a second order derivative and the constraints are required to be continuously differentiable. SQP formulates a sequence of QP subproblems based on the Hessian approximation of the Lagrangian function by taking the second order Taylor expansion of the Lagrangian function, and uses an iterative way to solve the QP sub-problems. The MATLAB function “fmincon” [103],[104],[105],[106] is used to solver the SQP problem. However, for the sake of facilitation of explaining the number of model executions required, which is related to the computational time, we provide some relevant equations of SQP. SQP is based on the Lagrangian function shown in Equation 5.3 with the Lagrange multipliers on the model constraints. 5.2. Model predictive control of open channel flow 93 Figure 5.2: SQP-based MPC controlling a water system L(X k , U k , Λk , Mk ) = J(X k , U k ) + me X i=1 Λki hi (X k , U k ) + mi X Mki ri (X k , U k ) i=1 (5.3) where L is the Lagrangian function, Λki = [λk+1 , · · · , λk+n ] and Mki = [µk+1 , i i i k+n · · · , µi ] are the Lagrange multipliers. The QP sub-problems at control step k are formulated according to Equation 5.4 by taking the second order Taylor expansion of the Lagrangian function. The solutions of the QP sub-problems S are used to formulate the next iteration until the objective function values converge. 1 k k T k k L(X k , U k , Λk , Mk ) = min[ (S k )T HL,p S k +(fL,p ) S +gL,p ] (5.4) k k k k k 2 S X ,U ,Λ ,M min subject to: hi (Xp , Up ) + 5X hi (Xp , Up )s1 + 5U hi (Xp , Up )s2 = 0, i = 1, · · · , me ri (Xp , Up ) + 5X ri (Xp , Up )s1 + 5U ri (Xp , Up )s2 ≤ 0, i = 1, · · · , mi k where HL,p is the Hessian matrix of the Lagrangian function at (Xpk , Upk ), k fL,p is the Jacobian matrix of the Lagrangian function at (Xpk , Upk ), gL,p is 94 Chapter 5. Model assessment in model predictive control k the constant matrix, S k is the search direction containing S1k = Xp+1 − Xpk k and S2k = Up+1 − Upk . Note that the subscript p represents the iteration index in SQP. Because of the difficulty in analytically calculating the gradient of the Lagrangian function, a numerical method is often used to estimate the gradient by executing the prediction model. Forward difference is one of the numerical methods for the estimation by assuming a small perturbation δ on the state or the control input, as described in Equation 5.5 Lxk+2 +δ − Lxk+2 Lxk+n +δ − Lxpk+n Lxk+1 +δ − Lxk+1 p p p , p ,··· , p ]T δ δ δ Luk+n−1 +δ − Luk+n−1 Luk +δ − Lukp Luk+1 +δ − Luk+1 p p 5U L(X k , U k , Λk , Mk ) = [ p , p ,··· , p ]T δ δ δ (5.5) 5X L(X k , U k , Λk , Mk ) = [ The Lagrange multipliers in calculating the gradient of the Lagrangian function can be obtained through the Karush-Kuhn-Tucker (KKT) conditions shown in Equation 5.6. KKT conditions are the first order necessary optimality conditions that need to be fulfilled for nonlinear optimization [107],[108]. It is obtained by taking the partial derivative of the Lagrangian function with respect to X k ,U k ,Λk , and Mk . 5L(Xpk , Upk , Λkp , Mkp ) = 5X J(Xpk , Upk ) + 5U J(Xpk , Upk ) mi me X X k k k Λi,p 5X hi (Xp , Up ) + + Mki,p 5U ri (Xpk , Upk ) = 0 i=1 i=1 (5.6) Λki,p hi (Xpk , Upk ) = 0 Mki,p ≥ 0 In order to numerically calculate the Jacobian matrix of the Lagrangian function, n model runs are required. These model runs include n(2n + 1) runs to calculate the Lagrangian function values of Lxk+1 , · · · , Lxk+n and Luk , · · · , Luk+n−1 , and 2 × n × n additional runs to calculate the Lagrangian function values with small perturbation on each of the variables of state X and control input U , namely Lxk+1 +δ , · · · , Lxk+n +δ and Luk +δ , · · · , Luk+n−1 +δ . Because all the model variables over the prediction horizon in X and U are dependent, a small perturbation on one variable will change the model constraints and influence all Lagrangian function values. Thus, the model needs to be executed over the prediction horizon n for each small perturbation of the 2n variables in order to calculate the Jacobian matrix. 5.3. Test case 95 For the Hessian matrix, Quasi-Newton method is used to calculate the Hessian approximation. The Broyden–Fletcher–Goldfarb–Shanno (BFGS) method is one of the most popular algorithms to update the Hessian approximation based on the Jacobian matrix [107]. Therefore, there is no need for extra model executions to calculate the Hessian matrix of the Lagrangian function. In total, n(2n + 1) model runs are required for each of the iterations in the nonlinear optimization with the forward difference method. 5.3 Test case In order to assess the performance of the QP-based MPC scheme using the linearized Saint-Venant model in comparison with the SQP-based MPC scheme, we will perform simulation experiments. Figure 3.1 describes a test canal reach and includes all the geometric parameter values. In the test case, we assume no lateral flows and try to control the downstream water level of the canal reach at −3.2mM SL (mean sea level) by operating the downstream gate with a maximum flow of 4m3 /s, given an upstream inflow disturbance. Figure 3.3 on page 47 shows the inflow disturbance scenario, involving large and frequent variations. The discharges are above the maximum downstream gate flow in certain periods. Two simulation experiments are setup to compare the QP-based and SQPbased MPC schemes. Figures 5.3(a) and 5.3(b) show the procedures. In experiment (a) (Figure 5.3(a)), both MPC schemes use the same information from the water system, and only the optimal control actions from SQPbased MPC are sent back to the water system. This experiment illustrates the controllers behavior with different prediction models in terms of the calculation of time-varying parameters. In experiment (b) (Figure 5.3(b)), both QP-based MPC and SQP-based MPC form their own loops with the water systems. The two water systems start from the same initial condition. This experiment is intended to show the influence of the controllers on the total water system loop. In addition, according to the QP-based MPC scheme shown in Figure 5.1, different numbers of iterations are tested in each MPC implementation, especially for the first control step when no previous control information is available for calculating the time-varying parameters of the state-space model. Each experiment covers a simulation period of 20 hours with a simulation 96 Chapter 5. Model assessment in model predictive control (a) Experiment of controller behavior (b) Experiment of control influence on the water system Figure 5.3: Two experiments time step of 2 seconds. The gate is operated every 4 minutes using the optimal control action. The reach is discretized in 500 segments, resulting in 500 water level states. A Kalman filter is implemented to estimate the unmeasured water levels and velocities as the initial condition of the model constraints based on the measured water levels at the upstream and downstream side of the reach (details of the Kalman filter are in [78]). The optimization problem in this case is only subject to the Saint-Venant equations and there is only one structure in control. Therefore, the number of equality constraints (me ) and the number of inequality constraints (mi ) both equal to 1. 5.4 Results In this section, we perform the experiments described in the previous section to assess the performance of the QP-based and SQP-based MPC schemes. In addition, we will provide an analysis of the computational time requirements. 5.4. Results 5.4.1 97 Results of control performance Experiment of controller behavior Before starting experiment (a), it is necessary to analyze the convergence of the objective function values of the QP-based MPC scheme using the linearized Saint-Venant model, since iterations between the “Forward Estimation” and “QP solver” are used to increase the model accuracy. Over the iterations, the performance is expected to increase, as the unknown information from the previous optimization is updated. Figure 5.4 shows this convergence of the objective function values at control steps 1, 13, 67, 115 and 193, where upstream inflows are above the maximum downstream control flow and the control limits may be reached. At these control steps, the upstream inflows in the prediction also change significantly, as is illustrated in Figure 3.3 on page 47. Note that the first objective function values in Figure 5.4 are without iterations. It is clear that the objective function values converge after a certain number of iterations. But iterations only have significant influence for the very first control step, while the influence on the rest of the control steps is negligible. Figure 5.6 also shows the evolution of predicted water levels and gate flows of QP-based MPC over 30 iterations at the first control step. The evolution results are similar to Figure 5.4 and show a fast convergence. To compare the behavior of the controllers, the control goal of minimizing the objective function values is analyzed. Figure 5.6 shows the results of experiment (a). Because of the lack of previous optimal information in the QP-based MPC scheme, especially at the very first control step, the figure also plots the result of this MPC scheme with 10 iterations between the “Forward Estimation” and “QP solver” at the first control step. A maximum of 10 initial iterations is taken as tests showed that taking a larger number of iterations does not alter the solutions any further (Figure 5.4). Figure 5.6 shows that SQP-based MPC has relatively low costs per control step over the prediction horizon and outperforms the QP-based MPC in that sense. The difference between the objective function values of the two MPC schemes shows that the lack of information from the previous control step does influence control performance, especially for the first control step. Oscillations occur due to the complete ignorance of the previous information at the beginning. The influence vanishes quickly as the simulation proceeds. On the other hand, the QP-based MPC can follow the SQP-based MPC performance trajectory very well. 98 Chapter 5. Model assessment in model predictive control Figure 5.4: Convergence of objective function values of the QP-based MPC scheme at control steps 1, 13, 67, 115, and 193 Figure 5.5: Evolution of the predicted water levels and discharges of QPbased MPC over 30 iterations at the first control step 5.4. Results 99 Figure 5.6: Comparison of objective function values between SQP-based MPC and QP-based MPC (10 iterations are only applied at the first control step) Moreover, there is a maximum of only 14.39% difference in the objective function values between SQP-based MPC and QP-based MPC with 10 initial iterations, shown in Figure 5.7. The percentage is calculated by taking the difference of their objective function values divided by the objective function value of the SQP-based MPC scheme. The larger differences mainly happen at the beginning of the simulation, where many flow constraints are activated, but no previous information is available as will be shown in Figure 5.9 later on. Although the control flow also reaches the constraints in the simulation afterwards, for example at about 800 minutes shown in Figure 5.9, the percentage difference between the two MPC schemes is small (< 5%) due to the previously available information (at about control step 200). Experiment of control influence on the water system After assessing the behavior of the controllers in experiment (a), it is necessary to analyze their control influence on the water systems over a full simulation. Regarding the control performance, the first indicators are the controlled water level and discharge evolution over the simulation horizon, shown in Figures 5.8 and 5.9 for both MPC schemes, respectively. Both 100 Chapter 5. Model assessment in model predictive control Figure 5.7: Percentage difference in objective function values between SQPbased MPC and QP-based MPC with 10 initial iterations in experiment (a) controllers can control the water levels very close to the target, and the system behavior using these two controllers is very similar. The water level oscillations that are visible in Figure 5.8 are realistic and caused by the discrete steps that the controller takes every 4 minutes, while the flow dynamics is simulated using a 2 second time interval. The maximum control flow of 4m3 /s is reached several times during the whole simulation as shown in Figure 5.9. The performance of the controlled water levels and discharges can also be indicated through quantitative performance indicators, such as the Maximum Absolute Error (MAE) indicating the percentage of maximum water level deviation from the target and the Integrated Absolute Discharge Change (IAQ) calculated by the integral of the absolute flow changes over the simulation minus the absolute flow difference of the first and last simulation steps [67]. IAQ reflects the tear and wear of the gate over the whole simulation. The comparison of the two MPC schemes using these indicators is shown in Table 5.1. As can be seen, the differences in control performance between the schemes are small. Due to the higher model accuracy, SQP-based MPC has slightly lower values for the MAE and IAQ indicators, which indicates slightly better performance. 5.4. Results 101 Figure 5.8: Controlled water levels in SQP-based MPC and QP-based MPC without iterations Figure 5.9: Controlled discharge in SQP-based MPC and QP-based MPC without iterations (Upstream inflow is plotted to indicate the downstream flow trends) 102 Chapter 5. Model assessment in model predictive control Table 5.1: Performance indicators of both SQP-based MPC and QP-based MPC Maximum Absolute Value Integrated Absolute Discharge (MAE) (%) Change (IAQ) (m3 /s) SQP-based MPC -0.55 13.52 QP-based MPC -0.60 13.55 5.4.2 Results of computational time Computational time is important for real-time control implementation. Before the next control time step is reached, the optimization results should be available. Table 5.2 shows the computational time of different components in both MPC executions. According to the MPC procedures in Figures 5.1 and 5.2, the “total time per control step” represents the average computational time from “water system” to “water system” through “Kalman filter” and “MPC” block. The “control time” is the specific time for the control generation in “MPC” block. The “model calls in control” represents the time of model simulations within the “MPC” block. For QP-based MPC, the “model calls in control” includes the time of calling the model in the “Forward Estimation” and the controller, while for SQP-based MPC it is the time of calling the model in the SQP optimization. The calculation of both MPC schemes was on a 64-bit computer with an 8 Gb internal memory. Table 5.2: Computational time components in both QP-based MPC and SQP-based MPC executions SQP-based MPC QP-based MPC Total time per control step (s) 1761.25 54.39 Control time (s) 1750.14 44.40 Model calls in control (s) 1748.44 2.48 From Table 5.2, it follows that 99.37% of the total computational time in SQP-based MPC is used to generate the control actions, while 99.9% of the control actions calculation time is spent on the model executions within the optimization. This illustrates the importance for reducing the total number of model executions and speeding up the model computations. It is noted that the “control time” and the “model calls in control” do not include the time of Kalman filtering. Moreover, there exist large computational time differences between the two MPC executions. Since the actual control time step is 4 minutes, the table 5.4. Results 103 indicates that the optimization time of SQP-based MPC is unacceptable in this case, while the implementation of QP-based MPC is possible and 2 or 3 iterations can even be allowed. The time of “model calls in control” is not the major time consumption in QP-based MPC and most of the computational time is spent on the large matrix multiplications in order to build up the Hessian and Jacobian over the prediction, according to Xu et al. [78]. Because model calling takes most of the computational time in SQP-based MPC, it is interesting to analyze the number of model executions. Table 5.3 compares the number of model executions per control step of the two MPC schemes, which is a function of the number of iterations niter and the prediction horizon n. For the QP-based MPC, niter is the number of iterations between the “Forward Estimation” and “Quadratic Programming” blocks. For SQP-based MPC, the number of iterations per control step is taken as an average number of iterations over the full control steps (n̄iter ). Table 5.3: Number of model executions per control step in linear and nonlinear MPC QP-based MPC SQP-based MPC No iteration niter iterations Number of model executions 2n (niter + 1) × 2n n(2n + 1) × n̄iter per control step It should be noticed that the model execution in QP-based MPC only occurs in the “Forward Estimation” and preparation of Hessian and Jacobian matrices buildup over the prediction horizon. Therefore, the number of executions increases linearly with the number of iterations between the “Forward Estimation” and “Quadratic Programming”. Because the Hessian and Jacobian matrices are pre-calculated, there is no need to execute the model within the QP optimization, although QP iteratively solves the optimization problem. Figure 5.10 shows the number of iterations used in the SQP in SQP-based MPC. There are n̄iter = 45.86 iterations per control step on average, and every iteration requires n(2n + 1) model calls to calculate the Hessian approximation and the Jacobian matrices. For that reason, the computational difference between the two MPC schemes is significant. 104 Chapter 5. Model assessment in model predictive control Figure 5.10: Number of iterations used in SQP optimization 5.5 Conclusions and future research In this Chapter, a comparison has been made between QP-based and SQPbased MPC schemes for control of open channel flow that can be described by 1-dimensional Saint-Venant equations. Two experiments were conducted for testing the behaviors of controllers and their influence on the water systems. Both MPC schemes presented in this chapter can control the water system very well. Due to the integrated calculation of the time-varying parameters of the Saint-Venant equations, a more accurate prediction model is achieved in SQP-based MPC. Furthermore, SQP-based MPC achieves slightly better control performance regarding the minimization of the objective function. SQP-based MPC is more computationally expensive. The QP-based MPC using the linearized Saint-Venant equations was tested in a single canal reach in this research. However, in general, as the complexity of the problem increases, the computational time will increase accordingly when the same model accuracy (spatial discretization) is reached. In QP-based MPC using linearized Saint-Venant model, iterations between the “Forward Estimation” and “Quadratic Programming” can improve the control results. The improvement is only significant at the very first control step, when there is no previous optimal information at all and many constraints are active. The influence of this lack of previous optimal infor- 5.5. Conclusions and future research 105 mation dies out quickly as the simulation proceeds and the control results converge fast over the iterations. As a benchmark for control performance, the results of SQP-based MPC show that the procedure of QP-based MPC with the “Forward Estimation” is an effective and efficient way to deal with nonlinearity of the model constraints. This chapter also provides an interesting finding that model executions take 99.9% of the control time in the optimization of SQP-based MPC. This suggests a working direction for SQP-based MPC in the future regarding reducing the total number of model executions and speeding up the model calculations, for example, the adjoint method. In addition, switching all the calculations to low level programming will also decrease the computational time significantly, since the matrix inverse in the model calculation takes much time. Because of the non-convexity of the optimization, there is no guarantee of global optimum in nonlinear optimization. Once the computational burden of SQP-based MPC optimization is conquered, a multi-start method, a number of SQP-based MPC executions with multiple initial values, can be implemented to increase the chance of reaching the global optimum. More practically, another future research direction regarding MPC is to analyze the influence of future uncertainty on the proposed QP-based MPC procedure. For example, what is predicted in the previous step does not happen or what is not predicted in the previous step does happen, etc. Unlike the theoretical work in this Chapter, which assumes perfect predictions, real world implementations have to deal with these changing predictions. 106 Chapter 5. Model assessment in model predictive control Chapter 6 Conclusions and future research In this thesis, real-time control of combined surface water quantity and quality was studied. As a test case, a polder system was considered where, due to deteriorating water quality, the canals need to be flushed. Both feedback control and model predictive control (MPC) were designed to control the flushing procedure. The thesis focuses on the implementation of MPC, because of its advantage of prediction and constraint handling which leads to better operation. Model Predictive Control proved to be a much larger challenge due to the heavy computation, which can be a barrier for real-time implementation. The control performance of MPC using different simplified internal models was analyzed and a model reduction method to balance the control effectiveness and the computation time in MPC was proposed. The main research questions as stated in the introduction were answered and the main findings and future research are summarized in this chapter. 6.1 Conclusions 1. In this thesis, both simple and complex models applied in MPC were studied controlling both in water quantity and quality. For flow modelling, commonly the Integrator Delay model suffices. For polders and irrigation canals, the flow changes are small over the prediction horizon which allows for such a linear model. An accurate model is needed for river operation, because river discharges vary significantly. Therefore, the Saint-Venant model is required to achieve sufficient accuracy. 107 108 Chapter 6. Conclusions and future research This thesis mainly focuses on the Saint-Venant model and proposes a reduced Saint-Venant model for MPC. 2. Combined surface water quantity and quality control is possible. Both feedback control and MPC can control the water system very well, yet the control performance is different. Because of the prediction used in MPC, this MPC controller can take actions in advance while feedback control waits until the deviation from the target happens. This is important in flood control or polder flushing where limits of operations are narrow. 3. Different models can be used as prediction models in MPC. Different model accuracy and complexity lead to different control performance. Essentially, control effectiveness and computation time of the model needs to be properly balanced. 4. Proper Orthogonal Decomposition (POD) is an efficient method to produce a reduced model that contains less number of states, yet still be accurate enough for control purposes. It runs an offline simulation to generate model snapshots, which are used to formulate basis functions. As long as enough snapshots are used in a simulation with wide flow ranges, the coherent flow structures can be captured. POD can be used on either linear or nonlinear models, which makes it perfect to reduce the order of the discretized Saint-Venant equations. 5. The reduced Saint-Venant model has a low order of states, reducing the large matrix operation time within MPC. Accordingly, the computation time of MPC is significantly reduced. Because the main flow characteristics are captured by the reduced model, the control effectiveness remains very high. 6. The proposed MPC scheme with the “Forward Estimation” procedure linearizes the Saint-Venant equations at every time step. This linearized time-varying model transforms the nonlinear MPC to linear MPC and changes the nonlinear programming to standard quadratic programming which can be solved in a straightforward and fast way. 7. Iterations can be included in the proposed MPC procedure between the “Forward Estimation” and the MPC optimization. They increase the control accuracy when the prediction is uncertain. Otherwise, the influence of iterations is insignificant. 8. SQP is often used to solve a nonlinear optimization by formulating a sequence of quadratic programming sub-problems. Although it is in- 6.2. Future research 109 teresting to study this method applied to nonlinear MPC under the constraint of a nonlinear model, the numerical calculation of the gradient of the Lagrangian function can be extremely time consuming. 6.2 Future research Data and sensors 1. In this thesis, all the measurements for water quantity and quality variables are assumed to be measurable at a prescribed control interval. Water quantity variables, such as water levels or flows, can be easily measured and many implementations of these measurements are available. However, water quality measurements in real-time are much more difficult in practical implementation, especially for certain substances, e.g. nitrate, PH. This difficulty needs to be taken into account for real-time control of water quantity. A focus towards real-time measurements of water quality variables is recommended. 2. The research in this thesis is based on deterministic MPC and all the study cases assume perfect predictions for MPC. However, this is usually not valid in reality and uncertainty needs to be considered, for example in the input data and the prediction model itself. Ensemble predictions such as [109] [110] are required to cope with the uncertainty, and the combination of MPC with uncertain predictions needs further research. Controller structure 1. For the polder flushing case, applying a water network instead of a canal will make the test more challenging. It will be difficult for feedback control to control both water quantity and quality. MPC, using the network model, will still be able to find sensible control solutions. Optimization issues 1. In combined water quantity and quality control, a single objective function is formulated for both water quantity and quality variables, to- 110 Chapter 6. Conclusions and future research gether with the change of structure flow. The relative importance of each target is tuned by setting different weighting factors of the control variables. However, in order to assess the trade-off between water quantity and quality objectives, the computation of Pareto fronts can be useful. 2. Optimization is one of the key elements in MPC. Thus, it can be interesting to study better optimization for non-linear problems and to better understand the topography of the objective function. It is also worthwhile to understand if a global minimum is really needed or if, as is the case with the traveling salesman problem, a good local minimum would be sufficient as well. Computation methods 1. The execution of the Saint-Venant model in MPC programmed in Matlab takes most of the computational time. Therefore, it is interesting to switch the code to a low level programming language, such as FORTRAN or C. This will reduce the computational time significantly. In addition, the tests in Chapters 3 and 5 are conducted on a single canal reach. When dealing with large-scale systems, it is important to analyze the increase of computation time as the model calculations increase significantly. 2. Since model reduction techniques are very powerful to reduce the model order, it is useful to apply the technique to 3-dimensional models, where computation time is usually a problem in real-time operation, especially applying such models in MPC. A potential application is to model and control salt water intrusion, which is a hot issue in Delta areas, e.g. the Marina Bay in Singapore and the Haringvliet sluices in the Netherlands. Figure 6.1 shows a schematic view of MPC controlling both water quantity and quality using reduced models in 1-dimension or 3-dimension. 6.2. Future research 111 Figure 6.1: Schematic view of MPC controlling both surface water quantity and quality using reduced models 112 Chapter 6. Conclusions and future research Bibliography [1] Ward. D.R. Water Wars: Drought, Flood, Folly and the Politics of Thirst. Riverhead Hardcover, first edition, 2002. [2] Zhang. Q. and Gao. G. The spatial and temporal features of drought and flood disasters in the past 50 years and monitoring and warning services in China. Science & Technology Review, 7, 2004. [3] Coward. E.W. Irrigation and agricultural development in Asia: Perspectives from the social sciencest. Cornell Univ Pr, 1980. [4] Rao. NH, Sarma. PBS, and Chander. S. Irrigation scheduling under a limited water supply. Agricultural Water Management, 15(2):165–175, 1988. [5] Sperna Weiland. F. Hydrological Impacts on Climite Change. Utrecht Studies in Earth Sciences, 2011. [6] Warmer. H. and van Dokkum. R. Water pollution control in the Netherlands. Policy and Practice. RIZA report, 2002. [7] Xu. M., van Overloop. P.J., and van de Giesen. N.C. Model selection for salt water intrusion in delta areas. In 25th ICID European Regional Conference, pages Paper II–17, May. 2011. [8] Xu. M., van Overloop. P.J., van de Giesen. N.C., and Stelling. G.S. Real-time control of combined surface water quantity and quality: polder flushing. Water Science and Technology, 61(4):869–878, 2010. [9] Fontane. D. G., Labadie. J. W., and Loftis. B. Optimal control of reservoir discharge quality through selective withdrawal. Water Resources Research, 17(6):1594–1602, 1981. [10] Cembrano. G., Quevedo. J., Salamero. M., Puig. V., Figueras. J., and Marti. J. Optimal control of urban drainage systems. A cases tudy. Control Engineering Practice, 12(1):1–9, 2004. 113 114 Bibliography [11] Schuurmans. J., Bosgra. O.H., and Brouwer. R. Open-channel flow model approximation for controller design. Applied Mathematical Modelling, 19(9):525–530, 1995. [12] Litrico. X. and Fromion. V. Simplified modeling of irrigation canals for controller design. Journal of Irrigation and Drainage Engineering, 130(5), 2004. [13] Schuurmans. J., Hof. A., Dijkstra. S., Bosgra. O.H., and Brouwer. R. Simple water level controller for irrigation and drainage canals. Journal of Irrigation and Drainage Engineering, 125(4):189–195, 1999. [14] Wahlin. B.T. and Clemmens. A.J. Automatic downstream water-level feedback control of branching canal networks: theory. Journal of Irrigation and Drainage Engineering, 132(3):198–207, 2006. [15] Courant.R., Friedrichs. K., and Lew. H. On the partial difference equations of mathematical physics. IBM Journal of Research and Development, 11(2):215–234, 1967. [16] Lyn. D.A. and Goodwin. P. Stability of general Preissmann scheme. Journal of Hydraulic Engineering, 113(1):16–28, 1987. [17] Stelling. G.S. and Duinmeijer. S.P.A. A staggered conservative scheme for every Froude number in rapidly varied shallow water flows. International Journal for Numerical Methods in Fluids, 43(12):1329–1354, 2003. [18] van der Vegt. JJW and De Boom. WC. Numerical simulation of flow around circular cylinders at high reynolds numbers. In Behaviour of offshore structures: proceedings of the 4th International Conference on Behaviour of Offshore Structures (BOSS’85), pages 227–238, Jul. 1985. [19] Dewey. H.G. and Madsen. W.R. Flow control and transients in the California aqueduct. Journal of Irrigation and Drainage Engineering Division, 120(HY3), 1976. [20] Bodely. W.E. and Wylie. E.B. Control of transients in series channels with gates. Journal of Hydraulics Division, 104(HY10), 1978. [21] Buyalski. C.P. Automatic downstream control of the corning canal check gates by the el-flo plus reset control system. In U.S./U.S.S.R Symposium on Automation and Remote Control of Water Resources Systems, Frunze, U.S.S.R, May. 1979. Bibliography 115 [22] Buyalski. C.P. Automatic upstream control system for canals. In 8th Technical Conference, U.S. Commission on Irrigation, Drainage, and Flood Control, Phoenix, Arizona, Sept. 1979. [23] Stedinger. J.R., Sule. B.F., and Loucks. D.P. Stochastic dynamic programming models for reservoir operation optimization. Water Resources Research, 20(11):1499–1505, 1984. [24] Chang. L.C. and Chang. F.J. Intelligent control for modelling of real-time reservoir operation. Hydrological Processes, 15(9):1621–1634, 2001. [25] Burt. C.M., Mills. R.S., Khalsa. R.D., and Ruiz. VC. Improved Proportional-Integral (PI) logic for canal automation. Journal of Irrigation and Drainage Engineering, 124(1):53–57, 1998. [26] Litrico. X. and Fromion. V. Design of structured multivariable controllers for irrigation canals. In 44th IEEE Conference on Decision and Control, the European Control Conference, pages 1881–1886, Dec. 2005. [27] van Overloop. P.J., Schuurmans. J., Brouwer. R., and Burt. C.M. Multiple-model optimization of proportional integral controllers on canals. Journal of Irrigation and Drainage Engineering, 131(2):190– 196, 2005. [28] Malaterre. P.O., Rogers. D.C., and Schuurmans. J. Classification of canal control algorithms. Journal of Irrigation and Drainage Engineering, 124(1):3–10, 1998. [29] van Overloop. P.J. Model Predictive Control on Open Water Systems. IOS Press, 2006. [30] Garcia. C.E., Prett. D.M., and Morari. M. Model predictive control: theory and practice a survey. Automatica, 25(3):335–348, 1989. [31] Leigh. J.R. Control Theory. The Institution of Electrical Engineers, second edition, 2004. [32] Camacho. E. and Bordons. C. Nonlinear model predictive control: an introductory review. Assessment and Future Directions of Nonlinear Model Predictive Control, 358(1):1–16, 2007. [33] Holmes. P., Lumley. J.L., and Berkooz. G. Turbulence, Coherent Structures, Dynamical Systems and Symmetry. Cambridge University Press, 1998. 116 Bibliography [34] Siade. A.J., Putti. M., and Yeh. W.W.G. Snapshot selection for groundwater model reduction using proper orthogonal decomposition. Water Resources Research, 46(8):W08539, 2010. [35] Winton. C., Pettway. J., Kelley. C., Howington. S., and Eslinger. O.J. Application of Proper Orthogonal Decomposition (POD) to inverse problems in saturated groundwater flow. Advances in Water Resources, 34(12):1519–1526, 2011. [36] Ha. D.M., Tkalich. P., and Chan. E.S. Tsunami forecasting using proper orthogonal decomposition method. Journal of Geophysical Research-Oceans, 113(C6):C06019, 2008. [37] Ravindran. S.S. A reduced-order approach for optimal control of fluids using proper orthogonal decomposition. International Journal for Numerical Methods in Fluids, 34(5):425–448, 2000. [38] Hinze. M. and Volkwein. S. Proper orthogonal decomposition surrogate models for nonlinear dynamical systems: error estimates and suboptimal control. Dimension Reduction of Large-Scale Systems, 45(1):261– 306, 2005. [39] Chen. G., Li. Y., and Yan. G. A nonlinear pod reduced order model for limit cycle oscillation prediction. SCIENCE CHINA Physics, Mechanics & Astronomy, 53(7):1325–1332, 2010. [40] Liang. Y.C., Lee. H.P., Lim. S.P., Lin. W.Z., Lee. K.H., and Wu. C.G. Proper orthogonal decomposition and its applications - part i: theory. Journal of Sound and Vibration, 252(3):527–544, 2002. [41] Ha. D.M., Lim. K.M., Khoo. B.C., and Willcox. K. Real-time optimization using proper orthogonal decomposition: Free surface shape prediction due to underwater bubble dynamics. Computers & Fluids, 36(3). [42] Litrico. X. and Fromion. V. H control of an irrigation canal pool with a mixed control politics. In Control Systems Technology, IEEE Transactions on, pages 99–111, Jan. 2006. [43] Breur. K.J., van Leeuwen. P., and Dellaert. N.P. Deriving discharge strategies to reduce cso in urban drainage systems. Water Science and Technology, 36(8):259–263, 1997. [44] Petruck. A., Cassar. A., and Dettmar. J. Advanced real time control of a combined sewer system. Water Science and Technology, 37(1):319– 326, 1997. Bibliography 117 [45] Vanrolleghem. P.A., Benedetti. L., and Meirlaen. J. Modelling and realtime control of the integrated urban wastewater system. Environmental Modelling & Software, 20(4):427–442, 2005. [46] Cox. B.A. A review of currently available in-stream water quality models and their applicability for simulating dissolved oxygen in lowland rivers. Science of the Total Environment, 314:335–377, 2003. [47] Elshorbagy. A. and Ormsbee. L. Object-oriented modeling approach to surface water quality management. Journal of Environmental Engineering, 21(5):689–698, 2006. [48] Lobbrecht. A.H., Sinke. M.D., and Bouma. S.B. Dynamic control of the Delfland polders and storage basin, the Netherlands. Water Science and Technology, 39(4):269–279, 1999. [49] Glasgow. H.B., Burkholder. J.A.M., Reed. R.E., Lewitus. A.J., and Kleinman. J.E. Real-time remote monitoring of water quality: a review of current applications, and advancements in sensor, telemetry, and computing technologies. Journal of Experimental Marine Biology and Ecology, 300(1-2):409–448, 2004. [50] Johnson. K.S. and Coletti. L.J. In situ ultraviolet spectrophotometry for high resolution and long-term monitoring of nitrate, bromide and bisulfide in the ocean. Deep-Sea Research Part I, 49(7):1291–1305, 2002. [51] Camacho. E.F. and Bordons. C. Model Predictive Control. Springer, second edition, 2004. [52] Fischer. H.B. Mixing in Inland and Coastal Waters. Academic Press, second edition, 1979. [53] Versteeg. H.K. and Malalasekera. W. An Introduction to Computational Fluid Dynamics: The Finite Volume Method. Longman Scientific & Technical, 1995. [54] Bolea. Y., Puig. V., and Blesa. J. Gain-scheduled Smith proportionalintegral derivative controllers for linear parameter varying first-order plus time-varying delay systems. Control Theory & Applications, IET, 5(18):2142–2155, 2011. [55] Tornil-Sin. S., Ocampo-Martinez. C., Puig. V., and Escobet. T. Robust fault detection of non-linear systems using set-membership state estimation based on constraint satisfaction. Engineering Applications of Artificial Intelligence, 25(1):1–10, 2012. 118 Bibliography [56] Reddy. J.M., Dia. A., and Oussou. A. Design of control algorithm for operation of irrigation canals. Journal of Irrigation and Drainage Engineering, 118(6):852–867, 1992. [57] Durdu. O.F. Control of transient flow in irrigation canals using Lyapunov fuzzy filter-based Gaussian regulator. International Journal for Numerical Methods in Fluids, 50(4):491–509, 2005. [58] Thomann. R.V. and Mueller. J.A. Principles of Surface Water Quality Modeling and Control. Harper & Row, Publishers, 1987. [59] Schuurmans. J. Control of Water Levels in Open-channels. Delft University of Technology, the Netherlands, 1997. [60] Ziegler. J.G. and Nichols. N.B. Optimum settings for automatic controllers. Journal of Dynamic Systems, Measurement, and Control, 132(3):115–220, 1993. [61] Clemmens. A.J. and Schuurmans. J. Simple optimal downstream feedback canal controllers: theory. Journal of Irrigation and Drainage Engineering, 130(1):26–34, 2004. [62] Xu. M. and van Overloop. P.J. On the application of model reduction in model predictive control of open channel flow. In 9th International Conference on Hydroinformatics, pages 2169–2177, Sept. 2010. [63] Simon. D. Optimal State Estimation: Kalman, H Infinity, and Nonlinear Approaches. John Wiley & Sons, 2006. [64] The MathWorks. MATLAB Users Guide. Natick, 1998. [65] WL|Delft Hydraulic. Sobek User Guide and Technical Reference Manual. 2004. [66] L. Sirovic. Turbulence and the dynamics of coherent structures i: Coherent structures. ii: Symmetries and transformations. iii: Dynamics and scaling. Quarterly of Applied Mathematics, 45(3):516–590, 1987. [67] A.J Clemmens, Kacerek. T.F., Grawitz. B., and Schuurmans. W. Test cases for canal control algorithms. Journal of Irrigation and Drainage Engineering, 124(1):23–30, 1998. [68] Kerachian. R. and Karamouz. M. A stochastic conflict resolution model for water quality management in reservoir-river systems. Advances in Water Resources, 30(4):866–882, 2007. Bibliography 119 [69] Dhar. A. and Datta. B. Optimal operation of reservoirs for downstream water quality control using linked simulation optimization. Hydrological Processes, 22(6):842–853, 2008. [70] Shirangi. E., Kerachian. R., and Bajestan. M.S. A simplified model for reservoir operation considering the water quality issues: Application of the Young conflict resolution theory. Environmental Monitoring and Assessment, 146(1):77–89, 2008. [71] Chaves. P. and Kojiri. T. Deriving reservoir operational strategies considering water quantity and quality objectives by stochastic fuzzy neural networks. Advances in Water Resources, 30(5):1329–1341, 2007. [72] Mujumdar. P. and Saxena. P. A stochastic dynamic programming model for stream water quality management. Sadhana, 29(5):477–497, 2004. [73] Chaves. P., Tsukatani. T., and Kojiri. T. Operation of storage reservoir for water quality by using optimization and artificial intelligence techniques. Mathematics and Computers in Simulation, 67(4):419–432, 2004. [74] van Overloop. P.J., Schuurmans. W., and Brouwer. R. Model predictive control of canal systems in the netherlands. 2003. [75] Negenborn. R.R., Lukszo. Z., and Hellendoorn. H. Intelligent Infrastructures. Springer, 2010. [76] Litrico. X., Belaud. G., and Fovet. O. Adaptive control of algae detachment in regulated canal networks. In Networking, Sensing and Control (ICNSC), 2011 IEEE International Conference on, pages 197– 202, Delft, the Netherlands, Apr. 2011. [77] Augustijn. D.C.M., van den Berg. M., de Bruine. E., and Korving. H. Dynamic control of salt intrusion in the mark-vliet river system, the netherlands. Water Resource Management, 25(3):1005–1020, 2011. [78] Xu. M., van Overloop. P.J., and van de Giesen. N.C. On the study of control effectiveness and computational efficiency of reduced SaintVenant model in model predictive control. Advances in Water Resources, 34(2):282–290, 2010. [79] Ratto. M., Castelletti. A., and Pagano. A. Emulation techniques for the reduction and sensitivity analysis of complex environmental models. Environmental Modelling & Software, 34:1–4, 2012. 120 Bibliography [80] Razavi. S., Tolson. B.A., and Burn. D.H. Numerical assessment of metamodelling strategies in computationally intensive optimization. Environmental Modelling & Software, 34:67–86, 2012. [81] Castelletti. A., Galellib. S., Restellia. M., and Soncini-Sessaa. R. A general framework for dynamic emulation modelling in environmental problems. Environmental Modelling & Software, 34:5–18, 2012. [82] Ratto. M. and Pagano. A. Using recursive algorithms for the efficient identification of smoothing spline ANOVA models. Advances in Statistical Analysis, 94:367–388, 2010. [83] Borgonovo. E., Castaings. W., and Tarantola. S. Model emulation and moment-independent sensitivity analysis: An application to environmental modelling. Environmental Modelling & Software, 34:105–115, 2012. [84] Pannocchia. G., Rawlings. J.B., and Wright. S.J. Partial enumeration MPC: Robust stability results and application to an unstable CSTR. Journal of Process Control, 21:1459–1466, 2011. [85] Marruedo. D.L., Alamo. T., and Camacho. E.F. Input-to-state stable MPC for constrained discrete-time nonlinear systems with bounded additive uncertainties. In 41st IEEE Conference on Decision and Control, pages 4619–4624, Las Vega, Nevada, USA, Dec. 2002. [86] Pannocchia. G., Rawlings. J.B., and Wright. S.J. Conditions under which suboptimal nonlinear MPC is inherently robust. System & Control Letters, 60:747–755, 2011. [87] Pannocchia. G., Rawlings. J.B., and Wright. S.J. Inherently robust suboptimal nonlinear MPC: theory and application. In 50th IEEE Conference on Decision and Control and European Control Conference (CDC-ECC), pages 3398–3403, Orlando, FL, USA, Dec. 2011. [88] Pannocchia. G., Rawlings. J.B., and Wright. S.J. Is suboptimal nonlinear MPC inherently robust? In 18th IFAC World Congress, pages 7981–7986, Milano, Italy, Aug.-Sept. 2011. [89] Chow. V.T. Open-Channel Hydraulics. McGraw-Hill, Inc., New York, 1959. [90] Lee. J.H., Lee. K.S., and Kim. W.C. Model-based iterative learning control with a quadratic criterion for time-varying linear systems. Automatica, 35(5):641–657, 2000. Bibliography 121 [91] Falcone. P., Borrelli. F., Tseng. H.E., Asgari. J., and Hrovat. D. Linear time-varying model predictive control and its application to active steering systems: Stability analysis and experimental validation. International Journal of Robust and Nonlinear Control, 18(8):862–875, 2008. [92] Blanning. R.W. The construction and implementation of metamodels. simulation, 24(6):177–184, 1975. [93] Castelletti. A., Galellib. S., Restellia. M., and Soncini-Sessaa. R. A data-driven dynamic emulation modelling approach for the management of large, distributed water resources systems. In 19th International Congress on Modelling and Simulation, pages 4008–4014, Perth, Australia, Dec. 2011. [94] Castelletti. A., Galellib. S., Restellia. M., and Soncini-Sessaa. R. Datadriven dynamic emulation modelling for the optimal management of environmental systems. Environmental Modelling & Software, 34:30– 43, 2012. [95] Wahlin. B.T. Performance of model predictive control on ASCE test canal 1. Journal of Irrigation and Drainage Engineering, 130(3):227– 238, 2004. [96] Willems. P., Blanco. T.B., Chiang. P.K., Cauwenberghs. K., Berlamont. J., and De Moor. B. Evaluation of river flood regulation by means of model predictive control. In 4th International Symposium on Flood Defence: Managing Flood Risk, Reliability and Vulnerability, pages 80.1–80.8, May. 2008. [97] Rodellar. J., Gomez. M., and Bonet. L. Control method for on-demand operation of open channel flow. Journal of Irrigation and Drainage Engineering, 119(2):225–241, 1993. [98] Negenborn. R.R., van Overloop. P.J., Keviczky. T., and De Schutter. B. Distributed model predictive control of irrigation canals. Networks and Heterogeneous Media, 4(2):359–380, 2009. [99] Barjas Blanco. T., Willems. P., Chiang. P.K., Haverbeke. N., Berlamont. J., and De Moor. B. Flood regulation using nonlinear model predictive control. Control Engineering Practice, 18(10):1147–1157, 2010. 122 Bibliography [100] Ding. Y. and Wang. S.S.Y. Optimal control of open-channel flow using adjoint sensitivity analysis. Journal of Hydraulic Engineeringl, 132(11):1215–1228, 2006. [101] Schwanenberg. D., Verhoeven. G., and Raso. L. Nonlinear model predictive of water resources systems in operational flood forecasting. In 9th International Conference on Hydroinformatics, pages 2014–2021, Tianjin, China, Sept. 2010. [102] Schittkowski. K. NLPQL: A FORTRAN subroutine solving constrained nonlinear programming problems. Annals of Operations Research, 5(1):485–500, 1986. [103] Gill. P.E., Murray. W., and Wright. M.H. Practical Optimization. Academic Press, 1981. [104] Han. S.P. A globally convergent method for nonlinear programming. Journal of Optimization Theory and Applications, 22(3):297–309, 1977. [105] Powell. M.J.D. The convergence of variable metric methods for nonlinearly constrained optimization calculations. Nonlinear Programming, pages 27–63, 1978. [106] Powell. M.J.D. A fast algorithm for nonlinearly constrained optimization calculations. Numerical Analysis, pages 144–157, 1978. [107] Bonnans. J.F., Gilbert. J.C., Lemarechal. C., and Sagastizbal. C.A. Numerical Optimization: Theoretical and Practical Aspects. SpringerVerlag New York, 2006. [108] Sun. W. and Yuan. Y. Optimization Theory and Methods: Nonlinear Programming. Springer, 2006. [109] Raso. L., van de Giesen. N., Stive. P., Schwanenberg. D., and van Overloop. P.J. Tree structure generation from ensemble forecasts for real time control. Hydrological Processes, 2012. doi:10.1002/hyp.9473. [110] Pianosi. F. and Raso. L. Dynamic modelling of predictive uncertainty by regression on absolute errors. Water Resources Research, 48(W03516), 2012. Appendix A Time-varying state-space model over prediction horizon Note: the subscript r represents that the variables are in reduced-order domain. When deleting the subscript r, they become the original variables in the unreduced model. The reduced-order time variant state-space model is described as follows: x̂r (k + 1) = Ar (k)x̂r (k) + Bu,r (k)u(k) + Bd,r (k)d(k) ŷr (k) = Cr x̂r (k) (A.1) When the model is written over the prediction horizon, the overall state-space model formulation becomes, following van Overloop [14]: x̂r (k) x̂r (k + 1) .. . = Ar,n x̂r (k) + Bur,n x̂r (k + n) ŷr (k) ŷr (k + 1) .. . ŷr (k + n) ŷr (k) ŷr (k + 1) = Cr,n .. . ŷr (k + n) u(k) u(k + 1) .. . u(k + n − 1) + Bdr,n dr (k) dr (k + 1) .. . dr (k + n − 1) (A.2) 123 124 Appendix A. Time-varying state-space model over prediction horizon The prediction matrices of Ar,n , Bu,r,n , Bd,r,n and Cr,n are also time-varying and given as: I Ar (k) Ar (k + 1)Ar (k) Ar,n = .. . Ar (k + n − 1)Ar (k + n − 2) · · · Ar (k) 0 0 ··· 0 Bu,r,n = Bd,r,n = Cr,n Bu,r (k) Ar (k+1)Bu,r (k) 0 Bu,r (k+1) ··· ··· .. . .. . .. 0 Bd,r (k) Ar (k+1)Bd,r (k) 0 0 Bd,r (k+1) ··· ··· ··· .. . .. . ... 0 0 . 0 Ar (k+n−1)···Ar (k+1)Bu,r (k) Ar (k+n−2)···Ar (k+1)Bu,r (k+1) ··· Bu,r (k+n−1) 0 0 0 0 Ar (k+n−1)···Ar (k+1)Bd,r (k) Ar (k+n−2)···Ar (k+1)Bd,r (k+1) ··· Bd,r (k+n−1) Cr 0 0 Cr = 0 0 0 0 0 0 0 · · · Cr ··· ··· ... Appendix B Combined water quantity and quality state-space model formulation The one dimensional water quantity and quality model is generally described by the Saint-Venant equations and the transport equation: ∂A ∂Q + = ql ∂t ∂x (B.1) ∂Q ∂Qv ∂η Q|Q| + + gA +g 2 =0 ∂t ∂x ∂x Cz RA (B.2) ∂Ac ∂Qc ∂ ∂c + = (KA ) + ql cl ∂t ∂x ∂x ∂x (B.3) According to Stelling and Duinmeijer [17] and Xu et al. [8], the equations for both water quantity and quality can be spatially discretized with staggered grids. A semi-implicit scheme is applied to the time integration for the SaintVenant equations, where the advection term in the momentum equation is explicitly discretized by first-order upwinding. The friction term is linearized by setting |Q| to explicit. The remaining terms use the implicit scheme. The time integration for the transport model is fully implicit. The water quantity and quality equations are solved through a tri-diagonal format: 125 126 Appendix B. Combined water quantity and quality state-space model formulation ā1,1 ā1,2 0 0 ā2,2 ā2,2 ā2,3 0 ... ... 0 0 0 āl,l−1 āl,l 0 −− −− −− −− 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ekη,i,1 ek η,i,2 .. . ekη,i,l + = I2l,2l − − −− ekc,i,1 ek c,i,2 .. . ek c,i,l | | 0 0 0 0 | 0 0 | 0 0 + −− −− | b̄1,1 b̄1,2 | b̄2,1 b̄2,2 ... | 0 | 0 0 c̄1,1 0 0 0 .. .. . . 0 0 0 c̄l,1 −− −− d¯1,1 0 0 0 .. .. . . 0 0 0 d¯l,1 0 0 0 0 −− 0 b̄2,3 ... b̄l,l−1 ek+1 0 η,i,1 k+1 e 0 η,i,2 .. . 0 k+1 eη,i,l 0 −− − − − − − 0 ek+1 c,i,1 k+1 0 e c,i,2 .. 0 . k+1 b̄l,l ec,i,l Qk+1 c,1 Qk+1 c,2 + I2l,2l dkη,i,1 dkη,i,2 .. . k dη,i,l −−− dkc,i,1 dkc,i,2 .. . k dc,i,l (B.4) ∆t k āi,i−1 = − ∆xW k Ai−1 f ui−1/2 t,i āi,i = 1 + ∆t k k (Ai−1 f ui−1/2 ∆xWt,i + Aki f ui+1/2 ) ∆t k āi,i+1 = − ∆xW k Ai f ui+1/2 t,i ∆t b̄i,i−1 = − ∆xA k k+1 k+1 Ki−1 Āi−1/2 ∆x i k+1 b̄i,i = 1 + k+1 k+1 K Ā +K ∆t ( i−1 i−1/2∆x i ∆xAki ∆t b̄i,i+1 = − ∆xA k( Kik+1 Āk+1 i+1/2 i c̄i,1 = ∆t k ,i ∆xWt,i =1 c̄i,2 = ∆t k ,i ∆xWt,i =l ∆x ) Āk+1 i+1/2 ) 127 d¯i,1 = ∆t (ck+1 in ∆xAki − cki ), i = 1 d¯i,2 = ∆t (ck+1 l ∆xAki − ckl ), i = l dη,i = ∆t k k (−Ai rui+1/2 ∆xWt,i k + ql,i ), i = 1 dη,i = ∆t k k (Ai−1 rui−1/2 ∆xWt,i k − Aki rui+1/2 + ql,i ), i = 2, 3, . . . , l − 1 dη,i = ∆t k k (Ai−1 rui−1/2 ∆xWt,i k ), i = l + ql,i dc,i = k+1 k+1 k+1 k+1 ∗ k+1 ∆t Kin Ai ∗ k k k k (ck+1 [ k in − c ) + ql,i (cl,i − ci ) + Qi+1/2 ci − Qi+1/2 ci+1/2 ], i ∆x ∆xAi =1 k+1 k+1 k+1 ∗ k+1 k+1 ∗ k+1 ∆t k k k k dc,i = ∆xA k [ql,i (cl,i −ci )+(Qi+1/2 −Qi−1/2 )ci −(Qi+1/2 ci+1/2 −Qi−1/2 ci−1/2 )], i = i 2, 3, . . . , l − 1 dc,i = ∆t [q k (ck ∆xAki l,i l,i k+1 ∗ k+1 k − cki ) − Qk+1 i−1/2 ci + Qi−1/2 ci−1/2 ], i = l ( where ∗ ci+1/2 = ci (Qk+1 i+1/2 ≥ 0) ci+1 (Qk+1 i+1/2 < 0) where c∗ is the concentration target value, Kin and cin are the dispersion coefficient and concentration of the incoming water. Note that cin uses the outflow concentration of the upstream reach if the reach in concern is not the first one. All the variables at time step k + 1 in the above matrices are calculated through a “Forward Estimation” procedure. g∆t f ui+1/2 = ∆x(1 + g rui+1/2 = − Āk 1 ( i+1/2 k −Q̄k ∗ v k Q̄ki+1 ∗ vi+1 i i ∆x where: = Qki+1/2 +Qki−1/2 2 , Āki+1/2 = Cz2 R k + vi+1/2 1+g Q̄ki k |vi+1/2 | ) Q̄ki+1 −Q̄ki ) ∆x k + vi+1/2 k |vi+1/2 | Cz2 R Aki+1 +Aki , 2 ∗ vi = vi−1/2 (Q̄ki ≥ 0) vi+1/2 (Q̄ki < 0) 128 Appendix B. Combined water quantity and quality state-space model formulation Appendix C Reduced model verification using extrapolated scenario of lateral flows In section 4.4, the reduced model is verified using the interpolated scenario of lateral flows and it achieves good model accuracy. However, it is also important to verify the model according scenario extrapolation. Table C.1 provides the verification scenario and Figures C.1, C.2 and C.3 show the reduced model accuracy using the extrapolated scenario. Figure C.1: Root mean square error of the reduced model on water quantity and quality (extrapolated scenario) 129 130 Appendix C. Reduced model verification using extrapolated scenario of lateral flows Table C.1: Lateral flow scenario for reduced model verification (step changes happen between 5 and 8 hours of the simulation Lateral 1 Lateral 2 Lateral 3 Reach Discharge Concentration Discharge Concentration Discharge Concentration (m3 /s) (kg/m3 ) (m3 /s) (kg/m3 ) (m3 /s) (kg/m3 ) 0.02 to 0.10 1.0 to 1.8 0.03 to 0.11 1.2 to 2.0 No third lateral 0.02 to 0.10 1.2 to 2.0 0.03 to 0.11 1.4 to 2.2 No third lateral 0.04 to 0.12 0.9 to 1.7 0.02 to 0.10 1.5 to 2.3 0.03 to 0.11 1.8 to 2.6 0.02 to 0.10 1.5 to 2.3 0.04 to 0.12 1.0 to 1.8 No third lateral 1 2 3 4 131 Figure C.2: Reduced water level states (I) and concentration states (III) projected back to the original order, and the water level differences (II) and concentration differences (IV) between the reduced model and the original model 132 Appendix C. Reduced model verification using extrapolated scenario of lateral flows Figure C.3: Reduced water quantity disturbances (I) and quality disturbances (III) projected back to the original order, and the water quantity disturbance differences (II) and water quality disturbance differences (IV) between the reduced model and the original model Appendix D Linearization of hydraulic structures It is noticed that in all the cases, we used pump flows to represent hydraulic structures for simplicity. However, in many canals with gravity flows, weirs and gates are often used, while pumps are only used to lift water out of the system. Although weirs and gates are not used in this study, it is important to mention the possibility of applying these hydraulic structures to our case study. In general, weirs and gates can both create free flow and submerged flow, depending on the upstream and downstream water levels of the structure and the structure settings. These flow conditions can be described by the following equations [65] (assuming positive flow, namely upstream water level is higher than downstream water level. For negative flow, the same approach follows): r 3 2 2 g(hku − hcr ) 2 Free weir flow: Qk = Cg Wg 3 3 3 3 when hku − hg < dg k & hku − hg > (hkd − hkg ) 2 2 Submerged weir flow: Qk = Ce Cg Wg (hkd − hkg ) 3 when hku − hg < dg k 2 133 q 2g(hku − hkd ) (D.1) (D.2) 3 & hku − hg ≤ (hkd − hkg ) 2 134 Appendix D. Linearization of hydraulic structures q Free gate flow: Qk = Cg Wg µg (hkg − hcr ) 2g(hku − hcr + µg (hkg − hcr )) 3 when hku − hg ≥ dg k 2 k Submerged gate flow: Q = & hkd ≤ hcr + dg k ) (D.3) Cg Wg µg (hkg 3 when hku − hg ≥ dg k 2 q − hcr ) 2g(hku − hkd ) (D.4) & hkd > hcr + dg k ) where Ce is discharge coefficient [−], Cg is lateral contraction coefficient [−], Wg is the structure width [m], hu is the upstream water level of the structure, hd is the downstream water level of the structure [m], hcr is the crest level [m], hg is the gate lower edge level [m], dg is the height of gate opening [m], which equals hg − hcr , µg is the contraction coefficient, g is the gravitational acceleration and equals 9.81[m/s2 ], k is the time step. For discrete systems, the structure equations need to be discretized. In order to reach a stable condition with large time step which is normally the case in real-time control, implicit scheme is necessary as used in discretization of the Saint-Venant equations in this thesis. However, the structure formulas are nonlinear, the implementation of implicit scheme will destroy the linear formulation of the internal model in MPC. In order to keep the linearity of the model formulation, first order Taylor expansion is applied to the structure equations. This is expected to be working well, but further investigation is required. The Taylor expansion if the structure formulas are as follows: Free weir flow: r k+1 Q k = Q + Cg Wg 2 g(hku − hcr )(hk+1 − hku ) u 3 (D.5) Submerged weir flow: Ce Cg Wg (hkd − hkg ) k+1 p (hu − hku ) k k 2g(hu − hd ) q hkd − hkg + Ce Cg Wg ( 2g(hku − hkd ) − p )(hk+1 − hkd ) d k k 2g(hu − hd ) q − Ce Cg Wg 2g(hku − hkd )(hk+1 − hkg ) g Qk+1 = Qk + (D.6) 135 Free gate flow: k+1 Q gCg Wg µg (hkg − hcr ) k =Q +q (hk+1 − hku ) u k k 2g(hu − (hcr + µg (hg − hcr ))) q + Cg Wg µg ( 2g(hku − (hcr + µg (hkg − hcr ))) (D.7) Ce Cg Wg (hkd − hkg ) −q )(hk+1 − hkg ) g k 2 k 2g(hu − (hcr + µg (hg − hcr ))) Submerged gate flow: gCg Wg µg (hkg − hcr ) k+1 p (hu − hku ) k k 2g(hu − hd ) gCg Wg µg (hkg − hcr ) k+1 (hd − hkd ) − p k k 2g(hu − hd ) q + Cg Wg µg 2g(hku − hkd )(hk+1 − hkg ) g Qk+1 = Qk + (D.8) 136 Appendix D. Linearization of hydraulic structures List of Symbols Symbol Af A An Ar Ar,n As Bd Bd,n Bd,r Bd,r,n Bu Bu,n Bu,r Bu,r,n C Cr Cr,n Cz CR D H HL Hf Hm I J Description Unit cross-sectional area system matrix system matrix over the prediction horizon reduced system matrix reduced system matrix over the prediction horizon surface area disturbance matrix disturbance matrix over the prediction horizon reduced disturbance matrix reduced disturbance matrix over the prediction horizon control input matrix control input matrix over the prediction horizon reduced control input matrix reduced control input matrix over the prediction horizon output matrix reduced output matrix reduced output matrix over the prediction horizon Chezy coefficient correlation matrix disturbance vector Hessian matrix Hessian matrix of the Lagrangian function L Hessian matrix of the objective function fo measurement matrix identity matrix Objective function 137 [m2 ] [−] [−] [−] [−] [m2 ] [−] [−] [−] [−] [−] [−] [−] [−] [−] [−] [−] 1 [m 2 /s] [−] [−] [−] [−] [−] [−] [−] [−] 138 K Ki Kp Kp,η Kp,c L Lc LK M N P− P Pf Q Qc Qc,max Qc,min Qin Qout Qp Qp,max Qp,min ∆Qc,max ∆Qc,min QN R RN S Sb Tc U V W Wb Wt Wx Wx,η Wx,c Wr List of symbols dispersion coefficient integral gain factor proportional gain factor proportional gain factor on water level deviation from target proportional gain factor on concentration deviation from target Lagrangian function canal length Kalman gain number of snapshots number of states a priori posteriori wetted perimeter mean flow control flow maximum control flow minimum control flow inflow discharge outflow discharge pump discharge maximum pump flow minimum pump flow maximum control flow change minimum control flow change model noise covariance hydraulic radius measurement noise covariance search direction matrix bottom slope control time step input vector water volume mean width bed width top width penalty on states penalty on water level deviation from target penalty on concentration deviation from target penalty on reduced states [m2 /s] [−] [−] [−] [−] [−] [m] [−] [−] [−] [−] [−] [m] [m3 /s] [m3 /s] [m3 /s] [m3 /s] [m3 /s] [m3 /s] [m3 /s] [m3 /s] [m3 /s] [m3 /s] [m3 /s] [−] [m] [−] [−] [−] [s] [m3 /s] [m3 ] [m] [m] [m] [−] [1/m2 ] [(m3 /kg)2 ] [−] List of symbols Wx,n Wu Wu,n ∗ Wu,c X Y YL a b c cl cin cout d dm dr eη ê ec e∗c f fm fo fu g gc gf gL h k kd l m m1 m2 me n 139 penalty on states over the prediction horizon [−] penalty on control input [(s/m3 )2 ] penalty on control input over the prediction horizon [(s/m3 )2 ] penalty on virtual input [−] state matrix [−] output matrix [−] gradient of the first order derivative of the Lagrangian function [−] function of variables [−] function of variables [−] concentration [kg/m3 ] lateral concentration [kg/m3 ] inflow concentration [kg/m3 ] outflow concentration [kg/m3 ] disturbance [−] mean water depth [m] reduced disturbance [−] water level deviation from target [m] water level deviation from target after Kalman filter [m] average concentration deviation from target [kg/m3 ] virtual input [−] Jacobian matrix [−] model function [−] objective function [−] linearization factor in discretized Saint-Venant equations [−] gravitational acceleration [m/s2 ] constant matrix [−] constant matrix [−] constant matrix [−] constraint function [−] time step index [−] number of delay steps [−] number of spatial increment [−] total number of constraints [−] number of reduced states [−] number of reduced disturbances [−] number of equality constraints [−] prediction horizon [−] 140 niter n̂iter nr nu ql ru s t t1 t2 ∆t u us v wmeas wmodel x x̂ x̂r ∆x y yr ym yt ytarget z zr Φ1 Φ2 Ψ1 Ψ2 Λ M α β τ τw η ε σ1 List of symbols number of iterations average number of iterations number of canal reaches number of control inputs lateral flow linearization factor in discretized Saint-Venant equations search direction time initial time final time time step control input shear velocity mean velocity measurement noise model noise state Kalman state reduced Kalman state spatial increment output reduced output measured output controlled water level target water level snapshot vector reduced snapshot vector basis function matrix of states basis function matrix of disturbances orthogonal matrix with Φ1 orthogonal matrix with Φ2 lagrange multiplier matrix on equality constraints lagrange multiplier matrix on inequality constraints coefficient side slope delay time shear stress water level above reference level initial model error standard deviation of measurements [−] [−] [−] [−] [m2 /s] [−] [−] [s] [s] [s] [s] [m3 /s] [m/s] [m/s] [−] [−] [−] [−] [−] [m] [−] [−] [−] [m] [m] [−] [−] [−] [−] [−] [−] [−] [−] [−] [−] [s] [N/m2 ] [m] [m] [m] List of symbols σ2 δ λ µ φ 141 standard deviation of the model perturbation lagrange multiplier on an equality constraint lagrange multiplier on an inequality constraint eigenvector of the kernel matrix [m] [−] [−] [−] [−] 142 List of symbols Acknowledgements Finalizing PhD work is not an easy task. It needs complete support from both academic side and the family side. I am sincerely appreciated for all the help I had during my PhD progress. I thank Dr. Peter-Jules van Overloop. It sounds weird to call such a good friend like this. Although it needs to be formal, I’d rather use PJ here. I am very appreciated for all the careful supervisions you gave. I enjoyed the moments discussing scientific research with you. You inspired me by some of your ’crazy’ ideas and the way working towards them, although I am not completely agree with you sometimes. Meanwhile, you are also an excellent friend for sharing life experience. Thank you for bringing me to different Dutch occasions, getting to know your families and friends, and introducing the real Dutch life. I still remember the night with your band playing at a bar in your hometown Bergen op Zoom till 3am. It was great fun. I thank Prof. Nick van de Giesen for giving me the opportunity to continue the PhD study. Thank you for giving me your concrete support and the complete freedom to develop myself not only in the research but also for social activities. Your trust pushes me to work towards the target. I am even more appreciated for allowing me to work at Deltares without finalizing my PhD dissertation. I thank the committee for spending their valuable time on reading my dissertation and giving comments for the improvements. I thank Dr. Rudy Negenborn. It was a great pleasure to work with you on an article. Your attitude and the way of thinking and performing in scientific research gave me a deep impression. Looking forward to cooperating with you again in the future. Of course, I won’t forget Betty Rothfusz, the kind and beautiful secretary who helped to arrange everything during my PhD study. I thank all the colleagues at TUDelft. It was great fun to work and play together with 143 144 Acknowledgements you. I thank Deltares, the company where I am working. Thank you for admitting my expertise before I get my PhD degree and give me space to finalize my PhD work. Family is always important. Only with the full family support, I can finalize the PhD research. Thank you my dear wife Bai Yuqian. As you said that marrying with you is my most wise decision ever in my life, I agree with you! Your love and encouragement give me the best support. Thank you for your understanding and allowing me to work even in the weekend. More important, thank you for giving me the best “gift” in my life: our son, Xu Jiayue. Hey, little man. You are my hero. Your smile, naive, naughty and cry drag all my tiredness away and keep me fresh. Love you forever! I thank my father. Only when I became the father of Jiayue, I fully realized the responsibility of being a father. Thank you for your understanding and support. To my mom in the heaven. It’s a pity that you can’t be with us to enjoy such a moment that you were looking forward to. But I can feel your existence and you are always with us. Somehow, I can feel you are smiling in the sky looking at me. Please bless us! About Author Min Xu was born on October 29, 1981 in Suzhou China. He came to the Netherlands in 2005 after his Bachelor at Hohai University. He studied water management in Delft University of Technology majoring in operational water management. During his master, he was a student assistant for half year. He conducted an internship at Friesland water board for rainfall-runoff modeling and damage calculation. His graduation project was together with USDA. He spent 3 months in Arizona to model an irrigation canal and build up the control system to balance the water mismatches in the canal. The master project was completed in 2007. In November 2007, Min Xu started his PhD research at Delft University of Technology. The PhD research was an extension of his study interest in operational water management, specifically with model predictive control (MPC). His PhD mainly focused on the application of real-time control to the combined surface water quantity and quality control. Moreover, computational accuracy and efficiency was another interest of his study. He developed a control procedure for MPC with the reduced model to balance the control effectiveness and computational time. Besides his PhD research topic, Min Xu is also interested in other water management fields, such as numerical modeling, flood protection, river or canal network control, sewer system control. Before finishing his PhD, Min Xu received a job position at Deltares in the unit of Inland Water System. He became an adviser and researcher in the department of operational water management. His main focus is on flood forecasting and real-time control. Moreover, this position also provides a great platform to expand the knowledge of water management in other fields. 145 146 About Author Publications Journal papers 1. Xu. M., van Overloop. P.J. and van de Giesen. N.C. Model reduction on model predictive control of combined water quantity and quality. Environmental Modelling & Software. 2012. (Accepted) 2. Xu. M., Negenborn. R.R., van Overloop. P.J. and van de Giesen. N.C. De Saint-Venant equations-based model predictive control of open channel flow. Advances in Water Resources. Volume 49:37-45, 2012. 3. Xu. M., van Overloop. P.J. and van de Giesen. N.C. On the study of control effectiveness and computation efficiency of reduced SaintVenant model in model predictive control of open channel flow. Advances in Water Resources. Volume 34(2):282-290, 2010. 4. Xu. M., van Overloop. P.J., van de Giesen, N.C. and Stelling. G.S. Real-time control of combined surface water quantity and quality: polder flushing. Water Science and Technology. 61(4):869-878, 2010. Conference papers 1. Xu. M. and Schwanenberg. D. Comparison of sequential and simultaneous model predictive control of reservoir systems. In the Proceedings of the 10 th International Conference on Hydroinformatics, HIC 2012. Hamberg, Germany, HIC2012-0272, 2012. 2. Schwanenberg. D., Ochterbeck. T., Gooijer. J., Xu. M. and van Heeringen. K. Model predictive control of pumps and gates for draining dutch polder systems. In the Proceedings of the 10 th International Con147 148 Publications ference on Hydroinformatics, HIC 2012. Hamberg, Germany, HIC20120058, 2012. 3. Xu. M., van Overloop. P.J. and van de Giesen. N.C. Model selection for salt water intrusion in delta areas. In the Proceedings of the 25 th ICID European Regional Conference. Groningen, the Netherlands, Paper II-17, 2011. 4. Xu. M. and van Overloop. P.J. On the Application of model reduction in model predictive control of open channel flow. In the Proceedings of the 9 th International Conference on Hydroinformatics, HIC 2010. Tianjin, CHINA, Volume 3:2169-2177, 2010. 5. Xu. M., van Overloop. P.J., Schielen. R.M.J. and Havinga. H. Model predictive control of discharge distribution of the Rhine river in the Netherlands. In the Proceedings of the NCR Publication. Dalfsen, the Netherlands, 52-53, 2008. Abstract 1. Xu. M. and van Overloop. P.J. Model predictive control on irrigation canals, application on the Central Main Canal in Arizona. EGU Geophysical Research Abstracts. Vol. 10:EGU2008-A-00000, 2008.

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

Download PDF

advertisement