Skip to content

Control Program

Traditionally, real-time operation of water distribution is carried out using rule-based regulation of individual or small groups of coordinated control structures. There is a large potential for improving operational efficiency by global dynamic optimisation of the operation of all control structures within the water distribution infrastructure.

The global optimisation caters for coordination of operation of structures, and thereby facilitates a system-wide prioritisation of distribution, ensuring efficient water delivery at the required pressure. Demand forecast are integrated in the control minimizing sudden changes in pumped flow, improving operations and mitigating water hammer.

The optimisation is based on a dynamic surrogate model of the transmission network, which predicts the future system state as a function of three inputs: 1) initial state, 2) forecasted boundaries and 3) control actions. This means that the optimistation takes the expected future system state into account, when deciding on the best operation "now".

Quadratic optimization

The core of a model predictive control system is to solve a quadratic program with a set of linear constraints:

\min_{x} \frac{1}{2} \textbf{x} ^T P \textbf{x} + g^T \textbf{x} \\ s.t. \\ A \textbf{x}=\textbf{b} \\ C \textbf{x} \le \textbf{d}

where \textbf{x} has all elements for all time steps, so for instance \textbf{x} = \begin{bmatrix} x_{a,1..N_p} \\ x_{b,1..N_p} \\x_{c, 1..N_p} \end{bmatrix} for a system with three elements a, b and c. Also P is a diagonal matrix of weights. The inner product of a vector is equal to the square sum, the program can be reformulated as:

\min_{x_a, x_b, x_c} \rho_a \sum \textbf{x}_a^2 + \rho_b \sum \textbf{x}_b^2 + \rho_c \sum \textbf{x}_c^2 \\ s.t. \\ A \begin{bmatrix} \textbf{x}_a \\ \textbf{x}_b \\ \textbf{x}_c \end{bmatrix} = \textbf{b} \\ C \begin{bmatrix} \textbf{x}_a \\ \textbf{x}_b \\ \textbf{x}_c \end{bmatrix} \le \textbf{d}

The \rho are scalars, which they can be simplified to, given that the values of diagonal matrix P= I \begin{bmatrix} \rho_{a, 1..N_p} & \rho_{b, 1..N_p} & \rho_{c, 1..N_p} & \end{bmatrix}^T are equal inside the horizon intervals. It should be noted that the 'half' factor is omitted, as well as the linear terms g^T\textbf{x}. Given the design and scope of a control optimization program, these are acceptable condition, although no particular derivation is covered in these pages.

The reformulation with separate parts of the minimisation function is very useful, since part can define a control objective, where \rho clearly indicates the weight or priority for that objective. In this case the vectors x are readily designed as one quantity or state, with an indexed position for each point in the control horizon.

The state vector

In the following sections, the mpc program is covered in sections, and various states are explained. In summary the vector x is a composition of several elements. In control applications most state variables in the program will be described as either an input or output, and indeed x is resolved in those components:

\textbf{x} = \begin{bmatrix} \textbf{u} \\ \textbf{y} \\ \textbf{s} \end{bmatrix}

where \textbf{u} is the vector of all input, \textbf{y} is the vector of every output, and \textbf{s} is the vector of slack variables. Here the model control definitions for input and output are used. Input is a variable that can be manipulated in the optimisation (it is therefore not a variable that should be supplied externally). Output is a result computed by the model - it is a consequence of the chosen input. Cost function elements (optimisation targets) can be formulated with both input and output.

The third element, slack variables - \textbf{s}, exist as a tool for model design. Certain constraints in the program can be relaxed with a slack variable. It means that the constraint is allowed to be violated, but with a penalty which is proportional to the square of said slack variable. In most cases slack variables can't be associated with a physical property, and is for this reason mostly discounted from the output.

Program constraints

As a general guide, the equality constraints (A\textbf{x}=\textbf{b}) should be used to design the property of the controlled dynamic system, ie. defining the relevant physics of the system, for example:

  • relating water flow in and out of a storage tank with stored volume.
  • maintaining a massbalance across the system.
  • define the relcationship for headloss and flow through a pressurized pipe.

In control, equality constraints are also often called hard constraints, as a violation of these will render the program infeasible (which is fine for physical laws).

Inequality constraints (C\textbf{x} \le \textbf{d}), define a band of acceptable solutions, which is essential to control:

  • Keep a pump operating at flow / pressure / rotations under its given capacity.
  • Control water level in a storage tank to be inside desired boundaries, where the bottom volume could have some settled particles, or the certainly would have an overflow.

Additionally, inequality constraints can introduce slack variables, which relaxes the constraints for some variables:

  • Account for uncertainty / variance in sensor measurements, when these imperfections would otherwise not allow a complete massbalance.
  • Let the system recover in a controlled manner from a bad state.

Control objectives

For a water distribution network, assuming it includes elevated storage - or a similar reservoir - three types of objectives are defined for the model predictive control optimization program.

  1. Smooth and stable water production
  2. Minimise target level deviation in elevated storage

Note that the full control solutions will have many additional control parameters and constraints.

Water production

Each water works connected to a transmission network is associated with a water production - or discharge flow. It is an objective to create a stable discharge for several reasons:

  • Ground water wells are better operated with a stable demand.
  • Pump scheduling / load distribution is easier.
  • Responding to unexpected demand or anomalies is safer, if the controller is on point most of the time.
  • A stable discharge should reduce the risk for water hammer.

This objective puts a penalty (\rho on the controlled discharge (u_i) when it deviates from the flow in the previous time step (u_{i-1})). \rho is constant over the time horizon. The aim is to dampen changes in the controlled discharge

\sum_{i=0}^{N_p-1} \rho \left( u_i - u_{i-1} \right)^2

As the sum start at i=0, the very first term in the sum needs u_{-1}, i.e. thae controlled flow from the time step prior to starting the optimisation. This ensures that there is a cost related to making a change in the manipulated flow also in the very first time step.

Target level deviation

Each elevated storage or reservoir is in control purposes an equalizer of pressure, with the variable free water surface, and for capacity during peak demand. From a theoretical perspective, this control objective is redundant, since demand forecasts, pump capacity and control limits for the water height would identify an optimal solution, where the water level is shifted up during peak demand.

A practical approach suggests that it is better to choose a water level somewhere interior in the storage capacity as a target for the controller. Without the target, the storage capacity might go to its minimum, without other reason, than maintaining water production at its current rate. That requires much trust in the accuracy of demand forecasts, and measurements, as well as a high degree of responsiveness in the system actuators. Much of this is mitigated by choosing the interior target, keeping a larger amount of water in reserve capacity.

The squared deviations, between output (level) and its target at each time step, quantifies that objective and are aggregated in a sum:

\sum_{i=1}^{N_p} \rho (y_i - r_i)^2

Here y_i is a state in the controller (water level) at time step, i, r_i is the target value for time step, i. The target, r_i, may be a constant or vary over the control horizon.

Objectives prioritisation

These two objectives are counter points to each other: The water production stabilizes, using the storage capacity as a buffer, while keeping a steady water level in the storage, requires a responsive water production.

It is useful to have at least two objectives with opposite orientation, since it creates a range settings, that can be modified to obtain the desired controller realisation. The \rho in each expression is a weight for the given objective. This is a dimensionless number, which is set relative to the other. The larger one \rho is chosen relative to the other, the more that objective is emphasized, but if they are set equal, the controller gives the objectives equal significance.

Some heuristics exists with regards to setting these types of weights, but the generally most practical approach is to choose a set, and modify until a desired control realisation is achieved. The fact that the weights are so abstracted (no dimension, no physical dependency / explanation) should make it easier to engage with the system.

Controller output

A model predictive controller system uses a set of forecasts to identify the best control action "now" with respect to how the system will be affected in the "near future", which in control terms is the control horizon.

The output in this type of controller is multiple vectors, with the model states for the duration of the control horizon. Among these, some can be selected as setpoints, like the discharge from the waterworks. Often, only the first index position is passed as a setpoint, while the horizon is discarded.

An opportunity though, is that the state vectors can be included in a decision support systemm, since a feed of continously updated forecasts on pressure and flow could have operative relevance.