scieee AI-readable full text Open interactive document viewer

Predictive control with dynamic constraints for closure and opening operations of irrigation canals

Galvis Restrepo, Eduard

Abstract

Water delivery systems usually work in continuous way based on some prescribed flow conditions and user's needs . However there are situations in which abrupt changes in the operating conditions must be carried on. Typical examples are the alternative closing of a canal system during the non-demand periods to save water for other purposes as energy production, and the closure of a canal due the danger of water pollution in the supplier river. Closure of a canal means setting zero flow conditions by closing the gates along the canal, while maintaining specific water levels under the maximum allowed value. The closure operation requires a progressive and well planned set of actions to avoid overtopping and cracking in the canal lining, which can involve both economic and environmental issues. The opening operation involves restarting the canal to its normal operating condition from zero flow condition. This thesis is devoted to develop a supervised decentralized predictive control strategy for solving the problems related to the closure and opening operations of canal systems. The evaluation is fulfilled by means of numerical simulation on two cases of study in a variety of operating scenarios. The strategy is also experimentally validated through real-time implementation in a laboratory canal available in the Technical University of Catalonia (canal PAC-UPC). The control strategy has been developed in a two-level architecture: (i) a set of individual decentralized downstream water level predictive controllers, which are formulated via an optimal control problem under dynamic constraints and implemented by upstream local gates; and (ii) a supervising level to achieve the compromise of fast execution with smooth gate trajectories and water level regulation, even in the presence of disturbances. The simulation and real-time implementation scenarios have demonstrated that the proposed strategy is convenient for closure and opening of irrigation canals. Problems presented when the canal closure operations are not managed properly, such as overtopping, have been avoided in all the scenarios.

Full text

1 UNIVERSITAT POLITÈCNICA DE CATALUNYA Doctoral Programme: AUTOMATIC CONTROL, ROBOTICS AND COMPUTER VISION Doctoral Dissertation Predictive Control with Dynamic Constraints for Closure and Opening Operations of Irrigation Canals Eduard Galvis Restrepo Supervisors: José Rodellar Benedé Manuel Gómez Valentín November, 2015 2 i Abstract Water delivery systems usually work in continuous way based on some prescribed flow conditions and user’s needs. However there are situations in which abrupt changes in the operating conditions must be carried on. Typical examples are the alternative closing of a canal system during the nondemand periods to save water for other purposes as energy production, and the closure of a canal due the danger of water pollution in the supplier river. Closure of a canal means setting zero flow conditions by closing the gates along the canal, while maintaining specific water levels under the maximum allowed value. The closure operation requires a progressive and well planned set of actions to avoid overtopping and cracking in the canal lining, which can involve both economic and environmental issues. The opening operation involves restarting the canal to its normal operating condition from zero flow condition. This thesis is devoted to develop a supervised decentralized predictive control strategy for solving the problems related to the closure and opening operations of canal systems. The evaluation is fulfilled by means of numerical simulation on two cases of study in a variety of operating scenarios. The strategy is also experimentally validated through real-time implementation in a laboratory canal available in the Technical University of Catalonia (canal PAC-UPC). The control strategy has been developed in a two-level architecture: (i) a set of individual decentralized downstream water level predictive controllers, which are formulated via an optimal control problem under dynamic constraints and implemented by upstream local gates; and (ii) a supervising level to achieve the compromise of fast execution with smooth gate trajectories and water level regulation, even in the presence of disturbances. The simulation and real-time implementation scenarios have demonstrated that the proposed strategy is convenient for closure and opening of irrigation canals. Problems presented when the canal closure operations are not managed properly, such as overtopping, have been avoided in all the scenarios. ii iii Resumen Los canales de riego usualmente trabajan en forma continua bajo unas condiciones de flujo prescritas y acorde a las necesidades de agua de los usuarios. Sin embargo hay situaciones en las cuales se presentan cambios abruptos en las condiciones de operación. Un típico ejemplo es la alternativa de cierre durante los periodos de inactividad de los regantes. Dicho cierre tiene por objeto el ahorro de agua para otros propósitos, como puede ser la produccion de energía. Otro ejemplo es la necesidad de cierre de un canal ante la presencia de un vertido de contaminantes aguas arriba en la fuente abastecedora de agua. El cierre de un canal requiere cerrar de forma progresiva y suave las compuertas de todo el canal, evitando desbordamientos y manteniendo unos calados de seguridad en los diferentes tramos del canal hasta llegar a una condición de caudal cero. La violación de los calados máximos puede producir inundaciones y pérdidas de agua innecesarias. La reducción de los niveles de agua por debajo de los calados mínimos permitidos puede causar daños en la estructura física del canal. Esta tesis se centra en el desarrollo de una estrategia de control predictivo descentralizado supervisado para gestionar de forma automática las operaciones de cierre y apertura de canales de riego. La evaluación de la estrategia se lleva a cabo mediante la simulación numérica en dos casos de estudio. Dicha evaluación se completa mediante experimentos en tiempo real realizados en un canal de laboratorio existente en la Universitat Politècnica de Catalunya (canal PAC-UPC). La estrategia de control se ha desarrollado con una arquitectura de dos niveles: (i) un conjunto de controladores individuales descentralizados para el control de niveles de aguas abajo, cuya formulación se plantea como un problema de control óptimo con restricciones dinámicas; y (ii) un nivel de supervisión encargado de alcanzar el compromiso de una ejecución rápida del proceso de cierre (o apertura) con movimientos suaves de compuerta y de una regulación de los niveles de agua dentro de los márgenes de consigna, incluso en presencia de perturbaciones. Tanto los escenarios de simulación como los de implementación en tiempo real, han demostrado que la estrategia propuesta en esta tesis es satisfactoria para operaciones de cierre y apertura de canales de riego. En efecto, la estrategia de control ha sido capaz de evitar problemas, como por ejemplo el desbordamiento, que se presentan cuando la operación de cierre de un canal no se realiza adecuadamente. iv v Contents 1 Introduction .............................................................................................................................. 1 1.1 Motivation ........................................................................................................................ 1 1.2 Thesis objectives ............................................................................................................... 5 1.3 Outline of the dissertation ................................................................................................. 6 2 Control of irrigation canals ...................................................................................................... 7 2.1 Irrigation systems ............................................................................................................. 7 2.2 Concepts related to the automation of irrigation systems ................................................. 8 2.2.1 Control system architecture ....................................................................................... 9 2.2.2 Open-loop and closed-loop control ......................................................................... 10 2.2.3 Canal control concepts: Upstream control vs. Downstream control ....................... 11 2.2.4 Centralized and decentralized control ..................................................................... 11 2.3 Literature review ............................................................................................................. 12 2.3.1 Types of Automatic control applied on irrigation canals ........................................ 12 2.3.2 Control of canals under large change in operating condition .................................. 16 2.4 Predictive control essentials ........................................................................................... 17 2.5 Final remarks .................................................................................................................. 20 3 Description and numerical simulation of case studies ........................................................... 21 3.1 Introduction .................................................................................................................... 21 3.2 Laboratory canal PAC-UPC ........................................................................................... 21 3.3 Ebro River Left Bank canal (ERLB Canal) .................................................................... 26 3.4 Models of irrigation canals ............................................................................................. 28 3.5 Numerical models of the case studies ............................................................................. 31 3.5.1 Numerical model of the canal PAC UPC ................................................................ 31 vi 3.5.2 Numerical model of the Ebro River Left Bank canal .............................................. 32 3.6 Model of canals for control purposes ............................................................................. 33 3.6.1 Parametric model of the canal PAC UPC ............................................................... 34 3.6.2 State-space model of the canal PAC UPC .............................................................. 38 3.6.3 IDZ model of the Ebro River Left Bank canal ........................................................ 40 3.7 Final remarks .................................................................................................................. 42 4 Management practices involving closure and opening operations ........................................ 45 4.1 Introduction .................................................................................................................... 45 4.2 Management practices involving closing and opening operations ................................. 46 4.2.1 Night closure to save water ..................................................................................... 46 4.2.2 Night closure in rotational delivery systems ........................................................... 47 4.2.3 Canal closure on weekends ..................................................................................... 47 4.2.4 Emergency plan ....................................................................................................... 47 4.2.5 On demand partial closure ....................................................................................... 48 4.2.6 Opening operation ................................................................................................... 48 4.3 Drawbacks associated to closure operation .................................................................... 49 4.3.1 Cracking in the canal lining .................................................................................... 49 4.3.2 Overtopping ............................................................................................................. 50 4.4 Feasibility of closure operation ...................................................................................... 50 4.5 Manual closure simulation results in the cases of study ................................................. 52 4.5.1 Manual closure of the canal PAC-UPC ................................................................... 52 4.5.2 Manual closure of the Ebro River left bank canal ................................................... 58 4.5.3 Discussion of the simulation results ........................................................................ 62 4.6 Conclusion ...................................................................................................................... 64 5 Predictive control with dynamic constraints in canal automation ......................................... 65 5.1 Introduction .................................................................................................................... 65 5.2 Overall control strategy .................................................................................................. 67 5.2.1 Basic objective ........................................................................................................ 67 5.2.2 Controller architecture: supervised control ............................................................. 68 5.3 Local water level predictive controllers ......................................................................... 70 5.3.1 Unconstrained Predictive Control ........................................................................... 70 5.3.2 Predictive control with constraints .......................................................................... 76 5.3.3 Predictive control with dynamic constraints ........................................................... 80 5.4 Supervised decentralized predictive control (SDPC) ..................................................... 83 vii 5.5 Computational implementation ...................................................................................... 85 5.6 Concluding remarks ........................................................................................................ 86 6 Simulation and real-time results ............................................................................................ 87 6.1 Introduction .................................................................................................................... 87 6.2 Simulation results in the case studies ............................................................................. 87 6.3 Simulation of water level control at canal PAC-UPC .................................................... 89 6.3.1 Control objective and operating scenarios .............................................................. 89 6.3.2 Implementation issues ............................................................................................. 90 6.3.3 Results ..................................................................................................................... 91 6.3.4 Discussion of results ................................................................................................ 96 6.4 Simulation of water level control at Ebro River left bank (ERLB) canal ...................... 98 6.4.1 Control objective and operating scenarios ............................................................ 100 6.4.2 Open-loop and closed-loop predictive control applied on the ERLB canal .......... 101 6.4.3 Results ................................................................................................................... 103 6.4.4 Discussion of the results ........................................................................................ 123 6.5 Real-time implementation of supervised decentralized predictive control on the laboratory canal ....................................................................................................................... 124 6.5.1 Real-time control ................................................................................................... 125 6.5.2 Water level control at canal PAC-UPC ................................................................. 127 7 Conclusions and future research .......................................................................................... 133 7.1 Summary and general conclusions ............................................................................... 133 7.2 Contributions of this thesis ........................................................................................... 135 7.3 Future research ............................................................................................................. 136 7.4 Publications derived from this thesis ............................................................................ 137 References ................................................................................................................................... 139 Appendix A .............................................................................................................................. 149 xv Nomenclature 𝐴 wetted cross sectional area a slope of the sigmoidal curve 𝐵 width of the weir 𝐵𝑝𝑧 width of the permitted zone during a close/opening operation 𝐶𝑑𝑓 gate coefficient 𝑒𝑗 signal error 𝑔 gravity acceleration 𝐻𝑒 head over the weir J cost function k present sampling instant L gate opening q shift operator Q discharge 𝑄𝑖 input discharge 𝑄𝑖+1 output discharge m Q maximum discharge 𝑄𝑤𝑖 lateral discharge 𝑅 weighting factor matrix xvi 𝑅𝑤 tuning parameter for the desired closed-loop performance 𝑆0 bottom slope 𝑆𝑓 friction slope SP set point 𝑇𝑠 sampling time 𝑢(𝑘) control variable 𝑉 volume of the pool, 𝑤(𝑘) disturbance signal 𝑥𝑚𝑖 state vector of the i-th pool 𝑦𝑠𝑝 water level setpoint. 𝑦(𝑘) output variable 𝑦𝑟 reference trajectory 𝑦𝑘 measured output at instant 𝑘. 𝑦𝑖∗ desired final value of variable 𝑦𝑖 𝑦𝑠𝑝 water level setpoint. 𝛹 weighting factor matrix λ prediction horizon 𝜏𝑖 delay time ∆𝑢 incremental control variable ∆𝑦 predicted output ∆𝑦 predicted incremental output. 1. Introduction 1 1 Introduction Chapter 1 Introduction 1.1 Motivation Current environmental and economic challenges require real commitment with the modernization of the irrigation canals facilities. Crop irrigation demands 70% of all freshwater worldwide and if current trends continue it is estimated that two out of three people will be affected by the lack of freshwater sources by 2025 (UN, 2006). Many irrigation projects throughout the world built decades ago are inefficient in terms of water and energy use and they are in urgent need of modernization (Hervé, 2002). A need exists for improving the operational efficiency and flexibility in the water supply. Efficiency means increasing the volume ratio of water used on crops with respect to the volume of water removed from fresh water sources (e.g. rivers, streams, lakes, reservoirs). Flexibility is related to deliver water to users in time, frequency and duration as required. There are three main delivery concepts in water conveyance systems (Buyalski et al., 1991):  Rotation: users share a constant water supply, while cooperating with other water users to establish the time and quantity of delivery.  Scheduled: a notification of delivery time and quantity is required in advance, whereby water users are limited to contractual water allotment on a daily, monthly and yearly basis.  Demand: unrestricted use of the available water supply with limitations only on maximum flow rate and total allotment. 1. Introduction 2 Water conveyance system is constructed to convey water from one place to another to accomplish functions such as irrigate agricultural land, municipal/industrial expansion or for energy production (Buyalski et al., 1991). Water conveyance systems are mainly composed by a main canal, secondary canals, reservoirs, check structures, canal pumping plants, weirs and turnouts, among others. A single canal is usually divided into pools, whose boundaries are defined by the presence of gates. Traditionally, check structures used on irrigation canals are operated manually based on the canal staff skills and experience. This type of canal management has several drawbacks:  Low efficiency in terms of delivered water versus water taken from the source (Litrico, 1999).  No operator is able to manage the interaction between all the parameters of a complex system such as a canal divided into several pools. Measurements and readings may be imprecise or even falsified by operators (Goussard, 1993).  Large waters losses (Rivas et al., 2007).  Manual operation cannot react against unforeseen changes, for instance, when farmers start to take water or a rain event (Horváth, 2013). On the other hand, apart from irrigation, there are other important and necessary operations in canal management such as the closure and the opening of a canal facility. These are challenging management tasks because they can cause problems such as overtopping and cracking in canal lining. Overtopping is produced when the water level exceeds the top of canal bank, caused by the transient waves that bounce back iteratively when gates are closed. Cracking or structural damage sometimes occurs by reason of the pressure that the concrete canal lining is subject due to the sub-pressure effect of outside water when either the canal is emptied or the water level decreases considerably. In general, the following elements are required to design and implement a canal control system in the field:  A control strategy that can cope with irrigation canal management problems and fulfill water level regulation requirements (Sepúlveda, 2008).  A good dynamical model of the canal to design, analyze and simulate control strategies.  A controller (e.g. Programmable Logic Controllers (PLC), embedded systems or even general-purpose computer systems).  Instrumentation / data acquisition system to measure relevant variables and to operate gates. The instrumentation elements include sensors (water levels gauges and flow meters) and actuators (valves, servomotors, etc.), among others. The design of a control system for canal regulation is a complex task with challenging problems. Canals are distributed over long distances with significant time delays. However, despite the complexity in the design and implementation of control algorithms, automation offers a solution to improve the water delivery service and get a better water conveyance efficiency (an estimated 1. Introduction 3 30% to 60%) in the global management of irrigation canals. Some advantages of automatic canal compared to conventional method are (Buyalski et al., 1991):  Achieve operational flexibility when simultaneous information on the entire system is known.  Immediate response to sudden and unforeseen variances in canal side diversion or to storm runoff flooding into the canal.  Flexibility to adjust discharges through the system on a daily or an hourly basis.  Problems like overtopping can also be avoided. From the automatic control point of view, controlled variables are usually water levels, discharges or water volumes. Control action variables are gate opening or discharges under gates (another algorithm transforms discharge into gate position). In order to achieve quality of service, water levels should be maintained at reference setpoints, calculated on the basis of demand. It is also important to avoid fluctuations from setpoints, which translate into flow fluctuations at turnout checkpoints (Cantoni et al., 2007). The disturbances in the system are mainly as a result of turnouts variations, which are located typically at downstream part of each pool. During the last 30 years, the research community has focused on control methods to improve the operational management of water conveyance systems, ranging from early classical feedback and feedforward control structures (Burt, 1999), (Burt and Piao, 2002) and (Clemmens et al., 2005), to more recent implementations of advanced control methods like predictive control (van Overloop et al., 2010) and (Aguilar et al., 2012). While there is an extensive literature on automatic control of canals in standard operation scenarios (see Chapter 2 for a literature review), the problems of canal closure and opening, which imply abrupt changes between different operation regimes, have received much less attention. Some references on the subject are (De Bievre et al., 2003), (Ghumman et al., 2009) and (Soler et al., 2010), including the recent work of an optimal predictive open-loop control of a 15 km length-canal for an emergency closure operation in (Soler et al., 2014). Irrigation systems usually work in a continuous way around some prescribed flow operating conditions and users needs. An operating regime is determined mainly by the discharge along the canal. Gate movements affect both upstream and downstream water levels (𝑦1 and 𝑦2), as illustrated in Figure 1.1 for a heading gate in a canal section. The discharge under the gate (Q) affects the levels as follows: 𝑄=𝐶𝑑𝑓𝐵𝐿√2𝑔(𝑦1−𝑦2) (1.1) where 𝐶𝑑𝑓 is the gate coefficient, B is the width of the gate, L is the gate opening and 𝑔 is the acceleration of gravity. In a multireach canal, gate movements induce couplings among the reaches and therefore changes in operating conditions require efficient control strategies. This requirement is particularly stringent in scenarios where abrupt changes in the operating conditions must be carried out. 1. Introduction 4 Figure 1.1 Sluice gate Canal closure is a main example of such scenario, in which the operation must drive the canal from a baseline regime to setting zero discharge conditions by closing all the gates along the canal. Conversely, the opening operation means restarting the operating discharge from zero. Typical closures (and the corresponding reverse opening operations) may be required in circumstances such as: non-demand water periods; emergency situations in primary or secondary canals due to pollutants flowing along the supplier river; corrective or preventive maintenance of check structures or canal lining; and others. Due to the couplings among canal pools, decreasing the discharge by means of closing the gates affects directly the controlled water levels in adjacent pools. Meanwhile, during the closure operation, water levels must keep within specified maximum and minimum values. Indeed, it is recommended to leave enough water level safeguards to avoid problems such as overtopping and cracking in canal lining by cause of subpressure effects. Consequently, a specific goal is to move the gates as smooth as possible. However, this goal is conflicting with the fact that feasibility of closure operation depends on the closing velocity. For instance, night closure must be as faster as possible to make it feasible and, clearly, emergency situations are particularly demanding. In summary, these operational requirements are very challenging and almost impossible to achieve using local manual control methods for canal systems management. The literature on this topic is scarce and, to the best of our knowledge, there is no practical implementation of automatic controllers for closure operation to date. The aim of this thesis is to contribute with new developments in canal automation to satisfy the requirements of the problem of closure and opening. Based on the strengths of predictive control and previous experiences of the research group, this methodology is adopted as the theoretical control background. 1. Introduction 5 1.2 Thesis objectives The overall objective is to develop a predictive control strategy with dynamic constraints for closure and opening operation of irrigation canals, which will be efficient in terms of designing feasible gate trajectories (compromise between smoothness of gate excursions and overall time for operation completion), while keeping water levels within prescribed bounds. The following specific objectives are proposed to reach the overall goal and serve as roadmap in the developments:  To define two case studies as benchmarks for numerical and experimental testing. One is an experimental facility, the laboratory canal PAC-UPC. New instrumentation and acquisition and control tools are designed in this work to facilitate closing and opening automatic operations. The other one is a main canal of the left bank of the river Ebro, which is numerically simulated via a state of art computational code.  To perform a study about the problem of closing and opening the benchmark canals, considering different manual operations. The interest is twofold: (1) learning significant issues and difficulties that arise when check structures are required to get completely closed; and (2) getting practical inputs for the automatic control design.  To develop a predictive control strategy for closure and opening of irrigation canals. The strategy includes optimization under dynamic constraints, a decentralized control architecture and a supervising scheme to achieve the compromise of fast execution with smooth gate trajectories and water level regulation even in the presence of disturbances.  To validate the control methodology by means of numerical simulation on the two cases of study in a variety of operating scenarios. This includes comparisons of the performance with respect to the use of open-loop control of gate trajectories.  To experimentally validate the methodology in the laboratory canal PAC-UPC. 1. Introduction 6 1.3 Outline of the dissertation The dissertation is organized in seven chapters, this Introduction being the first one, where motivation and objectives have been stated. Chapter 2 reviews concepts related to irrigation canal management and control and presents a review on relevant literature. Chapter 3 introduces the two case studies used to test the control strategy proposed in this dissertation, the experimental platform canal PAC-UPC and the main canal of the Ebro river left bank canal. Numerical simulation schemes are presented based on solving the Saint Venant equations and linear models are derived to serve as background in the formulation of the control strategy. Chapter 4 discusses relevant hydraulic issues encountered in water conveyance canals under closure needs and presents the results of manual closures of the benchmark canals, which serve as motivation and learning prior to the automatic control design and implementation. Chapter 5 develops the methodology to design a predictive control with dynamic constraints for irrigation canal automation, which is the core of this thesis. Chapter 6 describes the assessment of the control methodology on both cases of study, first using the numerical simulation schemes. In a second step, experimental results are presented for the laboratory canal available in UPC. Finally, Chapter 7 presents the conclusions, summarizes the main contributions and gives some suggestions for future research. 2. Control of irrigation canals 7 2 Control of irrigation canals Chapter 2 Control of irrigation canals 2.1 Irrigation systems A system of irrigation canals transports water from its source to the farmer fields. Irrigation is mainly used to assist the growing of agricultural crops during periods of inadequate rainfall. Typically, the system is a tree-shaped net of open canals and water flows downhill through the canals and enters the fields by gravity most of times. The main (or primary) canal taps water from the water source, which may be a river, a lake, a reservoir or groundwater. Water is then distributed by the smaller secondary canals to the tertiary canals which are even smaller. From these tertiary canals the water finally enters the fields where it will be used to irrigate a crop (Van den Bosch et al., 1992). Figure 2.1 shows a small dam on a river from which water is tapped and passes into the main canal. The water then passes into two smaller canals, and finally the fields are irrigated by siphons. Figure 2.1 Part of a small irrigation system (taken from (Van den Bosch et al., 1992)) 2. Control of irrigation canals 8 Canal system operation depends on check structures for depth and discharge management. An irrigation canal system is divided into pools and gates are usually the boundaries between canal pools, in this way the pools are located in a series configuration. From the hydraulics point of view, each pool has a unique response when the discharge through structures is changed. Physical parameters that influence the canal pool behavior are longitudinal bed slope, cross section size and shape, wall materials (surface roughness) and length (Clemmens, 2014). The check gates are the main control structure on an irrigation canal. Gates are mainly used to regulate water levels, to measure and control discharge, and to increase and regulate in-channel storage volumes (Buyalski et al., 1991). There are several types of gates, such as undershot and overshot gates. The undershoot gates are movable gates allowing water to flow under the gates, meanwhile, the overshot gates are movable gates allowing water to flow over them. Sluice gates can be divided into two main different types, vertical rising and wall-mounted. Examples of undershot gates are radial, vertically hinged and sluice gates. A line weir is a typical example of overshot gates. Hydraulically, the overshot gate is a moveable weir. Meanwhile, the sluice gates are made of either wooden or metal plate, these gates may be vertical or curve. The sluice gates slide in grooves in the sides of the canal. In this dissertation only sluice gates are considered in the proposed case studies. In the management of irrigation systems, one of the main goals is to guarantee the user’s required discharge. Additionally, it is necessary to keep the water depths constant in checkpoints along the canal in order to avoid problems such as cracking in the canal lining. In order to describe the hydraulics in the canal, a set of variables can be used such as water depth (downstream or upstream), volume of water in a pool or discharge through a structure. The water depth (or water level) is the vertical distance from the lower point of the canal section to the free surface. The manipulated variables may be either discharge or gate openings. The disturbances in the system are mainly caused by turnout variations (offtakes), infiltration from the canal or rainfall (intakes). The turnouts are located typically at downstream part of canal pools. Meanwhile, a strong rainfall into the canal can result in higher rates of water level changes. The system operational constraints are mainly related either to maximum/minimum available discharges or related to check gate limits. 2.2 Concepts related to the automation of irrigation systems Automatic control can improve the performance of the irrigation water delivery systems. The improvements are mainly related to the efficiency and the operational flexibility in the canal operation. The efficiency is the ratio of water volumes used in the irrigated fields to volume of water extracted from the available source. The flexibility is related to the capacity to give to the user the required discharge in time and quantity, with flexibility rather than restrictions over the time of water intake. Automation incorporates to the irrigation system, a control system that upgrades the conventional method of canal system operation. The control system is able to automatically operate check structures based on feedback information from the current state of the 2. Control of irrigation canals 15 space prediction model was derived from Saint Venant equations. According to results, the generalized predictive control was slightly sensitive to the magnitude and delay variation. In (Sawadogo et al., 1998) a centralized predictive control approach was used to control the automatic operation of gates of each pool in an irrigation canal; the designed controller considers explicitly the interactions among subsystems. Meanwhile, a predictive control with constraints was proposed by (Pages et al., 1998) for water management applications in France. On the other hand, (Akouz et al., 1998) showed simulation results about the centralized generalized predictive control (GPC) technique used to control the downstream water levels of the first three reaches of the ASCE canal test 2. The strategy demonstrated to compensate the time delay and to overcome the system nonlinearity. Other examples of predictive control strategies to control of irrigation canals in the last two decades can be found in (Rodellar et al., 1989), (Pages et al., 1998), (Gómez et al., 2002), (Wahlin, 2004) (van Overloop, 2006), (Begovich, et al., 2007), (Sepúlveda, 2008), (Mantecon et al., 2010), (Delgoda et al., 2012), (Horváth, 2013), (Álvarez et al., 2013), (Horváth et al., 2014a), (van Overloop et al., 2014) and (Horváth et al., 2015). Predictive control has demonstrated a positive performance when it has been implemented and tested in actual irrigation canals. An implementation of real-time control for eight-pools of the WM Canal at the Maricopa-Stanfield Irrigation and Drainage District (USA) was reported by (van Overloop et al., 2010). The results show that the water could be efficiently delivered to users with little deviations in the water level. However, the behavior of the system with known setpoint changes in water demand was not as effective as expected, thus the authors suggested to continue exploring in this area to take advantage of all the benefits of this control technique. Meanwhile, an implementation of adaptive predictive expert (ADEX) control of water levels in the Canal Imperial de Aragon, Spain was fulfilled by (Aguilar et al., 2012). The results showed that predictive control had a better performance than PI control in field tests related to both change in setpoint levels and disturbance rejection. In addition to nonlinear predictive control, there are some variants of predictive control, the most popular being adaptive predictive control, distributed model predictive control and predictive control based on multiple models. The following paragraphs describe briefly the application of these variants of predictive control to irrigation canals control. In adaptive predictive control, the predictive control is proposed within the framework of adaptive systems (Martín Sánchez & Rodellar, 1996). Adaptability plays an important role in practical applications such as control involving time delay or when the predictions made by the model are not satisfactory due to unmodeled dynamics. Examples of adaptive predictive control applied to irrigation canals can be found in (Cardona et al., 1997), (Sawadogo et al., 2000), (Aguilar et al., 2009), (Lemos et al., 2009) and (Aguilar et al., 2012). Distributed control is a control structure that involves centralized and decentralized control in the same structure. In distributed control, each local controller communicates with neighbor controllers in order to find a cooperative solution for the overall control problem (Maestre et al., 2011). Examples of distributed predictive control for water systems can be found in (Dunbar, 2. Control of irrigation canals 16 2007), (Negenborn et al., 2009), (Zafra-Cabeza et al., 2011), (Alvarado et al., 2011) and (Lemos et al., 2013). Although industrial processes are nonlinear, most predictive control applications are based on the use of linear models. However there are several examples of nonlinear predictive control applied to water systems such as (Igreja & Lemos, 2009), (Arnold et al., 1999) and (Georges, 2009). Meanwhile, (Xu et al., 2012) develops a comparison between linear and nonlinear schemes applied to control of open channel flow. The first scheme is based on a linearized Saint-Venant model and the second one is based on the discretization of the Saint-Venant equations and its formulation as linear time-varying state-space model. The performance is evaluated in terms of control accuracy and computational time. The authors came to the conclusion that both schemes can control the water system with positive performance, but the drawback of the schemes is that computational complexity of nonlinear predictive control is higher and the computational time longer than the linear one. Predictive control based on multiple models is an extension of the standard predictive control framework that incorporates more than a single model in the predictive control formulation. The methodological approach was proposed by (Murray-Smith & Johansen, 1997). The main advantage of the multi-model strategy is that well known linear system theory can be used. The strategy is useful when there are different operating points, the approach is based on the ‘divide- and-conquer’ strategy, which develops local linear models corresponding to specific operating conditions. The global model is obtained by the integration of local linear models. Results obtained by both (Duviella et al., 2010) and (van Overloop et al., 2008) have shown the suitability to use this approach to improve the performance of controllers in canal systems. 2.3.2 Control of canals under large change in operating condition Two examples of control strategies applied to irrigation canals under large change in operating conditions can be found in (Duviella et al., 2010) and (Charbonnaud et al., 2011). In (Duviella et al., 2010) two model-based gain scheduling controllers have been proposed for canals systems in order to deal with large operating condition. The first controller is based on representing the canal behavior as a Hayami linear parameter varying model that allows to consider the way that the parameters vary according to the operating point. The second control strategy is based on representing the canal behavior as a set of linear time-invariant models that can be obtained through a multi-modeling identification process. The supervision of the operating mode is fulfilled on-line and it is combined with a control accommodation method which switches to the best controller. Both controllers have given similar performances. In (Charbonnaud et al., 2011), a supervised robust predictive multi-controller strategy is proposed. The ‘divide and conquer’ strategy is used to divide the system operating range into four operating range discharges in order to control a canal under large changes in operating condition (from 0 m3/s to 5 m3/s ). The overall controller follows a multi-controller approach, namely, from the identified discrete models, a bank of robust predictive controllers was designed. Every predictive controller corresponds with an identified discrete model. 2. Control of irrigation canals 17 It is noteworthy that, during the last 20 years, the research community has focused on control methods to improve the operational management of water conveyance systems. However, automatic canal closure operation has received much less attention in the literature of irrigation canals. A case study on night closure feasibility for water saving of the Upper Swat-Pehur High Level canal system in Pakistan is found in (Ghumman et al., 2009). The results show that where canal lengths are less than 5 km, the potential to save water in the irrigation system is quite positive. Reducing the discharges rate at night have demonstrated to save a significant amount of water in medium-sized canal networks (De Bievre et al., 2003). For instance, significant water savings were achieved through night-time closure of Shingrai Minor in Pakistan (Khan & Ghumman, 2008). In general, the feasibility of night-time closure depends on the speed of filling and emptying the canal each day, and the time required to meet full irrigation demand during the day. An application of open-loop predictive control on automatic closure/opening operations of the Ebro River Left Bank canal in Spain is found in (Soler et al., 2010) and (Soler et al., 2014). The left bank canal usually works at its maximum capacity of 19 m3/s. The objective of the closure operation is to isolate the irrigation system from a scenario considering a pollutant flowing in the supplier river. The closure operation is designed to be performed in three stages. The first stage carries the canal from the unknown initial state to a 15 m3/s steady state by applying only one gate movement. The second stage is devoted to drive the canal from the 15 m3/s steady state to another defined by 2 m3/s. The third stage carries the canal to zero discharge with only one gate movement, in this way, the canal is isolated totally. Namely, in both first and third stage, the gates are moved in automatic manual operation, while in the second stage the optimal gate trajectories are obtained with open-loop predictive control in order to change the discharge from 15 m3/s to 2 m3/s as smooth as possible. Meanwhile, the opening operation is designed to be performed in two stages. In the first stage, the open-loop predictive strategy generates the gate opening trajectories in order to drive the canal from 0 m3/s to a 15 m3/s steady state in a smooth way. The second opening stage is devoted to raise all the gates above the water surface except the most upstream gate (Soler et al., 2014). 2.4 Predictive control essentials This subsection is devoted to explain basic concepts related to predictive control, which is chosen in this dissertation as control strategy to manage irrigation canal operations involving abrupt changes in the operating conditions. Predictive control is known with several names in the literature, such as model predictive control, model-based predictive control or receding horizon control. Throughout this dissertation, only the name predictive control will be used. Some of the advantages of predictive control that have received special interest from researches in both industrial and academic communities are (Maciejowski, 2002; Wang, 2009):  Ability to handle constraints on the inputs, states and outputs of the controlled system and also with safety and equipment constraints.  Completely multivariable framework. 2. Control of irrigation canals 18  Predictive Control is more powerful than Proportional-Integral-Derivative (PID) control  Ability to perform on-line optimization. Based on a model of the process, predictive control makes the predicted process dynamic output equal to a desired dynamic output conveniently predefined (Martín Sánchez & Rodellar, 1996). Predictive control essentially relies on the use of a model able to predict the system output as a function of the system inputs on a moving horizon scenario. The model allows to compute the control sequence that makes the predicted output to follow a desired trajectory through the minimization of a performance criterion (also called cost function or objective function in technical literature). A predictive control problem has the framework of a finite horizon optimal control problem. One of the elements of the predictive controller is the optimizer, which computes at each sampling time, the optimal output based on the controlled variable error, the cost function, constraints and process disturbances. Figure 2.5 shows a block diagram of the predictive control strategy. Predictive control essentially solves a standard optimal control problem on-line (each sampling time) for the current state of the plant. Figure 2.5 Predictive control block diagram. An implementation of predictive control must consider the following requirements: - An accurate model that captures the dynamic behavior to obtain a positive closed-loop performance. Besides, a control-oriented model must be also simple enough for allowing the on-line optimization. It is noteworthy that real systems often have problems as nonlinearity, strong coupling, uncertainty and wide operating range, which makes the synthesis of an appropriate model a challenging task. - The optimization problem must be solved at each sampling time, which implies computationally demanding algorithms in terms of load (burden) in real-time implementation. A great amount of survey papers may be found in the literature. For instance, (Henson, 1998), (Morari & Lee, 1999), (Mayne et al., 2000), (Qin & Badgwell, 2003), (Morari & Barić, 2006), (Camacho & Bordons, 2010), (Darby & Nikolaou, 2012), (Martín-Sánchez et al., 2012), (Xi et al., 2. Control of irrigation canals 19 2013), (Christofides et al., 2013) and (Mayne, 2014), most of them highlighting developments and challenges proposed until their publication date. It is widely agreed that one of the most attractive feature of predictive control lies in the ability to explicitly handle constraints. In the last 30 years, predictive control has been successfully applied to complex industrial processes, showing its great potential of handling complex control problems. Currently a considerable number of industrial applications demand on-line optimization with constraints management in the control system design rather than only solving the traditional regulating problem (Xi et al., 2013). The fundamentals of the predictive control developed in this dissertation follows the approach proposed by (Martín Sánchez & Rodellar, 1996). This approach has been used in the control of a canal with single pool configuration (Rodellar et al., 1993, 1989) and also in a multi-pool configuration in (Gómez et al., 2002) and (Aguilar et al., 2009, 2012). The system is usually represented by a difference equation, which may be expressed as follows: 𝐴(𝑧−1)𝑦(𝑘)=𝐵(𝑧−1)𝑢(𝑘)+𝑤(𝑘) (2.1) where 𝑦(𝑘) is the output variable. 𝑢(𝑘) is the control variable and 𝑤(𝑘) is the disturbance signal. 𝐴(𝑧−1) and 𝐵(𝑧−1) are polynomials in the backward shift operator given by 𝐵(𝑧−1)=𝑏1𝑧−1+𝑏2𝑧−2+⋯ 𝑏𝑚𝑧−𝑚 (2.2) 𝐴(𝑧−1)=1−𝑎1𝑧−1+𝑎2𝑧−2+⋯ 𝑎𝑛𝑧−𝑛 (2.3) In predictive control, in order to stablish the prediction, a time horizon [𝑘,𝑘+𝜆] is considered, where 𝑘 is the present instant and λ is the prediction horizon. The notation 𝑢(𝑘+𝑗|𝑘) indicates the control variable for a future time instant 𝑘+𝑗. Meanwhile, the future sequence of control actions 𝑈(𝑘)=[𝑢(𝑘|𝑘) 𝑢(𝑘+1|𝑘)… 𝑢(𝑘+𝜆−1|𝑘)]𝑇 is optimized at each sampling time, by minimizing a cost function. The minimization may include penalties on deviations of the controlled variable of the desired reference and penalties on the requested control variable changes, namely: min 𝑢 𝐽=∑𝑒𝑗 (𝑘+𝑗|𝑘)𝑇𝛹𝑗𝑒𝑗(𝑘+𝑗|𝑘) 𝜆 𝑗=1 + ∑𝑢(𝑘+𝑗|𝑘)𝑇𝑅𝑗 𝜆−1 𝑗=0 𝑢(𝑘+𝑗|𝑘) (2.4) where 𝑒𝑗(𝑘+𝑗|𝑘)=𝑦(𝑘+𝑗|𝑘)−𝑦𝑟(𝑘+𝑗|𝑘) is the signal error and 𝑦𝑟(𝑘+𝑗|𝑘) is the reference trajectory. 𝛹𝑗 and 𝑅𝑗 are weighting factors. The prediction model may be linear as in (2.1), or nonlinear. Therefore, based on the type of model used in the optimization, predictive control can be categorized as linear or nonlinear. The theory of predictive control using linear models is more developed than the nonlinear one. Thus almost all commercial implementations are based on a linear prediction model (Álvarez et al., 2013). The nonlinear predictive control is applied when the process has severe nonlinearities or 2. Control of irrigation canals 20 when the processes operate in continuous transitions, namely with no operation around a stationary state, and therefore, linear modelling is not enough to model the main dynamic characteristics of the process. In practice, virtually all systems operate under practical constraints. In many systems, control variables cannot be arbitrarily large and may have some magnitude limits. Actuators such as valves or gates have a limited operating range and limited slew rate (maximum rate of change). Even state variable values must be limited in many applications. The problem of dealing with constraints is tackled systematically by using optimization. The constraints are presented as linear inequalities of the control variable. Since the cost function J is a quadratic function and the constraints are linear inequalities, the problem of finding the optimal predictive control can be stated as a standard quadratic programming problem. Therefore, the predictive control problem may be expressed as follows: min 𝑢𝐽= 12𝑢𝑇𝐻𝑢+𝑢𝑇𝑏 subject to: 𝑀𝑢≤𝛾 (2.5) where 𝑢 is the control variable and 𝑀 is a matrix that collects the constraints. 𝐻,𝑏, and 𝛾 are compatible matrices and vectors. It is noteworthy that, it takes a longer time to calculate the constrained predictive control optimal value in comparison with the unconstrained one. Thus, the real-time implementation demands for either fast algorithms that require less computation time or high performance computing devices with small sampling time (Xi et al., 2013). The feasibility is also an important issue in order to guarantee that the optimizer satisfies the constraints. Usually, the normal way of using a constrained predictive control algorithm is to compute 𝑢(𝑘) using (2.5) and apply it to the process. If 𝑢(𝑘) violates the constraint then 𝑢(𝑘) is saturated to its limits by either the predictive control algorithm or the actuator (Camacho & Bordons, 2004). However, in case of unfeasibility, there are methods dealing with the constraint management in order to try to recover the feasibility. Such methods act over the constraints in different ways, such as disconnection of the controller, a temporary elimination of constraints or a temporary relaxation of the constraints limits. 2.5 Final remarks The control methodology developed in this thesis combines prediction issues as described above with constrained optimal control as described in (2.5), all of them within a supervised decentralized control scheme with a strategy to manage constraints in a time-varying manner. 3. Description and modelling of case studies 21 3 Description and numerical simulation of case studies Chapter 3 Description and modelling of case studies 3.1 Introduction This chapter is devoted to present the case studies where the dynamically-constrained predictive control strategy will be tested. The first part of the chapter presents a general description of the case studies, the experimental platform canal PAC-UPC and the Ebro River Left Bank canal. The laboratory canal was specially designed to test irrigation canal control algorithms. The second case study is the canal where the motivational work fulfilled by (Soler et al., 2014) was developed. Secondly, some aspects about the implementation of the numerical model developed in SIC software are presented. Finally, the mathematical models used in the derivation of the proposed predictive control algorithms are described. 3.2 Laboratory canal PAC-UPC Laboratory canals may be considered as an intermediate step between the numerical simulation and real-time implementation on the field. Although there are few laboratories for experimentation in irrigation canals in the world, these are very useful tools to test control algorithms. Canal PACUPC is the acronym of "Canal de Pruebas de Algoritmos de Control – Universitat Politècnica de 3. Description and modelling of case studies 22 Catalunya. The canal was built in 2006 and it is located at the Laboratory of Physical Models of the Technical University of Catalonia, Barcelona, Spain. The experimental facility has the following characteristics and instrumentation components:  Length of 220 m in a serpentine shape (see Figure 3.1 ), this shape aims to minimize the space to be occupied by the canal.  Bottom slope of 0 m/m in order to achieve the largest possible time delay (Horváth, 2013).  Rectangular cross section with canal width of 0.44 m and deep of 1 m.  Area of 22.5 m x 5.4 m.  Manning’s coefficient of 0.016.  Maximum discharge of 150 l / s.  A head reservoir.  Three pools in series with length of 87, 90.2 and 43.5 m.  Three sluices gates of 1m x 0.4 m (G1, G2 and G3 in Figure 3.1). The gate velocities are 1.524 mm/s for G2 and 3.125 mm/s for G1 and G3.  Four rectangular weirs used for lateral offtakes. Weirs are at the end of each pool and another one at the end of the canal. The weirs consist of a wall of plastic specially designed to cover a broad range of weir heights.  Three orifices connected to manual valves (see Figure 3.2b).  Electromechanical devices. Each gate is controlled by a three-phase servomotor of 0.75 CV of power. The servomotors are located on top of the gates (see Figure 3.2c). Each servomotor has a motor driver which has been installed in a control box beside the canal. The control boxes allow either the local or the distant operation of the motorized gates.  Ten water level sensors (LS in Figure 3.1). Sensors are located upstream and downstream of each gate and at every rectangular weir.  Three PCI data acquisition cards made by Advantech, with analog output channels and single-ended analog inputs. 3. Description and modelling of case studies 23 Figure 3.1 Schematic layout of the UPC PAC canal, from (Sepúlveda, 2008). 3. Description and modelling of case studies 24 Figure 3.2 Experimental canal facility A Simulink/Matlab-based SCADA system has been developed in order to manage the control system in the facility. The Supervisory Control and Data acquisition (SCADA) system provides both monitoring and control of remote sensors and actuators. The HMI (human-machine interface) implemented in the control room (see Figure 3.2d) has been developed in Matlab/Simulink environment (see Figure 6.43). The supervisory system is combined with a data acquisition system. In this way, the system receives as input signals the measurements of water levels from different points of the canal and also the three gate opening measures. The analog output signals are sent to the actuators (servomotors) which execute the control actions allowing gate movements. The 4-20 mA standard analog communication protocol is used for communicate sensors with the computer-based controller over a pair of conductors. In the standard protocol, the current signal range is 4 mA to 20 mA, this means 0% to 100% of measurement range, respectively. A flow path of sensor signals is depicted in Figure 3.3. 3. Description and modelling of case studies 31 Figure 3.9 Concept map of solution of Saint Venant equations 3.5 Numerical models of the case studies 3.5.1 Numerical model of the canal PAC UPC Simulations of case studies in this thesis are fulfilled by the SIC (Simulation and Integration of Control for Canals) modeling software developed by IRSTEA France, which is a one dimensional hydrodynamic software based on the Preissmann Scheme (Malaterre, 2012). This scheme belongs to the category of implicit finite differences. The SIC software permits simulating the hydraulic behavior of the irrigation canals under steady and unsteady flow conditions. A model in SIC is composed by three main units. The first unit is used to describe the canal geometry. Unit 2 is devoted to steady flow calculation and unit 3 is used for the unsteady flow calculation. The software was especially developed for simulation of automatic control of irrigation canals, and there are several possibilities to model different hydraulic structures, such as gates and weirs. Some of the most common control algorithms, such as PID control, are incorporated in a regulation module. An advantage of SIC software is that it is possible to evaluate any control algorithm written in Matlab® (see Figure 3.11). 3. Description and modelling of case studies 32 The canal PAC-UPC has been modelled in SIC using 6 nodes and 5 reaches (a reach is a part of the canal bounded by nodes). This configuration is depicted in Figure 3.10 . The last node is located in the end of the canal, in the place of weir 4 (see Figure 3.14). The three gates G1, G2 and G3 are placed in nodes Nd2, Nd3 and Nd5 respectively. The discharge over weir W4 as a function of the water level is included as a system boundary condition. The validation of the model using experimental data has been fulfilled in (Horváth, 2013). Figure 3.10 SIC window with the canal PAC-UPC geometry. Figure 3.11 The regulation module of SIC software. 3.5.2 Numerical model of the Ebro River Left Bank canal The Ebro River Left Bank canal, has been modelled in SIC using 19 nodes (N1,…, N19 ) and 18 reaches as is depicted in Figure 3.12. The water level of 4.5 m is the upstream boundary condition in order to obtain water surface profile of the initial steady state. The discharge over spillway 3. Description and modelling of case studies 33 located at the canal end is included as downstream boundary condition. The model simulation results were validated by comparison with results obtained by (Soler et al., 2014). Figure 3.12 Sketch of the ERLB canal for simulation purposes Figure 3.13 Simulation of the ERLB canal including a regulation module in SIC 3.6 Model of canals for control purposes In canal control, models may be categorized as “flow-flow” and “flow-water level" models according to the control and controlled variable which are chosen to represent inputs and system outputs. The flow-water level mathematical model gives the information about the behaviour of the water level based on the upstream flow that the predictive controller needs in order to predict 3. Description and modelling of case studies 34 the future output of the system. Along the canal there are offtakes to farms and secondary canals. Offtakes are usually treated as disturbances (Weyer, 2003). In a single pool configuration, such as it is depicted in Figure 3.8, a basic mass balance gives: 𝑑𝑉(𝑡) 𝑑𝑡 =𝑄𝑖(𝑡)−𝑄𝑖+1(𝑡)−𝑄𝑤𝑖(𝑡) (3.5) where 𝑉 is the volume of the pool, 𝑄𝑖 is the input discharge, 𝑄𝑤𝑖 is the lateral offtake, and 𝑄𝑖+1 is the output discharge. A mathematical model that considers the water level 𝑦𝑖 as output variable, may be described as function of the discharge along the canal. A simple description is possible assuming that the volume in a pool is proportional to the water level. Particularly, in downstream water level control, the task of the controller is to move an upstream gate in order to achieve the required downstream water level. One of the difficulties that makes this task a challenging one, it is the time delay, which is the time taken for the water to arrive from upstream to downstream. Therefore the model must consider the time delay explicitly. Subsections 3.5.1 and 3.5.2 present the discrete-time models used in the controller design in this dissertation. 3.6.1 Parametric model of the canal PAC UPC A transfer function model is used to describe the first case study of this dissertation. The transfer function is expressed as a difference equation based on a multivariable Auto-Regressive with eXogenous input (ARX) model. This black-box model has been obtained by parametric identification by (Sepúlveda, 2008). The model is a relationship between the downstream water level and the upstream flow in the canal pool. The difference equation consider in this model only has constant coefficients. The canal was already introduced in Section 3.2 and its scheme is illustrated in Figure 3.14. In this sketch, y1, y2 and y3 are the controlled downstream water levels; QG1, QG2 and QG3 are the discharge under gates; QW4 is the weir discharge at the end of the canal. Qw1 and QW2 are the lateral weir discharges. The model parameters were obtained using a sampling time of 10 s. The model for the three pool configuration of the laboratory canal has the following form: [𝑦1(𝑘) 𝑦2(𝑘) 𝑦3(𝑘)]=[1−𝐴𝑝1(𝑞)0 0 0 1−𝐴𝑝2(𝑞)0 0 0 1−𝐴𝑝3(𝑞)][𝑦1(𝑘−1) 𝑦2(𝑘−1) 𝑦3(𝑘−1)] +[𝐵11(𝑞)𝐵12(𝑞)0 0 𝐵22(𝑞)𝐵23(𝑞) 0 0 𝐵33(𝑞)][𝑄𝐺1(𝑘−1) 𝑄𝐺2(𝑘−1) 𝑄𝐺3(𝑘−1)] +[𝐵12(𝑞) 0 0 𝐵23(𝑞) 0 0 ][𝑄𝑤1(𝑘−1) 𝑄𝑤2(𝑘−1)] where q is the shift operator: 𝑞𝑓(𝑘)=𝑓(𝑘+1),𝑞−1𝑓(𝑘)=𝑓(𝑘−1) (3.6) 3. Description and modelling of case studies 35 Figure 3.14 Scheme of the Canal PAC The ARX model for the first pool is 𝐴𝑝1(𝑧)𝑦1(𝑘)=𝐵11𝑄𝐺1(𝑘−1)+𝐵21(𝑄𝐺2(𝑘−1)+𝑄𝑤1(𝑘−1)) (3.7) where 𝐴𝑝1(𝑧)=1−0.6918𝑧−1+0.091𝑧−2+0.07062𝑧−3+0.1638𝑧−4 +0.2801𝑧−5+0.213𝑧−6 𝐵11=𝑧−3−0.2895𝑧−4 𝐵12=−1.154𝑧−1+0.4729𝑧−2−0.0675𝑧−3+0.4496𝑧−4−0.4899𝑧−5 The ARX model for the second pool is 𝐴𝑝2(𝑧)𝑦2(𝑘)=𝐵22𝑄𝐺2(𝑘)+𝐵23(𝑄𝐺3(𝑘)+𝑄𝑤1(𝑘−1)) (3.8) where 𝐴𝑝2(𝑧)=1−0.0.4315𝑧−1−0.1178𝑧−2−0.0393𝑧−3+0.03022𝑧−4 −0.1962𝑧−5+0.05333𝑧−6−0.3033𝑧−7−0.3838𝑧−8 𝐵22=0.1644𝑧−4 𝐵23=−1.994𝑧−1+0.4728𝑧−2−0.1484𝑧−3+0.6077𝑧−4−0.4835𝑧−5 And the ARX model for the third pool is 𝐴𝑝3(𝑧)𝑦3(𝑘)=𝐵33𝑄𝐺3(𝑘−1) (3.9) where 3. Description and modelling of case studies 36 𝐴𝑝3(𝑧)=1−0.6495𝑧−1−0.2344𝑧−2+0.142𝑧−3−0.3175𝑧−4−0.2122𝑧−5 𝐵13=0.1422𝑧−2−0.9872𝑧−3 There is a need to convert the calculated discharge into gate opening, since the control variable is discharge and the actuators are check gates. This problem is addressed in (Litrico et al., 2008) and (Sepúlveda, 2008). The gate openings are calculated using the desired discharge, the water level measurements and the inverse non-linear gate equation (Ferro & Ansar, 2001). If the gate opening is physically unfeasible, for instance it is higher that the canal bank, the maximum allowed gate opening is fixed in the actuator. The validation of the ARX model using experimental data have been fulfilled by (Sepúlveda, 2008). Meanwhile, Figure 3.15 and Figure 3.16 show the numerical results of the response of the ARX models in comparison with the response of SV model simulated by the SIC software. The ARX model step responses were simulated by Simulink® with the same data input. The validation in the time-domain is illustrated in Figure 3.15 and Figure 3.16, the test was performed producing a step discharge (dotted line) in the upstream gate, while keeping the downstream discharge constant. The system output are the water levels (solid lines). The test results in Figure 3.15 are related to the first pool of the canal PAC-UPC only, and the results show that the step response for both positive change (left) and negative input discharge are quite similar for the ARX model in comparison with the SV model. In order to quantify the similitude of step responses in every canal pool, the square of the correlation coefficients are 𝑅𝑐1 2=0.9998 for pool 1, 𝑅𝑐2 2=0.9996 for pool 2 and 𝑅𝑐3 2=0.961 for pool 3. Figure 3.15 Step responses of the ARX model of pool 1. 3. Description and modelling of case studies 37 Figure 3.16 Step responses of the ARX models of pool 2 and 3. Another way to validate the model is considering the frequency domain. For instance, a comparison between the SV model and the ARX model for the first pool is depicted in Figure 3.17. Results indicate that the Bode magnitude and phase plots for both models are almost equal in the low frequency area and the first resonance peak is located in the same frequency in both models. A validation in frequency domain for the rest of the canal pools is illustrated in (Sepúlveda, 2008). Figure 3.17 . Bode plot diagrams of SV model and ARX model for Pool1 10-4 10-3 10-2 10-1 0 20 40 60 Frequency response of the UPC-PAC Canal, Pool 1 Frequency (rad/s) Phase (deg) 10-4 10-3 10-2 10-1 -700 -600 -500 -400 -300 -200 -100 0 Frequency (rad/s) Phase (deg) ARX SV Model ARX SV Model 3. Description and modelling of case studies 38 3.6.2 State-space model of the canal PAC UPC In order to get a model for the whole canal, the linear model of each pool may be transformed into a state-space model described by 𝑥𝑚𝑖(𝑘+1)=𝐴𝑚𝑖𝑥𝑚𝑖(𝑘)+𝐵𝑚𝑖𝑢𝑖(𝑘)+𝐵𝑑𝑤𝑖(𝑘) (3.10) 𝑦𝑖(𝑘)=𝐶𝑚𝑖𝑥𝑚𝑖(𝑘) (3.11) where 𝑥𝑚𝑖(𝑘+1) is the n-dimensional state vector of the i-th pool containing the water levels and the discharges under gates in previous sampling times, u(k) is the control variable containing the discharge under gate, 𝑤𝑖 is the input disturbance, 𝑦𝑖 is the controlled variable (water level), 𝐴𝑚𝑖, 𝐵𝑚𝑖, and 𝐶𝑚𝑖 are matrices of proper dimension. The model may be stated to use system input and output variables as its state variables. The spacestate variable for the first pool 𝑥𝑚1(𝑘), for instance, considers the downstream discharge 𝑄𝐺2 and 𝑄𝑤1 as the measurable disturbances for a decentralized control scheme. In this way, based on the ARX model, the state-space variable for the first pool may be written as follows: 𝑥𝑚1(𝑘)=[𝑦1(𝑘) 𝑦1(𝑘−1) 𝑦1(𝑘−2)… 𝑦1(𝑘−5) 𝑢1(𝑘−1) 𝑢1(𝑘−2) 𝑢1(𝑘−3)]𝑇 where 𝑢1(𝑘)= 𝑄𝐺1(𝑘) [𝑚3 𝑠] , 𝑛1=9, 𝐴𝑚1 ∈ ℜ𝑛1𝑥𝑛1,𝐵𝑚1∈ ℜ𝑛1𝑥1 , 𝐶𝑚1 ∈ ℜ1𝑥𝑛1 𝐴𝑚1= [ 𝐴11 𝐴12 𝐴13 100 010 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 𝐴14 𝐴15 𝐴16 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 𝐴17 𝐴18 𝐴19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 ] (3.12) 𝐵𝑚1=[0 0 0 0 0 0 1 0 0 ]𝑇 𝐶𝑚1=[1 0 0 0 0 0 0 0 0] where A11=0.6819, A12=-0.091, A13=0.07, A14=-0.1638, A15=0.2801, A16=0.213, A17=0, A18=1, A19=-0.289 For the second pool, the space-state variable 𝑥𝑚2(𝑘), considers the downstream discharge 𝑄𝐺3 and 𝑄𝑤2 as the measurable disturbances. Meanwhile, based on the ARX model, the state-space variable may be written as follows: 𝑥𝑚2(𝑘)=[𝑦2(𝑘) 𝑦2(𝑘−1)… 𝑦2(𝑘−7) 𝑢2(𝑘−1) 𝑢2(𝑘−2) 𝑢2(𝑘−3)]𝑇 3. Description and modelling of case studies 39 Other parameters of the state-space model for the second pool are: 𝑢2(𝑘)= 𝑄𝐺2(𝑘) [𝑚3 𝑠], 𝑛2=10, 𝐴𝑚2 ∈ ℜ𝑛2𝑥𝑛2 , 𝐵𝑚2∈ ℜ𝑛2𝑥1 , 𝐶𝑚2 ∈ ℜ1𝑥𝑛2 where 11 12 13 14 15 16 17 18 19 1A 1B 2 A A A A A A A A A A A 1 0 0 0 A m 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0                       with A11=0.04315, A12=0.1178, A13=0.0393, A14=-0.030, A15=0.1962, A16=-0.053, A17=0.3033, A18=0.3838, A19=0, A1A=0, A1B=1.644 and 𝐵𝑚2=[0 0 0 0 0 0 0 0 1 0 0 ]𝑇 𝐶𝑚2=[1 0 0 0 0 0 0 0 0 0 0] Finally, for the third pool, based on the ARX model, the state-space variable may be written as follows: 𝑥𝑚3(𝑘)=[𝑦3(𝑘) 𝑦3(𝑘−1) 𝑦3(𝑘−2) 𝑦3(𝑘−3) 𝑦3(𝑘−4) 𝑢3(𝑘−1) 𝑢3(𝑘−2) 𝑢3(𝑘 −3)]𝑇 Other parameters of the state-space model for the third pool are: 𝑢3(𝑘)= 𝑄𝐺3(𝑘) [𝑚3 𝑠], 𝑛3=7, 𝐴𝑚3 ∈ ℜ𝑛3𝑥𝑛3 , 𝐵𝑚3∈ ℜ𝑛3𝑥1 , 𝐶𝑚3 ∈ ℜ1𝑥𝑛3 where m3 0.6495 0.2344 -0.142 0.3175 -0.2112 1.422 -0.9872 1 0 0 0 0 0 0 0 1 A = 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0            3. Description and modelling of case studies 40 𝐵𝑚3=[0 0 0 0 0 1 0 ]𝑇 𝐶𝑚3=[1 0 0 0 0 0 0 ] 3.6.3 IDZ model of the Ebro River Left Bank canal The model used in this dissertation to describe the second case of study is based on the Integrator Delay Zero (IDZ) model proposed by (Litrico & Fromion, 2004b). The integrator delay zero (IDZ) model is an expansion of the ID model that incorporates a zero in the transfer function. The integrator delay (ID) model assumes that the canal consists of two parts: a downstream part (characterized by backwater) and an upstream part (characterized by uniform flow). In the part affected by backwater, a simple reservoir model is used, and the parts with uniform flow are approximated by the kinematic wave model. The two models are connected in the ID model. Meanwhile, the IDZ model is able to represent the canal behavior in low and high frequencies; the integrator delay accounts for low frequencies, whereas the zero represents the direct influence of the discharge on the water level in high frequencies and the delay is related to the system delay. The transfer function of the IDZ model describes the ratio of the downstream water level and the upstream discharge under gate in the Laplace domain. In a single pool configuration (see Figure 3.8), the IDZ model is written as follows: 𝐺𝐼𝐷𝑍𝑖(𝑠)=𝑦𝑖(𝑠) 𝑄𝐺𝑖(𝑠)=𝐾1𝑖𝑠+1 𝐴𝑒𝑖𝑠e−τ𝑖s (3.13) where 𝐾1𝑖 is a parameter calculated from the canal properties, 𝜏𝑖 is the delay time and 𝐴𝑒𝑖 is the integrator/backwater approximation. The downstream water level considering the downstream discharge may be expressed as (Litrico & Fromion, 2004b): 𝑌(𝑠)=𝐾𝑖𝑠+1 𝐴𝑖𝑠𝑒−𝑇𝑖𝑄𝑖(𝑠)−𝐾2𝑠+1 𝐴𝑖𝑠𝑄𝑖+1(s) (3.14) The Ebro River Left Bank canal was already introduced in Section 3.3, and a scheme of this canal is illustrated in Figure 3.18. 4. Management practices involving canal closure and opening operations 47 4.2.2 Night closure in rotational delivery systems When farmers practice a rotational delivery system, night irrigation is done only during times of peak crop water demand (some reasons to do this are personal safety, cold and darkness). So, as a result water does not flow continuously, and a large proportion is saved in medium-sized canal networks (Ghumman et al., 2009). A typical strategy developed in a tree-shaped net of open canals is day and night opening of main canal but night closure of secondary canals (see the layout depicted in Figure 4.2 ). Figure 4.2 A typical irrigation scheme (from (Van den Bosch et al., 1992)). 4.2.3 Canal closure on weekends When a canal decreases the irrigation on weekends, it is advisable to close it in order to reduce operational labor and energy and subsequently save water, money and manpower. 4.2.4 Emergency plan Another motivation for closing a canal is the danger of contamination of water due to a pollutant flowing in the supplier river. Once any pollutant flowing down the river is detected in the upstream main canal, some authorities decide to call for an emergency plan in order to avoid pollutants travel downstream the canal. Typically, in those situations a warning signal is sent to the canal management staff who must then initiate the emergency procedure. The procedure starts closing the upstream pool in order to isolate the overall system. Subsequently, the gates can be closed as quickly as the water delivery system allows, while maintaining the water level between prescribed allowed maximum and minimum operating levels. The aim is to prevent damages in the canal lining (Soler et al., 2014). The polluted water takes time to travel along the canal pools, and this time is a function of the geometry and the canal flow. For instance, in the Ebro River left bank canal in Spain, the pollutant 4. Management practices involving canal closure and opening operations 48 takes approximately 7.3 h traveling 40 km downstream from a gauging station to the canal inlet. The gauging station is in charge to detect whether any pollutant is flowing downriver and emits an emergency warning. Namely, the 15 km-long canal system has a period of time of 7.3 h in which it has to be isolated (Soler et al., 2014). Therefore, the challenge for the emergency plan is to design a strategy able to close the canal as quickly as possible considering physical characteristics that impose some constraints to the control possibilities. Some characteristics are maximum capacity, amount of depth fluctuations and amount of storage, among others. 4.2.5 On demand partial closure Canals must irrigate agricultural crops in some periods of short rainfall, however in specific periods of time, irrigation is not required, although canal must remain filled -with less amount of flow but filled- to supply freshwater for nearby population. That means that the canal acts as source or reservoir of potable water for human consumption. On demand operation, a lot of farmers choose not irrigate their crops overnight, namely, the canal management operators need to slow down the discharge in order to save water. This operation involves to change a large percentage of the operating point but without driving the canal to zero flow. 4.2.6 Opening operation Opening a previously closed canal means restoring a non-zero operating flow without altering the prescribed water levels. The goal is to move gradually the gates from zero flow condition to a nominal flow value. The upstream gates movement will generate naturally a waving effect in the canal, however there are two main objectives to ensure during the opening operation. The first objective is to maintain specific water levels between maximum and minimum critical values in order to avoid problems, such as, canal overtopping. The second objective is to execute the opening operation as quick as possible. In some canals, finally all the gates will be completely open. Consequently, restarting the canal on (canal opening) requires a progressive and well planned set of actions to achieve a prescribed flow condition maintaining water levels between the permitted values under normal operating conditions. The opening operation must be done as quickly as possible but considering that to lead the system to a desired steady state, some variables such as water levels, gate opening, and flow at the end of the canal will have a transient behavior until the water demand is reached. Since restarting the canal to the previously steady state implies to supply an extra water volume to compensate water losses during the time that the canal has been closed, the opening operation is expected to be longer than the closing operation. 4. Management practices involving canal closure and opening operations 49 4.3 Drawbacks associated to closure operation An operating point change within a wide range, as in closure operations, must not imply water level changes in the same proportion. Whatever the reason to change drastically the operating point in the system, the experience indicates to leave enough canal freeboard to avoid some hydraulic issues like cracking in the canal lining and overtopping. For instance, in the Ebro river left bank canal, which has 3 m of canal depth, it is recommended around 1 m-freeboard in several checkpoints in order to protect the canal lining (Soler et al., 2014). 4.3.1 Cracking in the canal lining A common problem related to canal closure is the transient wave phenomenon originated when the gates are suddenly closed along the canal, which usually leads to the risk of exceeding the minimum/maximum safety levels required on the canal. Particularly, if the water level decreases below the minimum safety level, it can lead to structural damage or cracking (see Figure 4.3). Cracking in the canal lining arises by reason of the pressure that the concrete canal lining are subject to the effect of outside water by sub-pressure effects. Namely, cracking occurs when the equilibrium between the subsurface water pressure and that of water in the canal is broken, and the pressure difference generates over tension on the canal lining. The cracked concrete canal lining may result in a significant loss of water and money. Leakage often starts on a small scale, but the moment when water finds a way through a canal embankment, a hole will develop through which water will leak. Serious leakage can be avoided when the canal system is inspected frequently and when repairs are carried out immediately. The longer a hole or crack is left, the larger it will become (Van den Bosch et al., 1992). Figure 4.3 Photo and schematic of longitudinal cracking (taken from (Moreno, 1986)) 4. Management practices involving canal closure and opening operations 50 4.3.2 Overtopping Another important issue to bear in mind in both closure and opening operations is the transient wave phenomena originated when the gates are suddenly closed/open along the canal. The wave travels in downstream direction and it arrives at the downstream end and bounces back iteratively. Exceeding the maximum safety level may lead to the water exceeds the top of canal bank with negative consequences (Figure 4.4). Overtopping is a problem because it causes erosion of the canal banks and may lead to serious breaches (Van den Bosch et al., 1992). Overtopping of a canal section is induced by an exaggerated discharge in a particular section exceeding the actual canal capacity. Moreover, canal banks that are frequently overtopped are very probably eroded and lowered, and thus the actual capacity will be less than the original one for which the canal has been designed. Figure 4.4 Photo and schematic of overtopping (from (Van den Bosch et al., 1992)) 4.4 Feasibility of closure operation Depending on the reason to closing a canal, the feasibility of closure operation must be analyzed from two points of view mainly. First, when the closure operation has the objective to save water. Secondly, when the closure operation has the objective to isolating a canal in the presence of pollutant flowing in the supplier river. Feasibility of closure operation to save water The feasibility of closure operation with the objective to save water, considers night-closure, closure on weekends and night-closure in rotational delivery systems. Particularly, canals can be closed at nights provided that the closure operation is fast enough to make it feasible. To determine feasibility of closure, some aspects have to be assessed, such as time taken to achieve a new steady 4. Management practices involving canal closure and opening operations 51 state, and time required to meet full crop water demand in the service (Ghumman et al., 2009). These aspects are analyzed below.  Time taken to achieve steady state hydraulic conditions after the canal is opened in the morning. Canal physical characteristics determine both the time taken to achieve steady state hydraulic conditions after the canal is opened in the morning and the minimum time required to perform the closure operation. A case study of feasibility of night closure of the Upper Swat-Pehur canal (USC) system in Pakistan is found in (Ghumman et al., 2009). Based on hydrodynamic simulation models, the results show that where canal lengths are less than 5 km, there is good potential to make savings. In the particular case of Dagai Distributary (3.2 km long), it attained a steady state within 2 hours of canal opening, and later took 60 min to drain (with discharge 0.16 m3/s). Namely, mainly values of both time filling and emptying make suitable the night-time closure.  Time required to meet full crop water demand in the service area. Required time to meet full crop water demand in the service during the day due to crop water demand varies through a season. The management of an irrigation system must offer flexible service in order to deliver the required amount of water at an appropriate time to meet the farmers’ needs. The goal is deliver optimal water supply at peak demand and reduce the amount at early growth stage of crops (Ghumman et al., 2009). Feasibility of closure operation due to an emergency plan The feasibility of closure operation with the objective to isolate the canal in the presence of pollutant flowing in the supplier river is mainly evaluated by the time taken for discharges to go from a baseline to zero in a downstream checkpoint of the canal. This time is evaluated in both closure and opening operations. A detailed study on the closure as a result of pollutant flowing in the supplier river is found in (Soler et al., 2014). In the event of a pollutant discharge, the water users’ association have decided to design an emergency plan in order to isolate the system for the protection of the main canal lining. In thus study, the pollutant takes approximately 7.3 h traveling 40 km downstream from a gauging station to the canal inlet in the Ebro River left bank canal. The gauging station is in charge to detect whether any pollutant is flowing downriver and emits an emergency warning. Therefore, the system has the period of time of 7.3h as the maximum value in which system must be isolated. In summary, the feasibility and usefulness of a closure operation is mainly determined by comparing the time required to achieve the objective (i.e. closing the canal before the pollutant arrival to specific checkpoints) and the minimum time required to perform the closure operation, which relies on the canal geometry, flow conditions and velocity of check structures. 4. Management practices involving canal closure and opening operations 52 4.5 Manual closure simulation results in the cases of study The aim of this section is to illustrate, by simulation results, several scenarios of closure operation using local manual control. Simulations are fulfilled in SIC (Simulation of Irrigation Canals) modeling software. In particular, it is expected that some scenarios reveal evidence of the previously discussed problems and motivates the need of automatic control systems. The closure simulations suppose idealized motorized gates, whose velocities can be changed manually. Simulation results include three variables, downstream water levels, discharges under gates and gate openings. Five scenarios have been designed to check the transient response after closing gates of cases of study under manual local control. Scenarios depending on the gates velocities. The first scenario is devoted to test the downstream water levels closing all gates at the same velocity. In the second scenario, all gates are closed at the same velocity but with a value lower than the first scenario. In the third scenario, gates are closed with different velocities and the velocity of most upstream gate is higher than the rest of the gates. In the fourth scenario, gates are closed with different velocities and the velocity of most upstream gate is lower than the rest of the gates. The fifth scenario simulates a closure operation when only the most upstream gate is closed. Disturbances are not considered in these scenarios. 4.5.1 Manual closure of the canal PAC-UPC The laboratory canal is a zero-slope rectangular one, having 220 m length, 44 cm width, 1m depth and a Manning’s coefficient of 0.016. The maximum affordable inflow is around 150 l/s. The maximum and minimum operating levels recommended for accuracy and safety purposes are 97 cm and 63 cm respectively (Subsection 3.2 contains more information related to characteristics of the canal). To fulfill simulations, a three pool configuration has been used (Figure 4.5). There is a rectangular weir, W4 at the end of the canal. In Figure 4.5, L1, L2 and L3 are openings of gates G1, G2 and G3 respectively; y1, y2 and y3 are downstream water surface elevations; yup is the reservoir water level; Q1, Q2 and Q3 are discharges under gates; QW1, QW2 are lateral offtakes (site of turnouts); and QW4 is the flow-rate through the rectangular weir W4. 4. Management practices involving canal closure and opening operations 53 Figure 4.5 Illustration of canal PAC-UPC in three pool configuration Scenarios Simulation results include three variables: downstream water levels, discharges under gates and gate openings. The scenarios are the following:  Scenario 1: Closing all gates at the same velocity with 𝑉𝑔1= 𝑉𝑔2= 𝑉𝑔3=3.125 mm/s  Scenario 2: Closing all gates at the same velocity with 𝑉𝑔1= 𝑉𝑔2= 𝑉𝑔3=1.5 mm/s  Scenario 3: Closing all gates with different velocity, 𝑉𝑔1=3.125 ; 𝑉𝑔2= 𝑉𝑔3=1.5 mm/s  Scenario 4: Closing all gates with different velocity, 𝑉𝑔1=1.5 ; 𝑉𝑔2=3.125; 𝑉𝑔3=3.125 mm/s  Scenario 5: closure of gate G1 only with velocity 𝑉𝑔1=1.5 mm/s. The rest of the gates remain in the same position along the time of simulation. For each scenario, two operating steady state flows are considered: - Low flow (52 l/s) - High flow (121 l/s) Canal closure at low flow Figures 4.6 to 4.8 show results for the low flow cases. In Figure 4.6, simulation starts with an operating point around a steady state of 52 l/s, then after 5 seconds all the gates close simultaneously. In the first scenario, all gates closed at 3.125 mm/s in left part of Figure 4.6. Simulation results of Scenario 2 are illustrated in the right part of Figure 4.6 . 4. Management practices involving canal closure and opening operations 54 Figure 4.6 Simultaneous closing of all gates with the same velocity at low flow As it can be noted, starting from a relatively low flow (52 l/s), closing can be done in less than 1.5 minutes maintaining water levels y1 and y2 inside the safety band prescribed for this canal. Meanwhile, water level in the third pool decays exponentially as a result of the presence of the weir at the end of the canal. The wave phenomenon still remain for a period of time even after all the gates have been closed. Open loop responses show a relatively low maximum error: 2.71 cm for first pool and 1.9 cm for second pool at 3.125 mm/s and 0.91 cm for the 87 m-long pool and 1 cm for second pool at 1.524 mm/s, it indicates that, water levels in two first pools have less variation closing at 1.524 mm/s than closing at 3.125 mm/s. Simulation results using different velocities in the closure operation are illustrated in Figure 4.7. In both scenarios, there are no overtopping despite wave phenomenon. However, in the fourth scenario, the velocity of G1 slower than G3 and G2, produces a higher ripple in the transient response of water level y1. 0 1 2 3 4 5 0.4 0.5 0.6 0.7 0.8 Scenario 2 (Velocity =1.5 mm/s ) 0 1 2 3 4 5 0 20 40 0 1 2 3 4 5 0 5 10 t (min) 0 1 2 3 4 5 0.4 0.5 0.6 0.7 0.8 Water Levels (m) Scenario 1 (Velocity =3.125 mm/s ) 0 1 2 3 4 5 0 20 40 Discharges (l/s) 0 1 2 3 4 5 0 2 4 6 8 10 12 Gate Opening (cm) t (min) y1 y2 y3 QG1 QG2 QG3 L1 L2 L3 4. Management practices involving canal closure and opening operations 55 Figure 4.7 Closing scenarios 3 and 4 at low flow (different velocities) Figure 4.8 Scenario 5 at low flow 0 1 2 3 4 5 0.4 0.5 0.6 0.7 0.8 Scenario 4 y1 y2 y3 0 1 2 3 4 5 0 10 20 30 40 50 QG1 QG2 QG3 0 1 2 3 4 5 0 2 4 6 8 10 12 t (min) L1 L2 L3 0 1 2 3 4 5 0.4 0.5 0.6 0.7 0.8 Water Levels (m) Scenario 3 0 1 2 3 4 5 0 10 20 30 40 50 Discharges (l/s) 0 1 2 3 4 5 0 2 4 6 8 10 12 Gate Opening (cm) t (min) 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0.5 0.6 0.7 0.8 0.9 Water Levels (m) Scenario 5 (Only gate G1 is closed. ) y1 y2 y3 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 20 40 60 Discharges (l/s) QG1 QG2 QG3 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 5 10 15 t (min) Gate Opening (cm) L1 L2 L3 4. Management practices involving canal closure and opening operations 56 The fifth scenario aims to isolate quickly the downstream pools from the water source (reservoir) by only closing the upstream pool. This operation results in water levels that go further below the minimum allowed values, as is depicted in Figure 4.8. Canal closure at high flow When the input flow increases, the operation scenarios get more complicated and problems could arise. Simulation results of both scenarios 1 and 2 starting from a steady state of 121 l/s are shown in Figure 4.9. Initial water levels y1, y2 and y3 are 93.3, 80.8, and 66.5 cm respectively and the initial gate openings are 17.4, 30 and 26.1 cm for G1, G2 and G3 respectively. The gate velocities are 3.125 mm/s in the left plot and 1.524 mm/s in the right plot. When the gates are all closed simultaneously following a straight line trajectory, the resulting water profiles decrease their amplitude in the deepest value around 6.88% at 3.125 mm/s and 10.9% at 1.524 mm/s. Percentagewise, the first pool water level has decreased further with respect to the operating point of 52 l/s. Figure 4.9 Simultaneous closing of all gates at high flow 1 2 3 4 5 6 0.4 0.6 0.8 Water Levels (m) Scenario 1 (Velocity =3.125 mm/s ) 1 2 3 4 5 6 0 50 100 Discharges (l/s) 0 1 2 3 4 5 6 0 10 20 30 Gate Opening (cm) Time, t (min) 1 2 3 4 5 0.4 0.6 0.8 Scenario 2 (Velocity =1.5 mm/s ) y1 y2 y3 1 2 3 4 5 6 0 50 100 QG1 QG3 QG5 0 1 2 3 4 5 6 0 10 20 30 t (min) L1 L2 L3 4. Management practices involving canal closure and opening operations 63 of manual closure operation using the strategy of sequential gate movements in the laboratory canal PAC-UPC is illustrated in Figure 4.18. For comparison purposes, this simulation starts from the same steady state that illustrated in Figure 4.11 (scenario 4) but closing the gates sequentially from upstream to downstream and imposing a smooth trajectory to each gate. As it can be observed, with this strategy, water levels in pools 1 and 2 are lower than those in Figure 4.11. Nevertheless, maintaining the levels in each pool inside the safety band prescribed for the canal is not guaranteed. Moreover, amplitude variations of levels 1 y and 2 y from its original positions are higher than 3 cm (lower than the case depicted in Figure 4.9). Therefore, there is an improvement in that there is no overtopping, however the problem of closure is not completely solved because the open loop-control system does not consider neither the influence of the output variable (water levels) in the control action nor the disturbances that may occur during the closure and opening operations. Figure 4.18 Sequential closure of all gates with no overtopping in Canal PAC-UPC 2 4 6 8 10 12 14 16 0.4 0.5 0.6 0.7 0.8 0.9 1 Water Level (m) y1 y2 y3 0246810 12 14 16 18 0 50 100 Discharge (l/s) QG1 QG2 QG3 2 4 6 8 10 12 14 16 0.05 0.1 0.15 0.2 0.25 0.3 t (min) Gate Opening (m) L1 L2 L3 4. Management practices involving canal closure and opening operations 64 4.6 Conclusion Based on the issues described in this chapter, a proper closure operation of a given canal system must consider the following operation requirements:  To drive any canal pool from its initial steady state to another state with a minimum discharge, the closure operation must be as smooth as possible by way of moving the gates in a progressive and smooth manner.  The water levels on the canal pools must be settled to given set-points between the minimum and maximum safety water levels for each pool during the closure/opening operations.  The gates along the canal must be closed subsequently from upstream to downstream to avoid as much as possible both the oscillatory behavior of the water profiles and the potential overtopping.  The closure/opening operations must be done as soon and quick as possible. The minimum allowed time is determined by the geometry of the canal, the flow conditions, the velocity of the check structures and the final objective pursued with the closure operation. The closure operation is a very challenging task whose primary goal is to save water. The operational requirements of the closure operation are almost impossible to achieve using local manual control methods. In this dissertation, an automatic control strategy is proposed to guarantee the users’ water demands while keeping the water levels within specified maximum and minimum values in order to prevent damages to the canal. 5. Predictive control with dynamic constraints in canal automation 65 5 Predictive control with dynamic constraints in canal automation Chapter 5 Predictive control with dynamic constraints in canal automation 5.1 Introduction This chapter develops the control strategy and the formulation to carry out the closing operation with the aim of minimizing the problems discussed in Chapter 4. Due to its advantages and results highlighted in the literature review subsection, predictive control has been chosen in this dissertation as the control methodology in order to deal with abrupt changes in operating conditions of irrigation canal systems. A key aspect of predictive control is the use of a model explicitly in the design methodology. The model is used as part of the control algorithm and hence its performance is influenced by the accuracy of the model. In control engineering, the suitable process models should be accurate enough to represent the most important dynamics of the process and simple enough to make the real-time implementation feasible when online optimization is required. The dynamics of a canal may be approximated around a given operating point with linear timeinvariant (LTI) models in order to use linear control design tools, as it is usual in control engineering practice (Duviella et al., 2010). However, in the canal control context, when the operating point changes within a wide range, it results in changes of LTI model parameters and in the time delay. These changes represent a problem for predictive control, as well as others modelbased control techniques (a related concept map is depicted in Figure 5.1), where the linearized 5. Predictive control with dynamic constraints in canal automation 66 model obtained around a particular operating point considers a positive performance only over a small interval of discharges. Therefore, this problem is an extra challenge to face in the controller design. The main control strategies to tackle the problem when parameters change in time are robust control, adaptive control and predictive control. There are four approaches to deal with this problem when using predictive control (PC): adaptive PC (Martín Sánchez & Rodellar, 1996), multimodel PC (van Overloop et al., 2008), nonlinear PC (Allgower et al., 2004) and multiobjective PC (Bemporad & Muñoz de la Peña, 2009). For instance, in the multimodel PC approach, when the operating conditions are too wide, the dynamic relationship between input and output is approximated using decomposition into a set of operating regimes (each of them associated to a local model). Figure 5.1 Concept map related to the model-based control This thesis focuses on designing controllers for irrigation canal systems involving abrupt changes in operating condition such as closure and opening operation. These abrupt changes lead to models used for control purposes that should change along the time. To deal with those problems, this dissertation proposes a new strategy called supervised decentralized predictive control with dynamic constraints (SDPC) from now on. Within this approach, the overall canal is decomposed into a number of pools connected by controllable gates in a local manner. Every local controller observes the downstream pool behavior to control its local subsystem, considering the interaction between pools as a measurable disturbance. Each controller also considers the external disturbances such as the interacting flow caused by downstream lateral offtake/intake variation. In an upper hierachical level, a supervisor is designed, which coordinates a sequential operation of the local controllers, manages the tuning of the control parameters depending on the operating mode and dinamically updates constraints on the control gates depending on the presence and magnitude of abrupt changes. The chapter is organized as follows. Section 5.2 describes the overall supervised control strategy. Section 5.3 presents the formulation of the local predictive controllers and two ways to obtain the optimal solution (unconstrained and constrained). Section 5.3.3 introduces the idea of dynamic constraints in the canal closure operation, while Section 5.5 turns this idea into a component within the supervised control scheme. Finally, Section 5.6 focuses on some issues concerning the 5. Predictive control with dynamic constraints in canal automation 67 implementation of the developed control scheme, prior to the numerical assessment that will be presented in Chapter 6. 5.2 Overall control strategy 5.2.1 Basic objective As it was mentioned in Chapter 4, closing a canal means changing form an operating flow condition to an almost zero discharge steady state while maintaining the prescribed water levels in all the canal pools. There are two main objectives involved in the problem of automatic closure/opening in canals. The first objective is to regulate the water levels in order to keep them as close as possible of the setpoint (constant reference). The second objective is to regulate the discharge passing through the check gates, in order to change the operating discharge within a wide range. The purpose of the control system is to manipulate the upstream discharge in order to maintain the downstream water level within specified maximum and minimum values to avoid the related problems mentioned in Section 4.2. Namely, in order to make the closure operation feasible, once the closure operation has started, the gate openings must decrease as faster as possible but avoiding overtopping, and other problems related to surpassing the safety band for the water levels. A schematic of a feedback control in a one-pool configuration irrigation system is illustrated in Figure 5.2 to control the downstream water level. Water level is used as feedback signal for the computer-based controller, which sends the control variables to the position controller through a data acquisition card (DAQ card). The computer takes the downstream water level to calculate the control variable at each sampling time. The position controller is an inner control loop that converts the desired gate openings into actual gate movements. The system considered herein can be an isolated pool or it may also be a controlled pool within a multi-pool irrigation network, such as it is considered in this thesis. Figure 5.2 Illustration of the control problem for a decentralized operation (taken from (Rodellar et al., 1993)) 5. Predictive control with dynamic constraints in canal automation 68 5.2.2 Controller architecture: supervised control The problems that arise in a closure operation when all the gates in a canal are simultaneously closed (see Subsection 4.3) and the improvements obtained when the gates are sequentially closed, suggest the convenience of an agent (supervisor) in the control system determining the right moment to move the different gates in the canal. Operating the canal gates sequentially, progressing either downstream or upstream, is a technique commonly used to change the canal system flow. On conventionally operated canals, the basic procedure is to initiate a discharge change in the headwork and progress in the downstream direction (Buyalski et al., 1991). Figure 5.3 Supervised decentralized downstream control system In supervised decentralized control, the global scheme is composed by a set of gates operating along a series of pools as depicted in Figure 5.3. The cyclic sequential movement of the gates is the responsibility of the supervisor. Each pool is seen as a system controlled by its upstream gate (Gómez et al., 2002). Every individual gate moves as a result of the computation of the control law on its corresponding decentralized controller, which may facilitate the real time operation. Hence, the overall system is decomposed into a set of coupled subsystems (controlled pools) and the design effort is placed in deriving decentralized controllers for each subsystem. Therefore, for a N-pool configuration, the controller architecture is composed by N decentralized controllers and a global supervisor, which commands the convenient order of closing the gates. Each local control unit or local controller (see Figure 5.4) is responsible for closing its motorized gate following a smooth trajectory able to maintain the water level in the pool inside the allowed safety band. 5. Predictive control with dynamic constraints in canal automation 69 Figure 5.4 Decentralized control of a single-pool configuration The predictive local controllers designed in this dissertation consider the interactions between adjacent pools. Check structures, such as gates and offtakes are located along the canal and strongly interact with the canal dynamics. Thus, the whole canal has to be regarded as a complex dynamic system with high number of variables related to states, inputs and outputs. (Gómez et al., 2002). In this way, an upstream gate movement affects directly the controlled water levels of its controlled pool but also the water level in neighbor pools, namely the interactions occur between input and output of adjacent pools in the system. Consequently, disturbances occur both downstream and upstream. There are two unknown disturbances considered in the proposed controller, first the downstream disturbances caused by the downstream gate opening and second, the lateral offtakes/intakes. Therefore, each controller includes in its control law the control actions computed by its neighbors as a measurable disturbance (feedforward input). Three operating modes at supervisory level are proposed:  Normal  Closure  Opening The operating mode (OM) is determined manually by the water manager depending on the operation that the facility requires to fulfill. In normal operating mode, the main goal of the control system is to keep the water levels as close as possible to the setpoints, this goal is enough to judge the controller’s ability to deliver the needed offtakes discharges (Clemmens et al., 1998). There is no abrupt changes in the operating conditions under normal operation. The closure operation mode means change from a baseline operating regime to setting zero discharge conditions by closing all the gates along the canal. The discharge decreasing tendency is imposed once the supervisory level decides to close the canal. In the opening operation mode, the gates are moved in order to restarting the operating discharge from zero. 5. Predictive control with dynamic constraints in canal automation 70 The supervisory level in the controller is the monitoring structure responsible for the following tasks:  Coordinating the sequential operation of each local controller. For closure mode without disturbances, the sequence initiates with a discharge change in the headwork and progress in the downstream direction, then the sequence repeats itself till to reach zero flow in all the pools. Meanwhile, on opening operation without disturbances, the sequence of operation is to initiate a discharge change in the headwork and progress in the downstream direction, then the sequence repeats itself till to reach the new steady state with a baseline flow in all the pools.  Scheduling the controller parameters according to the OM. The predictive controller parameters, prediction horizon, constraints, and weighting factor, are different for each operating mode. Tuning of each controller must be done offline and separately. In the normal operating mode, for instance, the plant model and constraints are time-invariant because the operation is assumed to be around a particular operating point. In the closure (or opening) operating mode, the supervisor changes the parameters of the dynamic constraints that determines the maximum discharge of each controlled pool in the presence of unknown disturbances. Namely, the constraints are dynamic because change over the time (see Subsection 5.3.3).  Locating disturbances. In the presence of an unexpectedly large disturbance, the supervisor must detect the location where a sudden raise of water level has occurred and then to decide which is the next controller to operate during the closure operation. For instance, in case of an unexpectedly large intake QW1 (see Figure 5.3) during a closure operation, the supervisor sends an enable signal to the local controllers in order to restart the sequence with a change in the position of gate G2 first. Meanwhile, in case of an unexpectedly intake QW2, the supervisor decides to restart the sequence changing the position of G3 first, in order to reduce the effect of the disturbance. 5.3 Local water level predictive controllers In this section, a generic control law is formulated using predictive control. In a first step, the control is derived assuming no constraints; a further step introduces constraints in the control variable. 5.3.1 Unconstrained Predictive Control Predictive control essentially relies on the use of a model able to predict the system output as a function of the system inputs on a moving horizon scenario. The model allows to compute the control sequence that makes the predicted output to track the setpoint through the minimization of 5. Predictive control with dynamic constraints in canal automation 71 the cost function. The model is usually given as a difference equation. In this work it is assumed that the process is described by the following discrete transfer function: 𝑦(𝑧)=𝐵(𝑧−1) 𝐴(𝑧−1)[𝑢(𝑧)+𝑤(𝑧)] (5.1) where 𝑦(𝑧) is the output variable with the 𝑍-transform applied to 𝑦(𝑘), 𝑢(𝑧) is the control action or input and 𝑤(𝑧) is the measurable disturbance. 𝐴(𝑧−1) and 𝐵(𝑧−1) are the polynomials: 𝐵(𝑧−1)=𝑏1𝑧−1+𝑏2𝑧−2+⋯ 𝑏𝑚𝑧−𝑚 (5.2) 𝐴(𝑧−1)=1−𝑎1𝑧−1+𝑎2𝑧−2+⋯ 𝑎𝑛𝑧−𝑛 (5.3) The next step in the design process is to compute the future control signal sequence that will make the predicted output equal to a conveniently selected output trajectory along the prediction horizon. Incremental formulation of the predictive model is used in this dissertation because it introduces some practical advantages in the real time implementation. One of the advantage is that the incremental formulation is able to handle potential steady state deviations from the setpoint due to load disturbances (Martín Sánchez & Rodellar, 1996). Taking a difference operation at instant k, the control action 𝑢(𝑘) and the predicted output 𝑦(𝑘) can be written as ∆𝑢(𝑘)=𝑢(𝑘)−𝑢(𝑘−1) ∆𝑦(𝑘)=𝑦(𝑘)−𝑦(𝑘−1) where ∆𝑢 is the incremental control variable, and ∆𝑦 is the incremental output. A predictive model is used to predict the sequence of incremental outputs ∆𝑦(𝑘+𝑗|𝑘) as a function of an incremental control sequence ∆𝑢(𝑘+𝑗−1|𝑘) over the entire interval [𝑘,𝑘+𝜆] at the present sampling instant 𝑘, namely ∆𝑦(𝑘+𝑗|𝑘)=∑𝑎𝑖∆𝑦(𝑘+𝑗−𝑖|𝑘) 𝑛 𝑖=1 + +∑𝑏𝑖∆𝑢(𝑘+𝑗−𝑖|𝑘)+ 𝑚  𝑖=1 ∑𝑐𝑖∆𝑤(𝑘+𝑗−𝑖|𝑘) 𝑝 𝑖=1 (5.4) 𝑗=1,2,… 𝜆 Where 𝑦(𝑘+1−𝑖|𝑘)=𝑦(𝑘+1−𝑖) 𝑖=1,…,𝑛 𝑤(𝑘+1−𝑖|𝑘)=𝑤(𝑘+1−𝑖) 𝑖=1,…,𝑝 𝑢(𝑘+1−𝑖|𝑘)=𝑢(𝑘+1−𝑖) 𝑖=1,…,𝑚 (5.5) where 𝑦(𝑘+1−𝑖) and 𝑢(𝑘+1−𝑖) are the measured output and inputs already applied at instant 𝑘. 𝑤(𝑘+1−𝑖) is the measureable disturbance at the present time 𝑘. This extended prediction thus includes the specific case of λ=1. In problems where disturbances are known in advance, the disturbances may be added to the controller in order to introduce feedforward 5. Predictive control with dynamic constraints in canal automation 72 capability, which allows both tracking setpoint changes and overcoming the unmeasured disturbances that are usually present in the canal. The controller proposed in this dissertation is based on a decentralized control strategy, therefore the predictive model (5.4) describes a single-input, single-output (SISO) process. Hereinafter, the formulations of the local controller are based on the model (5.4). At every sampling time, the future sequence of control actions is optimized over the prediction horizon. The optimization is fulfilled by minimizing an objective function with penalties on deviations from setpoint and penalties on requested control signal changes. The objective function used in this dissertation is the following linear quadratic function: 𝐽=∑𝛹𝑗(𝑦(𝑘+𝑗|𝑘)−𝑦𝑟(𝑘+𝑗|𝑘))2 𝜆 𝑗=1 + ∑𝑅𝑗∆𝑢(𝑘+𝑗|𝑘)2 𝜆−1 𝑗=0 (5.6) where 𝑦𝑟(𝑘+𝑗|𝑘) is a reference trajectory. 𝛹𝑗 and 𝑅𝑗 are weighting factors defined for each future time 𝑘+𝑗. For simplicity, they can be constant (𝛹, 𝑅) along the whole prediction horizon. The next step is to express the predictive model (5.4) as a function of the information of the process inputs and outputs at instant 𝑘, as well as the predicted control input, ∆𝑢. In this way, by using the initial condition (5.5) recursively, the predictive model (5.4) may be written as follows: ∆𝑦(𝑘+𝑗|𝑘)=∑𝑒𝑖(𝑗) ∆𝑦(𝑘+1−𝑖) 𝑛 𝑖=1 + ∑𝑔𝑖(𝑗)∆𝑢(𝑘+1−𝑖)+ 𝑚  𝑖=2 ∑𝑑󰆹𝑖(𝑗)∆𝑤(𝑘+1−𝑖) 𝑝 𝑖=2 +∑𝑔1(𝑗−𝑖)∆𝑢(𝑘+𝑖|𝑘) 𝑗−1 𝑖=0 +∑𝑑󰆹1(𝑗−𝑖)∆𝑤(𝑘+𝑖|𝑘) (𝑗=1,2,…,𝜆) 𝑗−1 𝑖=0 (5.7) Assuming that future disturbances 𝑤(𝑘+𝑖|𝑘) for 𝑗>0 remain unchanged and constant, then the values ∆𝑤(𝑘+𝑖|𝑘)=0, and equation (5.7) may be simplified as follows: ∆𝑦(𝑘+𝑗|𝑘)=∑𝑒𝑖(𝑗)∆𝑦(𝑘+1−𝑖) 𝑛 𝑖=1 + ∑𝑔𝑖(𝑗)∆𝑢(𝑘+1−𝑖)+ 𝑚  𝑖=2 ∑𝑑󰆹𝑖(𝑗)∆𝑤(𝑘+1−𝑖|𝑘) 𝑝 𝑖=1 +∑𝑔1(𝑗−𝑖)∆𝑢(𝑘+𝑖|𝑘) 𝑗−1 𝑖=0 (𝑗=1,2,…,𝜆) (5.8) 5. Predictive control with dynamic constraints in canal automation 79 𝐽=[𝜃𝑇−∆𝑈𝑇𝐺0𝑇𝑍𝑇]𝛹[𝜃−𝑍𝐺0∆𝑈]+∆𝑈𝑇𝑅∆𝑈 𝐽=𝜃𝑇𝛹𝜃−𝜃𝑇𝛹𝑍𝐺0∆𝑈+∆𝑈𝑇𝐺0𝑇𝑍𝑇𝛹𝑍𝐺0∆𝑈−∆𝑈𝑇𝐺0𝑇𝑍𝑇𝛹𝜃+∆𝑈𝑇𝑅∆𝑈 Grouping the elements with common factor: 𝐽=𝜃𝑇𝛹𝜃−2∆𝑈𝑇𝐺0𝑇𝑍𝑇𝛹𝜃+∆𝑈𝑇[𝐺0𝑇𝑍𝑇𝛹𝑍𝐺0+𝑅]∆𝑈 (5.32) Finally, replacing (5.30) into (5.32) leads to 𝐽=[𝑌𝑟−𝑍(𝐸∆𝑌−𝐺∆𝑈−𝑃∆𝑊)−𝑌𝑘]𝑇𝛹[𝑌𝑟−𝑍(𝐸∆𝑌−𝐺∆𝑈−𝑃∆𝑊)−𝑌𝑘] −2∆𝑈𝑇𝐺0𝑇𝑍𝑇𝛹[𝑌𝑟−𝑍(𝐸∆𝑌−𝐺∆𝑈−𝑃∆𝑊)−𝑌𝑘] +∆𝑈𝑇[𝐺0𝑇𝑍𝑇𝛹𝑍𝐺0+𝑅]∆𝑈 (5.33) Due to the first factor of (5.33) does not depend on ∆𝑈, the optimization problem (5.28) may be reformulated considering (5.33) as follows: min ∆𝑈 𝐽=−2∆𝑈𝑇𝐺0𝑇𝑍𝑇𝛹[𝑌𝑟−𝑍(𝐸∆𝑌−𝐺∆𝑈−𝑃∆𝑊)−𝑌𝑘] +∆𝑈𝑇[𝐺0𝑇𝑍𝑇𝛹𝑍𝐺0+𝑅]∆𝑈 (5.34) Subject to: −∆𝑢(𝑘)≤−∆𝑢𝑚𝑖𝑛 ∆𝑢(𝑘)≤∆𝑢𝑚𝑎𝑥 ∆𝑢(𝑘)≤𝑈𝑚𝑎𝑥−𝑢(𝑘−1) −∆𝑢(𝑘)≤−𝑈𝑚𝑖𝑛+𝑢(𝑘−1) In order to formulate the problem (5.34) as (5.29) comparing factors, let us consider: 𝑢=∆𝑈 𝐽= 12𝑢𝑇𝐻𝑢+𝑢𝑇𝑏 where 𝐻=𝐺0𝑇𝑍𝑇𝛹𝑍𝐺0+𝑅 (5.35) 𝑏=−2𝐺0𝑇𝑍𝑇𝛹[𝑌𝑟−𝑍(𝐸∆𝑌−𝐺∆𝑈−𝑃∆𝑊)−𝑌𝑘] (5.36) Meanwhile, the inequalities in (5.34) may be expressed in a matrix form as follows: 𝛾=[ ∆𝑢𝑚𝑎𝑥 ∆𝑢𝑚𝑖𝑛 𝑈𝑚𝑎𝑥−𝑢(𝑘−1) −𝑈𝑚𝑖𝑛+𝑢(𝑘−1)] (5.37) Due to the predictive controller only implements the first sample of the ∆𝑈 sequence, the matrix 𝑀 in (5.29) may be considered as follows: 5. Predictive control with dynamic constraints in canal automation 80 𝑀=[ 1 0 0… 0 −1 0 0 …0 1 0 0… 0 −1 0 0… 0 ] ⏟ (5.38) where 𝑀∈ℝ4𝑥𝜆 . Finally, within the optimization framework, the complete constrained predictive control problem (5.28) is reformulated as follows: min ∆𝑈 12∆𝑈𝑇[𝐺0𝑇𝑍𝑇𝛹𝑍𝐺0+𝑅]∆𝑈−∆𝑈𝑇𝐺0𝑇𝑍𝑇𝛹 [𝑌𝑟−𝑍(𝐸∆𝑌−𝐺∆𝑈−𝑃∆𝑊)−𝑌𝑘] 𝑠.𝑡.: 𝑀∆𝑈≤[ ∆𝑢𝑚𝑎𝑥 ∆𝑢𝑚𝑖𝑛 𝑈𝑚𝑎𝑥−𝑢(𝑘−1) −𝑈𝑚𝑖𝑛+𝑢(𝑘−1)] (5.39) Downstream water level control As was mentioned in Section 5.2, the irrigation canal control stated in this dissertation defines the discharge as control variable and the water level as controlled variable. The discharge is used as control variable in order to state the control problem as linear, the use of gate opening directly would lead to a nonlinear control problem (Sepúlveda, 2008). The optimal solution of (5.39) gives the values of the incremental control action at instant k for the canal in a normal operating mode. In normal operation the main goal is achieve a water level error equal to zero. In the decentralized operation, the control algorithm computes the required gate discharge at every pool as follows: 𝑄(𝑘)=𝑈(𝑘)=∆𝑈(𝑘)+𝑈(𝑘−1) (5.40) Finally, a gate discharge controller (see Figure 5.4) converts the required discharge into gate opening (L) in the real-time algorithm by inverting the gate discharge equation (Chow, 1988) as follows: 𝐿(𝑘)= 𝑄(𝑘) 𝐶𝑑𝑓𝐵𝐿√2𝑔(𝑦1(𝑘)−𝑦2(𝑘)) (5.41) 5.3.3 Predictive control with dynamic constraints The control scheme derived in Section 5.3.2 presumes that the canal is operating in a normal mode. Two objectives are involved in the optimal predictive control: minimizing the error (𝑒=𝑌𝑟−𝑌) between the controlled water level and the reference trajectory related to the setpoint, while keeping the control variable within “small” enough values and increments, as prescribed by the following cost function subject to specified constraints: 5. Predictive control with dynamic constraints in canal automation 81 𝐽=[𝑌𝑟−𝑌]𝑇𝛹[𝑌𝑟−𝑌]+∆𝑈𝑇𝑅∆𝑈 (5.42) In a canal closure operation, a third control objective needs to be addressed, which is conflicting with the objectives in the normal mode operation: it is the fact that the control variable has to decrease throughout time since the goal is that the gate openings decrease to get closed. The closure operation of a canal by manipulating the discharges under gates is not an easy task. Decreasing the discharge by means of closing an upstream gate affects directly two controlled water levels (𝑦1 and 𝑦𝑑) in adjacent pools as it is illustrated in Figure 5.5 and described by the following relation: 𝑄=𝐶𝑑𝑓𝐵𝐿√2𝑔(𝑦1−𝑦2) (5.43) Figure 5.5 One pool configuration canal On the other hand, during the closure operation, the control must keep the water level within specified maximum and minimum safety levels to avoid problems in the canal as it has been mentioned in the Subsection 4.3.1. There are two natural reactions in case of a closing warning. The first natural reaction is to consider closing all the gates in the canal at maximum velocity, however this reaction may result on overtopping as has been illustrated in some scenarios in Subsections 4.5.1 and 4.5.2. The second reaction is to move the gates slowly and as smooth as possible during the closure operation. However, this reaction is conflicting with the fact that feasibility of closure operation depends on the closing velocity. For instance, night closure must be as fast as possible to make it feasible, as it has been discussed in Section 4.4. Consequently, minimizing the cost function (5.42) as an attempt to minimize the error during the closure operation is not enough to solve the challenging problem in closing/opening operating modes. Then, the optimization problem with only one cost function is not feasible because two control objectives cannot be achieved simultaneously. Therefore the predictive control problem must be reformulated in a multiobjective way. Another contribution of this thesis is related to handling a predictive control problem that cannot be solved optimizing the typical cost function (5.42) even considering time-invariant constraints. The problem is tackled with a versatile strategy 5. Predictive control with dynamic constraints in canal automation 82 called dynamically-constrained predictive control (DCPC), which keeps the constrained predictive control formulation presented in previous section, but introducing dynamic constraints to help to drive the closure operation smoothly with the maximum discharge changes, while keeping the water level under the control objectives. The physical idea is to restrict the control variable inside a moving interval that makes the gates to follow a smooth trajectory along the time. A significant number of simulation and experimental results executed in the cases of study proposed in this dissertation, have led to the evidence that a very convenient shape for a smooth gate trajectory that drastically reduces the amplitude peak value of the resulting water profile oscillation is the trajectory given by a sigmoid function. The sigmoid function, also called the sigmoidal curve, is a bounded differentiable real function. The curve has a pair of horizontal asymptotes as 𝑡→±∞. In the DCPC context applied to irrigation canal control, the sigmoid function may be expressed as follows: 𝑈𝑚𝑎𝑥(𝑡)= 𝑄𝑚 1+𝑒−𝑎(𝑡−𝑐) (5.44) where a is the slope of the curve, 𝑄𝑚 is the maximum amplitude (discharge), the parameter c determines the time where value 𝑈𝑚𝑎𝑥 is half of 𝑄𝑚 and t is the time. Depending of the sign of the parameter a, the function is inherently open to right or to the left. Values less than zero are useful for closure operations and greater than zero for opening operations. Whether the discharge under gate follows an imposed sigmoidal function, the velocity of the closure of each gate in a multiplepool canal may be managed just varying the parameters, a and c. Figure 5.6 (left) illustrates an example of sigmoidal function with values of c=100 min, 𝑄𝑚=15.06 m3/s and 𝑎=−0.0011. Figure 5.6 (right) illustrates an example of sigmoidal function with values of c=100 min, 𝑄𝑚= 15.06 m3/s and 𝑎=0.0011. Figure 5.6 Examples of sigmoidal functions used as dynamic constraints. In the proposed DCPC strategy, each local predictive controller considers two constraints. The first constraint is the time-invariant constraint related to discharge slew rate (5.21). The second one, is the time-variant constraint related to the discharge range (5.24). 050 100 150 200 250 0 2 4 6 8 10 12 14 16 Umax (m3/s) t (min) Closure 050 100 150 200 250 0 2 4 6 8 10 12 14 16 Umax (m3/s) t (min) Opening 5. Predictive control with dynamic constraints in canal automation 83 At each control instant k, the optimal control problem (5.39) is solved to obtain the discharge control under the gate, where constraints are imposed on the increment (∆𝑢𝑚𝑎𝑥) and the absolute value (𝑈𝑚𝑎𝑥). In the case of a closure operation (similarly for opening), when the water master decides to initiate the operation, the sigmoidal function is used in the solution of the control problem (5.39). Time t=0 in Figure 5.6 is the initial time and, for subsequent control instants k, the constraint on the discharge amplitude is made time-varying (𝑈𝑚𝑎𝑥(𝑘)) and it is determined by the sigmoidal function (5.44) with 𝑡=𝑘𝑇𝑠 (𝑇𝑠 is the sampling time). Therefore, the sigmoidal function is used in the DCPC control as a dynamic constraint imposed to the controller in order to allow the discharge under gates change along the time in a smooth way in the direction of closing or opening, depending on the operation mode. 5.4 Supervised decentralized predictive control (SDPC) The result of Section 5.3 is a control scheme able to govern the upstream gate of a single pool through the solution of the optimal predictive control (5.39) at each control instant k, including the dynamic constraints in the closure and opening modes. When the objective is to control a multipool canal, the individual controllers are assembled to set up the overall supervised decentralized predictive control (SDPC) scheme outlined in Section 5.2.2 and illustrated in Figure 5.3 The supervisor is responsible for managing a cyclic sequential movement of each motorized gate that delimits the pool of the entire irrigation canal. The supervisor may be located at headquarter (master station). Each subsystem corresponds with a controlled pool. Each decentralized control (control unit) is a local automatic water level controller. Each control unit requires the current state of its controlled pool and information of neighbor pools. For the practical implementation, the proposed control system requires a remote terminal unit (RTU). The RTU monitors the water levels and equipment status, and transmit these data to the supervisor. The supervisor is also responsible for scheduling the parameters of the controllers depending on the operating mode. Particularly important is the management of the constraints in the closure and opening modes, which becomes fundamental in the presence of unexpectedly large disturbances. In a well (a priori) defined operation scenario (a closure, for instance) the supervisor may tune the sigmoidal curve to state reasonable dynamic constraints according to the maximum allowed discharge for each controlled pool. However, during a closure operation, the presence of an unexpectedly large disturbance may force the control variable outside its limits. Therefore, the optimizer cannot find a practical value to introduce the control variable into its feasible region. In these circumstances, the constraints become temporarily incompatible (Camacho & Bordons, 2004) and the predictive control problem can become infeasible, because the region defined for the control variable by the set of constraints is empty. In the proposed DCPC control scheme, a large disturbance may occur under two situations. The first situation is a sudden discharge change more than 10% of the operating discharge with regard to the previous discharge. The second situation is a sudden change in water level greater than 5% of the set point with regard to the previous measured water level. 5. Predictive control with dynamic constraints in canal automation 84 The solution proposed in this thesis to tackle the unexpectedly large disturbance problem, is a supervised automatic control that reshapes systematically the sigmoidal function through the constraints relaxation. The relaxation or softening is present throughout the disturbance. As a result of relaxation, constraints related to the control variable range are treated as soft constraints in the optimization problem statement. In the literature of quadratic programming, constraints which cannot violated are referred to as hard constraints, while those which can be violated are known as soft constraints (Camacho & Bordons, 2004). In order to include the soft constraints, the general form of constraints are expressed as follows: 𝑀∆𝑢≤𝛾+𝑉z (5.45) In this inequality, matrix M, vectors 𝛾 and 𝑉 depend on both process parameters and signal limits. M, and 𝛾 are calculated before starting an operation that involve an abrupt change in the operating condition. Matrix M and hard constraints related to discharge slew rate do not change throughout the closure/opening operations. Meanwhile, z depends on the process state that changes every sampling time, and it is recomputed accordingly to the disturbances along the canal. For instance, in the presence of a positive disturbance caused by a strong runoff or a storm that add water to a pool during a closure operation, constraints relax by increasing its value. With soft constraints, the optimization problem (5.29) is modified to min 𝑢 12𝑢𝑇𝐻𝑢+𝑢𝑇𝑏 𝑠.𝑡.: 𝑀𝑢≤𝛾+𝑉z (5.46) Consequently, the complete optimization problem (5.39) may be expressed as follows: min ∆𝑈 12∆𝑈𝑇[𝐺0𝑇𝑍𝑇𝛹𝑍𝐺0+𝑅]∆𝑈 −∆𝑈𝑇𝐺0𝑇𝑍𝑇𝛹[𝑌𝑟−𝑍(𝐸∆𝑌−𝐺∆𝑈−𝑃∆𝑊)−𝑌𝑘] (5.47) 𝑠.𝑡.: 𝑀∆𝑈≤ [ ∆𝑢𝑚𝑎𝑥 ∆𝑢𝑚𝑖𝑛 𝑈𝑚𝑎𝑥(𝑘)−𝑈(𝑘−1) −𝑈𝑚𝑖𝑛(𝑘)+𝑈(𝑘−1) ] +[0011][𝑄𝑤𝑖(𝑘)] (5.48) where the 𝑈𝑚𝑎𝑥 value is computed at any control instant, k according to the sigmoidal function (5.44), 𝑈𝑚𝑖𝑛=𝑈𝑚𝑎𝑥−𝐵𝑝𝑧 , where 𝐵𝑝𝑧 is a scalar that determines the width of the permitted zone during a close/opening operation and 𝑄𝑤𝑖 is the disturbance of i-th pool of the canal (lateral offtake/intake). When this control problem is integrated to the overall decentralized control scheme, the supervisor plays two important roles in: a) locating the pool where the large disturbance 𝑄𝑤𝑖 occurs, and b) re-tuning the sigmoidal trajectory to adapt to the new discharge conditions. Practical details illustrating these issues are made clear in chapter 6, in different scenarios involving large disturbances. 5. Predictive control with dynamic constraints in canal automation 85 5.5 Computational implementation There is not an explicit analytic solution of the optimization problem (5.46) as it exists in the case without constraints. Subsequently, the predictive control problem may be solved minimizing the quadratic cost function and the linear constraints recursively (Camacho & Bordons, 2004). The predictive control solves the optimal control problem, this is performed on-line for the current state of the plant at each control instant k considering the moving prediction horizon. The initial state is the current state of the system being controlled. There are several techniques to solve the quadratic programming problem. (Camacho & Bordons, 2004) shows a revision of the main algorithms used in predictive control. This section is not intended to describe in detail an optimization technique, merely to highlight some relevant aspects of the algorithm used in this dissertation. To obtain the numerical solution of the constrained optimization problem, the Hildreth’s quadratic programming algorithm (Luenberger, 1969), (Wismer & Chattergy, 1978) has been used in this dissertation. The Hildreth’s procedure solves the optimization problem (5.46). All the required information about the algorithm can be found in (Wang, 2009). To deal with inequality constraints, the Hildreth’s procedure reduces the problem to an equality constraint problem using Lagrange multipliers. In this way, the procedure solves the following dual problem: max 𝜆≥0min 𝑢[12𝑢𝑇𝐻𝑢+𝑢𝑇𝑏+𝜆𝑇(𝑀𝑥− 𝛾)] (5.49) The problem (5.49) considers the so-called Lagrange expression, which is expressed as the objective function 𝐽𝐿=12𝑢𝑇𝐻𝑢+𝑢𝑇𝑏+𝜆𝑇(𝑀𝑥− 𝛾) (5.50) The minimization of the Lagrange expression, gives the optimal λ and u taking the first partial derivatives and then equating these derivatives to zero (Wang, 2009): 𝜕𝐽𝐿 𝜕𝑢=𝐻𝑢+𝑏+𝑀𝑇𝜆=0 (5.51) 𝜕𝐽𝐿 𝜕𝜆=𝑀𝑥− 𝛾=0 (5.52) Both equations (5.51) and (5.52) contain n+m variables u and λ, where n is the dimension of u and m is the dimension of λ. The variables u and λ are the necessary conditions for minimizing the Lagrange expression with equality constraints. The Lagrange multipliers are the elements of vector λ. Isolating u from (5.51) and then replacing it into (5.52) leads to 𝑢=−𝐻−1(𝑀𝑇𝜆+𝑏) (5.53) 5. Predictive control with dynamic constraints in canal automation 86 𝜆=−(𝑀𝐻−1𝑀𝑇)−1 (𝛾+𝑀𝐻−1𝑏) (5.54) The optimal solution of (5.46) using a simple and effective algorithm implemented with the Hildreth’s procedure gives the values of the incremental control action at instant k of the supervised decentralized predictive control with dynamic constraints. The implementation of the algorithm in Matlab (Mathworks, 2008) is shown in appendix A. 5.6 Concluding remarks The main outcome of this chapter is a supervised decentralized predictive control strategy for the automatic operation of a multi-pool irrigation canal. Local controllers are derived based on the on-line computational solution of optimal control problems with time-varying constraints. A supervisor is used to manage the sequential operation of the local controller and the tuning of the constraints, particularly in the closure/opening scenarios in the presence of large unknown disturbances. Practical details related to the implementation and the performance are presented and discussed in the next chapter. 6. Simulation and real-time results 87 6 Simulation and real-time results Chapter 6 Simulation and real-time results 6.1 Introduction The aim of this chapter is to illustrate, by both simulation and experimental results, the performance of the supervised decentralized predictive control (SDPC) with dynamic constraints developed in Chapter 5, as a convenient strategy for the automatic closure and opening of irrigation canal systems. The simulations results in the two cases of study have been obtained using the SIC software. The SDPC is tested in real time in the experimental facility of the Technical University of Catalonia. This chapter also shows some practical aspects related to the real-time implementation in the laboratory canal to allow doing experiments involving abrupt changes in the canal operating points. 6.2 Simulation results in the case studies The simulations of this subsection are mainly focus on the unsteady flow calculation. Simulation experiments are stablished to test scenarios that involve abrupt changes in the operating regime. All simulation experiments start from a steady state conditions. All the algorithms have been implemented using Matlab/Simulink environment (Mathworks, 2008). The interaction between the control algorithms and the hydraulic scenarios implemented in SIC is achieved using the regulation module available in SIC. 6. Simulation and real-time results 88 Figure 6.1 Performance evaluation indexes In order to evaluate the perfomance of the control system in irrigation canals, test experiments as setpoint tracking and disturbance rejection are fulfilled. Some performances indexes suggested by the American Society of Civil Engineers (ASCE) committee are considered to evaluate the performance. The strength of the control system against modeling error and disturbances is also assessed (see the concept map depicted in Figure 6.1). The evaluation of the waveform is related to the oscillatory nature of the response of the water levels. This oscillatory behavior prevents the controlled variable to reach the setpoint value quickly. If the oscillations increase, water level becomes considerably larger than the setpoint. This situation might lead to harmful effects on the canal as was depicted in Subsection 4.3. A performance index such as maximum absolute overshoot is included in the properties of the waveform. In order to evaluate the quality of the controlled responses, the following error based performance indexes proposed by (Clemmens et al., 1998) are used in this dissertation: RMSE: Root Mean Squared Error MAPE: Mean Absolute Percentage Error ISE: Integral Squared Error IAE: Integral Absolute Error MAO: Maximum Absolute Overshoot SSE: Steady State Error The performance indexes are defined as follows: 𝑅𝑀𝑆𝐸=√1𝑁∑(𝑌𝑘−𝑌𝑘)2 𝑁 𝑘=1 𝑀𝐴𝑃𝐸=100 𝑁√∑|𝑌𝑘−𝑌𝑘 𝑌𝑖| 𝑁 𝑖=1 6. Simulation and real-time results 95 Figure 6.6 Sigmoidal function of 𝑆𝑃3, with 𝑎=0.014, c=5 min, 𝑦3∗ =65 cm and 𝑦3(0)=35 cm The closed-loop automatic control exhibits a positive behaviour based on various performance indexes. The maximum absolute overshoots of both levels are lower than 2%. The MAO of 𝑦1is 88.73 cm, which is equivalent to 0.83% of SP1. The MAO of 𝑦2 is 78.3 cm, which is equivalent to 1.72% of SP2. The steady state errors are: 0.44 cm for 𝑦1, 0.4 cm for 𝑦2 and 0.45 cm for 𝑦3. These values are lower than 1.5 % of every water level setpoint.  Scenario 3: This scenario is devoted to analyze the automatic closure in the presence of a strong disturbance. The lateral offtake Qw1 of 41 l/s is present during 0≤𝑡≤2 min. After on, the disturbance changes suddenly to 0 l/s. The test is detailed in Table 6-5. Time [sec] Qop [l/s] SP1 [cm] SP2 [cm] SP3 [cm] W1 [cm] QW1 [l/s] W2 [cm] QW2 [l/s] W4 [cm] 0 131 82 73 61.2 65 41 90 0 35 5 131 82 73 -- 65 41 90 0 35 120 120 82 73 -- 90 0 90 0 35 480 0 82 73 -- 90 0 90 0 35 Table 6-5 Disturbance test in the Scenario 3. The 41 l/s are equivalent to 31% of the operating discharge in the first pool of the canal. The purpose of this scenario is to resemble that, at the beginning of the simulation, there were a farmer irrigating his/her local crops during the closure operation. However, at time t = 2 min, the farmer suddenly decided stop irrigation due to a warning of closure. In this scenario, only the appointed disturbance is considered, the lateral offtake Qw2 being equal to zero. The closure operation of Scenario 3 under SDPC is depicted in Figure 6.7. The closing time is 7.5 minutes approximately. The process duration is longer than the closure operation without 0 5 10 15 20 35 40 45 50 55 60 65 Setpoint of water level y 3 (cm) Time, t (min) SP3 6. Simulation and real-time results 96 disturbances due to that the supervisor redefines the dynamic constraints to deal with the strong disturbance (as it is explained in Subsection 6.3.4). The higher the disturbance, the longer the closing time. The closed-loop automatic control exhibits a satisfactory behaviour even in presence of disturbance along the closure operation. The maximum absolute overshoots of both levels are lower than 7%. The MAO of 𝑦1is 87.16 cm, which is equivalent to 6.3% of SP1. The MAO of 𝑦2is 73.6 cm, which is equivalent to 0.83% of SP2. The SSE for y1 and y2 are 0.13 and 0.07 cm respectively, which represent values lower than 1 % of the setpoint for both cases. Figure 6.7 Simulation results of closure operation with disturbance test at canal PAC-UPC. 6.3.4 Discussion of results In all the scenarios, water levels in each pool remain inside the safety band along both transient and steady response. As it can be noted in figures 6.4, 6.5 and 6.7 there is no overtopping neither in the closure nor in the opening operation. The closure operation performance has improved comparing to open-loop closure operations illustrated in the local manual closure at Section 4.5.1. The laboratory canal is prismatic and the lengths of the first two pools are quite similar (87 m and 90.2 m respectively). As a consequence, the dynamic constraints for pools 1 and 2 are quite similar during a closure operation without disturbances, as it is illustrated in Figure 6.8 (left). The sigmoidal function that determines the constraint for discharge in the third pool, 𝑈𝑚𝑎𝑥3, has a little 0 2 4 6 8 10 12 0.4 0.6 0.8 1 Water Level (m) Scenario 3 y1 y2 y3 0 2 4 6 8 10 12 0 50 100 Discharge (l/s) QG1 QG2 QG3 QW1 0 2 4 6 8 10 12 0 10 20 30 Gate Opening (cm) t (min) L1 L2 L3 6. Simulation and real-time results 97 bit higher slope because the length of pool 3 (45 m) is approximately a half of pools 2 and 1. As it has been observed from the experimental data, the time delay of pool 3 is lower than the first two pools in the laboratory canal. In closure scenarios without disturbances, the gate openings decrease in a smooth way till reach the zero gate position. The supervisor set the parameters of the dynamic constraint that determines the maximum discharge of the i-th pool following the sigmoidal function (5.44). On the other hand, if a sudden raise of the water level occurs, then the supervisor will reshape the dynamic constraints in the next sampling time. The supervisor is checking values of water levels at every sampling time and compares current values with previous values in order to determine higher rates of water level changes caused by a change in the lateral offtake/intake (disturbance). Consequently, the dynamic constraints (and therefore the gate openings) are different in the presence of disturbances, as it is illustrated in Figure 6.8 (Scenario 3). As a consequence of the measurement of the higher rates of water level changes, the supervisor detects where the disturbance is located, and then it decides the way to operate the canal during the closure/opening operating mode. For instance, in the presence of a positive disturbance (intake) during a closure operation, the upstream local controller remains with the same constraint. However, the rest of downstream discharge constraints change their parameters to allow the transmission of the incorporated discharge to the canal. The gate openings change the negative slope as soon as a raise of water is detected (see Figure 6.8 and Figure 6.9 related to the Scenario 3). Assuming that 𝑄𝑤1 changes suddenly at time 𝑘=𝑘𝑑, making the water level 𝑦1 increase suddenly, then the dynamic constraint 𝑈𝑚𝑎𝑥 1(𝑘) does not change over the closing time (see Figure 6.8 related to the Scenario 1). However, the supervisor will change both constraints, 𝑈𝑚𝑎𝑥 2(𝑘) and 𝑈𝑚𝑎𝑥 3(𝑘), by means of updating their amplitude value 𝑄𝑚 2 and 𝑄𝑚 3 in proportion to the disturbance amplitude presented in the canal, namely: 𝑄𝑚 2(𝑘𝑑+)=𝑄𝑚 2(𝑘𝑑−)+𝑄𝑤1 𝑄𝑚 3(𝑘𝑑+)=𝑄𝑚 3(𝑘𝑑−)+𝑄𝑤1 where 𝑄𝑚 𝑖(𝑘𝑑+) indicates the discharge value defined a sampling time after the change of 𝑄𝑤1 and 𝑘𝑑− indicates a sampling time before the sudden change of 𝑄𝑤1. An additional way used by the supervisor to reshape the dynamic constraints in the presence of large disturbances, is by time shifting the original dynamic constraint to Δc. In this way, the original constraint given by (5.44) is modified to the following sigmoidal function: 𝑈𝑚𝑎𝑥(𝑡)= 𝑄𝑚 1+𝑒−𝑎(𝑡−(𝑐+∆𝑐) (6.2) where the parameter Δc shifts the function left or right according to its sign. Effectively, 𝑈𝑚𝑎𝑥(𝑡− 𝛥𝑐) equals what 𝑈𝑚𝑎𝑥(𝑡) was before as long as both parameters Qm and a remain with the same value. 6. Simulation and real-time results 98 Figure 6.8 Sigmoidal functions of Scenarios 1 and 3 Figure 6.9 Gate openings of Scenarios 1 and 3 6.4 Simulation of water level control at Ebro River left bank (ERLB) canal This subsection is devoted to the simulation of the downstream water level control of the ERLB canal. In order to conduct a series of simulations, the configuration depicted in Figure 6.10 has been used. Water may be drawn at four points along the length of the canal, as it is illustrated in Figure 6.10. The lateral discharges, QS1, QS2, QS3 and QS4 are the disturbances for the control system. The disturbances may be positive or negative. A positive disturbance or intake (a pumping for instance) is equivalent to impose a constant discharge as boundary condition at the 0 5 10 0 20 40 60 80 100 120 t (min) Qmax (l/s) Scenario 3 0 5 10 0 20 40 60 80 100 120 t (min) Qmax (l/s) Scenario 1 Qmax1 Qmax2 Qmax3 QW1 0 5 10 0 5 10 15 20 25 30 Gate Opening (cm) t (min) Scenario 1 L1 L2 L3 0 5 10 0 5 10 15 20 25 30 Gate Opening (cm) t (min) Scenario 3 L1 L2 L3 6. Simulation and real-time results 99 offtake in SIC. For the simulation, it is assumed that the pump has a flowmeter to measure the positive disturbance. Meanwhile, a negative disturbance is equivalent to a lateral offtake, which is a point of outflow. The negative disturbances are calculated using the formula of the discharge over a sharp crested weir (Horváth, 2013): 𝑄=23√2𝑔𝐶𝑑𝑤𝐵𝐻𝑒3/2 (6.3) where 𝐻𝑒 is the head over the weir, 𝐶𝑑𝑤 is the discharge coefficient and 𝐵 is the width of the weir. Figure 6.10 Sketch of the ERLB canal Figure 6.11 Water surface profile of initial steady state of ERLB canal obtained by SIC. The simulation for closure operation starts with an operating point of 15 m3/s. In order to obtain the initial state conditions, the gate openings are: 𝐿1=0.483,𝐿2=1.827,𝐿3=1.326,𝐿4= 1.753 and 𝐿5=2.109 m. The steady state water levels are: 𝑦1=2.5,𝑦2=2.54,𝑦3=2.46, 6. Simulation and real-time results 100 𝑦4=2.51 and 𝑦5=2.5 m. These gate openings will remain the same along 79 min of simulation. After on, at 𝑡=80 min, it is considered the beginning of the closure operation. The time 𝑡= 250 min is considered the end of the simulation for the canal closure operations. Figure 6.11 shows the backwater curves of steady state of the ERLB canal. 6.4.1 Control objective and operating scenarios The overall control objective of the predictive control system is to regulate the downstream water level while the operating flow changes in a wide range. The specific requirements to bear in mind during the automatic closure and opening operations are:  Once the closure (or opening) operation has started, the setpoints for all water levels is 2.5 m.  Managing the canal operation in order to drive the discharges from 15 m3/s to 2 m3/s in less than 3 hours, namely a three hours-settling time. This time is also a requirement for the opening operation.  The accepted steady state offset (error for the controlled water levels) is ±5 cm (2%).  The maximum absolute overshoot is expected to be less than 2.7 m, namely a percentage overshoot lower than 8%. Large overshoots are undesirable because percentage overshoot exceeding 20% produces overtopping. Nine scenarios have been designed to simulate the performance of the predictive control system with abrupt changes in the operating conditions in the canal. The first scenario is devoted to test a partial closure of the ERLB canal. Seven scenarios have been simulated in order to check the disturbance rejection during a closure operation. The eighth scenario simulates the closure operation and the ninth scenario simulates the opening operation. Simulation results include three variables, downstream water levels, discharges under gates and gate openings. In the scenarios only the appointed disturbance is considered, while the rest of the spillway discharges are equal to zero. The scenarios are the following:  Scenario 1: Partial closure from 15 m3/s to 2 m3/s with no disturbances.  Scenario 2: Partial closure with a positive disturbance (lateral intake) Qs1 of 5.8 m3/s, for 100≤𝑡≤140 min.  Scenario 3: Partial closure with a lateral intake of Qs1 of 6.8 m3/s, for 100≤𝑡≤162 min.  Scenario 4: Partial closure with a lateral intake of Qs2 of 5.8 m3/s, for 100≤𝑡≤140 min.  Scenario 5: Partial closure with a lateral intake of Qs3 of 5.8 m3/s, for 100≤𝑡≤150 min.  Scenario 6: Partial closure with a lateral offtake of Qs1 of -4.3 m3/s, for 100≤𝑡≤250 min.  Scenario 7: Partial closure with two lateral offtakes of Qs1 of -4.3 m3/s, for 100≤𝑡≤ 250 min and Qs3 of -3.8 m3/s, for 110≤𝑡≤250 min.  Scenario 8: Total closure from 15 m3/s to 0 m3/s without disturbances.  Scenario 9: Total opening from 0 m3/s to 15 m3/s without disturbances. 6. Simulation and real-time results 101 For the closure operation scenarios, 1 to 7, the downstream boundary condition at the end of the canal is determined by the scheduled hydrograph shown in Figure 6.12. The discharge starts at 15 m3/s and it ends at 2 m3/s. Changing from an operating point of 2 m3/s to zero discharge could be done closing all the gates simultaneously at maximum velocity with no risk of overtopping as it is remarked by (Soler et al., 2014). Figure 6.12 Downstream boundary condition for closure operation 6.4.2 Open-loop and closed-loop predictive control applied on the ERLB canal A considerable number of scenarios have been tested to make a comparison between open-loop and closed-loop control. The open loop control is implemented using a predictive control algorithm so-called GoRoSo (Soler et al., 2012) and the closed loop control is implemented using the supervised decentralized predictive control (SDPC) control strategy developed in this dissertation. The open-loop control assumes that there are not disturbances along the closure operation. This implies that the same gate trajectories have been implemented for Scenario 1 and the rest of scenarios (2 to 7). On the other hand, the closed-loop control considers the disturbances, therefore the supervisor will manage the dynamic constraints to achieve a positive performance even in presence of disturbances. Open-loop control The GoRoSo algorithm may be categorized as open-loop centralized predictive control. It is a feedforward control algorithm for irrigation canals based on sequential quadratic programming (SQP). The SQP method is proposed by (Fletcher, 2013) and (Luenberger, 1969). With the GoRoSo algorithm, it is possible to compute the gate trajectories that smoothly carry the canal from the initial state to the final state by keeping the downstream water levels constant (Soler et al., 2014). The algorithm minimizes a linear quadratic objective function with penalties on water level deviations from setpoint as follows: 50 100 150 200 250 0 2 4 6 8 10 12 14 16 Discharge (m3/s) t (min) Downstream Boundary Condition for closure Operation 6. Simulation and real-time results 102 𝐽=12∑(𝑦(𝑘+𝑗|𝑘)−𝑦𝑠𝑝)2 𝜆 𝑗=1 (6.4) where 𝑦𝑠𝑝 is the water level setpoint and 𝑦(𝑘+𝑗|𝑘) denotes the future water levels. The gate trajectories are calculated offline before the closure operation starts. The prediction horizon (λ) is 6-h long and it is discretized into 72 operation periods of 5 min each one. Each gate trajectory is defined by means of a piecewise time function divided into the same 72 pieces. In this way, each gate trajectory consists of 72 sequential gate openings, one for every sampling time. The implementation also considers functional constraints over the gate movements, such as the gate openings are lower than 15 cm of the previous position at every sampling time. Closed-loop control Within the SDPC strategy, the analytically obtained IDZ models described in Chapter 4 are used to make predictions of the behavior of the 5-pool configuration. The incremental formulation of the predictive control has been used to control the downstream water levels. The control action implemented in each pool is determined by equations (5.47) and (5.48) at every sampling time. The SDPC algorithm has a functional constraint over the maximum gate opening. The maximum gate opening is determined by the water level. Increasing a gate opening over the water level is pointless. However, whether during a specific time an undershoot gate goes out of the water (it means neither submerged nor free flow), the SIC software applies the unidimensional Saint- Venant equations directly to calculate the discharge in this node. Namely, SIC automatically considers that there is no effective structure when a gate opening is greater than the water depth. The decentralized controller considers the downstream disturbances caused by the change of both the output discharge and lateral offtake/intake. In the canal, pools are coupled to each other, therefore, a gate movement affects directly the controlled water levels in adjacent pools. In this way, disturbances occur both downstream and upstream. Namely, each decentralized controller considers the measured disturbances as the sum up of both the downstream discharge and the discharge change caused by the lateral disturbance. For the tuning procedure, the maximum allowed water level error is chosen to be 10 cm, namely, the maximum allowed value estimated of the water level, 𝑒𝑀𝐴𝑉𝐸 is equal to 0.1m. The MAVE of the change in discharge, ∆𝑢𝑀𝐴𝑉𝐸 is chosen to be 0.1 m3/s. For the closed-loop control system, several set of tuning values were tested in simulation. The chosen tuning parameters for the closure scenarios are detailed in Table 6-6. For the diagonal matrix of weighting factor (R), it is recommended 𝑅𝐶<2 (𝑅=𝑅𝐶𝐼𝜆𝑥𝜆 ). The sampling time for the supervisor has been fixed to 60 s. Meanwhile, the sampling time for the decentralized controllers is 300 s. The supervisor is in charge of managing the dynamic constraints for each decentralized predictive controller in case of large disturbances, in a similar way as previously described in Section 6.3.4 for the canal PAC-UPC. 6. Simulation and real-time results 103 Pool λ RC a [x10-3] c [min] ∆𝑼𝒎𝒂𝒙 [m3/s] ∆𝑼𝒎𝒊𝒏 [m3/s] Pool 1 15 1 1.1 150 0.5 0.5 Pool 2 21 1 1.2 157 0.5 0.5 Pool 3 23 1 1.5 166 0.5 0.5 Pool 4 12 1 2 178 0.5 0.5 Pool 5 9 1 2 181 0.5 0.5 Table 6-6 Parameters for each controlled pool for the closure scenarios 6.4.3 Results  Scenario1: Partial closure from 15 m3/s to 2 m3/s without disturbances. In this scenario all the spillways are closed, the spillway height being at its maximum (3 m). Discharge is only over spillway 5, at the end of the canal. Figure 6.13. Sketch of the Scenario 1 The closure operation managed by the open-loop controller is depicted in Figure 6.14. The procedure is to initiate a discharge change in the most upstream gate and progress in the downstream direction. The optimal gates trajectories for the closure operation can be seen in the bottom part of Figure 6.14. As it can be observed the performance is really positive because the closure operation transient is short (lower than 3h). The oscillations have ripple values lower than 2.552 m and the water levels remain practically around the setpoint value of 2.5 m. The maximum water level decrease is 3 cm. 6. Simulation and real-time results 104 Figure 6.14 Simulation results of automatic closure of ERLB canal under open-loop control in Scenario 1 The closure operation managed by the SDPC controller is depicted in Figure 6.15 . The closedloop control modifies the discharges under gates in a sequential order driven by the supervisor. The procedure is to initiate a discharge change in the most upstream gate and progress in the downstream direction. In the simulation results, the water depths remain practically around the setpoint value of 2.5 m. The steady state errors are lower than 2.2 cm. The closure operation generates a positive translational wave with a maximum height of 2.563 m. The automatic closure operation under the SDPC control exhibits a satisfactory performance. The values of all performance indexes proposed in Section 6.2 are detailed in Table 6-7. According to results, both controllers (open and closed loop) present a positive performance with small oscillations, none of them presenting a clear better performance for all the performance indexes. The closure generates a positive translational wave that results into oscillations along all the pools. The highest values of MAO are presented at pool 4 (2.559 for open-loop control and 2.562 for closed-loop control). The comparison of the evolution of water level error over the closing time is depicted in Figure 6.16. Given the larger prediction horizon used in the open-loop control (6 h), the gates are moved from the beginning of the closure operation, which generates small oscillations in the water levels. On the other hand, two situations, first the smaller prediction horizon of closed-loop controller, and second the almost zero slope in the sigmoidal function at the beginning of the closure operation produces small changes in gate openings and therefore, no oscillations in the water level are produced along the first 40 minutes. 50 100 150 200 250 2.4 2.5 2.6 2.7 2.8 Water Level (m) y1 y2 y3 y4 y5 50 100 150 200 250 5 10 15 Discharge (m3/s) Scenario 1: Open-Loop Control QG1 QG2 QG3 QG4 QG5 50 100 150 200 250 0 1 2 3 Gate Opening (m) Time, t (min) L1 L2 L3 L4 L5 6. Simulation and real-time results 111 Figure 6.24. Simulation results of automatic closure of ERLB canal under closed-loop control Pool Control RMSE MAPE ISE IAE MAO SSE [m] [%] [m] [m] [m] [m] Pool 1 OL 0.52444 19.157 46.756 81.417 3.3023 -0.5089 CL 0.17577 4.8579 5.2519 20.646 2.8187 0.0035 Pool 2 OL 0.14388 5.3867 3.5192 22.893 2.6845 -0.1767 CL 0.06553 2.1181 0.7301 9.002 2.65 -0.0259 Pool 3 OL 0.06210 2.1084 0.6557 8.961 2.6015 -0.0954 CL 0.06936 2.2084 0.81798 9.386 2.6437 -0.0464 Pool 4 OL 0.02829 0.8926 0.1361 3.7937 2.5696 -0.0035 CL 0.09981 2.9816 1.6938 12.672 2.6977 -0.0157 Pool 5 OL 0.00822 0.2595 0.0114 1.1029 2.513 0.01703 CL 0.01809 0.5555 0.0556 2.361 2.5328 -0.0097 Table 6-8 Performance indexes of Scenario 3 (OL = Open-Loop, CL = Closed-loop) 50 100 150 200 250 2.4 2.6 2.8 3 3.2 Water Level (m) Scenario 3: Closed-Loop Control y1 y2 y3 y4 y5 50 100 150 200 250 0 5 10 15 20 Discharge (m3/s) 50 100 150 200 250 0 1 2 Gate Opening (m) Time, t (min) L1 L2 L3 L4 L5 QG1 QG2 QG3 QG4 QG5 QS1 6. Simulation and real-time results 112  Scenario 4: Partial closure from 15 m3/s to 2 m3/s with an imposed disturbance intake of Qs2 of 5.8 m3/s. In this scenario, the intake adds water to the canal for 100≤𝑡≤140 min. For the remaining time of simulation Qs2 = 0 m3/s. Figure 6.25. Sketch of the Scenario 4 In this scenario, the open-loop control approach leads the water levels 𝑦2 and 𝑦3 outside the accepted steady state error band, as it is illustrated in Figure 6.26. On the other hand, the scenario tackled with SDPC control leads the system to a final steady state where all water level errors are lower than 5 cm, as it is shown in Figure 6.27, namely inside the safety water level band. Figure 6.26 Simulation results of automatic closure of ERLB canal under open-loop control in scenario 4 50 100 150 200 250 2.4 2.5 2.6 2.7 2.8 Water Level (m) Scenario 4: Open-Loop Control y1 y2 y3 y4 y5 50 100 150 200 250 0 5 10 15 Discharge (m3/s) QG1 QG2 QG3 QG4 QG5 QS2 50 100 150 200 250 0 0.5 1 1.5 2 2.5 Gate Opening (m) Time, t (min) L1 L2 L3 L4 L5 6. Simulation and real-time results 113 Figure 6.27. Simulation results of closure operation of ERLB canal under SDPC control in scenario 4  Scenario 5: Partial closure from 15 m3/s to 2 m3/ with the presence of the disturbance Qs3 of 5.8 m3/s, 100≤𝑡≤150 min. For the remaining time, Qs3 = 0 m3/s. Figure 6.28. Sketch of the scenario 5 50 100 150 200 250 2.4 2.6 2.8 3 3.2 Water Level (m) Scenario 4 y1 y2 y3 y4 y5 50 100 150 200 250 0 5 10 15 20 Discharge (m3/s) QG1 QG2 QG3 QG4 QG5 QS2 50 100 150 200 250 0 1 2 Gate Opening (m) Time, t (min) L1 L2 L3 L4 L5 6. Simulation and real-time results 114 In this scenario, the open-loop control leads to steady state errors of 𝑦2 and 𝑦3 greater than 5 cm, as it is illustrated in Figure 6.29. Meanwhile, the supervisor in the SDPC control considers the value of the disturbance Qs3 to reshape the constraints as described in (6.2). The final steady state errors for all water levels under SDPC control are lower than 5 cm, as it is shown in Figure 6.30. Figure 6.29 Simulation results of closure operation of ERLB canal under open-loop control in scenario 5 50 100 150 200 250 2.4 2.5 2.6 2.7 2.8 Water Level (m) Scenario 5: Open-Loop Control y1 y2 y3 y4 y5 50 100 150 200 250 0 5 10 15 Discharge (m3/s) QG1 QG2 QG3 QG4 QG5 QS3 50 100 150 200 250 0 0.5 1 1.5 2 2.5 Gate Opening (m) Time, t (min) L1 L2 L3 L4 L5 6. Simulation and real-time results 115 Figure 6.30. Simulation results of closure operation of ERLB canal under SDPC in Scenario 5  Scenario 6: Partial closure from 15 m3/s to 2 m3/s with a lateral offtake of Qs1 of -4.3 m3/s, for 100≤𝑡≤250 min. For 0≤𝑡<100 min, Qs1 is equal to zero. Figure 6.31. Sketch of the Scenario 6 50 100 150 200 250 2.4 2.5 2.6 2.7 2.8 Water Level (m) Scenario 5: Closed-Loop Control y1 y2 y3 y4 y5 50 100 150 200 250 0 5 10 15 20 Discharge (m3/s) QG1 QG2 QG3 QG4 QG5 QS3 50 100 150 200 250 0 0.5 1 1.5 2 2.5 Gate Opening (m) Time, t (min) L1 L2 L3 L4 L5 6. Simulation and real-time results 116 The implementation of a negative disturbance at node 7 in SIC is shown in Figure 6.32. A lateral offtake (discharge as function of elevation) has been selected as a boundary condition at downstream devices in the SIC window. Figure 6.32 Simulation of lateral offtake in SIC In this scenario, the final value of water level 𝑦1 is determined by the lateral weir height. However a suitable control strategy must allow the rest of the water levels remain around the setpoint of 2.5 m. The setpoint tracking is affected in the open-loop control performance because the water level 𝑦2 is around 2.4 m at the end of the simulation, as it is illustrated in Figure 6.33. The performance of the closed-loop control is better than the open-loop control partly because the SDPC control makes the closure of the downstream pools quicker than the first pool (upstream pool). Finally, the use of dynamic constraints allows gradually decrease the discharge of each pool keeping the setpoints water levels of 𝑦2,𝑦3,𝑦4 and 𝑦5 around 2.5 m, as it is illustrated in Figure 6.34. 6. Simulation and real-time results 117 Figure 6.33. Simulation results of automatic closure of ERLB canal under open-loop control in scenario 6 Figure 6.34 Simulation results of closure operation of ERLB canal under closed-loop control in scenario 6 50 100 150 200 250 1.8 2 2.2 2.4 2.6 Water Level (m) Scenario 6: Open-Loop Control y1 y2 y3 y4 y5 50 100 150 200 250 0 5 10 15 Discharge (m3/s) QG1 QG2 QG3 QG4 QG5 -QS1 50 100 150 200 250 0 0.5 1 1.5 2 2.5 Gate Opening (m) Time, t (min) L1 L2 L3 L4 L5 50 100 150 200 250 1.8 2 2.2 2.4 2.6 Water Level (m) Scenario 6 y1 y2 y3 y4 y5 50 100 150 200 250 0 5 10 15 Discharge (m3/s) QG1 QG2 QG3 QG4 QG5 -QS1 50 100 150 200 250 0 1 2 Gate Opening (m) Time, t (min) L1 L2 L3 L4 L5 6. Simulation and real-time results 118  Scenario 7: Partial closure from 15 m3/s to 2 m3/s with two disturbances, and lateral offtake of Qs1 of -4.3 m3/s at 100≤𝑡≤250 min and another Qs3 of -3.8 m3/s at 110≤ 𝑡≤250 min. For the remaining time, 0≤𝑡<100 min, Qs1 and Qs3 being equal to 0 m3/s. Figure 6.35. Sketch of the Scenario 7 Similar to the Scenario 6, the final values of water levels 𝑦1 and 𝑦3 of Scenario 7 are determined by their respective spillway heights. The automatic closure in this scenario under open-loop control leads to values of SSE of 18.96 cm for 𝑦2 and 12.44 cm for 𝑦4. Namely, both water levels 𝑦2 and 𝑦4 are lower than 2.4 m in the open loop control operation, as it is illustrated in Figure 6.37. Meanwhile, the SDPC control is able to tackle the problem of partial closure with two disturbances, allowing to improve the performance indexes for the closure operation, as it is indicated in Table 6-9, for instance, the steady state errors are 0.88 cm for 𝑦2 and 0.44 cm for 𝑦4. Simulation results of closure operation of ERLB canal under open-loop control in Scenario 7 are illustrated in Figure 6.38. Figure 6.36 Water level error during the closure process in Scenario 7 (open loop vs. closed loop control) 100 150 200 250 -0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 Water Level Error (m) Time, t (min) Closed-Loop Control 100 150 200 250 -0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 Water Level Error (m) Time, t (min) Open-Loop Control e1 e2 e3 e4 e5 e1 e2 e3 e4 e5 6. Simulation and real-time results 119 Figure 6.37 Simulation results of closure operation of ERLB canal under open-loop control in Scenario 7 Figure 6.38 Simulation results of closure of ERLB canal under closed-loop control in Scenario 7 50 100 150 200 250 1.8 2 2.2 2.4 2.6 Water Level (m) Scenario 7: Open-Loop Control y1 y2 y3 y4 y5 50 100 150 200 250 0 5 10 15 Discharge (m3/s) QG1 QG2 QG3 QG4 QG5 -QS1 -QS3 50 100 150 200 250 0 0.5 1 1.5 2 2.5 Gate Opening (m) Time, t (min) L1 L2 L3 L4 L5 50 100 150 200 250 1.8 2 2.2 2.4 2.6 Water Level (m) Scenario 7: SDPC Control y1 y2 y3 y4 y5 50 100 150 200 250 0 5 10 15 Discharge (m3/s) QG1 QG2 QG3 QG4 QG5 -QS1 -QS3 50 100 150 200 250 0 0.5 1 1.5 2 2.5 Gate Opening (m) Time, t (min) L1 L2 L3 L4 L5 6. Simulation and real-time results 120 Pool Control RMSE MAPE ISE IAE MAO SSE [m] [%] [m] [m] [m] [m] Pool 1 OL 0.35538 12.76 21.47 54.23 2.5223 0.5157 CL 0.41255 14.362 28.934 61.04 2.5172 0.6404 Pool 2 OL 0.11821 4.0452 2.3757 17.192 2.5547 0.1896 CL 0.04122 1.308 0.2888 5.5589 2.5436 0.0088 Pool 3 OL 0.172 6.2239 5.0293 26.452 2.4981 0.248 CL 0.17565 6.3564 5.2448 27.015 2.493 0.2692 Pool 4 OL 0.07617 2.3528 0.98632 9.999 2.5157 0.1244 CL 0.01739 0.5918 0.05144 2.5154 2.5344 -0.0044 Pool 5 OL 0.0119 0.3333 0.02415 1.4167 2.5116 0.0312 CL 0.0158 0.3712 0.0425 1.5778 2.5142 0.0041 Table 6-9 Performance indexes of Scenario 7 (OL = Open-Loop, CL = Closed-loop) So far, the study scenarios were all examples of partial closure to show the advantages of closedloop control over the open-loop control. The two remaining scenarios, which are related to the total closure operation and total opening operation, are tested only under the SDPC control.  Scenario 8: Total closure from 15 m3/s to 0 m3/s with predictive control without considering disturbances. In this scenario, all spillway’s thresholds are above water levels, namely, the spillway heights being at its maximum of 3 m and discharge is only over spillway 5, at the end of the canal. The automatic closure operation under SDPC control exhibits a satisfactory behaviour based on the performance indexes given in Table 6-10. The total closure operation is executed in less than 3 hours, as it is depicted in Figure 6.39. After a series of tests on this scenario, it was determined that the minimum time to closure the canal is 110 min without disturbances. The closure operation with the minimum closing time is illustrated in Figure 6.40. Effectuating the closure operation quicker, results into higher rates of gate opening and higher values of MAO in all pools. 6. Simulation and real-time results 127 Figure 6.44 Acquisition of water level signals in the SCADA system The accuracy of the measurements of the SCADA system is affected by both physical and instrumentation constraints in the canal. For instance, the accepted gate position error is 2 mm, owing to the fact that it is not possible to move the motorized gate less than a minimum distance. There are level sensors located upstream and downstream of each gate and at every rectangular weir in order to measure discharge based on these water level measures. The accepted water level error is around 1 cm and the minimum control variable incremental flow variation is around 6 l/s. The canal has three vertical sluice gates hoisted by three-phase servomotors located on top of the gates. Each servomotor has a position measuring gear embedded in the motor chassis. At the time when the experiments where fulfilled, the gate velocities were 3.125 mm/s for G1, 1.524 mm/s for G2 and 3.125 mm/s for G3. On the other hand, to achieve an operating discharge equal to zero is not allowed in the actual laboratory canal owing to the fact that the minimum gate openings are 3, 5 and 5 mm for gates G1, G2 and G3 respectively. A discharge value around 5% of the operating flow had chosen as minimum discharge in the experiments. Finally, the watermaster may manipulate the canal-related data in the HMI. The operator may decide when to start a closure/opening operation. The operator may also adjust other parameters such as setpoint along a normal canal operation, penalization over setpoint variation, closing time, opening time, prediction horizon and manual/automatic operation. 6.5.2 Water level control at canal PAC-UPC 6.5.2.1 Control objective and operating scenarios The general objective of the SDPC controller is to keep the water levels as close as possible to the setpoint, while the operating discharge changes in a wide range. The regulating task is evaluated 6. Simulation and real-time results 128 by both setpoint tracking and disturbance rejection. The specific requirements to bear in mind for the proposed experimental tests are:  Canal freeboard of 8 cm.  Manage the canal to execute a closure operation with an 8 min-settling time (as long as there are no lateral offtakes).  The accepted steady state error (SSE) is 3 cm for controlled water levels.  The maximum absolute overshoot must be less than 5% of the setpoint for every controlled water level. It is expected less than 92 cm for the first pool, which means a percentage overshoot lower than 8% of the top of canal lining. A series of experiments were conducted to test the hypothesis of the dissertation, namely that the supervised decentralized dynamically-constrained predictive control is a convenient strategy for closure and opening of irrigation canals automatically. In the laboratory canal PAC-UPC, the proposed scenarios are:  Scenario 1: Automatic closure with no disturbances. The initial operating flow is 100 l/s.  Scenario 2: Automatic canal opening from 5 l/s to 90 l/s with no disturbances. The opening time must be less than 12 minutes.  Scenario 3: Automatic closure in the presence of a disturbance Qw1 of 36 l/s during 0≤ 𝑡≤2.4 min, and after on the disturbance changes suddenly to 0 l/s. 6.5.2.2 Experimental results  Scenario1: This test is devoted to analyze the closure operation without changes in the lateral offtakes. The initial operating flow is 100 l/s. This scenario starts from the steady state detailed in Table 6-13. The lateral weirs, W1 and W2 are settled to the maximum height of 90 cm and the height of the final weir (W4) is 35 cm. For this closure operation, levels y1 and y2 are the controlled variables. For the new steady state obtained after the closure operation, level y3 is determined by final weir height at the end of the canal. Setpoint for levels y1 and y2 are 0.88 and 0.72 m respectively. Qop [l/s] y1 [cm] y2 [cm] y3 [cm] L1 [cm] L2 [cm] L3 [cm] W1 [cm] QW1 [l/s] W2 [cm] QW2 [l/s] W4 [cm] 100 88 72 59 11.2 20 20 90 0 90 0 35 Table 6-13 Initial Steady State for scenario 1 The automated closure operation using SDPC is depicted in Figure 6.45. The controlled system exhibits a satisfactory behaviour based on performance requirements given in Subsection 6.5.2.1. As it can be observed, after 6 minutes the closure operation is completed with the flow reaching a close to zero value, while the water levels are maintained all the time inside the permitted safety 6. Simulation and real-time results 129 band. The maximum absolute overshoots are 89.53 cm and 72.78 cm for y1 and y2 respectively (lower than 1.8 % of the setpoint for both cases). The steady state errors for y1 and y2 are 0.1 and 0.8 cm respectively. These SSE values represent magnitudes lower than 1.3 % of the setpoint for both cases. Figure 6.45. Experimental results of automatic closure of canal PAC-UPC under SDPC  Scenario 2: This experiment is devoted to analyze the automatic canal opening from 6.5 l/s to 91 l/s without changes in the lateral offtakes. This scenario starts from the steady state detailed in Table 6-14. For this opening operation, the three downstream levels are the controlled variables. The setpoints are SP1 = 90 cm, SP2 = 72.5 and SP3 = 57 cm. The experimental results of the automated opening operation under SDPC control are depicted in Figure 6.46. Qop [l/s] y1 [cm] y2 [cm] y3 [cm] L1 [cm] L2 [cm] L3 [cm] W1 [cm] QW1 [l/s] W2 [cm] QW2 [l/s] W4 [cm] 6.5 90 72.5 40 0.9 0.67 0.73 90 0 90 0 35 Table 6-14 Initial Steady State for Scenario 2 0 2 4 6 8 10 12 40 60 80 100 Water Level (cm) Scenario 1 y1 y2 y3 0 2 4 6 8 10 12 0 20 40 60 80 100 120 Discharge (l/s) QG1 QG2 QG3 0 2 4 6 8 10 12 0 10 20 30 Gate Opening (cm) Time, t (min) L1 L2 L3 6. Simulation and real-time results 130 The experimental results of the automatic opening under SDPC exhibits a positive performance. For instance, the time taken to achieve a steady state condition for the opening operation is 12 minutes approximately. The maximum level errors are 0.2 cm (lower than 0.5 %) for 1 y and 3.6 cm (lower than 5 % of the setpoint value) for 𝑦2. The steady state errors are 0.2 cm (lower than 0.5%) for 𝑦1 and 0.6 cm (around 0.9 % of the setpoint value) for 𝑦2. The water level 𝑦2 is affected directly by the increase of volume at the end of the canal where there is a rectangular weir, the U- shape of 𝑦2 is modulated by the increase of volume at pool 3. The opening operation duration is longer than the closure operation since the system has to fill up the downstream pool with a volume of 325 m3 approximately. Figure 6.46 Experimental results of automatic opening of canal PAC-UPC under SDPC.  Scenario 3: This scenario is devoted to analyze the automatic closure in the presence of a disturbance. The lateral offtake Qw1 of 36 l/s is present along 2.4 min, and after on the disturbance changes suddenly to 0 l/s. The initial operating flow in the first pool is 138 l/s. The 36 l/s are equivalent to 26% of the operating discharge in the first pool of the canal. In this closing scenario only water levels y1 and y2 are the controlled variables. The setpoints for levels y1 and y2 are 84 and 70 cm respectively. Qop [l/s] y1 [cm] y2 [cm] y3 [cm] L1 [cm] L2 [cm] L3 [cm] W1 [cm] QW1 [l/s] W2 [cm] QW2 [l/s] W4 [cm] 138 84 70 59.6 17.8 29.4 21.8 65 36 90 0 35 Table 6-15 Initial Steady State for Scenario 3 0 2 4 6 8 10 12 14 16 18 20 40 60 80 100 Water Level (cm) Scenario 2 y1 y2 y3 0 2 4 6 8 10 12 14 16 18 0 50 100 Discharge (l/s) QG1 QG2 QG3 0 2 4 6 8 10 12 14 16 18 0 5 10 15 20 t (min) Gate Opening (cm) L1 L2 L3 6. Simulation and real-time results 131 The closed-loop automatic control exhibits a satisfactory behaviour even in presence of disturbance along the closure operation. For instance, the maximum absolute overshoots for both water levels are lower than 6%, namely, the MAO of 𝑦1is 88.7 cm, which is equivalent to 5.6% of SP1 and the MAO of 𝑦2is 72.7 cm, which is equivalent to 3.85% of SP2. Meanwhile, the steady state errors for y1 and y2 are 2 and 3 cm respectively. These SSEs represent values lower than 5 % of the setpoint for both cases. Experimental results of the automated closure operation under SDPC are depicted in Figure 6.47 Figure 6.47 Experimental results of closure operation with disturbance rejection at canal PAC-UPC 6.5.2.3 Discussion of the experimental results In all the experimental scenarios, the controlled water levels in every pool remain inside the safety band along both transient and steady response. In real-time implementation, the gates are moved sequentially from upstream to downstream (with at least 10 seconds delay between them) as driven by the supervisor. The dynamic constraints that determine the maximum discharge of predictive control are defined by the sigmoidal function described in (6.2). The controlled variables converge to the reference with a small acceptable error. As it can be noted in Figures 6.45, 6.46 and 6.47, no overtopping is produced in the automatic operations involving abrupt changes in operating conditions. 0 2 4 6 8 10 12 14 20 40 60 80 100 Water Levels (cm) Scenario 3 y1 y2 y3 0 2 4 6 8 10 12 14 0 50 100 150 Discharge (l/s) QG1 QG2 QG3 QW1 0 2 4 6 8 10 12 14 0 10 20 30 Gate Opening (cm) t (min) L1 L2 L3 6. Simulation and real-time results 132 The Embedded Matlab® code for real-time control that allows the implementation of the on-line optimization-based control approach has been implemented with a sampling time of 10 sec. The matrices 𝐸𝑖,𝐺𝑖,𝑃𝑖 and 𝐺0 involved in the predictive control formulation (see Subsection 5.3.1) are calculated offline for the controller algorithm. So, once the SCADA system starts up, a file with the matrices is loaded just one time. The controller tuning parameters used in the real-time implementation are the same used in simulation (see Table 6-1). The experimental results reveal that the success of the automatic control strategy for closure and opening operations proposed in this dissertation depends highly on the degree of accuracy of the gate position control and the proper calibration of the water level sensors. Therefore, a regular preventive maintenance of the canal instrumentation is highly recommended. Devices that require more technical attention include water level sensors, flowmeters, and motorized check gates. In actual canal irrigation system, control equipment hardware must resist the canal bank environment and function for long continuous periods without failure. The actual implementation in field requires a two-way radio system in order to communicate the headquarter (supervisory controller) with the decentralized control units. 7. Conclusions 133 7 Conclusions and future research Chapter 7 Conclusions 7.1 Summary and general conclusions This dissertation has been motivated by the interest for developing automatic control strategies to manage closing and opening operations in irrigation canals that are composed by several pools connected by controllable gates. Such types of operations are challenging and scarcely studied within the literature related to irrigation canals and, in particular, within the state of the art covering the applications of automatic control systems. Main difficulties with closing (and similarly opening) operations are related to the following factors:  They involve large changes in water discharges, and are sensitive to the couplings between the different pools and to the presence of unknown disturbances.  They require a critical command of the gate trajectories, with a compromise between producing feasible smooth excursions and completing the canal closing within a specifically needed short time, while keeping the water levels within prescribed bounds. To contribute towards the solution of the problem, this work has combined knowledge of two wide and different areas: control engineering and hydraulic engineering. From the last side, the thesis has addressed two benchmark case study problems: a laboratory canal available at the Technical University of Catalonia (PAC-UPC) and a main canal of the left bank of the river Ebro in Spain (ERLB). Both have been numerically simulated via a state of art computational code, while the canal PAC-UPC has been additionally used for real-time implementations. 7. Conclusions 134 Following a constructive approach, the core of thesis has been initiated by studying the problem of closing and opening these benchmark canals, checking different manual operations. The outcome of this study (in Chapter 4) has been twofold: (1) learning significant issues and difficulties that arise when check structures are required to get completely closed; and (2) getting practical inputs for the automatic control design. Numerical simulation results have highlighted problems, such as overtopping, that arise when the closure canal operations are not managed properly. These problems motivate the need for automatic control. Five scenarios, depending on the gate velocities, have been designed to check the transient response after closing gates of cases studies under manual local control. The quality of the closure operation in canals is determined by aspects such as closing velocity, water levels inside the minimum/maximum safety margins required on the canal, and to keep the water levels as close as possible to the setpoint. Wave phenomenon occurs regardless which are the initial conditions or which are the velocities of motorized gates. A canal system to be closed is affected by upstream and downstream disturbances. Therefore, the control system to manage closure and opening operations must avoid the risk of exceeding the safety levels required on the canal to avoid problems such as overtopping and cracking. The closure/opening operations must be done as soon and quick as possible to make feasible the closure in management practices such as, night closure to save water. The minimum allowed time to complete the operation is determined by the geometry of the canal, the flow conditions, the velocity of the check structures and the final objective pursued with the closure. The operational requirements of the closure operation are almost impossible to achieve using local manual control methods. The simulation and real-time experiments in Chapter 4 have demonstrated that closing the gates sequentially from upstream to downstream in a smooth manner may reduce the overtopping risk. From the control engineering side, the outcome of the thesis (Chapter 5) has been a control strategy for automatic closure and opening of irrigation canals, which has been developed in a two-level architecture: (i) individual decentralized downstream water level predictive controllers formulated via an optimal control problem under dynamic constraints and implemented by upstream local gates; and (ii) a supervising scheme to achieve the compromise of fast execution with smooth gate trajectories and water level regulation, even in the presence of disturbances. The aim of the supervisor is being responsible for allowing the cyclic sequential movement of each motorized gate of the entire canal system. In the presence of an unexpectedly large disturbance, the supervisor detects the location where a sudden raise of water level has occurred and then command the next controller to operate during the closure operation. Each decentralized control is a local automatic water level controller, which requires the current state of its controlled pool and information of neighbor pools. For the practical implementation, the proposed control system requires a remote terminal unit (RTU). The RTU monitors the water levels and equipment status, and transmits these data to the supervisor. The final supervised decentralized predictive control (SDPC) strategy has been evaluated (in Chapter 6) by means of numerical simulation on the two cases of study in a variety of operating scenarios. This includes comparisons of the performance with respect to the use of optimal 7. Conclusions 135 predictive open-loop control of gate trajectories. In addition, it has been experimentally validated through real-time implementation in the laboratory canal PAC-UPC. Most of the simulation results show that the closed loop predictive control with dynamic constraints is a convenient strategy for automatic closure and opening operation of canals. In all the simulation scenarios, water levels in each controlled pool remain inside the safety band along both transient and steady response. Nine scenarios have been designed to check the performance of the predictive control in the ERLB canal. Three scenarios have been simulated to check the controller performance in the canal PAC-UPC. Overtopping is avoided in both closure and opening operations. The closure operation performance under SDPC has improved comparing to open-loop closure operations. In the simulation results of closure operation in the ERLB canal, without any presence of disturbances, both open-loop and closed-loop control present a positive performance with small oscillations (less than 10 cm). However, if during the closure operation, a large disturbance (intake or offtake) is present along the canal, then the disturbance rejection is better tackled by the closed-loop control than by the open-loop control. The performance of openloop control presents undesirable large overshoots that lead to overtopping in two scenarios. In general, the steady state errors are lower for the closed-loop than for the open-loop control. In all the experimental closure and opening scenarios fulfilled in the canal PAC-UPC, the controlled water levels in every pool remain within the safety margins along both transient and steady response. In the real-time implementation, the gates are moved sequentially from upstream to downstream. The experimental results reveal that the success of the automatic control strategy for closure and opening operations proposed in this dissertation depends highly on the degree of accuracy of the gate position control and the proper calibration of the water level sensors. Therefore, a regular preventive maintenance of the canal instrumentation is highly recommended. Devices that require more technical attention include water level sensors, flowmeters and motorized check gates. In actual canal irrigation systems, control equipment hardware must resist the canal bank environment and function for long continuous periods without failure. The results presented in Chapter 6, in summary, conclude the efficiency of the control strategy proposed in this thesis to face the problem of closing/opening irrigation canals. 7.2 Contributions of this thesis The main contribution of this dissertation is the development of a strategy for automatic canal operations involving abrupt changes and disturbances in operating conditions, which has been called supervised decentralized predictive control with dynamic constraints (SDPC). Another contribution is related to how to tackle a predictive control problem that cannot be solved by optimizing the typical linear quadratic cost function with time-invariant constraints when two conflicting control objectives are stated in the control problem. A sigmoidal function, acting as a dynamic constraint, has been proposed in the control design, which contributes to generate the 7. Conclusions 136 controlled gate movements in a smooth way. In the presence of disturbances, a supervisor reshapes systematically the sigmoidal function through the relaxation of constraints as soon as a raise of water is detected. It has been the first time that real-time predictive control with constraints has been implemented in the canal PAC UPC facility. The Hildreth’s quadratic programming algorithm has been used in this work to obtain the on-line numerical solution of the constrained optimization problem. A new supervisory control and data acquisition (SCADA) system for the laboratory canal facility has been built as part of the development of this thesis. The SCADA system is an extension of the original one designed by (Sepúlveda, 2008). 7.3 Future research For further research and applications, some ideas could be considered:  To extend the validations of the supervised decentralized predictive control with dynamic constraints by simulating the implementation in the two ASCE test canals in closing/opening scenarios.  The transient wave phenomenon originated when the gates are suddenly closed along the canal presents higher peaks in pools which length are shorter than the upstream neighbor one. Therefore the maximum absolute overshoot values are lower in the upstream pool in comparison with the downstream pool. In this way, to compare the performance by means of simulation in another canals is a challenge to extend the results achieved in this dissertation.  To validate the SDPC control methodology by means of closure/opening operations in a real field irrigation canal. Indeed, field testings would give significant lessons on the different components of the overall system, regarding both the methodologies and the supervision and control practical units.  To test the SDPC control methodology using gate opening directly as control action variable instead of discharge such as it is proposed in the work (Horváth et al., 2014b). It may be interesting to make a comparison between the two schemes in terms of formulation and performance.  To propose new scenarios under abrupt change conditions to validate the SDPC strategy. For instance, a scenario where some of the canal gates broke down along the closure operation. Another example could be testing an on demand partial closure involving abrupt change in the operating condition in less time than the total closure operation.