1 Introduction

Water resources affect almost every aspect of our daily lives, including irrigation, drainage, water supply, flood defense, navigation, and hydropower generation. In addition, the human presence has been increasingly integrated into natural water systems (Vogel et al. 2015). To manage and plan water resources in a sustainable and operational way, various types of water infrastructure have been designed, planned, and implemented in modern engineered water systems (Loucks et al. 2005).

Optimization-based methods have been widely developed and applied for water resources planning and management since the 20th century. For long-term water resources planning, the multi-objective portfolio optimization and sequential optimization approaches are both effective, especially for problems incorporating multiple targets (Characklis et al. 2006; Reed et al. 2013; Matrosov et al. 2015; Beh et al. 2015). Considering the uncertainty of system forecasts, whether predictable or not (Walker et al. 2013; Maier et al. 2016), the dynamic adaptive decision-making approach further enhances their applicability to a wider range of water resources problems induced by climate change, population growth, etc. Haasnoot et al. (2013), Kwakkel et al. (2016), and Zeff et al. (2016). Commonly, these optimization-based planning approaches take hundreds of decade-long scenarios into account, and computational burden is not a concern in this context. On the contrary, short-term water resources management, which is the focus of our study, aims to find real-time solutions–in other words, decisions regarding how to operate the infrastructure are made promptly when measurement data are collected. A family of real-time control (RTC) techniques have been specifically proposed for this purpose. Classic RTC approaches, proportional—integral—derivative (PID) control being the most well-known, have been applied to irrigation and drainage canal systems extensively in recent decades (Malaterre et al. 1998; Clemmens and Schuurmans 2004; Schuurmans 1997). A PID controller customarily sets a feedback mechanism for tracking reference states or setpoints. Nonetheless, a growing number of concerns related to multiple objectives, distributed systems, and the uncertainty of hydrological processes pose difficulties for classic approaches, which finally led to the emergence of a modern optimization-based control approach–Model Predictive Control (MPC). In addition to the features of classic control, MPC also has the ability to address time delays, constraints, and multiple objectives (Richalet et al. 1978; Maciejowski 2002).

The remarkable development of MPC in recent years has benefitted from in-depth investigations of convex optimization, the improvement in algorithms, etc. Moreover, many research works have studied how to deal with multiple interconnected systems. Specifically, distributed MPC targets problems arising from multiple systems, in which coupled systems share information about their own operations (Maestre and Negenborn 2014). As a result, MPC is gaining more popularity in water resources systems (Ocampo-Martinez et al. 2013; Delgoda et al. 2013; Zafra-Cabeza et al. 2011; van Overloop et al. 2010). Further, MPC has a flexible structure to meet different requirements. For example, to account for the uncertainty of hydrological forecasts, the formulation of the operation commonly considers ensemble forecasts (EFs), which are a collection of state trajectories varying with time (i.e., dynamical uncertainties). Hence, multi-scenario MPC (MS-MPC) is proposed to find a common solution based on the likelihood of occurrence of each scenario (van Overloop et al. 2008; Tian et al. 2017). However, this approach can be quite conservative due to the fact that some unlikely and extreme scenarios may affect the decisions of the controller. In other words, since the control problem has to guarantee the feasibility in all the scenarios considered, a significant loss of performance may occur (Grosso et al. 2017). To avoid this issue, alternatives have been considered, such as the so-called chance constrained MPC, which can also be built based on either scenarios or an explicit characterization of the uncertainty (see, e.g., Schildbach et al. (2014) and Jurado et al. (2016) and references therein), and tree-based MPC (TB-MPC), which formulates tree-shaped decisions for multiple scenarios (Raso et al. 2013; Maestre et al. 2013a). Regarding the latter, the idea is to use a tree-shaped structure to represent possible trajectories of system states over time. In this way, the solution to the problem is less conservative, as unlikely scenarios have their own set of control actions that are implemented only if the real evolution of the uncertainty exhibits an extreme behavior. From a control viewpoint, TB-MPC is formulated as a closed-loop optimization problem due to its capability of adjusting its response as more knowledge is gained about the evolution of the disturbances along the prediction horizon) (Raso et al. 2014).

This article continues the investigation of distributed MPC and tree-based MPC. To date, TB-MPC has been studied in water systems from a global point of view (Raso et al. 2014), and Maestre et al. (2013b) studied how to distribute the computations. However, water systems often spread over large areas, and EFs are present in different geographically disperse water systems with their own hydrological conditions.

In addition to existing tree-based MPC, which can only address a single water system, this study proposes a hierarchical and distributed scheme to expand the application of tree-based MPC to multiple water systems. Therefore, we propose a computational hierarchy in which the whole system can be divided into several subsystems with different EFs. The hierarchical structure is composed of an upper control layer as well as a lower one. The upper layer collects global forecast information, sending a set of their most probable local scenarios to the local agents, while the lower layer solves the optimal control problem in a distributed way by applying a TB-MPC scheme. The main contribution of this work relies on a real-time control scheme informed by ensemble stream flow forecasts to optimally operate water resources systems characterized by multiple, spatially distributed control points diversely affected by hydroclimatic uncertainty. The novelty of this work is to propose a new real-time control approach, hierarchical and distributed tree-based MPC, which is able to cope with real-time water resources management problems under dynamical uncertainty. The proposed approach is illustrated through simulations, including a lake–canal water system in the Northwest of the Netherlands. Furthermore, a performance comparison of this new approach with other varieties of MPC shows that HD-MPC has some distinct advantages.

The remainder of the paper is organized as follows. Section 2 introduces how MPC and TB-MPC can be applied to a single system. Section 3 describes how to deal with multiple local EFs using HD-MPC. Section 4 deals with the application of this novel approach to the study area through a simulation. A discussion of the results is presented in Section 5. Finally, conclusions are drawn in Section 6.

2 Model Predictive Control for Reservoir Management

MPC is a widely used RTC technique that computes a vector of control actions to minimize a pre-defined performance criterion over a given prediction horizon, based on the dynamical model describing the evolution of the system. Only the first element of the vector, corresponding to the control action to be implemented at the current time step, is applied. MPC is implemented in a receding-horizon manner. In other words, the above-mentioned minimization is repeatedly solved at each sample step k.

A common way to model the dynamics of a water system (e.g., a reservoir system) is of the form (van Overloop 2006):

$$ x(k + 1)= Ax(k) + B_{u}u(k) + B_{d}d(k) $$
(1)

where, \(x(k)\in {\mathbb {R}^{n}}\), \(u(k)\in {\mathbb {R}^{m}}\), and \(d(k) \in {\mathbb {R}^{l}}\) are the system state, the control variable, and the system disturbance, respectively. Note that the water level h(k), the flow q(k) via the pump, and the height hg(k) of the gate are aggregated into the state x(k) = [h(k),q(k),hg(k)]T. Likewise, the change in the pump flow Δq(k) and the change in the gate height Δhg(k) are aggregated into the control variable u(k) = [Δq(k),Δhg(k)]T. The coefficients of the matrices \(A\in {\mathbb {R}^{n \times n}}\), \(B_{u}\in {\mathbb {R}^{n \times m}}\) and \(B_{d}\in {\mathbb {R}^{n \times l}}\) have been obtained by applying the linearized De Saint-Venant equations following (Stelling and Duinmeijer 2003; Xu 2013).

The control performance at sample step k can be calculated according to the weighed sum of deviations as follows:

$$ f(x(k + 1),u(k))= \left( x(k + 1) - r\right)^{T} Q\left( x(k + 1) - r\right)+u^{T}(k)R u(k). $$
(2)

Here, f is defined as the stage cost function and r is the reference vector given to the state. Matrices Q and R weigh the states and the control variables, respectively, in which Q is commonly positive semi-definite and R is positive definite, which guarantees that the cost function (2) is convex when dynamic (1) is affine. Equation 2 implies a quadratic cost function that has to be minimized.

In addition, the stage function needs to satisfy constraints regarding the physical limits of its variable. The constraints are formulated as follows:

$$\begin{array}{@{}rcl@{}} &&x_{\min} \leq{x(k)}\leq x_{\max}, \end{array} $$
(3)
$$\begin{array}{@{}rcl@{}} &&u_{\min} \leq{u(k)}\leq u_{\max} . \end{array} $$
(4)

Here, xmin and xmax are the minimum and maximum allowed values on the state x, which are either the safety level,s the pump capacities, or the lowest and highest gate positions, and umin(k) and umax(k) are the minimum and maximum allowed changes in pump flows or gate positions.

The standard structure of MPC we use in this paper has the following form:

$$ \underset{{u(k:k+N_{\mathrm{p}}-1)}}{\min} J(k) = \sum\limits_{j = k}^{k+N_{\mathrm{p}}-1} {f(x(j + 1),u(j))}, $$
(5)

subject to Eqs. 14, where J(k) is the cost function and Np is the length of the prediction horizon. After calculating the system dynamic (1) over Np, the optimization is solved to determine the optimal sequence of inputs along the prediction horizon u(k : k + Np − 1) to be applied to the system, subject to the constraints (3) and (4)in a receding-horizon fashion.

2.1 TB-MPC for a Single System

The tree-based approach can handle an ensemble forecast of a single system, which is a set of possible future trajectories of hydrological conditions incorporating dynamical uncertainties (Raso et al. 2014). The idea is that a collection of similar scenarios can be merged as one scenario, being one branch of a scenario tree. In addition, branches overlap each other while their differences are small and bifurcate when significant differences appear. We note that the root of the scenario tree is common for all scenarios at each time step k. This is because the root corresponds to current disturbances, which are usually known with little or no uncertainty in this context. The scenario tree is updated at each sample step with the up-to-date predictions from the EF.

Take Fig. 1, for example, in which the tree structure consists of three scenarios and bifurcates at time steps 1 and 2, respectively. At step k, all three scenarios begin with the same information, which corresponds to the current measurement of the disturbance, making them overlap each other. Next, the branches bifurcate at the beginning of the second sample step k + 1 because Scenario 1 has forecast information different from the other two scenarios. At the last step, branches of Scenarios 2 and 3 bifurcate into different branches again due to the information gap. At each time step, the tree is built based on updated EF. The way to generate a tree structure can be found in Raso et al. (2014), Growe-Kuska et al. (2003), and Šutienė et al. (2010).

Fig. 1
figure 1

An example of tree-based scenarios

Note that the set of all the Ns scenarios together is referred to as a tree; scenario s is referred to as the s-branch of a tree; and the part between sample steps k and k + 1 is referred to as the k-section of a branch. In addition, subscript [i] is used to denote a variable that belongs to scenario i (i= 1,...,Ns); for example, x[i](k). Finally, we assume that any two branch sections i and j that start with the same node during the time interval [k, k + 1] satisfy u[i](k) = u[j](k). This is a non-anticipative condition that makes the controller compute a common control input for the branching point, as the disturbance can only be measured after it has occurred. For example, the tree in Fig. 1 requires that u[1](k) = u[2](k) = u[3](k) (i.e., the same control input is computed for all scenarios for the current sample step). Another example is the non-anticipative constraint u[2](k + 1) = u[3](k + 1). Hence, non-anticipative constraints guarantee that calculated control actions are only certain with regard to past information of the corresponding branches (i.e., the same input control has to be computed for the scenarios as long as they share a common trajectory in the three). This is how TB-MPC computes control inputs as a decision tree with the same shape of the scenario tree, as seen in Fig. 1.

Remark 1

Note that in Fig. 1, the disturbances are common at the beginning, but this is not a limiting feature of the algorithm, and branching of the disturbance scenarios can occur at the first time instance. However, in that situation, the control input would still remain the same for all these disturbances as per the non-anticipatory condition.

The tree-based approach can be used when considering EFs. Taking Ns scenarios, the formulation of TB-MPC can be expressed as the sum of Ns objective functions weighted by the probability of occurrence of each scenario, as follows:

$$\begin{array}{@{}rcl@{}} && \underset{{{u_{[i]}}(k:k+N_{\mathrm{p}} - 1)}}{\min} J(k) = \sum\limits_{i = 1}^{N_{\mathrm{s}}} {{p_{[i]}}\left( {\sum\limits_{j = k}^{k+{N_{\mathrm{p}}} - 1} {f({x_{[i]}}(j + 1),{u_{[i]}}(j))}} \right),} \end{array} $$
(6)
$$\begin{array}{@{}rcl@{}} \\ &&\text{subject \ to}\\ && {x_{[i]}}(j + 1) =A{x_{[i]}}(j)+B_{u}{u_{[i]}}(j)+B_{d}{d_{[i]}}(j), \end{array} $$
(7)
$$\begin{array}{@{}rcl@{}} && x_{\min} \leq{x_{[i]}(j + 1)}\leq x_{\max} , \end{array} $$
(8)
$$\begin{array}{@{}rcl@{}} &&u_{\min} \leq{u_{[i]}(j)}\leq u_{\max} , \end{array} $$
(9)
$$\begin{array}{@{}rcl@{}} && {u_{[i_{1}]}}(j) = {u_{[i_{2}]}}(j),{\text{ if } }{d_{[i_{1}]}}(j) = {d_{[i_{2}]}}(j), \end{array} $$
(10)
$$\begin{array}{@{}rcl@{}} && \forall j = k,k + 1,...,{k+N_{\mathrm{p}}} - 1,\ i = 1,...,{N_{\mathrm{s}}}, \end{array} $$

where p[⋅] is the probability of each scenario. Note that the following condition must hold between time steps k and k + 1 for all the scenario sections:

$$ \sum\limits_{i = 1}^{N{\mathrm{s}}} {p_{[i]}(k)} \leq 1. $$
(11)

Here, a small number of highly improbable scenarios could be excluded to reduce the number of considered scenarios. Therefore, the computational burden would be improved.

Equations 610 are for single systems solved in a centralized manner. In this work, we extend this scheme to the case of distributed subsystems under different sources of uncertainty. This issue can be addressed by a hierarchical and distributed controller. The hierarchy handles the scenario information in the top layer and delivers it to the bottom one to solve the optimization problem in a decentralized fashion, where only the relevant scenarios for each subsystem are considered.

3 Two-level Hierarchical TB-MPC

Enabling a distributed control approach is important because large-scale water systems are usually composed of multiple subsystems and structures. Practically, large-scale water systems are often managed in a non-centralized way. Each of the several subsystems has its own predictions with regard to uncertainty and management objectives. For example, the Dutch water system consists of 27 non-intersecting areas managed by different water boards in a decentralized fashion, i.e., with none or little coordination, even when each subsystem is influenced by its adjacent neighbors.

We formulate the optimization problem here using a hierarchical and distributed architecture to ensure a proper coordination between subsystems by dividing the overall optimization problem into smaller subproblems assigned to local controllers–also called agents–located in different regions. In this way, subsystems are controlled locally and coordination is attained with the aid of a common upper layer, which processes forecast information and provides prices for the shared resources of the system.

3.1 Global and Local Scenario Trees

Next, the principles of the prediction exchange between local agents and the coordinator are addressed. The aim of the coordinator in the upper layer is to communicate local scenarios to all affected local controllers. A global tree is formed by consolidating the local EFs. The centralized separable objective function (6) is distributed as follows:

$$\begin{array}{@{}rcl@{}} J(k) &=& \sum\limits_{j = 1}^{{N_{\mathrm{b}}}} {{J_{\{ j\}} }(k)} \end{array} $$
(12)
$$\begin{array}{@{}rcl@{}} &=& \sum\limits_{j = 1}^{{N_{\mathrm{b}}}} \left( {\sum\limits_{i = 1}^{{N_{{\mathrm{s,\{ j\}} }}}} {{p_{\{ j\},[i]}}{J_{\{ j\} ,[i]}}(k)}}\right), \end{array} $$
(13)

which is minimized subject to the constraints (7) and (10) corresponding to each subsystem. It is assumed that the overall system is composed of Nb subsystems and J{j}(k) is the cost of the objective function of subsystem j, which has Ns,{j} scenarios derived from the centralized EF. In short, when distributing the optimization problem, a local controller j minimizes J{j}(k). The notations J{j},[i] and p{j},[i] correspond to the probability and cost function for the agent {j} considering the scenario disturbance [i], respectively. It will be shown later that the solution of the local controllers converges to that of a centralized controller minimizing J(k) centrally by introducing certain coupled variables to attain coordination.

In this work, the tree-based EF is addressed in a top-down fashion. Following this approach, the upper layer gathers information for the whole system (e.g., from processed satellite data) and delivers to each subsystem all scenarios relevant to it. Therefore, it is assumed that the upper layer has access to the scenario tree for the whole system while the subsystems only have some branches of the whole scenario tree. The optimization problem contains a central EF in the top layer whereas the lower level considers local EF scenarios for each subsystem and its corresponding MPC problem. Hence, it is assumed that all the local agents at the bottom layer receive their information from the top layer as a tree of possible branches of the whole system. Then, each subsystem only considers its relevant scenarios.

Figure 2 presents an example of how local trees can be obtained from a centralized tree. We assume the system is composed of two subsystems. Scenarios 1 and 2 are relevant for subsystem 1, with scenario 3 being removed. Regarding subsystem 2, scenario 1 is dropped for the same reason. Hence, the distributed EF trees provide local agents only with relevant information for their optimization problems.

Fig. 2
figure 2

A centralized disturbances tree is distributed into two local subsystems

3.2 Dual Decomposition Based HD-MPC

The details regarding the dual decomposition-based hierarchical and distributed model predictive controller are given next.

At the bottom layer, local controllers make decisions with their own EF and exchange information to coordinate their actions (see, e.g., Maestre and Negenborn (2014)). The resulting centralized problem is:

$$\begin{array}{@{}rcl@{}} &&\underset{{\text{ all }}{u_{\{ j\} ,[i]}}(k)}{\min} \sum\limits_{j = 1}^{{N_{\mathrm{b}}}} {\sum\limits_{i = 1}^{{N_{{\mathrm{s}},\{ j\}} }} {{p_{\{ j\},[i]}}{J_{\{ j\} ,[i]}}(k)}}, \end{array} $$
(14)
$$\begin{array}{@{}rcl@{}} && {\text{subject}} {\text{to}}\\ &&{x_{\{ j\} ,[i]}}(k + 1)= A{x_{\{ j\},[i]}}(k)+B_{u}{u_{\{ j\},[i]}}(k)+B_{d}{d_{\{ j\}},[i]}(k) \end{array} $$
(15)
$$\begin{array}{@{}rcl@{}} && x_{[i]_{\min}} \leq{x_{\{ j\},[i]}(k + 1)}\leq x_{[i]_{\max}}, \end{array} $$
(16)
$$\begin{array}{@{}rcl@{}} && u_{[i]_{\min}} \leq{u_{\{ j\},[i]}(k)}\leq u_{[i]_{\max}} \quad \forall k \in [0,1,...,{N_{\mathrm{p}}} - 1], \end{array} $$
(17)
$$\begin{array}{@{}rcl@{}} &&{u_{\{ j\} ,[{i_{1}}]}}(k) = {u_{\{ j\} ,[{i_{2}}]}}(k), {\text{if}} {d_{\{ j\} ,[{i_{1}}]}}(k) = {d_{\{ j\} ,[{i_{2}}]}}(k), \end{array} $$
(18)
$$\begin{array}{@{}rcl@{}} &&Cu(k)=\sum\limits_{j = 1}^{N_{\mathrm{b}}}C_{\{j\}} u_{\{j\}} (k)= c, \quad \forall k \in [0,1,...,{N_{\mathrm{p}}} - 1]. \end{array} $$
(19)

Each subsystem is subject to coupling constraints, given by Eq. 18, where \(C \in \mathbb R^{n_{c} \times m}\), \(C_{\{j\}} \in \mathbb R^{n_{c} \times m_{\{j\}}}\) and \(c \in \mathbb R^{n_{c}}\). In particular, this type of constraint appears when coupled variables are replicated locally to parallelize the computations of the centralized control problem (Maestre and Negenborn 2014).

The dual decomposition approach relies on decomposing the coupled variables used by local controllers with additional conditions in the form of coupling constraints to guarantee that a single value is obtained for each shared variable. Then, the coupling constraints are replaced by introducing Lagrange multipliers (see, e.g., Biegel et al. (2014)) as follows:

$$\begin{array}{@{}rcl@{}} && \underset{{\text{all } }{\lambda_{\{ {j_{1}},{j_{2}}\}} }(k)}{\max}\underset{{\text{all } }{u_{\{ j\} ,[i]}}(k)}{\min} \sum\limits_{j = 1}^{{N_{\mathrm{b}}}} {\sum\limits_{i = 1}^{{N_{{\mathrm{s}},\{ j\}} }} {{p_{\{ j\} ,[i]}}{J_{\{ j\} ,[i]}}(k) +} } \end{array} $$
(20)
$$\begin{array}{@{}rcl@{}} &&\quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad\lambda_{\{ {j_{1}},{j_{2}}\}} (k)(C u(k)-c),\\ &&{\text{subject}} {\text{to}} \\ && {x_{\{ j\} ,[i]}}(k + 1)= A_{[i]}{x_{\{ j\},[i]}}(k)+B_{u_{[i]}}{u_{\{ j\},[i]}}(k)+B_{d_{[i]}}{d_{\{ j\}},[i]}(k) \end{array} $$
(21)
$$\begin{array}{@{}rcl@{}} && x_{[i]_{\min}} \leq{x_{\{ j\},[i]}(k + 1)}\leq x_{[i]_{\max}}, \end{array} $$
(22)
$$\begin{array}{@{}rcl@{}} && u_{[i]_{\min}} \leq{u_{\{ j\},[i]}(k)}\leq u_{[i]_{\max}} \quad \forall k \in [0,1,...,{N_{\mathrm{p}}} - 1], \end{array} $$
(23)
$$\begin{array}{@{}rcl@{}} && {u_{\{ j\} ,[{i_{1}}]}}(k) = {u_{\{ j\} ,[{i_{2}}]}}(k), {\text{if}} {d_{\{ j\} ,[{i_{1}}]}}(k) = {d_{\{ j\} ,[{i_{2}}]}}(k), \end{array} $$
(24)

where \(\lambda _{\{ {j_{1}},{j_{2}}\}}\) are the Lagrange multipliers that emerge from the coupling constraints. The optimization problem (20) is separable in different local optimization problems, as shown in Algorithm 1 (Maestre and Negenborn 2014).

figure a

We demonstrate now that the distributed controllers in the bottom layer solve the optimization problem without any loss of performance with respect to the centralized approach subject to the convexity and affinity assumptions. Let us recall that the overall system is composed of Nb subsystems with a cost function J{j}[i] for forecast i, and disturbances composed of Ns,{j} scenarios:

$$d_{\{ j\} ,[{i}]}, \quad \forall i\in\{1,2,\cdots,N_{{\mathrm{s}},\{ j\}}\}. $$

From Eq. 13), it can be seen that the overall optimization problem in a distributed fashion is:

$$\begin{array}{@{}rcl@{}} &&\underset{{\text{all } }{u_{\{ j\} ,[i]}}(k)}{\min} p_{\{ 1\} ,[{1}]} J_{\{ 1\} ,[1]} (k)+ p_{\{ 1\} ,[{2}]} J_{\{ 1\} ,[2]}(k) + {\cdots} + p_{\{ 1\},[N_{\mathrm{s},\{ 1\}}]}J_{\{ 1\} ,[N_{\mathrm{s},\{ 1\}}]}(k)\\ & & + p_{\{ 2\} ,[{1}]} J_{\{ 2\} ,[1]}(k) + p_{\{ 2\} ,[{2}]} J_{\{ 2\} ,[2]}(k)+ {\cdots} + p_{\{ 2\},[N_{\mathrm{s},\{ 2\}}]}J_{\{ 2\},[N_{\mathrm{s},\{ 2\}}]}(k)\\ & &\quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \cdots \\ && + p_{\{ N_{b}\},[1]} J_{\{ N_{b}\} ,[1]}(k)+ \quad \quad \cdots+ \quad \quad p_{\{ N_{b}\},[N_{\mathrm{s},\{ N_{b}\}}]} J_{\{ N_{b}\} ,[N_{\mathrm{s},\{ N_{b}\}}]}(k).\\ && \end{array} $$
(25)

From a centralized viewpoint, the optimization problem (6) can be rewritten by explicitly including all possible combinations of the local scenarios’ disturbances. This results in an optimization problem composed of Ns global scenarios, that is,

$$ N_{\mathrm{s}}=\prod\limits_{j = 1}^{N_{\mathrm{b}}}N_{\mathrm{s,\{j\}}}. $$
(26)

Then, the overall optimization problem becomes

$$ \underset{\text{all }{u_{\{ j\} ,[i]}}(k)}{\min} \sum\limits_{i = 1}^{N_{\mathrm{s}}} p_{[i]} J_{[i]}, $$
(27)

where p[i] stands for the probability that corresponds to the global scenario i and J[i] is the global cost of the system for that particular combination of scenarios. To illustrate this, Figure 3 shows all combinations among the disturbance scenarios that corresponds to the local agents. For example,

$$\begin{array}{@{}rcl@{}} &&p_{[1]} J_{[1]}=\underbrace{\left( p_{\{ 1\} ,[{1}]}\times p_{\{ 2\} ,[{1}]}\times {\cdots} \times p_{\{ N_{\mathrm{b-1}}\} ,[{1}]}\times p_{\{ N_{\mathrm{b}}\} ,[{1}]} \right)}_{p_{[1]}}\underbrace{\left( {\sum}_{j = 1}^{N_{\mathrm{b}}}J_{\{ j\} ,[1]}\right)}_{J_{[1]}}. \end{array} $$
Fig. 3
figure 3

Disturbance scenarios from a centralized perspective

Hence, by solving this problem in a hierarchical-distributed fashion we can achieve the same solution and avoid the combinatorial explosion of the purely centralized approach.

4 Simulations and Results

In this section, we present a case study where the proposed approach is tested. To this end, we first introduce the system used as a case study. Next, we describe the parameters used by the controller. Finally, some tests are carried out to assess the performance of the proposed approach in comparison with other well known methods.

4.1 Case Study

We test the proposed controller in the Northwest water system in the Netherlands, which consists of Lake IJsselmeer, Lake Markermeer (subsystem 1), and the North Sea Canal (subsystem 2). The catchment is shown in Fig. 4a and its simplified schematic is shown in Fig. 4b. Also, the scheme of the proposed control architecture is depicted in Fig. 4c. Turned gates and pumps can be assumed to be a single structure when they work in a synchronized way. As a consequence, the two large sluice gate sets between Lake IJsselmeer and the North Sea – 108 and 54 meters wide, respectively – are considered as a single 162-meter-wide gate. Further, even though Lake IJsselmeer and Markermeer have different water levels, they are coupled via two sluice gates by gravity flow. Therefore, they are combined into a reservoir for simplicity. Note that the Schellingwoude Gate links both subsystems, being a coupled variable between the corresponding local agents. The Lake Marker and the North Sea Canal are operated via the Houtrib and the Schellingwoude gates. The water is exchanged from the North Sea Canal to the North Sea via IJmuiden pumps. The maximum capacities for the outflow via the Houtrib Gate, the Schellingwoude Gate, and the IJmuiden pumps are 1000 m3/s, 50 m3/s, and 260 m3/s, respectively.

Fig. 4
figure 4

The North Dutch catchment

Both subsystems have disturbance inflows d(k) that come from the Rhine River and rainfall. The historical data were retrieved from a Dutch live web service operated by Rijkswaterstaat.Footnote 1 Based on these data, twenty inflow scenarios were generated using the Stochastic Climate Library (SCL).Footnote 2 This toolkit generates stochastic rainfall data using an autoregressive model. The generated scenarios have a mean value equal to that of the historical sequence and a standard deviation of 250 m3/s. Figure 5a shows for each subsystem the minimum, mean, and maximum values of the EF during 30 simulated days. It is important to note that the disturbances show increased levels due to rainfall during six days starting on day 6, with a maximum value around 1400 m3/s.

Fig. 5
figure 5

Disturbances of the local subsystems

In addition, we also consider two different measurable disturbances per subsystem to stress the local controllers. The disturbance for subsystem 1 are higher due to rainfall from day 5 to day 15, with maximum inflow around 500 m3/s. Regarding local subsystem 2, the disturbance presents a higher inflow, around 200 m3/s during the 5 first days; after this time period, the inflow is closer to 100 m3/s until day 20. In the remaining time, both disturbances show a regular input for the two subsystems, as shown in Fig. 5b.

The remaining parameters used for simulation were set as follows: the storage capacities of Lake IJsselmeer and Markermeer and North Sea Canal are 7.4e8 m3 and 3.1e7 m3, respectively; the length of the time step is 1 h; the prediction horizon (NP) is 24 h and the simulation takes place during 30 days. The setpoints of the water levels were fixed as h1ref = h2ref = − 0.4m. Also, the water exchange is bounded between 0 and 50 m3/s. Likewise, water levels are constrained between -5 m and 5 m to ensure the safety of canal levees for both subsystems. Finally, the quadratic penalties on the setpoint (Q1), Δq1 via the Houtrib Gate (R1), Δq2 via the Schellingwoude Gate (R2), and Δqex via the IJmuiden pumps (Rex) are 4000, 1/300, 1/200, and 1/260, respectively.

4.2 Controller Configuration

The control system is structured hierarchically as follows: the upper layer sends two different EF trees with the most likely Ns = 20 scenarios to each subsystem, which are related to precipitation in different areas and water demands due to different hydrological conditions. The EFs contain relevant information regarding the probability of each scenario that each local controller in the bottom layer can use to solve its optimization problem at each time step. Figure 4c shows a diagram of the approach as well as the variables involved in the case study.

Remark 2

For simplicity, the same stage cost is used for every time step in the horizon and also for the terminal penalty in the simulations. Regarding the latter, a terminal cost design can be critical for system stability, although this issue goes beyond the scope of this work. In any case, the proposed framework is compatible with any choice of stage and terminal costs.

4.3 Application of HD-TBMPC to the Case Study

The applied control actions stem from a tree composed of Ns = 20 control sequences. Nevertheless, only the first component of these sequences gets to be implemented due to the receding horizon control strategy. To this end, a non-anticipative constraint is imposed in the optimization problem to guarantee that the value of the first component of all the control sequences is common Table 1 shows the disturbances as well as the control input for local agent 1. As can be seen, the same control action is computed for the root of the tree at the first time step, and then the scenario tree bifurcates at the next time steps (i.e., different control inputs are calculated for each branch of the disturbance tree. These control actions reduce the over-conservatism because they are optimal for the disturbance realizations merged before a bifurcation point where the control action takes a different path. The structure of the branching factor (i.e., the number of branches that occurs after a node) can be established a priori, as pointed out in Di Cairano et al. (2014). Additionally, the number of decision variables in each optimization problem can be reduced if necessary by using a shorter control horizon, thereby improving the computational burden remarkably. However, this could result in possible adverse effects on stability and performance.

Table 1 Control inputs expressed in a tree composed of 20 scenarios for local subsystem 1 at the time instant k = 288

Our results show that the water levels for both subsystems stay around the corresponding reference levels. That is, disturbances are successfully handled by the controller. Figure 6a shows the water level for the subsystem 1, which has a mean value of − 0.4 m and a standard deviation of 0.0029 m. Similar results are obtained for the second subsystem (see Fig. 6b), which presents the same mean and a standard deviation of 0.0104 m. Neither reference levels violates the established constraints at any time instant.

Fig. 6
figure 6

a Water level of Lake IJsselmeer and Lake Markermeer, b water of the North Sea canal, c water exchange between the local subsystems, and d outflows of the local subsystems using an HD-MPC controller

Figure 6c shows the evolution of the water exchange via the Schellingwoude Gate between the sea and the canal. An increased water exchange occurs around 35 m3/s until the end of the highest rainfall input. During the rest of the simulation, the water exchange is reduced due the lower disturbance level.

Figure 6d shows the evolution of the pumps, which actuate directly over the outflows. They are turned on to deal with rainfall and reach 227 m3/s and 200 m3/s, respectively, during the first 5 days. The pump at IJmuiden, which corresponds to subsystem 1, achieves its maximum flow, around 450 m3/s, between days 5 and 15, which correspond to the period of maximum inflows. After that, the outflow 1 is decreased over the next 10 days. Next, the inflows are increased, and the discharge also increases again to prevent an overflow. Meanwhile, subsystem 2 receives the water from its neighbor and that of the rainfall input. Then, pump 2, which governs the outflow, is closer to 100 m3/s during a period of 15 days. After that, the increase in the inflow causes an increase in outflow 2.

4.4 Performance Assessment

A performance comparison is carried out between five MPC controllers to show the benefits of the proposed approach. The five considered controllers are a perfect forecast MPC (PF-MPC) controller, a standard DMPC controller fed with the mean value of the considered scenarios, a min–max MPC that solves the optimization problem by taking into account the worst-case scenario at each time step, a MS-MPC, which computes a unique control sequence that is valid for all scenarios at each sample step, and finally, the newest approach, an HD-MPC controller based on a TB-MPC.

The results from the final cumulative cost (FCC) and the mean value of the water levels for both subsystems (\(\bar {\mathrm {h}}_{1}\), \(\bar {\mathrm {h}}_{2}\)) are given next:

  • PF-MPC: FCC is 130.76 and \(\bar {\mathrm {h}}_{1}\) and \(\bar {\mathrm {h}}_{2}\) are both -0.3999.

  • Standard DMPC: FCC is 8.72e3 and \(\bar {\mathrm {h}}_{1}\) and \(\bar {\mathrm {h}}_{2}\) are -0.4159 and -0.3957, respectively.

  • Min-max MPC: FCC is 4.55e3 whereas \(\bar {\mathrm {h}}_{1}\) and \(\bar {\mathrm {h}}_{2}\) are -0.4104 and -0.3721, respectively.

  • MS-MPC: FCC is 2.35e3 and \(\bar {\mathrm {h}}_{1}\) and \(\bar {\mathrm {h}}_{2}\) are respectively -0.4015 and -0.3962.

  • HD-MPC: FCC is 487.46 whereas \(\bar {\mathrm {h}}_{1}\) and \(\bar {\mathrm {h}}_{2}\) are -0.3996 and -0.3993, respectively.

We show here the evolution of the system variables for the best and the worst method according to FCC. PF-MPC shows the best result, exhibiting the ideal controller behavior, as can be seen in Fig. 7. Nevertheless, this controller is not realistic because a perfect forecast cannot be obtained. The worst results are those of the standard DMPC controller, which are shown in Fig. 8. The water levels do not follow their reference levels, and the outflows through the valves fall in an over-conservative manner. Therefore, FCC is increased remarkably. This shows the vulnerabilities of this type of controller when the disturbance prediction is made considering mean values. As for the rest of the methods, the min–max MPC approach shows an increased FCC compared with both scenario-based MPCs. Regarding MS-MPC, it offers a high FCC as a result of the application of a unique control input for all possible scenarios; it can be considered as a conservative approach. This issue has been avoided by using the tree-based HD-MPC.

Fig. 7
figure 7

a Water level of Lake IJsselmeer and Lake Markermeer, b water of the North Sea canal, c water exchange between the local subsystems, and d outflows of the local subsystems using an PF-MPC controller

Fig. 8
figure 8

a Water level of Lake IJsselmeer and Lake Markermeer, b water of the North Sea canal, c water exchange between the local subsystems, and d outflows of the local subsystems using a standard DMPC controller

This comparison allows us to rank the performance of the proposed controller. The best performance, as expected, is achieved with the PF-MPC. However, HD-MPC is promising despite the presence of uncertainties compared with the other methods.

5 Discussion

Real-time controllers have been widely used to allocate water resources. Special attention has been paid to scenario-based techniques due to their advantages in addressing uncertainty. Scenarios allow the controller to benefit from information about the uncertainty affecting the system to calculate the optimal control actions for the system accordingly. While there are alternative methods, such as considering the disturbances as bounded sets and then calculating a min–max solution of the problem, they are very conservative, as they assumes a worst-case scenario in every computation. The use of meaningful scenarios allow us to relax the conservativeness of the solution, while limiting the number of scenarios allows us to improve the tractability of the optimization problem. MS-MPC and TB-MPC controllers, both well-known methods, were used to deal with hydrological conditions. These control schemes have been mainly applied from a centralized point of view. However, as with MS-MPC, if a unique control action for all possible scenarios is sought, the resulting control performance deteriorates (observe the higher FCC value). Likewise, using the hierarchical and distributed approach proposed in the paper, we can deal with processing scenarios from the subsystems, and if they were all taken together as in TB-MPC (i.e., a centralized approach), the computational requirements would likely explode. As expected, the FCC has been reduced by using a TB-MPC approach instead of an MS-MPC approach. However, in comparison to the new HD-MPC approach, TB-MPC suffers from higher computational requirements related to the number of scenarios that are considered. TB-MPC uses scenarios for the whole system, and due to the numerous subsystems involved, this may add up to a large number of scenarios. However, this issue is mitigated by the novel HD-MPC approach. At the same time, the performance of HD-MPC, while visibly worse than that of PF-MPC, significantly exceeds that of MS-MPC. Overall, the HD-MPC approach enhances several qualities of scenario-based MPC controllers.

6 Conclusions

This article presents a water resource management architecture to deal with systems subject to dynamical uncertainty. To this end, the overall system is distributed into subsystems that cooperate to coordinate their actions at the lower layer. The resulting subsystems correspond to different geographical regions under different hydrological conditions. The upper layer manages the uncertainty by considering EF and cumulative probability distribution functions based on historical data, which are filtered to provide local controllers only with relevant information regarding their disturbances. In this manner, it is possible to avoid combinatorial explosion problems, which may render the computation of the control actions infeasible. Hence, our approach is translated into a reduction of the computational burden for the management of water systems. As we have shown, tree-based HD-MPC can be used to address the disturbances and uncertainties that commonly affect water systems. The new method was compared with the PF-MPC, standard DMPC, min-max, and MS-MPC methods, demonstrating a favorable trade-off between robustness and cost. Moreover, it has been shown that with the proposed controller, the distributed solution converges to that of a centralized approach. Future works will focus on improving dynamical uncertainty estimation and test other stochastic approaches for dealing with the uncertainty in a distributed manner.