You are on page 1of 309

ROBUST MODEL PREDICTIVE CONTROL

OF WATER QUALITY
IN DRINKING WATER DISTRIBUTION SYSTEMS

by

TAO CHANG

A thesis submitted to
The University of Birmingham
for the degree of
DOCTOR OF PHILOSOPHY

Department of Electronic, Electrical and


Computer Engineering
School of Engineering
The University of Birmingham

August 2003
Synopsis

This thesis develops online feedback control of chlorine residuals performing at the lower level
of a hierarchical structure of integrated quantity and quality control in drinking water distribution
systems (DWDS), which provides a practical solution for online water quality control in DWDS.

Input-output and state-space models of the chlorine residuals are developed from mathematical
models of chlorine residual dynamics. The existing path analysis algorithm is extended and
utilized to obtain the parameter structure. Joint parameter and model structure error estimation is
developed using bounding approach based on a point-parametric model. The uncertainty radius of
the system is outlined through robust output prediction, through which requirements for model
accuracy from robust model predictive control (MPC) are explicitly imposed on model
estimation. Hence, an integrated design of controller and model estimation is achieved.

MPC is applied for chlorine residual control based on the set-bounded model. To fulfil output
constraints under system uncertainties, safety zones are employed, which are designed from an
online evaluation of the uncertainty scenarios of the system, to restrict the output constraints. The
safety zones can be obtained by solving a nonlinear constrained optimization problem using a
significantly simplified relaxation-gain algorithm. The resulting robust MPC (RMPC) is
decentralized assuming communication among the decentralized RMPCs is available.

The proposed methodology is verified by applying it to a simulated benchmark DWDS.


Simulation study of model estimation and RMPC operation is presented and discussed.
To my wife Dongmei
Acknowledgments

Most of all, I would like to thank my supervisor Prof. Tech. Sci. Mietek A. Brdys for his
advice, assistance and encouragement. Without his continuous support, guidance and
help this work would never have been presented here.

I would also like to thank all the members of the research group for their support and help
during past three years, especially Ying Zhang, Dr. Paul F. Weston and Dr. Yazeng Liu.

I am grateful to the Overseas Research Students Awards Scheme (ORS) and Department
of Electronic and Electrical Engineering of The University of Birmingham for their
financial supports.

My special thanks go to my parents, my brother and his family. Their unconditional


support is always the motivating strength in my life.

Last but not least, my deepest gratitude goes to Dongmei, my wife, for her love, support,
and care. To her I dedicate this work.
ROBUST MODEL PREDICTIVE CONTROL OF WATER QUALITY
IN DRINKING WATER DISTRIBUTION SYSTEMS

Chapter 1 Introduction 1
1.1 Objective of the project ......................................................................................... 1
1.1.1 Introduction to Water Quality Control in Drinking Water
Supply/Distribution Systems ................................................................... 2
1.1.2 Chlorine Residual Control in Drinking Water Distribution Systems ........ 7
1.1.3 Bounding Approach and Modelling of Chlorine Residuals
in Drinking Water Distribution Systems ................................................. 8
1.1.4 Robust Model Predictive Control for Time Delay System
under Output Constraints ....................................................................... 11
1.2 Achievements ...................................................................................................... 12
1.3 Thesis Structure ................................................................................................... 13

Chapter 2 Hierarchical Integrated Quantity and Quality Control Structure 15


2.1 Operational Control of Drinking Water
Distribution Systems: Objectives ...................................................................... 16
2.2 Hierarchical Integrated Quantity and Quality Control Structure ........................ 19
2.2.1 Hydraulic Impact On Quality Control .................................................... 19
2.2.2 Different Time-Scales for Quantity and Quality Control ....................... 20
2.2.3 Integrated Controller with Lower Level Fast Feedback Controller ....... 20
2.3 Lower Level Chlorine Residual Control ........................................................... 22
2.3.1 Control Input and Monitoring Point Location ........................................ 23
2.3.2 Features of the Lower Level Controller ................................................. 24
2.3.3 Decentralisation: With and Without Communication
Among the Local Controllers ............................................................... 25
2.3.4 Summary of the Lower Level Controller ............................................... 26

Chapter 3 Mathematical Model of Chlorine Residuals in Drinking Water Distribution


Systems 27
3.1 Hydraulic Laws in Drinking Water Distribution Systems .................................. 28
3.1.1 Pipes ....................................................................................................... 29
3.1.2 Valves ..................................................................................................... 31
3.1.3 Pumps ..................................................................................................... 32
3.1.3.1 Fixed Speed Pumps ................................................................. 32
3.1.3.2 Variable Speed Pumps ............................................................ 33
3.1.3.3 Variable Throttle Pumps ......................................................... 34
3.1.3.4 Pump Station ........................................................................... 34
3.1.4 Reservoirs and Tanks ............................................................................. 35
3.1.5 Physical Laws ......................................................................................... 37
3.1.5.1 Flow Continuity Law .............................................................. 37
3.1.5.2 Energy Conservation Law ...................................................... 37
3.1.6 Hydraulic Model of Drinking Water Distribution Systems
and Simulation ..................................................................................... 38
3.2 Implicit Model of Chlorine Residuals in Drinking Water
Distribution Systems ......................................................................................... 39
3.2.1 Hydraulic Time Steps ............................................................................. 40
3.2.2 Advective Transportation in Pipes ......................................................... 40
3.2.3 Reaction Kinetics: First Order Model .................................................... 42
3.2.3.1 Basic Bulk and Wall Decay Model ......................................... 43
3.2.3.2 Improved Wall Decay Model Considering Wall Transport .... 43
3.2.3.3 Remarks on Chlorine Reaction Kinetics ................................. 45
3.2.4 Reaction Kinetics Existing Re-Chlorination: Second Order Model ....... 46
3.2.5 Mixing of Chlorine Residuals in
Drinking Water Distribution Systems .................................................... 48
3.2.5.1 Mixing at Junction Nodes ....................................................... 48
3.2.5.2 Mixing in Storage Facilities .................................................... 49
3.2.6 Numerical Methods and Solvers ............................................................ 50
3.2.6.1 Eulerian Method: Finite-Difference Method and Discrete
Volume Method ..................................................................... 50
3.2.6.2 Lagrangian Method: Time-Driven and
Event-Driven Method ............................................................ 51
3.3 Explicit Model of Chlorine Residuals in Drinking Water Distribution
Systems ............................................................................................................. 51
3.3.1 Input-Output Model Formulation: Without Tanks in the Network ........ 53
3.3.1.1 Modelling of Chlorine Concentration in a Pipe and
Discretization of Time Delay ................................................ 54
3.3.1.2 Mixing at Junction Node ......................................................... 56
3.3.1.3 Input-Output Model of Chlorine Residuals in Drinking
Water Distribution Systems without Tanks ........................... 57
3.3.2 Modelling of Chlorine Residuals in Water Network with
Storage Facilities ................................................................................... 59
3.3.2.1 Chlorine Residual Modelling in Storage Tanks ...................... 60
3.3.2.2 Chlorine Residual Modelling in Water Network
with Tanks: Continuous Tank ............................................... 62
3.3.2.3 Chlorine Residual Modelling in Water Network
with Tanks: Switching Tank ................................................. 66
3.3.3 State-Space Model of Chlorine Residuals in Water Network ................ 69
3.4 Model Structure Determination .......................................................................... 72
3.4.1 Path Analysis Algorithm ........................................................................ 73
3.4.1.1 Detention Time Calculation in a Pipe ..................................... 74
3.4.1.2 At Junction Node .................................................................... 76
3.4.1.3 Backward Tracking in the DWDS without Tanks .................. 77
3.4.1.4 Backward Tracking in the DWDS with Tanks ....................... 78
3.4.2 Model Structure of State-Space Model .................................................. 79
3.4.3 Model Structure of Input-Output Model ................................................ 82
3.5 Summary ............................................................................................................ 83

Chapter 4 Model Parameter Estimation 85


4.1 Overall Procedure of Model Parameter Estimation .......................................... 89
4.1.1 Multiple Time-scales in Parameter Estimation/Calibration ................. 89
4.1.2 Structure of the Model Parameter Estimator ........................................ 90
4.2 Uncertainty in DWDS From Viewpoint of Chlorine Residual
Modelling for Control ..................................................................................... 93
4.2.1 Uncertainty in the Hydraulic Coefficients ........................................... 93
4.2.1.1 Meterage Errors .................................................................... 93
4.2.1.2 Roughness Coefficient C .................................................... 94
4.2.1.3 Pump Hydraulic Characteristic Curve g (⋅) .......................... 94

4.2.1.4 Valve Controlled Value V ................................................... 95


4.2.2 Uncertainty Caused by Water Demand Prediction
and Hydraulic Solver .......................................................................... 95
4.2.3 Reaction Constants and Approximation in
Chlorine Reaction Kinetics ................................................................. 96
4.2.4 Summary .............................................................................................. 97
4.3 Estimation of Parameters in Models for Control: Problem Formulation ......... 97
4.3.1 Problem Formulation ........................................................................... 98
4.3.2 Role of Simulator in Parameter Estimation ........................................ 100
4.3.3 Summary ............................................................................................ 101
4.4 Introduction to Bounding Approach for Estimation of
Parametric Model Parameters ....................................................................... 102
4.5 Point-Parametric Model Parameter Estimation .............................................. 106
4.5.1 Time-Varying Parameter Formulation ............................................... 108
4.5.2 Time-Invariant Parameter Formulation .............................................. 111
4.5.3 Parameter Estimation under Measurement Errors ............................. 112
4.5.4 Summary ............................................................................................ 113
4.6 Experiment Design ......................................................................................... 114
4.6.1 Representation of Inputs .................................................................... 114
4.6.2 Two Technical Theorems ................................................................... 115
4.6.3 Summary ............................................................................................ 120
4.7 Obtaining Parsimonious Model by Time Horizon Partition ........................... 122
4.7.1 Robust Output Prediction ................................................................... 122
4.7.2 Parameter Piece-Wise Constant Bounded Model by Partitioning ...... 125
4.8 Simulation Study ............................................................................................ 127
4.8.1 A Simple DWDS with One Switching Type Tank ............................ 128
4.8.2 Illustration of Path Analysis Algorithm ............................................. 132
4.8.3 Parameter Estimation of the Time-Varying
Point-Parametric Model .................................................................... 136
4.8.3.1 Estimation on a Time Slot .................................................. 137
4.8.3.2 Estimation on a Time Slot: under Measurement Error ....... 138
4.8.3.3 Model Performance ............................................................ 139
4.8.4 Parameter Estimation of the Time-Invariant
Point-Parametric Model .................................................................... 143
4.8.5 Summary ............................................................................................ 144

Chapter 5 Robust Model Predictive Controller Design 145


5.1 Model Predictive Controller ........................................................................... 147
5.1.1 Formulation Of Model Predictive Controller ..................................... 147
5.1.2 Robust MPC based on Uncertain Model: A Brief Overview ............. 152
5.1.2.1 Uncertainty Modelling ........................................................ 152
5.1.2.2 Formulation of Robust Model Predictive Control:
Min-Max Approach ........................................................... 154
5.1.2.3 Formulation of Robust Model Predictive Control:
Reference Governor Approach .......................................... 155
5.1.2.4 Formulation of Robust Model Predictive Control:
Constraints Restriction Approach .................................... 156
5.2 Robust MPC by Introducing Safety Zones to Restrict Output Constraints .... 157
5.2.1 Structure of the Robust Model Predictive Control ............................. 159
5.2.2 Algorithm of the Robust Model Predictive Control ........................... 161
5.3 Formulation of Nominal Model based Model Predictive Control .................. 161
5.3.1 Nominal Model .................................................................................. 162
5.3.1.1 Input-Output Model ............................................................ 162
5.3.1.2 State-Space Model .............................................................. 163
5.3.1.3 Matrix Expression of the Model: Input-Output Model ....... 164
5.3.1.4 Matrix Expression of the Model: State-Space Model ......... 165
5.3.1.5 Output Predictions .............................................................. 166
5.3.2 Performance Index ............................................................................. 169
5.3.3 Input Constraints ................................................................................ 171
5.3.4 Output Constraints ............................................................................. 172
5.3.5 Optimization Problem of the NMPC: Quadratic Programming ......... 172
5.4 Uncertainties in the System ............................................................................ 173
5.4.1 Parameter Bounded Model ................................................................. 173
5.4.2 Measurement Errors ........................................................................... 173
5.4.3 Actuator Errors ................................................................................... 174
5.5 Control Feasibility Assessment ...................................................................... 175
5.5.1 Robust Output Prediction: Based on Input-Output Model ................. 177
5.5.2 Robust Output Prediction: Based on State-Space Model ................... 179
5.5.3 Assessment of the Control Feasibility ................................................ 181
5.6 Approximated Calculation of Robust Output Prediction:
Mixed Integer Programming ......................................................................... 182
5.6.1 MIP Introduction ................................................................................ 182
5.6.2 Approximating Product Term by Linearization ................................. 183
5.6.3 Problem Formulation ......................................................................... 185
5.7 Controller Operation under Algorithm Failure ............................................... 186
5.7.1 Uncertainty Radius Tuning ................................................................ 187
5.7.2 Output Constraint Relaxation ............................................................. 188
5.7.3 Repeat Last Control Values ............................................................... 189
5.7.4 Soft Constraint Treatment .................................................................. 189
5.8 Summary and Remarks .................................................................................. 191
Chapter 6 Safety Zone Design for Robust Model Predictive Control 193
6.1 Constrained Non-linear Programming ........................................................... 193
6.1.1 Penalty Function and Barrier Function .............................................. 193
6.1.2 Multiplier Penalty Function ............................................................... 195
6.1.3 Solving Algorithm .............................................................................. 196
6.2 Formulation of Safety Zones Design Using Multiplier Penalty Function ...... 197
6.2.1 Smooth Function ................................................................................ 198
6.2.2 Existence of First Order and Second Order Derivatives .................... 200
6.3 Solution of Multiplier Penalty Formulated Problem ...................................... 201
6.4 Approximated Algorithm ............................................................................... 201

Chapter 7 Chlorine Residual Control in Drinking Water Distribution Systems:


A Case Study 207
7.1 Simulation Environment ................................................................................. 208
7.1.1 Quadratic Programming Solver .......................................................... 208
7.1.2 Mixed Integer Programming Solver ................................................... 208
7.1.3 Water Network Simulator: EPANET ................................................. 209
7.1.4 Main Specifications of the Software and Hardware
in the Simulation ............................................................................... 210
7.1.5 Simulation Implementation in Matlab ............................................... 210
7.2 Chlorine Residual Control of a Simple Water Network ................................. 213
7.3 A Benchmark Drinking Water Distribution Network .................................... 217
7.3.1 Model of the Benchmark Drinking Water Distribution Network ...... 221
7.3.1.1 Input-Output Model ............................................................ 222
7.3.1.2 State-Space Model .............................................................. 224
7.3.1.3 Remarks on the Parameter Piece-Wise Constant
Bounded Model ................................................................... 227
7.3.2 Robust Model Predictive Control of Chlorine Residuals
in Drinking Water Distribution Network .......................................... 228
7.3.2.1 Safety Zone Design ............................................................. 228
7.3.2.2 Chlorine Residual Control Based on Input-Output Model .. 233
7.3.2.3 Chlorine Residual Control Based on State-Space Model ... 236
7.3.2.4 Chlorine Residual Control
Existing Water Demand Prediction Error ........................ 238
7.4 Summary and Remarks .................................................................................. 241
Chapter 8 Decentralization of The Robust Model Predictive Controller 243
8.1 Control Problem Statement ........................................................................... 244
8.2 Decentralized Control Structure .................................................................... 245
8.3 Algorithm Description and Implementation .................................................. 249
8.4 Simulation Results ......................................................................................... 249
8.5 Summary ....................................................................................................... 253

Chapter 9 Conclusions 255


9.1 Modelling of Chlorine Residuals for Control Purposes ................................. 256
9.2 Robust Model Predictive Control of Chlorine Residuals in
Drinking Water Distribution Systems ........................................................... 257
9.3 Conclusions on Simulation Study .................................................................. 258
9.4 Issues on Practical Implementation ......................................................259
9.5 Recommendations to Future Work ................................................................. 260

Bibliography 263

Appendix

A. A Simple DWDS Network File 275


B. Network File of a Benchmark DWDS 278
C. A Sample MPS File for MOMIP Solver 282
D. Call MOMIP Solver in MATLAB 285
E. Embedding EPANET2.0 into Matlab 290
F. List of Publications 294
List of Symbols

Lower Cases

ai (t ) i th Impact coefficient in discrete model, where i ∈ I


an , j ,i (t ) i th Impact coefficient of the n th output with respect to j th input,
where i ∈ I n , j
a p (t ) Impact coefficient in continuous model, with respect to path p
asjp (t ) Impact coefficient in continuous model, describing injection node
s ’s effect on node j through path p
bn,i (t ) Coefficients describing dynamics caused by tanks, corresponding to
n th output and i = 1,..., nT , where nT is the tank number in the system
cij ( x, t ) Chlorine residual concentration in a pipe ij at time instant t , and
position x with respect to node i
cT (t ) System state, chlorine concentration in tank
d (t ) Time-varying transportation delay
dl (t ) Time-varying transportation delay in pipe l
d p (t ) Time-varying transportation delay in path p
drn ,k ,i (t ) i th Impact coefficient of the n th output with respect to k th state during
draining cycle, where i ∈ Dn,k is the delay number set from tank node
to output node
flk , j ,i (t ) i th Impact coefficient of the k th state with respect to j th input during
filling cycle, where i ∈ Fk , j is the delay number set tom injection
node to tank node
f
g (qij ) Fixed-speed pump hydraulic characteristic curve
g s (qij ) Variable-speed pump hydraulic characteristic curve
hi Water head of node j
∆hij Water head difference of node i and node j
k General chlorine decay constant
kb Bulk decay constant
kf Mass transfer coefficient of chlorine residuals
kw Wall decay constant
m(t ) Operational controls produced at the upper level
nI Number of injection nodes
nM Number of monitored nodes
nT Number of tanks
p Chlorine transportation path from injection node to monitored node
qij Water flow from node i to node j
rh Hydraulic radius of a pipe
[t 0 , t 0 + Tc ] Control horizon Tc starting at time instant t0
[t 0 , t 0 + Tm ] Modelling horizon Tm starting at time instant t0
u (t ) System input at time instant t , chlorine concentration in injection
node
u max (t ) Upper limit of input constraint
u min (t ) Lower limit of input constraint
∆u (t ) max Rate constraint of input
u c (t ) Controller outputs
vij Flow velocity in pipe ij
wd i Water demand at node i
y (t ) System output at time instant t , chlorine concentration at monitored
node
y m (t ) Output measurement
y (t + k | t ) k th -step output prediction performed at time instant t
y l (t + k | t ), y u (t + k | t ) Robust output prediction, lower and upper bounds on y (t + k )
performed at time instant t
max
y (t ) Upper limit of output constraint
max
y s (t ) Upper limit of output constraint modified by safety zone
y min (t ) Lower limit of output constraint
y smin (t ) Lower limit of output constraint modified by safety zone

Upper Cases

C ( x) Constraint set of a nonlinear optimal problem


C (Uˆ )
u Set of input constraints
C y (Yˆ ) Set of output constraints
Hp Prediction horizon of model predictive control
Hm Input horizon of model prediction control
I Discrete time delay number set over a time slot
Ip Discrete time-delay number in path p over the considered horizon
I n, j Discrete delay number set corresponding to n th output and j th input
Lij Length of pipe ij
P(t ) Path set from injection node to monitored node
P, Q Weight matrix
R Set of real number
Sj j th time slot of the control horizon
S y ,d , S T ,d Time period of draining cycle
S y , f , ST , f Time period of filling cycle
∆Th Hydraulic step
∆Tc Quality step
∆TD Discretization time step
Û Input vector over H m of MPC
V (t ) Water volume in tank
V (Uˆ ) Performance index of MPC
Vz (Uˆ ) Performance index of MPC with zone reference
Y pk Set of k th -step predicted output performed at time instant t
Y pl , Y pu Robust output prediction vector over prediction horizon H p
Yˆ Predicted output vector over H p
min max
Y ,Y Output constraint vector
Ysmin , Ysmax Output constraint vector modified by safety zones
W Uncertainty radius of the set-bounded parametric model
W max Accuracy requirement from controller on model uncertainty radius
Z Set of integers

Greek Letters

α (t ) Chlorine decay coefficient in tank


β (t ) Decay factor of chlorine residuals corresponding to delay d (t )
ε (t ) Model structure error
ε+ Small positive number
ε a (t ) Actuator error
ε m (t ) Measurement error
ν Relaxation gain
φ (t )T Regressor vector of ARMA model
Φ ( x) Objective function of a nonlinear optimal problem
∇Φ ( x ) First order differentiate of Φ ( x) with respect to x
∇ 2 Φ( x) Second order differentiate of Φ ( x ) with respect to x
θ (t ) Parameter vector of ARMA model
~
Θ Feasible parameter set for time-varying point-parametric model
Θ Feasible parameter set for time-invariant point-parametric model
σ (t + k | t ), σ (t + k | t ) Safety zones for k th -step output constraint required at time instant t
l u

σ l ,σ u Safety zone vector over prediction horizon


τ Back-tracking time step of path analysis algorithm
ω ji (t ) Flow mixing ratio at node i with respect to flow from pipe ji


The symbol = is used where a variable is defined.
List of Abbreviations

ADE Advection-Diffusion Equation


ARMA Auto-Regressive Moving Average
ARMAX Auto-Regressive Moving Average Exogenous
DBP Disinfectant By-Product
DRMPC Decentralized Robust Model Predictive Control
DVM Discrete Volume Method
DWDS Drinking Water Distribution Systems
EDM Event-Driven Method
EPA Environmental Protection Agency of United States
FDM Finite-Difference Method
FIR Finite Impulse Response
FSP Fixed Speed Pump
GPM Gallon Per Minute
IHMPC Infinite Horizon Model Predictive Control
IO Input-Output
LP Linear Programming
MA Moving Average
MGD Million Gallon / Day
MIMO Multiple Input Multiple Output
MIP Mixed Integer Programming
MISO Multiple Input Single Output
MPC Model Predictive Control
MPS Mathematical Programming Systems
NMPC Nominal Model based Model Predictive Control
PDE Partial Differential Equation
PDF Probability Distribution Function
PID Proportion, Integration and Derivative
QP Quadratic Programming
RHC Receding Horizon Control
RMPC Robust Model Predictive Control
ROP Robust Output Prediction
SCADA Supervisory Control And Data Acquisition
SISO Single Input Single Output
SOI Special Order Inequalities
SOS2 Special Order Set of Type2
SS State-Space
TCP/IP Transportation Control Protocol / Internet Protocol
TDM Time-Driven Method
UBB Unknown But Bounded
UV Ultraviolet
VSP Variable Speed Pump
VTP Variable Throttle Pump
Chapter 1

Introduction

1.1 Objective of the Project

Maintaining chlorine residual concentration is discussed in this thesis, which is the key issue
of quality control for drinking water distribution systems (DWDS). The objective of the
control problem can be stated as: maintain the chlorine residual concentration throughout the
water network within the bound of lower and upper limits. Large time delays, constraints and
uncertainties in the system are the main features of the problem. In order to design the
controller, chlorine dynamics in the DWDS should be modelled and suitable mechanisms are
needed to model the uncertainties in the system based on a priori knowledge of the system
and online observations. Fulfilling constraints under uncertainty is the main objective of the
controller.

-1-
CHAPTER 1. INTRODUCTION

1.1.1 Introduction to Water Quality Control in Drinking Water


Supply/Distribution Systems

Water is an important resource that is essential for industrial application and domestic usage.
Drinking water is usually taken from ground sources such as rivers and lakes, or underground
sources such as wells and springs. Source water is treated in the water plant to filter out
unwanted substances using physical and chemical methods thereby making it safe, clean and
healthy for people to consume. The treated drinkable water from the water plant is then
transported to consumer taps by drinking water distribution systems. DWDS is large-scale
network systems composed of pumps, valves, storage tanks and user taps connected together
by pipes of various diameters made from variety of materials.

Figure 1.1 Neuhaus Water Supply System

A water distribution system can be a very large and complex system. For instance, cities with
a population of around 50,000 may have as many as 285 miles of distribution piping; 19,000
water meters; 1250 valves; 2,300 fire hydrants; 1 elevated tank; 1 ground storage tank; 4
booster pump stations; and 2 different water production facilities with 150 water supply wells
-2-
CHAPTER 1. INTRODUCTION

(Tyagi and Rowe, 2002). Figure 1.1 shows the Neuhaus Water Supply System in the Free
State of Thüringia, Germany (Chen, 1997). This system supplies 2,700 cubic meters of water
per day to an area of about 260 square kilometres with 28,000 inhabitants. The system
contains 11 reservoirs, 56 demand nodes, 53 pipes, 4 pumps and 4 valves.

To kill the microorganisms that can cause waterborne ills, disinfection is usually the final
treatment stage in the drinking water plant. Disinfectant concentration in the water may decay
during the transportation, and bacteria growth cannot be controlled if disinfectant
concentration is lower than certain level. Although the water has been disinfected at the
treatment works, the bacteria and waterborne pathogens may grow. Microorganisms can also
grow up on the pipe and tank walls as not all organisms are killed in the water treatment plant.
The surviving bacteria can grow to deleterious levels without further disinfection during water
transportation in the DWDS. In order to reduce the number of these disease-causing
organisms to a level that is harmless to human beings, chemicals are added at certain places in
the DWDS. The control of disinfection in the DWDS is the quality control problem that will
be considered in this thesis.

A number of chemical disinfectants can be used in the DWDS, e.g. chlorine, hypochlorite,
chlorine dioxide, chloramines and ozone. There are also non-chemical methods to disinfect
water such as ultraviolet (UV) irradiation and anolyte. The most common disinfectant is
chlorine, as it is inexpensive and effectively annihilates a variety of waterborne pathogens.
“Chlorine is highly soluble and is easily applied to water in controlled amount, either as
chlorine gas ( Cl2 ), which readily dissolves in water at room temperature, or as a salt of

hypochlorite ( OCl − )” (Frederick, 1997). When chlorine gas is added to water, the following
reactions occur (Frederick, 1997):

Cl 2 + H 2O ⇔ HOCl + Cl − (1.1)

HOCl + H 2O ⇔ H + + OCl − (1.2)

The relative concentrations of hypochlorous acid ( HOCl ) and hypochlorite ions ( OCl − ),
together termed “free chlorine” are determined principally by pH . The free chlorine needed
to react with all of the reactive materials in water is also referred to as the chlorine demand.
A minimum disinfectant concentration is required in order to effectively control the hazardous
-3-
CHAPTER 1. INTRODUCTION

microorganisms. It is usually stated as “a detectable chlorine concentration”. In practical


DWDS operation the minimum chlorine residual concentration is required as 0.2 [mg/l] by
U.S. EPA (Environmental Protection Agency) (EPA, 2002).

The first use of chlorine for water disinfection can be traced back to 1850, when John Snow
attempted to disinfect the Broad Street Pump water supply in London after an outbreak of
cholera (Christman, 1998). Since then, chlorine has been widely used in the DWDS around
the world. The magnitude of waterborne diseases has reduced significantly since the
widespread use of chlorine to treat drinking water. Disinfection of drinking water is one of the
major public health advances of the 20th century. However, in the 1970s scientists discovered
that during the water treatment process, chlorine and chloramines can react with organic
precursor material present in the bulk water or pipe walls to form Disinfection By-Products
(DBPs). Since the discovery of trihalomethanes, dozes of DBPs have been identified. Some
DBPs are suspected carcinogens, and epidemiological and animal studies have suggested a
link between certain DBPs and pregnancy loss (miscarriage) (EPA Meeting Summary, 1999;
Zierolf, Polycarpou and Uber 1998). The effects of the DBPs on human health are still under
investigation.

Concerns about the potential health hazards of chlorine or chlorine-based disinfectant DBPs
led public health authorities in many countries to propose regulations for water treatment and
DWDS operation to control DBPs in drinking water. This leads to a limitation on the chlorine
dosage in DWDS, and stricter monitoring of the chlorine residual concentration in the water
network. For instance, the WHO 1993 Guidelines established a guideline value of 5 [mg/l]
for free chlorine in drinking water, but noted that this value is conservative, as no adverse
effect was identified in the study used. At the meeting to plan the revision of the guidelines,
held in Berlin in June 2000, it was concluded that the guideline document should be revised
based on the Environmental Health Criteria monograph on disinfectants and disinfection by-
products published in 1999 (WHO, 2000).

The EPA (Environmental Protection Agency of United States) made a two-stage


implementation of the regulations on water disinfectants and DBPs. The final Stage 1
Disinfectants and Disinfection By-products Rule includes the following key provisions (EPA,
2002):

-4-
CHAPTER 1. INTRODUCTION

• Maximum residual disinfectant level goals (MRDLGs) for chlorine (4 [mg/l]),


chloramines (4 [mg/l]), and chlorine dioxide (0.8 [mg/l]);
• Maximum contaminant level goals (MCLGs) for four trihalomethanes (chloroform
(zero), bromodichloromethane (zero), dibromochloromethane (0.06 [mg/l]), and
bromoform (zero)), two haloacetic acids (dichloroacetic acid (zero) and trichloroacetic
acid (0.3 [mg/l])), bromate (zero), and chlorite (0.8 [mg/l]); EPA subsequently
removed the zero MCLG for chloroform from its National Primary Drinking Water
Regulations, effective May 30, 2000, in accordance with an order of the U.S. Court of
Appeals for the District of Columbia Circuit.
• MRDLs for three disinfectants (chlorine (4.0 [mg/l]), chloramines (4.0 [mg/l]), and
chlorine dioxide (0.8 [mg/l]));
• MCLs for total trihalomethanes - a sum of the four listed above (0.080 [mg/l]),
haloacetic acids (HAA5) (0.060 [mg/l])- a sum of the two listed above plus
monochloroacetic acid and mono- and dibromoacetic acids), and two inorganic
disinfection byproducts (chlorite (1.0 [mg/l])) and bromate (0.010 [mg/l]));
• A treatment technique for removal of DBP precursor material

The rules on disinfectant and DBPs will be even stricter in the future. In the UK, exposure to
DBP is controlled by means of health-based standards for chloroform and other
trihalomethanes that are enforced by the Inspectorate. The standards are set in the European
Commission's Drinking Water Directive and the Inspectorate has advised water companies to
optimize disinfection processes in order to minimize DBP concentrations in drinking water.
Due to difficulties in investigating the adverse effects of DBPs, the Inspectorate received
advice from the Department of Health's expert committees. This advice confirmed that
disinfection is vital to the prevention of waterborne disease and that, providing steps are taken
to minimize exposure to DBP, there are no grounds for changing current disinfection practices
(UK Drinking Water Inspectorate, 2002). There is still no guided value of minimum or
maximum chlorine residual concentration. Contrary to the United States, water treatment in
some parts of Europe is intent on reduction, and in some cases elimination of chlorine
residuals from the distribution system. The supplier’s strategy is to provide biologically stable
water with no chlorine demand and maintain a high quality distribution network, such that the
potential contamination introduced into the system is maintained at a low level. However, it is
not operationally practical in all European countries. Many people still argue that maintaining

-5-
CHAPTER 1. INTRODUCTION

a chlorine residual concentration is an effective means. (Braghetta, Jacangelo, Trussell and et


al., 1997)

A major challenge for water suppliers is how to balance risks from microbial pathogens and
from disinfection by-products. It is important to provide protection against microbial
pathogens while simultaneously ensuring decreasing health risks to the public from DBPs.
This situation hints more financial and technical efforts should be executed. The current
control technology in water practice cannot meet the requirement arising from the new
regulations. The quality control in DWDS is at present extremely important application field
still waiting for a practically sound solution (Polycarpou, Uber, Wang and et al., 2002).

The disinfectant by-product debate makes some people think that chlorine disinfectant may be
replaced by other disinfectants in the future. This is highly unlikely, as other disinfectants also
produce by-products, with the exception of UV treatment. Furthermore, chlorine is the
disinfectant of choice for drinking water for a number of reasons. Its wide range of benefits
cannot be provided by any other single disinfectant. Chlorine-based disinfectants are the only
disinfectants that provide a residual in the distribution system. This residual is an important
part of a multi-barrier to prevent waterborne disease. The comparison of different disinfection
methods is listed below (C3, 1997):

Table 1.1 Performance of the Most Common Disinfections Used in DWDS

Disinfectants Residual State of Colour Removal of


Maintenance Information Removal Common
on Byproduct Odours
Chemistry
Chlorine Good Adequate Good Good

Chloramines Good Limited Unacceptable Poor


Chlorine Unacceptable Adequate Good Good
dioxide
Ozone Unacceptable Limited Excellent Excellent
UV Unacceptable Nil N/A N/A

-6-
CHAPTER 1. INTRODUCTION

Shortage of underground water resources means that more and more surface water is required
for drinking water sources, needing more disinfection than underground water. This fact
suggests that the use of chlorine may be increasing in particular areas especially in developing
countries where pollution is denser than in developed countries. According to the WHO
(World Health Organisation), disinfection by chlorine is still the best guarantee of
microbiologically safe water (Christman, 1998). The WHO noted that “the risks to health
from disinfection by-products are extremely small in comparison with the risks associated
with inadequate disinfection, and it is important that disinfection should not be compromised
in attempting to control such by-product” (WHO, 1993 and 1998).

It should be pointed out that although chlorine is the main disinfection method used in most of
the water treatment plants worldwide, it is not used in certain countries, e.g. the Netherlands.
In some countries, France for example, chlorination is not used as the main disinfection
method (Connell, 1998). From the viewpoint of control technology, we are more interested in
the kinetic properties of the disinfectant concentration when added to water. The methodology
developed for a particular chemical can be used for other chemicals without many difficulties.
Only the modelling and controlling of chlorine residual concentration in DWDS are
considered in this thesis. The developed methodology can be extended to other disinfectant
application in DWDS and more generally it can be used in a wide range of chemical /
biological processes.

1.1.2 Chlorine Residual Control in Drinking Water Distribution Systems

Quality control (chlorine concentration control) in DWDS is based on the hydraulics


produced by the quantity controller. A hierarchical structure is proposed in this thesis for
integrated quantity and quality control of DWDS. At the lower level of the structure, an
online feedback chlorine concentration controller is designed using RMPC (Robust Model
Predictive Control) technology. The controller is used to improve the control performance of
the upper level controller where the feedback is less frequent than the controller at the lower
level. Suitable model form is needed for RMPC design. Input-output and state-space models
with bounded parameters will be developed in this thesis using bounding approach.

-7-
CHAPTER 1. INTRODUCTION

Control of chlorine concentration is a relatively new field. As public authorities increase the
requirement for monitoring the disinfectant concentration and maximum DBPs in DWDS,
more and more online chlorine monitoring information is becoming available, which provides
for the possibilities of online feedback control of water quality in DWDS. For large water
distribution system it is difficult to maintain a uniform chlorine distribution by adding only
chlorine to the output flows from the water treatment plant. Contradictory chlorine demand
may occur at the zones close to the water reservoir and zones at the edge of the DWDS, which
leads to the application of chlorine booster stations in the DWDS. However, suitable control
technologies that can handle the special features of the chlorine concentration control in
DWDS: large time-varying time-delay, operation and output constraints and uncertainties in
the system, is still under research. The quality control in DWDS is at present an extremely
important application field that still waits for a practically sound solution (Polycarpou, Uber,
Wang and et al., 2002).

In this thesis, the existing techniques discussed in the following sections will be extended, and
a practical methodology of integrated modelling and controller design will be developed for
water quality control in DWDS.

1.1.3 Bounding Approach and Modelling of Chlorine Residuals in Drinking


Water Distribution Systems

As stated in (Milanese, Norton, Piet-Lahanier and et al., 1996), “Bounding is the process of
finding bounds on the parameters or state of a given system model that confine within
specified ranges the errors between the model outputs and their observed values.” Bounding
approach defines a mapping from the a priori knowledge of the system and online collecting
information (measurements / observations on the system) through the model into the bounds
of the model parameters. The a priori knowledge and online system information define a set,
containing all possible errors in which all unknown factors are included, which may be called
the constraint set. Meanwhile the parameter bounds define another set that is usually called
the feasible set, and the mapping from constraint set to the feasible set. Different from
statistical estimation methods, the bounding approach does not require any statistical

-8-
CHAPTER 1. INTRODUCTION

properties of the measurement data, nor of the a priori knowledge of the system itself, e.g. the
Probability Distribution Function (PDF). In bounding estimation, the error or uncertainty
information for a particular parameter or state is given by certain norms on that variable. This
may be the most useful advantage in bounding estimation. As in practice, especially in some
chemical and biological process, the observation data is limited, the statistical properties
obtained are usually biased. Moreover, it is not convincing to assume the model structure
error, which is the model residual error caused by neglected factors in the system such as
model order reduction, linearization or other simplifications, being a random variable with a
certain PDF. Different from statistical estimation, bounding approach establishes a direct link
between the available information and the uncertainties in the model (parameters and
structure) without possessing prior statistical knowledge about the system.

As will be discussed in detail in the following chapters, three main aspects govern chlorine
residual concentration in DWDS: transportation, mixture and reaction. The first two aspects
depend on the hydraulics of the DWDS such as water flow, flow velocity and water head over
time, which are driven by water demand and pump/valve operations of the network. The
water demand is time varying and results in time-varying hydraulics. In operational control of
DWDS water demand is usually outlined by a predicted discrete-time series with certain time
step, usually one or two hours. The predicted water demand is assumed to be constant over
each time step. The operation schedules of pumps and valves are derived from optimizing an
operating energy consumption to meet the water demand. The water demand prediction
describes the average value of water demand over the time step while neglecting prediction
errors and the instantaneous variations. Such errors result in uncertain hydraulic information
that will be used to model chlorine transportation and mixing. Furthermore, chlorine reaction
kinetics is a complicated chemical process that is still under research. Only first- and second-
order mathematical models are generally applied at present. All of the above factors should be
appropriately embedded into the system modelling.

Driven by hydraulics, chlorine dynamics is also time varying and abrupt variations may occur
due to switching of operation status. Traditional estimation methods, e.g. the least squares
algorithm, may fail in tracing such fast time-varying dynamics. The historical observations
are not sufficient to identify a model for model predictive control purposes where model at
future time is needed. Alternatively, numerical simulation of the DWDS is widely used at
present in water network design and operation optimization. Accurate numerical simulator
-9-
CHAPTER 1. INTRODUCTION

can be obtained by calibrating the simulator coefficients using historical observation data. The
chlorine concentration data generated by the simulator based on the water demand prediction
over the control horizon can then be used as pseudo observation data for model parameter
estimation. The uncertainties caused by hydraulics and neglected chlorine reaction kinetics
are treated as the a priori knowledge for the system and are assumed unknown but bounded
(UBB).

Transportation delay is the main feature in the chlorine concentration modelling in DWDS.
Depending on the scale of the DWDS and the location of the nodes of chlorine injection and
monitoring, the delay may vary from tens of minutes to tens of hours. Driven by varying
hydraulics, the time-delay is continuous and time varying. As it is still difficult to process
continuous time-varying delays in model estimation and control design, the continuous time
delay is discretized over certain time horizon. However, discretization leads to approximation
errors, and it is difficult to evaluate the error analytically to give a less conservative bounds.
In this case, applying the point-parametric model concept may give a better evaluation of the
model structure error. Corresponding to each input function over the control horizon there
exists a set of parameter and model structure errors that is consistent with the observations
and the a priori knowledge. Hence, it is a point parameter estimate corresponding to this
particular input. The set that includes all the possible point estimates corresponding to any
input is defined as the feasible parameter set in this case. The bounds on the parameters and
model structure error can then be calculated jointly.

The obtained bounded model will be used for robust control design and operation. To
improve the control design quality and performance, an integrated way of robust estimation
and control is needed. As the chlorine concentration system is time varying, the tightest
bounds on the parameters must be time varying as well. However, it is difficult to obtain
accurate time-varying bounds in practice. An approximate, constantly bounded model is
applied instead. However, the constant bounds on parameters may tend to infinity when time
goes forwards, which makes robust control impossible as no robust controller can handle very
large conservatism. A robust output prediction (ROP) is defined that bounds the outputs
considering all uncertain factors in the system, hence, which can be used as a criterion of
evaluating the uncertainties existing in the model. ROP establishes a link between the model
estimation and control design / operation. Model accuracy requirements from control design
can now be imposed on model estimation explicitly.
- 10 -
CHAPTER 1. INTRODUCTION

1.1.4 Robust Model Predictive Control for Time Delay System under
Output Constraints

Based on the obtained chlorine residual model, the controller for water quality control is to be
designed. The chlorine concentration control in DWDS is complicated by time-varying
delays, input and output constraints, and uncertainties in the systems. Model predictive
control (MPC) is a powerful control tool that can explicitly deal with hard constraints and is
suitable for systems with time delays. The MPC is operated by optimizing a performance
index based on an output prediction over the prediction horizon, where the output prediction
is obtained by explicit use of the system model. The existence of uncertainties in the system
makes the MPC design and operation more difficult and certain properties of the controller
have to be rechecked. A robust controller is required, where the need for robustness arises
from the uncertainty in the system description. The controller properties like stability,
constraint satisfaction and performance need to be investigated under the uncertainty.

The objective of water quality control is to maintain the chlorine residual concentration within
the upper and lower limits under uncertain factors in the DWDS. A nominal model-based
MPC (NMPC) is designed first. When the input from the NMPC controller is applied to the
plant, the output constraints may not be satisfied at certain time instants due to uncertainties in
the system. The set-bounded parameter model provides a way of considering the extreme
scenarios of the system, the “worst-case” situation that the controller may be facing. This
implies the imposition of more restrictive constraints on the controller in order to satisfy the
output constraint in extreme situations. It is proposed to employ safety zones to modify the
output constraints that result in more restricted output constraints in the NMPC. Control
feasibility can now be guaranteed under system uncertainty in measurements, model and
actuator errors. The control space is shrunk correspondingly due to the constraint restrictions,
which is the price paid for the uncertainties in the system. Clearly, less conservatism is
required for larger operational space of the controller.

- 11 -
CHAPTER 1. INTRODUCTION

The safety zones are non-negative values that are redesigned at each MPC operating time step
according to the current system scenarios. The design of the safety zones is an iterative
algorithm, where the design iteration repeats until the output constraints are met under the
current uncertainties.

1.2 Achievements

1) A hierarchical structure of integrated quantity and quality control for DWDS is


proposed. A fast online feedback lower level quality controller is used to compensate
the loss of control performance at the upper level caused by varying hydraulics.

2) Input-output (IO) type model of chlorine residuals for control in DWDS with both
continuous and switching tanks is developed based on the existing IO models that only
work for DWDS with continuous tanks. Model structure of an IO type model during
the switching of tank operation is identified.

3) Based on the input-output type model, a state-space (SS) model is developed by taking
the chlorine concentration in tanks as the model states. The limitation of existing
input-output model is identified, and the control performance during the period of tank
filling cycle to tank draining cycle is improved by applying the SS model.

4) Structures of input-output and state-space type model are acquired by applying the
extended path analysis algorithm. Based on the point-parametric model, for the first
time, a set-bounded joint parameter and model structure error estimation algorithm is
established.

5) The obtained set-bounded model is assessed whether sufficient for robust control
design by a criterion defined through robust output prediction (ROP), through which
an integrated design of model estimation and robust control is achieved.

- 12 -
CHAPTER 1. INTRODUCTION

6) The chlorine concentration control problem in DWDS is formulated as model


predictive control (MPC) based on a set-bounded model under input and output
constraints. The robustness of the controller is guaranteed by introducing the so-called
safety-zone to restrict the output constraints. The calculation of the safety-zone is
formulated into a non-linear constrained optimal problem that is solved by applying a
penalty function method, where the convergence is guaranteed. A dedicated solver of
this penalty function optimization problem is developed as an iterative matrix
relaxation algorithm, and further simplified into an iterative relaxation-gain algorithm.
The obtained robust MPC (RMPC) is then decentralized assuming communication
among the decentralized RMPCs is available.

7) Finally, the developed methodology is verified on a benchmark DWDS. Simulation


results are presented and discussed. Recommendations for future work are also given.

1.3 Thesis Structure

In Chapter 2, the hierarchical structure of integrated quantity and quality control is presented.
The operational control problem for DWDS is introduced. The determination of the chlorine
injection and monitored node location problem is discussed by giving certain results in the
literature.

Mathematical modelling of the chlorine residual concentration is considered in Chapter 3.


Starting with the basic DWDS component model, the hydraulic effects on the quality model
are analysed. The mathematical models of chlorine transportation, mixing and reaction
kinetics are obtained. The procedures for obtaining input-output and state-space type models
are presented. The input-output model structure of DWDS with switching tank is analysed. A
controllability problem is also discussed in that chapter. How to determine the model
parameter structure is presented next, where a backtracking method is used in calculating the
time-delay in the chlorine transportation from the injection node to the monitored node, which
is the so-called path analysis algorithm.

- 13 -
CHAPTER 1. INTRODUCTION

The model estimation algorithm is derived in Chapter 4. Firstly, the overall structure of the
estimation problem is shown, which includes constructing a numerical simulator that is used
to generate the input-output data for the parameter estimation. Set-bounded estimation based
on the point-parametric model is developed and presented. A modelling horizon partitioning
algorithm is presented by measuring the “uncertainty radius” of the obtained model, where
“uncertainty radius” is based on the robust output prediction, through which the model
accuracy requirements from the controller are embodied into model estimation.

In Chapter 5, a robust model predictive controller is designed and implemented based on both
input-output and state-space models. The robustness of maintaining the output constraint
under uncertainty is guaranteed by introducing safety zones to modify the output constraints.
The modified output constraints are used in the nominal model based MPC resulting in a
restricted control space corresponding to the uncertainties. The overall RMPC algorithm
finally obtained is an iterative type algorithm. The iterations are carried out in order to
determine satisfactory safety-zones.

In Chapter 6, the safety zone design is formulated as a non-linear constrained optimization


problem. A simplified matrix relaxation algorithm and relaxation gain algorithm are
developed.

The implementation of the chlorine concentration controller is described in Chapter 7. The


controller is verified on a benchmark DWDS using computer simulation. Simulation results
are presented and discussed.

Decentralization of the above centralized RMPC is developed in Chapter 8, assuming that


communication among local controllers is available. At a local controller, the present control
inputs of the remote controllers are predicted based on the controls generated one time-step
earlier, obtained by communications from remote controllers. The prediction error is treated
as unknown but bounded, handled similarly to the actuator error, making the decentralization
fit well into the previously developed RMPC technology.

In Chapter 9 conclusions are presented. Recommendations for future work are presented as
well.
- 14 -
Chapter 2

Hierarchical Integrated Quantity and


Quality Control Structure

An integrated approach to quantity and quality control in water supply and distribution
systems is proposed. The integrated control consists of optimizing the operational cost,
meeting a demand on water of desired quality and maintaining the system constraints. This
constrained optimizing control problem is complex due to nonlinearities, large dimension,
output constraints, mixed-integer structure of the variables involved, at least two time scales
in the system dynamics and process uncertainty. A sub-optimal two-level hierarchical control
structure is proposed that allows incorporating the desired controller functions and yet making
the synthesis of these functions possible. The algorithms for implementing the functionalities
are proposed and discussed. Detailed design of the lower level controller is to be presented
and investigated in this thesis. Determination of optimal locations of booster stations
(actuators) and chlorine sensors for the lower level controller design purposes is discussed.
The contents of the chapter have been presented in (Brdys, Chang and Duzinkiewicz, 2000;
Brdys, Duzinkiewicz, Chang and et al., 2002; Duzinkiewicz, Brdys and Chang, 2002).

-15-
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

2.1 Operational Control of Drinking Water Distribution


Systems: Objectives

Drinking water distribution systems is a large scale network system composed of water
reservoirs, storage tanks, pumps, valves and pipes that are connected together to transport
water to the consumer taps (demand nodes). In order to provide high quality water to
consumers to fulfil the water quantity and pressure demand, operational control of DWDS is
performed. The purpose of the operational control is to satisfy the time-varying water
demands, maintain a stable prescribed water pressure throughout the network and minimize
the operating costs. This is achieved by operating the controllable components in the network
subjecting to the operational constraints. The controllable components are pumps, valves and
chemical injections such as chlorine. Constraints mainly include physical laws governing the
hydraulics such as relations between flows and heads, operating limitation of the controlled
components and control objectives. Many of the relations are described by non-linear
equations. From control viewpoint, operational control of DWDS is a constrained non-linear
optimal control problem including both the real and integer variables.

There are two major aspects in the control of drinking water distribution systems (DWDS):
quantity and quality. The quantity control deals with water flows and pressures producing
pump and valve schedules. As stated in Chapter 1, only control of chlorine residuals is
considered in this thesis. The objective of maintaining desired water quality is expressed by
certain limits (lower and upper) on the chlorine residuals at the consumption points. The
chlorine residuals are directly controlled in the treatment plants so that the water entering the
DWDS has prescribed residual values and also by post chlorination (booster chlorination)
carried out at certain points of the system. The chlorine residuals at these nodes representing
mixed outputs from the treatment plant and booster station are the direct control variables for
the quality control. The controller aims at keeping the plant output y (⋅) (chlorine residual
concentration at monitored nodes) within the output constraints described by the lower-upper
limits:

y min (t ) ≤ y (t ) ≤ y max (t ) (2.1)

- 16 -
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

over the time horizon t ∈ [t 0 , t0 + Tc ] , where Tc is the considered control horizon, and y min (t )

is the minimum chlorine residual requirement in the DWDS that is typically 0.2 [mg/l]. Value
of the upper limit depends on the network design, the locations of the chlorine injection nodes
and monitored nodes. The goal of control is to achieve an as low as possible chlorine
concentration above the minimum requirement. This concentration must be achievable under
the hydraulics of the particular water network. Here the value is set as y max (t ) = 0.3 [mg/l],
which has been verified achievable by the simulation results that will be presented in Chapter
8. In practice this value should be determined given the location of the chlorine injections and
the monitoring nodes and the predicted hydraulics in advance. Otherwise, it should be
included and solved in the integrated problem of the location of system inputs and outputs.

There are constraints on actuator to be satisfied:

Amplitude Limit: u min (t ) ≤ u (t ) ≤ u max (t ) (2.2)

Rate Limit: | u (t ) − u (t − 1) |≤ ∆u max (2.3)

where the upper limit u max (t ) is from the requirements of health regulations where a
maximum chlorine concentration in the DWDS is usually regulated or recommended as
discussed in Chapter 1. A value of 4 [mg/l] is defined by US EPA, this is a very conservative
value. In practice the DWDS operates lower than this value because of the usage of chlorine
booster stations. Hence, in the simulation study upper limit on chlorine injection is taken as
u max (t ) = 1 [mg/l] as the DWDS used in the simulation is a relatively small network. The

lower limit u min (t ) and rate change limitation ∆u max are from the operational constraints of

the chlorine booster stations, which are set as u min (t ) = 0 [mg/l] and ∆u max = 0.05 [mg/l].

Electricity charges due to pumping constitute the main component of the operational cost to
be minimized. Various algorithms for the quantity control were proposed, e.g., (Coulbeck,
Brdys, Orr and et al., 1988ab; Brion and Mays, 1991; Lansey and Zhong, 1990; Ormsbee and
Lansey, 1994; Brdys and Ulanicki, 1994; Nitivattananon, Sadowski and Quimpo,1996). In
order to compensate the uncertainty impact a feedback was introduced by Brdys and Ulanicki
(1994) by applying a model predictive technology in its receding horizon form. It is well

- 17 -
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

known that the hydraulics has an essential impact on the quality (Rossman, Clark and
Grayman, 1994). Recent work presented in (Ostfelt and Shamir, 1993ab; Brdys, Puta, Arnold
and et al., 1995; Sakarya and Mays 2000; Ostfeld, Salomons and Shamir, 2002, Trawicki,
Duzinkiewicz and Brdys, 2002) developed proposals for combining the quantity and quality
issues into one integrated control scheme in order to cater for the quantity – quality
interaction. Again, the receding horizon control technology was proposed (Brdys, Puta,
Arnold and et al., 1995) in order to introduce real measurement data into the integrated
optimization problem solved online. The optimization problem is very complex and its
solvers both implicit and explicit (Brdys, Puta, Arnold and et al., 1995; Sakarya and Mays,
2000; Ostfeld and Shamir, 2002; Trawicki, Duzinkiewicz and Brdys, 2002) have advantages
and disadvantages. Although the hybrid solver (Brdys, Arnold, Puta and et al., 1999ab;
Trawicki, Duzinkiewicz and Brdys, 2002) turns out to be much more efficient the quality step
needs to be quite small in order to obtain solutions maintaining the quality constraints.
Hence, the problem dimension increases rapidly even for small size systems. On the other
hand, due to the uncertainty in demands, system model parameters and measurement errors,
the chlorine residual constraints may be violated, regardless how small the quality step might
be. This is because a control technology (including the predictive one) that can guarantee
meeting the output constraint under large uncertainty in the model does not exist. The
uncertainty can be quite significant in our case as the optimizing control problem needs to be
considered over a horizon of typically 24 hours and the demand prediction over such period
may be very inaccurate. It is proposed to introduce another lower control level with high
frequency of sampling, which generates corrections of the chlorine residuals at the controlled
nodes based on the measurements of the chlorine residuals at the monitored nodes, so that the
quality constraints can be met.

- 18 -
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

2.2 Hierarchical Integrated Quantity and Quality Control


Structure

2.2.1 Hydraulic Impact On Quality Control

Chlorine concentration can change significantly due to decay and mixing of water flow with
different chlorine concentration. Retention time from the water reservoir to the monitored
nodes depends on the hydraulics that is determined by the operation of the DWDS. Hence,
quantity control has significant effects on the quality control. On the other hand the effect of
chlorine injection on the hydraulics can be neglected because the chlorine mass added is
negligible compared to the mass of the water. Thus there exists only one-way interaction
between hydraulics and quality in DWDS systems.

One purpose of quality control is to maintain a minimum chlorine concentration throughout


the network that can be achieved by reducing the overall retention time of water from the
source of DWDS to the monitored nodes. However, this objective can contradict the quantity
control problem where the objective is to minimize the energy cost of operating pump. For
instance, water is pumped into the storage tanks during the low electricity tariff period and
water is drained out during high electricity tariff period to meet water demands and to average
water pressure. However, this may result in large detention time of water in the storage tank
that is contradicted to quality control objective. It is necessary to solve the quantity and
quality control in an integrated way. The objectives of quantity and quality control can be
coordinated properly and potential conflict can be avoided. However, due to the quite
different natures of quantity and quality control, quality control objective cannot be achieved
accurately. Output constraint satisfaction cannot be guaranteed under uncertainties in the
system.

- 19 -
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

2.2.2 Different Time-Scales for Quantity and Quality Control

In operational control of DWDS the quantity control problem is formulated based on a water
demand prediction over the control horizon, which is typically 24 hours. Typical demand
prediction step used is 1 hour or 2 hours, and during the time period the demand is assumed
constant. Hydraulics is solved / modelled based on this discrete time steps, which is called
hydraulic steps or quantity steps. Modelling of chlorine transportation is performed in smaller
quality steps in order to achieve desired accuracy, which is typically 5 or 10 minutes or even
smaller. It can be seen that there is an almost ten times difference between the quantity step
and quality step. Computation burden and calculation accuracy have to be compromised in the
integrated quantity and quality controller. In the upper level of a hierarchical structure
integrated quantity and quality controller the quantity operational problem is solved and
quality control is taken into account to avoid contradiction. The lower level quality controller
is used to compensate the inaccurate performance of the upper quality control and constraint
satisfaction can be robustly guaranteed in the lower level.

2.2.3 Integrated Controller with Lower Level Fast Feedback Controller

The basic control structure is illustrated in Figure 2.1. It consists of two levels. The optimizing
controller at the upper level operates according to a receding horizon strategy. At the
beginning of a 24 hours time period the DWDS quantity and quality state is measured and/or
estimated and sent to the integrated quantity and quality optimizer. The consumer demand
prediction is also sent to the optimizer. Solving the integrated quantity-quality optimization
problem then produces the optimized chlorine injection schedules at the booster and treatment
work output nodes and the optimized pump and valve schedules over next 24 hours. The
pump and valve schedules are applied to the DWDS and maintained during the so-called
control time step e.g., two hours. The above sequence repeats at the end of the control time
horizon. Clearly, the quality constraints are satisfied for the DWDS model. Due to the model-
reality differences they might be violated in reality. The online measurements of the chlorine
concentrations at the monitored nodes are sent to the quality feedback controller at the lower

- 20 -
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

level and are compared against the prescribed bounds on allowed chlorine concentrations. The
DWDS hydraulic predictions are taken directly from the solution of the optimization problem
obtained at the upper level.

Optimizing Controller
- Upper Level
Optimized flow
Consumer demand schedules
prediction over 24 hours

Electricity
tariff
Optimized
Integrated quantity and chlorine injection
quality optimizer schedules

Operating schedules for


next 24 hours Hydraulic
Optimized Information
Optimized
valve
pump
schedules
schedules
Chlorine Chlorine
reference Quality Feedback Corrections
Controller ∑
bounds
Quantity, quality
feedback
Lower-level controller
Chlorine concentration Chlorine
at monitored nodes injection

Drinking Water Distribution System (DWDS)

Figure 2.1 Hierarchical Two-Level Structure for Optimizing Integrated Quantity-Quality


Control

With this information and by using the chlorine prediction at the monitored nodes applying
quality model, suitable instantaneous chlorine injection values at the controlled nodes can be
produced. In order to avoid large movements of the injection values the optimized injection
schedules obtained at the upper level are used to initialise the quality feedback controller.
Hence, the controller only produces corrections to the optimized injection schedules that
might be needed to make the schedules feasible. The corrections are performed online and the
sampling rate is selected accordingly so that no serious constraint violation can occur during
long time interval. The feasibility is achieved at the cost of certain loss on ‘optimality’. In

- 21 -
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

practise this loss is expected to be small. The corrected injection schedules are applied to the
DWDS. The controller is named as quality feedback controller in order to emphasize its fast
operating rate. Clearly, a feedback is applied in the upper level controller as well but it is done
at a much slower rate. Usually, at the upper level, DWDS operates are updated online every
one hour or two hours. At the lower level, the feedback is faster and controls changes every 5-
10 minutes. Compared with the lower level control, the time step used at the upper level can
be larger. Hence an efficiency of the integrated quality and quantity optimizer can be vastly
improved while maintaining good sub-optimality of the generated schedules. If the chlorine
concentration reference trajectories at the monitored nodes are prescribed then the feedback
quality controller performs a standard trajectory tracking function. It becomes a “keeping
within constraints” controller if the chlorine concentration is to be kept within the prescribed
limits only. The latter controllers are still under development by control community. The
design of a robust model predictive control type controller is presented in this thesis. The
proposed control structure offers reasonable compromise between a loss on optimality and
possibility of solving this very difficult control problem by applying existing control
technology. We shall not discuss further the optimization solvers needed to implement the
upper level controller as they can be found in the previously referenced literature. We shall
concentrate on the lower level quality feedback controller design.

2.3 Lower Level Chlorine Residual Control

Lower level feedback controller is designed in order to compensate the inaccuracy in the
upper level controller, in which operation is based on a demand prediction over a 24-hour
control horizon. Discrepancy is inevitable due to predictions errors, uncertainties in the
system, and relatively large sampling time that results in insufficient quality information
feedback. At the lower level a fast feedback scheme is introduced in order to compensate the
quality controls calculated at the upper level. The lower level feedback controller operates in a
time scale suitable to handle the quality interval dynamics.

- 22 -
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

2.3.1 Control Input and Monitoring Point Location

Chlorine booster stations and chlorine sensors are used for quality control in DWDS as
actuators and output measurement apparatuses, respectively. The location of these facilities
changes the system inputs and outputs, which is crucial to achieve the quality control
objectives.

It is not economical and not necessary to put chlorine sensors at every node of the water
network. Location of monitored nodes (chlorine sensors) is determined first in water network
design for quality control. The actuator location is then to be determined based on the
arrangement of the monitoring nodes by considering the control problem of maintaining the
chlorine concentration at the monitored nodes. It can be seen that the control problem and
chlorine injection location interact with each other. Hence, an integrated approach to the
sensor-actuator location and control problems is needed to produce an optimal solution of the
location problem.

Generally, the selection of the monitored nodes is based on the system observability. The
monitored nodes should be the “best” ones among the network nodes that can represent the
quality status of the DWDS and at the same time the measurement instrument costs and
maintenance costs are minimum. This topic was addressed in (Lee and Deininger, 1992;
Harmant, Nace, Kiene and et al., 1999; Propato, Uber and Polycarpou, 2002; Tryby, Bocceli,
Uber and et al., 2002).

The selection of the injection nodes is generally based on the system controllability. Each
monitored node should be covered by at least one chlorine injection nodes (Propato, Uber and
Polycarpou, 2002). Otherwise the control objective cannot be achieved. The costs of
implementation should be taken into account as well. More often, a monitored node may be
weakly controllable. Typically, weakly controllable situations are characterized by long
transport delays between the input and the output nodes, which deplete the chlorine
concentration in the water as a result of the chlorine decay over time. In real drinking water
distribution systems, these configurations might be difficult to avoid because of the time-
varying network hydraulics: a single I/O pair could be highly controllable at one moment and
weakly controllable at the next time period. On the other hand a strongly controllable system

- 23 -
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

would be desired. This topic was addressed in (Subramaniam, Tryby and Uber, 2000; Nace,
Harmant and Villon, 2001; Propato, Uber and Polycarpou, 2002).

In this thesis, the selection of monitored nodes (chlorine sensors) and injection nodes
(chlorine booster station) is taken as a priori knowledge about the DWDS. It is assumed that
the inputs and outputs of the system are known in advance when the controller is to be
designed.

2.3.2 Features of the Lower Level Controller

Main features of the lower level chlorine residual concentration controller can be summarised
as:

• Significant impact of hydraulics on chlorine residual modelling and control


• Large time-varying time delays due to chlorine transportation by the time-varying
hydraulics
• There exist abrupt changes of chlorine concentrations in the DWDS mainly caused by
water mixing due to operating status changes, such as pump and valve start and stop,
• There exist uncertain factors that can change the chlorine concentrations, such as
demand prediction error, hydraulic modelling error, chlorine modelling error, actuator
errors of the operating facilities

In summary, the control problem can be stated as robust control of an uncertain time-varying
system with time-varying time-delayed inputs. The main objective is to guarantee an input
feasibility of fulfilling output constraints under the uncertainty. As the control problem
includes many constraints and the inputs are delayed the Model Predictive Control is
proposed to design the controller.

- 24 -
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

2.3.3 Decentralization: With and Without Communication Among the


Local Controllers

Quality and Quantity Information from


Upper Level

Upper Level
Chlorine Lower Level
Flow injection
schedules schedules
Time Interaction
Partitioning Prediction
To other local
controllers
Chlorine Chlorine
injection feedback
Chlorine
reference DWDS
bound or
trajectory Robust Model Predictive
Control

Local Quality Controller

Injection node Monitored node

Figure 2.2 Structure of the Decentralized Feedback Quality Controller

Decentralization of the quality feedback controller is wanted due to obvious practical reasons
(Findeisen, Bailey, Brdys and et al., 1980). It is a common situation that a particular booster
station can influence several consumption points. The input-output dynamics shows possibly
strong interactions. One control input may influence a number of controlled outputs if the
paths exist from these inputs to various outputs. Vast majority of the control literature on
decentralized regulatory control considers situations where the interactions are weak. This is
not so however, in our case. In order to achieve complete decomposition of the controller into
a number of independent controllers that utilise only local information it is proposed to use
the injection quality schedules produced at the upper level as the real interaction estimates.
Then the error may be considered small enough to classify the interactions as weak. The error
can be tolerated due to robustness of the local controller. The overall structure of the local in

- 25 -
CHAPTER 2. HIERARCHICAL INTEGRATED QUANTITY AND QUALITY CONTROL STRUCTURE

space quality feedback controller with a predictive control mechanism is illustrated in


Figure 2.2.

Due to time limitation we shall only consider a simplified decentralization task where the
communications between the decentralized controllers are assumed available. Through
communications control inputs from outer-loop MPC controllers generated one time-step
before can be obtained. Based on these one-step-earlier inputs, an outer-loop interaction can
be produced with prediction errors. Again, it is assumed that such prediction error is unknown
but bounded. Under these assumptions, a decentralized RMPC can be obtained, which fits
well into the centralized RMPC mechanism developed. The local controller robustness is
needed to reject the prediction error and its design is to be presented in the Chapter 8 of this
thesis.

2.3.4 Summary of the Lower Level Controller

Design of the lower level feedback chlorine residual controller will be presented in the
following chapters. Although the technology of model predictive control is quite mature at
present it is challenged by the uncertainties in the system (Mayne, 1999). Robustness of
meeting real output constraint is required.

Mathematical model of chlorine residual in DWDS has been investigated from late 1960s. But
model suitable for control design and operating is still under development. An input-output
model without considering the storage tank in the DWDS was presented in (Zierolf,
Polycarpou and Uber, 1998). Chlorine residual model of general DWDS for control purpose
does not exist at present. The uncertainties in the system should be modelled deliberately and
suitable uncertain model is needed for robust MPC design purposes. We shall derive suitable
models, which are either in input-output form or in state-space form, for control purpose in
the subsequent chapters.

- 26 -
Chapter 3

Mathematical Model of Chlorine Residuals


in Drinking Water Distribution Systems

In this chapter, the mathematical model of chlorine concentration in the DWDS is to be


established. There are three aspects governing chlorine residual concentration in the water
network: transportation, mixing and reaction. Usually chlorine is added in the water treatment
works and injected at some nodes in the distribution network. Only chlorine residual
concentration in the distribution network is considered in this thesis.

A model structure that is convenient for control purposes needs to be established. First, the
hydraulic characteristics of the components and physical laws in DWDS are described in
brief. Next is the chlorine residual model in the DWDS. The numerical methods of solving
chlorine concentration model and some existing solvers are introduced. Finally, suitable
models for control purposes are derived in forms of input-output and state-space models.

The model parameters in the input-output model and state-space model are associated with
time-delays that are transportation time of the injected chlorine from the injection nodes to the
monitored nodes. Hence, model structure depends on hydraulics. The structure of the model
or the active parameter set over a time horizon is determined by obtaining the time delay
range over that horizon. Starting from a monitored node a backward tracking algorithm is to

- 27 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

be performed recursively through time and geographical space across the water network. The
backward tracking ends until the injection nodes are reached. It is the so-called path analysis
algorithm. Through path analysis, finally, the model structures of input-output and state-space
model are obtained.

Section 3.3.2.3 and Section 3.3.3 have been presented in (Brdys and Chang, 2001 and 2002a).

3.1 Hydraulic Laws in Drinking Water Distribution


Systems

Water is the carrier of the chlorine in the distribution network. The characteristics of the
chlorine transportation and mixing are determined directly by the water flows, velocities and
detention times in the reservoirs. The hydraulics has significant effect on the chlorine
concentration modelling while the chlorine injection’s impact on the hydraulics can be
neglected without loss of accuracy. Systems approach to modelling and operational control of
water distribution systems has been presented in the book (Brdys and Ulanicki, 1994). The
hydraulic laws in DWDS described here are helpful in analysing the uncertainty sources in the
quality control. However, the description is very brief. The details can be found in the above
book and in e.g. (Coulbeck, 1988; Chen, 1997; Haestad Methods, 1997; Brdys, Arnold, Puta
and et al., 1999ab; Rossman, 2000).

The following assumptions are made in the following modelling, which are commonly
applied in operational control of DWDS.

1. The inertia effect of the water in the pipe is neglected.


2. Water is treated as incompressible fluid.
3. Constant temperature and air pressure within the DWDS.
4. Constant density and viscosity. Changes caused by injection of chlorine are neglected.
5. Instantaneous dynamics of the water network components are neglected, e.g. pump
and valve off / on, and water pressure propagation dynamics in long pipes.

- 28 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

The above assumptions will result in simplified instantaneous hydraulics. However, as the
quantity and quality control problems are investigated in a time-scale ranged from several
minutes to several hours, the inaccuracies caused by the above assumptions can be considered
sufficiently small, which can then be tolerated by appropriate controller design.

3.1.1 Pipes

The water in a pipe flows from the higher head node to the lower head node. The flow
direction may change due to the head change in the pipe nodes. For notation clarity the higher
head node of a pipe is called upstream node and the lower head node is called sink node. The
head-flow relation can be written as (Brdys and Ulanicki, 1994):

qij = φ ij (∆hij ) = φij (hi − h j ) (3.1)

where qij is the flow from node i to node j . i → j is defined as the positive direction of the

flow, qij ≤ 0 when the flow is from j to i , which is shown in Figure 3.1.

qij

hi hj

Figure 3.1 Model of a Pipe

The equation (3.1) can also be written as:

α −1
∆hij = hi − h j = g ij (qij ) = Rij qij qij (3.2)

where Rij is the pipe resistance, α is the flow exponent, which are related to the friction

losses. Many equations can approximate friction losses. Commonly applied methods include
(Haestad Methods, 1997):

- 29 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

• Manning’s equation
• Chezy’s (Kutter’s) equation
• Hazen-Williams equation
• Darcy-Weisbach (Colebrook-White) equation

Hazen-Williams equation is most frequently used in modelling drinking water distribution


systems because of its calculating simplicity and accuracy that can satisfy operational control
purposes. The equation was developed experimentally and it can only be used for water
within temperatures normally experienced in potable water systems:

v = kCR 0.63 S 0.54 (3.3)

where v is the mean velocity ( ft / s or m / s ) , k = 1.32 for U.S. standard (Imperial


Measurement System) units or k = 0.85 for S.I. units, C is the Hazen-Williams roughness
coefficient, R is the hydraulic radius ( ft or m ), and S is the friction slope.

Applying Hazen-Williams equation, equation (3.2) will now be written as:

0.852
∆hij = hi − h j = Rij qij qij (3.4)

Rij = (1.21216 × 1010 × Lij ) /(Cij1.852 × Dij4.87 )

where Lij , Dij and Cij denote the pipe length, diameter and Hazen-Williams roughness

coefficients, respectively. If the pipe length and diameter are in m and mm , respectively, and
the heads are in m , then flow yielding from (3.4) are in litre / sec .

C ’s value is determined by the material of the pipe mainly. It should be pointed out that the
roughness coefficient changes considerably depending on age, manufacturer, workmanship
and other factors. It can be measured using empirical method but can have significant error
due to time change. This parameter has to be calibrated regularly in order to establish an
accurate hydraulic model.

- 30 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

Hazen-Williams model is not accurate for very low or very high flow. However, its accuracy
can be improved by adjusting the roughness coefficient accordingly. This is another reason
that the C parameter should be calibrated using the measurement data in order to get better
modelling accuracy over a full flow range.

3.1.2 Valves

There are many kinds of valves in drinking water distribution system performing varieties of
functions (Chen, 1997):

• Check Valves: Control the flow in one direction only


• Flow Control Valves: Limit the flow rate at a specified value
• Pressure Reducing Valves: Reduce water pressure
• Pressure Sustaining Valves: Maintain the pressure to some value
• Pressure Breaker Valves: Create specified head loss across the valve
• Throttle Control Valves: Head loss characteristics change with time

As a modelling example, the flow control valve is illustrated in Figure 3.2 (Brdys and
Ulanicki, 1994). The flow control valves is a kind of variable valves that can be modelled as a
pipe with controlled conductivity, that is:

−0.46
qij = Vij Gij (hi − h j ) hi − h j (3.5)

where Vij denotes the controlled value and the valve is closed if Vij = 0 , and fully opened if

Vij = 1 .

qij

hi hj

Figure 3.2 Model of Flow Control Valve

- 31 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

3.1.3 Pumps

Pumps are important components in the DWDS that add energy into the DWDS by increasing
the hydraulic head of the water. It provides the water supply from the sources to the pipe
network and acts as pressure booster device to maintain the water head in the network. Driven
by electrical motors pump is the main energy consumption part in the DWDS and minimizing
electricity is one of the main objectives in operational control of DWDS. The following type
of pumps can be distinguished: fixed speed pumps (FSP), variable speed pumps (VSP) and
variable throttle pumps (VTP) (Brdys and Ulanicki, 1994; Chen, 1997).

3.1.3.1 Fixed Speed Pumps

The head-flow relationship for a fixed speed pump with the suction and delivery nodes i and
j , respectively, called pump hydraulic characteristic curve, is a non-linear function. That can
be written as:

∆h ji = g f (qij ) (3.6)

where ∆h ji = h j − hi and h j ≥ hi , hi and h j are the suction head and delivery head,

respectively. The superscript f in g f (qij ) stands for ‘fixed’.

The non-linear function g f (qij ) can be often approximated by a quadratic function

(Coulbeck, 1988; De Moyer and Horowitz, 1975):

g f (qij ) = Aij qij2 + Bij qij + h0,ij (3.7)

- 32 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

where Aij is the resistance coefficient and Aij < 0 , and Bij is a coefficient often taking the

value of Bij ≤ 0 in order to ensure a single stable operating flow point for a headloss, and

h0,ij is the shut-off head.

The pumps are installed in the pump station and they may run in series or in parallel. When a
number of pumps are running in series, the flows are the same but the total yielding heads are
the sum of the heads raised by each pump. When the pumps are connected in parallel, the
head is the same but the flows are added. For a group of U ij fixed speed pumps having the

same hydraulic curves in parallel with uij pumps switched on (Brdys and Ulanicki, 1994):

∆h ji = g f (qij , uij ) (3.8)

⎧ qij 2 qij
⎪ Aij ( ) + Bij ( ) + h0,ij , if u ij ≠ 0
g (qij ) = ⎨
f
u ij u ij
⎪0 if u ij = 0

where uij = 1...U ij is the number of pumps switching on.

3.1.3.2 Variable Speed Pumps

The pump speed s can be continuously controlled over a certain speed range. The headloss
function of a group of U ij variable speed pumps in parallel having the same hydraulic curves

can be written as:

∆h ji = g ijs (qij , uij , sij ) (3.9)

where sij is a speed factor defined as

operating speed
sij = (3.10)
nominal speed

- 33 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

Again (De Moyer and Horowitz, 1975; Coulbeck, 1988), the non-linear function gijs (⋅) can be

approximated by a quadratic function:

⎧ qij 2 qij
⎪ Aij ( ) + Bij ( ) sij + h0,ij sij , if uij ≠ 0 sij ≠ 0
2
and
gijs (qij , uij ,s ij ) =⎨ uij uij (3.11)

⎩ 0 otherwise

3.1.3.3 Variable Throttle Pumps

The characteristic function of a group of throttle pumps in parallel is written as:

∆h ji = g ijs (qij , uij ) − ∆h t (qij , Vij ) (3.12)

There are two parts in the right side of the equation. The first part stands for head gain from a
fixed speed pump. The head drop across the throttle is modelled by a variable control valve in
the second part.

3.1.3.4 Pump Station

In general, a pump station contains all of the pumps above in parallel. Figure 3.3 shows such a
generalised i th pump station configuration (Brdys and Ulanicki, 1994), where there are M is

variable speed pumps, M it variable throttle pumps and M i f fixed speed pumps, qi or q pi are

the overall pump flow, and hsi , hdi are the suction head and delivery head, respectively. As
the pumps are connected in parallel, the head is the same and the flows are added.

- 34 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

Figure 3.3 Generalized Pump Station Configuration (Brdys and Ulanicki, 1994)

3.1.4 Reservoirs and Tanks

Reservoirs and tanks are the dynamic components in the DWDS. Due to their energy storage
properties, they are different from pipes, valves, pumps and other components in the network.
The i th reservoir node is considered to which the total water load is qlr ,i = q s ,i − wd r ,i + qout ,i ,

where qs ,i denotes water delivery from treatment works, wd r ,i is the demand flow at reservoir

i and qout ,i is the disturbance flow such as evaporating. A reservoir model is shown in

Figure 3.4 (Chen, 1997).

qs , i qout ,i

qr , i wd r ,i
DWDS
Figure 3.4 Model of a Reservoir

- 35 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

The mass balance in the reservoir is described as:

dwi (t )
= ρ [qri (t ) + qlr ,i ] , for i = 1,..., nr (3.13)
dt

where ρ is the density of water, wi (t ) and qri (t ) denote the mass of water stored in the

reservoir and the total flow into the reservoir from the DWDS, respectively, at time instant t .
Substituting the water head and cross-sectional area of the reservoir into the above equation
yields:

dxi (t ) 1
= [qri (t ) + qlr ,i ] for i = 1,..., nr (3.14)
dt S i ( xi (t ))

hri (t ) = xi (t ) + Ei for i = 1,..., nr (3.15)

where xi (t ) is the ith reservoir level and Si ( xi (t )) denotes the reservoir cross-sectional area

at this level, hri (t ) is the reservoir head and Ei is the reservoir elevation. Finally, it can be
obtained that:

dhri (t ) 1
= [qri (t ) + qlr ,i ] for i = 1,..., nr (3.16)
dt Si (hri (t ))

It can be seen that the head and flow described by this equation is non-linear even if the cross-
sectional area does not depend on the head, as the flow returned to the reservoir, qri (t ) ,
depends on the reservoir head.

- 36 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

3.1.5 Physical Laws

3.1.5.1 Flow Continuity Law

For every junction node j , the following holds:

∑ qij = wd j (3.17)
i∈J j

where J j denotes set of nodes linked to node j , wd j is the demand of water that is allocated

to the j th junction node. For reservoir nodes, wd j = 0 if no water demand is allocated to the

j th node. If j is a reservoir node in a steady state, that is, when the reservoir level is
constant, then the above equation is also satisfied at this node. The flow continuity law states
that the sum of inflows and outflows is equal to zero for every non-reservoir node. It also
holds for the reservoir nodes that are in a steady state.

3.1.5.2 Energy Conservation Law

The law is usually expressed in terms of the head change (increases or drops) along a loop or
energy path. The following holds:

∑ hij = ∂Er (3.18)

where hij = hi − h j denotes the head change across an arc (pipe) in a path and ∂Er the head

difference between the start node and final node of a path.

If the start node and the final node are the same node then the paths constitutes a loop.
Clearly, for the loop:

- 37 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

∑ hij = 0 (3.19)

3.1.6 Hydraulic Model of Drinking Water Distribution Systems and


Simulation

The problem of static network simulation is to determine the instantaneous values of


unknown heads and flows in the network being given the value of demand loads and control
variables for valves and pumps. In particular, reservoir heads are assumed to be known. The
reservoir nodes inflow vector, however, does not have to be known. Several solvers can solve
the problem (Brdys and Ulanicki, 1994). From the viewpoint of operational control of DWDS
it can be stated that if the value of demand and controlled variables at one instant is given then
value of flows and heads in the network at that instant is determined.

For operational control purposes, we will consider the network not only at a particular instant
but also over a time horizon [t 0 , t 0 + Tc ] . The network dynamics is described by a non-linear

differential equation (3.16). The unknown vector of reservoir flows qr (t ) is determined by the
reservoir head hr (t ) , demand wd (t ) and control variables m(t ) at time instant t . There does

not exist analytical solution of qr (t ) but the value can be calculated by employing static
simulation.

qr (t ) = f r (hr (t ), m(t ), wd (t )) (3.20)

The control and demand trajectories over [t 0 , t 0 + Tc ] are assumed known. The dynamical
simulation is defined as the numerical solution of the following differential equation:

dhr (t )
= A(hr (t ))[ f r (hr (t ), t ) + qlr (t )] (3.21)
dt
qr (t ) = f r (hr (t ), t ) (3.22)

- 38 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

where (3.21) is the matrix formulation of equation (3.16) and A is a diagonal matrix in which
components are 1 over the cross-sectional area of each reservoir at certain water level. There
are many available technologies and numerical solvers for this problem, e.g. EPANET,
GINAS, PICOLLO, SIMNET and HYPRESS. However, software package that can handle
quality simulation together with quantity is limited. The well known is EPANET from U.S.
EPA, which is widely used in simulation study of water network.

3.2 Implicit Model of Chlorine Residuals in Drinking


Water Distribution Systems

Mathematical model of chlorine residual concentration in DWDS can be explored by starting


the analysis of the chlorine distribution in a pipe. Chlorine transportation is an advection
process that can be modelled by advection-diffusion equation. The chlorine reactions to
substance in water and wall materials are modelled by 1st order or 2nd order dynamics. The
chlorine concentration is mixed at the junction nodes and storage reservoirs/tanks. Finally,
model describing the chlorine concentrations in DWDS can be constructed. However, the
chlorine concentration at injection nodes and chlorine concentration at monitored nodes are
linked via transportations, mixing at the network nodes and decay models. The relationship
between the injection nodes and monitored nodes are implicit.

The basic principles in obtaining equations for chlorine residual concentration in DWDS are
mass conservation and reaction kinetics. There are three main aspects governing chlorine
concentration in the DWDS: transportation, mixing and decay caused by chlorine reactions.
As water is the carrier of the chlorine distribution, the hydraulics information such as flows
and velocities determine the transportation time and mixing ratio, which are important
variables in obtaining a mathematical model of the chlorine concentration.

- 39 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

3.2.1 Hydraulic Time Steps

The operational control of DWDS is usually repeated over certain period. Typically, the
control horizon used in practice is 24 hours. At the beginning of the operation horizon, as
described in Chapter 2, an integrated quantity and quality controller is run at the upper level
based on a prediction of the water demand wd (t ) in the next 24 hours. The control variables:
pump operating schedules, valve control schedules and chlorine adding schedules, are
optimized at the upper level. Hydraulic information such as flows, flow velocity and water
head can be calculated by solving model (3.21) provided that the prediction demand wd (t )

and operational controls m(t ) are given. The hydraulics problem stated in (3.21) is only
solved at certain discrete time instant when the head of nodes and reservoirs are updated by
solving (3.22). Such steps are defined as the hydraulic time steps. The calculation of the
mathematical model of chlorine concentration is based on the hydraulic information obtained
in this way. It can be seen that error of hydraulic solver exists and its effects on chlorine
concentration model should be considered.

3.2.2 Advective Transportation in Pipes

A dissolved substance will travel down the length of a pipe with the same average velocity as
the carrier fluid while at the same time reacting at certain rate. In nature, transport occurs in
fluids through the combination of advection and diffusion. The mass transportation of a single
chemical is described by the advection-diffusion equation (ADE) (Fischer, List, Koh and et
al., 1979). The ADE is derived from the law of mass conservation and Fick’s Law of
diffusion, which states that the mass of a solute crossing a unit area per unit time in a given
direction is proportional to the gradient of solute concentration in that direction. The ADE is a
second order parabolic partial differential equation, that includes generic reaction and
source/sink terms as (Fischer, List, Koh and et al., 1979; Fernandes and Karney 2000):

∂c( x, t )
+ v∇c( x, t ) = D∇ 2c( x, t ) + r (c( x, t )) + S (c( x, t )) (3.23)
∂t

- 40 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

where c( x, t ) is the substance concentration at position x and time t , x is the spatial vector,

v is the velocity vector in 3-dimension space, ∇ , ∇


2
denote first derivative and second
derivative operator with respect to 3-dimension spatial vector x , D is the diffusion
coefficient matrix, r (⋅) is a function or a set of functions defining chemical and biological
reactions and S (⋅) is a function defining the sources of the substance or sinks within the
pipes. Notice, that both v and D could be time varying. In our case, within one hydraulic
step that is described in the previous section, the velocity is assumed constant.

Under most of the operation conditions, the advection effect is the main mechanisms of the
chlorine transportation throughout the DWDS. The diffusion effects are neglected ( D = 0 ).
Finally, a one-dimensional advection equation with reaction part is obtained, which represents
the main transport mechanisms of chlorine in a pipe as depicted in Figure 3.5:

∂c( x, t ) ∂c( x, t )
+v = r (c( x, t )) (3.24)
∂t ∂x

where r (⋅) stands for the reaction kinetics, v is the flow velocity in the pipe and x is the
distance from the up-stream node. As pointed out before, v is constant during the hydraulic
time step.

Flow velocity v

c(0, t ) x c ( x, t ) c(l , t )

Figure 3.5 Distribution of Chlorine Residual Concentration in a Pipe

Longitudinal dispersion is usually not an important transport mechanism under most


operating conditions. It was pointed out in (Fernandes and Karney 2000) that under low
velocity flow conditions significance of longitudinal dispersion in the concentration evolution
throughout the system should be considered. Ozdemir and Ger (1999) investigated such
diffusions in 2-dimension along the longitudinal and radius direction. Therefore, neglecting

- 41 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

such diffusions in equation (3.24) is treated as modelling error in this thesis, especially during
low water consumption period when the flow velocity is low.

3.2.3 Reaction Kinetics: First Order Model

The chlorine reaction kinetics is still being investigated at present in order to understand the
chemical and biological processes more accurately. Usually the reactions are divided into two
stages: rapid reaction and slow reaction. The former decay occurs at the first a few minutes
when the chlorine is added into the water. The slow reaction occurs subsequently. In the
modelling of chlorine residuals in drinking water distribution systems it is assumed that the
rapid decay has been completed before the chlorine reaches the user taps. Rapid reactions are
usually considered in the water treatment plant only (Clark, 1998). Throughout the thesis
without prior announcement, only slow decay process is discussed and rapid decay is assumed
complete.

A first-order reaction kinetics is used at present in most models and DWDS simulation
packages, which is described by the following equation:

dc(t )
= − kc(t ) (3.25)
dt

where k > 0 is the decay constant. It is widely accepted that chlorine in distribution systems
will either decay due to reactions with compounds contained within the bulk water (bulk
decay) or due to reactions at the pipe wall materials (wall decay). This has led some
researchers to model wall decay and bulk decay separately. Two different models have
generally been used to model bulk and wall decay (Rossman, 2000).

- 42 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

3.2.3.1 Basic Bulk and Wall Decay Model

The simplest method of modelling bulk and wall decay is to define the overall decay constant
as the sum of a bulk and wall decay constant:

k = kb + k w (3.26)

where kb and k w are the bulk decay constant and wall decay constant, respectively. Usually,

kb is measured by sampling water from the water treatment plant, adding chlorine into the

water, and recording chlorine concentration in the water at different time instant. Then kb can
be calculated by processing the experimental data. Traditional parameter estimation method
like least square algorithm can be used to process the data. The wall reaction constant cannot
be obtained using empirical method. The wall reaction mainly depends on the pipe wall
materials that may vary with time. Regular calibration of the parameter is needed to catch up
with the changes of the pipe wall materials.

3.2.3.2 Improved Wall Decay Model Considering Wall Transport

The transportation kinetics in the wall reaction has not been considered in the basic model.
The rate of the reactions is also affected by the rate at which chlorine can be transported from
the bulk flow to the pipe wall. A film resistance model of mass transfer was presented by
Rossman, Clark and Grayman (1994) using a mass-transfer coefficient with respect to the
flow regime in the pipe. However, the reaction of the chlorine to the substance releasing from
the wall to the water bulk is not modelled.

∂c ∂c kf
+v = −kb c − (c − c w ) (3.27)
∂t ∂x rh

where k f is the mass transfer coefficient, rh is the hydraulic radius of pipe and cw is the

chlorine concentration at the pipe wall. The hydraulic radius is defined as the cross-sectional
- 43 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

area of a stream of water divided by the length of that part of its periphery in contact with its
containing conduit. In brief, it can be stated as the ratio of area to wetted perimeter. The
second term in the right side of the equation represents chlorine transport from the bulk flow
1
to the pipe wall and the subsequent reactions. stands for the area on the pipe wall where
rh
the reaction occurs, i.e., the area per unit of pipe volume.

The reaction occurring at the wall pipe is also assumed as a first order decay with respect to
the wall concentration cw . The reaction rate is the same as the transportation rate in the
balanced state (steady state), i.e., transported mass is equal to disappeared mass caused by
wall reaction:

k f ( c − c w ) = k w cw (3.28)

where k w is the wall decay constant. Substituting (3.28) into (3.27), cw can be cancelled,
giving:

∂c( x, t ) ∂c( x, t ) k f kw
+v = − kb c ( x , t ) − c ( x, t ) (3.29)
∂t ∂x rh (k f + k w )

Standard expressions can be used for mass transfer coefficient k f (Rossman, Clark and

Grayman, 1994):

D
k f = Sh (3.30)
d
Sh = 0.023R 0.83 Sc 0.333 ; for R > 2300
0.0668(d / L)( RSc)
Sh = 3.65 + ; for R ≤ 2300
1 + 0.04[(d / L)( RSc)]2 / 3
vd
R=
v0

v0
Sc =
D

- 44 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

where Sh is Sherwood number, R is Reynolds number, Sc is Schmidt number, D is the


molecular diffusivity of chlorine in water, v0 is the kinetic viscosity of water, d is the pipe

diameter and L is the pipe length. D and v0 usually take default value as:

D = 1.2 × 10−9 m 2 / s (3.31)


v0 = 1.0 × 10−6 m 2 / s

Equation (3.29) describes the chlorine concentration along a pipe. For any pipe in the drinking
water distribution systems the chlorine concentration can be expressed as:

∂cij ( x, t ) ∂cij ( x, t )
+v = − kcij ( x, t ) (3.32)
∂t ∂x
k f kw
k = ( kb + ) (3.33)
rh (k f + k w )

where cij ( x, t ) is the chlorine concentration across pipe ij at position x with respect to node

i at time t , and k is the overall decay constant. Model (3.32) is widely used in the present
simulators or solvers for chlorine concentration in DWDS. Again, flow velocity v in equation
(3.32) is constant as the model only describes the chlorine reaction during one hydraulic time
step.

3.2.3.3 Remarks on Chlorine Reaction Kinetics

Free chlorine residuals exist in water in forms of hypochlorous acid ( HOCl ) and
hypochlorite ions ( OCl − ), which are determined principally by pH ( Frederick, 1997). For

instance, within certain pH range ( pH ≥ 7.5 ), OCl − is the dominant form of free chlorine,
in a distribution system composed of concrete pipes (Woolschlager and Soucie, 2003).
Woolschaler and Soucie (2003) analysed the causes of disinfectant loss in such concrete pipe
structured DWDS. They found that concrete surface may react with water and reduce the
pH value, resulting shifts of more active HOCl from OCl − . They found that an average of

- 45 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

23 percent of free chlorine loss is attributed to pipe wall reaction. Hence, neglect of such
complex and non-linear kinetics results in inaccurate reaction modelling. Such uncertainties
caused by simplification in reaction kinetic have to be handled in chlorine residual control
design.

3.2.4 Reaction Kinetics Existing Re-Chlorination: Second Order Model

Chlorine concentration is decaying after the water leaves the treatment plant. In order to
maintain the chlorine concentration chlorine is added in certain places of the DWDS. This re-
chlorination process has been analysed by Boccelli and Uber (2001).

It is known that the decay of the chlorine residuals in water is a complex process that the
decay kinetics is varying with respect to the detention time of chlorine after being added into
the water. The kinetics usually includes a rapid decay period and a slow decay period. It is
difficult to describe the rapid and slow chlorine decay with consistent set of mechanisms.
Models have been developed by using adaptive model parameters or by using multiple
models with respect to different period. For example, the Water Treatment Plant Model
(Clark and Boutin, 2001; USEPA, 1992) used three models in sequence to describe chlorine
decay: (1) zero-order from time t = 0 to t = 5 min , (2) second-order model from t = 5 min to
t = 5hr , and (3) first-order model for t > 5hr . In modelling chlorine residuals in DWDS,
researches focus on the relatively slow chlorine decay in the distribution network, assuming
that the rapid decay reactions have been completed. The assumption is reasonable as the
injection of the chlorine into the DWDS is implemented by the chlorine booster station, in
which a local controller regulates the chlorine concentration obtained at the injection node
considering the rapid reactions.

However, a little research has been performed to test models of chlorine loss in natural water
under conditions where the chlorine injection dose changes. The chlorine dose changes can be
caused by re-chlorination. The chlorine dose is added at the first times in the water treatment
plant and then the water is pumped into the distribution networks. Re-chlorination occurs
when the chlorine booster stations are used in DWDS. In addition to the usage of booster

- 46 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

stations re-chlorination also occurs in distribution systems through the mixing of waters with
different chlorine residuals and different residence time. The mixing is common since water
mixed at the junction nodes may follow from different paths, resulting in different chlorine
concentration and different substance which chlorine will react to. The re-chlorination
phenomenon is not modelled in most of the current chlorine residual models and simulators.
The current models and simulators have been tested and compared by using data from re-
chlorination experiments in paper (Boccelli and Uber 2001).

Boccelli and Uber (2001) found that, the first order chlorine decay model (3.25) assumed that
the reactive substances in the water are always in excess. The assumption allows decay
constant k to depend only on the chlorine concentration. However, it is sometimes
inconsistent with the observation data. As re-chlorination times increases, the estimated value
of k decreases consistently, reflecting a limitation of the reactive material remaining in the
solution. Boccelli and Uber (2001) assumed that the reaction constant to be first-order with
respect to free chlorine concentration and reactive component concentration in the water, and
thus second-order overall:

dc A dcB
= − k Ac AcB , = − k B c AcB (3.34)
dt dt

where c A and cB are the chlorine concentration and reactive substance concentration,
respectively, k A and k B are the decay constant for the free chlorine and reactive substance,
respectively.

Extra variable and parameter are needed in applying the above model for chlorine transfer
through the pipe. The chlorine reaction described in equation (3.25) is substituted by the
above reaction equation, and new model variable cB and new model parameter k B are
introduced:

∂c A ( x, t ) ∂c ( x, t )
+v A = − k A c A ( x, t ) c B ( x, t ) (3.35)
∂t ∂x
∂c B ( x, t ) ∂c ( x, t )
+v B = − k A c A ( x, t ) c B ( x, t ) (3.36)
∂t ∂x

- 47 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

where c B is modelled in the same way as c A . On overall, the reaction dynamics of c A is


described now by a second-order partial differential equation. Simulation of such multi
species in DWDS has been considered by Shang, Propato and Uber (2002).

By comparing with the first-order model, it can be seen that the second-order model explicitly
considered the reactive species in the reaction kinetics. Based on the second-order model the
chlorine decay constant, at a particular chlorine concentration, will decrease as the reaction
continues, which is consistent with the observations. Hence, second-order model is better or
the same in the accuracy comparison with first-order model. The magnitude of discrepancy
depends on the operating conditions, namely, the quantity of the reactive substance in the
water. However, in order to run the second-order model the reactive component concentration
has to be tracked, and it means extra parameter has to be introduced into the model.

Which type of reaction model should be used in chlorine residual modelling is determined by
the operation condition of the network and residence time from the chlorine injection to the
user taps. In this thesis we assumed that the water network operating conditions allow that the
modelling discrepancy caused by applying first-order model is not that significant, which can
be explained by the modelling error and can be tackled in the robust controller design.

3.2.5 Mixing of Chlorine Residuals in Drinking Water Distribution


Systems

3.2.5.1 Mixing at Junction Nodes

At junctions receiving inflow from two or more pipes, the mixing of fluid is taken to be
complete and instantaneous. Thus, the concentration of a substance in water leaving the
junction is simply the flow-weighted sum of the concentration from the inflowing pipes. For
node i it can be written as (Brdys, Arnold, Puta and et al., 1999ab):

- 48 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

∑ cki ( Lki , t )qki (t ) − ∑ ci (t )qik (t )


k∈INi k∈OUTi
ci (t ) = (3.37)
∑ qki (t ) − ∑ qik (t )
k∈INi k∈OUTi

where INi is the node set of the pipes in which the flow is getting into node i , OUTi is the

node set of the pipes in which the flow is leaving node i , cki ( Lki , t ) represents chlorine

concentration in the sink side of the pipe, and cki (0, t ) is the chlorine concentration at the start

node of a outflow pipe and cki (0, t ) = ci (t ) .

3.2.5.2 Mixing in Storage Facilities

It is convenient to assume that the contents of storage facilities (tanks and reservoirs) are
completely mixed. If there is no mixing then the storage facilities can be treated as long pipes
with large detention time. This is a reasonable assumption for many tanks operating under
fill-and-draw conditions providing that sufficient momentum flux is imparted to the inflow
(Rossman, Uber and Grayman, 1995). Under completely mixed conditions the concentration
throughout the tank is a blend of the current contents and that of any entering water. At the
same time, the internal concentration could be changing due to reactions. The mixing and
reactions can be written as (Brdys, Arnold, Puta and et al., 1999ab):

∂ (Vs (t )cs (t ))
= ∑ qis cis ( Lis , t ) − ∑ q si cs (t ) + rs (cs (t )) (3.38)
∂t i∈IN s i∈OUTs

where Vs (t ) is the volume in storage at time t , cs (t ) is the concentration in the storage

facility, IN s is the node set of the pipes in which flow is getting into the tanks, OUTs is the

node set of the outflow pipes, and rs (⋅) is the function describing the chlorine reactions. The
reaction function was described in Section3.2.2.

- 49 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

3.2.6 Numerical Methods and Solvers

Dynamical models of water quality can be classified spatially as either Eulerian or Lagrangian
and temporally as time-driven or event-driven (Rossman and Boulos, 1996). Eulerian models
divide the pipe network into a series of equally sized volumes or segments and record changes
at the boundaries or within these volumes as water flows through them. Lagrangian models
record and track changes in a series of discrete parcels or mass of chlorine as they travel
through the pipe network. Time-driven simulation updates the state of the network at fixed
time intervals. Event-driven simulation updates the state of the system only at times when a
change actually occurs, such as when a new parcel of water reaches the end of a pipe and
mixes with water from other connecting pipes. Comparisons of the algorithm performance
can be found in (Rossman and Boulos, 1996).

3.2.6.1 Eulerian Method: Finite-Difference Method and Discrete Volume Method

The finite-difference method (FDM) discretizes (3.32) by approximating the partial derivative
∂c( x, t )
at equally spaced points along a pipe’s length direction, and then solves the resulting
∂x
∆c( x, t )
algebraic equations for in discrete time.
∆t

The discrete volume method (DVM) is another Eulerian method. Unlike FDM approximating
the partial derivatives in (3.32), DVM uses the exact solution of (3.32) to appropriately
transport and react each volume element. The analytical solution of (3.32) can be obtained as
in (Aris and Amundson, 1973; Zierolf, Polycarpou and Uber, 1998):

⎧⎪ c( x − vt ,0) exp(− kt ). for x − vt ≥ 0


c ( x, t ) = ⎨ x x (3.39)
⎪⎩c(0, t − v ) exp(−k v ). for x − vt < 0

- 50 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

Again, flow velocity v is constant during one hydraulic time step. At the beginning of each
simulation time step, DVM calculates the chlorine concentration in each water volume
element by multiplying factor exp(−kt ) and then move the volume element forward by vt
distance along the pipe, which is based on the solution in (3.39).

The size of the segments in FDM and volumes in DVM are determined at the beginning of
each hydraulic step. The simulation accuracy and computation efficiency can be implemented
by adjusting the size of the segment or volume.

3.2.6.2 Lagrangian Method: Time-Driven and Event-Driven Method

Lagrangian methods record and track the parcel or mass of chlorine entering into the DWDS.
The techniques can be further classified as time-driven method (TDM) and event-driven
method (EDM). The time-driven method updates the position and age of each slug of chlorine
at fixed intervals of time. The event-driven method only updates the position and age of the
chlorine at certain hydraulic event, such as end of the hydraulic step, reach a junction node
and flow velocity changes. When these events occur Lagrangian methods calculate the
chlorine concentrations by reacting each parcel or mass according to its age and reaction
constant k using formula (3.39).

- 51 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

3.3 Explicit Model of Chlorine Residuals in Drinking


Water Distribution Systems

The modelling and simulation techniques shown in the previous sections are accurate and
sufficient for water network design and tasks of DWDS simulation. However, all the nodes
and storage facilities in the water networks are involved in the model and result in a
distributed model. There is no explicit relationship between the chlorine injections and
chlorine concentrations in the interested nodes, which are the inputs and outputs of the system
from the control viewpoint. In controller design and operation an explicit relationship
between input and output is usually wanted. In this section, it is to be shown that the chlorine
transport path in the network and time delay associated with the path from the injection node
to the monitored node are calculated by using a back-tracing method, which is called path
analysis for chlorine transportation in the DWDS. During transportation chlorine reacts with
substance in the water and mixed with other flows at the junction nodes. This phenomenon is
described by the impact coefficients in the finally obtained input-output model (Zierolf,
Polycarpou and Uber, 1998). The transportation time-delay in input-output model is
continuous in time and time varying. The range of the continuous time-delay over the
modelling horizon is then discretized and approximated by a series of time delay numbers. A
discrete IO model is obtained in a moving average (MA) format.

The existence of storage facilities enlarges the detention time from the input node to the
output node and introduces dynamics in the model. Thus, more model parameters are added.
The final model with tanks in the DWDS is in an autoregressive moving average (ARMA)
format.

There are two types of tanks operated in most of the water networks: continuous tank and
switching tank. Switching tank is operated in a repeated filling and draining cycles. Direction
of water flow changes from filling to draining periodically, and vice versa. To reconstruct an
IO model of the system during the switching period (switching from filling to draining),
chlorine concentration in the tank has to be traced back till to the last draining cycle. This will
introduce a number of extra parameters into the model, which are corresponding to the time-
period covering the filling cycle just before the current draining cycle. It makes the model

- 52 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

very complicated for parameter estimation and control design if the filling cycle is very long.
Notice, that in the operation of DWDS measurement of the chlorine concentrations in the
tanks are practically possible. Taking the chlorine concentrations in the tanks as state
variables, alternatively, a state-space (SS) model can be derived based on the IO model.

In this section, IO model in (Zierolf, Polycarpou and Uber, 1998) has been extended to handle
chlorine residual modelling in DWDS with continuous tank and switching tank. SS model is
derived based on the obtained IO models. Model parameter structure of the models has been
identified.

3.3.1 Input-Output Model Formulation: Without Tanks in the Network

Based on the analytical solution of (3.32) in (3.39) the chlorine transportation time in a pipe
can be calculated by tracking the water flow from the sink node to the upstream node. As
stated before the flow velocity is piece-wise constant over the entire considered time horizon.
The calculation accuracy can be improved by using appropriate tracing time step.

Starting from the monitored node, backward trace is performed until reaching the upstream
node of the pipe. At the upstream node of the pipe the flow may mix with inflow from a
number of the upstream pipes. Each inflow in the upstream pipe constitutes one new path and
the backward tracking continues in the upstream pipe separately through different new paths.
New path is added at each junction node. This backward tracking algorithm is called path
analysis of chlorine transportation. Knowing all hydraulic information such as flows and
velocities, the path analysis starts at the monitored nodes, runs recursively, and ends when the
tracking reaches one chlorine injection node. Finally, the paths connecting the injection node
and monitored node are obtained and delay times in the paths can be calculated
simultaneously. The structure of paths from an injection node to a monitored node is depicted
in Figure 3.6. The path analysis algorithm for a general DWDS will be presented in
Section3.4.

- 53 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

Injection Monitored
Paths from injection Node
Node
node to monitored node

Figure 3.6 Path Set from an Injection Node to a Monitored Node

3.3.1.1 Modelling of Chlorine Concentration in a Pipe and Discretization of Time Delay

Using the result in (3.39) the chlorine concentration at the sink node of a pipe can be
described by the flowing equation in input-output relationship:

y (t ) = β (t )u (t − d (t )) (3.40)

where u (t ) is the chlorine concentration at upstream node of the pipe at time t , which is the
input of the model, y (t ) is the chlorine concentration at the sink node, which is the model
output, d (t ) is the detention time of chlorine transportation from the upstream node to the

sink node when the chlorine reaches sink node at time t , and β (t ) = e − kd ( t ) is the decay factor
where k is the reaction constant that defined in (3.32). The flow velocity in the pipe is piece-
wise constant but the detention time d (t ) is continuously time varying as the chlorine
transportation in the pipe may cover more than one hydraulic time step, resulting in an overall
time-varying flow velocity and time-delay.

d (t )
d

d
t
0 Th

Figure 3.7 Discretization of Continuous Time Delay

- 54 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

The continuous variations in time delay make the model complicated in control design
because exact function of d (t ) is unknown and d (t ) can only be calculated numerically using
path analysis algorithm. Such variations also make the model parameter estimation difficult
for the same reason. Time delay d (t ) over time horizon [0, Th ] is considered, where Th is the

modelling time horizon. The range of the delay variation over [0, Th ] can be obtained by

numerically calculating the delay time. Let d and d denote the maximum delay and
minimum delay, respectively, which has been shown in Figure 3.7.

The delay range can then be discretized into a series of delay numbers and the continuous
delay will be replaced approximately by these delay numbers (Makoudi and Radouane, 2000;
Polycarpou, Uber, Wang and et al., 2002).


I ij ={nmin , nmin + 1,... + nmax − 1, nmax } (3.41)

nmin = round (d / ∆TD )

nmax = round (d / ∆TD )

where ∆TD is the discretization time step, round (⋅) is the function that takes the integer that
is closest to a real number. Applying this approximation to equation (3.40) yields:

y (t ) = ∑ ai (t )u (t − i ) + ε (t ) for t ∈ [0, Th ] (3.42)


i∈I ij

where I ij is the delay number in pipe ij over time [0, Th ] , ai (t ) is the artificial parameters

associated with the delay numbers, ε (t ) is the model structure error caused by discretization.
Although time index t is the same as in the continuous model (3.40), it should be understood
that t denotes discrete time in equation (3.42), which is t = k∆TD , k = 0,1,2... with time going
forward.

Notice that in the discrete model there is no time-varying delay and there are only time-
varying parameters in (3.42). Usually time-varying parameters is easier to be tackled in

- 55 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

control design or parameter estimation than handling continuously varying time delay in
(3.40).

Model structure error ε (t ) can be controlled by using small discrete time step ∆TD . The
determination of ∆TD depends on the hydraulic dynamics but it not easy to obtain the range
of error ε (t ) corresponding to the value of the applied ∆TD . This will be further discussed in
Chapter 4 of parameter estimation using bounding method.

In the following sections of this chapter, for notation simplicity reason, ε (t ) is not presented
in deriving chlorine residual model, and it will be presented in the final obtained model
structure.

3.3.1.2 Mixing at Junction Node

From viewpoint of chlorine residual modelling, two pipes in the drinking water distribution
systems can be viewed as connecting in cascade or parallel depending on the flow directions
in the pipes. The model of pipes connected in cascade can be obtained by summing up the
detention time in each pipe and multiplying the decay factors in each pipe. When the pipes
are connected in parallel the flows reach the junction node will be mixed there. As before, the
mixing is assumed instantaneous. Thus,

y (t ) = ∑ ω ji (t ) β ji (t )u (t − d ji (t )) (3.43)
j∈INi

| q ji (t ) |
ω ji (t ) = (3.44)
∑ | qki (t ) |
k ∈IN i

where INi is the upstream node set of the pipes connected together, d ji (t ) and β ji (t ) are the

detention time and decay factor in pipe ji respectively, ω ji (t ) is the mixing ratio for pipe ji .

Both of these parameters are time varying overall.

- 56 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

3.3.1.3 Input-Output Model of Chlorine Residuals in Drinking Water Distribution


Systems without Tanks

How to derive IO model is illustrated by exploring the DWDS in Figure 3.8 as in (Zierolf,
Polycarpou and Uber, 1998):

F
D
B d
b f
A Output
a C c E e G
Input

Figure 3.8 Illustration of Chlorine Paths in a Simple Water Network

As shown in Figure 3.8 the source node of chlorine injection is node ‘A’ and monitored node
is ‘G’, let Psj denote the path set from source node ‘A’ to node j . y (t ) and u (t ) denote the

chlorine concentration at the monitored node and injection node, respectively, which are the
model output and input. Using the equations obtained in the previous two sections
recursively, the chlorine concentration at a node, c j (t ) , can be expressed by the following

equation:

c j (t ) = ∑ asjp (t )u (t − d sjp (t )) (3.45)


p∈Psj

| qup ( l ),dn ( l ) (t − d l (t − d down (l ) (t ))) | × exp[−k l d l (t − d down ( l ) (t )]


where asjp (t ) = ∏ (3.46)
l∈ p ∑ | qup (l ),dn (l ) (t − d l (t − d down ( l ) (t ))) |
k∈IN dn ( l )

d sjp (t ) = ∑ dl (t −d down (l ) (t )) (3.47)


l∈ p

d down ( l ) (t ) = ∑ d m (t − d down ( m ) (t )), for l ∈ p (3.48)


m∈down ( l )

where d sjp (t ) is the detention time from source node s to node j via path p , d l (t ) is the

detention time in pipe l , and the chlorine contribution from injection node s to node j at

- 57 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

time t through path p is defined as impact coefficient asjp (t ) . Defined by (3.46), asjp (t ) is a

function of chlorine reactions and mixing effects at nodes across path p . In the above
equations, l is the pipe in path p , up(l ) and dn(l ) denote the upstream node and downstream
node of pipe l respectively, down(l ) denotes downstream pipe set in path p (pipe l is
excluded), d down (l ) (t ) is the detention time in downstream of pipe l in path p that is

calculated recursively from the destination node by backtracking to the start node as described
in (3.48). Take the calculation of the impact coefficient and detention time in path “A-C-E-G”
at time t as an example:

d1 = d e (t ) (4.49)

d 2 = d c (t − d1 )

d3 = d a (t − d 2 − d1 )

d AGp (t ) = d1 + d 2 + d3

| q EG (t ) | exp(−k e d1 ) | qCE (t − d1 ) | exp(−k c d 2 )


a AGp (t ) = ×
| q EG (t ) | + | q FG (t ) | | qCE (t − d1 ) | + | q DE (t − d1 ) |
| qCE (t − d1 − d 2 ) | exp(−k a d 3 )
×
| q AC (t − d1 − d 2 ) | + | q BC (t − d1 − d 2 ) |

where detention time d1 , d 2 and d3 are recursively calculated and back-tracked from the

destination node G till reaching source node A .

Now, the input-output model for general water networks without storage facilities can be
obtained based on equation (3.45):

y (t ) = ∑ β p (t )u (t − d p (t )) (3.50)
p∈P ( t )

where P(t ) is the path set from injection node to monitored node, and the path set can be time
varying, d p (t ) is the detention time in path p and β p (t ) is the impact coefficient with

respect to path p . Similarly as in Section3.3.1.1, equation (3.50) can be discretized and a


discrete input-output model can be obtained:

- 58 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

y (t ) = ∑ ai (t )u (t − i ), for t ∈ [0, Th ] (3.51)


i∈I ( t )

where I (t ) is defined as U I p (t ) , I p (t ) is the discrete delay number with respect to path p


p∈P ( t )

on time horizon [0, Th ] . The time index t in I (t ) only hints that some subset of I p (t ) is
inactive or active due to path changes over certain time period. The set is piece-wise invariant
over certain time-slots according to the path set changes.

Until now, only single-input and single-output (SISO) situation is considered. Generally,
chlorine concentration model in DWDS should be multiple-input multiple-output (MIMO).
Interactions between the inputs and outputs are inevitable. It is assumed that interactions are
only through inputs. The assumption is reasonable because output interactions can be treated
as interactions through inputs. Under the assumption the system can be simplified as a
number of MISO systems and the MISO model structure can be identified by repeating the
procedure individually for each output. For example, the first output of the MIMO model
reads:

nM
y1 (t ) = ∑ ∑ a1,m ,i (t )u m (t − i ) , for t ∈ [0, Th ] (3.52)
m =1i∈I1, m ( t )

where there are n M inputs, other parameter definitions are similar as before and a1, m ,i is the

i th impact coefficient of the first output under the m th input.

3.3.2 Modelling of Chlorine Residuals in Water Network with Storage


Facilities

Treated-water storage tanks are commonly used in DWDS to satisfy demand fluctuations, to
provide storage for unexpected abrupt demand for emergencies like fire fighting and to
equalise operating pressures. However, the existence of the tanks in DWDS makes the model
of chlorine transportation more complicated because of the long residence times in these tanks
(Rossman, Uber and Grayman, 1995). There are two types of tanks in practical operation. For
- 59 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

the first type the water flow can get into the tank and run out of the tank simultaneously, and
we call it continuous tank. The second type can only be operated in a repeated sequential
filling and draining cycles and is called switching tank. In the modelling of chlorine residual
concentration dynamics in storage tank the following assumptions are made:

• Tank contents are completely mixed instantaneously


• The kinetics of chlorine reactions to substance in tank water is first-order with respect
to the chlorine concentration in tanks

Again, approximation errors of the above assumptions are attributed to the modelling errors.
A research has been performed to improve the modelling accuracy of chlorine concentration
in tank (Rossman, Uber and Grayman 1995). The reaction kinetics can be verified or
calibrated by laboratory study of the water samples taking from the tanks and recording the
chlorine decay over time.

3.3.2.1 Chlorine Residual Modelling in Storage Tanks

Under the above assumptions, following differential equations can be obtained by using water
mass conservation and chlorine mass conservation within the tank:

dV (t )
= q f (t ) − qd (t ) (3.53)
dt
dV (t )c(t )
= q f (t )u (t ) − qd (t )c(t ) − kV (t )c(t ) (3.54)
dt

where V (t ) is the water volume in the tank at time t , q f (t ) and qd (t ) are the water flow

filling into the tank and draining out of the tank, respectively, c(t ) is the chlorine
concentration in the tank, u (t ) is the chlorine concentration of the water flowing into the tank,
and k > 0 is the chlorine decay constant in the tank. Model described by equations (3.53) and
(3.54) is a general chlorine concentration model that can work for both continuous tank and
switching tank. For the switching tank the following condition is attached:

- 60 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

q f (t ) × qd (t ) = 0 (3.55)

such that the inflow and outflow do not appear simultaneously.

The differential equations in (3.53) and (3.54) can be approximated by backward difference
equation or forward difference equation:

df f (t ) − f (t − ∆T )
Backward difference: t= (3.56)
dt ∆T

df f (t + ∆T ) − f (t )
Forward difference: t= (3.57)
dt ∆T

where ∆T is the discrete time step. Substituting (3.56) or (3.57) into (3.53) and (3.54) yields:

By backward difference:
V (t ) ∆Tq f (t )
c(t ) = c(t − 1) + u (t ) (3.58)
(1 + ∆Tk )V (t ) + ∆Tq f (t ) (1 + ∆Tk )V (t ) + ∆Tq f (t )

By forward difference:
(1 − k∆T )V (t − 1) − ∆Tq f (t − 1) ∆Tq f (t − 1)
c(t ) = c(t − 1) + u (t − 1) (3.59)
V (t − 1) V (t − 1)

Time index t is not changed after discretization for notation simplicity. It is understood that t
in the above equations represents integer numbers. In practice backward approximation is
usually applied, giving:

y (t ) = α (t ) y (t − 1) + β (t )u (t ) (3.60)
V (t )
where α (t ) = (3.61)
(1 + ∆Tk )V (t ) + ∆Tq f (t )

∆Tq f (t )
β (t ) = (3.62)
(1 + ∆Tk )V (t ) + ∆Tq f (t )

- 61 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

The water volume V (t ) in the tank is usually far larger than the inflow volume ∆Tq f (t )

during the discrete time interval, that is V (t ) >> ∆Tq f (t ) . The typical decay constant in tank

is 0.5 / day or 2.08333 × 10 −2 / hour , 3.47222 × 10 −4 / min . The typically applied discrete time
step ∆T is from 5 minutes to tens of minutes and is usually less than an hour. Hence, it can be
1
obtained that α (t ) ≈ and this is similar to the result in (Polycarpou, Uber, Wang and
1 + ∆Tk
et al., 2002) where a reaction rate coefficient λ is defined as λ = e − k∆T . Both of them are
1
solutions of the first order reaction equation (3.25), while α (t ) ≈ is the discrete
1 + ∆Tk
alternative of the analytical solution c(t ) = e − k∆T c(t − 1) by backward difference
approximation:

1
c(t ) = c(t − 1) (3.63)
1 + ∆Tk

whereas β (t ) is very small and this implies that the control action is very weak from the
input to the tank. The controllability will be very weak if the water demand at a monitored
node is provided mainly by the tank. Therefore, hydraulic dynamics should be taken into
account when selecting the positions of the injection nodes. This will be further addressed in
the following sections in developing a state-space model.

3.3.2.2 Chlorine Residual Modelling in Water Network with Tanks: Continuous Tank

The modelling of the chlorine residuals in DWDS depends on the location of the tanks in
DWDS and topological relations of the tanks to the monitored nodes. If there are multiple
tanks in the network the tank effects on the monitored nodes can be modelled as multiple sub-
systems of tanks combined in cascade or in parallel. In general, each tank located at the
chlorine transportation path from the injection node to the monitored node will introduce one
more dynamic into the system. The order of the system depends on the number of the tanks
involved in. In order to illustrate the derivation of the model, a simple conceptual water
network is used as in (Polycarpou, Uber, Wang and et al., 2002), which is shown in

- 62 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

Figure 3.9, where P1 is the path from the injection node to the monitored node, P 2 is the
path from the injection node to the tank, and P3 is the path from the tank to the monitored
node. For continuous tank the flow P 2 and P3 are continuous, but for switching type tank
P2 and P3 cannot exist simultaneously.

P2 cin (t ) P3
cT (t )

u (t ) y (t )
P1

Figure 3.9 Simple DWDS with One Tank

Firstly, the continuous tank is considered as in (Polycarpou, Uber, Wang and et al., 2002). Let
cin (t ) denote the chlorine concentration in the water flow getting into the tank, and cT (t )
denote the chlorine concentration in the tank, which is the chlorine concentration in the
outflow of the tank as well. u (t ) and y (t ) are the chlorine concentration at the injection node
and the monitored node, respectively. The following equations can be obtained according to
the model developed in Section3.3.1.2, Section3.3.1.3 and Section3.3.2.1:

cin (t ) = ∑ a 2 i (t )u (t − i ) (3.64)
i∈I P 2

cT (t ) = α (t )cT (t − 1) + β (t )cin (t ) (3.65)

y (t ) = ω (t ) ∑ a1i (t )u (t − i ) + (1 − ω (t )) ∑ a 3i (t )cT (t − i )
i∈I P1 i∈I P 3

= ∑ a1i (t )u (t − i ) + ∑ a3i (t )cT (t − i ) (3.66)


i∈I P1 i∈I P 3

where I P1 , I P 2 and I P 3 are the delay number set in the corresponding path P1 , P 2 and P3 ,

respectively, α (t ) and β (t ) are defined in (3.61) and (3.62), a1i , a 2 i and a3i are impact

coefficients corresponding to path P1 , P 2 and P3 , respectively, and ω (t ) is flow mixing


ratio defined in (3.44). Substituting (3.64) into (3.65) and using the resulting (3.65) at
different time instant give:

- 63 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

cT (t ) = α (t )cT (t − 1) + ∑ β (t )a 2 i (t )u (t − i ) (3.67)
i∈I P 2

cT (t − 1) = α (t − 1)cT (t − 2) + ∑ β (t − 1)a 2 i (t − 1)u (t − 1 − i )


i∈I P 2

......
cT (t − d max
3
+ 1) = α (t − d max
3
+ 1)cT (t − d max
3
) + ∑ β (t − d max
3
+ 1)a 2 i (t − d max
3
+ 1)u (t − d max
3
+ 1 − i)
i∈I P 2

3
where d max denotes the maximum delay number in path P3 , which is the maximum number

in I P 3 . Next, we shall express cT (t − k ) , 0 ≤ k ≤ d max


3
, in terms of cT (t − d max
3
) by using the
above equations recursively, yielding:

3
d max
cT (t − k ) = ∏ α (t − i + 1)cT (t − d max
3
) + ∑ β (t − k )a 2 i (t − k )u (t − k − i ) + (3.68)
i = k +1 i∈I P 2

α (t − k ) ∑ β (t − k − 1)a 2i (t − k − 1)u (t − k − 1 − i ) +... +


i∈I P 2

α (t − d max
3
+ 2) Lα (t − k ) ∑ β (t − d max
3
+ 1)a 2 i (t − d max
3
+ 1)u (t − d max
3
+ 1 − i)
i∈I P 2

By introducing new coefficients it can be rewritten into:

3
d max
cT (t − k ) = ∏ α (t − l + 1)cT (t − d max
3
)+ ∑ al′ (t )u (t − l ) (3.69)
l = k +1 3 −1
d max
l∈ U ( I P 2 + j )
j =k

where I P 2 + j defines a new number set in which each element is added by number j .

Substituting (3.69) into (3.66) to replace cT items in the equation yields:

3
d max
y (t ) = ∑ a1i (t )u (t − i ) + ∑ a3i (t )[ ∏ α (t − l + 1)cT (t − d max
3
)+ ∑ al′ (t )u (t − l )]
i∈I P1 i∈I P 3 l =i +1 3 −1
d max
l∈ U ( I P 2 + j )
j =i

= α ′′(t )cT (t − d max


3
) + ∑ ai′′ (t )u (t − i ) (3.70)
i∈I ′

3
d max
where α ′′(t ) = ∑ a3i (t )[ ∏ α (t − l + 1)]
i∈I P 3 l =i +1

- 64 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

⎧ 3 −1
d max ⎫

I = ⎨ U [ U ( I P 2 + j )]⎬ U I P1 (3.71)
⎩i∈I P 3 j =i ⎭

Now, we shall cancel cT (t − d max


3
) in equation (3.70). Using (3.70) gives:

y (t − 1) = α ′′(t − 1)cT (t − 1 − d max


3
) + ∑ ai′′(t − 1)u (t − 1 − i ) (3.72)
i∈I ′

From its definition it can be seen that α ′′(t ) ≠ 0 , giving:

y (t − 1) − ∑ ai′′(t − 1)u (t − 1 − i )
i∈I ′
cT (t − 1 − d 3
)= (3.73)
max
α ′′(t − 1)

Using (3.67) yields:

cT (t − d max
3
) = α (t − d max
3
)cT (t − d max
3
− 1) + ∑ β (t − d max
3
)a 2i (t − d max
3
)u (t − d max
3
− i) (3.74)
i∈I P 2

substituting the obtained cT (t − 1 − d max


3
) into the above equation yields:

α (t − d max
3
)[ y (t − 1) − ∑ ai′′(t − 1)u (t − 1 − i )]
i∈I ′
cT (t − d max
3
)= +
α ′′(t − 1)

∑ β (t − d max )a 2 i (t − d max )u (t − d max − i )


3 3 3
(3.75)
i∈I P 2

Finally, substituting (3.75) into (3.70) it can be derived that:

y (t ) = b(t ) y (t − 1) + ∑ ai (t )u (t − i ) (3.76)
i∈I

α ′′(t )α (t − d max
3
)
where b(t ) =
α ′′(t − 1)
ai (t ) are new introduced coefficients

- 65 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

I = I ′ U ( I ′ + 1) U ( I P 2 + d max
3
) (3.77)

The input and output relationship was established in equation (3.76), which is in an ARMA
format. From the definition of the delay number set I given by (3.71) and (3.77), it can be
concluded that the general detention time in path P 2 − P3 was enlarged due to the existence
of the tank.

3.3.2.3 Chlorine Residual Modelling in Water Network with Tanks: Switching Tank

The main content of this section has been presented in (Brdys and Chang, 2002a).

If the tank is of a switching type, condition α ′′(t ) ≠ 0 does not hold at any time instant.
During the filling cycle, flow in P3 is zero and (1 − ω (t )) = 0 , hence α ′′(t ) = 0 (see (3.66) and
(3.70)). So (3.75) does not hold anymore. The backtracking in (3.69) must go further till
reaching the last draining cycle in order to apply the same principle to eliminate cT terms in
the model. The switching sequence of tank operation is illustrated in Figure 3.10, where two
draining cycles and one filling cycle are presented, where j is the last time step of previous
draining cycle. The tank operations in filling status from time instant j + 1 until to time
instant k . Then from time k + 1 the tank switches to draining status again. The chlorine
residual model with tank effects is to be established from time k + d min , where d min and
d max are the minimum and maximum transport delay from the tank to the monitored node,
respectively.

Last draining Filling Draining

j j +1 k k + 1 k + d min k + d max k + d max + 1 t

Figure 3.10 The Time Sequence of Draining and Filling Cycle Switching

- 66 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

Using the input-output model obtained in the previous section, the following equations can be
derived:

Last draining: y ( j ) = ∑ dri ( j )cT ( j − i ) + ∑ ai ( j )u ( j − i ) (3.78)


i∈D0 i∈I 0

cT (t ) = α d cT (t − 1) , t = L , j (3.79)

Filling: cT (t ) = α f (t )cT (t − 1) + ∑ fli (t )u (t − i ) , t = j + 1,L, k (3.80)


i∈F

Draining: cT (t ) = α d cT (t − 1) , t = k + 1, L (3.81)

⎧ ∑ ai0 (t )u (t − i ), t = k + 1, L , k + d min − 1 (3.82)



y (t ) = ⎨i∈I (3.83)
⎪⎩i∑ dri (t )cT (t − i ) + ∑ ai0 (t )u (t − i ), t = k + d min , L
∈D i∈I

where D0 and I 0 are the delay number set corresponding to paths from tank to the monitored
node and paths from the injection node to the monitored node, respectively, during the last
draining cycle. Similarly, F is defined for delays during filling cycle, D and I are defined
for the current draining cycles, and other parameters such as fli , dri , ai , α d and α f are

defined same as in previous sections. The following numbers are defined:

d min = min( D) (3.84)

d max = max( D)
0
d max = max( D0 )

First, we shall represent cT ( j ) by y ( j ) from (3.78-3.79), yielding:

0 −i ) ( −i )
cT ( j − i ) = α d cT ( j − d max ) = αd
( d max 0
cT ( j ) (3.85)

substitute into (3.78) the following can be obtained:

- 67 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

y ( j ) − ∑ ai ( j )u ( j − i )
i∈I 0
cT ( j ) = ( −i )
(3.86)
∑ dri ( j )α d
i∈D0

Substituting (5.86) into (3.80), cT (t ) during filling cycle is obtained:

cT (t ) = b′(t ) y ( j ) + ∑ fli′(t )u (t − i ) , t = j + 1,L , k (3.87)


i∈Id ( t )

Id (t ) = ( I 0 + t − j ) U ( I F + t ′ − j − 1) ,
t ′= j +1,...,t

where b′(t ) and fli′(t ) are new coefficients, and Id (t ) is the delay number set.

For model during the draining cycle, when time moves from t = k + d min + 1 to

t = k + d max ,... , there exist tank concentrations described by both (3.81) and (3.87),
substituting them into (3.83) gives:

y (t ) = b′′(t ) y ( j ) + ∑ fli′′(t )u (t − i ) + ∑ ai0 (t )u (t − i )


i∈I S ( t ) i∈I

for t = k + d min , L , k + d max (3.88)

y (t ) = ∑ ai0 (t )u (t − i ) + α d′ (t )T (t − d max ) , for t = k + d max + 1, L (3.89)


i∈I

where I S (t ) = U {Id (t − i ) + i + 1} is the delay number set during the switching course, and b′′ ,
i∈D

fli′′ and α d′ are new introduced parameters.

Now, using the same method as in the previous section, y ( j ) and T (t − d max ) are cancelled,

(3.88) and (3.89) can be written into (3.90) and (3.91) introducing new parameters b , fl ′′′
and ai , respectively:

y (t ) = b(t ) y (t − 1) + ∑ fli′′′ (t )u (t − i ) + ∑ a (t )u (t − i )
i
i∈( I S +1)U I S i∈( I +1)U I

for t = k + d min + 1, L , k + d max (3.90)

y (t ) = b(t ) y (t − 1) + ∑ a (t )u (t − i ) , for t = k + d max + 1, L


i (3.91)
i∈( I +1)U I

- 68 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

where equation (3.90) denotes the model around switching course of the tank operation status
and equation (3.91) described the model after switching. Comparing delay number set I s and
I defined by (3.77), it can be seen that the existence of the switching type tank make the
model structure complicated and more parameters are needed around the switching course.

3.3.3 State-Space Model of Chlorine Residuals in Water Network

The main content of the section has been presented in (Brdys and Chang, 2001).

The existence of the tanks in the water network makes the derivation of the chlorine residual
model more difficult. Extra parameters introduced make the parameter estimation more
complicated as well. The situation becomes even worse during the period of flow direction
changes when the tank is switching from a filling cycle to a draining cycle. More parameters
have to be introduced into the input-output model to improve the model accuracy, which will
make the model unsuitable for control application. Notice, that it is usually not difficult to
measure the chlorine concentrations in the tanks and these values will be used as state
variables in the model. Thus a state-space model of the chlorine concentration in the DWDS
can be obtained.

A water network with the monitored node connected to the tank directly is shown in
Figure 3.11, which will be used to illustrate the procedure of deriving the state-space model.

u (t )

P2 Paths from Injection


to Monitored Node

Tank
q2 (t ), c2 (t )
q1 (t ), c1 (t )
cT (t )
q1′ (t ), c1′ (t ) P1 y (t )

Figure 3.11 Example of Monitored Node Connected to a Tank Directly

- 69 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

Applying the input-output models developed in previous sections it can be obtained that:

cT (t ) = α d cT (t − 1) , t ∈ Sd (3.92)

cT (t ) = α (t )cT (t − 1) + β (t )c1′ (t ) , t ∈ S f (3.93)

where c1′ (t ) = ∑ fli0 (t ) y (t − i ) (3.94)


i∈F

q1 (t )c1 (t ) + q2 (t )c2 (t )
y (t ) = (3.95)
q1 (t ) + q2 (t )

where c1 (t ) = ∑ dri0 (t )cT (t − i ) t ∈ Sd (3.96)


i∈D

c2 (t ) = ∑ ai0 (t )u (t − i ) t∈Sf (3.97)


i∈I

where cT (t ) is the chlorine concentration in the tank,


q1′ (t ) and c1′ (t ) are flow and chlorine concentration into the tank when the flow
direction in P1 changes,
S d , S f denote the draining period and filling period of the tank operation,

respectively,
q1 (t ) and c1 (t ) are flow and chlorine concentration that reach the monitored node
from the injection node via a number of paths,
q2 (t ) and c2 (t ) are flow and chlorine concentration getting into the monitored node
from the tank,
α d , α (t ) , β (t ) , fli (t ) , dri (t ) and ai (t ) are defined similarly as in the previous
section,
D and F are delay number set corresponding to the draining paths and filling
paths.

Equations (3.92) and (3.93) describe the chlorine concentration in the tank during the draining
and filling periods, respectively.

cT (t ) are measured and kept in the final model formulation as the state-space variable. The
state value at the end of the filling cycle is the initial condition in the model describing the

- 70 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

draining cycle. A unified model describing the system during tank draining and filling periods
can now be formulated by applying the input-output equations (3.92)-(3.97) as:

⎧⎪cT (t ) = α (t )cT (t − 1) + ∑ fli (t ) y (t − i )


⎨ y (t ) = ∑ a (t )u (t − i )
i∈F
, t∈Sf (3.98)
⎪⎩ i∈I
i

⎧⎪cT (t ) = α (t )cT (t − 1)
⎨ y (t ) = ∑ a (t )u (t − i ) + ∑ dr (t )c (t − i ), t ∈ Sd (3.99)
⎪⎩ i∈I
i
i∈D
i T

where ai (t ) is the coefficients related to injection, dri (t ) is related to the chlorine from the

tank that is zero for the filling cycle, fli (t ) is the coefficient related to chlorine addition to the
tank that is zero over draining cycle.

The above state-space model assumes that the monitored node is connected directly to a
switching type tank. For arbitrary topology of tanks, monitored nodes and injections nodes in
DWDS the general state-space model can be written as:

⎧⎪cT (t ) = α (t )cT (t − 1) + ∑ fli (t )u (t − i )


⎨ y (t ) = ∑ a (t )u (t − i )
i∈F
, t∈Sf (3.100)
⎪⎩ i∈I
i

⎧⎪cT (t ) = α (t )cT (t − 1)
⎨ y (t ) = ∑ a (t )u (t − i ) + ∑ dr (t )c (t − i ), t ∈ Sd (3.101)
⎪⎩ i∈I
i
i∈D
i T

It is understood that, in the above equations, fli (t ) stand for input impact coefficients related

to u (t ) , which are different from the meaning of fli (t ) in (3.98).

It has been pointed out previously that additional delays have to be introduced into the input-
output model (3.90) in order to retrieve information of chlorine concentration in the tank
based on the outputs at the monitored node. The relevant output data can only be gathered
during the draining cycle and after a switching from filling to draining cycle has occurred one
needs to backtrack to the last draining cycle, which has been shown in the previous section.

- 71 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

Therefore, the total number of delays in the input-output model is greater than in the state
space one and this difference can get very large for certain network structures. Thus, the state-
space model can be viewed as a parsimonious parameterisation of a real system mapping.

Although SS model described by equations (3.100-3.101) is derived by analysing a switching


type tank, equations (3.100-3.101) can also be used to describe chlorine concentration in
DWDS with continuous tanks. In this case the equation is:

⎧⎪cT (t ) = α (t )cT (t − 1) + ∑ fli (t )u (t − i )


i∈F
⎨ y (t ) = ∑ a (t )u (t − i ) + ∑ dr (t )c (t − i ) (3.102)
⎪⎩ i∈I
i
i∈D
i T

3.4 Model Structure Determination

The previous section has developed models for elementary network structures. The approach
applied will be generalised to handle general network structures with multiple chlorine
injection inputs and monitored nodes. The parameters in the input-output model and state-
space model are associated with the time delays of chlorine transportation in the water flow
paths. Chlorine transportation time is time varying, hence, the parameter set is time varying as
well. Over certain time horizon only certain parameters are active and taking non-zero values.
The structure of the model or the active parameter set over a time horizon is determined by
obtaining the time delay range over that horizon. Before we start the modelling it is assumed
that the hydraulic information such as water flows, velocities and pipe lengths are available.
Starting from a monitored node a backward tracking algorithm is to be performed recursively
through time and geographical space across the water network, the backward tracking ends
until the injection nodes are reached. Then the paths between the injection and monitored
nodes and time-delays in these paths are obtained simultaneously. It is the so-called path
analysis algorithm.

- 72 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

For a system of multiple monitored nodes and multiple injection nodes, this process is
repeated at each monitored node. Through path analysis the following model structure
information can be obtained:

• Inputs or states that have effects on chlorine concentration at one monitored node
• Chlorine transportation path from the injection nodes or the tanks to the monitored
node
• Detention time in the path

Path analysis algorithm developed in (Zierolf, Polycarpou and Uber, 1998) is extended to
handle DWDS with tanks. Based on the algorithm, structures of IO and SS models have been
identified.

3.4.1 Path Analysis Algorithm

The path analysis algorithm is a set of algorithms that are based on the chlorine transportation
partial differential equation (3.32) and its solution (3.39) (Zierolf, Polycarpou and Uber, 1998;
Shang, Uber and Polycarpou, 2000 and 2002). Starting from the monitored node a recursive
backward tracking algorithm is performed within a single pipe with certain tracking step until
the upstream node is reached. At the junction node the flow is partitioned into sub-streams in
the upstream direction and the recursive tracking is repeated in each pipe independently and
then at the next upstream node the partition occurs again. The overall tracking ends when the
injection nodes are reached or the flow stops at the boundary nodes. Performing the algorithm
at every monitored node, the model structure information for a monitored node can be
obtained: the inputs, paths and detention time in path.

- 73 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

3.4.1.1 Detention Time Calculation in a Pipe

Hydraulic information of water flow and velocity in pipe lij are known a priori, which are

obtained from the upper level of the hierarchical structure and shown in Figure 3.12, where i
is the upstream node, j is the downstream node, Lij is the length of the pipe and vij (t ) is the

flow velocity. Notice, that within the hydraulic time step vij is constant as stated before.

Based on this assumption the analytical solution of PDE (3.32) is given in (3.39), which is the
fundamental of the path analysis algorithm. However, path analysis may cover a number of
hydraulic time steps in tracking water flow, time index t in vij (t ) is used to address this.

vij (t )
i j
Lij

Figure 3.12 Water Flow in a Pipe

We shall choose tracking time step first. Let ∆Th be the hydraulic step, ∆Tc be the quality

time step and ∆TD be the discretization step. Usually the relationship of these values is
∆Th ≥ ∆Tc ≥ or = ∆TD . Then the selection of tracking time step τ should follow the
following restrictions:

• τ ≤ ∆Tc (3.103)

• τv(t ) ≤ Lij , any t , Lij

In order to achieve reasonable accuracy and computational efficiency the tracking time step
can be chosen as ∆Tc / 5 ≤ τ ≤ ∆Tc / 2 .

Figure 3.13 illustrates the backward tracking procedure of the pipe in Figure 3.12. The
tracking starts at the downstream node j at time instant t , in τ time interval the flow can
travel τ × v(t ) counting the time from time instant t , let xij denote the tracking distance from

node j to the current tracking point.

- 74 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

τvij (t − 4τ ) τvij (t − 2τ ) τvij (t )


τvij (t − 3τ ) τvij (t − 1τ )
i j

xij

Figure 3.13 Backward Tracking Flow in a Pipe

For the situation described in Figure 3.13 the detention time in the pipe can be expressed as:

Lij − [τ | vij (t ) | +τ | vij (t − 1) | +τ | vij (t − 2) | +τ | vij (t − 3) |]


TDij = τ + τ + τ + τ + (3.104)
vij (t − 4)

where the tracking distance is the sum of the travelled distances in every tracking step. The
distance in each tracking step may be different due to flow velocity changes if the tracking
involves two hydraulic time step. Because of the definition of the positive direction of the
flow the velocity could be negative in the tracking direction. When the tracking exceeds one
hydraulic step (when the pipe is very long or the hydraulics changes during the tracking in the
water network), the water flow in a pipe may change direction, the sign of the velocity may
change. Figure 3.14 shows such an example.

τvij (t − 5τ ) τvij (t − 3τ )
τvij (t − 6τ ) τvij (t − 4τ ) τvij (t − 2τ )
τvij (t )
τvij (t − 1τ )
i j

xij
Figure 3.14 Tracking Water Back through a Pipe with Reverse Flow

The detention time in Figure 3.14 is calculated as:

- 75 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

Lij − τ [| vij (t ) | + | vij (t − 1) | − | vij (t − 2) | + | vij (t − 3) | + | vij (t − 4) | + | vij (t − 5) |]


TDij = 6τ + (3.105)
vij (t − 6)

Flow direction changes may make the path analysis complicated in a real looped water
network especially when the change affects a number of nodes. In summary, the backward
tracking water algorithm in a pipe can be expressed as (Zierolf, Polycarpou and Uber, 1998):

Algorithm 3.1 Finding upstream node and detention time in a pipe

(1) At time instant t , set TD = 0 , x = 0 ;


(2) If the flow direction is opposite to tracking direction x = x + τv(t − TD )
else x = x − τv(t − TD ) ;
(3) If x < L then TD = TD + τ and go to step (2);
L − x + τv(t − TD )
else TD = TD + , set the current node to i , end.
| v(t − TD ) |

The algorithm will be performed at different time instant over the modelling horizon at the
downstream node and the detention time in the pipe can be obtained over the time horizon.

3.4.1.2 At Junction Node

Water flow at a junction node could come from a number of pipes in the upstream, which
means there may exist multiple paths from the sources to the monitored node. The tracking is
partitioned at the junction node and the backward tracking is repeated in each upstream pipe
and the detention time now is extended to vector form in order to denote the multiple paths.

Algorithm 3.2 Partitioned Backward Tracker at Junction Node j

(1) Finding the upstream nodes of the junction node from the water flow direction at time
t , let them be denoted by i1...iu ;

- 76 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

If there is no upstream pipe then the backward tracking stops at the junction node and
the detention time is discarded and a null vector is generated;
(2) Extend the detention time TD to vector by adding elements corresponding to each
upstream pipe if there are more than one upstream pipes, set the initial value equal to
the value of the detention time tracking at the junction node:
[td i1 ...td iu ] j

(3) Run algorithm 3.1 at time t to track back again and update the detention time vector
by adding corresponding detention times in each upstream pipe.

Each element in the detention time vector stands for a potential path between the injection
node and the monitored node.

3.4.1.3 Backward Tracking in the DWDS without Tanks

The tracking may be performed in the loop water network, some criterions should be added to
the algorithm in order to avoid loop tracking and stop the tracking when the injection nodes
are reached. In order to denote the detention time between the tracking stopping nodes and
starting node (monitored node) a detention time vector is defined:
[tdi1 ... td im ] j ,t , where i1 ,...im are nodes that the tracking stops at, j denotes the starting

node (monitored node) and t denotes the time instant at which the tracking started. With this
notation, the detention time in the vector represents one node as well. If all nodes in the vector
are chlorine injection nodes (source nodes) then the backward tracking will stop and each
element in the detention time vector represents the detention time in one path. From the
updating history of the vector the paths can be extracted easily.

Algorithm 3.3 Path Analysis Algorithm in DWDS without Tanks

(1) At time t , at monitored node j , set the detention time vector TD = [] j ,t ;

(2) Select one non-source node ik from TD vector, at initial monitored node j is
selected;
If there is no non-source node then go to step (6).
- 77 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

(3) Perform Algorithm 3.2 at node ik at time instant (t − tdik ) , obtaining a detention time

vector TDik and upstream nodes (i1...iu )ik ;

(4) Update TD by substituting tdik by TDik , the index i1 Lim in TD are updated by

inserting (i1...iu )ik correspondingly;

(5) Update the path recorder according to the changes in TD , go to (2);


(6) End.

It can be seen that the backward tracking is performed recursively until all the reached nodes
in the detention time vector are source nodes or sink nodes. The input nodes to node j are the
source nodes remaining in the vector and detention time in the paths are obtained at the same
time. Running Algorithm 3.3 at each time instant over the modelling horizon with τ as time
interval, the time-varying detention time over modelling time horizon can be derived.

3.4.1.4 Backward Tracking in the DWDS with Tanks

In (Zierolf, Polycarpou and Uber, 1998; Shang, Uber and Polycarpou, 2000 and 2002) path
analysis algorithm was developed for DWDS without tank. Based on the results presented
there, the path analysis algorithm is extended for DWDS with tanks.

There are two types of tank in operation as described before: continuous tank and switching
tank. In order to determine the model structure of the continuous tank, delays in the filling
path and draining path are both needed. When a tank is reached during the tracking, the water
flow is partitioned into two parts. One part ends at the tank standing for the draining path of
from the tank to the monitored node. Another part will be traced back again until the filling
path is found (Shang, Uber and Polycarpou, 2002).

If the tank on the tracking path is switching type, the flow tracked into the tank will stay there
until the tracking reaches the filling cycle. Similar to continuous tank the detention time in the
draining path and filling path are needed in order to determine the model parameter structure.
The draining and filling switching time instants can be obtained from the hydraulic

- 78 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

information directly. With this information the model parameter structures can be determined
based on the analysis results in the previous chapter.

The revision to the algorithms when there exist tanks in DWDS can be summarised as
follows.

Revision to Step (3) in Algorithm 3.3: Path Analysis Algorithm in DWDS

(3a) Finding the upstream nodes of the tank:


(i) Continuous Tank: The upstream node can be found directly
(ii) Switching Tank: Tracking the time backward until the draining flow changes
to filling flow

(3b) (i) Keep the detention time between the tank and monitored node in the
detention time vector and mark it as source node
(ii) Add new element into the detention time vector and initialised it zero

With these revisions the path analysis can be performed between the tank to the monitored
node and between the tank to the injection nodes. The detention time in the paths can be
finally obtained.

3.4.2 Model Structure of State-Space Model

For a DWDS with nM monitored nodes, nI chlorine injection nodes and nT tanks, generally,
there could be nI chlorine transportation path sets from injection nodes to each tank, nI
chorine transportation path sets from injection nodes to each monitored node, and nT chlorine
transportation path sets from storage tanks to each monitored node. Together, there are
nM × nI + nM × nT + nT × nI delays to be identified. These delays can be calculated over the
considered modelling horizon by using the path analysis algorithms described in
Section3.3.1.3. Finally, the delays are discretized and the discrete delay number set F , I and

- 79 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

D , can be obtained correspondingly. Thus, the structure of the state-space model of chlorine
transportation is obtained.

nT tanks
.
.
.

. . nM Monitored
nI Injection . . Nodes
Nodes . .

Figure 3.15 Illustration of Chlorine Transportation Delays to be Identified in a DWDS

Finally, SS model of chlorine concentration in the DWDS with nT tanks, nI chlorine


injection nodes and nM monitored nodes is obtained as:

⎧ nT
⎪α1 (t )cT 1 (t − 1) + ∑ ∑ fl1, j ,i (t )u j (t − i ) + ε T1 (t ), t ∈ ST1 , f
cT 1 (t ) = ⎨ j =1 i∈F1, j ( t ) (3.106)
⎪⎩α1 (t )cT 1 (t − 1) + ε T1 (t ), t ∈ ST1 ,d

M
⎧ nI
α
⎪ n (t ) cTn T (t − 1) + ∑ ∑ flnT , j ,i (t )u j (t − i ) + ε Tn (t ), t ∈ STn ,f
cTn (t ) = ⎨ T j =1 i∈Fn , j ( t )
T
T T

⎪α n (t )cTn (t − 1) + ε Tn (t ), t ∈ STn ,d
T

⎩ T T T T

⎧ nI
⎪⎪ ∑ ∑ a1, j ,i (t )u j (t − i ) + ε y1 (t ), t ∈ S y1 , f
j =1 i∈I1, j ( t )
y1 (t ) = ⎨ n nT
⎪ ∑ ∑ a1, j ,i (t )u j (t − i ) + ∑ ∑ dr1, j ,i (t )cTp (t − i ) + ε y (t ),
I
t ∈ S y1 ,d
⎪⎩ j =1 i∈I1, j ( t ) p =1i∈D1, p ( t )
1

- 80 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

⎧ nI
⎪∑ ∑ an , j ,i (t )u j (t − i ) + ε yn (t ), t ∈ S yn , f
⎪ j =1 i∈I n M , j (t ) M M M
yn (t ) = ⎨ n n
⎪ ∑ ∑ an , j ,i (t )u j (t − i ) + ∑ ∑ drn , p ,i (t )cTp (t − i ) + ε y (t ),
M I T
t ∈ Sy
⎩⎪ j =1 i∈I n M , j (t )
nM ,d
M p =1i∈Dn , p ( t ) M nM
M

where t ∈ [t 0 , t o + TM ] , t 0 is the initial time and TM is the modelling horizon considered,

y1 (t )... y n (t ) are chlorine concentrations at nM monitored nodes,


M

u1 (t )...u n (t ) are chlorine concentrations at nI injection nodes,


I

cT 1 (t )...cTn (t ) are chlorine concentrations at nT tanks,


T

ST p , f and ST p ,d denote time-slots of filling cycle and draining cycle of the p th tank

respectively,
S yn , f and S yn ,d denote time-slots corresponding to the n th output y n (t ) associating

with tanks that are in filling cycle and draining cycle respectively,
α p (t ) denotes model parameters caused by chlorine decay in the p th tank,

Fp , j (t ) denotes delay number set that corresponds to cTp (t ) associating with the

j th input u j (t ) ,

fl p , j ,i (t ) are the model parameters that corresponds to the p th state cTp (t ) and the

j th input u j (t ) associating with delay number i ,

ε Tp (t ) denotes modelling error in p th state cTp (t ) ,

I n, j (t ) denotes delay number set that corresponds to y n (t ) associating with the

j th input u j (t ) ,

an , j ,i (t ) are the model parameters that corresponds to the n th output y n (t ) and the

j th input u j (t ) associating with delay number i ,

Dn , p (t ) denotes delay number set that corresponds to y n (t ) associating with the

p th states cTp (t ) ,

drn , p ,i (t ) are the model parameters that corresponds to the n th output y n (t ) and the

p th state cTp (t ) associating with delay number i ,

ε y n (t ) denotes modelling error in n th output yn (t ) .

- 81 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

3.4.3 Model Structure of Input-Output Model

Similarly, delays can be calculated in the same way as in obtaining state-space model. Again,
considering a DWDS with nI chlorine injection nodes and nM chlorine monitored nodes with
nT tanks, the IO type model of this nI inputs and nM outputs system can be derived:

⎧nI
⎪⎪ ∑ ∑ an , j ,i (t )u j (t − i ) + ε n (t ), t ∈ S n , f
j =1 i∈I n , j ( t )
y n (t ) = ⎨n n , n = 1...n M (3.107)
⎪ ∑ bn ,i (t ) y n (t − i ) + ∑ ∑ an , j ,i (t )u j (t − i ) + ε n (t ),
T I
t ∈ S n ,d
⎪⎩ i =1 j =1 i∈I n , j ( t )

where t ∈ [t 0 , t o + TM ] , t 0 is the initial time and TM is the modelling horizon considered,

y1 (t )...... y n (t ) are chlorine concentrations at nM monitored nodes,


M

u1 (t )......u n (t ) are chlorine concentrations at nI injection nodes,


I

S n , f and S n ,d denote time-slots of filling cycle and draining cycle respectively,

I n, j (t ) denotes delay number set that corresponds to y n (t ) associating with the

j th input u j (t ) ,

an , j ,i are the model parameters that corresponds to the n th output y n (t ) and the

j th input u j (t ) associating with delay number i ,

bn ,i , i = 1...nT are the parameters corresponding to the n th output that describe dynamics

caused by nT tanks,
ε n (t ) denotes modelling error in yn (t ) .

- 82 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

3.5 Summary

Input-output model and state-space model have been constructed that are suitable for
controller design and operation. It can be seen that the model parameter structure is associated
with the time delay numbers. Model structures of both IO and SS are obtained by performing
path analysis algorithm. Ranges of time delays in the chlorine transportation paths are
obtained by path analysis algorithm. Notice, that as the time delay discretization is performed
over certain time-slot, the obtained delay number sets I n , j , Db , p and Fp , j in (3.106) and

(3.107) are associated with such time-slot. In Chapter 4, we shall show that the overall
modelling horizon will be partitioned into a number of time-slots, and model parameter
estimation will be performed slot by slot. Looking at the overall modelling horizon, delay
number sets are different over different partition time-slots. Hence, we introduce time index
to denote these sets over the overall modelling horizon as I n , j (t ) , Dn , p (t ) or Fp , j (t ).

Simulation studies, which will be presented in Chapter 7, show that both IO and SS models
work well if the controllability of the system is guaranteed by proper arrangement of the
injection nodes and sensor nodes. However, large number of parameters are needed in order
to achieve an accurate input-output model when the model operates over a switching period of
tank operation. Difficulties in parameter estimation and control design and operation with
such IO model are obvious. State-space model is preferred under such situation when the
measurements of chlorine residual concentration in tank are available. State-space model is
more attractive in long-term chlorine concentration regulation by trade-off the chlorine
concentration in tanks between short-term targets and long-term targets. Without
contradicting control objectives in tanks there are more free operating margins for the state-
space model compared with the input-output model, especially when the controllability is
weak. In this situation, the tank is used as a chlorine buffer more actively than in the IO model
case.

The parameters in both models are time varying and heavily dependent on the hydraulics,
which should be addressed once more. It can be seen from the hydraulic model that the
hydraulic information accuracy is determined by many factors in the system, such as water
demand prediction, hydraulic time step, pump characteristic curve, physical coefficients of the

- 83 -
CHAPTER 3. MATHEMATICAL MODEL OF CHLORINE RESIDUALS IN DRINKING WATER DISTRIBUTION SYSTEMS

pipes and storage facilities. The hydraulics is a main source of uncertainties in chlorine
concentration model. Such uncertainties are attributed to the structure error shown in the
model equations. The values of the errors are unknown but bounded. Available hydraulic
solvers that can give the bounds do not exist at present. Time limitation does not allow the
author to perform the work. It is promising that such solver can be implemented based on the
researches presented in (Chen, 1997) by introducing hydraulic uncertainties in the problem
formulation. Researches related to robust estimation of hydraulics can also be found in (Brdys
and Chen, 1994, 1995, 1996 and 1997; Brdys 1999; Brdys and Lisiak, 1999; Brdys,
Duzinkiewicz, Grochowski and et al., 2001).

- 84 -
Chapter 4

Model Parameter Estimation

The input-output models and the state-space models that were developed in Chapter 3 are
suitable for control purposes. Their parameters can be estimated by using data generated by
the implicit model (plant simulator). Assuming that the network flows are known, the model
structure can be derived in either IO or SS forms. Although the quantity control inputs are
known when the quality controller is designed, the corresponding flows in the network are not
known at this time. However, they can be predicted by using network simulator with
predicted disturbance inputs, which is the water demand. The procedure of the chlorine
residual model structure design can be summarised as follows:

1. Implement a hydraulic model (quantity simulator) of the DWDS


2. IO or SS model structure is acquired through path analysis

In order to complete the model design, its parameters must be estimated. This requires
chlorine measurements over control horizon. However, they are not available either at the
moment that the parameter estimation is being performed. We can try to use the past
measurements and this will work if water demand over future control horizon does not differ
much from the demand pattern in the past and also the quantity controls in the past are similar
to the present ones that are to be applied. Such situation is very rare in practice. Again, it is
proposed to utilize the network simulator with predicted demand to produce future chlorine

- 85 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

residuals, and treat such chlorine residuals as pseudo measurements. The pseudo
measurements will be used to estimate the model parameters. The coefficients of the water
network, which are used by the simulator, are stationary. Therefore, they can be estimated and
calibrated based on the past measurement data. Thus, the following steps are performed to
complete the estimation of parameters in models for control purposes:

3. Implicit model of chlorine residuals in DWDS (quality simulator) is built up


4. Finally, model parameters are estimated

Step 1 and step 3 are to implement a numerical model of chlorine residuals. Coefficients of
the DWDS, e.g. pipe length, diameter, roughness, tank parameters, chlorine reaction constant
and water demand, are needed in implementing such model. These steps are called implicit
modelling in the thesis as they are implicit in representing input-output relationship that is
required by the control design and operation. The implicit modelling is well developed and an
exhaustive literature covering this topic exists. The model parameter estimation discussed in
this chapter concentrates on the last step of the above procedure. In order to make it clear for
the meaning of “estimation”, we use “estimation” particularly for estimation of parameters in
the IO and SS models. “Calibration” is used instead when we discuss the coefficient
calculation and updating in the implicit modelling.

A number of factors have been identified in obtaining the chlorine residual model in
Chapter 3, uncertainties caused by these factors should be appropriately embedded into the
input-output model and the state-space model. The uncertainties in the system are mainly due
to three reasons: inaccurate hydraulic information, simplification in chlorine kinetics
description and discretization of time-varying time delays of chlorine transportation. The
deterministic nature of the model structure error is obvious. Therefore, it is proposed to apply
bounding approach to model such deterministic structure error. Notice, that this structure error
is operating point dependent and could be very large under certain inputs. As the model will
be used in MPC operation, the entire input space is to be searched in solving the optimal
problem of MPC. Hence, the a priori knowledge on the structure error, which is needed in
applying bounding approach for parametric model estimation, must consist of the error
structure bounds corresponding to all possible operating conditions. Therefore, one bound
accommodating all the operating conditions is typically very large.

- 86 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Obviously, the parameters of chlorine residual model are time varying. Set-bounded approach
requires a priori knowledge of the time structure of the time-varying parameters, in order to
obtain acceptable boundary accuracy. The parameter time structure required by the existing
set-bounded technology is usually described by evolution of the parameters driven by a
bounded external signal. Unfortunately, the knowledge is not available in our application.
However, even if it was available, the tightness of the resulting parameter bounds could still
heavily depend on the a priori structure error bounds. A time structure in parameter variation
exists in our case. However, it cannot be represented in a form needed by set-bounded
techniques mentioned above. It comes from the fact that the parameters are slowly varying in
certain time intervals and abruptly switching to other values at the interval end points. In this
thesis our approach to utilize this structure will be proposed and the corresponding technique
will be derived.

Not being able to apply existing set-bounded techniques for time-varying parameter
estimation we may think of parameterisation of the models by constant parameters. That is,
we assume constant parameters plus a structure error part in (3.106) or (3.107). Large bounds
on the structure error in the IO model or the SS model are necessary as the physical
parameters are time varying and may abruptly change at certain time instants. This will
dramatically increase the structure error bounds due to possible abrupt parameter changes, and
consequently result in enormous bounds on the parameters. The resulting model will be too
conservative to be used for robust control. Such effect was verified by the author’s simulation
studies.

A model structure with time-varying parameters plus model structure error was then
attempted. In order to achieve sufficient accuracy under abrupt changes, small time step in
discretization was required. This resulted in large number of parameters, and the models were
over-parameterised. In order to improve the model structure, the hydraulic information can be
utilized and the control horizon can be partitioned into a number of time-slots according to the
hydraulic operation status of the DWDS, e.g. the tank operations and the pump operations.
Parameter estimation can then be performed time-slot by time-slot under decreased model
structure error bounds. Still, a large number of parameters may be needed over certain time-
slots. In order to maintain acceptable bounds on the model structure error, over-
parameterisation may happen again. Therefore, there is a limit of decreasing the model
structure error bound by increasing the number of parameters. It was verified in the case study

- 87 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

that such limit is active. It means that requirement for parameter bound diameter for the
robust control cannot be satisfied by just partitioning the control horizon and introducing new
parameters. Notice, that further reduction of the model structure error bound can only be
done, as the parameter number cannot be further reduced, by making the parameter operating
point dependent, and performing the model structure and parameter estimation jointly.

The above analysis leads to the introduction of point-parametric model in which the
parameters and modelling error depend on the operating point of the model. Through the
input the relationship between modelling error and parameter is established. Therefore, it is
possible to distribute the model uncertainty between the parameter part and modelling error
part in order to obtain a less conservative uncertainty presentation overall. Set-bounded
parameter estimation algorithms will be developed for the point-parametric models.

In order to assess whether the obtained model is sufficient for control, an uncertainty radius
will be defined through robust output prediction to evaluate the uncertainty scenarios of the
model. Using the uncertainty radius as the partitioning criterion will further partition the
previously partitioned time-slot, which has been obtained by utilizing the hydraulic
information. Finally, a parameter piece-wise constant bounded model will be obtained.
Through the uncertain radius, control design and model estimation are actively linked. Thus,
the model estimation and controller can be designed in an integrated way.

Simulation result is presented at the end of the chapter by applying the estimation algorithm
to a simple conceptual DWDS.

Section 4.1, Section 4.2, Section 4.5.1 and Section 4.7.2 of this chapter have been presented
in (Brdys and Chang, 2002a; Chang and Brdys, 2003).

- 88 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

4.1 Overall Procedure of Model Parameter Estimation

4.1.1 Multiple Time-scales in Parameter Estimation/Calibration

Two coefficients in equation (3.32) are needed to calculate the chlorine concentration in a
pipe: flow velocity v and decay constant k . They are both time varying. We shall look at the
variation characteristics of the decay constant first, k is a composite decay constant of bulk
reaction and wall reaction, which is described by equation (3.33). Bulk reaction rate kb is

mainly determined by the reactive substance dissolved in the bulk water, which are relatively
stable over certain time period, e.g. a couple of days or weeks. The value of k b depends on

the hydraulics and is time varying. Wall reaction rate k w depends on the water temperature,

material, roughness and age of the pipe. It can change slowly due to changes of the dependent
factors (Rossman, Clark and Grayman, 1994; Zierolf, Polycarpou and Uber, 1998). Variation
of flow velocity is quite different from the variation of k . Flow velocity v may change at a
time scale of minutes/hours because of the random water-consumption pattern and abrupt
changes due to DWDS operation status switches, for instance, pump on/off and valves on/off.
Factors that influence (3.32) are listed as follows:

kb depends on the temperature and water sources.

k f depends on the water flow velocity.

k w depends on the pipe’s material, roughness and age.

v is mainly determined by water demand and DWDS operation.

Hydraulics are the most active short-term variables in the DWDS, which may change in
hourly time scale. The water source may change due to the operation status in the water
treatment factory. Typically, the batch control horizon in the treatment factory is from days to
a couple of weeks. Pipe roughness only changes due to pipe wall aging and sediments along
the pipe wall. Significant changes occur only in a time-scale of months or even longer. As has
been shown, the variation rates of different plant parameters are in a time-scale from hour to
days, which is almost 10-100 times different. A single estimation technology cannot handle

- 89 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

such situation. Proper parameter estimation technology should be applied according to the
various rates, as illustrated in Figure 4.1. Because modelling of chlorine concentration is
related to fast and abruptly changes of the plant coefficients, predictions for water flow and
velocity are needed.

Calibrated more
Parameter
Constant Calibrated frequently /
Prediction
physical over certain adaptively
values time period updated online

Invariant Slowly Varying Fast


varying parameters varying
parameters
parameters parameters

Figure 4.1 Relationship of the Variation Rate of the Coefficients / Parameters and
Corresponding Estimation Technology

4.1.2 Structure of the Model Parameter Estimator

As stated in Chapter 2, operational control of DWDS is based on a water demand prediction


over typically 24-hour period. The operation schedules of pumps and valves are generated by
an upper level controller. The water demand pattern changes with season, temperature and
customs of culture and may change abruptly because of emergent events like fire fighting.
This implies some special properties of the chlorine residual model estimation problem:

Remark 4.1: Specialties in Model Parameter Estimation of Chlorine Residuals

• Model parameters obtained using historical data are not sufficiently accurate in
describing the present and future system dynamics. The main reason is that the water
demand is non-repeated every day. That results in non-repeated operational controls
and hydraulics.
• Measurements (historical data) are used for implicit model implementation.

- 90 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Hence, numerical simulators for hydraulic and quality information (implicit models) are
needed to predict the real plant outputs that will be used in model parameter estimation for
input-output or state-space models (explicit models). IO or SS models are explicit models that
are convenient for control design but require additional parameters. The model parameters can
be estimated by using the implicit model’s numerical results. The overall procedure is
illustrated in Figure 4.2.

DWDS Information Water Demand


D, L, g (⋅), P Prediction
Wd
Hydraulic C Calibrator
Information
From
Measurements
v f v f DWDS
h, v, f , c
Model Structure Implicit Model
DWDS
Determination (Simulator) kb , k w Coefficients
I c
Model Parameter Estimation
Structure
Error
Explicit Model
(Input-output /
State-space Model)

Figure 4.2 Procedure of Chlorine Model Parameter Estimation

It can be seen from the figure that the hydraulic models have to be developed in advance. As
described in Chapter 3, a number of solvers exist in this field. Knowing the operational
controls from the upper level controller, a quantity and quality simulator for the DWDS can
be constructed, where a number of coefficients are needed. Some of the coefficients can be
metered directly and they are invariant during DWDS operation. Some can be calculated from
other known values. Others can only be estimated either online or offline by using
measurement data and should be calibrated regularly. The coefficients and their evaluation
methods are summarised in Table 4.1. Only parameters that are most important in water
quality modelling are listed.

- 91 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Table 4.1 Coefficients in the Quantity and Quality Simulator

Parameter Category Parameter Description Value


Node Wd Water demand at the node Prediction

h Elevation of the node Meterage


Pipe L Length Meterage
d Diameter Meterage
C Roughness coefficient Calibration
Valve V Valve controlled value Quantity
(valve schedule) Optimizer
Storage Tank h Elevation of the tank Meterage
d Diameter of the tank Meterage
Pump g (⋅) Pump hydraulic Nominal
characteristic curve Value &
Calibration
P Pump schedule Quantity
Optimizer
Hydraulic v Flow velocity Hydraulic
Information Simulator
f Water flow Hydraulic
Simulator
h Water head in the nodes Hydraulic
and tanks Simulator
Chlorine Reaction kb Bulk reaction constant Calibration
Constant
kf Mass Transfer Rate Calculation

kw Wall reaction constant Calibration

Some of the coefficients in the table are time varying over the control and modelling horizon.
For instance, water demands are values that are governed by the random water consuming
patterns at the user taps. It is the fundamental factor that causes time-varying structure of the
DWDS.
- 92 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

4.2 Uncertainty in DWDS from Viewpoint of Chlorine


Residual Modelling for Control

The input-output model and state-space model are based on the chlorine transportation-decay
equation that is described by (3.32) and mixing equations at the junction node and at storage
tanks that are described by (3.37) and (3.38), respectively, where hydraulics are not exactly
known. The chlorine decay constant is not exactly known either, and time varying with
respect to the change of the water sources and pipe system. Equation (3.32) itself is an
approximation of the real kinetics of chlorine residual reaction in water. Finally, as the input-
output model and state-space model are discretized, discretization caused structure error is
inevitable. Both of these factors must be modelled properly in order to robustly implement the
control objective defined in Chapter 2.

4.2.1 Uncertainty in the Hydraulic Coefficients

Model structure is determined by the delay ranges, which are derived by path analysis over
certain time horizon as described in Chapter 3, where flow, water head, velocity and other
hydraulic variables are needed. Many DWDS coefficients can affect the hydraulic variables
and the uncertainties in these coefficients enter into the finally obtained model through such
hydraulics. In summary, hydraulic discrepancy results in model parameter structure error
through inaccurate delay ranges obtained in performing path analysis algorithm.

4.2.1.1 Meterage Errors

Considering the coefficients listed in Table 4.1, coefficients including elevation h of a node
or tank, pipe length L and pipe or tank diameter d can be metered directly. There are other
hydraulic variables like water heads at nodes and flows in the pipes where pressure sensors

- 93 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

are installed. These values are the feedback values in the quantity controller or initial /
boundary values in the numerical simulator. The measurement errors in these values can be
neglected, as they have no significant effects on the chlorine residual concentration modelling
compared with other uncertainties in the system.

4.2.1.2 Roughness Coefficient C

The value of C is mainly determined by material of the pipe, and it also changes considerably
with respect to age, manufacturer, workmanship and other factors. It can be measured by
using an empirical method but may change significantly over time. Usually, the roughness
coefficient can be calibrated by using online measurements of flows and heads in the pipe.
However, in practice it is almost impossible to measure heads and flows in all of the pipes.
Instead, the DWDS is divided into a number of zones depending on the pipe material, age and
operation conditions. For each zone a uniform roughness coefficient is used and calibrated by
using available measurement data (Zierolf, Polycarpou and Uber, 1998). The roughness
discrepancy in the pipes will cause inaccuracy in the flow and head relationship modelling.
Regular calibration is needed in order to reduce the error of head-flow relationship. The
inaccuracy effect on chlorine residual modelling caused by roughness uncertainty is indirect
through the flow f in mixing equation (3.37) and (3.38) and the flow velocity v in equation
(3.32).

As stated in Chapter 3, Hazen-Williams is the most common equation applied in water


industrial to describe the relation of flow and head. However, Hazen-Williams model is not
accurate for very low or very high flow. In practice, the accuracy can be improved by
adjusting the roughness coefficient C accordingly. It is another reason why regular
calibration is needed.

4.2.1.3 Pump Hydraulic Characteristic Curve g (⋅)

First, as mentioned in Section 3.1.3 pump hydraulic characteristic curve g (⋅) is a non-linear
function approximated by a quadratic function. The operating speed of the motor may be

- 94 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

different from the nominal speed of the motor, resulting in discrepancy in the hydraulic
characteristic curve.

Second, in the mathematical model of pump the start and the shut down of the pump are
assumed immediate. In reality, the motor can only be started up and shut down smoothly,
which can be modelled as a first-order system with some time constant.

In summary, inaccurate pump hydraulic characteristic results in discrepancy in the water


head, flow and flow velocity.

4.2.1.4 Valve Controlled Value V

Similar to pump operation, the inaccuracy in valve control is the discrepancy between the
operating value and the nominal value of the valve position. This also results in uncertainties
in the flow and flow velocity in the DWDS simulator.

4.2.2 Uncertainty Caused by Water Demand Prediction and Hydraulic


Solver

In order to describe the water-consumption pattern over the considered horizon, water demand
prediction is used in operational control of DWDS. Based on a nominal water demand
prediction the operational optimization problem is formulated and solved. The resulting pump
and valve schedules are to be used to operate the DWDS. These schedules are applied to the
numerical simulator of the DWDS as well to generate the hydraulic information needed for
chlorine residual modelling. The difference between the real water demand and the predicted
one results in inaccurate water flow, velocity and head solutions in the numerical simulator.
Uncertainties in the hydraulic information finally appear in the chlorine residual model
through the detention time and mixing ratio.

- 95 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

The numerical solver is used to give the hydraulic information such as flows, heads and
velocity that are needed for path analysis in order to obtain the structure of the chlorine
residual model. Many solvers are available as described in Chapter 3. The simulator error is
unknown. However, there is still no solver that can quantitatively handle the above
uncertainties and algorithm error.

4.2.3 Reaction Constants and Approximation in Chlorine Reaction Kinetics

As stated before, the bulk reaction constant kb is heavily dependent on the nature of the water
and water temperature, and can range from below 0.01/day to above 1.0/day (Rossman,
2000). For a water treatment factory the source water may be taken from different places,
rivers, wells or lakes. The reactive substance concentrations from different sources are quite
different. During the treatment process, the added chemicals or physical processes (such as
filtering) change the substance in the water depending on the operating conditions. The water
is mixed at the reservoir before getting into the DWDS. Therefore, the water status may
change significantly due to varying operational conditions of the treatment factory.
Fortunately, because of the capacity of the storage facilities in the water supply system, such
changes do not occur frequently. By frequent calibration (depending on operational conditions
of the water supply system) the bulk reaction constant can be obtained with sufficient
accuracy.

The uncertainties in wall reaction constant k w are more complicated. k w depends on


temperature and also relates to pipe age and material. It is well known that metal pipe
roughness tends to increase due to encrustation and tuburculation (scale and mineral
accumulation) of corrosion products on the pipe walls. There is some evidence that the same
processes that increase a pipe's roughness with age also tend to increase the reactivity of its
wall with some chemical species, particularly chlorine and other disinfectants (Rossman,
2000).

The chlorine reaction kinetics is assumed first-order. But analysis in Section 3.2.3 showed
that a second-order model is more accurate when there is re-chlorination and there is no

- 96 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

sufficient reactive substance. In the water quality control of DWDS re-chlorination is


common and detention time is quite large under some circumstances due to the geographical
structure of the network. In this case, the assumption of sufficient reactive substances is
doubtful. Hence, a simplified first-order reaction model will result in simulator error.

Finally, it has been discussed in Section 3.2.2 and Section 3.2.3 that diffusion effects and non-
linearity of chlorine reactions are neglected, and such errors could be very significant under
certain circumstances.

4.2.4 Summary

Inaccurate factors in hydraulics, chlorine reaction model and discretization must be embedded
into the final IO or SS model. The first two factors are not analysed quantitatively and it is
assumed in this thesis that these uncertainties can be approximated and represented by the
quality simulator error, which is unknown but bounded. However, without a quantitative
description for the hydraulic uncertainties, it is difficult to assess the model structure obtained
in Chapter 3. Moreover, the bounds on simulator error could be conservative without a
quantitative analysis of the effects caused by the reduction and neglected kinetics in chlorine
reaction model.

4.3 Estimation of Parameters in Models for Control:


Problem Formulation

The System is an abstraction of the physical plant keeping only the inputs and outputs (states)
and putting all the details into the so-called ‘model’. System identification is the process of
constructing a description of the dynamic system in a proper mathematical way based on the
input/output data and a priori knowledge of the system. The purpose of parameter estimation

- 97 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

is to find the set of parameter values such that the input/output data and the a priori
knowledge are consistent.

4.3.1 Problem Formulation

The parameters of the IO and SS models described by (3.106) and (3.107) need to be
estimated. Notice that the parameters in each equation appear only in that equation, not
appearing in the other equations of the model. Second, as the observations of outputs and
states are collected from the DWDS simulator, all observations of cTp (t ), p = 1,..., nT and

y n (t ), n = 1,..., nM over the modelling horizon are available. There exist only input interactions
in the system but no interactions between the outputs, and there are no interactions in the state
equations either. Hence, parameter estimations can be performed independently, equation by
equation.

Consider the SS model first. Equations in (3.106) can be written in a compact form, yielding:

T p (t ) = φT p (t )T θ T p (t ) + ε T p (t ), p = 1,..., nT (4.1)

y n (t ) = φ yn (t )T θ yn (t ) + ε yn (t ), n = 1,..., nM

where

⎪⎧[cTp (t − 1) u1 (t − i p ,1,l ) ... u1 (t − i p ,1,u ) ... u n I (t − i p ,n I ,l ) ... u n I (t − i p ,n I ,l )], t ∈ ST p , f


φT p T (t ) = ⎨
⎪⎩[cTp (t − 1)], t ∈ ST p ,d
⎧⎪[α p (t ) fl p ,1,l (t ) ... fl p ,1,u (t ) ... fl p ,n ,l (t ) ... fl p ,n ,u (t )]T , t ∈ S T p , f
θ T p (t ) = ⎨ I I

⎪⎩[α p (t )] , t ∈ S T p ,d
T

⎧⎪[u1 (t − in ,1,l )...u1 (t − in ,1,u ) ... u n I (t − in ,n I ,l )...u n I (t − in ,n I ,u )], t ∈ S yn , f


φ yn (t )T = ⎨
⎪⎩[u1 (t − in ,1,l )...u1 (t − in ,1,u ) ... u n I (t − in ,n I ,l )...u n I (t − in ,n I ,u )

cT 1 (t − jn ,1,l )...cT 1 (t − jn ,1,u ) ... cTn (t − jn ,n )...cTn (t − jn ,n )] , t ∈ Sy


T T ,l T T ,u n ,d

- 98 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

⎧⎪[a n ,1,l (t )...a n ,1,u (t ) ... a n ,n ,l (t )...a n ,n ,u (t )]T , t ∈ S yn , f


θ yn (t ) = ⎨ I I

⎪⎩ n ,1,l
[ a (t )...a n ,1,u (t ) ... a n , n I ,l (t )...a n , n I ,u (t ) drn ,1,l (t )...drn ,1,u (t ) ... drn ,n ,l (t )...drn ,n ,u (t )]T , t ∈ S yn ,d
T T

where {i p , j ,l ,..., i p , j ,u } = Fp , j (t ) for j = 1...n I , {in , j ,l ,..., in , j ,u } = I n , j for j = 1...n I , and

{ jn , p ,l ,..., jn , p ,u } = Dn , p (t ) for p = 1...nT .

Similarly, the n th output of an IO model described by (3.107) can be written in a compact


form:

y n (t ) = φ n (t )T θ n (t ) + ε n (t ), n = 1,..., nM (4.2)

where φ n (t)T and θ n (t ) are defined as:

⎧⎪φ n (t )T = [u1 (t − in ,1,l ) ... u1 (t − in ,1,u ) ... u n (t − in ,n ,l ) ... u n (t − in,n ,u )]



I I I I
, for t ∈ S n , f
θ
⎪⎩ n (t ) = [ a n ,1,l (t ) ... a n ,1,u (t ) ... a n ,n I ,l (t ) ... a n ,n I ,u (t ) ]T

and
⎧⎪φ n (t )T = [ y n (t − 1) ... y n (t − nT ) u1 (t − in,1,l ) ... u1 (t − in,1,u ) ... u n (t − in ,n ,l ) ... u n (t − in,n ,u )]

I I I I
θ
⎪⎩ n (t ) = [bn ,1 (t ) ... bn , nT (t ) a n ,1,l (t ) ... a n ,1,u (t ) ... a n ,n I ,l (t ) ... a n ,n I ,u (t ) ]T

for t ∈ S n,d , where {in , j ,l ,..., in , j ,u } = I n , j for j = 1...nI .

Note, that (4.1) and (4.2) are in the same MA or ARMA form, where chlorine concentration
cT in the output equations of the SS model are measured and known. Hence, parameter
estimation problem is finally formulated for a MISO time-varying dynamical model with
delayed inputs under uncertainties, which is given in a general ARMA form:

y = φ (t )T θ (t ) + e(t ) (4.3)

where e(t ) is the model structure error, which is unknown. The regressor vector and
parameter vector are defined as:

- 99 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

φ (t )T = [ y (t − 1) ... y (t − n) u1 (t − i1,l ) ... u1 (t − i1,u ) ... u m (t − im,l ) ... u m (t − im ,u )]

θ (t ) = [b1 (t ) ... bn (t ) a1,i (t ) ... a1,i (t ) ... a1,i (t ) ... a1,i (t )T ] .


1,l 1,u 1,l 1,u

By using DWDS simulator, values of y (t − i ), i = 1,..., n and u1 (t − i1,l ),..., u1 (t − i1,l ) that build

up the regressor can be obtained.

4.3.2 Role of Simulator in Parameter Estimation

Let us further analyse the components of e(t ) in (4.3). As pointed out earlier, model structure
error e(t ) is mainly attributed to hydraulic information inaccuracy, chlorine residual kinetics
neglect and time delay discretization. Let ε s (t ) denote the structure error caused by the first

two reasons, and ε (t ) denote structure error caused by discretization:

e(t ) = ε s (t ) + ε (t ) (4.4)

where ε s (t ) are caused by the uncertain factors that are described in Section 4.2, which
cannot be estimated at present and are to be handled in controller design as disturbance input
assuming the bounds on it being known. An algorithm for computing such bounds can be
developed based on Chen’s work (1997). Discretization error ε (t ) can be jointly estimated
with the model parameters. Hence, we shall consider the parameter estimation problem
described by the following equation:

y = φ (t )T θ (t ) + ε (t ) (4.5)

where the model parameters θ (t ) are time varying, and the model structure error ε (t ) is
unknown. As stated in the introduction part of this chapter, ε (t ) depends on system operating
point.

- 100 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

As stated before, data needed for model parameter estimation is collected from the implicit
model (quality simulator). The values of the regressor φ (t ) in (4.5) are assigned by taking the
chlorine concentrations from the DWDS simulator. How the DWDS simulator is applied in
estimation is illustrated in Figure 4.3, where y s (t ) is the simulator output, error ε s (t )

represents the simulator error and y DWDS (t ) is the output that equals to real DWDS output. It

is clear that DWDS simulator is the “plant” considered in parameter estimation, and y s (t ) is

the plant output during estimation process. For clarity let y p (t ) represent the simulator output
while developing the parameter estimation algorithm.

Simulator Output
y s (t ) , which is
Inputs u (t ) Plant Output in DWDS Output
Estimation: y p (t ) y DWDS (t )
DWDS
Chlorine Simulator
Injection ⊕
Plant in ε s (t )
Estimation Simulator
Error

Figure 4.3 Illustration of Applying DWDS Simulator in Model Estimation

As measurement noises are not present in the observation data from DWDS simulator, it is
convenient to assign the values of the inputs and outputs (states) in regressor φ (t ) by using
data from the simulator directly. The complex problem formulation of parameter estimation
under noisy observations is not necessary in this case, as inputs and outputs in the regressor
are exactly known. This is an advantage in the following estimation algorithm development.

4.3.3 Summary

The property of IO or SS allows the parameter estimation problem to be formulated for as a


MISO model, which can be further generalised into ARMA form. Hence, we shall concentrate

- 101 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

on developing a parameter estimation algorithm based on the ARMA form given by (4.5)
under model structure error.

Remark 4.2:
• Components in θ or φ are associated with the delay numbers that are discretizations
of the continuous delay over certain time horizon. Hence, the structure of the
parameter vector θ and regressor φ are constant over certain time-slots but may vary
at different time-slots.
• Uncertainty in the model structure error ε (t ) is mainly due to discretization in
obtaining the model.
• Exact parameter values are not necessary. A robust model predictive controller (MPC)
will be designed based on a bounded parameter model.

From the requirement of robust MPC design, the modelling objective is to obtain the least
conservative (tightest) uncertainty model with uncertainty represented by bounding values for
the corresponding parameters. The algorithm of how to calculate the parameter bounds is
developed next.

4.4 Introduction to Bounding Approach for Estimation of


Parametric Model Parameters

Parametric model is the mapping from the input to the output space with proper parameters
associated with the model structures such as transfer function and ARMA model. With proper
values of these parameters the mapping can make model output equal to the plant output,
considering a time-invariant system modelled by ARMA expression:

y (t ) = φ (t )T θ + ε (t ) (4.6)

- 102 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

where y (t ) is the model output that equals to the plant output y p (t ) , θ is the model
parameter vector, ε (t ) is the modelling error part, which could be generated by linearization
error or model mismatch, etc. Parameter estimation is the process of obtaining the value of θ
based on a series of observations of y (t ) on time horizon [1...N ] , which is illustrated in
Figure 4.4.

ε m (t )

y p (t )
Plant + y m (t )
u (t )

Model y (t )

Figure 4.4 Illustration of Model Parameter Estimation

ε (t ) is usually assumed as a stochastic process, e.g. Guassian process. However, such


assumption is not realistic in some circumstances, where a structure error of the model
obviously exists and is deterministic. Furthermore, the statistical property of the stochastic
process (e.g. probability distribution function) is hard to obtain in practice. The difficulties in
classical stochastic estimation lead to the bounding approach in estimation, where only prior
knowledge that bounds ε (t ) is needed (Milanese, Norton, Piet-Lahanier and et al., 1996):

ε (t ) ≤ ε max (4.7)

where ⋅ could be L1 , L2 or L∞ norms. An observation of the output y (1) generates a pair of

hyperplanes when the error bounds are given by L1 norm:

y (1) − ε max ≤ φ (t )T θ ≤ y (1) + ε max (4.8)

which bound the parameter vector θ .

A set Γ(1) can be defined:

- 103 -
CHAPTER 4. MODEL PARAMETER ESTIMATION


Γ(1) ={θ | y (1) − ε max ≤ φ (t )T θ ≤ y (1) + ε max } (4.9)

in which the parameter vector θ is contained. Therefore, the observations


{ y (1), y (2),..., y ( N )} over modelling horizon N confines the parameter vector θ to a feasible
parameter set that can be defined as:

N
D( N ) = D(0) I ( I Γ(i )) (4.10)
i =1

where D(0) stands for any a priori information on the system. The feasible set is a polytope
with multiple vertices. These vertices could increase rapidly so that updating of such feasible
set will not be computationally easy with large number of observations. The difficulties in
obtaining the exact feasible parameter set lead to a number of techniques of computing its
approximations. Among these techniques Ellipsoidal Outer Bounding, Orthotopic Outer
Bounding and Inner Bounding are the most often used methods in obtaining the approximated
boundary of the feasible parameter set (Walter and Piet-Lahanier, 1990 and 1993; Vicino and
Zappa, 1996; Chisci, Garulli and Zappa, 1996; Maksarov and Norton, 1996). The bounds on
individual parameters rather than the overall set are needed in controller design. The
orthogonal projections of set D(N ) on the subspace of parameter can be calculated as (Brdys,
1999):

θ i min = min(θ i ) (4.11)

subject to θ ∈ D(N )
and
θ i max = max(θ i ) (4.12)

subject to θ ∈ D(N )

where θ i and θ i are the orthotopic type bounds on parameter θ i , which are intervals
min max

bounding the individual model parameters. Such intervals are the value range that the
parameter may exist, with these values, the observed values (plant output) and output data of
the model are matched. It provides a way to relate uncertainty in the model to uncertainty in

- 104 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

the plant itself and its inputs and outputs. It is opposed to stochastic method describing
uncertainty in the systems, no probability distribution function (PDF) is needed. It’s direct
and explicit for robust control design (Milanese, Norton, Piet-Lahanier and et al., 1996).

Similarly, state (output) estimation problem can also be formulated by using bounding
concept, where the estimated state is confined by the historical observations, a priori
knowledge of the plant and system model. Estimation of the outputs in the future yields the
output prediction where the knowledge about the system over the prediction horizon is
included.

Bounding approach’s advantages in estimation and control are obvious and some successful
applications have been reported (Milanese, Norton, Piet-Lahanier and et al., 1996). Parameter
estimation problem of time-varying plants is frequently found in engineering practice, where
there may exist abrupt changes in the parameters. Such problem has been considered in
(Norton and Mo, 1990; Maksarov and Norton, 1996; Watkins and Yurkovich, 1997; Mathelin
and Lozano, 1999; Deng, Zhang and Baras, 1999). To incorporate the information obtained at
the latest observation, Γ(k ) , into the previously obtained feasible parameter set D(k − 1) ,
D(k − 1) is expanded until at least its intersection with Γ(k ) gives non-empty set. The
expansion is based on the a priori knowledge on the parameter variations, and is usually
given as:

θ (k ) = θ (k − 1) + w(k ) (4.13)

where w(k )T Q(k ) wk ≤ 1 (4.14)

and the positive definite matrix Q(k ) defines the size and shape of ellipsoidal bounds on the
parameter variations. Abrupt changes in parameter or state estimation can be handled if the
information on these abrupt variations, Q(k ) , is sufficient.

The a priori knowledge on modelling error part or parameter variation part is usually derived
by mathematically analysing the physical system. Unfortunately, it is not straightforward to
acquire such result in analysing chlorine residual model (3.106) or (3.107). Furthermore,
obtaining a sufficient accurate but less conservative Q(k ) is also a big challenge.

- 105 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

The uncertainties are located in two parts of model (4.6): parameters θ and modelling error
part ε . Instead of trying to construct a model with unique parameter vector, multiple
parameter vectors are assumed that are associated with the inputs and modelling error part,
which leads to the introduction of point-parametric model.

4.5 Point-Parametric Model Parameter Estimation

With the observation data available, the parameter bounds of model (4.5) can be generated
using bounding approach as described in (Milanese, Norton, Piet-Lahanier and et al., 1996). A
priori information about the structure error ε (t ) is needed. However, it can be seen from the
model structure generation that it is not trivial to obtain this value. This implies that otherwise
a more conservative assumption on ε (t ) is to be applied or the priori knowledge about ε (t )
could be wrong. This may result in more conservatively estimated bounds on model
parameters, which may make the feasible control region too small to be operated on. As stated
in the introduction part of this chapter, available techniques of bounding approach for
parametric model are not applicable in parameter estimation of chlorine residual model. A
less conservative estimation approach is wanted in order to make the model more feasible and
efficient for control purposes.

Instead of trying to obtain the prior bounds on ε (t ) in advance, it is to be handled together


with model parameters during estimation. The uncertainties in the parameter and structure
error can be better explained by the point-parametric model.

It can be shown that there is internal links between the uncertainty in the parameters and
uncertainty in structure error part of the model:

y (t ) = M (u, θ (u, t ), t ) + ε (u, t ) (4.15)

where u denotes input function of time for a simplified notation. In the above formulation, θ
and ε are input dependent. Notice, that the meaning of θ and ε in (4.15) is different from
- 106 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

the meaning of θ and ε in (4.5). Actually, they are different parameters. Only the model
parameter structure of model (4.5) remains in the point-parametric model. For notation
simplicity, we still use θ and ε in the following formulation description. Corresponding to
an input u (⋅) , there exists at least one θ and ε that satisfy (4.15), and they are a set of
parameters of the model.

Uncertainty in the parameter can now be linked to the structure error uncertainty directly. It is
possible now to trade off the uncertainty distribution between the parameter part and structure
error part and estimate them jointly. Hence, a less conservative uncertainty model is possible.
However, dedicated input excitation design is needed in order to get sufficiently rich
information in the system outputs. It means that with this information, it will be possible to
find a parameter set in the parameter space so that for any output there exists a parameter in
this set that the plant output can be produced by the model with this parameter. Of course, it is
impossible to try all input signals. It will be shown in the subsequent sections that it is a
sufficient condition to excite the plant with only a finite number of specially designed inputs.

The uncertainties in the system may locate in the parameters and / or structure part of the
model. This results in two types of possible model structure differing in uncertainty
allocation. The first type of model allocates all of the uncertainties in the system into model
parameters, resulting in:

y (t ) = M (u, θ (u, t ), t ) (4.16)

where the parameters must be time-varying in order to make the model work. Alternatively,
uncertainties in the system can be explained by constant parameter and a time-varying
modelling error part together:

y (t ) = M (u, θ (u ), t ) + ε (u , t ) (4.17)

Notice that u denotes function of time, being a constant parameter value corresponding to
this function. In both of the cases, the parameters and modelling error part are input
dependent. Parameter estimation algorithm will be developed based on the two types of
models.

- 107 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

A robust output prediction (ROP) algorithm can be developed based on parameter bounded
uncertain model, which is also part of the robust model predictive controller. Suitable norm
on robust prediction can be defined to evaluate uncertainties in the obtained model. In this
way, integrated robust modelling and control design is to be developed. Model accuracy
requirement from the controller is expressed through ROP and embedded into model
parameter estimation explicitly. Thus, the modelling horizon is partitioned under such model
uncertainty criterion and finally resulting in a parameter piece-wise constant bounded model.

4.5.1 Time-Varying Parameter Formulation

First, we consider the model with all uncertainties locating in model parameters.

Definition 4.1: Point Parametric Model I: Time-varying Parameter without Structure Error
For any plant input u(t ) , there exists {θ (t ), φ (t )} that equation y (t ) = φ (t )T θ (t ) generates

y (t ) that equals to the plant output y p (t ) , for ∀t over the considered time horizon.

Let y j (⋅) denote the model response to input u j (⋅) over the time interval [t 0 , t 0 + Tm ] .

According to Definition 4.1 there exist trajectories of θ j (⋅) so that the model response equals

to the plant response y (t ) = y p (t ) . Different inputs require different scenarios of θ j (⋅) in


order to match the plant responses, giving:

y j (t ) = φ j (t )T θ j (t ) (4.18)

It is assumed that the control input is valued on a compact set so that the trajectories of θ j (⋅)
can be bounded above and below over the time interval [t 0 , t 0 + Tm ] . For robust control
purposes, obtaining the exact envelopes over time is not essential. A constant least
conservative envelope that can bound the exact envelope trajectory over time is estimated,
which is sufficient for robust control design in the water quality control (Brdys and Chang,
2002b).

- 108 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Under Definition 4.1, all the uncertainties in the system are only explained by the time-
varying parameters. In order to estimate the envelope of the parameters, a series of
experiments are performed under input u j (⋅) , j = 1L E . The corresponding outputs are

collected as y j (t ) from t = 1 to t = N . A feasible parameter set corresponding to E inputs


can be defined as:

~ ~ ~
θ j (t ) ∈ Θ(θ l , θ u ) (4.19)
~ ~ ~ ∆
Θ(θ l , θ u ) ={θ j (t ) ∈ R M : y j (t ) = φ j (t )T θ j (t ),
~ ~u
where θ l ≤ θ j (t ) ≤ θ , j = 1L E , t = 1L N } (4.20)

~ ~ ~
where Θ(θ l , θ u ) is the union of the parameter sets that are consistent with the inputs and
~ ~
corresponding measurements, θ l and θ u are the union bounds, M is the dimension of the
parameter vector, E is the experiment number, and N is the number of observations under
an experiment.

A union
θ2 Possible values ~ ~l ~u
Θ(θ , θ )
Possible values of θ 2 (n)
of θ 1 (n)
~
θ 2u
Possible values
The least
of θ 3 (n)
conservative union
~ ~ ~
Θ(θ l , θ u )*
~
θ 2l
Possible values Possible values
of θ 4 (n) of θ 5 (n)
~ ~ θ1
θ1l θ1u

Figure 4.5 A 2-dimension Parameter Example at Time Instant n

A 2-dimension θ = [θ 1 , θ 2 ] example at time instant t = n over time horizon [1..N ] is shown in

Figure 4.5, where θ 1 ,..., θ 5 are parameters corresponding to five inputs u (⋅)1 ,..., u (⋅) 5 ,
respectively:

- 109 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

y 1 ( n ) = φ 1 ( n ) T θ 1 ( n) (4.21)
M
y 5 ( n) = φ 5 ( n) T θ 5 ( n)

According to Definition 4.1, there could exist multiple parameter values corresponding to one
~ ~ ~
input. Values of θ j are not unique as shown in the figure. Θ(θ l , θ u ) defines a union of the
parameters bounded by an axis-parallel box, which is composed of at least one value of
θ 1 (n) ,..., θ 5 (n) , respectively. When the box bounded space is the “minimum”, it is called the
~ ~ ~
least conservative bounding of the union that is Θ(θ l , θ u )* .

~ ~ ~
The least conservative estimation for set Θ(θ l ,θ u ) can be calculated by optimizing an index
function:

~ ~ ~ ~
[θ l ,θ u ]* = arg min J (θ l ,θ u ) (4.22)
~ ~
[θ l ,θ u ,θ j (t )]

~ ~ ~
subject to θ j ∈ Θ(θ l , θ u )

~ ~ ~ ~ ~ ~
where J (θ l , θ u ) = (θ u − θ l )T P(θ u − θ l ) (4.23)

Possible choice of P could be an identity matrix of dimension M , which is the dimension of


the parameter vector. The formulation of the index is related to finding the minimum diagonal
distance of the axis-parallel box that contains parameters that are consistent with the
experiment data, in other word, we are looking for the “uncertainty-minimum” parameter sets
that can explain the experiment data. When P = I , where I is an identity matrix, the
performance index exactly represents the diagonal.

Apparently, the result of (4.22) depends on the experiments. As our inputs are evaluated on a
compact set it is possible to find a set of experiments so that the result of (4.22) is consistent
with all the inputs. Experiment design will be discussed in the following section.

Finally a time-varying point-parametric model with constant bounded parameter is obtained


as:

- 110 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

y (t ) = φ (t )T θ (t ) (4.24)
∆ ~* ~
~ ~
θ (t ) ∈ Θ , Θ ={θ ∈ R M : θ l ≤ θ (t ) ≤ θ u }
*
(4.25)

This is a time-varying model in which parameters are bounded by constant envelopes. The
time-invariant model is to be developed next.

4.5.2 Time Invariant Parameter Formulation

The uncertainties in the parameter and structure error can also be handled by the point-
parametric model with time-invariant parameters and time-varying structure error. Let y j (⋅)

denote the model response to input u j (⋅) :

y j (t ) = φ j (t ) T θ j + ε j (t ) (4.26)

Notice that ε j (t ) must be time-varying as the parameters are constant.

Definition 4.2: Point Parametric Model II: Time invariant Parameter


For any plant input u(t ) , there exists {θ , φ (t ), ε (t )} that equation (4.26) generates y (t ) that
equals to the plant output, for ∀t over the considered time horizon.

Similar to time-varying formulation, the feasible parameter set Θ can be defined as:

[θ j , ε j (t )] ∈ Θ(θ l ,θ u , ε l , ε u ) (4.27)

Θ(θ l ,θ u , ε l , ε u ) ={[θ j , ε j (t )] ∈ R M +1 : y j (t ) = φ j (t )T θ j + ε j (t ), where (4.28)

θ l ≤ θ j ≤ θ u andε l ≤ ε j (t ) ≤ ε u , for j = 1L E , t = 1L N }

The bound estimation can be calculated as follows:

- 111 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

[θ l ,θ u , ε l , ε u ]* = arg min J (θ l ,θ u , ε l , ε u ) (4.29)


[θ l ,θ u ,θ j ,ε l ,ε u ,ε j ( t )]

subject to [θ j , ε j (t )] ∈ Θ(θ l ,θ u , ε l , ε u )

where J (θ l , θ u , ε l , ε u ) = (θ u − θ l )T P(θ u − θ l ) + (ε u − ε l )T Q(ε u − ε l ) . (4.30)

The choice of P and Q is the compromise of distributing uncertainty between the parameters
and structure error. The selection is “optimal” that with such P and Q the obtained model
uncertainty “radius” is minimum, where the uncertainty radius can be defined using the worst-
case output prediction. These will be shown in the following section and in simulation studies.

A time-invariant model with constant bounded parameter was obtained as:

y (t ) = φ (t )T θ + ε (t ) (4.31)

Θ ={[θ , ε (t )] ∈ R M +1 : θ l ≤ θ ≤ θ u , ε l ≤ ε (t ) ≤ ε u }
* * * *
(4.32)

4.5.3 Parameter Estimation under Measurement Errors

Let us consider now more realistic situation where the output measurements are corrupted by
unknown but bounded measurement error. The measurement model can be written as:

y m (t ) = y (t ) + ε m (t ) (4.33)

where y (t ) = φ (t )T θ (t ) (4.34)
and ε min ≤ ε m (t ) ≤ ε max (4.35)

where ε m (t ) is the measurement error, and ε min , ε max are lower and upper bounds on the
measurement error, respectively. Combining (4.33) and (4.35) yields,

ym (t ) − ε max ≤ y (t ) ≤ ym (t ) − ε min (4.36)

- 112 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Hence, under such measurement errors, outputs in regressor φ (t ) become unknown values.
Let us consider a more general circumstance where the inputs are also not fully known:

u min (t ) ≤ u (t ) ≤ u max (t ) (4.37)

then regressor φ (t ) are not known but can be bounded as:

φ min (t ) ≤ φ (t ) ≤ φ max (t ) (4.38)

Thus, parameter estimation problem described by (4.5) becomes more complex as the
regressor is unknown now, which is often referred to as “error-in-variables” in set-bounded
estimation whereas estimation problem (4.5) is referred to as “equation-error” estimation
problem when the inputs and outputs are exactly known (Milanese, Norton, Piet-Lahanier and
et al., 1996).

The feasible parameter set definition based on point-parametric model in the error-in-
variables case is still open. As in chlorine residual modelling for control purposes the
observation data are collected from a DWDS simulator, consideration of measurement errors
is not essential in this circumstance. Therefore, it is not further discussed in this thesis.

4.5.4 Summary

Uncertainty of the model locates in the parameters and modelling error part of the system
model. Through input these two parts are linked and a point-parametric model is defined.
Algorithm of how to find the bounds on parameters and modelling error based on the
observations corresponding to the inputs has been developed.

- 113 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

4.6 Experiment Design

4.6.1 Representation of Inputs

The system input in practice is usually restricted by actuator performance and operational
limits. The input constraints for chlorine residual control can be expressed as:

u min ≤ u (t ) ≤ u max , u min ≥ 0 (4.39)

Then, an input series u = [u (1) ... u ( N I )] over time horizon t = 1,..., N I can be viewed as a
point in N I dimension Euclidean space bounded by parallel cubes with r vertices, and

r = 2 N I , where N I is the input time horizon corresponding to N output observations.


Figure 4.6 is the example of such input vector in 3-dimension and 2-dimension cases, where
N I = 3 and N I = 2 , respectively.

u (2)
u (2)

u u max
u
u (3)

u max
min
u min
u

u (1) u (1)
max min max
u min u u u

Figure 4.6 Input Series Vector in a Euclidean Space

The following theorem in (Kalman, 1961; Grünbaum, Klee, Perles and et al., 1967) is useful
for designing experiment:

- 114 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Theorem 4.1: Let K ⊂ R d be a polytope and let vertices K = {v1 ,..., vr } . Then each x ∈ K can
be expressed in the form:
r r
x = ∑ λi ( x)vi with λi ( x) ≥ 0 and ∑ λi ( x) = 1 . (4.40)
i =1 i =1

Proof:
Proof can be found in (Kalman, 1961).
End of proof.

Theorem 4.1 allows that any point in the polytope-bounded space can be expressed by the
convex combination of the polytope’s vertices. Hence, considering a time horizon t = 1,..., N I ,
any input u (t ) satisfying (4.39) can be expressed as:

E
u (t ) = ∑ α j u j (t ) (4.41)
i =1

E
where ∑ α j = 1 and α i ≥ 0 ,
i =1

[ ]
and t = 1...N I , E = 2 N I , and u j = u j (1), L , u j ( N I ) is the j th vertex of the N I -dimension

cube in which component u j (k ) is u min or u max . There are E vertices u1 ,..., u E


corresponding to a time horizon N I .

4.6.2 Two Technical Theorems

We shall give two theorems that are helpful to generate the input excitations for model
estimation purposes.

{
Theorem 4.2: Let u j (t ), y j (t ) } E
j =1 be input-output pairs corresponding to a system defined as

in (4.18), where t = 1,..., N . Let θ 1 (1),L,θ E ( N ) be the parameter trajectories for which

- 115 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

~ ~
y j (t ) = φ j (t )T θ j (t ) , θ j (t ) ∈ Θ , where Θ is defined as in (4.20). Then for input
E
u (t ) = ∑ α i u j (t ) where α i ≥ 0 , there exists point-parametric model parameter θ (t ) such that
j =1

~
y (t ) = φ (t )T θ (t ) and θ (t ) ∈ Θ .

Proof:
For each input u j (t ) the following hold:

y1 (t ) = φ 1 (t )T θ 1 (t ) (4.42)
M
y E (t ) = φ E (t )T θ E (t )

~
where θ j (t ) ∈ Θ (4.43)
~
Θ ≡ {θ ∈ R M : θ kl ≤ θ k (t ) ≤ θ ku , k = 1L M }

E
For the input u (t ) = ∑ α i u j (t ) , where α i ≥ 0 and t = 1L N , because the system is linear so
j =1

E E
that the corresponding output y (t ) = ∑ α i y i (t ) , and φ (t ) = ∑ α iφ i (t ) .
i =1 i =1

Let us define a θ (t ) as:

E
θ k (t ) = ∑ β ki (t )θ ki (t ), k = 1L M (4.44)
i =1

α iφ ki (t )
where β ki (t ) = E
, i = 1L E (4.45)
∑ α iφ k (t )
i
i =1

where M is the dimension of the parameter vector, θ k is the k th component of vector θ , and

φ k is the k th component of vector φ . Notice, that as in our application, y (t ) ≥ 0 and u (t ) ≥ 0 ,

- 116 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

E E
∑ α iφ k (t ) = 0 is equivalent to φ k (t ) = 0 . Hence, θ k (t ) can be defined as θ k (t ) = ∑ α iθ k (t )
i i i

i =1 i =1

E
when ∑ α iφ ki (t ) = 0 , and the following calculation still holds.
i =1

Substituting φ (t ) and θ (t ) with the above expression, the following calculation is performed,
yielding:

E
φ (t )T θ (t ) = ∑ α iφ i (t )Tθ (t ) (4.46)
i =1

= ∑ ⎡ ∑ α iφ ki (t )T θ k (t )⎤
E M

i =1 ⎢
⎣ k =1 ⎥⎦

= ∑ ⎡∑ α iφ ki (t )T ⎤θ k (t )
M E

⎢i =1
k =1 ⎣ ⎥⎦

⎡ ∑
E
α iφ ki (t )θ ki (t ) ⎤
M ⎢ E ⎥
= ∑ ⎢(∑ α iφ ki (t )T ) i =1 E ⎥
k =1 i =1
∑ α iφ k (t ) ⎥
i

⎣ i =1 ⎦
M E
= ∑ ∑ α iφ ki (t )θ ki (t )
k =1i =1

E M
= ∑ ∑ α iφ ki (t )θ ki (t )
i =1 k =1

E M
= ∑ α i ∑ φ ki (t )θ ki (t )
i =1 k =1

E
= ∑ α i y i (t )
i =1

= y (t )

So it was proved that θ (t ) is a feasible parameter of the time-varying point-parametric model


with input u and output y :

y (t ) = φ (t )T θ (t ) (4.47)

From the definition about the system we have that:

u(t ) ≥ 0 , y (t ) ≥ 0 and α i ≥ 0 (4.48)

- 117 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

then there exists:


E
0 ≤ β ki (t ) ≤ 1 and ∑ β ki = 1 (4.49)
i =1

~
It means that θ (t ) is the convex combination of θ j (t ) , hence, θ (t ) ∈ Θ .
End of proof.

{
Theorem 4.3: Let u j (t ), y j (t ) }E
j =1 be input-output pairs corresponding to a system defined as

in (4.26), where t = 1,..., N . Let θ 1 , L , θ E , ε 1 (t ),..., ε E (t ) be the parameter trajectories for

which y j (t ) = φ j (t )T θ j + ε j (t ) , [θ j , ε j (t )] ∈ Θ , where Θ is defined as in (4.28). Then for


E E
input u (t ) = ∑ α i u j (t ) where α i ≥ 0 and ∑ α i = 1 , there exists point-parametric model
j =1 j =1

parameter θ , ε (t ) such that y (t ) = φ (t )T θ + ε (t ) and [θ , ε (t )] ∈ Θ .

Proof:

Similar to the proof of Theorem 4.2, corresponding to u j (t ) , j = 1L E and t = 1L N there

exist φ j (1),L,φ j ( N ) and θ j so that:

y1 (t ) = φ 1 (t )T θ 1 + ε 1 (t ) (4.50)
……
y E (t ) = φ E (t )T θ E + ε E (t )
and
[θ j , ε j (t )] ∈ Θ(θ l , θ u , ε l , ε u ) (4.51)

Θ ≡ {[θ , ε ] ∈ R M +1 : θ kl ≤ θ k ≤ θ ku , k = 1L M , ε l ≤ ε ≤ ε u }

E E
As the system is linear its response to the input u (t ) = ∑ α i u j (t ) equals to y (t ) = ∑ α i y i (t ) ,
j =1 i =1

E
where α i ≥ 0 , and ∑ α i = 1 , t = 1L N .
i =1

- 118 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Let θ , ε (t ) be defined as:

E
θ k = ∑ β ki (t )θ ki , k = 1L M (4.52)
i =1

E
ε (t ) = ∑ α iε i (t )
i =1

α iφ ki (t )
where β ki (t ) = E
, i = 1L E (4.53)
∑ α iφ k (t )
i

i =1

E E
Similarly as in proof of Theorem 4.2, θ k can be defined as θ k = ∑ α iθ ki when ∑ α iφ ki (t ) = 0 ,
i =1 i =1

which does not change the following computation.

We shall prove that the above defined θ , ε (t ) are model parameters under the input u and the
output y :

E E
φ (t )T θ + ε (t ) = ∑ α iφ i (t )T θ + ∑ α i ε i (t ) (4.54)
i =1 i =1

E M E
= ∑ ∑ α iφ ki (t )T θ k + ∑ α iε i (t )
i =1 k =1 i =1

E
∑ α iφ k (t )θ k
i i
M E E
= ∑ (∑ α iφ ki (t )T ) i =1E + ∑ α iε i (t )
k =1 i =1
∑ α iφ k (t ) i =1
i

i =1

M E E
= ∑ ∑ α iφ ki (t )θ ki + ∑ α iε i (t )
k =1 i =1 i =1

E M E
= ∑ ∑ α iφ ki (t )θ ki + ∑ α iε i (t )
i =1 k =1 i =1

E M E
= ∑ α i ∑ φ ki (t )θ ki + ∑ α iε i (t )
i =1 k =1 i =1

E M
= ∑ α i { ∑ φ ki (t )θ ki + ε i (t )}
i =1 k =1

E
= ∑ α i y i (t )
i =1

- 119 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

= y (t )

Thus, it has been proved that [θ , ε (t )] is a parameter of the time invariant point-parametric
model:

y (t ) = φ (t )T θ + ε (t ) (4.55)

Similar to the time-varying case we have:

E E
0 ≤ β ki (t ) ≤ 1 , ∑ β ki = 1 and ∑ α i = 1 (4.56)
i =1 i =1

Hence, [θ , ε (t )] ∈ Θ .
End of proof.

4.6.3 Summary

The inputs of our problem are evaluated on a compact set and can be represented by a convex
expression as in (4.41). Applying the E base inputs to the system the experiment data can be
produced for point-parametric model parameter estimation. Theorem 4.2 and Theorem 4.3
guarantee that constantly bounded time-varying or time-invariant model can be obtained
respectively using the methods presented in Section 4.5 based on these experiments. Data
needed for estimation are generated by using a DWDS simulator, which is described in
Section 4.3. The simulator errors are not considered in parameter estimation and such errors
are handled in controller design as unknown but bounded disturbance input.

The following remark is given for the parameter estimation algorithm based on point-
parametric model:

Remark 4.3:

- 120 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

• N output observations may be produced by inputs over a time horizon of N I , in our

application N I ≥ N . The number of the needed experiments, E = 2 N I , increases with


the input horizon. With larger N I , the computation task in solving the optimization
problem augments dramatically.
• Theorem 4.2 only requires that α i ≥ 0 in the input representation, which implies
possibility of further reduction in the experiment design.
• The computation efficiency can be improved by reducing the experiment number in
the following way in practice:
1. Replacing the base inputs by a number of random inputs. After obtaining the
bounded model, it can be checked whether the estimation results are consistent
with the responses to the base inputs. Increase the number of random inputs
until satisfactory model is obtained.
2. Find a ploytope with less vertices that can bound the cube space containing the
inputs. Use the vertices of the new polytope as the experiment inputs.
• Application of quality simulator in producing the measurement data makes it possible
to separate the multiple input contributions to an output. Hence, input experiment
design can be simplified.
• An input range u min ≤ u (t ) ≤ u max is required in experiment design. However, larger
input range results in larger uncertainties in the obtained model parameters, which is
the price paid for point-parametric model.

- 121 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

4.7 Obtaining Parsimonious Model by Time Horizon


Partition

4.7.1 Robust Output Prediction

Output prediction based on the obtained set-bounded models described by (4.24) or (4.31) is
under uncertainty as well. Given the input, a robust prediction of the outputs over a prediction
horizon H p can be calculated that are consistent with the past measurements, model

uncertainty and input uncertainties. The upper and lower envelopes that bound the output
trajectory set determine a set in the output space in which a real output is contained, provided
that the uncertainty model is convinced. This is illustrated in Figure 4.7, where the robust
prediction is carried out at time instant t .

Output
Ypk
y u (t + k | t )

y (t )

y (t + k | t )

y l (t + k | t )

Time Step
t t+k t + Hp
Figure 4.7 Illustration of the Robust Output Prediction

The bounding envelope is y l (t + k | t ) , y u (t + k | t ) , and it can be viewed as producing at time

t the worst case t + k step output prediction, which belongs to a output set Y pk that is

composed of all possible output trajectories.

Hence, taking the time-invariant model as an example:

- 122 -
CHAPTER 4. MODEL PARAMETER ESTIMATION


Y pk ={ y (t + k | t ) ∈ R : y (t + 1 | t ) = φ (t + 1)T θ + ε (t + 1)

M (4.57)
y (t + k | t ) = φ (t + k )T θ + ε (t + k )

where ε l ≤ ε (t + j ) ≤ ε u , θ l ≤ θ ≤ θ u and φ l ≤ φ ≤ φ u for j = 1,..., k} .

The above formulation is a batch type as in defining the output set at t = t + k all the previous
output equations from t = t + 1 are contained, which are constraints on y (t + k | t ) . In order to
achieve sufficient accuracy and reduce computation complexity simultaneously, formulations
of recursive form and a “moving windows” form have been discussed in (Brdys, 1999).

Bounds on θ , ε (t ) are from the model obtained in the previous section, and bounds on the

regressor φ (t)T are composed of two parts: bounds on output variables and input variables.
Considering the following regressor:

φ (t + k )T = [ y (t + k − 1 | t ) ... y (t + k − nT | t ) u (t + k − il | t ) ... u (t + k − iu | t )] (4.58)

where y (t + k − i | t ) is bounded by measurements when k − i ≤ 0 as follows by using


measurement model (4.33) and (4.35):

ym (t + k − i ) − ε mmax ≤ y (t + k − i | t ) ≤ ym (t + k − i ) − ε mmin (4.59)

and y (t + k − i | t ) is bounded by the model equations of (4.57) only when k − i > 0 , hence, it
does not produce any constraint on the regressor:

− ∞ ≤ y (t + k − i | t ) ≤ +∞ (4.60)

Constraints on input u in the above regressor exist because of the actuator error in
implementing the controller outputs. In our problem it is the error of the chlorine injection
actuator: the chlorine boost station. The detail of the chlorine boost station is to be presented
in Chapter 5, actuator constraints can be expressed as:

- 123 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

u c (t + k | t ) + ε amin ≤ u (t + k | t ) ≤ u c (t + k | t ) + ε amax (4.61)

where u c (t + k | t ) is the controller output, u (t + k | t ) is the actuator output, and ε amin , ε amax are

bounds on actuator errors. Based on (4.59)-(4.61) the bounds φ l (t + k ) and φ u (t + k ) on


φ (t + k ) can be obtained.

Let V p ,t + k be the variables in (4.57):

V p ,t +k = {y (t + k | t ),..., y (t + 1 | t ), φ (t + 1),..., φ (t + k ),θ , ε (t + 1),..., ε (t + k )} (4.62)

Robust output prediction is defined as:

y lp (t + k | t ) = min y (t + k | t ) (4.63)
V p ,t + k

subject to: y (t + k | t ) ∈ Y pk

and y up (t + k | t ) = max y (t + k | t ) (4.64)


V p ,t + k

subject to: y (t + k | t ) ∈ Y pk

There exist product terms of variables in (4.57), hence, solving (4.63) is a non-linear
programming problem. An approximated solving algorithm will be presented in Chapter 5 in
detail. An output prediction envelope can be generated over prediction horizon H p as:

Y pl = [ y lp (t + 1 | t ) L y lp (t + H p | t )] (4.65)

Y pu = [ y up (t + 1 | t ) L y up (t + H p | t )]

In order to assess model uncertainty impact on the robust output prediction accuracy so-called
uncertainty radius is defined as:

W = max{Y pu − Y pl } , under u (t ) = 1(t ) (4.66)

- 124 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

where 1(t ) defines a unit step input. It will be presented in Chapter 5 that the robust model
predictive controller operates on an input set that is restricted by input-output constraints that
is modified by “safety zones”. This results in shrink in the feasible input set. The safety zones
are designed based on the robust output prediction. In order to extend the feasible input set
that the controller operates on, a least conservative output prediction is wanted. Requirement
for model accuracy from robust controller can be represented by an upper limit on W .
Through W the model estimation is related to the controller design directly and the model
design and controller can be practised in an integrated way.

4.7.2 Parameter Piece-Wise Constant Bounded Model by Partitioning

As the time-varying delays may change over a very large range and abrupt changes may
occur, a large number of parameters may be required for sufficient accurate modelling and the
parameter values may be subject to abrupt changes at certain time instants. Therefore, the
parameter bounds calculated could extend to infinite with the modelling horizon going
forward. It’s possible to further reduce the bound estimation conservatism.

First, by exploiting a priori knowledge about hydraulics let us partition the overall horizon
into a number of time-slots. Over a time-slot only certain parameters associated with the delay
range corresponding to this slot are active (non-zero). A priori knowledge supporting the
partitioning can be obtained by analysing the physical system (DWDS) itself. Due to the flow
and velocity change in the water network, parameter θ (t ) may abruptly change their values at
time instant t j ∈ [t0 , t0 + Tm ] , j = 1,2, L N p 0 and t N p 0 = t0 + Tm . Within the time interval

[t j −1 , t j ] the changes can be assumed slow and also, certain delays do not occur over the time

interval. The instants t j are assumed known from physical system analyses. Under these

assumptions the entire model horizon Tm can be partitioned into N p 0 time-slots at first,

defined as:

S j ={t ∈ Z : t j −1 ≤ t < t j }, j = 1,2, L , N p 0



(4.67)

- 125 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

The slots obtained based on this information constitutes our a priori partitioning before
running the parameter estimation procedure. Horizon N in the previous sections is located
within one slot of the prior partition. The bounding radius calculated by (4.66) grows when
the time horizon N increases. Suitable parameter bounds are needed in order to make the
robust predictive control applicable. To make the control robustly feasible the envelope width
W cannot be larger than a constraint W max . W max acts as the judgment of whether the
“uncertainty radius” of the obtained model is appropriate for control. Different N will be
tried when the parameter estimation is running within one a priori time-slot. A new partition
point is to be inserted when W > W max . Thus, a new time-slot is inserted. An algorithm for the
partitioning can be proposed as:

Algorithm 4.1: Time Horizon Partitioning by Uncertainty Radius Judgement

1. A priori partitioning is produced based on the path analysis result;


2. Starting from t0 , with N = 1 , the parameter bounds are calculated using algorithms
~ ~
presented in Section 4.5, giving [θ l , θ u ]* ;

3. If t0 + N is within the a priori slot and W < r × W max , where 0 ≤ r ≤ 1

set N = N + 1 , go to step2;
else t0 + N is inserted as new partitioning point and then set t0 = t 0 + N , N = 1 .
Go to step 2 until the end of the modelling horizon is reached.

~
Finally, N p time-slots are obtained and the parameter bounding orthotope Θ j and Θ j for time-

varying model and time invariant model respectively over S j can be obtained as:

~ ∆
{
Θj =θ j ∈R
dim( I j )
: θ min
j
≤ θ (t ) ≤ θ max
j
,t ∈ S j } (4.68)

={[θ , ε (t )] ∈ R }

dim( I j )+1
or Θj : θ min
j
≤ θ ≤ θ max
j
, ε min
j
≤ ε (t ) ≤ ε max
j
,t ∈ S j (4.69)

S j ={t ∈ Z : t j −1 ≤ t < t j }, j = 1,2, L , N p .



where (4.70)

Yielding the Parameter Piecewise Constant Bounded Models as:

- 126 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

~
Time-varying Model M (⋅) : y (t ) = φ (t )T θ (t ) (4.71)
~
where θ (t ) ∈ Θ J (t )

and J (t ) = j , for t ∈ S j .

Time Invariant Model M (⋅) : y (t ) = φ (t )T θ + ε (t ) (4.72)


where [θ , ε (t )] ∈ Θ J (t )

and J (t ) = j , for t ∈ S j .

It is understood that vector φ (⋅) changes its structure following changes of the parameter
vector. Model (4.71) or (4.72) will be used in RMPC design.

4.8 Simulation Study

EPANET 2.0 is a software package published in 2000 by National Risk Management


Research Laboratory of United State Environment Protection Agency (Rossman, 2000). The
product is open-source software and is widely used in DWDS simulation and design of
hydraulic and water quality behaviour within pressurised pipe networks. In the thesis,
EPANET was used as the DWDS simulator that is an important component in the estimation
structure described in Section 4.1. EPANET’s embedding into Matlab/Simulink environment
and details of the simulation platform will be presented in Chapter 7.

In this section, chlorine residual modelling of a small simple DWDS is presented. Path
analysis is performed first to obtain the parameter structure of the model. The time-varying
parameter estimation algorithm developed in this chapter is implemented and time-varying SS
model and IO model with constant bounded parameters are obtained.

- 127 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Time-invariant model is explored next and it has been shown that the uncertainty
conservatism is reduced by choosing different weight matrix P and Q to distribute the
uncertainty between the parameters and structure error part appropriately.

4.8.1 A Simple DWDS with One Switching Type Tank

2
Tank
1

110

9 9 10 11 12 13
Source 10 11 12

Pump

111 112 113

21 21 22 22 23

121 122

31 31 32

Figure 4.8 A Sample DWDS Network

The conceptual DWDS in Figure 4.8 is taken from EPANET package (Rossman, 2000).
Length of the pipes in this DWDS has been reduced from 5280[feet] to 2640[feet] for result
presentation convenience (otherwise, a time horizon of more than 24-hour should be
presented to illustrate the overall performance). Another modification is the additional link
between the tank and node 12. Extra pipe 1 is added between the tank and end of pipe 110.
Node 1, the end of pipe 110, has the same elevation of the tank and pipe 1 is very short. With
such modification chlorine concentration just before getting into the tank can be obtained
conveniently without adding extra hydraulic dynamics into the DWDS. Naturally, node 1 can

- 128 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

be neglected in analysing hydraulics and pipe 110 is treated as linking to tank 2 directly. In
analysing chlorine transportation, node 1 can be viewed as the water flow into the tank just
before mixing when the tank is operated at filling status. The network file of the DWDS can
be found in Appendix A, where the options of the simulator settings are included. Modelling
of chlorine dynamics of this DWDS over a 24-hour horizon is considered.

There are 8 water consumption nodes in this DWDS linked with 10 pipes. For simplicity
reason, the predicted water demand pattern at different nodes is assumed the same and the
pattern step is 2 hours. The absolute water consumption at certain node is characterised by the
node property “base demand” in EPANET. For example, if the water demand pattern at time
t = 2 [hour] is 1.2, water consumption at node 32 will be 1.2 × 100 = 120 [Gallon/Minute]
where 100 is the “base demand” of node 32. The water demand at node 32 over the 24-hour
modelling horizon is shown in Figure 4.9.

Demand for Node 32


150.0
145.0
140.0
135.0
130.0
125.0
Demand [GPM]

120.0
115.0
110.0
105.0
100.0
95.0
90.0
85.0

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Time [hours]

Figure 4.9 Water Demand Predictions at Node 32

The water is pumped from the source (node 9) and it is also supplied by the tank (node 2).
Link 9 is the pump that connects the source to node 10 and then through pipe 10 to the
DWDS. The pump is fixed speed type that is described in Chapter 3. The pump hydraulic
characteristic curve is described by the following quadratic equation:

- 129 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

∆h10,9 = g f (q9,10 ) = 333.33 − 3.704 × 10 −5 × (q9,10 ) 2 (4.73)

where ∆h10,9 is the water head increase between node 9 and node 10, q9,10 is the water flow

between the two nodes, and when the pump is shut-off the flow is zero. The pump is operated
by a simple rule according to the water head in the tank, which is described as follows in
EPANET:
LINK 9 OPEN IF NODE 2 BELOW 104.5
LINK 9 CLOSED IF NODE 2 ABOVE 150

Base on the above operation rule, the operation of the pump over 24 hours can be shown by
the flow q9,10 in Figure 4.10.

Flow for Link 9


2000.0
1900.0
1800.0
1700.0
1600.0
1500.0
1400.0
1300.0
1200.0
Flow [GPM]

1100.0
1000.0
900.0
800.0
700.0
600.0
500.0
400.0
300.0
200.0
100.0
0.0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Time [hours]

Figure 4.10 Flow into the DWDS Pumped from the Source

Node 2 is a switching tank, which is operated by the water head. When the water head h12 at
node 12 is greater than head h2 at tank 2, it is operated in filling status. While h12 < h2 it is
operated in draining status. Thereafter the 24-hour horizon is divided into two cycles
depending on the tank operating status, which can be seen on Figure 4.11, where the positive
direction of flow f 2,12 in pipe 110 is defined from node 2 to node 12. Node 1 and pipe 1 are

- 130 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

neglected by the reason described before. Hence, over time horizon S f = [0,13) [hour] the

tank is operated in filling status, and over time horizon S d = [13,24) [hour] the tank is

operated in draining status, where S f , S d are the filling and draining period as defined in

(3.106) and (3.107).

Flow for Link 110


1200.0
1100.0
1000.0
900.0
800.0
700.0
600.0
500.0
400.0
Flow [GPM]

300.0
200.0
100.0
0.0
-100.0
-200.0
-300.0
-400.0
-500.0
-600.0
-700.0
-800.0
-900.0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Time [hours]

Figure 4.11 Flow between DWDS and Tank 2

The initial chlorine concentration in the tank node is 0.4 [mg/l] at time t = 0 , and initial
chlorine concentration at other nodes is zero at time t = 0 . In order to maintain a chlorine
concentration throughout the DWDS, node 32 is selected as the monitored node as it is most
remote from the source. Hence, chlorine concentration at node 32 is the output of the system.
A booster station is installed at node 11 in order to carry out an injection of chlorine
disinfectant to maintain the chlorine concentration at monitored node 32, where chlorine
concentration at node 11 is the system input.

First, parameter estimation for a SS model described by equation (3.106) is illustrated in


detail. Running EPANET, hydraulics such as water flow, flow velocity and head at nodes can

- 131 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

be obtained. Based on this hydraulic information, the SS model structure is obtained by path
analysis.

4.8.2 Illustration of Path Analysis Algorithm

2
Tank
1

1 Filling Cycle

110

Path IV
9
Source 9 10 10 11 11 12 12 13

Pump

111 112 113

21 21 22 22 23

Path I Path II Path III


121 122

31 31 32

Figure 4.12 Paths During Filling Period

SS model is described by equation (3.106). During filling period there exist chlorine
transportation paths from injection node to monitored nodes and paths to the tank,
respectively. By performing the algorithms presented in Chapter 3, it can be found that there
are three paths from the injection to the monitored node for the filling period, which can be
represented by the sequences of the pipe id, 111-121-31, 111-21-122 and 11-112-122. Water
flow in pipe 22 is from node 22 to node 23 over the 24-hour time horizon. Hence, there is no
path that includes node 13 and node 23. There is a filling path of 11-110 from the injection
node to the tank. The paths are depicted on Figure 4.12.

- 132 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

During the draining period, there is only one path from the injection node to the monitored
node: 111-121-31, and two paths from tank to the monitored node, 110-112-122 and 110-112-
21-121-31. The chlorine transportation paths during draining period are shown in Figure 4.13.

2
Tank
1
Draining Cycle
1

110

9
Source 9 10 10 11 11 12 12 13

Pump

111 112 113

21 21 22 22 23

Path I 121 Path VII


122

Path VI
31 31 32

Figure 4.13 Paths During Draining Cycle

Next, it shows how chlorine transportation delay in a path is calculated by taking path I as an
example. The simulator time steps are set as follows:

∆Th = 2[hour ] (4.74)

∆Tc = 10 [min]

where ∆Th and ∆Tc are the hydraulic time step and quality time step defined in Chapter 3.

The discretization time step ∆TD = 10 [min] is chosen according to these time step values. The
reporting time is set to 1 minute in EPANET. Hence, τ = 1 [min], where τ is the tracking time
step defined in Section 3.4.

- 133 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Velocity for Link 31

0.53
0.51
0.49
0.47
0.45
Velocity [fps]

0.43
0.41
0.39
0.37
0.35
0.33
0.31
0.29
0.27
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Time [hours]

Figure 4.14 Flow Velocity in Pipe 31

Figure 4.15 Chlorine Transportation Delay in Pipe 31

- 134 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Time delay of chlorine transportation in pipe 31, 121 and 111 are calculated independently by
using Algorithm 3.1 presented in Chapter 3. The tracking starts at t = 24[hour ] as this path
exists in both of filling and draining cycle. As an example, flow velocity in pipe 31 is shown
in Figure 4.14, and the calculated delay is shown in Figure 4.15.

After obtaining delays in pipe 31, 121 and 111, time delay in path I can be calculated as
described in Section 3.3.1.3. Time delay of chlorine transportation in path I is shown in
Figure 4.16.

Figure 4.16 Delay in Path I 11-121-31

Delays in other paths can be obtained similarly. The model parameter structure can be
obtained by discretizing the delay over certain time period. Parameter estimation is then
performed.

- 135 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

4.8.3 Parameter Estimation of the Time-Varying Point-Parametric Model

In order to obtain a parsimonious model the modelling horizon is partitioned by using


algorithm described in Section 4.7.2. The bounds on time-varying parameters over a time-slot
can be calculated by solving optimization problem described by equation (4.22). Six random
inputs over the modelling horizon are used as the experimental inputs. Chlorine concentration
collected from EPANET are normalized before being fed into the parameter estimation
algorithm:

c = csim / c0 (4.75)

where c is the chlorine concentration after normalization, csim is the chlorine concentration

generated by EPANET, and c0 = 0.25[mg / l ] is the normalization factor. An example input


and its response are shown in Figure 4.17, where the dots are the chlorine concentration
collected from EPANET at time interval of 10 minutes. The discretization time step is 10
minutes. Thus, the 24-hour horizon is discretized into 144 time steps.

Parameter estimation of the state equation and output equation described by (3.106) can be
performed in the same way separately by solving optimization problem described by equation
(4.22).

The time horizon is initially partitioned into two time-slots at t = 13[hour ] . Finally, the 24-
hour or 144 time-step modelling horizon is partitioned into a number of time-slots after
performing the algorithm in Section 4.7.2, where the uncertainty radius is set as W max = 0.25
and r = 1.0 , which are setting tunings obtained in simulation together with controller
operation. In calculating the Robust Output Prediction a unit step
u (t ) = 1.0, t = [0, 24][hour ] is used. Over each time-slot the parameter estimation problem is
solved.

Next, parameter estimation of ai over a time-slot [19, 27] [time-step] is shown in detail.

- 136 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Figure 4.17 An Example of the Experiment: Random Input Response

4.8.3.1 Estimation on a Time-Slot

The discrete number set associating with parameter ai in (3.106) over [19, 27] [time-step] is

{12, 13,14,15,16}. Thus, five parameters a12 , a13 , a14 , a15 and a16 are to be estimated. The

weight matrix in the performance index in (4.22) is set as P = 1.0 × I 5 , where I 5 is an identity
matrix of dimension 5. The specifications of the computing environment are as follows:

Sun Station: Sparc Ultra-10


CPU: 360 MHz
Memory: 256 MBytes
Operating System: SunOS 5.7
Matlab: Version 5.3 (R11)
Simulink: Version 3.0 (R11)

- 137 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Optimization Toolbox: Version 2.0 (R11)


EPANET Version2.0
MOMIP Version 2.3

The computation time of solving the quadratic programming problem described in (4.22) is 29
seconds. The calculated bounds on the parameters are:

a~12l = 0.1308 , a~12u = 0.1455


* *
(4.76)

a~13l = 0.1049 , a~13u = 0.1191


* *

a~14l = 0.1107 , a~14u = 0.1252


* *

a~15l = 0.1143 , a~15u = 0.1276


* *

a~16l = 0.1117 , a~16u = 0.1250 .


* *

4.8.3.2 Estimation on a Time-Slot: under Measurement Error

A random measurement error is added in the same data that are used in Section 4.8.3.1. The
measurement error described by equation (4.35) now is as follows:

− 2.5% × y m (t ) ≤ ε m (t ) ≤ 2.5% × y m (t ) (4.77)

where y m (t ) is the chlorine concentration collected from EPANET that is depicted as quality
simulator in Figure 4.3.

Other settings are the same as in Section 4.8.3.1. If we do not consider such measurement
errors and just assign the collected values to the regressor in (4.5) and solve problem
described by equation (4.22), the following calculated bounds on the parameters are obtained:

a~12l = 0.1477 , a~12u = 0.1682


* *
(4.78)

a~13l = 0.1132 , a~13u = 0.1315


* *

- 138 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

a~14l = 0.1120 , a~14u = 0.1320


* *

a~15l = 0.0918 , a~15u = 0.1111


* *

a~16l = 0.1014 , a~16u = 0.1201 .


* *

However, from the analysis in Section 4.5.3 we know that these results are wrong, as the
outputs in the regressor are unknown values bounded by (4.36). Unfortunately, as estimation
algorithm for point-parametric under measurement error is not available, we cannot compare
these results with the correct ones.

4.8.3.3 Model Performance

As an example, parameter value a9 over the 24-hour horizon is shown in Figure 4.18,

similarly dr10 and fl 2 are illustrated in Figure 4.19 and Figure 4.20, respectively.

Figure 4.18 Parameter Bounds of a9

- 139 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Figure 4.19 Parameter Bounds of dr10

Figure 4.20 Parameter Bounds of fl 2

- 140 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

From the figures, it can be seen that the parameters of the SS model are piece-wise constant
bounded over the time horizon. Parameter trajectory over the time horizon is time-varying and
could be any trajectory within the upper-lower bounded envelope. Taking the centre of the
bounds as the nominal value of the parameter, a nominal model can be obtained. The SS
model performance is illustrated in Figure 4.21 by applying a chlorine injection 0.25[mg/l] as
the step input.

Similarly, IO type model can be obtained. As described in Section 3.3.2.3 when the current
draining period reaches at t = 13 [hour] the parameter estimation will involve the dynamics of
chlorine concentration in tank 2 over the filling cycle [0,13] [hour]. Chlorine concentration in
tank 2 at time t = 0 can be obtained by introducing chlorine dynamics from last draining
cycle at t < 0 . To simplify the estimation, the chlorine concentration in tank 2 at time instant
t = 0 is assumed known. Hence, back-tracking stops at t = 0[hour ] . The nominal model
output, robust output prediction and plant output are shown in Figure 4.22.

As a robust MPC will be designed in Chapter 5, a bounded-parameter model is sufficient for


controller design and operation. In this case, it is not necessary that nominal model outputs
must exactly fit plant outputs. If the robust output prediction, the upper and lower envelopes
in Figure 4.21 and Figure 4.22, can bound the plant output, then the model is called
sufficiently accurate for controller operation. Hence, Figure 4.21 and Figure 4.22 showed that
the estimated IO model and SS model could be used for controller design and operation.
However, as stated in Section 4.7.2, the maximum envelope width cannot exceed a value
W max . Otherwise, the model uncertainty would be too big to be operated on, and there will be
no feasible input that can be robustly implemented. This has been achieved by partitioning the
modeling time-horizon into a number of time-slots.

- 141 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Figure 4.21 Step Response of the SS Model

Figure 4.22 Step Response of the IO Model

- 142 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

Comparing Figure 4.21 and Figure 4.22, it can be found that during filling cycle, about 0-80
[time-step], there is no difference between IO model and SS model. However, there are more
parameters in the input-output model during the switching period, which make the model less
accurate in the draining cycle compared with state-space model. More parameters imply more
conservatism of the model and larger computation errors during the estimation, which result
in larger uncertainty radius of the model. It can be found by comparing Figure 4.21 and
Figure 4.22 that the uncertainty in the robust output prediction based on IO model is larger
over the draining horizon.

4.8.4 Parameter Estimation of the Time-Invariant Point-Parametric Model

Time-invariant model estimation can be performed by solving optimization problem defined


in (4.29). By changing the weight of the P and Q in (4.29) the uncertainty allocation in the
parameter part and the structure error part can be changed. Using uncertainty radius W as the
index of estimated model uncertainty, the model estimation are compared and assessed for
difference weight setting.

Same time-slot as in Section 4.8.3.1 is considered. There are 8 samples and 6 experiments,
N = 8, E = 6. The parameters correspond to delay number 12 to 16, thus the parameters are
a12 , a13 , a14 , a15 , a16 . Inputs are random numbers and a DWDS is simulated by using
EPANET2.0, which generates the data for model parameter estimation and it is assumed
there is no simulator error. The output prediction is calculated assuming a step input
u (t ) = 1.8 × 1(t ) .

P = 1, Q = 10 W = 0.3615 (4.79)
P = 1, Q = 5 W = 0.2742
P = 1, Q = 1 W = 0.1603
P = 1, Q = 0.5 W = 0.1462
P = 1, Q = 0.1 W = 0.1576
P = 1, Q = 0.05 W = 0.1611

- 143 -
CHAPTER 4. MODEL PARAMETER ESTIMATION

It can be found that the uncertainty radius W is minimum at P = 1, Q = 0.5 according to the
simulation data. However, how to find the optimal value of P, Q that make W global
minimum is still an open problem.

4.8.5 Summary

Parameter bounded model is needed for control purposes. Both of the obtained IO and SS
model can be used for RMPC design that will be presented in the next chapter. However, as
shown in Section 4.8.3.3, if there exist switching type tanks in the DWDS, state-space model
is suggested in quality control of DWDS provided that the chlorine concentration in the tanks
is measurable.

Controllability can be improved by actively using the tank as the chlorine residual storage,
especially for nodes close to the tanks. When the tank is operated in the draining cycle water
demand at these nodes is mainly provided by the tank. Hence, controllability is very weak as
flow proportion from the injection node is low. Chlorine concentration in the tanks are
presented in the SS model, which makes it possible to manage the chlorine residual storage
dynamically. In the case study presented in Chapter 7, it will show that by using SS model the
control objective can be achieved at a node that is directly connected to the tank.

- 144 -
Chapter 5

Robust Model Predictive Controller Design

Model predictive control (MPC) belongs to the class of model based controller design
concepts, that is, a model of the plant process is explicitly used to design the controller. It is
also referred to as receding horizon control (RHC) due to its operating on a receding horizon.
Another name of MPC is moving horizon optimal control. The current control input is
calculated by solving online, at each control step, a finite-horizon open-loop optimization
problem, using the current state of the plant as the initial state of the optimal problem. The
solution of the optimization problem yields an optimal control sequence over the prediction
horizon and only the first value of the sequence is applied to the plant as the control input
over the prediction steps. At next control step the prediction horizon moves forward and same
procedure repeats. (Mayne, Rawlings, Rao and et al., 2000; Bemporad and Morari, 1999).

MPC is among a few efficient possible methods that are suitable to deal with multi-variable
constrained control problems that appear especially in the process control where a relatively
slow process dynamics makes the optimization computations possible in real time.

The MPC technology that originated from the late 1960s has been developed to a quite mature
level. Many results on stability, optimality and performance tuning are presented in the
literature. However, this technology is challenged by the uncertainty existing in the system,
such as model structure error, state estimation error, actuator error, measurement error and

- 145 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

exogenous disturbances. Stability, performance and constraint satisfaction should be checked


under the uncertainty scenarios (Mayne, Rawlings, Rao and et al., 2000; Bemporad and
Morari, 1999; Mayne, 1999; Primbs and Nevistic, 2000). Robustness of the controller is the
ability to maintain these properties when there are discrepancies in the information on which
the controller design relies, e.g. model mismatch and actuator distortion.

Fulfilling constraints is essential in many process plants for reasons of safety, productivity
and environment protection. In the quality control of DWDS the chlorine residuals should be
maintained within an upper-lower limits. As discussed in the previous chapter there are many
uncertain factors in the system that can affect reaching these objectives. The computed
controller outputs, which are usually based on a model of the plant, may not meet the plant
output constraints due to model mismatch. Feasible control inputs may become infeasible
when they are applied to the plant if there is no controller robustness. Robustness of meeting
output constraints under uncertainties in the system, e.g. uncertainties in models, actuators
and measurements, is the main objective of the robust model predictive controller design in
this chapter. Without prior declaration, robust MPC refers to MPC with “output constraint
satisfaction under uncertainties” in this thesis.

The chapter is structured as follows. First, MPC is introduced and a brief overview of existing
methods for robust MPC design is given. Safety zones are proposed to modify the original
output constraints and with the restricted output constraints the MPC is formulated based on
the nominal model. The outputs over prediction horizon are calculated considering the
uncertainties in the system, yielding a robust output prediction. The control feasibility is
checked by using the robust output prediction. Safety zones are re-designed if the proposed
controls are not robustly feasible. Overall, the designing of the safety zones and control
calculation are performed within an iterative algorithm. Finally, remedy actions are suggested
when the controller operates in practice, and when no solution is found.

Parts of this chapter (Section 5.2, Section 5.4 and Section 5.5) have been presented in (Brdys,
Chang and Duzinkiewicz, 2001; Brdys and Chang, 2002b; Brdys, Duzinkiewicz, Chang and
et al., 2002; Chang and Brdys, 2002; Duzinkiewicz, Brdys and Chang, 2002).

- 146 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

5.1 Model Predictive Controller

5.1.1 Formulation of Model Predictive Controller

s (t ) y (t + H p | t )

y (t + k | t )
r (t )

y (t )
y (t + 2 | t )
y (t + 1 | t )

Past Time Future Time


Time
t t+2
t +1 t+k t + Hm t +Hp
Input

u (t )

u (t + 1 | t )
u (t | t )

Figure 5.1 Operation of the MPC: Basic Idea

The idea of MPC is illustrated in Figure 5.1 (Maciejowski, 2002; Bemporad and Morari,
1999). The current time instant is t and the present output is y (t ) . The previous output is also
shown in the figure. A finite time horizon H p , output prediction horizon, is defined and the

system outputs over the finite horizon [t + 1, t + H p ] are to be controlled. s (t ) is the set-point

trajectory that may be varying depending on the operation of the plant. The objective of the

- 147 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

controller is to track the set-point trajectory (the constant set-point regulation problem is also
included as a special case). A reference trajectory r (t ) is defined starting from the current
time instant and extending over the prediction horizon H p . It considers an ideal or desired

tracking trajectory from the current output to the set-point trajectory. Actually, the reference
trajectory r (t ) defines a closed-loop behaviour of the controlled plant, which is the
performance of the controller. r (t ) can be calculated before running MPC by specifying the
performance of tracking set-point trajectory s (t ) from the current output y (t ) . For example, it
is very convenient to define a first-order or second-order system to describe the tracking
performance and to take the time constant and damping ratio of the reference system as the
tuning knobs of the MPC performance. (Maciejowski, 2002)

The vector of outputs over prediction horizon is defined as:

Yˆ = [ y (t + 1 | t ) L y (t + H p | t )]T (5.1)

where y (t + i | t ), i = 1...H p stands for model output at t + i , and such model prediction is

performed at time instant t .

Control input vector over the prediction horizon is defined as:

T
⎡ ⎤
Uˆ = u (t | t ) L u (t + H m − 1 | t ) u (t + H m − 1 | t ) L u (t + H m − 1 | t )⎥
⎢ (5.2)
⎢ 1444444 424444444 3⎥
⎣⎢ from ( t + H m ) to ( t + H p −1) ⎦⎥

where u (t + i | t ), i = 1...H m are the controller output series produced by the controller at time

instant t , H m is the input horizon and the control input keeps the same value from the end of
the input horizon to the end of the prediction horizon. There may be output and input
constraints on the control input and output values. Let the following inequalities denote the
output and input constraints, respectively:

C y (Yˆ ) ≤ 0 (5.3)

- 148 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

Cu (Uˆ ) ≤ 0 (5.4)

By using the plant model explicitly the output over the prediction horizon Yˆ can be obtained
knowing the current and past states x(t ) , past inputs u (t ) :

Yˆ = M ( x(t ), u (t ), Uˆ , θ ) (5.5)

where M (⋅) denotes the model of the plant, which could be linear or non-linear, time-
invariant or time-varying, and θ is the model parameters. In order to track the reference
trajectory, a performance index V (⋅) is defined, which is also referred to as cost function
because of the inclusion of the control cost in the function. Usually V (⋅) can be defined by
using L1 , L2 or L∞ norms to measure the distance between the predicted outputs and
reference values. If the model is linear and L2 norm is applied, a final optimization problem
is the quadratic one:

Uˆ = arg min V (Uˆ ) = (Yˆ − R)T P(Yˆ − R) + Uˆ T QUˆ (5.6)


subject to: C y (Yˆ ) ≤ 0

Cu (Uˆ ) ≤ 0

where R = [r (t + 1) L r (t + H p )]T are the reference values, C y (⋅) and Cu (⋅) stand for the

constraints on the outputs and inputs, respectively. In order to guarantee stability extra
constraints may be added as well. For instance, constraint on terminal output over the
prediction horizon. The MPC algorithm can now be stated as:

Algorithm of MPC:

1.At time t , obtaining the current state of the plant and other information in the past;
2.Solving optimization problem described in (5.6);
3.Applying only the first control value in the control sequence, that is u (t ) = u (t | t );
4. t ← t + 1 . Go to step 1.

- 149 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

There are also other formulations of MPC such as for unstable system, continuous system and
non-quadratic performance index function (Maciejowski, 2002). There are still some
applications in practice where there is no clearly specified reference for the output. For
instance, in chlorine residual concentration control in the DWDS the objective is to maintain a
minimum chlorine residual concentration in the water distribution network and at the same
time keep the concentration under the upper limit. The particular output trajectory is not very
important in this case. In other words, the reference is a zone instead of a trajectory, which is
shown in Figure 5.2.

Output
Reference
Zone

Time

Figure 5.2 Zone Reference MPC Problem

Two methods can be used to formulate the zone-referenced MPC problem. First, there is no
penalty for outputs in the performance index and the reference zone is to be implemented as
hard constraints:

Y min ≤ Yˆ ≤ Y max (5.7)

where Y min and Y max define the upper and lower limits of the reference zone. Constraint
described by (5.7) can be added into optimization problem described in (5.6) explicitly. This
is called the hard-constraint method. The second method is so-called soft-constraint method
that is to only penalize value of the outputs out of the zone by the following function:

Vz (Yˆ ) = ∑ [ y (t + i | t ) − rl (t + i ) + y (t + i | t ) − ru (t + i ) ]
Hp
(5.8)
i =1

- 150 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

where rl (t + k ), ru (t + k ) are the lower and upper value of the zone output reference,

respectively, for k = 1,..., H p .

Considering the predicted output y (t + i | t ) at time instant t + i , if its value is greater than the
upper limits then:

y (t + i | t ) − rl (t + i ) + y (t + i | t ) − ru (t + i ) = y (t + i | t ) − rl (t + i ) + y (t + i | t ) − ru (t + i )

= 2 * [ y (t + i | t ) − ru (t + i )] + ru (t + i ) − rl (t + i )
(5.9)
and if y (t + i | t ) is less than the lower limit of the zone then:

y (t + i | t ) − rl (t + i ) + y (t + i | t ) − ru (t + i ) = − y (t + i | t ) + rl (t + i ) − y (t + i | t ) + ru (t + i )

= 2 * [rl (t + i ) − y (t + i | t )] + ru (t + i ) − rl (t + i )
(5.10)
If y (t + i | t ) is within the zone then:

y (t + i | t ) − rl (t + i ) + y (t + i | t ) − ru (t + i ) = y (t + i | t ) − rl (t + i ) − y (t + i | t ) + ru (t + i )

= ru (t + i ) − rl (t + i ) (5.11)

Hence, when the optimal control is achieved the performance index takes the minimum value:

Hp
Vz min = ∑ [ru (t + i ) − rl (t + i )] (5.12)
i =1

The method is a kind of “soft constraint” method because the output violations are penalised
instead of fulfilling hard output constraints. The optimization of absolute value performance
index can be converted into linear programming. This kind of formulated controller can be
used as the remedy controller if the first method does not work when there is no feasible
solution in the optimal problem, which will be presented in detail in the last section of this
chapter. Equation (5.8) gives one type of penalty function that can be conveniently used in

- 151 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

MPC formulation. Other types of penalty functions for inequality constrained optimization
can also be found in (Fletcher, 1987; Gill, Murray and Wright, 1982).

5.1.2 Robust MPC based on Uncertain Model: A Brief Overview

5.1.2.1 Uncertainty Modelling

MPC is a kind of time-domain controller design method, as most of the models used in MPC
are time-domain representations. There are two main classes of uncertainty modelling
methods: norm-bounded uncertainty and polytopic uncertainty (Bemporad and Morari, 1999).

Norm-bounded uncertainty representation is the most common method in uncertainty


modelling because of its explicit linking to the physical plant. The most useful time-domain
models in MPC are step response and impulse response, which are used widely in the process
control. For example, the following FIR (Finite Impulse Response) model:

N
y (t ) = y (t − 1) + ∑ h(t )[u (t − k ) − u (t − k − 1)] (5.13)
k =0

where the coefficients are bounded as:

htl ≤ h(t ) ≤ htu (5.14)

The uncertainty representation method can be easily extended to ARMA models. This is also
referred to as set-membership (set-bounded) modelling in the literature of estimation
(Milanese, Norton, Piet-Lahanier and et al., 1996).

Another norm-bounded uncertainty modelling method is structured feedback uncertainty,


which is depicted in Figure 5.3 (Bemporad and Garulli, 2000; Kothare, Balakrishnan and
Morari, 1996).

- 152 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

p(t ) q(t )

x(t + 1) = Ax(t ) + Bu (t ) + B p p(t )


y (t ) = Cx(t )
q(t ) = Cq x(t ) + Dqu (t )
u (t ) y (t )

Figure 5.3 Structure Feedback Uncertainty

Operator ∆ is block-diagonal where each block represents either a memoryless time-varying


matrix with ∆ i (t ) 2 ≡ σ (∆ i (t )) ≤ 1 , or a convolution operator with the operator norm induced
t t
by the truncated L2 norm less than 1 , that is ∑ pi ( j )T pi ( j ) ≤ ∑ qi ( j )T qi ( j ) . Each ∆ i is
j =0 i =0

assumed to be either a repeated scalar block or a full block and models a number of factors,
such as non-linearities, dynamics or parameters, that are unknown, un-modelled or neglected.

Polytopic method is a multiple model paradigm. The following time-varying system is


considered:

x(t + 1) = A(t ) x(t ) + B(t )u (t ) (5.15)


y (t ) = Cx(t )
[ A(t ) B(t )] ∈ Ω

where Ω is a prespecified set that is defined as:

Ω = Co{[ A1 B1 ], [ A2 B2 ], L [ AL BL ]} (5.16)

where Co denotes the convex hull with L vertices [ A1 B1 ],L,[ AL BL ] . The polytopic
model is often used for non-linear plants where the multiple models correspond to the
different operating points.

- 153 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

The issue of which uncertainty modelling method should be used depends on a number of
factors, the physical model of the plant, available model identification/estimation technology
for the particular plant (model) and integration with the controller technology. The bounding
technology, which is also referred to as set-membership or set-bounded estimation
technology, as discussed in Chapter 4, allows computing the bounds on the model parameters
and resulting in worst-case control synthesis considering the uncertainty in the system. It is
the author’s opinion that parameter bounding is the most practical and convenient way to
represent uncertainty in a robust MPC of chlorine residuals in DWDS.

Robustness is the question raised by introducing uncertainty in the system description, which
is stated as maintenance of certain properties such as stability, constraint satisfaction and
performance in the presence of the uncertainty.

5.1.2.2 Formulation of Robust Model Predictive Control: Min-Max Approach

The basic idea of taking account of the uncertainty in MPC is to optimize the worst-case
scenario of the system under uncertainties, where the extreme situation of the system is
considered. It is usually formulated as a Min-Max optimization of the objective function
subject to input and output constraints:

min
ˆ
max V ( x(t ), u (t ), Uˆ , θ ) (5.17)
U UncertainVariables

subject to: C y (Yˆ ) ≤ 0

Cu (Uˆ ) ≤ 0

where the uncertainties lie in the plant state (measurements) x(t ) , past inputs u (t ) , inputs Uˆ
and model parameter θ , these variables can be bounded by using L1 , L2 or L∞ norm.
ARMAX model with bounded parameters has been used in (Veres and Norton, 1993) with
online parameter updating and finite control horizon predictive control was formulated. The
parameters are confined to a polytope. This result is a simplification of the Min-Max
formulation based on the fact that a linear form over a convex polytope can have generic

- 154 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

extrema only at the vertices of the polytope. With parameter update the overall controller is
adaptive and can be used for control of slowly time-varying plant. In (Lee and Yu, 1997), the
open-loop and closed-loop finite control horizon MPC on polytopic uncertain model have
been investigated and the closed-loop formulated MPC was solved by dynamic programming.
Robust stability was achieved in the closed-loop formulated MPC based on time-varying
model when the control horizon is infinite. For the open-loop MPC based on a MA model
with one integrator with ellipsoids uncertainty, Min-Max problem was simplified by
minimizing the upper and lower bounds on the worst-case objective function.

In (Kothare, Balakrishnan and Morari, 1996), infinite horizon MPC was formulated, which is
stimulated by the results that infinite horizon control laws have been shown to guarantee
nominal stability (Muske and Rawlings, 1993; Rawlings and Muske, 1993). Similarly, an
upper bound on the robust performance objective was derived under uncertainty, and the
upper bounds was minimized with a constant state-feedback control law by using LMI
optimization. Both constrained IHMPC (Infinite Horizon MPC) and unconstrained IHMPC
were investigated. In (Cuzzola, Geromel and Morari, 2002) the conservatism has been
reduced by imposing a bound on the performance function that gives an upper bound on the
worst-case performance objective function over infinite horizon. The final resulting
formulation is also a LMI optimization problem.

The main concern of the Min-Max formulation of the MPC is to maintain the stability and
performance under uncertainties. In industrial process control the robustness in maintaining
the performance and constraints is more important. Because many plants themselves are
stable so the stability can be guaranteed if the control horizon in MPC is longer than the
steady time of the plants. It can then be approximately viewed as H ∞ MPC control problem
and the stability can be achieved.

5.1.2.3 Formulation of Robust Model Predictive Control: Reference Governor Approach

Reference trajectory governor approach was used in (Bemporad and Mosca, 1998; Angeli,
Casavola and Mosca, 2001) for a tracking problem, where reference trajectory r (t ) over

- 155 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

prediction horizon are designed not only by defining the MPC performance as described in
Section 5.1.1. Extra constraints are imposed during the reference trajectory generation. The
calculated control inputs under the generated reference trajectory can manoeuvre the system
to the desired state without constraint violation under all uncertain circumstances. The
additional constraints on the reference are calculated based on the uncertainty scenario of the
system. The idea is that the reference trajectory that considered the uncertainty will drive the
system states “far” from the “dangerous zones” where constraint violation may occur.

5.1.2.4 Formulation of Robust Model Predictive Control: Constraint Restriction


Approach

In (Beporad and Garulli, 2000) an output-feedback predictive control with state estimation
under input and measurement uncertainty has been investigated. In order to solve the
optimization problem with infinite constraints by quadratic programming with finite number
of constraints, an extra constraint was imposed on the inputs. The idea is that in order to
maintain the performance or output constraint satisfaction extra constraints are imposed on
the original problem. The new optimization problem results in a more restricted constrained
problem. Hence, the feasible input space is shrinked and that is the price paid for system
uncertainty. The state and input constraint maintenance under uncertainty has been
investigated in (Chisci, Rossiter and Zappa, 2001). Additional constraints on the system states
and inputs have been added, where the constraints can be calculated off-line. However, off-
line computation of the constraints on the states and inputs may result in conservative control
performance. In the next section we will show that by restricting the output constraints with
introduction of so-called safety zones that are updated online at each time step, a less
conservative robust MPC can be implemented.

- 156 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

5.2 Robust MPC by Introducing Safety Zones to Restrict


Output Constraints

As stated in equation (2.1), the objective of water quality control is to maintain the chlorine
residual concentration within an upper-lower bound under uncertain factors in the DWDS.
When the input from the nominal model based MPC controller is applied to the plant, due to
uncertainties in the system, the output constraint cannot be fulfilled and their violations may
be inevitable at certain time instants. The idea to implement constraint satisfaction robustness
is to apply a more restricted output constrains in the MPC by introducing so-called safety
zones, which have been used in an optimal control problem in (Brdys, Duda and Tatjewski,
1998) to improve optimality. If the restriction is suitable then the violation of the modified
constraints can be kept still within the original output constraints. Thus the output constraint
satisfaction can be guaranteed. Safety zone is not a new idea to meet system constraints under
unknown factors. It is widely used in engineering area, such as conservative design in many
electrical devices. The basic idea of introducing safety zones into MPC is depicted in
Figure 5.4, where y min and y max are the lower and upper limits on outputs that are defined in
equation (2.1).

Output σ u (t + k | t )
y max

y smax (t + k | t )
Modified
constraints
y smin (t + k | t )

y min
σ l (t + k | t )
Time
t t+k t + Hp Step
Figure 5.4 Using Safety Zones to Modify Output Constraints

- 157 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

The output constraints modified by safety zones over the prediction control horizon are
defined as follows:

Y min = [ y min L y min ]T

Y max = [ y max L y max ]T

σ l = [σ 1l L σ Hl p ]T (5.18)

σ u = [σ 1u L σ Hu p ]T

Ysmin = Y min + σ l

Ysmax = Y max − σ u

σ il , σ iu are safety zones for the lower constraint and upper constraint at step i over the
prediction horizon, respectively. Choice of the control input is now more restricted. This is
the price to be paid for system uncertainty. Now the optimization problem in MPC becomes:

Uˆ = arg min V (Uˆ ) = (Yˆ − R)T P(Yˆ − R) + Uˆ T QUˆ (5.19)


subject to: Ysmin ≤ Yˆ ≤ Ysmax

Cu (Uˆ ) ≤ 0

With suitable values of σ il and σ iu , real system output under nominal model based MPC may

violate constraints Ysmin , Ysmax because of uncertainties in the system. σ il and σ iu leave

sufficient distance between Ysmin , Ysmax and Y min , Y max . Hence, constraints Y min , Y max can be

maintained under such uncertainty, which is illustrated in Figure 5.5, where the robust output
prediction is used to assess the controls from the nominal model based MPC and to generate
the values of the safety zones.

- 158 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

Robust Real Output Predicted Output


Output from Nominal Model
Output Prediction

y max

y smax (t + k | t )

y smin (t + k | t )

y min

Time
t t+k t + Hp Step

Figure 5.5 Output Constraint is Maintained under Uncertainty

5.2.1 Structure of the Robust Model Predictive Control

Predicted output Predicted output


envelopes envelopes
Safety Zone Robust output prediction Constraint
Generator Violation Checking

Safety
Zones Proposed chlorine Chlorine
Chlorine at
monitored node injection injection to be
blended
MPC Optimizer Control
Acceptance

Figure 5.6 Structure of Robust MPC

The structure of the robust model predictive controller (RMPC) is depicted in Figure 5.6,
which was presented in (Brdys, Chang and Duzinkiewicz, 2000). “MPC optimizer” is a
standard MPC solver as described in Section 5.1 that is based on the nominal model of the

- 159 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

chlorine residuals in DWDS. Before the control input is applied to the plant its robust
feasibility is assessed by the “Constraint Violation Checking” sub-system. Control feasibility
assessment is based on a robust output prediction that is generated by another sub-system
“Robust Output Prediction”. The robust output prediction is the “worst-case” of the plant
output over the prediction horizon that is consistent with the measurement errors, actuator
errors and model uncertainties as presented in Section 4.7.1. The robust output prediction is
an envelope over the prediction horizon:

Y pl = [ y lp (t + 1 | t ) L y lp (t + H p | t )]T (5.20)

Y pu = [ y up (t + 1 | t ) L y up (t + H p | t )]T

where y lp (t + k | t ) and y up (t + k | t ) are the upper and lower limits that bound the plant output

robustly at prediction time step k :

y lp (t + k | t ) ≤ y (t ) |t =t + k ≤ y up (t + k | t ) (5.21)

where y (t ) |t =t + k is the plant output at time instant t + k , which is unknown at present time

instant t but can be bounded by the above inequality. The output assessment can now be
expressed as whether the following conditions are satisfied:

Ypl ≥ Y min and Ypu ≤ Y max (5.22)

If the control feasible assessment is successful then the proposed control value is applied to
the plant. Otherwise, information of the violations, robust output predictions will be fed into
the “Safety Zone Generator” sub-system, where the safety zones are designed according to the
present uncertainty scenarios that contain all of the uncertainties in the systems. With the new
updated safety zones the nominal model based MPC solver is performed again to generate a
new control input. Then the above sequence is repeated until the control feasible assessment
is successful. On overall, the robust model predictive controller structure is an iterative
algorithm. The iteration ends when suitable safety zones have been found. With these safety
zones the control is robustly feasible.

- 160 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

5.2.2 Algorithm of the Robust Model Predictive Control

According to the structure of the controller illustrated in Figure 5.6 the RMPC algorithm can
be obtained. In general, determining suitable safety zones requires a number of iterations to be
performed. The overall robust MPC controller is of iterative type and it operates as follows:

(1) Let [σ l σ u ] = 0 , obtain Uˆ by solving (5.19);

(2) Calculate Y pl , Y pu by using (4.63, 4.64).

If Uˆ is robustly feasible, that is (5.22) is satisfied, go to (4)


Else go to (3);
(3) Redesign [σ l σ u ] , and calculate Uˆ based on this safety-zone design, then go to (2);

(4) Let u c (t ) = u (t | t ) .

In the next section, step (1) and step (2) of the above algorithm will be formulated in detail
and solved. The algorithm for iterative calculation of the safety zone will be described in the
next chapter.

5.3 Formulation of Nominal Model based Model Predictive


Control

We shall formulate a nominal model based MPC (NMPC) in this section by deriving the
expressions of nominal model, output prediction, index function, input constraints, output
constraints, and optimal problem of NMPC, respectively.

- 161 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

5.3.1 Nominal Model

5.3.1.1 Input-Output Model

A parameter piece-wise constant bounded model was obtained in Chapter 4, and the input-
output model is defined by:

y (t ) = b J (t ) (t ) y (t − 1) + ∑ aiJ (t ) (t )u (t − i ) + ε J (t ) (t ) (5.23)
i∈I J ( t )

where the parameters and modelling error are bounded by lower and upper piece-wise
constant values as:

b _ l J ( t ) ≤ b J ( t ) (t ) ≤ b _ u J (t )

a _ liJ ( t ) ≤ aiJ ( t ) (t ) ≤ a _ uiJ ( t ) (5.24)

ε _ l J (t ) ≤ ε J (t ) (t ) ≤ ε _ u J (t )

where the modelling horizon is [t 0 , t 0 + TM ] , and the modelling horizon is divided into S

time-slots, the time-slot s j is defined as s j =[t j −1 , t j ] , j = 1...S and t S = t 0 + Tm . Operator

J (⋅) is defined as J (t ) = j , for t ∈ s j . Time-varying parameter and time-invariant parameter

models were obtained in Chapter 4. Time index t in the parameters are used in both cases to
uniformly represent the two types of models. For notation simplicity reason only SISO system
is considered. It can be extended to MIMO systems without a lot of effort. The nominal model
is defined by the nominal scenario of the uncertainty. For instance, let us take the bound
centre as the nominal parameter value at each time-slot S j :

bˆ J ( t ) = [b _ l J ( t ) + b _ u J ( t ) ] / 2

aˆiJ (t ) = [a _ liJ ( t ) + a _ uiJ (t ) ] / 2 (5.25)

εˆ J (t ) = [ε _ l J (t ) + ε _ u J (t ) ] / 2

- 162 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

and the nominal model can be obtained as:

y (t ) = bˆ J (t ) y (t − 1) + ∑ aˆiJ (t )u (t − i ) + εˆ J ( t ) (5.26)
i∈I J ( t )

5.3.1.2 State-Space Model

The parameter piece-wise constant bounded state-space model is as follows (see (3.106)):

cT (t ) = α J ( t ) (t )cT (t − 1) + ∑ fliJ ( t ) (t )u (t − i ) + ε TJ ( t ) (t )
i∈FJ ( t )

y (t ) = ∑ dri J (t )
(t )cT (t − i ) + ∑ aiJ ( t ) (t )u (t − i ) + ε yJ ( t ) (t ) (5.27)
i∈DJ ( t ) i∈I J ( t )

where the horizon partitioning is defined similarly as for the input-output model and the
parameters are bounded as:

α _ l J (t ) ≤ α J (t ) (t ) ≤ α _ u J (t )
fl _ liJ ( t ) ≤ fliJ ( t ) (t ) ≤ fl _ uiJ ( t )

ε _ lTJ (t ) ≤ ε TJ (t ) (t ) ≤ ε _ uTJ (t ) (5.28)

a _ liJ ( t ) ≤ aiJ ( t ) (t ) ≤ a _ uiJ ( t )

dr _ liJ ( t ) ≤ dri J ( t ) (t ) ≤ dr _ uiJ (t )

ε _ l yJ (t ) ≤ ε yJ (t ) (t ) ≤ ε _ u yJ (t )

The nominal model is defined by taking the bound centre as well:

αˆ J (t ) = (α _ l J (t ) + α _ u J (t ) ) / 2

fˆliJ ( t ) = ( fl _ liJ ( t ) + fl _ uiJ ( t ) ) / 2

εˆTJ (t ) = (ε _ lTJ (t ) + ε _ uTJ (t ) ) / 2


aˆiJ ( t ) = (a _ liJ ( t ) + a _ uiJ ( t ) ) / 2 (5.29)

- 163 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

dˆri J ( t ) = (dr _ liJ ( t ) + dr _ uiJ ( t ) ) / 2

εˆ yJ (t ) = (ε _ l yJ (t ) + ε _ u yJ (t ) ) / 2

Finally, the nominal model is obtained:

cT (t ) = αˆ J ( t ) cT (t − 1) + ∑ fˆliJ ( t ) u (t − i ) + εˆTJ ( t )
i∈FJ ( t )

y (t ) = ∑ dˆri J ( t ) cT (t − i ) + ∑ aˆiJ ( t ) u (t − i ) + εˆ yJ ( t ) (5.30)


i∈DJ ( t ) i∈I J ( t )

5.3.1.3 Matrix Expression of the Model: Input-Output Model

It is assumed without loss of generality that εˆ J (t ) = 0 . As parameter structure I J (t ) may

change over prediction horizon, it is not easy to write the predicted outputs neatly. In order to
make the formulation of the nominal model based MPC (NMPC) simple we extend the model
parameters by introducing some zero parameters:

max I
y (t ) = bˆ J (t ) y (t − 1) + ∑ aˆiJ (t )u (t − i ) (5.31)
i =1

where I max = max( U I j ) , which is the maximum delay number over the control horizon.
j =1...S

Now, it is trivial to convert the above equation into state-space model expression by taking
x(t ) as state-variable:

⎧⎪ x(t + 1 ) = AJ ( t ) x(t) + Bu(t)


⎨ (5.32)
⎪⎩ y(t) = C J ( t ) x(t)

⎡ y (t − 1) ⎤
⎢ u (t − 1) ⎥
⎢ ⎥
where x(t ) = ⎢ u (t − 2) ⎥ , matrices AJ ( t ) , B, C J (t ) are defined as:
⎢ ⎥
⎢ M ⎥
⎢⎣u (t − I max )⎥⎦
( I max +1)×1

- 164 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

⎡bˆ J ( t ) aˆ1J ( t ) aˆ 2J ( t ) L aˆ IJmax


(t )
−1
(t ) ⎤
aˆ IJmax ⎡0 ⎤
⎢ ⎥ ⎢1 ⎥
⎢ 0 0 0 L 0 0 ⎥ ⎢ ⎥
⎢ 0 1 0 L 0 0 ⎥ ⎢0 ⎥
AJ ( t ) =⎢ ⎥ ,B = ⎢ ⎥ (5.33)
⎢ 0 0 1 L 0 0 ⎥ ⎢0 ⎥
⎢ L ⎥ ⎢M⎥
⎢ ⎥ ⎢ ⎥
⎢⎣ 0 0 0 L 1 0 ⎥⎦ ( I +1)×( I +1) ⎢⎣0⎥⎦ ( I max +1)×1
max max

[
C J ( t ) = bˆ J ( t ) aˆ1J (t ) aˆ 2J ( t ) L aˆ IJmax
(t )
−1 aˆ IJmax ]
(t )
1×( I max +1)

In order to distinguish the above state-space expression of input-output model from the state-
space model obtained previously, let us call it matrix expression of the model.

5.3.1.4 Matrix Expression of the Model: State-Space Model

Similarly as processing input-output model zero valued parameters are introduced and it is
assumed that the nominal value of modelling error is zero. The nominal model can now be
written into:

max If
cT (t ) = αˆ J ( t ) cT (t − 1) + ∑ fˆliJ (t ) (t )u (t − i )
i =1 (5.34)
max Id max Iu
y (t ) = ∑ dˆri J ( t ) (t )cT (t − i ) + ∑ aˆ iJ ( t ) u (t − i )
i =1 i =1

where If max = max( U F j ) , Id max = max( U D j ) and Iu max = max( U I j ) . The above
j =1... S j =1... S j =1... S

⎡ cT (t − 1) ⎤
⎢ M ⎥
⎢ ⎥
⎢cT (t − Id max )⎥
model can be converted into matrix expression by taking x(t ) = ⎢ ⎥ as
⎢ u (t − 1) ⎥
⎢ M ⎥
⎢ ⎥
⎢⎣ u (t − I max ) ⎥⎦ ( Id max + I max )×1

state variable, where I max = max( If max , Iumax ) . The matrix expression of the state-space
model can be written as:

- 165 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

⎧⎪ x(t + 1 ) = AJ (t ) x(t) + Bu(t)


⎨ (5.35)
⎪⎩ y(t) = C J (t ) x(t)

where
⎡α J ( t ) 0 0 L 0 0 fˆl1J ( t ) fˆl2J (t ) fˆl3J ( t ) L fˆl IfJmax
(t )
−1 fˆl IfJmax
(t )
0 L 0⎤
⎢ ⎥
⎢ 0 1 0 L 0 0 ⎥
⎢ 0 0 1 L 0 0 ⎥
⎢ ⎥
⎢ L ⎥
⎢ 0 0 0 L 1 0 ⎥
AJ ( t ) =⎢ ⎥
⎢ 0 0 0 L 0 0 0 L 0⎥
⎢ ⎥
⎢ 0 1 0 L 0 0 0 L 0⎥
⎢ 0 0 1 L 0 0 0 L 0⎥
⎢ ⎥
⎢ L L ⎥
⎢⎣ 0 0 0 L 0 0 0 1 0⎥⎦

B = [0 L 0 1 0 L 0 0 L 0]
T
(5.36)

[
C J ( t ) = dˆr1J ( t ) L dˆrIdJ max
(t )
aˆ1J ( t ) L aˆ IuJ (max
t)
0 L 0 ]

where the dimensions of the matrices are dim( AJ ( t ) ) = ( Id max + I max ) × ( Id max + I max ) ,

dim( B) = ( Id max + I max ) × 1 and dim(C J ( t ) ) = 1 × ( Id max + I max ) , respectively.

5.3.1.5 Output Predictions

It has been shown that both of the input-output model and state-space model can be written
into matrix form and the matrix expressions are in the same format. Furthermore, the MIMO
system can be presented in the same way with suitable dimensions of matrix A, B, C . Hence,
MPC formulation is the same regardless of the number of inputs or outputs. Now it is
convenient to write the system outputs based on the following system model:

⎧⎪ x(t + 1 ) = AJ (t ) x(t) + Bu(t)


⎨ (5.37)
⎪⎩ y(t) = C J (t ) x(t)

- 166 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

At time instant t , let us define the input vector and output vector over prediction horizon H p ,

respectively, as follows:

⎡ u (t | t ) ⎤ ⎡ y (t + 1 | t ) ⎤
⎢ ⎥ ⎢ ⎥
Uˆ = ⎢ M ⎥ Yˆ = ⎢ M ⎥ (5.38)
⎢⎣u (t + H m − 1 | t )⎥⎦ H ×1 ⎢ y (t + H p | t )⎥
m ⎣ ⎦ H p ×1

where H m and H p are defined in Section 5.1.1. The model outputs over prediction horizon

are calculated recursively, giving:

x(t + 1) = AJ (t ) x(t ) + Bu (t | t ) (5.39)

[
⎡ u (t | t ) ⎤
x(t + 2) = AJ (t +1) x(t + 1) + Bu (t + 1 | t ) = AJ (t +1) AJ (t ) x(t ) + AJ (t +1) B B ⎢ ⎥ ]
⎣u (t + 1 | t )⎦
⎡ u (t | t ) ⎤
[
x(t + 3) = AJ ( t + 2) AJ ( t +1) AJ (t ) x(t ) + AJ ( t + 2 ) AJ ( t +1) B ]
AJ (t +1) B B ⎢⎢ u (t + 1 | t ) ⎥⎥
⎢⎣u (t + 2) | t ⎥⎦

......
⎡ u (t | t ) ⎤
0 ⎡ 1 1 ⎤⎢ ⎥
x(t + k ) = ∏ AJ (t + i ) x(t ) + ⎢( ∏ AJ (t + i ) ) B ∏ AJ (t + i ) ) B L B ⎥ ⎢ M ⎥
i = k −1 ⎣ i = k −1 i =k −2 ⎦
⎢⎣u (t + k − 1 | t )⎥⎦

......
⎡ u (t | t ) ⎤
⎢ M ⎥
0 ⎡ 1 1 ⎤ ⎢ ⎥
x(t + H p ) = ∏ AJ (t + i ) x(t ) + ⎢( ∏ AJ (t + i ) ) B ∏ AJ (t + i ) ) B L B ⎥ ⎢u (t + H m − 1 | t )⎥
i = H p −1 ⎢⎣ i = H p −1 i= H p −2 ⎥⎦ ⎢ ⎥
⎢ M ⎥
⎢⎣u (t + H m − 1 | t )⎥⎦

Finally, the outputs can be written as:

Yˆ = FR × x(t ) + MR × E × Uˆ (5.40)

- 167 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

where FR × x(t ) is the free response of the system and the second part of the above equation

is the forced response manipulated by input Uˆ , and the matrices are defined as:

⎡ C J ( t +1) AJ ( t ) ⎤
⎢ C ⎥
⎢ J ( t + 2 ) AJ ( t +1) AJ ( t ) ⎥
⎢ M ⎥
FR = ⎢ 0 ⎥ (5.41)
⎢C J ( t + Hp −1) i = H∏−2 AJ ( t +i ) ⎥
⎢ 0
p

⎢ C J ( t + Hp ) ∏ AJ ( t +i ) ⎥
⎢⎣ i = H p −1 ⎥⎦

⎡ C J ( t +1) B ⎤
⎢ C ⎥
⎢ J ( t + 2 ) AJ ( t +1) B C J (t + 2) B ⎥
⎢ L ⎥

MR = ⎢ C
1 ⎥
J ( t + k ) ∏ AJ ( t + i ) B L C J(t +k ) B ⎥
⎢ i = k −1

⎢ L ⎥
⎢C C J(t + H ) B ⎥
1 1
J ( t + H p ) ∏ AJ ( t + i ) B C J (t + H p ) ∏ AJ (t +i ) B L
⎢⎣ i = H p −1 i= H p −2 p ⎥⎦

and
⎡1 0 L 0 0⎤
⎢0 1 L 0 0⎥⎥

⎢ L ⎥
⎢ ⎥
0 0 L 0 1⎥
E=⎢
⎢0 0 L 0 1⎥
⎢ ⎥
⎢0 0 L 0 1⎥
⎢ L ⎥
⎢ ⎥
⎢⎣0 0 K 0 1⎥⎦ H ×H
p m

where matrix E extends Uˆ defined over input horizon [1, H m ] to prediction horizon

[1, H p ] by keeping the same value from the end of the input horizon H m to the end of the

prediction horizon H p .

- 168 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

5.3.2 Performance Index

V (Uˆ ) = Uˆ T QV Uˆ + µ[ y (t + H p | t ) − y r ]2 (5.42)

where QV is a positive-definite matrix. The first part of the index is to minimise the total
control energy and at the same time to attempt avoiding abrupt control value changes. For the
water quality control by chlorine injection, this part is to minimize the total chlorine dose
applied. The terminal output is penalized by the second part of the index function, which
tends to manoeuvre the terminal output close to the reference value yr by applying a tuning
knob µ .

The tuning knob µ can be used to tune the controller performance online. Its value can be
taken as µ = 1.0 at initial. The terminal output reference value yr can be also used as another
online tuning parameter depending on the operational conditions. The initial value can be set
at yr = ( y max + y min ) / 2 .

The weighting matrix QV is used to control the total chlorine injection dose and to smooth the
control input to avoid abrupt change of the inputs. In order to control the total dose the
simplest weighting matrix that can be used is the identity matrix I ( H m ) . From the end of

input horizon H m control value keeps unchanged to the end of prediction horizon H p . Thus,

the weighting matrix of chlorine dosing is:

⎡1 ⎤
⎢ O ⎥
Wdose = ⎢ ⎥ (5.43)
⎢ 1 ⎥
⎢ ⎥
⎢⎣ H p − H m + 1⎥⎦
H m ×H m

In order to smooth the input variations the following term is introduced:

H m −1
∑ [∆u (t + i )]
2
(5.44)
i =0

- 169 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

where ∆u (t + i ) = u (t + i ) − u (t + i − 1) (5.45)

The term can then be written as:

Hm
∑ [∆u (t + i )] = Uˆ D DUˆ − 2u (t | t ) × u (t − 1) + u (t − 1)
2 T T 2
(5.46)
i =0

where
⎡1 0 0 0 L 0 0⎤
⎢− 1 1 0 0 L 0 0⎥⎥

D = ⎢ 0 −1 1 0 L 0 0⎥ (5.47)
⎢ ⎥
⎢ L ⎥
⎢⎣ 0 0 0 0 L −1 1⎥⎦ H × H
m m

Now the performance index can be written as:

V (Uˆ ) = Uˆ T QV Uˆ + µ [ y (t + H p | t ) − yr ]2 − 2u (t − 1) × u (t | t ) (5.48)

where QV = ρ × Wdose + D T D , ρ is a tuning parameter of MPC, which can be set as ρ = 1.0 .

Substituting y (t + H p | t ) in (5.40) into the above equation yields:

1
V (Uˆ ) = Uˆ T QUˆ + f TUˆ (5.49)
2

where Q = 2 × [QV + µW TW ] (5.50)

f T = [− 2u (t − 1) 0 L 0] + 2µ × [C J ( t + H p ) × ∏ AJ ( t +i ) × x(t ) − y r ] × W
0

i = H p −1

⎡ 1 1 ⎤
W = C J (t + H p ) ⎢( ∏ AJ (t + i ) ) B ∏ AJ (t + i ) ) B L B ⎥ E
⎢⎣ i = H p −1 i = H p −2 ⎥⎦

where dimensions of Q and f T are dim(Q) = H m × H m and dim( f T ) = 1 × H m , respectively.

- 170 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

5.3.3 Input Constraints

The input constrains are mainly due to the limitation of the chlorine booster station. Like
other actuator limitation the constraints are expressed as the amplitude and rate limitations:

u min ≤ u (t ) ≤ u max (4.51)

∆u min ≤ u (t + 1) − u (t ) ≤ ∆u max

Over the prediction horizon the input constraints are written as:

lb ≤ Uˆ < ub (5.52)
⎡u min ⎤ ⎡u max ⎤
⎢ ⎥ ⎢ ⎥
where lb = ⎢ M ⎥ and ub = ⎢ M ⎥
⎢u min ⎥ ⎢u max ⎥
⎣ ⎦ ⎣ ⎦

and Q _ A1Uˆ ≤ Q _ b1 (5.53)

⎡ ∆u max + u (t − 1) ⎤
⎢ ⎥
⎢ ∆u max ⎥
⎢ M ⎥
⎢ ⎥
⎡ D ⎤ ⎢ ∆u max ⎥ , where D is defined in Section 5.3.2.
where Q _ A1 = ⎢ ⎥ and Q _ b1 =
⎣− D ⎦ ⎢ − ∆u − u (t − 1)⎥
min
⎢ ⎥
⎢ − ∆u min ⎥
⎢ M ⎥
⎢ ⎥
⎢⎣ − ∆u min ⎥⎦

The dimensions of the matrices are dim(Q _ A1 ) = (2 H m ) × H m and dim(Q _ b1 ) = (2 H m) × 1 ,


respectively.

- 171 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

5.3.4 Output Constraints

The output constraints over prediction horizon can be written as:

Ysmin ≤ Yˆ ≤ Ysmax (5.54)

where the constraint bounds are modifications of the original ones by introducing the safe-
zones as defined in (5.18).

Substituting the output prediction (5.40) into the above equation the output constraints can be
summarised as:

Q _ A2Uˆ ≤ Q _ b2 (5.55)

⎡ MR × E ⎤ ⎡ Ysmax − FR × x(t ) ⎤
where Q _ A2 = ⎢ ⎥ and Q _ b2 = ⎢ min ⎥ , the dimension of the matrices
⎣− MR × E ⎦ ⎣− Ys + FR × x(t )⎦
are dim(Q _ A2 ) = (2 H p ) × H m and dim(Q _ b2 ) = (2 H p ) × 1 , respectively.

5.3.5 Optimization Problem of the NMPC: Quadratic Programming

The NMPC optimization problem can now be formulated as the following quadratic
programming problem:

min
ˆ
U
{
V (Uˆ ) }
Subject to: lb ≤ Uˆ ≤ ub (5.56)
Q _ A × Uˆ ≤ Q _ b

1 ⎡ Q _ A1 ⎤ ⎡ Q _ b1 ⎤
where V (Uˆ ) = Uˆ T QUˆ + f TUˆ , Q _ A = ⎢ ⎥ and Q _ b = ⎢Q _ b ⎥ .
2 ⎣Q _ A2 ⎦ ⎣ 2⎦

- 172 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

The control inputs over the prediction horizon can be calculated by solving the quadratic
programming problem with 2 × ( H m + H p ) inequality constraints:

Uˆ = arg min V (Uˆ ) (5.57)


Subject to: lb ≤ Uˆ ≤ ub
Q _ A × Uˆ ≤ Q _ b .

5.4 Uncertainties in the System

The robust feasibility of fulfilling output constraint is achieved through online evaluation of
the uncertainties in the system. We shall first illustrate the uncertain factors involved in such
evaluation.

5.4.1 Parameter Bounded Model

The MPC formulated above is based on the nominal model. However, the real plant outputs
may have discrepancy from the predictions based on the nominal model. Hence, the control
inputs may not be feasible in reality under real disturbance scenarios in the plant. The
uncertainties are modelled by bounded model parameters expressed by (5.24) and (5.28) for
input-output model and state-space model, respectively.

5.4.2 Measurement Errors

The chlorine residual concentration in water can be measured by using amperometric test
method. The accuracy achieved can be ± 1% of the reading, the sensitivity can be

- 173 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

± 1 ppb ( 1 × 10 −3 [mg / l ] ) and delay in the measurement can be less than 10 seconds
(AccuChlor2TM Residual Chlorine Measurement System, 2002). So the measurement errors
and delay introduced by the sensor and instrumentation is not very significant. However, the
purpose of the water quality control is not only to implement the chlorine concentration at one
particular node. The average chlorine concentration in the monitored node representative area
is wanted instead. It is assumed that the average concentration of the area can be represented
by the chlorine concentration at the sensor location (this is also a criterion of monitoring node
locating) with errors that are not known but can be bounded:

y m (t ) = y (t ) + ε m (t )

cTm (t ) = cT (t ) + ε m (t ) (5.58)

ε mmin ≤ ε m (t ) ≤ ε mmax

where y m (t ) and cTm are the measured outputs in the monitored node and in the tank,

respectively, and y (t ) and cT (t ) are the real plant outputs in the DWDS, ε mmin and ε mmax are

lower and upper bounds on the measurement error ε m (t ) . The time delay occurring in the
measurements is neglected, compared with large delay in the plant dynamics. The bounding
of the measurement error can only be obtained during the field tuning and it also depends on
the DWDS operation condition. Thereby, it should be used as an online tuning parameter of
the controller.

5.4.3 Actuator Errors

Chorine residuals in the water are added into the water by using chlorine gas or chlorine
dioxide. In order to maintain the chlorine residual concentration at the injection node at the
desired value, chlorine booster station is the common automated facility applied in the
drinking water distribution systems. The chlorine booster station regulates the chlorine
concentration in the outflow of the station at the pre-set value. The preset value can be tuned
online or remotely through SCADA (Supervisory Control And Data Acquisition) system. The
concentration regulation is implemented by a local controller, typically the controller is of
- 174 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

PID type. The structure of the local controller and the chlorine booster station is illustrated in
Figure 5.7.

Local Controller + u c (t ) from MPC



(PID) -
Chlorine
Booster
Station

cin (t ) u (t ) implemented at
DWDS

Figure 5.7 Structure of Chlorine Booster Station and Local Controller

The controller outputs from the MPC u c (t ) are tracked at the chlorine booster station with
certain actuator errors:

u (t ) = u c (t ) + ε a (5.59)

ε amin ≤ ε a ≤ ε amax

where u (t ) is the chlorine residual concentration implemented by the chlorine booster station

in the DWDS, u c (t ) is the control output from the MPC, which is the set-point of the local

controller, and ε amin , ε amax are the bounds on the actuator error ε a .

5.5 Control Feasibility Assessment

Set bounded model of uncertainty that is used in this paper enables us to calculate upper and
lower envelopes bounding real plant response to a specific input. Comparing these envelopes
with the bounds defining the plant output constraints allows assessing the input feasibility. In
Section 4.7.1 the robust output prediction has been defined. We shall now formulate ROP

- 175 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

based on the IO model and the SS model, respectively. An algorithm for the envelope
calculation shall now be presented.

As described in Section 4.7.1, the plant output prediction at t over [t + 1, t + H p ] is performed

based on a priori information contained in the past inputs and output measurements, future
inputs, input-output model equations and uncertainty bounds. This a priori information has
been described in a form of equalities and inequalities constraining outputs over [t + 1, t + H p ]

that is described by equation (4.57). Any output trajectory satisfying these constraints can be
the plant response. The robust output prediction provides the intervals:

Y pl = [ y lp (t + 1 | t ) L y lp (t + H p | t )]T (5.60)

Y pu = [ y up (t + 1 | t ) L y up (t + H p | t )]T

over [t + 1, t + H p ] bounding the plant output values over [t + 1, t + H p ] . Hence,

y lp (t + k | t ) ≤ y (t + k ) ≤ y up (t + k | t ) , for k = 1, L , H p (5.61)

The robust prediction over the prediction horizon is illustrated in Figure 4.7. The robust
prediction is run in a batch form. When the kth step prediction is performed all the
information prior to kth step time instant are involved in. The prediction can also be operated
recursively but the results are more conservative because of the propagation of the uncertainty
in the system. The advantage of the recursive algorithm is the computation efficiency. An
alternative algorithm is a mixture of the batch and recursive methods. In (Brdys, 1999) a
moving window over the time horizon is introduced to represent the a priori knowledge of
uncertainty in the past. By tuning the size of the time window, prediction performance and
computation efficiency can be balanced. In this case, recursive algorithm is the special case of
the moving window method with window size equal to 0. It is assumed that the computation
time does not limit the controller actions in real time and the prediction conservatism is more
important in controller implementation. Hence, the batch method will be used in the following
formulation.

- 176 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

5.5.1 Robust Output Prediction: Based on Input-Output Model

Based on the set-bounded model of (5.23) and uncertainty analysis in Section 5.4, the
constraints bounding the plant output at t + k can be summarised as:

Uncertainties in the model: (5.62)


ε _ l J (t +1) ≤ y (t + 1 | t ) − b J (t +1) y (t ) − ∑ aiJ (t +1) u (t + 1 − i ) ≤ ε _ u J (t +1)
i∈I J ( t +1)

ε _ l J (t + 2) ≤ y (t + 2 | t ) − b J (t +2 ) y (t + 1 | t ) − ∑a i
J (t +2)
u (t + 2 − i ) ≤ ε _ u J (t + 2 )
i∈I J ( t + 2 )

ε _ l J (t + k ) ≤ y (t + k | t ) − b J (t + k ) y (t + k − 1 | t ) − ∑ ai
J (t +k )
u (t + k − i ) ≤ ε _ u J ( t + k )
i∈I J ( t + k )

Uncertainties in the measurements: (5.63)


y m (t ) − ε mmax ≤ y (t ) ≤ y m (t ) − ε mmin

where ε mmin , ε mmax are defined in (5.58).

In the above equations when the time indices in the inputs are ≥ t , the inputs are replaced by
the control inputs generated by the NMPC:

u c (t + i ) = u c (t + i | t ), i = 0,..., H p − 1

Uncertainties in the actuator: (5.64)


ε amin ≤ u (t + 1 − i ) − u c (t + 1 − i )) ≤ ε amax , any i ∈ I J ( t +1)

ε amin ≤ u (t + k − i ) − u c (t + k − i ) ≤ ε amax , any i ∈ I J (t +k )

where ε amin , ε amax are defined in (5.59).

- 177 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

Each equation above imposes a constraint on the variable y (t + k | t ) . Set Y pk has been

defined in (4.57) to denote the set of all y (t + k | t ) satisfying the above constraints. For input-
output model based formulation the set can be written as:


Y pk ={ y (t + k | t ) ∈ R : conditions described by (5.10), (5.30) − (5.32)} . (5.65)

Variables in the above equations can be summarized as:

V p ,t + k = { y (t + k | t ), y (t + k − 1 | t ),..., y (t + 1 | t ), y (t ) , (5.66)

u (t + duupper ),..., u (t ),..., u (t − dulower ) ,

b j1 ,..., b j z , aij1 , i ∈ I j1 ,..., aij z , i ∈ I j z }

where duupper = max (i − j ) and dulower = − min (i − j ) . It is assumed that time


i =1...k , j∈I J ( t +i ) i =1...k , j∈I J ( t +i )

horizon [t + 1, t + k ] only covers time-slots from j1 to jz , which is


{ j1 ,... j z } ∈ {J (t + 1),..., J (t + k )} .

Notice, that the parameters are different variables if J (t + k ) = j changes its values when new
time-slot is reached. It should be pointed out that time-invariant model is applied in the above
formulation. For time-varying model, constraints in equation (5.62) becomes equality
constraints and parameters become b J (t +k ) (t ), a iJ ( t + k ) (t ) , which means new variables are

introduced at each time step.

Hence, the k th step robust output prediction at time instant t based on IO model can be
defined as:
y lp (t + k | t ) = min [ y (t + k | t )] (5.67)
V p ,t + k

subject to y (t + k | t ) ∈ Y pk

y up (t + k | t ) = max [ y (t + k | t )] (5.68)
V p ,t + k

subject to y (t + k | t ) ∈ Y pk

- 178 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

5.5.2 Robust Output Prediction: Based on State-Space Model

Robust output prediction based on state-space model can be formulated in a similar way as in
the previous section. Again, we shall consider a time-invariant model only. At time instant t
the k th step robust output prediction is formulated as:

Uncertainties in the model: (5.69)


ε _ lTJ (t −dtlower ) ≤
cT (t − dtlower | t ) − α J ( t −dtlower ) cT (t − dtlower − 1) − ∑ fli
J ( t − dtlower )
u (t − dtlower − i )
i∈FJ ( t − dt )
lower

≤ ε _ uTJ ( t −dtlower )
M
J ( t + dtupper )
ε _ lT ≤
J ( t + dtupper ) J ( t + dtupper )
cT (t + dt upper | t ) − α cT (t + dt upper − 1 | t ) − ∑ fli u (t + dt upper − i)
i∈FJ ( t + dtupper )

≤ ε _ uTJ (t + dtlower )

ε _ l yJ (t +1) ≤ y (t + 1 | t ) − ∑ dri J (t +1) cT (t + 1 − i ) − ∑ aiJ (t +1) u (t + 1 − i) ≤ ε _ u yJ (t +1)


i∈DJ ( t +1) i∈I J ( t +1)

ε _ l yJ (t + 2 ) ≤ y (t + 2 | t ) − ∑ dri
J (t +2)
cT (t + 2 − i ) − ∑ aiJ ( t + 2) u (t + 2 − i ) ≤ ε _ u yJ ( t + 2 )
i∈DJ ( t + 2 ) i∈I J ( t + 2 )

M
ε _ l yJ (t + k ) ≤ y (t + k | t ) − ∑ dri
J (t +k )
cT (t + k − i ) − ∑ aiJ ( t + k ) u (t + k − i ) ≤ ε _ u yJ ( t + k )
i∈DJ ( t + k ) i∈I J ( t + k )

where [t − dtlower , t + dtupper ] are the time intervals of the states involved in expressing outputs.

Uncertainties in the measurements: (5.70)


ε mmin ≤ cTm (t ) − cT (t ) ≤ ε mmax

ε mmin ≤ cTm (t − 1) − cT (t − 1) ≤ ε mmax

M
ε mmin ≤ cTm (t − dtlower ) − cT (t − dtlower ) ≤ ε mmax

- 179 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

where the measurements exist when the time index is less than t .

In the above equations when the time index in the inputs is ≥ t , the inputs are replaced by the
control inputs generated by the NMPC:

u c (t + i ) = u c (t + i | t ), i = 0,..., H p − 1

Uncertainties in the actuator: (5.71)


ε amin ≤ u (t − i ) − u c (t − i ) ≤ ε amax , any i ∈ I J ( t +1) , FJ ( t +1)

ε amin ≤ u (t + k − i ) − u c (t + k − i ) ≤ ε amax , any i ∈ I J (t + k ) , FJ ( t + k )

Similarly, a set Y pk can be defined:


Y pk ={ y (t + k | t ) ∈ R : conditions described by (5.14), (5.35) − (5.37)} . (5.72)

Variables in the above equations can be summarized as:

V p ,t + k = { y (t + k | t ), y (t + k − 1 | t ),..., y (t + 1 | t ) (5.73)

cT (t + dtupper | t ) ,......, cT (t + 1 | t ) , cT (t ) , cT (t − 1) ,......, cT (t − dtlower )

u (t + duupper ),..., u (t ),..., u (t − dulower )

α j1 ,..., α j z1
fli j1 , i ∈ F j1 ,......, fli jz1 , i ∈ F jz1

dri j1 , i ∈ D j1 ,......, dri jz 2 , i ∈ D jz 2

aij1 , i ∈ I j1 ,......, aijz 2 , i ∈ I jz 2 }

where dtupper = max (i − j )


i =1,...k , j∈DJ ( t +i )

dtlower = − min (i − j )
i =1,...k , j∈DJ ( t +i )

duupper = max[ max (i − j ), max (i − j )]


i =1,...k , j∈I J ( t + i ) i =1,...dt f , j∈FJ ( t +i )

dulower = − min[ min (i − j ), min (i − j )]


i =1,...k , j∈I J ( t +i ) i =1,...dt f , j∈FJ ( t +i )

- 180 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

It is assumed that time horizon [t + 1, t + k ] only covers time-slots from j1 to jz 2 in the


output equations, and for the prediction of chlorine concentrations in the tank time horizon
[t − dtlower , t + dtupper ] only covers time-slots from j1 to jz1 .

Hence, the k th step robust output prediction at time instant t based on SS model can be
defined as:

y lp (t + k | t ) = min [ y (t + k | t )] (5.74)
V p ,t + k

subject to y (t + k | t ) ∈ Y pk

y up (t + k | t ) = max [ y (t + k | t )] (5.75)
V p ,t + k

subject to y (t + k | t ) ∈ Y pk

5.5.3 Assessment of the Control Feasibility

The robust output predictions over the prediction horizon can be calculated by solving the
optimization problem in (5.67-5.68) or (5.74-5.75). The output constraint satisfaction can now
be stated as whether the predicted plant outputs satisfy the following conditions:

Y pl ≥ Y min and Y pu ≤ Y max (5.76)

then clearly, the assessed control sequences Uˆ is guaranteed to be feasible for any extreme
situation within the uncertainty scenarios. In other words it is robustly feasible.

Calculating the robust output predictions is to solve the optimization problem of (5.67-5.68)
or (5.74-5.75). There are product terms of variables in the equations. In the optimal problem
base on IO model, non-linear constraints are described by equations in (5.62). In the optimal
problem base on SS model, non-linear constraints are described by equations in (5.69).

- 181 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

Hence, it’s a non-linear constrained programming problem. Some non-linear programming


solvers can solve the problem, however, satisfactory computation efficiency and global
optimality may not be achieved. Next, we shall present how to solve this problem by
converting it into a mixed-integer-programming (MIP) problem.

5.6 Approximated Calculation of Robust Output


Prediction: Mixed Integer Programming

Non-linear constrained optimization problems in (5.67-5.68) and (5.74-5.75) are non-convex


and the solution found by mathematical programming algorithms cannot be guaranteed to be
global. The often used existing global optimizing algorithms are not sufficiently efficient for
the application at hand. In order to derive efficient algorithms the problem is approximated by
a mixed-integer linear optimization problem by applying piecewise linearization of the non-
linear terms that are products of the parameters and physical variables. The approximation
error can be easily embedded into the modelling error. The resulting optimizer is global but
produces conservative approximations of the exact bounds. This conservatism can be
controlled by improving the accuracy of the approximation of the original problem.

5.6.1 MIP Introduction

A mixed integer linear programming problem (MIP) is a linear problem with two kinds of
variables: integer variables and continuous variables. The integer variables can take only
integer values, whereas the continuous variables can take any real number as a value. The
classical linear programming can only process continuous variables. In many problems some
variables represent entities that cannot be partitioned. The logical relationships in many
models can be formulated as linear programming with integer variables. Moreover, many

- 182 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

non-linear and non-convex models can be converted into linear programming problems with
integer variables.

5.6.2 Approximating Product Term by Linearization

The non-linear terms in the robust output prediction are both product terms:

f (u1 , u2 ) = u1u2 (5.77)

The variables can be separated by writing the equation into:

1
f (u1 , u2 ) = [(u1 + u2 ) 2 − (u1 − u2 ) 2 ] (5.78)
4

u1 + u2 u −u
introducing new variables y = and z = 1 2 , the product term can be expressed as:
2 2

f (u1 , u2 ) = y 2 − z 2 (5.79)

where the quadratic function y = x 2 can be approximated by piecewise linearization, which is


shown in Figure 5.8:

( y 6, x6)

( y5, x5)
y
( y 4, x 4)
( y3, x3)
( y1, x1) ( y 2, x 2)
x

Figure 5.8 Piecewise Linearization of Non-linear Function

- 183 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

An approximation error is preset in advance and according to this value the variable range is
partitioned and the quadratic curve can be approximated by a number of piecewise linear
functions:

y = y1 + ( y 2 − y1)r1 + ( y3 − y 2)r 2 + ( y 4 − y3)r 3 + ( y5 − y 4)r 4 + ( y 6 − y5)r 5


x = x1 + ( x 2 − x1)r1 + ( x3 − x 2)r 2 + ( x 4 − x3)r 3 + ( x5 − x 4)r 4 + ( x6 − x5)r 5 (5.80)
1 ≥ r1 ≥ i1 ≥ r 2 ≥ i 2 ≥ r 3 ≥ i3 ≥ r 4 ≥ i 4 ≥ r 5 ≥ i5

where ij is integer and rj is real number, ij ∈ {0,1} and rj ∈ R for j = 1,...,5 . The above
equation is also referred to as Special Ordered Inequalities (SOI) (Ogryczak and Zorychta,
1996).

The linearization can also be implemented by the so-called Special Order Set of Type 2
(SOS2):

y = y1λ1 + y 2λ 2 + y3λ 3 + y 4λ 4 + y5λ 5 + y 6λ 6 (5.81)


x = x1λ1 + x 2λ 2 + x3λ 3 + x 4λ 4 + x5λ 5 + x6λ 6
6
∑ λj = 1 and ∀λj ≥ 0, j = 1,...,6
j =1

Condition: At most two adjacent λj , j = 1,...,6 can be nonzero.

The above condition can also be represented by inequalities:

λ1 − i1 ≤ 0
λ2 − i1 − i 2 ≤ 0
λ3 − i 2 − i3 ≤ 0
(5.82)
λ4 − i3 − i 4 ≤ 0
λ5 − i 4 − i5 ≤ 0
λ6 − i5 ≤ 0
5
∑ ij = 1 and ij ∈ {0,1}, for j = 1,...,5
j =1

Both of the SOI and SOS2 formulation can be solved by mixed integer programming. The
comparison of performances of the two formulations of MIP problems has been presented in

- 184 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

(Chen, 1997). The SOI formulation of MIP problem can be efficiently solved compared with
SOS2 formulation. Hence, the robust prediction problem will be linearized into SOI
formulation of MIP problems in the following section.

5.6.3 Problem Formulation

Looking at the robust output prediction (ROP) problem based on input-output model and
state-space model it can be seen that the objective functions are both linear, only the
constraints are non-linear. For k th step calculation the 2k inequality constraints are in the
same form hence can be processed in a similar way for each constraint. The formulation
procedure is illustrated by converting the ROP problem based on input-output model into a
MIP problem. The ROP problem based on state-space can be processed in a similar way.

The linearization error ε L is used to control the approximation accuracy and the calculation
complexity to satisfy the contradict requirements of accuracy and computation complexity.
The first step is to check how many product terms there are in the constraints (5.62). Let
NP denote the total number of product terms in the constraint equations. Each product term is
linearized as described in Section 5.6.2 with a linearization step LN _ Step . Depending on the
variable range and linearization error the number of piecewise linear function needed is
different for different equation. Let LN1i and LN 2i denote the number of piecewise linear

segments in approximating each quadratic function, where i = 1,..., NP . For each product term
LN1i + LN 2i continuous variables, LN1i + LN 2i integer variables and ( LN1i + LN 2i ) × 2
constraints are introduced. Finally the problem can be formulated as:

Objective Function: y (t + k | t ) (5.83)

Variables:
X = [ y (t + k | t ), y (t + k − 1 | t ),..., y (t + 1 | t ), y (t ) , (5.84)
r11,1,..., r11, LN 11 ,......, r1NP ,1 ,..., r1NP , LN 1NP ,

- 185 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

r 21,1 ,..., r 21, LN 21 ,......, r 2 NP ,1 ,..., r 2 NP , LN 2 NP ,

i11,1 ,..., i11, LN 11 ,......, i1NP ,1 ,..., i1NP , LN 1NP ,

i 21,1 ,..., i 21, LN 21 ,......, i 2 NP ,1 ,..., i 2 NP , LN 2 NP ]T

⎡ Amip ⎤
Constraints: ⎢− A ⎥ X ≤ bmip (5.85)
⎣ mip ⎦
1 ≤ r11,1 ≤ i11,1 ≤ r11, 2 ≤ i11, 2 ≤ ...... ≤ r11, LN1 ≤ i11, LN1

......
1 ≤ r1NP ,1 ≤ i1NP ,1 ≤ r1NP , 2 ≤ i1NP , 2 ≤ ...... ≤ r1NP , LN NP ≤ i1NP , LN NP
1 ≤ r 21,1 ≤ i 21,1 ≤ r 21, 2 ≤ i 21, 2 ≤ ...... ≤ r 21, LN1 ≤ i 21, LN1

......
1 ≤ r 2 NP ,1 ≤ i 2 NP ,1 ≤ r 2 NP , 2 ≤ i 2 NP , 2 ≤ ...... ≤ r 2 NP , LN NP ≤ i 2 NP , LN NP

where the row coefficients in Amip are determined by the linearization as in (5.80),

bmip = [ε _ u J (t +1) L ε _ u J (t + k ) − ε _ l J (t +1) L − ε _ l J (t + k ) ] .

There are a number of MIP solvers that can be used to solve the above problem. MOMIP
(Ogryczak and Zorychta, 1996) is used in the thesis.

5.7 Controller Operation under Algorithm Failure

Due to the use of finite control horizon the system may be driven into a region where the
RMPC is unsolvable. The problem is how to identify such infeasible region and maintain the
system within the feasible region. There is research on feasibility and stability of constrained
finite receding horizon control. Given a compact set of the initial conditions a finite horizon
can be found that the feasibility and stability can be guaranteed for linear time invariant
determinant system (Primbs and Nevistic, 2000). As in the water quality control problem, the

- 186 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

system is uncertain, time varying and with delayed inputs, maintaining the control feasibility
by tuning control horizon is a too complex problem.

Safety zones are introduced to modify the output constraints in the RMPC resulting in a
shrunk input space. However, if the uncertainty radius is too large then output constraint
violation is inevitable, and there is no solution of (5.57). Even for the NMPC, feasible
controls cannot be found when the system states are located in certain region. When the
control infeasibility occurs remedy step has to be taken to keep the controller running
continuously. In the following sections four methods are proposed as the backup algorithms
when the RMPC algorithm is unsolvable.

5.7.1 Uncertainty Radius Tuning

An experience based on the computer simulations shows that NMPC is solvable with zero
safety zones. However, after the output constraints have been modified based on the robust
output prediction sometimes the NMPC becomes unsolvable. Although in (Primbs and
Nevistic, 2000) feasibility is maintained for time invariant determinant system by
manoeuvring the system state strictly in the feasible region that is determined by the current
system states, analysis the reason of infeasibility is too complex and almost impossible as the
DWDS system is complex time varying and delayed uncertain system. Notice, that the safety
zones are designed based on the robust output prediction, hence reducing the conservatism in
the robust prediction can enlarge the feasible space of the control input. The uncertainties
involved in the robust output prediction are uncertainties in the system model, measurement
error and actuator error. The main uncertainty source is the uncertainty in the model
parameters and modelling error parts. To reduce the uncertainty in the model the following
steps can be undertaken:

• Calibrate the implicit model of the DWDS. More accurate DWDS simulator can
improve the data quality that is used for model parameter estimation
• In Chapter 4, the model uncertainty radius W has been defined and used for modelling
horizon partitioning. Reducing the value of W max to increase the number of time-slots

- 187 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

over the modelling horizon, a less conservative model can be obtained. However,
more parameters need to be estimated.
• Improve the estimation results in (4.29) by tuning weighted matrix P and Q if time-
invariant model is applied

This method can work assuming that the DWDS is controllable with the present arrangement
of the chlorine injection nodes and monitored nodes.

5.7.2 Output Constraint Relaxation

Compared with potential dangerous effects caused by DPB, the control of relatively instant
healthy hazard effects caused by water-born pathogens is more essential. Hence, the objective
of maintaining a minimum disinfectant concentration is more important than the violation of
the maximum of DBP limitation over a relatively short period. (WHO, 1998)

The injection nodes and the monitored nodes are usually determined based on a nominal
water usage pattern. When DWDS is operated at extreme conditions, such as large
perturbation of water demand, the system is uncontrollable in quality at certain zone of the
DWDS. The output violations are inevitable under such situations and control feasibility
cannot be recovered by reducing model uncertainty. Corresponding to the output points where
violations occurred, the output constraints over the prediction horizon can be adjusted, and
constraints closing to the end of the horizon can be relaxed. The idea is: if risk of violation is
inevitable then we want to postpone the violation occurrence as late as possible. Let
yinc denote the value of the relaxation of the output constraint at the end of the prediction
horizon. The relaxing output constraints can be denoted as:

y min = y min − yinc (5.86)

y max = y max + yinc

- 188 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

This is the simplest method of relaxing the output constraints where the output constraint is
relaxed to the same extent at different time instant over the prediction horizon. More
complicated constraint relaxation algorithm can be developed to implement the control
feasibility without loss of robustness in reserve output constraint fulfilment at other time
instant where no violation occurs. This is out of the scope of this thesis and will not be further
discussed.

5.7.3 Repeat Last Control Values

Let control inputs calculated at time instant t − 1 be denoted by:

Uˆ t −1 = [u (t − 1 | t − 1), u (t | t − 1), L u (t − 1 + H p − 1 | t − 1)]T (5.87)

At time instant t if the overall optimization problem of RMPC is unsolvable then the control
inputs can be obtained by extending the previous control inputs Uˆ t −1 :

Uˆ t = [u (t | t − 1), u (t + 1 | t − 1), L u (t − 1 + H p − 1 | t − 1), u (t − 1 + H p − 1 | t − 1)]T (5.88)

This method works well if the controller can be driven out of the infeasible region in limited
number of time steps, where the infeasibility is caused by instant but abrupt changes in the
plant or exogenous disturbance, such as pump station starting or stopping, and storage tank
operating state switching in the DWDS. Reflecting in the model such instant but abrupt
changes usually correspond to large uncertainty radius.

5.7.4 Soft Constraint Treatment

In the previous formulation the output constraints are presented explicitly in the MPC
formulation as hard constraints of the optimization problem. However, there are still few

- 189 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

commercial MPC controller tools that can treat output (state) constraints in the hard (explicit)
way due to the practical reason. The output constraints are penalised in the performance index
instead in most of the existing MPC type controllers. It is usually called “soft constraint”
MPC.

As discussed in Section 5.1.2 the chlorine concentration control is a zone reference control
problem and the output violation can be penalised by using L1 norm to measure the distance
of the output to the reference. Performance index (5.42) can now be written as:

V = ∑ [ y (t + i | t ) − rl (t + i ) + y (t + i | t ) − ru (t + i ) ] + q ∑ u (t + i | t )
Hp H m −1
(5.89)
i =1 i =0

H m −1
+ qV ∑ u (t + i | t ) − u (t + i − 1 | t )
i =0

where the purpose of q, qv is the same as QV in (5.42), and let u (t − 1 | t ) denote u (t − 1) for
simplicity. In has been shown in (Abdelmalek, 1977; Chang and Seborg, 1983) that the
absolute value optimization problem can be solved by introducing non-negative variables and
converting the problem into linear programming problem. Let

y (t + i ) − rl (t + i ) = α1i − α 2i i = 1,2,L , H p

y (t + i ) − ru (t + i ) = β 1i − β 2i i = 1,2,L , H p (5.90)

u (t + i − 1) − u (t + i − 2) = γ 1i − γ 2i i = 1,2,L, H m

where α1i ≥ 0 , α 2i ≥ 0 , β 1i ≥ 0 , β 2i ≥ 0 , γ 1i ≥ 0 and γ 2i ≥ 0

Then the absolute value can be written as:

y (k + i ) − rl (k + i ) = α1i + α 2i (5.91)

y (k + i ) − ru (k + i ) = β 1i + β 2i

u (k + i − 1) − u (k + i − 2) = γ 1i + γ 2i

- 190 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

where when y (k + i ) − rl (k + i ) > 0 , we have α1i > 0 and α 2i = 0 , when

y (k + i ) − rl (k + i ) < 0 , we have α1i = 0 and α 2i > 0 , when y (k + i ) − rl (k + i ) = 0 , we have

α1i = 0 and α 2i = 0 , and it is similar for others. The objective function can now be
simplified into:

Hp H m −1
V = ∑ {α1i + α 2 i + β 1i + β 2i } + q ∑ u (t + i | t ) + qV ∑ {γ 1i + γ 2i }
Hm
(5.92)
i =1 i =0 i =1

Other constraints on the inputs Uˆ are the same as before, the output predictions are calculated
by using the nominal model. Finally a constrained linear programming can be formulated and
the inputs can be computed by solving the LP problem:

Uˆ = arg min V (5.93)


Uˆ ,α , β ,γ

subject to: lb ≤ Uˆ ≤ ub
Q _ A1 × Uˆ ≤ Q _ b1
condition on α , β , γ described by (5.90)

where α , β , γ stand for the new variables in (5.90). Existence of a solution of problem (5.93)
can be guaranteed but the output constraint violations are only penalised hence may not be
satisfied under certain circumstances.

5.8 Summary and Remarks

A robust model predictive controller (RMPC) has been obtained in this chapter:

Algorithm 5.1: Robust Model Predictive Control of Chlorine Residuals in DWDS


(1) Let [σ l σ u ] = 0 , solve Uˆ using (5.57);

(2) Calculate Y pl , Y pu by solving (5.67-5.68) or (5.74-5.75).

- 191 -
CHAPTER 5. ROBUST MODEL PREDICTIVE CONTROLLER DESIGN

If (5.76) is satisfied go to (4)


Else go to (3);
(3) Redesign [σ l σ u ] , and calculate Uˆ based on this safety-zone design, then go to (2);

If problem (5.57) is unsolvable with new-designed [σ l σ u ] using the algorithms

suggested in Section 5.8 to calculate Uˆ , go to (4);


(4) Let u c (t ) = u (t | t ) .

There are three computation tasks in the finally derived RMPC algorithm:

• Constrained Quadratic Programming in solving NMPC described by (5.57)


• Mixed Integer Programming in solving ROP described in (5.67-5.68) or (5.74-
5.75)
• Safety Zone Design

Solving (5.57) is a constrained quadratic programming problem and many efficient solvers
exist that computation demand shall not cause difficulty in practice. ROP is a constrained
non-linear programming problem, its non-linear terms are linearized and finally resulting an
MIP problem, where efficient solvers exist. Finding proper safety zones is not straightforward
and the algorithm is to be presented in the next chapter.

Due to complexity of the problem, e.g. non-linearity, constraints and uncertainty, it is difficult
to perform a stability analysis of the designed controller. However, it is convincing that
controller stability can be verified by simulation studies provided sufficiently accurate DWDS
numerical models.

The dynamics of chlorine residuals in DWDS is relatively slow. Typical sampling period
applied may vary from a couple of minutes to one hour. With the existing computation
software and hardware the implementation of the above algorithm is highly possible.
However, even for very simple water network the resulting optimization problem is very
complicated with large number of variables and constraints, which will increase the
computation complexity significantly. That is one of the reasons why a decentralised
implementation of the algorithm is needed, which will be developed in Chapter 8.

- 192 -
Chapter 6

Safety Zone Design for Robust Model


Predictive Control

Section 6.4 has been presented in (Brdys and Chang, 2002b).

6.1 Constrained Nonlinear Programming

6.1.1 Penalty Function and Barrier Function

Non-linear programming is the optimization problem formulated as in (6.1) where both the
objective and constrained functions may be non-linear (Fletcher, 1987).

min f ( x) (6.1)
subject to ci ( x) = 0, i ∈ E

ci ( x) ≤ 0, i ∈ I

- 193 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

where the set of indices E and I denote the equality and inequality constraints in the problem
respectively, the objective function f (⋅) and constraint function ci (⋅) are non-linear. A set of

all x satisfying the equality and inequality constraints is called feasible set. When
numerically solving a general optimization problem stated as above where the constraints
cannot be eliminated easily, it is necessary to balance the aims of minimizing the objective
function and staying inside or close to the feasible region. This leads naturally to the idea of a
penalty function which is a combination of f (⋅) and c(⋅) which enables f (⋅) to be minimized
whilst controlling constraint violations by penalizing them. For example, for the equality
constrained problem the penalty function can be formed as:

1 1
Φ ( x, σ ) = f ( x) + σ ∑ (ci ( x)) 2 = f ( x) + σc( x)T c( x) (6.2)
2 i 2

where the penalty function is the sum of objective function and the sum of the squares of the
constraint violations, parameter σ determines the amount of the penalty. The original
constrained problem can be solved by solving a sequence of minimization problem (Fletcher,
1987):

(i) Choose a fixed sequence {σ (k ) } → ∞ , typically {1,10,102 ,103 ,...} .

(ii) For each σ (k ) find a local minimizer, x(σ (k ) ) say, solving min x Φ ( x, σ (k ) ) .

(iii) Terminate when c( x(σ (k ) )) is sufficiently small.

A variety of results relating to the convergence of the above sequential penalty function can
be found in the literature (Fletcher, 1987; Gill, Murray and Wright, 1982). A penalty function
for the inequality constraint problem can be given in an analogous way as in (6.2):

1
Φ ( x, σ ) = f ( x) + σ ∑ [max(ci ( x),0)]
2
(6.3)
2 i

Another class of sequential minimization techniques is available to solve the inequality


constrained problem, known as barrier function methods. The name is from the property of
preserving strict constraint feasibility at all times, by using a barrier term that is infinite on the

- 194 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

constraint boundaries. This can be advantageous to the penalty function methods if the
objective function is not defined outside the feasible set. The barrier term can be formed as:

−1
Φ ( x, σ ) = f ( x) + r ∑ [ci ( x)] (6.4)
i

or Φ ( x, σ ) = f ( x) + r ∑ log(ci ( x)) (6.5)


i

where r is used to control the barrier function iteration, which is similar to the function of σ
in the penalty function. In this case a sequence of {r ( k ) } → 0 is chosen.

Penalty function methods and barrier function algorithms suffer from the same numerical
difficulties that with σ (k ) increasing or r (k ) decreasing it is increasingly difficult to solve the
minimization problem of (6.2), (6.3) and of (6.4), (6.5) because of the increasing ill-
conditioning of penalty or barrier function (Fletcher, 1987).

6.1.2 Multiplier Penalty Function

As stated in (Fletcher, 1987), the idea of penalty function stated in Section 6.1.1. is to create a
local minimizer x* in the limit σ (k ) → ∞ . However, x* can be determined to minimize Φ
for finite value of σ by locating the origin of the penalty term at proper place. This suggests
using the following function (Fletcher, 1987):

1 1
Φ ( x, θ , σ ) = f ( x ) + ∑ σ i ( ci ( x ) − θ i ) = f ( x ) + ( c ( x ) − θ ) S ( c ( x ) − θ )
2 T
(6.6)
2 i 2

where θ ,σ ∈ R m and S = diag (σ i ) , where m is the number of the constraints. The parameter

θ i correspond to shifts of origin and the σ i ≥ 0 control the size of the penalty, like σ in

(6.2). By introducing extra variable λ ∈ R m , (6.6) can be written into:

- 195 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

1
Φ ( x, λ , σ ) = f ( x) − λT c( x) + c( x)T Sc( x) (6.7)
2

where λi = θ iσ i , i = 1,..., m .

1
∑ σ iθ i in (6.6) is omitted because it is independent on x . There exists a
2
The item
2 i

corresponding optimum value of λ , for which x* minimizes Φ ( x, λ , σ ) . The result is


independent of σ and Φ ( x, λ , σ ) in (6.7) can be written as Φ ( x, λ ) (Fletcher, 1987). λ is
used as control parameter in a sequential minimization algorithm as follows:

(i) Determine a sequence {λ( k ) } → λ* .

(ii) For each λ(k ) find a local minimizer, x(λ(k ) ) say, solving min x Φ ( x, λ ) .

(iii) Terminate when c( x(λ(k ) )) is sufficiently small.

The optimum value λ* is not known in advance so the sequence in step (i) cannot be
predetermined. It will be shown in the next section how to construct the sequence. Because
(6.7) is obtained from (6.2) by adding a multiplier term λT c , (6.7) is often referred to as a
multiplier penalty function. It is also referred to as augmented Lagrangian function because
1 T
objective function f has been augmented by the term c Sc . (Fletcher, 1987)
2

6.1.3 Solving Algorithm

The solving algorithm has been given by Powell (1969) and Fletcher (1987):

Algorithm 6.1:

(i) Initially set λ = λ(1) , σ = σ (1) , k = 0 , c ( 0) =∞.


(ii) Find the minimizer x(λ ,σ ) of Φ ( x, λ , σ ) and denote c = c( x(λ ,σ )) .

- 196 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

1 (k ) 1 (k )
(iii) If c ∞ > c set σ i = 10σ i ∀i : ci > c and go to (ii).
4 ∞ 4 ∞

(iv) Set k = k + 1 , λ(k ) = λ , σ (k ) = σ , c ( k ) = c .


(v) Set λ = λ( k ) − S ( k )c ( k ) and go to (ii).

A convergence rate of 0.25 is to be achieved by adjusting the corresponding penalty factor


σ i in step (iii).

6.2 Formulation of Safety Zones Design Using Multiplier


Penalty Function

In the previous chapter in order to maintain the output constraints, safety zones have been
used to restrict the output constraints of the NMPC. The safety zones are re-designed at each
time step in order to reduce the conservatism. The calculation of safety zones is performed
iteratively. The design of safety zones can be formulated as a constrained non-linear
programming problem by describing the relationship between the safety zones and output
violation as the mapping that is depicted in Figure 6.1. Obviously the mapping is non-linear
as two subsystems in the sequences, the controller output calculation and robust output
prediction, are non-linear mappings from the input to the output.

Robust Robust
Safety NMPC Output Output
Zones Controller Prediction Violation
Output

C (σ l , σ u )
Figure 6.1 Mapping from the Safety Zones to Output Violation

“Robust output violation” is so named because the violations are based on the robust output
prediction. Notice, that for certain values of the safety zones, there may not exist NMPC

- 197 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

controller output. Thereby, the above mapping is not defined. A sufficiently big violation can
be assigned corresponding to such situation in order to maintain the definition of the above
mapping. However, the resulting mapping will be non-smooth, which leads to convergent
problem in solving the finally formulated optimal problem that will be presented in this
chapter. As stated in Chapter 5, when the NMPC is unsolvable, the searching for safety zones
will stop and remedy algorithms proposed in Section 5.7 are applied. Therefore, unsolvable
NMPC situation is excluded in the following discussion, and it is assumed that the above
mapping is defined for any safety zone value in a feasible set that will be defined in the
following sections.

6.2.1 Smooth Function

The output constraint violations over the prediction horizon H p can be defined as:

[
V = [V1 LV2 H p ]T = (Y min − Y pl )T (Ypu − Y max )T ]
T
(6.8)

where Ypl , Ypu are defined in (5.60), and Y min , Y max are defined in (5.18). Under this

definition output constraint violation occurs at certain time step when the corresponding
component of the vector is greater than zero. The objective of maintaining the output
constraint can be stated as:

Vi ≤ 0, i = 1,...,2 H p (6.9)

In (6.3) function max(ci ,0) was used in penalizing the inequality constraints by converting
them into equality constraints. However, the function is not smooth at zero. The derivative
discontinuity at zero will result in slow convergence (Fletcher, 1987). The following smooth
function from (Teo, Goh and Wong, 1991) is applied instead to convert the inequalities into
equality constraints:

- 198 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

⎧ x if x >ε+

f ( x) = ⎨( x + ε ) / 4ε +
+ 2
if −ε+ ≤ x ≤ ε+ (6.10)
⎪ 0 if x < −ε +

where ε + is small positive number. The function is shown in Figure 6.2. Notice, that if
f (Vi ) = 0 holds then (6.9) holds as well. Moreover, the constraint f (Vi ) = 0 can get

arbitrarily close to (6.9) by setting ε + sufficiently small.

f (x)

x
−ε+ ε+

Figure 6.2 Illustration of Function f (x)

Now we can define the robust output constraint violation as:

C (σ l , σ u ) = [ f (V1 ) L f (V2 H p )]T (6.11)

The objective of the safety zone design can now be written as:

C (σ l ,σ u ) = 0 (6.12)

where [σ l σ u ]∈ ∑

∑ ={[σ , σ ] : σ i ≥ 0, σ i ≥ 0, for i = 1L H p and y + σ i ≤ y − σ i }
l u l u min l max u
(6.13)

- 199 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

The above conditions imposed on [σ l σ u ] are needed in order to make sure that the
modified constraints define nonempty set. The multiplier (shifted) type of penalty function
associated with (6.12) can be defined as:

1
Φ (σ l , σ u , Ψ , Λ ) = [C (σ l , σ u )]T Ψ[C (σ l , σ u )] − ΛC (σ l , σ u ) (6.14)
2

where Ψ = diag 2 H pψ i , Λ = [λ1 L λ2 H p ] , λi are the multipliers. Under rather mild

conditions there exists such value Λ* of the multiplier Λ that the safety zones can be
calculated by solving the following problem (Fletcher, 1987):

[σ l σ u ] = arg min Φ (σ l , σ u , Ψ, Λ* ) (6.15)


σl, σu

subject to [σ lσ u ] ∈ ∑

6.2.2 Existence of First Order and Second Order Derivatives

If the optimum value of the penalty function is equal to zero then the wanted safety zones are
found. If it is nonzero then it means that the MPC controller is not able to produce control that
feasibility can be robustly assessed. In this situation, assuming good controllability of the
plant, the uncertainty radius must be reduced in order to regain robustly feasible operation of
the MPC controller. Obviously, a solution for (6.15) is not unique. Finding the smallest safety
zones remains an open problem. Following (Powell, 1969) an algorithm for simultaneous
solving (6.15) and finding Λ* shall be derived. A key assumption needed is second order
Fréchet differentiability of the mapping C (⋅,⋅) . This mapping is a composition of the
mappings describing the nominal model based MPC generation describe by (5.57), robust
plant output prediction described by (5.67-5.68) or (5.74-5.75), and function f (⋅) as depicted
in Figure 6.2. Clearly, the later one is smooth. The former ones are defined by a solution of a
constrained optimization problem parameterised by σ l , σ u and by Uˆ (σ l , σ u ) respectively.
As the parameters enter the constraints the elegant sufficient conditions for differentiability of
the solution do not exist (Hager, 1979; Clarke, 1983). However, for broad class of problems
- 200 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

the differentiability holds (Findeisen, Bailey, Brdys and et al., 1980). Hence, an existence of
all derivatives needed is assumed in the sequel.

6.3 Solution of Multiplier Penalty Formulated Problem

Following Powell’s algorithm as described in Section 6.1.3, the following algorithm solving
safety zones is obtained:

(i) Initially set k = 0, Λ = Λ(1) , Ψ = Ψ (1) , || C ( 0) ||∞ = ∞ ;


(ii)Find the minimizer of (6.14) x(Ψ , Λ) and denote C = C (x) ;
1 1
(iii) If || C ||∞ > || C ( k ) ||∞ , ∀i :| Ci |> || C ( k ) ||∞ set ψ i = 10ψ i , and go to (ii);
4 4
(iv) Set k = k + 1, Λ( k ) = Λ, Ψ ( k ) = Ψ , C ( k ) = C ;

(v) Set Λ = Λ( k ) − Ψ ( k ) C ( k ) and go to (ii) until the constraint is fulfilled with desired
accuracy, where x = [σ l ,σ u ] .

The algorithm can ensure global convergence with the convergent rate of 0.25 by online
tuning in step (iii).

6.4 Approximated Algorithm

If Λ* is known, (6.15) can be attempted by Newton method (Fletcher, 1987). It should be


pointed out that Newton method only solves unconstrained optimization problems. However,
problem described by (6.15) is constrained by [σ l σ u ] ∈ ∑ defined in (6.13). Therefore,
the solution might be on the boundaries of Σ . The following is assumed:

- 201 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

• Newton method searches from the initial point x0 = [ε + , ε + ] that is inside set Σ ,

where ε + denotes safety zone vector and its elements are small positive numbers.
• At least one solution of the safety zone problem (6.15) exists, which is sufficiently
close to x0 , and hence, it is inside the set Σ .

The first assumption can be easily satisfied. It has been found in the simulation studies that in
most cases the second assumption is true. It allows for the searching of solution using Newton
method to be performed within the feasible set throughout the searching process. The second
assumption is also necessary condition to make the Newton method convergent.

Differentiating function Φ (x) with respect to x (see (6.14)) yields:

∇Φ ( x) = AΨC ( x) − AΛ* (6.16)


∇ 2 Φ ( x) = ∇ 2C ( x)[ΨC ( x) − Λ* ] + AΨAT

where x denotes [σ , σ ] for notation simplicity, A = ∇C (x) is the gradient of the


l u

constraints defined as:


[
A = ∇c1 L ∇c2× H p ] (6.17)
∂ci ∂ci T
∇ci = [ L ]
∂x1 ∂x2×H p

Notice, that A is a square matrix. This is due to the very special property of the problem at
hand. Indeed every output constraint is broken into two constraints of upper and lower limits
that are represented by violation Vi , i = 1,...,2 H p (see (6.8)). Hence, dimension of x equals to

the number of constraints in (6.15) (see (6.11)).

For large values of ψ i , the following approximation holds when Ψ is non-singular (pp.291,
Fletcher, 1987):

- 202 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

[ AT Wx−1 A]−1 ≈ Ψ (6.18)

where Wx = ∇ 2 Φ ( x) . Hence, assuming the inverse of A exist,

Wx−1 ≈ ( AT ) −1 Ψ −1 A−1 (6.19)

It is a special property of our problem that A is a square matrix so that existence of A−1 is not
unusual. During the iterations of finding the optimal value of the problem, there exist two
situations:

Case 1: Searching point locates inside set Σ , and no constraint is active. Newton
method can be performed normally.

Case 2: When certain constraints are active, Newton direction is projected onto the
active boundaries that are intersections of certain hyperplanes defined in
(6.13). (Gill, Murray and Wright, 1982; Kelley and Sachs, 1995)

Applying Newton method at Case 1, solution of (6.15) is given as:

x ( k +1) = x ( k ) + δ ( k ) (6.20)

where δ ( k ) = −[∇ 2 Φ ( x) −1 ∇Φ ( x)] x= x( k ) . (6.21)

Corresponding to Case 2, solving (6.15) with the projected Newton method yields:

x ( k +1) = x ( k ) + α k Π [δ ( k ) ] (6.22)
a ( Σ , x( k ) )

where Π a ( Σ , x ) (⋅) denotes the projection onto the active constraint sets that are defined in

(6.13) in our problem, α k is the step length along the resulting search direction that is given

by the projection Π [δ ( k ) ] , and a(Σ, x (k ) ) denote the active constraint set at x = x (k ) .


a ( Σ , x( k ) )

As Π a ( Σ , x ) ( x) = I × x , where I is an identity matrix, (6.20) can be viewed as a special case of

- 203 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

(6.22) with α k = 1 . The constraints defined in (6.13) are linear and simple, and there are only
two forms of constraints:

xi ≥ 0 , for i = 1,...,2 H p (6.23)

xi + xi + H p ≤ y max − y min , for i = 1,..., H p (6.24)

Notice, when (6.24) is active the i th output constraint in the constraint vector Ysmax , Ysmin
modified by these safety zones becomes (see equation (5.18)):

Ysmin i = Ysmax i , where i ∈ [1, H p ] (6.25)

It means that the output must exactly equal to this value, which is very strict output constraint
and there may not exist NMPC solution. As stated in Section 6.2, there will be no safety zone
solution under such condition, and the searching stops.

In each equation described by (6.23) and (6.24) only xi or xi , xi + H p are involved, hence, a

simple “point-wise” like projection and searching step can be defined for α k Π (δ ( k ) )
a ( Σ , x( k ) )

corresponding to (6.23) and (6.24), respectively:

Definition of the Projected Searching Direction:


α k Π a ( Σ , x( k ) ) (δ ( k ) i ) = 0 , when (6.23) is active (6.26)

α k Π a ( Σ , x( k ) ) (δ ( k ) i ) = δ ( k ) i , when (6.23) is not active (6.27)

α k Π a ( Σ , x( k ) ) (δ ( k ) i ) =| δ ( k ) i + H p |
{ , when (6.24) is active and δ ( k ) i |≥| δ ( k ) i + Hp |
α k Π a ( Σ , x( k ) ) (δ ( k ) i + H p ) = − | δ ( k ) i + H p |

α k Π a ( Σ , x( k ) ) (δ ( k ) i ) = − | δ ( k ) i |
{ , when (6.24) is active and δ ( k ) i + Hp ≥| δ ( k ) i |
α k Π a ( Σ , x( k ) ) (δ (k )
i+H p ) =| δ (k )
i |

(6.28)

- 204 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

α k Π a ( Σ , x( k ) ) (δ ( k ) i ) = δ ( k ) i
{ , when (6.24) is not active (6.29)
α k Π a ( Σ , x( k ) ) (δ ( k ) i + H p ) = δ ( k ) i + H p

where δ ( k ) i , for i ∈ [1,2 H p ] denotes the i th component of the vector, and the projection

corresponding to (6.24) and δ ( k ) i |≥| δ ( k ) i + Hp | is shown in Figure 6.3. It must be pointed out
that the convergence of the projected Newton method under the above projection definition is
not proved. There are some results related to such topic, for instance, Kelley and Sachs (1995)
have considered a point-wise projected Newton method for constraints of upper and lower
bounds on the variables. In our application, simulation study shows that the constraints
described by (6.13) are not active in most cases under the assumptions made at the beginning
of the section, hence, we will not further analyse the convergence properties of the algorithm.

xi Newton’s
search
direction
y max − y min δ (k )i
Active
constraint
Projected (6.24)
direction δ ( k ) i+H p
xi + H p
y max − y min

Figure 6.3 Projection when (6.24) is active and under Certain Conditions

Next, we shall reduce the computational complexity of obtaining δ (k ) . Using (6.19) to


substitute ∇ 2 Φ ( x) in δ (k ) , yields:

δ ( k ) = −( AT ) −1[C ( x ( k ) ) − Ψ −1Λ* ] (6.30)

As Λ* does not depend on Ψ as described in Section 6.1.2 then Ψ −1Λ* ≈ 0 for large values
of ψ i . Finally, a greatly simplified algorithm is obtained as:

δ ( k ) = −( AT ) −1 C ( x ( k ) ) (6.31)

- 205 -
CHAPTER 6. SAFETY ZONE DESIGN FOR ROBUST MODEL PREDICTIVE CONTROL

Notice that the iteration (6.31) does not require Λ* any longer. It is surprising at the first
glance. However, the formula (6.31) has a very appealing form. Namely, new safety zones are
calculated by a correction of the present ones using the extend of constraint violation. As
calculating ( AT ) −1 may be still computationally demanding further simplification is proposed

that consist in replacing ( AT ) −1 by constant scalar gain. The resulting algorithm becomes of
standard relaxation type:

δ ( k ) = −νC ( x ( k ) ) (6.32)

where v is the relaxation gain, the possible choice of the relaxation gain is:

ν = max([diag[∇C (0)]]−1 ) (6.33)

where diag[∇C (0)] denotes the diagonal of [∇C ( x)] | x=0 . Finally, the following relaxation
gain algorithm of solving the safety zones is obtained:

Algorithm 6.2:
(i) Set x = [σ l σ u] = 0 ;

(ii) Solve Uˆ using (5.57).


If C ( x) = 0 is satisfied then go to step (v),
else go to step (iii);
(iii) Calculate new safety zones by using δ ( k ) = −νC ( x ( k ) )

If δ (k ) activates certain constraints then the projection defined above is performed:


δ ( k ) i = α k Π a ( Σ , x( k ) ) (δ ( k ) i ) , for i = 1,...,2 H p .

go to step (iv);
(iv) x ( k +1) = x ( k ) + δ ( k ) , go to step (ii);
(v) Set u c (t ) = u (t | t ) .

In Chapter 7, we shall show comparison of the solutions of safety zones found by trying
different values of the relaxation gain.

- 206 -
Chapter 7

Chlorine Residual Control in Drinking


Water Distribution Systems: A Case Study

Chlorine residual control of two DWDS is considered in the case study. First, for a SISO
system, modelling of such DWDS has been presented in Chapter 4. RMPC based on SS or IO
type models are operated over a 24-hour horizon and simulation results are presented.

Next, a benchmark DWDS with two chlorine injection nodes and two monitored nodes is
investigated. A sample of safety-zone design at a time instant is presented. By using different
values of the relaxation gain, safety zone values calculated by using Relaxation Gain method
are compared. Finally, compromise of computation efficiency and accuracy are achieved.
Water demand prediction error is handled by tuning the uncertainty radius of the chlorine
residual model accordingly.

The simulation results shown in Section 7.2 and Section 7.3 have been presented in (Brdys,
Chang and Duzinkiewicz, 2000 and 2001; Brdys and Chang, 2001; Chang and Brdys, 2002;
Duzinkiewicz, Brdys and Chang, 2002).

- 207 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

7.1 Simulation Environment

The model parameter estimation algorithm and the proposed robust model predictive
controller are to be verified by applying the mechanisms in chlorine residual control of
DWDS. The case study is implemented by using computer simulation. The system is
implemented under Matlab / Simulink environment on a SUN station running SUN-OS.

7.1.1 Quadratic Programming Solver

In solving the model parameter estimation problem defined in Chapter 4 and NMPC
optimization problem defined in Chapter 5, a quadratic programming solver that is
constrained by equality and inequality constraints is needed. Optimization toolbox in Matlab
package provides a quadratic solver “quadprog”, which is suitable to perform such task.

7.1.2 Mixed Integer Programming Solver

MOMIP version 2.3 is an optimization solver for middle-size mixed integer programming,
based on the branch-and-bound algorithm (Ogryczak and Zorychta, 1996), which is used to
solve the robust output prediction problem.

MPS (Mathematical Programming Systems) file is used in MOMIP as the data input to
describe the optimal problem. MPS format was originally introduced by IBM to define LP
data and becomes the standard recognised by most of the commercial LP package. In MPS
file, a problem is depicted as a tableau of numbers, in which the objective functions and
constraints correspond to rows, and the variables and the right-hand sides correspond to
columns. The detail and syntax of writing the file can be found in (Ogryczak and Zorychta,
1996). A sample file is given in Appendix C.

- 208 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

The most convenient way of using MOMIP solver in Matlab/Simulink is to compile the
MOMIP source codes into MEX-file (Simulink, 1998). However, MOMIP is written in C++,
and only MEX-files written in C and FORTRAN are officially supported by Matlab (Matlab
Support, 2002). Alternatively, a data interface is designed that receives MPS data from
Matlab/Simulink and passes the MPS data to a separately running MOMIP solver that is
running out of Matlab under the OS. After the MIP problem has been solved the results are
transferred to Matlab/Simulink through the same data interface. The communication between
the MOMIP solver and Matlab/Simulink is implemented by using TCP/IP programming. The
details of the implementation are given in Appendix D.

7.1.3 Water Network Simulator: EPANET

EPANET 2.0 is a software package published in 2000 by National Risk Management


Research Laboratory of United State Environment Protection Agency (Rossman, 2000). The
product is open source software and is widely used in DWDS simulation and design of
hydraulic and water quality behaviour within pressurised pipe networks. The package is
issued with two parts separately, a graphic interface and an algorithm part. It is convenient to
embed the algorithm part into other applications by inserting the source codes of the
simulation algorithms of hydraulics and quality directly. The graphic interface in Windows
makes it convenient to construct the distribution network, calibrate and tune the coefficients
of the network, run the simulation and obtain the result data.

In this thesis, EPANET is used to simulate the hydraulic and chlorine residual dynamics of
the DWDS. The controls of pumps and valves in the DWDS are provided by an integrated
quantity and quality controller at the upper level of a hierarchical structure as described in
Chapter 2. Hence, these operational controls are assumed known. Based on the operational
information a DWDS network file is produced. Running EPANET through the graphic
interface in MS Windows, the generated hydraulics are stored in a flat file, and can then be
read conveniently in Matlab/Simulink for chlorine residual modelling.

- 209 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

To simulate the chlorine dynamics in Matlab/Simulink, the source code of EPANET is


embedded into a C-file discrete S-function for Matlab/Simulink. It is a new feature of
EPANET 2.0 that chlorine residual dynamic solver can be called iteratively. Thus, in the
initialization part of the S-function, hydraulics over the 24-hour simulation horizon is solved
first, then the chlorine dynamics can be solved iteratively at each time step of the discrete S-
function. Chlorine injections are updated at each time interval of the S-function by taking the
S-function input values, which are from the RMPC block. The chlorine concentrations at the
monitored nodes are reported as the S-function outputs.

7.1.4 Main Specifications of the Software and Hardware in the Simulation

The main features of the simulation platform are listed below:

Sun Station: Sparc Ultra-10


CPU: 360 MHz
Memory: 256 MBytes
Operating System: SunOS 5.7
Matlab: Version 5.3 (R11)
Simulink: Version 3.0 (R11)
Optimization Toolbox: Version 2.0 (R11)
EPANET: Version2.0
MOMIP: Version 2.3

7.1.5 Simulation Implementation in Matlab

There are mainly two steps in the case study. First is to obtain the model of the chlorine
residual of the DWDS, which could be IO type or SS type. Quantity and quality data are
needed in order to perform path analysis algorithm and model parameter estimation. Path
analysis requires hydraulic data of water flow and velocity in the network, which can be

- 210 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

obtained by running EPANET in Windows and saving the simulation results into files that are
read by path analysis algorithm implemented in Matlab/Simulink. Experiments are designed
in Chapter 4 to generate the data needed for model parameter estimation. The experiment is
implemented in Matlab by embedding the EPANET source codes into a S-function in
Simulink, which is illustrated in Figure 7.1.

Chlorine
Concentration
Chlorine DWDS at Monitored
Injection (Plant) Nodes
EPANET
S-function S-function

Figure 7.1 Experiment Implementation for Model Parameter Estimation

Next, robust model predictive controller is designed based on the parameter piece-wise
constant bounded uncertain model. The measurement error and the actuator error are
considered in the case study. The Matlab/Simulink simulation implementation of the case
study is illustrated in Figure 7.2.

MOMIP
Solver

Data Communication Interface


TCP/IP Matlab/Simulink
Actuator Simulator
Error
Control ε a (t ) Errorε (t )
s
Objective RMPC c DWDS
u (t ) y (t )
y min , y max Controller ⊕ (Plant) ⊕
u (t ) EPANET yepanet (t )
S-function S-function

ε m (t )
y m (t )

Measurement
Error

Figure 7.2 Simulation Environment Implementation

- 211 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

where ε s , ε m and ε a are random numbers, which denote the simulator error, measurement

error and actuator error, respectively. As stated in Chapter 4, ε s is not handled in parameter

estimation. Hence, it is disturbance input of the obtained model. In MPC operation, ε s can be

treated in a similar way as to ε m . The upper and lower boundaries of these errors are known,
which are the bounds on the errors that will be used in the bounding formulation. The values
of the bounds are set as follows based on the simulation case study results in (Rossman, 2000)
and the operation manual of the chlorine measurement apparatus (AccuChlor2TM, 2002):

ε s (t ) ≤ 5% × yepanet (t )

ε m (t ) ≤ 5% × y (t ) (7.1)

ε a (t ) ≤ 5% × u c (t )

As stated in Chapter 2, the chlorine concentrations at the monitored nodes should be


maintained within 0.20[mg/l]-0.30[mg/l] limits. Hence, y max = 0.30[mg / l ] and

y min = 0.20[mg / l ] . In the following presentation of the simulation results, the chlorine
concentration is scaled by the factor of 0.25[mg/l] as defined in (4.75), so the upper and lower
output limit (0.2[mg/l]and 0.3[mg/l]) is converted into 0.8 and 1.2, respectively:

y min = 0.8 and y max = 1.2 (7.2)

and the output reference is yr = 1.0 unless it is specified additionally. Thus, the bounds on
ε s , ε m and ε a can be set accordingly as:

ε smin = −0.05 ε smax = 0.05

ε mmin = −0.05 ε mmax = 0.05 (7.3)

ε amin = −0.1 ε amax = 0.1

The linearization step that is used to convert the non-linear programming problem into MIP
problem in robust output prediction is set as:

- 212 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

LN _ Step = 0.1 (7.4)

where it has been defined in Section 5.6.2 and Section 5.6.3. The bounds on the linearization
error are estimated as ± 0.025 , which is treated as modelling error in the RMPC design. The
system output is to be maintained around yr = 1.0 and within the upper-lower limit, where
the values are after normalization. Hence, the linearization error is assumed within ± 2.5%.

A 24-hour horizon [0,24] [hour] is considered in the case study for chlorine residual control
by using MPC. Hence, modelling horizon over 36-hour horizon [0,36] [hour] is needed if the
prediction horizon of MPC is 12 hours. To simplify the simulation the modelling is performed
only over [0,24] [hour], model over [24,36] [hour] is obtained by repeating the parameter
values of the model over [0,12] [hour].

7.2 Chlorine Residual Control of a Simple Water Network

Chlorine residual control of the DWDS presented in Figure 4.8 is considered. The RMPC is
operated based on the time-varying SS and IO type models that have been obtained in
Chapter 4. The control period applied is 10 [min]. Thus, there are 144 time steps after
discretization.

As described in Section 5.3.1 the nominal model is obtained by taking the centre value of the
constant bounds on the model parameters. The prediction horizon is set as H p = 36 [time-

step], and control horizon H m = H p .

The coefficients of the simulation and robust output prediction have been described in Section
7.1.5. Performance index of NMPC is defined by setting:

µ = 1.0 (7.5)
ρ = 1.0 (7.6)

- 213 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

y r = 1 .0 (7.7)

where µ and ρ are defined in Section 5.3.2. The input constraints are defined as:

u min = 0.0 u max = 4.0 (7.8)


and ∆u min = −0.2 ∆u max = 0.2 (7.9)

where the above variables are defined in Section 5.3.3.

In calculating the safety zones a relaxation gain ν = 1.0 is used.

Robust model predictive controllers have been developed based on the input-output and state-
space models. The output constraint satisfaction is guaranteed by restraining output
constraints by introducing safety zones, and the controller performance is shown in Figure 7.3
to Figure 7.6. Comparing Figure 7.4 and Figure 7.6, controls are different from about t = 10
[time-step]. The differences are attributed to two reasons. Difference after t = 40 [time step]
mainly reflects the accuracy difference between IO and SS models during draining cycles.
Performance difference over horizon [10,40] [time step] is mainly because of the formulation
difference of the optimisation problem. For RMPC based on SS model, additional variables
may change the searching process in solving the constrained non-linear optimisation problem
in operating the RMPC, and result in different solution.

Simulation results show that controller performance fulfils the requirement of chlorine
concentration, no matter which model is applied. However, there are more parameters in the
input-output model during the switching period, which make the model less accurate in the
draining cycle compared with state-space model. That has been shown in Chapter 4. For
simple water network, this extra uncertainty in parameters may not cause problems in control.
For larger and more complicated network, the model uncertainty may exceed controller ability
(no feasible control can be derived with these uncertainties). In this case, a state-space model
is applied if the chlorine concentrations in the tanks are available. If measurements of chlorine
concentrations in tank are not available, the DWDS can be divided into a number of zones
and the decentralized RMPC is applied in each zone. Modelling is performed within each
zone that is a smaller and simpler DWDS after geographical division.

- 214 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.3 Output under Control of RMPC based on IO Model

Figure 7.4 Control Output of RMPC based on IO Model

- 215 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.5 Output under Control of RMPC based on SS Model

Figure 7.6 Control Output of RMPC based on SS Model

- 216 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

7.3 A Benchmark Drinking Water Distribution Network

A benchmark drinking water distribution system was investigated. The network structure is
illustrated in Figure 7.7, which is adopted from (Bush and Uber, 1998) with minor
modifications to the pump operation and demand pattern. The network file is attached in
Appendix B. There are 16 network nodes, 27 pipes and 3 storage tanks in the system. The
water is pumped from the source (node 100 and node 200) by two pumps (pump 201 and
pump 101) and is also supplied by the tanks (node 17,18,19). Node 16 and node 8 are selected
as monitored nodes as they are the most remote nodes from the source. The chlorine
concentrations at these nodes are the two plant outputs y1 and y2 . In order to maintain the
chlorine concentration at the monitored nodes, two corresponding injection nodes should be
selected. The chlorine concentrations at the injection nodes are the inputs u1 and u 2 , which
are selected deliberately according to the type of the model applied.

201 200
201
5 7

6 18 13 14
12 16
6 13 25 14 26
8
4 15
27

15

11 24
5

7 8 19
23
9 16
17 3
4

22

10
3 9 21 12

18 20

10 19 11
17
100
101 1011 1 2 2

Figure 7.7 A Benchmark Drinking Water Distribution System

- 217 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

The water demand prediction over 24-hour horizon is given in one-hour interval, which is
shown in Figure 7.8. As before, the demand pattern at the nodes is assumed the same and the
water consumption is set by “base demand ” of the node as explained in Section 4.8.1. The
pumps installed at node 101 and 201 are variable speed pump. The pump hydraulic
characteristic curve is given by the following quadratic equation:

∆h = g s (q ) = 373.34 − 2.593 × (q ) 2 (7.10)

where ∆h is the water head increase of the pump, and q is the water flow out of the pump.
The pump operation schedules are given and shown in Figure 7.9 and Figure 7.10 for pump
201 and pump 101, respectively.

There are three tanks, and all of them are switching tank. Under the above pump schedules
quantity operation status of tank 19 is shown in Figure 7.11 by showing the flow to and from
the tank.

Demand for Node 16


0.39
0.37
0.35
0.33
0.31
0.29
0.27
0.25
Demand [MGD]

0.23
0.2
0.18
0.16
0.14
0.12
0.1
0.08
0.06
0.04
0.02
0.0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Time [hours]

Figure 7.8 Water Demand Pattern

- 218 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Flow for Link 201

10.0

9.0
Flow [MGD]

8.0

7.0

6.0

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Time [hours]

Figure 7.9 Pump 201 Operation Schedule over 24-hour Horizon

Flow for Link 101

12.0

11.0

10.0
Flow [MGD]

9.0

8.0

7.0

6.0

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Time [hours]

Figure 7.10 Pump 101 Operation Schedule over 24-hour Horizon

- 219 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Flow for Link 23


2.0

1.0
Flow [MGD]

0.0

-1.0

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Time [hours]

Figure 7.11 Flow in Pipe 23

where it can be found that the filling period of tank 19 is [0, 6] [hour], [12, 19] [hour] and
[20,21] [hour], and the draining period is [6,12] [hour], [19,20] [hour] and [21,24] [hour].

The control period applied is 5 minutes. Thus, the 24-hour control horizon is now converted
into 288 discrete time steps. Timing options in running path analysis algorithm and
discretization are as follows:

∆Th = 1[hour ]

∆Tc = 5 [min] (7.11)

∆TD = 5 [min]
τ = 1 [min]

where the definitions of the above variables are given in Section 4.8.2.

- 220 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

7.3.1 Model of the Benchmark Drinking Water Distribution Network

In order to maintain the chlorine residuals throughout the DWDS it is natural to put the
chlorine injections at node 1 and node 5, which are the nodes that link the reservoir to the
DWDS. Chlorine concentration at node 16 is mainly controlled by the chlorine injection at
node 5, and chlorine concentration at node 8 is mainly controlled by the chlorine injection at
node 1. There are interactions between the two input-output pairs through the flow in pipe 24.
The flow in pipe 24 is shown in Figure 7.12, where the positive direction is defined as from
node 13 to node 8. It can be seen that during most of the time over 24-hour horizon chlorine
injection at node 5 acts on chlorine concentration at node 8 through flow 24. Over period
[9,11] [hour] although the flow direction in pipe 24 changes there is no flow from node 8
getting into node 16, as before the flow from node 8 reaches node 13 the flow direction
recovers. Hence, there is no interaction in the node 1-8 pair on node 5-16 pair. Hydraulic data
show that water flow from tank 17 or tank 18 does not enter node 16 or node 8 at all, which
means that y1 and y 2 only have dynamics caused by tank 19.

Flow for Link 24

1.0
Flow [MGD]

0.0

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Time [hours]

Figure 7.12 Flow in Pipe 24

- 221 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

During draining period of tank 19, water demand at node 8 is mainly fulfilled by flow from
the tank. Hence, controllability is weak during the period. The control objective cannot be
achieved with such input-output arrangement. Hence, node 1 cannot be selected as the
injection node according to the discussion of the injection node location in Section 2.3.1. In
order to improve the controllability on node 8, injection node is moved to node 10. When
applying SS model and taking node 1 as injection node, as stated in Section 4.8.5, chlorine
concentrations in tank can be managed more actively and a strong controllability on node 8
can still be maintained. As stated in Section 2.3.1, the above input-output locations are
assumed as a priori knowledge about the DWDS in this thesis.

7.3.1.1 Input-Output Model

As for IO type model, two booster stations are installed at the nodes 5 and 10, where chlorine
concentrations of the nodes are the two inputs of the system u1 and u 2 . u1 mainly controls y1
and u 2 mainly controls y 2 . u 2 has interactions on y1 . Running path analysis algorithm five
chlorine transportation paths are obtained, which are shown in Figure 7.13.

201 200
201
5 7

6
Path V
18 13 14
12 16
6 13 25 14 26
8
4 15
27

Path III 15

11 24
5

7 8 19
23
9
17
4 3
16 Path IV
22

Path I Path II
10
3 9 21 12

18 20

10 19 11
17
100
101 1011 1 2 2

Figure 7.13 Paths from the Injection Nodes to the Monitored Nodes

- 222 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

The minimum time delay in the paths is 30 [min], and maximum delay is 120 [min]. After
applying the model estimation algorithm, the entire control horizon is partitioned into thirteen
time-slots generating a piece-wise constant bounded model, and only certain parameters are
active within certain time-slots:

2
y1 (t ) = b1J,1(t ) (t ) y1 (t − 1) + ∑ ∑ a1J, (j t,i) (t )u j (t − i ) + ε 1J ( t ) (t ) + ε s (t ) (7.12)
j =1 i∈I J ( t )
1, j

y 2 (t ) = ∑ a2J,(2t,)i (t )u 2 (t − i ) + ε 2J ( t ) (t ) + ε s (t )
J (t )
i∈I 2 , 2

where, an , j ,i describes an impact of the injection input u j that is delayed by i steps on the

output y n , where n = 1,2. Figure 7.14 and Figure 7.15 show the piecewise constant envelopes

bounding the parameters a1,1,7 and a1, 2,18 over a whole horizon of 288 steps, respectively. The

centre values of these parameter envelopes are taken as the parameter values in the nominal
model.

Figure 7.14 Bounds on Parameter a1,1, 7

- 223 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.15 Bounds on Parameter a1, 2,18

7.3.1.2 State-Space Model

As for SS type model, two booster stations are installed at the nodes 1 and 5, where chlorine
concentrations in the nodes are the two inputs of the system u1 and u 2 . Similarly, u1 mainly
controls y1 and u 2 the mainly controls y 2 . u 2 has interactions on y1 . Running path analysis
algorithm six chlorine transportation paths are obtained, which are shown in Figure 7.16.

- 224 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

201 200
201
5 7

6 18 13 14
Path VI
12 16
6 13 25 14 26
8
4 15
27

15
Path IV
11 24
5

7 8 19
23
17 3
9 16 Path V
4

22

10
3 9 21 12

Path I Path II 18 20
Path III
10 19 11
17
100
101 1011 1 2 2

Figure 7.16 Paths from the Injection Nodes to the Monitored Nodes

The minimum and maximum delays in the above paths are 30 [min] and 180 [min],
respectively. The 24-hour or 288-time-step horizon is partitioned into eleven time-slots after
running the parameter estimation algorithm. A state-space model is obtained as follows:

2
cT (t ) = α (t ) J ( t ) cT (t − 1) + ∑ ∑ fl j ,i (t )u j (t − i ) + ε T (t ) + ε s (t )
J (t ) J (t )
(7.13)
j =1 i = F J ( t )
j

⎧ y (t ) = 2
∑ ∑ a1, j ,i (t )u j (t − i ) + ∑ dr1,i (t )cT (t − i ) + ε 1 (t ) + ε s (t )
J (t )
⎪⎪ 1 j =1 i∈I J ( t )
i∈D J ( t )


1, j 1
(7.14)
⎪ y 2 (t ) = ∑ a2, 2,i (t )u j (t − i ) + ε 2 (t ) + ε s (t )
J (t )

⎪⎩ i∈I 2J,(2t )

where the parameters are as defined in (3.106), and ε s (t ) is the simulator error that includes
hydraulic discrepancy and chlorine reaction model reduction, which is unknown but bounded
as stated before. Three examples of the estimated bounds on the parameters are shown in
Figure 7.17-7.19.

- 225 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.17 Bounds on Parameter fl1,18

Figure 7.18 Bounds on Parameter dr1,7

- 226 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.19 Bounds on Parameter a2, 2,15

7.3.1.3 Remarks on the Parameter Piece-Wise Constant Bounded Model

Figure 7.14-7.15 and Figure 7.17-7.19 show piece-wise constant bounds of the model
parameters. It can be seen that the 24[hour], 288[time-step], modelling horizon has been
partitioned into a number of time-slots. Over different time-slot, the bound width is different.
The bound width is associated with the uncertainties in the model. Hence, bound width could
be viewed as the uncertainty levels of the obtained model. It is also the reflection of the
hydraulic uncertainty levels. For example, in Figure 7.15, bounds on parameter a1, 2,18 around

80[time-step] is bigger than bounds over time-slot 260-288[time-step]. As presented in


Section 7.3 and Figure 7.11, time period around 80[time-step] is around the switching time
instant of tank operation. Hence, higher hydraulic uncertainty is expected, which resulted in
higher quality model uncertainty.

- 227 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

7.3.2 Robust Model Predictive Control of Chlorine Residuals in Drinking


Water Distribution Network

Based on the obtained IO, SS models, RMPC is practised. First, we shall show how the
relaxation gain algorithm is tuned.

7.3.2.1 Safety Zone Design

An approximation algorithm of solving the penalty function formulated non-linear


constrained optimization problem has been proposed in Chapter 6. The relaxation gain is
determined by using (6.33). The calculation of ν is illustrated by taking the RMPC design
based on IO model as an example, where the coefficients of the MPC is given in Section
6.3.2.2. The gradient ∇C (x) is calculated by using backward difference approximation, for
instance at time step t = 205 [time-step] the calculation is:

diag (∇C ( x)) x=0.1,∆x =0.1 = diag[ -0.056027, -0.040773, -0.029 (7.15)

-0.664800, -0.645327, -0.627067, -0.609553, -0.592513, -0.575787,


-0.559193, -0.542740, -0.526213, -0.509647, -0.492887, -0.471293,
-0.632847, -0.612973, -0.592440, -0.570913, -0.548047, -0.523280,
-0.495113, -0.465933, -0.461780, -0.541347].

so, ν = max([diag (∇C ( x))]−1 ) = −1.50 . (7.16)

Taking this value as the relaxation gain the safety zone design obtained at time step
t = 205 [time-step] is shown in Figure 7.20, and the computation time is 17 seconds.

- 228 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.20 Safety Zone Modified Upper Limit on Output at ν = −1.5

Smaller value of ν yields more accurate safety zones, however, requires more iterations and
computation time. At different value of relaxation gain the obtained safety zones are different
and the computation time needed are different. The computation time is illustrated as the
follows and the results are illustrated in Figure 7.21 to Figure 7.25:

ν = −0.25 time = 281 [seconds] (7.17)


ν = −0.5 time = 135 [seconds]
ν = −1.0 time = 19 [seconds]
ν = −2.0 time = 12 [seconds]
ν = −5.0 time = 13 [seconds].

- 229 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.21 Safety Zone Modified Upper Limit on Output at ν = −0.25

Figure 7.22 Safety Zone Modified Upper Limit on Output at ν = −0.5

- 230 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.23 Safety Zone Modified Upper Limit on Output at ν = −1.0

Figure 7.24 Safety Zone Modified Upper Limit on Output at ν = −2.0

- 231 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.25 Safety Zone Modified Upper Limit on Output at ν = −5.0

Comparing the results it can be concluded that:

• Relaxation gain is robust in the sense that for a large range of its values, feasible
solution can be obtained
• Computation time was reduced significantly with proper gain setting
• The proposal gain evaluation method, (6.33), can be used in practice

At each control step the relaxation gain can be updated, by calculating the diagonal
component of the gradient in (6.33), to adapt to the online operation status. In the following
simulation, fixed-value ν is used for simplicity reason.

- 232 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

7.3.2.2 Chlorine Residual Control Based on Input-Output Model

The coefficients of the NMPC are similar as in Section 7.2. The nominal model is obtained by
taking the centre value of the constant bounds on the model parameters. The prediction
horizon and control horizon are set as H m = H p = 36 [time-step]. Performance index of

NMPC is defined by setting:

µ = 1.0 (7.18)
ρ = 1.0 (7.19)
y1r = 1.1 (7.20)

y 2 r = 1.1 (7.21)

where µ , ρ , y1r and y2 r are defined in Section 5.3.2. The input constraints are defined as:

u min = 0.0 (7.22)


u max = 4.0
and ∆u min = −0.2 (7.23)
∆u max = 0.2

where the above variables are defined in Section 5.3.3. In calculating the safety zone a
relaxation gain ν = 1.0 is used.

The controller starts with zero safety zones. Its operation over a whole horizon and the output
constraint violation are illustrated in Figure 7.26 and Figure 7.27. The violation of y1 is about
5% above the output limit around steps t=70 [time-step] and t=230 [time-step]. The operation
of the controller over the same time period but with the modified output constrains by safety
zones is shown in Figure 7.29 and Figure 7.30, hence achieving the feasibility. The output
constraints modified by safety zones generated at step t=205 [time-step] are illustrated in
Figure 7.28.

- 233 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.26 Controller Performance with Zero Safety Zones: y1 and u1

Figure 7.27 Controller Performance with Zero Safety Zones: y 2 and u 2

- 234 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.28 An Example of Safety Zone Design

Figure 7.29 Constraints Fulfilment After Safety Zone Introduction: y1 and u1

- 235 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.30 Constraints Fulfilment After Safety Zone Introduction: y 2 and u 2

7.3.2.3 Chlorine Residual Control Based on State-Space Model

The NMPC coefficients are the same as used in Section 7.3.2.2 with the following exceptions:
y1r = 1.0 (7.24)

y 2 r = 1.0 (7.25)

Higher values of y r were used when applying IO model, as such values gave better results,
especially when there is a water demand prediction error. Additionally, how y r is used as the
tuning knob of the MPC was shown. Different values of y r will change the performance of
the MPC. By tuning y r , better performance can be achieved in terms of output constraint
fulfilling. The relaxation gains used are ν = 1.0.

Controller performance is illustrated in Figure 7.31 and Figure 7.32. The control objective
was achieved with the input-output node arrangement by using SS model, which was not
achieved when using IO model with the same input-output node arrangement.

- 236 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.31 Controller Performance with Safety Zones: y1 and u1

Figure 7.32 Controller Performance with Safety Zones: y 2 and u 2

- 237 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

7.3.2.4 Chlorine Residual Control Existing Water Demand Prediction Error

In the previous sections it has been assumed that the water demand used in model estimation
is exactly the same as in DWDS plant simulation. In reality, predicted water demand is
different from the real demand. Such discrepancy is an uncertainty source in the chlorine
residual model, which has been analysed in Chapter 4. Still lacking quantitative techniques in
converting the prediction uncertainty of water demand into hydraulic uncertainty, how to
incorporate such prediction uncertainty into quality model is still open. In this part, we shall
show that such uncertainty can be handled by enlarged parameter bounds that are obtained in
parameter estimation assuming a nominal water demand. Namely, water demand prediction
error caused uncertainty can be modelled by tuning model uncertainty radius.

The water demand is increased by 10% evenly at each demand node of the DWDS. Output
constraint violations occurred while the controller is based on the IO model in which
parameter bounds are not tuned. Next, the IO model parameter bounds are expanded 4% from
the centre of the parameter envelopes. It is shown in Figure 7.33 that the violations are
decreased except for the last period of the horizon where the constraint violation occurred due
to the tank impact on the monitored node, which has not been accurately modelled by the IO
type model.

Figure 7.34 and Figure 7.35 show the output under RMPC based on SS model with 10%
water demand increase. Similarly, RMPC is run based on SS model with the same parameter
tuning. The resulting controller performance is shown in Figure 7.36 and Figure 7.37. The
simulation results showed good controller performance. In particular, with the state-space
model it was possible to maintain the chlorine residuals over an entire twenty-four hours time
period under uncertainty in water demand. This was not achievable for the same network
using the input-output model and the upper limit was violated around 23.5hr after tank
switching had occurred as it is illustrated in Figure 7.33.

- 238 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.33 RMPC Based on IO Model under 10% Demand Increase: y1 and u1

Figure 7.34 Control with Zero Safety Zones based on State-Space Model
under 10% Demand Increase: y1 and u1

- 239 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.35 MPC with Zero Safety Zones based on State-Space Model
under 10% Demand Increase: y 2 and u 2

Figure 7.36 RMPC Control Performance Based on the tuned State-Space Model
under 10% Demand Increase: y1 and u1

- 240 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

Figure 7.37 RMPC Control Performance Based on the tuned State-space Model
under 10% Demand Increase: y 2 and u 2

7.4 Summary and Remarks

Feedback control of chlorine residuals in DWDS has been investigated by computer


simulation study. Chlorine residual dynamics is depicted by Input-Output or State-Space
model. Bounds on the model parameters are obtained by using the parameter estimation
algorithm developed based on the point-parametric model concept, where the uncertainty in
the model is linked to robust MPC design through the uncertainty radius defined by robust
output prediction. Robust MPC is designed and run under an operational environment with
uncertainty scenarios of discrepancies in plant, model, measurement, actuator and numerical
computation. The output constraints are fulfilled under the uncertainties after the introduction
of safety zones that restrict the original output constraint. The safety zones can be updated at

- 241 -
CHAPTER 7. CHLORINE RESIDUAL CONTROL IN DRINKING WATER DISTRIBUTION SYSTEMS: A CASE STUDY

each time-step using the relaxation gain algorithm. Proper value of the relaxation gain can be
obtained where sufficient performance and computing efficiency are achieved simultaneously.

Simulation results show that the utilization of the developed modelling and control
mechanisms in practice is highly possible. However, the following points have to be
exploited:

• When there exists switching type tank in DWDS, Input-Output model is not efficient
and accurate, especially around switching course that is from filling to draining period.
• When the DWDS is large-scale in terms of chlorine residual dynamics, higher
computation ability in solving ROP, MPC and safety zones is required.
• Water demand prediction error is the main uncertainty in the system. Therefore,
quantitative analysis of the error will improve the performance of the modelling and
control mechanisms.

- 242 -
Chapter 8

Decentralization of the Robust Model


Predictive Controller

As stated in Chapter 2, decentralization of the quality feedback controller is wanted due to


practical reasons, e.g. computation complexity, distributed actuators and sensors and subsystem
dependence on the central controller reliability. A decentralized structure is proposed in
Chapter 2 for robust model predictive control of chlorine residuals in drinking water distribution
systems. The water network is divided into a number of interacting zones. Each zone is directly
controlled by a local RMPC. However, the input-output dynamics show strong interactions. One
control input may influence a number of controlled outputs if the paths exist from these inputs to
various outputs. It is important from the control design viewpoint that in the model only the
inputs interact. Vast majority of the control literature on decentralized regulatory control
considers situations where the interactions are weak. This is not so however, in our case. In order
to achieve complete decomposition of the controller into a number of independent controllers that
utilize only local information, it is proposed to use the injection quality values produced at the
local controllers as the real interaction estimates assuming communication between the local

- 243 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

controllers is available. Then the error may be considered small enough to classify the
interactions as weak. The error can then be rejected due to the robustness of the local controller.

In this chapter a decentralized controller structure is proposed. The interaction prediction is


employed in order to compensate the interactions. It is an extension of controller designed in the
previous chapters. Robustness of controller can still be maintained by using the safety-zone
mechanism assuming bounds on the interaction prediction error known. It is also assumed that
the local controllers can exchange information about their control actions. The communication is
asynchronous. This information is used to predict the zone interactions. The content of this
chapter has been presented in (Chang, Brdys and Duzinkiewicz, 2003).

8.1 Control Problem Statement

Chlorine residual control in a DWDS is considered where there are nM monitored nodes, nI
chlorine injection nodes and nT tanks in the DWDS. It is assumed that n I = nM = n . It is rational
assumption when considering decentralizing control, and makes the decentralization applicable.

The control objective is to maintain chlorine residual at monitored nodes within upper-lower
limits:

y min ≤ yi ≤ y max , i = 1,..., n (8.1)

by injecting chlorine at source nodes:

u min ≤ ui ≤ u max , ∆ui ≤ ∆u max , i = 1,..., n (8.2)

- 244 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

where y min and y max are the limits on system output y , u min , u max and ∆u max are actuator
constraints on system input u , which are defined similarly like in the previous chapters.

We shall limit decentralization to design based on input-output model. The results can be
extended to state-space model without a lot efforts.

nT n
y1 (t ) = ∑ b1,i (t ) y1 (t − i ) + ∑ ∑ a1, j ,i (t )u j (t − i) + ε 1 (t )
i =1 j =1 i∈I1, j

M (8.3)
nT n
yn (t ) = ∑ bn,i (t ) yn (t − i) + ∑ ∑ an, j ,i (t )u j (t − i) + ε n (t )
i =1 j =1 i∈I n , j

where all the model parameters bn,i , an, j ,i and ε i (t ) are piecewise constantly bounded as

described in Section 5.3.1.1. A centralized robust model predictive controller has been designed
in Chapter 5 based on model (8.3) to maintain output constrains (8.1) with input constraints in
(8.2) under uncertainties in actuator and model. The decentralized RMPC (DRMPC) is to be
developed, which is composed of n local RMPCs in which only one input-output pair is involved
assuming communication among the n local RMPCs is available.

8.2 Decentralized Control Structure

Without loss of generality the interaction prediction can be illustrated by taking the first input-
output pair as an example. The first equation of model (8.3) can be rewritten as:

nT
y1 (t ) = ∑ b1,i (t ) y1 (t − i) + ∑ a1,1,i (t )u1 (t − i ) + EL1 (t ) + ε 1 (t ) (8.4)
i =1 i∈I1,1

- 245 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

n
EL1 (t ) = ∑ ∑ a1, j ,i (t )u j (t − i )
j = 2 i∈I1, j

where EL1 (t ) is the chlorine contribution to y1 (t ) from external loops. A single-input single-
output (SISO) RMPC can be designed based on model (8.4) assuming EL1 (t ) is an external
input. As communication between local control loops are available, the control inputs of the local
loops over the prediction horizon can be exchanged among the local controllers. For the local
controller 1 the following information can be obtained at time t from controllers 2,3,..., n :

U 2 (t − 1) = [u 2 (t − 1 | t − 1) u 2 (t − 1 + 1 | t − 1) ... u 2 (t − 1 + H p − 1 | t − 1)]T

M (8.5)
U n (t − 1) = [u n (t − 1 | t − 1) u n (t − 1 + 1 | t − 1) ... u n (t − 1 + H p − 1 | t − 1)]T

where U i (t − 1) is the vector of the control inputs over prediction horizon H p , proposed at time

t − 1 at the i th RMPC. At time instant t , by using the above information, the control inputs to be
generated by local controllers 2,3,..., n at t over prediction horizon can be predicted as:

~
U 2 (t ) = [u 2 (t − 1 + 1 | t − 1) u 2 (t − 1 + 2 | t − 1) ... u 2 (t − 1 + H p − 1 | t − 1) u 2 (t − 1 + H p − 1 | t − 1)]T + εI 2 (t )
M (8.6)
~
U n (t ) = [u n (t − 1 + 1 | t − 1) u n (t − 1 + 2 | t − 1) ... u n (t − 1 + H p − 1 | t − 1) u n (t − 1 + H p − 1 | t − 1)]T + εI n (t )

where εI i (t ) is the vector of the control variable prediction error. Let us notice that if there is no

uncertainty in the model then the first H p − 1 control inputs are predicted with zero errors.
~
Generating U i (t ) from U i (t − 1) is illustrated in Figure 8.1. It is difficult to give a least
conservative estimated bound on the control variable prediction error. However, it is understood
~
that with large enough prediction horizon H p difference between U 2 (t ) and predicted U 2 (t ) can

be bounded efficiently. On the other hand, the use of large H p does not allow for accurate

prediction of plant outputs. Also, as these control inputs represent corrections to the control

- 246 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

trajectory produced by the upper level of the overall control structure in Figure 2.1. The
interaction prediction error is supposed to be not very excessive. In practice this value can be
found by using this error bounds as a tuning knob of the controller until satisfied performance is
found.

u (t − 1 + H p − 2 | t − 1)
u (t | t − 1) u (t − 1 + H p − 1 | t − 1)

u (t − 1 | t − 1)
U i (t − 1)

Time
t −1

~
U i (t )

Time
t −1 t

~
Figure 8.1 Obtaining U i (t ) from U i (t − 1)

Substituting (8.6) into (8.3) it is obtained that:

nT ~
y1 (t ) = ∑ b1,i (t ) y1 (t − i ) + ∑ a1,1,i (t )u1 (t − i ) + EL1 (t ) + ε 1 (t ) (8.7)
i =1 i∈I1,1

~ n
EL1 (t ) = ∑ ∑ a1, j ,i (t )[u j (t − i | t − 1) + εI i (t − i)]
j = 2 i∈I1, j

- 247 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

Based on model (8.7) SISO RMPC can be designed. Interaction prediction error enters into
modelling error, hence, it can be handled by introducing safety-zones in RMPC as well. The
structure of the decentralized RMPC is illustrated in Figure 8.2.

RMPC Loop1 Measurement y1 (t )

Injection u1 (t ) DWDS
Interaction Prediction Zone 1

Local Quality Controller


u 2 (t − 1) from loop 2

. u n (t − 1) from loop n .
. .
. .

u n −1 (t − 1) from loop n

u1 (t − 1) from loop 2

Interaction Prediction

Injection u n (t )
RMPC Loop n Zone n
Measurement yn (t )
Local Quality Controller
Injection node Monitored node

Figure 8.2 Structure of Decentralized Controller of Quality Control in DWDS

- 248 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

8.3 Algorithm Description and Implementation

The DWDS can be separated into n zones. Within each zone there is one main injection node
and one monitored node, all other chlorine contributions are treated as external interacted inputs.
The decentralized controller is composed of n local controllers locating at each zone. Operation
of a local controller is to be summarised as:

Local Controller Operation:

0. Initialise the controller at time t = 0;


1. Receive control inputs from other local controllers generated at t = k − 1 ;
2. Run DRMPCs at t = k ;
3. Send control inputs over prediction horizon to other local controllers;
4. k = k + 1 , go to step 1.

Initialisation in step 0 can be done by solving a centralized RMPC problem based on a


centralized model.

8.4 Simulation Results

Chlorine residual control of the benchmark DWDS that was used in Chapter 7 is investigated by
using the developed DRMPC algorithm. The DRMPC is operated based on the IO model of the
benchmark DWDS, where the chlorine concentrations at node 8 is mainly controlled by the
injection at node 10 and interacted by the chlorine injection at node 5 that is the chlorine input to
the chlorine concentration at node 16 (see IO model described by equation 7.12). The
decentralization scheme of the DWDS is shown in Figure 8.3

- 249 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

The output reference at the end of the prediction horizon is set as:

y1r = 1.0 and y 2 r = 1.0 (8.8)

where definition of y1r and y2 r can be found in Section 5.3.2, and all other setting are the same
as in Section 7.3. Higher reference values were used in previous simulation in order to obtain
better performance under inaccurate water demand prediction. Here a lower value is applied.

201 200
201
5 7

6 18 13 14
12 16
6 13 25 14 26
8
4 15
27

15
Zone of Control
Interacting Zone Loop 2
11 24
5

7 8 19
23
9 16
17 3
4

22

10
3 9 21 12

18 20

10 19 11
17
100
101 1011 1 2 2 Zone of Control
Loop 1

Figure 8.3 Illustration of the Decentralization Scheme of the DWDS

Simulation results of the centralized 2-input 2-output RMPC, with introduction of safety zones in
the MPC operating, are shown in Figure 8.4 and Figure 8.5. It can be seen that output constraints
are satisfied over the control horizon. A DRMPC is then run under the same situation of the water
network. The outputs and inputs are shown in Figure 8.6 and Figure 8.7, where robust feasibility

- 250 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

is maintained. Looking at these figures, especially the time period from step 200 to time step
288, it can be found that the control inputs are quite different from the previous ones in the
centralized controller. The injection at node 10 of the decentralized controller is higher than in
the centralized case. The constraints on the input, as discussed in Chapter 1 and Section 2.1, still
maintain the chlorine concentration under WHO or EPA limit. In the centralized controller,
control loop of node10-8 pair got more chlorine contribution from loop of node 5-16 pair.
Coordination between the loops becomes weak due to the decentralization, which leads to
corresponding compensation in the local controller. For the case used in the simulation study,
such compensation ability for loss of coordination between local controllers is still within the
capacity of the local control loop. Hence, output constraints are still kept within prescribed limits.

Figure 8.4. Centralized Robust Model Predictive Controller: y1 and u1

- 251 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

Figure 8.5. Centralized Robust Model Predictive Controller: y 2 and u 2

Figure 8.6. Decentralized Robust Model Predictive Controller: y1 and u1

- 252 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

Figure 8.7. Decentralized Robust Model Predictive Controller: y 2 and u 2

8.5 Summary

A decentralized robust model predictive control structure was presented for chlorine residual
control in drinking water distribution systems. The overall water network was divided into a
number of zones. Within each zone a SISO robust model predictive controller is operated.
Interactions between the control zones can be predicted assuming that communications among
control zones are available. The prediction errors can be handled by using bounding method,
which can then be handled by using the same RMPC algorithm developed before. Hence, Output
constraints satisfaction can be maintained under uncertainties in the system. Computer simulation
results show that the algorithm is applicable for practical utilization.

- 253 -
CHAPTER 8. DECENTRALIZATION OF THE ROBUST MODEL PREDICTIVE CONTROLLER

- 254 -
Chapter 9

Conclusions

Integrated control of quality and quantity aspects is needed to satisfactorily meet operational
objectives in drinking water distribution systems. Recent works in this area have developed
better understanding of the problem and also new decision support and control technology
have been produced. In this thesis a hierarchical structure for an overall control is proposed
and how existing control technologies can be extended and used in the design was discussed.
It is apparent that although the problem is complex, applying existing control techniques can
make a significant improvement to the current practice.

The decision support and control systems for integrating quantity and quality in DWDS is an
emerging yet challenging application area that needs truly interdisciplinary research to be
performed in order to develop solutions that are needed by practitioners.

The methodology presented in this thesis provides a practical solution for online water quality
control in DWDS. In Chapter 2, a hierarchical integrated quantity and quality control
structure has been proposed, where control tasks of quantity and quality operation of DWDS
have been defined. Models for controller design have been established in Chapter 3. Based on
the hydraulics from the upper layer of the hierarchical structure, model structures have been
identified. Uncertain factors involved in the quality control problem have been analysed in
Chapter 4. Bounding approach has been proposed for mode parameter estimation due to its

- 255 -
CHAPTER 10. CONCLUSIONS

applicability in practice, in which only some a priori knowledge (bounds on the uncertain
variables) is needed. However, the not-tightest bounds may result in conservative model
parameter estimations. In order to reduce this conservatism, joint parameter and model
structure error estimation algorithms have been developed based on a point-parametric model
concept. Accuracy needs from controller design are imposed on the model estimation process
by the “uncertainty radius” defined through robust output prediction. Finally, parameter
piece-wise constant bounded models have been obtained.

Robust model predictive control in meeting output constraints under uncertainties has been
designed in Chapter 5, based on the bounded-parameter models obtained in Chapter 4. By
online evaluating the uncertainty scenarios of the system, output constraint safety-zones are
generated at each time step to restrict the output constraints in the optimization problem of
MPC. The algorithm of computing safety-zones has been developed in Chapter 6. Robustness
of the MPC in fulfilling output constraints under uncertainties has been achieved. The
centralized RMPC has then been decentralized in Chapter 8.

Simulation studies, presented in Chapter 7, have shown that the developed techniques of
model structure identification, parameter estimation and robust model predictive control
provide a practical solution for quality control of DWDS.

Modelling, controller design and simulation studies will be summarised and concluded in the
following sections.

9.1 Modelling of Chlorine Residuals for Control Purposes

The three main aspects governing chlorine residual dynamics in DWDS, transportation,
mixing and reaction, were discussed in the thesis based on the mathematical model of the
elementary DWDS components. Input-output and state-space models of chlorine residuals in
the DWDS, suitable for robust control purposes, have been developed.

- 256 -
CHAPTER 10. CONCLUSIONS

As a part of a hierarchical water quality control structure, quantity data obtained from the
upper level make it possible to identify the model structure using the path analysis algorithm.
The existing path analysis algorithm has been extended to handle DWDS with both
continuous tanks and switching tanks. The model structure under both situations with
multiple injection nodes and monitored nodes has been obtained. A parsimonious state-space
model has been obtained if the chlorine concentration in the tank is kept in the model as the
state variables, which is more convenient for parameter estimation and controller design,
especially when the controllability is weak.

Analysis has shown that deterministic structure error exists in the obtained models, therefore,
a bounding approach was used to perform the parameter estimation task. However, existing
bounding techniques cannot easily be utilized because of lack of sufficiently accurate a priori
knowledge on the parameter time structure and model structure error. In order to reduce the
conservatism of the bounds on the parameter time structure and model structure error, a point-
parametric model was introduced. A parameter-bounding algorithm was derived for this kind
of model. For the first time, bounding approach of a joint parameter and structure error
estimation has been developed that is based on point-parametric model. The control horizon
was partitioned into a number of time-slots based on the criterion defined through an
uncertainty radius of the model. With the introduction of the model uncertainty radius, robust
control design and parameter estimation was linked actively, and requirements of the control
design have been explicitly imposed on the model estimation. Simulation results have shown
that the obtained model can be used for robust controller design.

9.2 Robust Model Predictive Control of Chlorine Residuals


in Drinking Water Distribution Systems

The robust MPC controller for water quality control at the lower level of the hierarchical
integrated quantity and quality control in DWDS has been developed to maintain the chlorine
concentration at the monitored nodes within prescribed limits under modelling, water demand
uncertainty and control input constraints. The uncertainties in the time-varying parameters,

- 257 -
CHAPTER 10. CONCLUSIONS

model structure error part, measurement errors, actuator error, and disturbance input have
been modelled by applying a set-bounded approach. Safety zones have been employed to
modify the model-based output constraints so that control input feasibility was robustly
achieved. The safety zones were iteratively designed at each control generation time instant
based on the envelopes bounding the predicted system output response. Algorithm for
generating the safety zones based on the constraint violations over the MPC prediction
horizon has been derived by solving a non-linear constrained optimal problem, and its
convergence was analysed. An efficient simplified relaxation gain algorithm has been derived
in order to reduce the computational demand.

In this thesis, the robust model predictive controller has been developed for solving particular
water quality control problem in DWDS. However, the developed techniques have more
general application in problems that require output (state) constraints to be fulfilled for an
uncertain system. For instance, the RMPC methodology developed in the thesis has been
applied in SMAC (SMArt Control of Wastewater Systems) project that is under European
Commission’s 5th framework programme, in which one of objectives of the project is to fulfil
output and state constraints under system uncertainty in the operational control of a
wastewater treatment plant.

9.3 Conclusions on Simulation Study

A simulation case study based on a benchmark water distribution network was carried out to
validate the methodology developed in this thesis. A typical horizon of 24 hours for quantity
and quality control of the DWDS was considered. At the starting time instant of the 24-hour
control horizon, a water demand prediction over the considered 24-hour horizon was given.
An integrated quantity-quality control problem was then solved that produces the hydraulic
operation and chlorine injection schedules, which are controls generated at the upper level of
the hierarchical controller structure. Based on the hydraulic information, the structure of the
chlorine concentration model was derived in both input-output and state-space forms, and a
quality simulator was implemented as well. Model parameter estimation can then be

- 258 -
CHAPTER 10. CONCLUSIONS

performed by collecting data from the simulator by feeding input experiment designs. Finally,
the RMPC was performed based on the obtained chlorine concentration model over the
control horizon. The output constraints have been fulfilled under system uncertainties after
introducing the safety zones. Applying a state-space model, the simulation results showed
improved controller performance comparing with the controller based on the input-output
type model. The proposed mechanism of decentralization of the RMPC was also verified by
simulation results.

The RMPC was operated on a moving time horizon. When time reached the beginning of the
next 24-hour control horizon, the above procedure of modelling and control repeated. Overall,
by considering the unknown variations of model parameter uncertainty due to the nature of
daily variations in hydraulic dynamics, an indirect adaptive control design approach has been
implemented. Simulation results have shown that the proposed modelling and control
structure was practically applicable for water quality control in DWDS. More generally, the
methodology developed in the thesis could be useful for other process control and network
modelling.

9.4 Issues on Practical Implementation

The methodology developed in this thesis, chlorine residual modelling for control and robust
model predictive control in fulfilling output constraints under uncertainties, has been verified
applicable by simulation studies. However, implementation and application of these
techniques in the existing DWDS still require a lot engineering efforts. The gaps between
simulation studies and practical applications are summarised as follows:

• DWDS numerical simulator is needed in chlorine residual modelling. However,


calibration the DWDS simulator is not touched in this thesis
• Computation difficulty in solving the complex problem of robust output prediction
(see Section 5.5 and Section 5.6)

- 259 -
CHAPTER 10. CONCLUSIONS

Sufficiently accurate hydraulic simulators are commonly used in many DWDS operations.
Based on these existing hydraulic simulators, chlorine residual simulator could be established
and calibrated. Computation obstacles could be overcome by using efficient commercial
optimization solvers and high-speed industrial computers. It is highly possible to overcome
the above gaps and apply the methodology in the water quality control of the existing DWDS.

RMPC
S
C SCADA Real-Time Data
A RMPC Buffer NMPC
D Interface
A
Real-Time Data DB
Synchroniser S ROP
E
R
V
Current Data
I MPE
History Data
C
E
DB SPACE

Figure 9.1 Integrating RMPC into the Existing SCADA of DWDS

The techniques developed in this thesis can then be implemented and integrated into the
existing SCADA (Supervisory Control And Data Acquisition) system of the DWDS operation
by using embedded system development products, e.g. Matlab / Simulink toolkits, embedded
target and real-time workshop (http://www.mathworks.com). However, details of the system
implementation are out of the scope of this thesis. A principal system structure of such an
embedded implementation is proposed and depicted in Figure 9.1, where RMPC represents
the functional block of the robust model predictive control (RMPC) that is composed of three
sub-systems, NMPC (Nominal Model Predictive Control), ROP (Robust Output Prediction)
and MPE (Model Parameter Estimation). RMPC is connected to the existing SCADA system
through a data interface, through which online and historical data can be retrieved and
actuator settings can be set.

- 260 -
CHAPTER 10. CONCLUSIONS

9.5 Recommendations to Future Work

• Improvement on DWDS simulation under uncertainty


A sufficiently accurate bound on quality simulator outputs considering system uncertainty is
needed in operating the RMPC. EPANET was used in this thesis as the simulator that solved
the quantity and quality dynamics. However, no uncertainty was handled in this simulator. A
DWDS simulator needs to be developed to handle hydraulic, chemical kinetic uncertainty and
solver errors quantitatively. The outputs of this simulator could be range values of the
hydraulics and the chlorine concentrations.

• Joint Solution of locating injection and monitored nodes and control problem
The locations of injection nodes and monitored nodes relate to the system controllability and
observability respectively. Hence, embedding the control objective into the location problem
can improve the efficiency of chlorine injection and the validity of chlorine monitoring.

• Integrated state-estimation and control problem in DWDS


In this thesis, only a limited number of nodes were monitored under the assumption that they
were chosen appropriately so as to represent the chlorine distribution in the DWDS. If the
chlorine concentrations at these nodes meet the control objective then the chlorine
concentrations throughout the DWDS are assumed to have satisfied the control constraints as
well. It is desirable to monitor more nodes online. However, locating many additional sensors
into the DWDS is not economical. State estimation technology allows implementing a soft-
sensor system to achieve this task, which can be integrated with the controller proposed in the
thesis.

• Analysing of the decentralised controller structure


A decentralised controller structure was proposed assuming communication among local
controllers. Further analysis of the decentralised structure is needed to improve performance
and stability. A coordination mechanism is also needed especially under situations where
contradictory chlorine injections at interacted loops exist, or the required chlorine injections
exceed local loop capability. In these cases, without coordination from other control loops
there may be no solutions in the local controller.

- 261 -
CHAPTER 10. CONCLUSIONS

- 262 -
Bibliography

[1] Abdelmalek, N.N. (1977) “A simplex algorithm for minimum fuel problems of linear
discrete control systems”. International Journal of Control, 26(4), 635-642.

[2] Amato, F. and Pironti, A. (1999) “ Η∞ optimal terminal state control for linear systems
with lumpted and distributed time delays”. Automatica, 35(9), 1619-1624.

[3] Angeli, D., Casavola, A. and Mosca, E. (2001) “On feasible set-membership state
estimators in constrained command governor control”. Automatica, 37(1), 151-156.

[4] Aris R. and Amundson, N.R. (1973) Mathematical Methods in Chemical Engineering,
Volume 2, First-Order Partial Differential Equations with Applications. Prentice-Hall,
Inc., Englewood Cliffs, New Jersey.

[5] Bai, E., Tempo, R. and Cho, H. (1995) “Membership set estimators: size, optimal inputs,
complexity and relations with least squares”. IEEE Transactions on Circuits and Systems
–I: Fundamental Theory and Applications, 42(5), 266-277, May.

[6] Bai, E. and Huang, Y. (2000) “Variable gain parameter estimation algorithms for fast
tracking and smooth steady state”. Automatica, 36(7), 1001-1008.

[7] Bemporad, A., Casavola, A. and Mosca, E. (1998) “A predictive reference governor for
constrained control systems”. Computer in Industry, 36, 55-64.

[8] Bemporad, A. and Mosca, E. (1998) “Fulfilling hard constraints in uncertain linear
systems by reference managing”. Automatica, 34(4), 451-461.

[9] Bemporad, A. and Morari, M. (1999) “Robust model predictive control: A Survey”.
Robustness in Identification and Control, Garulli, A., Tesi, A. Vicino, A. (Eds.), Lecture
Notes in Control and Information Sciences, vol. 245, Springer-Verlag, 207-226.
http://control.ethz.ch/.

[10] Bemporad, A. and Garulli, A. (2000) “Output-feedback predictive control of constrained


linear systems via set-membership state estimation”. International Journal of Control,
73(8), 655-665.

[11] Boccelli, D.L., Tryby, M.E., Uber, J.G., Rossman, L.A., Zierolf, M.L. and Polycarpou,
M.M. (1998) “Optimal scheduling of booster disinfection in water distribution systems”.
Journal of Water Resources Planning and Management, March/April, 124(2), 99-111.

[12] Boccelli, D.L. and Uber, J.G. (2001) “Evaluation of multi-component model of chlorine
residual dynamics in water distribution systems”. Water Software Systems: theory and
applications VOLUME ONE (Eds. Ulanicki B., Coulbeck B. and Rance J.). Proc. Sixth

- 263 -
International Conference on Computing and Control for the Water Industry, 195-210, 03-
05 September, Leicester, UK.

[13] Brdys, M.A., Ulanicki, B. (1994) Operational Control of Water Systems: Structures,
Algorithms and Applications. Prentice Hall International (UK) Ltd.

[14] Brdys, M.A. and Chen, K. (1994). “Joint state and parameters estimation of dynamic
water supply systems under bounded uncertainty by using geometric programming”.
Proc. of the 10th IFAC Symposium on System Identification, Copenhagen, Vol.3, 331-336.

[15] Brdys, M.A., Puta, H., Arnold, E., Chen, K., and Hopfgarten, S. (1995) “Operational
control of integrated quality and quantity in water systems”. Roberts, P.D. and Ellis, J.E.
editors, Large Scale Systems: Theory and Applications. IFAC/IFORS/IMACS Symposium,
volume 2, 715-722, London.

[16] Brdys, M.A. and Chen, K. (1995). “Joint estimation of state and parameters in quantity
models of water supply and distribution systems”. Automatisierungstechnik, Oldenbourg
Verlag, (43), 2, 77-84.

[17] Brdys, M.A. and Chen, K. (1996). “Joint estimation of state and parameters of integrated
quantity and quality models of dynamic water supply and distribution systems”. Proc. of
the 13th IFAC World Congress, Vol.1, 73-78, San Francisco.

[18] Brdys, M.A. and Chen, K. (1997). “Application of genetic algorithms to joint state and
parameter estimation in water networks under set-bounded models of uncertainty”. Proc.
of the Int. Conference on ‘Computing and Control for the Water Industry’, Vol.2,
September, London.

[19] Brdys, M.A., Duda, J.T. and Tatjewski, P., (1998) “Improving optimality in multilayer
control systems by tighter constraints control and supervision”. Proc. of the 8th
IFAC/IFORS/IMACS/IFIP Symposium on Large Scale Systems: Theory & Applications,
Patras, July, vol.1, 468-473.

[20] Brdys, M.A. (1999) “Robust estimation of variables and parameters in dynamic
networks”. Proc. of the 14th IFAC World Congress, Beijing, P. R. China, 5-9 July.

[21] Brdys, M.A., Lisiak, Z. (1999) “Robust on-line monitoring of mixing quality in water
supply networks”. Proc. of the 26th A.S.C.E. Annual Water Resour. Plng. And Mgnt.
Conference, Tempe, Arizona, June.

[22] Brdys, M.A., Arnold, E., Puta, H., Chen, K. Hopfgarten, S. (1999a) “Integration of
quantity and quality issues in operational control of water systems. Part I: Modelling and
integrated operational control”. (Research Report / Paper Draft Provided by the Authors)

[23] Brdys, M.A., Arnold, E., Puta, H., Chen, K., Hopfgarten, S. (1999b) “Integration of
quantity and quality issues in operational control of water systems. Part II: Methods,
solvers and case-study”. (Research Report / Paper Draft Provided by the Authors)

[24] Brdys, M.A., Chang, T. and Duzinkiewicz, K. (2000) “Hierarchical control of integrated
quality and quantity in water distribution systems”. Proc. of the A.S.C.E. 2000 Joint
Conference on Water Resources Engineering and Water Resources Planning and
Management, Minneapolis, Minnesota, 30 July-2 August.

- 264 -
[25] Brdys, M.A., Chang, T. and Duzinkiewicz, K. (2001) “Intelligent model predictive
control of chlorine residuals in water distribution systems”. Proc. World Water &
Environmental Resources Congress, 20-24 May, Orlando, Florida.

[26] Brdys, M.A. and Chang, T. (2001) “Robust model predictive control of chlorine residuals
in water systems based on state space modeling”. Water Software Systems: theory and
applications VOLUME ONE (eds. Ulanicki, B., Coulbeck, B. and Rance, J.). Proc. Sixth
International Conference on Computing and Control for the Water Industry, 231-244, 03-
05 September, Leicester, UK.

[27] Brdys, M.A., Duzinkiewicz, K., Grochowski, M. and Rutkowski, T. (2001). “Robust
estimation of integrated hydraulics and parameters in water distribution systems”. Proc.
of the 4th ASCE Annual Water Distribution Systems Analysis, 2001 World Water and
Environmental Resources Congress, Orlando, Florida, 20-24 May.

[28] Brdys, M., Duzinkiewicz, K., Chang, T., Polycarpou, M.M., Wang, Z., Uber, J.G. and
Propato, M. (2002) “Hierarchical control of integrated quality and quantity in drinking
water distribution systems”. Proc. of I International Conference on Technology,
Automation and Control of Wastewater and Drinking Water Systems - TiASWiK’02,
Sobieszewo –Gdansk, Poland, 19-21 June.

[29] Brdys, M.A. and Chang, T. (2002a) “Modelling for control of quality in drinking water
distribution systems”. Proc. of 1st Annual Environmental & Water Resources Systems
Analysis (EWRSA) Symposium, A.S.C.E. Environmental & Water Resources Institute
(EWRI) Annual Conference, Roanoke, Virginia, 19-22 May.

[30] Brdys, M.A. and Chang, T. (2002b) “Robust model predictive control under output
constraints”. Proc. of the 15th IFAC World Congress, July 21-26, Barcelona.

[31] Brion, L.M., Mays, L.W. (1991) “Methodology for optimal operation of pumping stations
in water distribution systems”. Journal of Hydraulic Engineering, 117(11), 1551-1569.

[32] Brooms, A.C., Kouvaritakis, B. and Lee, Y.I. (2001) “Constrained MPC for uncertain
linear systems with ellipsoidal target sets”. System & Control Letters, 44, 157-166.

[33] Buchberger, S.G. and Li, Z. (2003) “Temporal scale consideration for water quality
modelling in municipal distribution systems”. Proc. of World Water and Environmental
Resources Congress 2003 and Related Symposia, Pennsylvania, 23-26 June.

[34] Bush, C.A. and Uber, J.G. (1998) “Sampling design method for water distribution model
calibration”. Journal of Water Resources Planning and Management, ASCE, 124(6).

[35] Chang, T.S. and Seborg, D.E. (1983) “A linear programming approach for multivariable
feedback control with inequality constraints”. International Journal of Control, 37(3),
583-597.

[36] Chang, T. and Brdys, M.A. (2002) “Performance comparison of chlorine controllers
based on input-output and state-space models”. 1st Annual Environmental & Water
Resources Systems Analysis (EWRSA) Symposium, A.S.C.E. Environmental & Water
Resources Institute (EWRI) Annual Conference, Roanoke, Virginia, May 19-22, 2002.

[37] Chang, T. and Brdys, M.A., and Duzinkiewicz, K. (2003) “Decentralised robust model
predictive control of chlorine residuals in drinking water distribution systems”. Proc. of
World Water and Environmental Resources Congress 2003 and Related Symposia,
Pennsylvania, 23-26 June.

- 265 -
[38] Chang, T. and Brdys, M.A. (2003) “Quantifying uncertainties for chlorine residual
control in drinking water distribution systems”. Proc. of World Water and Environmental
Resources Congress 2003 and Related Symposia, Pennsylvania, 23-26 June.

[39] Chen, K. (1997) Set Membership Estimation of State and Parameters and Operational
Control of Integrated Quantity and Quality Models of Water Supply and Distribution
Systems. Ph.D. Thesis, The University of Birmingham, 1997.

[40] Chisci, L., Garulli, A. and Zappa, G. (1996) “Recursive state bounding by
parallelotopes”. Automatica, 32(7), 1049-1055.

[41] Chisci, L., Rossiter, J.A. and Zappa, G. (2001) “Systems with persistent disturbances:
predictive control with restricted constraints”. Automatica, 37(7), 1019-1028.

[42] Clark R.M. (1998) “Chlorine demand and TTHM formation kinetics: A second-order
model”. A.S.C.E. J. of Environmental Eng., vol.124, no.1.

[43] Clarke, F.H. (1983) Optimization and nonsmooth analysis. Wiley, New York.

[44] Constans, S., Bremond, B. and Morel, P. (1999) “Chlorine levels water distribution
networks: from a new simulation method to a control formulation”. Proc. of the 26th
A.S.C.E. Annual Water Resour. Plng. And Mgnt. Conference, Tempe, Arizona, June.

[45] Coulbeck, B. (1988). “A review of methodologies for modelling and control of water
supply”. Computer Applications in Water Supply Vol.2 (Coulbeck, B. and Orr, C.H.
(eds.)). Research Studies Press Ltd, Letchworth, and John Wiley, Chichester.

[46] Coulbeck, B., Brdys, M.A., Orr, C. and Rance, J. A (1988a) “A hierarchical approach to
optimized control of water distribution systems: Part I Decomposition”. Journal of
Optimal Control Applications and Methods, 9(1).

[47] Coulbeck, B., Brdys, M.A., Orr, C. and Rance, J. (1988b) “A hierarchical approach to
optimized control of water distribution systems: Part II Lower level algorithm”. Journal
of Optimal Control Applications and Methods, 9(1).

[48] Cuzzola, F.A., Geromel, J.C. and Morari, M. (2002) “An improved approach for
constrained robust model predictive control”. Automatica, 38(7), 1183-1189.

[49] Deng, H., Zhang, C. and Baras, J.S. (1999) “Run-to-run control methods based on the
DHOBE Algorithm”. Technical Research Report. The Center for Satellite and Hybrid
Communication Networks, University of Maryland, http://www.isr.umd.edu/CSHCN.

[50] Dontchev, A.L., Polis, M.P. and Veliov, V.M. (2000) “A dual method for parameter
identification under deterministic uncertainty”. IEEE Transactions on Automatic Control,
45(7), 1341-1346, July.

[51] Dumont, G.A., Elnaggar, A. and Elshafei, A. (1993) “Adaptive predictive control of
systems with time-varying time delay”. International Journal of Adaptive Control and
Signal Processing, 7, 91-101.

[52] Duzinkiewicz, K., Brdys, M.A. and Chang, T. (In Press) “Hierarchical model predictive
control of integrated quality and quantity in drinking water distribution systems”. Urban
Water, 2002.

- 266 -
[53] Edwards, D.K., Denny, V.E. and Mills, A.F. (1976) Transport Processes. McGraw-Hill,
New York, N.Y..

[54] Fernandes, C. and Karney, B.W. (2000) “Numerical solution of the advection-dispersion-
reaction equation under transient hydraulic conditions”. Proceeding of the 8th
International Conference Pressure Surges: Safe Design and Operation of Industrial Pipe
Systems. The Hague, The Netherlands, 12-14 April.

[55] Findeisen, W., Bailey, F.N., Brdys, M.A., Malinowski, K., Tatjewski, P., and Wozniak,
A. (1980) Control and Coordination in Hierarchical Systems. A Wiley-Interscience
Publication, John Wiley&Sons.

[56] Fischer, H. H., List, E. J., Koh, R. C. Y., Imberger, J. , and Brooks N. H. (1979) Mixing
in Inland and Coastal Waters. Academic Press.

[57] Fletcher, R. (1987) Practical Methods of Optimization (second edition). John Wiley &
Sons Ltd.

[58] Gibert, E. and Kolmannowski, I. (1995) “Discrte-time reference governors for systems
with state and control constraints and disturbance inputs”. Proc. Of the 34th IEEE
Conference on Decision and Control, 1189-1194.

[59] Gibert, E. and Kolmannowski, I. (2001) “A generalized reference governor for nonlinear
systems”. Proc. Of the 40th IEEE Conference on Decision and Control, 4222-4227.

[60] Gill, P.E., Murray, W. and Wright, M.H. (1982) Practical Optimization. Academic Press,
2nd printing.

[61] Goodwin, G.C. and Sin, K.S. (1984) Adaptive Filtering Prediction and Control. Prentice-
Hall, Inc., Englewood Cliffs, New Jersey.

[62] Grünbaum, B., Klee, V., Perles, M.A. and Shephard, G.C. (1967) Convex Polytopes. John
Wiley & Sons, Ltd..

[63] Haestad Methods. (1997) Computer Applications in Hydraulic Engineering, Second


Edition, Haestad Press.

[64] Hager, W.W. (1979) “Lipschitz continuity for constrained processes”. SIAM J. Control
and Optimisation, 17(3), 321-338.

[65] Harmant, Ph., Nace, A., Kiene, L. and Fotoohi, F. (1999) “Optimal supervision of
drinking water distribution network”. Proc. of the 26th A.S.C.E. Annual Water Resour.
Plng. And Mgnt. Conference, Tempe, Arizona, June.

[66] Hestenes, M.R. (1969) “Multiplier and gradient methods”. Journal of Optimization
Theory and Applications, 4, 303-320.

[67] Kalman, J.A. (1961) “Continuity and convexity of projections and barycentric
coordinates in convex polyhedra”. Pacific Journal of Mathematics, 11, 1017-1022.

[68] Kelley, C.T. and Sachs, E.W. (1995) “Solution of optimal control problems by a
pointwise projected Newton method”. SIAM Journal on Control and Optimization,
Vol.33, Number 6, 1731-1757.

- 267 -
[69] Kolmanovsky, I.V. and Maizenberg, T.L. (2001) “Optimal control of continuous-time
linear systems with a time-varying, random delay”. Systems & Control Letters, 44, 119-
126.

[70] Kothare, M.V., Balakrishnan, V. and Morari, M. (1996) “Robust constrained model
predictive control using linear matrix inequalities”. Automatica, 32(10), 1361-1379.

[71] Lansey, K., Zhong, Q. A (1990) “Methodology for optimal control of pump stations.
Water Resources Infrastructure”. Proc. of 1990 A.S.C.E. Water Resour. Plng. and Mgnt
Specialty Conference, 58-61.

[72] Lee, B.H. and Deininger, R.A. (1992) “Optimal location of monitoring stations in water
distribution system”. Journal of Environmental Engineering, 118(1).

[73] Lee, K.R., Kim, J.H., Jeung, E.T. and Park, H.B. (2000) “Output feedback robust
Η∞ control of uncertain fuzzy dynamic systems with time-varying delay”. IEEE
Transactions on Fuzzy Systems, 8(6), 657-664, December.

[74] Lee, J., Kwon, W.H. and Choi, J. (1998) “On stability of constrained receding horizon
control with finite terminal weighting matrix”. Automatica, 34(12), 1607-1612.

[75] Lee, J.H. and Yu, Z. (1997) “Worst-case formulations of model predictive control for
systems with bounded parameters”. Automatica, 33(5), 763-781.

[76] Leyva-Ramos, J. and Pearson, A.E. (2000) “Output feedback stabilizing controller for
time-delay systems”. Automatica, 36(4), 613-617.

[77] Lozano, R., Dimogianopoulos, D. and Mahony, R. (2000) “Identification of linear time-
varying systems using a modified least-square algorithm”. Automatica, 36(7), 1009-1015.

[78] Maciejowski J.M. (2002) Predictive Control with Constraints. Pearson Education
Limited, Essex, England.

[79] Mahmoud, M.S. (2000) “Robust Η∞ control of discrete systems with uncertain
parameters and unknown delays”. Automatica, 36(4), 627-635.

[80] Makoudi, M. and Radouane, L. (2000) “A robust model reference adaptive control for
non-minimum phase systems with unknown or time-varying delay”. Automatica, 36(7):
1057-1065.

[81] Maksarov, D. and Norton, J.P. (1996) “State bounding with ellipsoidal set description of
the uncertainty”. International Journal of Control, 65(5), 847-866.

[82] Marinelli, A. and Furlani, G. (1999) “Water quality modeling: a case study”. Proc. of the
26th A.S.C.E. Annual Water Resour. Plng. And Mgnt. Conference, Tempe, Arizona, June.

[83] Marinescu, B. and Bourles, H. (2000) “Robust state predictive control with seperation
property: A reduced-state design for control systems with non-equal time delays”.
Automatica, 36(4), 555-562.

[84] de Mathelin, M. and Lozano, R. (1999) “Robust adaptive identification of slowly time-
varying parameters with bounded disturbances”. Automatica, 35(7), 1291-1305.

- 268 -
[85] Mayne, D. (1999) “Model predictive control: the challenge of uncertainty”. IEE Two-Day
Workshop on Model Predictive Control: Techniques and Applications - Day 1 (Ref. No.
1999/095), London, UK, 28 April.

[86] Mayne, D.Q., Rawlings, J.B., Rao, C.V. and Scokaert, P.O.M. (2000) “Constrained
model predictive control: Stability and optimality”. Automatica, 36(6):789-814.

[87] Megias, D., Serrano, J. and de Prada, C. (2002) “Min-max constrained quasi-infinite
horizon model predictive control using linear programming”. Journal of Process Control,
12(4), 495-505.

[88] Milanese, M., Norton, J.P., Piet-Lahanier, H. and Walter, E. (Eds). (1996) Bounding
Approaches to System Identification. Plenum Press, New York.

[89] De Moyer, R. and Horowitz, L.B. (1975). A System Approach to Water Distribution
Modelling and Control. Lexington Books, D.G. Heath, Lexington, MA.

[90] Muske, K.R. and Rawlings, J.B. (1993) “Linear model predictive control of unstable
processes”. Journal of Process Control, 3(2), 85-96.

[91] Nace, A., Harmant, Ph. and Villon, P. (2001) “Optimization of location and chlorine
dosage of the booster chlorination in water distribution network”. Proc. World Water &
Environmental Resources Congress, 20-24 May, Orlando, Florida.

[92] Niedzwiecki, M. (1994) “Identification of time-varying systems with abrupt parameter


changes”. Automatica, 30(3), 447-459.

[93] Nitivattananon, V., Sadowski, E.C. and Quimpo, R.G. (1996) “Optimization of water
supply system operation”. Journal of Water Resources Planning and Management,
ASCE, 122(5), 374-384.

[94] Norton, J.P. (1986) An Introduction to Identification. Academic Press Inc. (London) Ltd,
London.

[95] Norton, J.P. (1987) “Identification and application of bounded-parameter models”.


Automatica, 23(4), 497-507.

[96] Norton, J.P and Mo, S.H. (1990) “Parameter bounding for time-varying systems”.
Mathematics and computers in simulations, 32, 527-534.

[97] Norton, J.P. (1996) “Roles for deterministic bounding in environmental modelling”.
Ecological Modelling, 86, 157-161.

[98] Ogryczak, W. and Zorychta, K. (1996) Modular Optimizer for Mixed Integer
Programming MOMIP Version 2.3. Workingpaper, WP-96-106, IIASA, Laxenburg,
Austria, 1996.

[99] Oliveira, G.H.C., Amaral, W.C., Favier, G. and Dumont, G.A. (2000) “Constrained
robust predictive controller for uncertain processes modeled by orthonormal series
functions”. Automatica, 36(4), 563-571.

[100] Optimization Toolbox User’s Guide Version 2. (1999) The Math Works Inc.

- 269 -
[101] Ormsbee, L.E. and Lansey, K.E. (1994) “Optimal control of water supply pumping
systems”. Journal of Water Resources Planning and Management, ASCE, 120(2), 237-
252.

[102] Ostfelt, A., and Shamir, U. (1993a) “Optimal operation of multiquality networks, I:
Steady condition”. Journal of Water Resources Planning and Management, ASCE,
119(6), 645-662.

[103] Ostfelt, A., and Shamir, U. (1993b) “Optimal operation of multiquality networks, II:
Unsteady condition”. Journal of Water Resources Planning and Management, ASCE,
119(6), 663-684.

[104] Ostfeld A., Salomons, E., Shamir U. (2002) “Optimal operation of water distribution
systems under water quality unsteady conditions”. Proc. 1st Annual Environmental &
Water Resources Systems Analysis (EWRSA) Symposium, A.S.C.E. Environmental &
Water Resources Institute (EWRI) Annual Conference, Roanoke, Virginia, 19-22 May.

[105] Ozdemir, O.N. and Ger, A.M.(1999) “Unsteady 2-D chlorine transport in water
supply pipes”. Water Research, Vol.33, No.17, 3637-3645.

[106] Polycarpou, M.M., Uber, J.G., Desai, U. (1999) “Design of a Feedback Controller for
Water Distribution Systems Residual Maintenance”. Proc. of the 26th A.S.C.E. Annual
Water Resour. Plng. And Mgnt. Conference, Tempe, Arizona, June.

[107] Polycarpou, M.M., Uber, J.G., Wang, Z., Shang, F., Brdys, M.A. (2002). “Feedback
control of water quality”. IEEE Control Systems Magazine, 22(3), 68-87, June.

[108] Powell, M.J.D. (1969) “A method for nonlinear constraints in minimization


problems”. Optimization (Ed. Fletcher, R.). Academic Press, London.

[109] Primbs, J.A. and Nevistic, V. (2000) “Feasibility and stability of constrained finite
receding horizon control”. Automatica, 36(7), 965-971.

[110] Propato, M., Uber, J.G., Shang, F. and Polycarpou, M.M. (2001) “Integrated control
and booster system design for residual maintenance in water distribution systems”. Proc.
World Water & Environmental Resources Congress , 20-24 May, Orlando, Florida.

[111] Propato, M., Uber, J.G. and Polycarpou, M.M. (2002) “Control of booster disinfection
systems: optimal location of actuators and sensors”. Proc. of I International Conference
on Technology, Automation and Control of Wastewater and Drinking Water Systems -
TiASWiK’02, Sobieszewo –Gdansk, Poland, 19-21 June.

[112] Propato, M., Shang, F. and Uber, J.G. (2002) “On-line control of booster disinfection
systems: influence of modeling errors and affect on DBP formation”. Proc. of I
International Conference on Technology, Automation and Control of Wastewater and
Drinking Water Systems - TiASWiK’02, Sobieszewo –Gdansk, Poland, 19-21 June.

[113] Rawlings, J.B. and Muske, K.R. “The stability of constrained receding horizon
control”. IEEE Transactions on Automatic Control, 38(10), 1512-1516.

[114] Reinelt, W., Garulli, A. and Ljung, L. (2002) “Comparing different approaches to
model error modeling in robust identification”. Automatica, 38(5), 787-803.

- 270 -
[115] Rossman, L.A., Boulos, P.F. and Altman, T. (1993) “Discrete volume-element
method for network water-quality models”. Journal of Water Resources Planning and
Management, September/October, 119(5), 505-517.

[116] Rossman, L.A., Clark, R.M. and Grayman, W.M. (1994) “Modelling chlorine
residuals in drinking-water distribution systems”. Journal of Environmental Engineering,
July/August, 120(4), 803-820.

[117] Rossman, L.A., Uber, J.G. and Grayman, (1995) W.M. “Modeling disinfectant
residuals in drinking-water storage tanks”. Journal of Environmental Engineering,
121(10), 752-755, October.

[118] Rossman, L.A. and Boulos, P.F. (1996) “Numerical methods for modelling water
quality in distribution systems: a comparison”. Journal of Water Resources Planning and
Management, March/April, 122(2), 137-146.

[119] Rossman, L.A. EPANET 2.0 for Windows. (2000) Water Suply and Water Resourses
Division, National Risk Management Research Laboratory, Cincinnati, OH 45268.

[120] Sakarya, A. and Mays, L.W. (2000). “Optimal operation of water distribution system
pumps with water quality considerations”. Journal of Water Resources Planning and
Management, 126(4), pp-210-220.

[121] Scokaert, P.O.M. and Mayne, D.Q. (1998) “Min-Max feedback model predictive
control for constrained linear systems”. IEEE Transactions on Automatic Control, 43(8),
1136-1142.

[122] Shang, F., Uber, J.G. and Polycarpou, M.M. (2000) “Input-output model of water
quality in water distribution systems”. Proc. of the A.S.C.E. 2000 Joint Conference on
Water Resources Engineering and Water Resources Planning and Management ,
Minneapolis, Minnesota, 30 July-2 August.

[123] Shang, F., Uber, J., and Polycarpou, M. (2002) “Particle backtracking algorithm for
water distribution system analysis”. Journal of Environmental Engineering, 128(5), 441-
450, May.

[124] Shang, F., Propato, M. and Uber, J.G. (2002) “Extension of EPANET for multi
species modeling in water distribution systems”. Proc. of 1st Annual Environmental &
Water Resources Systems Analysis (EWRSA) Symposium, A.S.C.E. Environmental &
Water Resources Institute (EWRI) Annual Conference, Roanoke, Virginia, 19-22 May.

[125] Simulink: Writing S-function. (1998) The Math Works Inc.

[126] Subramaniam, P., Tryby, M., and Uber, J. (2000). “Set covering models for locating
booster chlorination stations in water distribution systems”. Proc. of the 2000 Joint Conf.
On Wat.Res.Eng. and Wat.Res.Plan. and Manag., ASCE., Minneapolis, MN.

[127] Teo, K.L., Goh, C.J. and Wong, K.H. (1991) A Unified Computational Approach to
Optimal Control Problems, John Wiley and Sons,Inc., New York.

[128] Trawicki, D., Duzinkiewicz, K., Brdys, M.A. (2002) “Optimising model predictive
controller for hierarchical control of integrated quality and quantity in drinking water
distribution systems”. I International Conference on Technology, Automation and
Control of Wastewater and Drinking Water Systems-TiASWiK'02, Gdansk-Sobieszewo,
June 19-21, Poland.

- 271 -
[129] Tryby, M., Bocceli, J., Uber. J., Rossman, L. (In Press). “A facility location model for
booster disinfection of water supply network”. ASCE J. of Wat. Res. Plan. and Manag,
2002.

[130] Tyagi, A.K. and Rowe, T.O. (2002) “Modelling of water quality in a rural water
distribution system”. 1st Annual Environmental & Water Resources Systems Analysis
(EWRSA) Symposium, A.S.C.E. Environmental & Water Resources Institute (EWRI)
Annual Conference, Roanoke, Virginia, 19-22 May.

[131] United States Environmental Protection Agency (USEPA). (1992). Water treatment
plant simulation program user‘s manual, Version 1.21. Drinking Water Technology
Branch, Drinking Water Standards Division, Office of Ground Water and Drinking
Water, Malcolm Pirnie, Inc.

[132] Using Matlab Version 5. (1999) The Math Works Inc.

[133] Veres, S.M. and Norton, J.P. (1991) “Structure selection for bounded-parameter
models: consistency conditions and selection criterion”. IEEE Transactions on Automatic
Control, 36(4), 474-481, April.

[134] Veres, S.M. and Norton, J.P. (1993) “Predictive self-tuning control by parameter
bounding and worst-case design”. Automatica, 29(4), 911-928.

[135] Veres, S.M. (2000) “Worst-case dual control: basic results”. International Journal of
Control, 73(18), 1621-1646.

[136] Vicino, A. and Zappa, G. (1996) “Sequential approximation of feasible parameter sets
for identification with set membership uncertainty”. IEEE Transactions on Automatic
Control, 41(6), 774-785, June.

[137] Walter, E and Piet-Lahanier, H. (1990) “Estimation of parameter bounds from


bounded-error data: a survey”. Mathematics and Computers in Simulation, 32, 449-468.

[138] Walter, E. and Piet-Lahanier, H. (1993) “Guaranteed linear and nonlinear parameter
estimation from bounded-error data: a survey”. ISCAS '93, 1993 IEEE International
Symposium on Circuits and Systems, On page(s): 774-777, Chicago, IL,USA, 3-6 May.

[139] Watkins, J. and Yurkovich, S. (1997) “Parameter set estimation algorithms for time-
varying systems”. International Journal of Control, 66(5), 711-731.

[140] Weston, P.F. and Norton, J.P. (1997) “Detection and estimation of abrupt changes in
input or state”. International Journal of Control, 67(5), 699-711.

[141] Wang, Z., Polycarpou, M.M. and Uber, J.G. (2000) “Decentralized model reference
adaptive control of water quality in water distribution networks”. Proc. of 2000 IEEE
International Symposium on Intelligent Control (ISIC’2000), Patras, Greece, 17-19 July.

[142] Wang, Z., Polycarpou, M.M., Shang, F. and Uber, J.G. (2000) “Adaptive control
formulation for chlorine residual maintenance in water distribution systems”. Proc. of the
A.S.C.E. 2000 Joint Conference on Water Resources Engineering and Water Resources
Planning and Management , Minneapolis, Minnesota, 30 July-2 August.

- 272 -
[143] Wang, Z., Polycarpou, M.M., Shang, F. and Uber, J.G. (2001) “Design of feedback
control algorithm for chlorine residual maintenance in water distribution systems”. Proc.
World Water & Environmental Resources Congress , 20-24 May, Orlando, Florida.

[144] Woolschlager, J. and Soucie, W.J. (2003) “Chlorine reactivity with concrete piper
surface”. Proc. of World Water and Environmental Resources Congress 2003 and
Related Symposia, Pennsylvania, 23-26 June.

[145] Zhou, D.H. and Frank, P.M. (2000) “A real-time estimation approach to time-varying
time delay and parameter of NARX processes”. Computers and Checmical Engineering,
23, 1763-1772.

[146] Zierolf, M.L., Polycarpou, M.M., Uber, J.G. (1998) “Development and auto-
calibration of an input-output model of chlorine transport in drinking water distribution
systems”. IEEE Transactions on Control Systems Technology, 6(4), 543-553, July.

[Website Reference]
Availability of the websites was last checked on 15/July/2003.

[147] AccuChlor2TM, Residual Chlorine Measurement System: Operating Manual, GLI


International, Inc. http://www.gliint.com, 2002.

[148] Braghetta, A., Jacangelo, J., Trussell, R.R. and Meheus J. (1997) The Practice of
Chlorination: Application, Efficacy, Problems and Alternatives. International Water
Association (IWA), http://www.iawq.org.uk/pdf/bp0004.pdf, August.

[149] C3 (1997) Drinking Water Chlorination White Paper: A Review of Disinfection


Practices and Issues. Website of Chlorine Chemistry Council, business council of
American Chemistry Council.
http://c3.org/chlorine_knowledge_center/whitepapercl.html, 12 June.

[150] Christman K. (1998) The history of Chlorine. Website of Chlorine Chemistry Council,
business council of American Chemistry Council.
http://c3.org/chlorine_knowledge_center/history.html.

[151] Clark, R.M. and Boutin B.K. (2001) “Controlling Disinfection By-Products and
Microbial Contaminants in Drinking Water”, USEPA/600/R-01/110, Office of Research
and Development, United States Environmental Protection Agency, December.
http://www.epa.gov/ORD/NRMRL/Pubs/600R01110/600R01110.htm.

[152] Connell G.F. (1998) European Water Disinfection Practices Parallel U.S. Treatment
Methods.
http://c3.org/news_center/ccc_periodicals/drinking_water/summer1998/disinfection.html.

[153] EPA Meeting Summary. (1999) DBP Reproductive and Developmental Health
Effects. M/DBP Stage 2 Federal Advisory Committee (FACA 2). Washington, DC, July
21-22. http://www.epa.gov/safewater/mdbp/st2jul99.html.

[154] EPA (2002) Drinking Water Priority Rulemaking: Microbial and Disinfection
Byproduct Rules. http://www.epa.gov/OGWDW/mdbp/mdbp.html.

[155] Frederick W.P. (1997) Drinking water disinfection with chlorine: An effective public
health practice. Website of Chlorine Chemistry Council, business council of American
Chemistry Council, April. http://c3.org/news_center/third_party/disinfection.html.

- 273 -
[156] Matlab Support (2002) MEX-files Guide, The MathWorks, Inc.
http://www.mathworks.com/support/tech-notes/1600/1605.shtml.

[157] UK Drinking Water Inspectorate (2002).


http://www.dwi.gov.uk/consumer/consumer/disinf.htm.

[158] WHO (1993) Guidelines for drinking-water quality. 2nd Ed. Vol. 1-
Recommendations, Geneva, World Health Organization.
http://www.who.int/water_sanitation_health/dwq/en/.

[159] WHO (1998) Guidelines for drinking-water quality. 2nd Ed. Addendum to Vol. 1-
Recommendations, Geneva, World Health Organization.
http://www.who.int/water_sanitation_health/dwq/en/.

[160] WHO (2000) Report of Drinking Water Quality Committee Meeting, Berlin,
5~9 June, 2000, Geneva, World Health Organization.
http://www.who.int/water_sanitation_health/dwq/en/.

- 274 -
Appendix A Simple DWDS Network File

[TITLE]
Quality Model
A simple example of modeling chlorine decay. Both bulk and
wall reactions are included.

[JUNCTIONS]
;ID Elev Demand Pattern
10 710 0 ;
11 710 150 ;
12 700 150 ;
13 695 100 ;
21 700 150 ;
22 695 200 ;
23 690 150 ;
31 700 100 ;
32 710 100 ;
1 850 0 ;

[RESERVOIRS]
;ID Head Pattern
9 800 ;

[TANKS]
;ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
2 850 121 100 160 50.5 0 ;

[PIPES]
;ID Node1 Node2 Length Diameter Roughness MinorLoss Status
10 10 11 100 18 100 0 Open ;
11 11 12 2640 14 100 0 Open ;
12 12 13 2640 10 100 0 Open ;
21 21 22 2640 10 100 0 Open ;
22 22 23 2640 12 100 0 Open ;
31 31 32 2640 6 100 0 Open ;
110 1 12 200 18 100 0 Open ;
111 11 21 2640 10 100 0 Open ;
112 12 22 2640 12 100 0 Open ;
113 13 23 2640 8 100 0 Open ;
121 21 31 2640 8 100 0 Open ;
122 22 32 2640 6 100 0 Open ;
1 2 1 1 18 100 0 Open ;

[PUMPS]
;ID Node1 Node2 Parameters
9 9 10 HEAD 1 ;

[VALVES]
;ID Node1 Node2 Diameter Type Setting MinorLoss

[TAGS]
[DEMANDS]
;Junction Demand Pattern Category

[STATUS]
;ID Status/Setting
[PATTERNS]
;ID Multipliers
;Demand Pattern

- 275 -
1 1.0 1.2 1.35 1.5 1.35 1.2
1 1.1 1.0 0.9 0.8 0.9 1.0
2 1.0 1.0 0.8 0.65 0.3 0.5
2 0.9 1.0 1.0 0.8 1.0 1.0
3 1.6 1.6 1.6 1.6 1.6 1.6
3 0.4 0.4 0.4 0.4 0.4 0.4
;CONSTANT INJECTION
4 1 1 1 1 1 1
[CURVES]
;ID X-Value Y-Value
;PUMP: Pump Curve for Pump 9
1 1500 250

[CONTROLS]
LINK 9 OPEN IF NODE 2 BELOW 104.5
LINK 9 CLOSED IF NODE 2 ABOVE 150
[RULES]
[ENERGY]
Global Efficiency 75
Global Price 0.0
Demand Charge 0.0
[EMITTERS]
;Junction Coefficient

[QUALITY]
;Node InitQual
10 0
11 0
12 0
13 0
21 0
22 0
23 0
31 0
32 0
9 0
2 0.4

[SOURCES]
;Node Type Quality Pattern
11 FLOWPACED 0.5 4
[REACTIONS]
;Type Pipe/Tank Coefficient

[REACTIONS]
Order Bulk 1
Order Wall 1
Global Bulk -0.5
Global Wall -1.0
Limiting Potential 0.0
Roughness Correlation 0.0

[MIXING]
;Tank Model

[TIMES]
Duration 24:00
Hydraulic Timestep 2:00
Quality Timestep 0:10
Pattern Timestep 2:00

- 276 -
Pattern Start 0:00
Report Timestep 0:01
Report Start 0:00
Start ClockTime 12 am
Statistic NONE
[REPORT]
Status Full
Summary No
Page 0

[OPTIONS]
Units GPM
Headloss H-W
Specific Gravity 1.0
Viscosity 1.0
Trials 40
Accuracy 0.001
Unbalanced Continue 10
Pattern 1
Demand Multiplier 1.0
Emitter Exponent 0.5
Quality Chlorine mg/L
Diffusivity 1.0
Tolerance 0.001

[COORDINATES]
;Node X-Coord Y-Coord
10 20.00 70.00
11 30.00 70.00
12 50.00 70.00
13 70.00 70.00
21 30.00 40.00
22 50.00 40.00
23 70.00 40.00
31 30.00 10.00
32 50.00 10.00
1 49.96 84.25
9 10.00 70.00
2 50.00 90.00

[VERTICES]
;Link X-Coord Y-Coord

[LABELS]
;X-Coord Y-Coord Label & Anchor Node
-0.57 72.11 "Source"
13.48 68.13 "Pump"
43.85 91.21 "Tank"

[BACKDROP]
DIMENSIONS 7.00 6.00 73.00 94.00
UNITS None
FILE
OFFSET 0.00 0.00
[END]

- 277 -
Appendix B Network File of a Benchmark DWDS

[TITLE]
Benchmark Quality Model

[JUNCTIONS]
;ID Elev Demand Pattern
5 100 1.0 ;
2 110 1.0 ;
1 90 0 ;
7 97 3.0 ;
8 103 1.5 ;
3 95 1.0 ;
4 105 3.0 ;
6 103 3.5 ;
13 110 0 ;
14 120 0 ;
16 130 0.25 ;
15 135 0.25 ;
10 112 0 ;
9 107 0.0 ;
12 112 0.5 ;
11 115 0.5 ;
101 90 0 ;
201 100 0 ;

[RESERVOIRS]
;ID Head Pattern
200 90 ;
100 90 ;

[TANKS]
;ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
17 240 90 50 150 30 0 ;
18 240 78 50 150 30 0 ;
19 240 78 40 150 30 0 ;

[PIPES]
;ID Node1 Node2 Length Diameter Roughness MinorLoss Status
2 1 2 800 18 100 0 Open ;
3 2 3 5000 16 100 0 Open ;
4 3 17 700 10 100 0 Open ;
5 3 4 3700 12 100 0 Open ;
6 4 5 3900 15 100 0 Open ;
13 5 6 2900 12 100 0 Open ;
11 6 7 3700 12 100 0 Open ;
9 3 7 3100 10 100 0 Open ;
10 2 7 5500 15 100 0 Open ;
17 2 10 3100 12 100 0 Open ;
18 10 9 1900 12 100 0 Open ;
21 9 12 1650 8 100 0 Open ;
20 12 11 1500 6 100 0 Open ;
19 10 11 1600 8 100 0 Open ;
22 8 9 2900 8 100 0 Open ;
16 7 8 2700 10 100 0 Open ;
15 6 13 2500 10 100 0 Open ;
24 13 8 3100 12 100 0 Open ;
25 13 14 1600 8 100 0 Open ;

- 278 -
26 14 16 1750 6 100 0 Open ;
27 14 15 1500 6 100 0 Open ;
23 19 8 1900 12 100 0 Open ;
12 6 18 900 8 100 0 Open ;
14 5 13 4500 15 100 0 Open ;
8 4 6 2500 10 100 0 Open ;
7 201 5 2100 16 100 0 Open ;
1 101 1 2000 20 100 0 Open ;

[PUMPS]
;ID Node1 Node2 Parameters
101 100 101 HEAD 1 PATTERN 101 ;
201 200 201 HEAD 1 PATTERN 201 ;

[VALVES]
;ID Node1 Node2 Diameter Type Setting MinorLoss

[TAGS]

[DEMANDS]
;Junction Demand Pattern Category

[STATUS]
;ID Status/Setting

[PATTERNS]
;ID Multipliers
;Demand Pattern
1 0.7 0.6 0.5 0.5 0.5 0.6
1 0.8 1.0 1.1 1.25 1.25 1.2
1 1.15 1.15 1.1 1.0 1.1 1.15
1 1.25 1.4 1.25 1.2 1.1 1.0
;pump 101
101 1 1 1 1 1 1
101 1 1 1 1.25 1.25 1.25
101 1.2 1.2 1.2 1.3 1.3 1.3
101 1.3 1.4 1.3 0.98 0.98 0.98
;pump 201
201 1 1 1 1 1 1
201 1 1 1 0.95 0.95 0.95
201 1.2 1.2 1.2 1.3 1.3 1.3
201 1.3 1.3 1.3 1.05 1.05 1.05

[CURVES]
;ID X-Value Y-Value
;PUMP:
1 6.0 280

[CONTROLS]

[RULES]

[ENERGY]
Global Efficiency 75
Global Price 0
Demand Charge 0

[EMITTERS]
;Junction Coefficient

- 279 -
[QUALITY]
;Node InitQual
17 0.0
18 0.0
19 1.0

[SOURCES]
;Node Type Quality Pattern
5 SETPOINT 1.0
10 SETPOINT 1.0

[REACTIONS]
;Type Pipe/Tank Coefficient

[REACTIONS]
Order Bulk 1
Order Wall 1
Global Bulk -0.5
Global Wall -1
Limiting Potential 0
Roughness Correlation 0

[MIXING]
;Tank Model

[TIMES]
Duration 24
Hydraulic Timestep 00:30
Quality Timestep 0:05
Pattern Timestep 1:00
Pattern Start 0:00
Report Timestep 0:05
Report Start 0:00
Start ClockTime 12 am
Statistic None

[REPORT]
Status No
Summary No
Page 0

[OPTIONS]
Units MGD
Headloss H-W
Specific Gravity 1
Viscosity 1
Trials 40
Accuracy 0.001
Unbalanced Continue 10
Pattern 1
Demand Multiplier 1.0
Emitter Exponent 0.5
Quality Chlorine mg/L
Diffusivity 1
Tolerance 0.01

[COORDINATES]
;Node X-Coord Y-Coord
5 3985.36 8389.12
2 4048.12 1297.07

- 280 -
1 3106.69 1297.07
7 4801.26 4832.64
8 6579.50 4769.87
3 2709.21 4351.46
4 3127.61 6589.96
6 4571.13 6924.69
13 6286.61 6903.77
14 7290.79 6945.61
16 8462.34 7029.29
15 7290.79 6066.95
10 6474.90 1903.77
9 6474.90 2845.19
12 7416.32 2845.19
11 7416.32 1903.77
101 2374.48 1276.15
201 4633.89 8535.56
200 5428.87 8619.25
100 1621.34 1276.15
17 1976.99 4351.46
18 3797.07 7301.26
19 7541.84 4769.87

[VERTICES]
;Link X-Coord Y-Coord

[LABELS]
;X-Coord Y-Coord Label & Anchor Node

[BACKDROP]
DIMENSIONS 0.00 0.00 10000.00 10000.00
UNITS None
FILE
OFFSET 0.00 0.00
[END]

- 281 -
Appendix C A Sample MPS File for MOMIP Solver

Sample file in Mathematical Programming System (MPS) Format.

MIN
OBJ cost
RHS I/1993
NAME AC_Model
ROWS
N cost
L m1:a1
L m1:a2
L m2:a1
L m2:a2
E m1:d1
E m1:d2
E m1:d3
E m2:d2
E m2:d3
E m2:d4
L bw1
L bw2
L bw3
G m1:w1
G m1:w2
G m1:w3
G m2:w1
G m2:w2
G m2:w3
E ver_w1
E ver_w2
E ver_w3
E sel_w1 'SOSROW'
E sel_w2 'SOSROW'
E sel_w3 'SOSROW'
COLUMNS
sizes 'MARKER' 2 'INTORG'
w1_u1 ver_w1 50 cost 200
w1_u1 sel_w1 1
w1_u2 ver_w1 80 cost 250
w1_u2 sel_w1 1
w2_u1 sel_w2 1
w2_u2 ver_w2 50 cost 200
w2_u2 sel_w2 1
w2_u3 ver_w2 100 cost 300
w2_u3 sel_w2 1
w3_u1 sel_w3 1
w3_u2 ver_w3 60 cost 200
w3_u2 sel_w3 1
w3_u3 ver_w3 130 cost 300
w3_u3 sel_w3 1
esizes 'MARKER' 'INTEND'
flows 'MARKER' 1 'INTORG'
m1:a1_w1 cost 2 m1:a1 1
m1:a1_w1 bw1 1 m1:w1 1
m1:a1_w2 cost 5 m1:a1 1
m1:a1_w2 bw2 1 m1:w2 1
m1:a1_w3 cost 3 m1:a1 1
m1:a1_w3 bw3 1 m1:w3 1
m1:a2_w1 cost 9 m1:a2 1

- 282 -
m1:a2_w1 bw1 1 m1:w1 1
m1:a2_w2 cost 4 m1:a2 1
m1:a2_w2 bw2 1 m1:w2 1
m1:a2_w3 cost 7 m1:a2 1
m1:a2_w3 bw3 1 m1:w3 1
m2:a1_w1 cost 4 m2:a1 1
m2:a1_w1 bw1 1 m2:w1 1
m2:a1_w2 cost 7 m2:a1 1
m2:a1_w2 bw2 1 m2:w2 1
m2:a1_w3 cost 9 m2:a1 1
m2:a1_w3 bw3 1 m2:w3 1
m2:a2_w1 cost 6 m2:a2 1
m2:a2_w1 bw1 1 m2:w1 1
m2:a2_w2 cost 1 m2:a2 1
m2:a2_w2 bw2 1 m2:w2 1
m2:a2_w3 cost 2 m2:a2 1
m2:a2_w3 bw3 1 m2:w3 1
m1:w1_d1 cost 7 m1:d1 1
m1:w1_d1 m1:w1 -1
m1:w1_d2 cost 1 m1:d2 1
m1:w1_d2 m1:w1 -1
m1:w1_d3 cost 6 m1:d3 1
m1:w1_d3 m1:w1 -1
m1:w2_d1 cost 14 m1:d1 1
m1:w2_d1 m1:w2 -1
m1:w2_d2 cost 3 m1:d2 1
m1:w2_d2 m1:w2 -1
m1:w2_d3 cost 5 m1:d3 1
m1:w2_d3 m1:w2 -1
m1:w3_d1 cost 2 m1:d1 1
m1:w3_d1 m1:w3 -1
m1:w3_d2 cost 7 m1:d2 1
m1:w3_d2 m1:w3 -1
m1:w3_d3 cost 9 m1:d3 1
m1:w3_d3 m1:w3 -1
m2:w1_d2 cost 1 m2:d2 1
m2:w1_d2 m2:w1 -1
m2:w1_d3 cost 6 m2:d3 1
m2:w1_d3 m2:w1 -1
m2:w1_d4 cost 4 m2:d4 1
m2:w1_d4 m2:w1 -1
m2:w2_d2 cost 3 m2:d2 1
m2:w2_d2 m2:w2 -1
m2:w2_d3 cost 5 m2:d3 1
m2:w2_d3 m2:w2 -1
m2:w2_d4 cost 8 m2:d4 1
m2:w2_d4 m2:w2 -1
m2:w3_d2 cost 7 m2:d2 1
m2:w3_d2 m2:w3 -1
m2:w3_d3 cost 9 m2:d3 1
m2:w3_d3 m2:w3 -1
m2:w3_d4 cost 1 m2:d4 1
m2:w3_d4 m2:w3 -1
eflows 'MARKER' 'INTEND'
w1 bw1 -1 ver_w1 -1
w2 bw2 -1 ver_w2 -1
w3 bw3 -1 ver_w3 -1
RHS
I/1993 m1:a1 80
I/1993 m1:a2 30
I/1993 m2:a1 40

- 283 -
I/1993 m2:a2 60
I/1993 m1:d1 60
I/1993 m1:d2 30
I/1993 m1:d3 15
I/1993 m2:d2 30
I/1993 m2:d3 25
I/1993 m2:d4 40
I/1993 sel_w1 1
I/1993 sel_w2 1
I/1993 sel_w3 1
BOUNDS
UP BD w1_u1 1
UP BD w1_u2 1
UP BD w2_u1 1
UP BD w2_u2 1
UP BD w2_u3 1
UP BD w3_u1 1
UP BD w3_u2 1
UP BD w3_u3 1
UP BD m1:a1_w1 200
UP BD m1:a1_w2 200
UP BD m1:a1_w3 200
UP BD m1:a2_w1 200
UP BD m1:a2_w2 200
UP BD m1:a2_w3 200
UP BD m2:a1_w1 200
UP BD m2:a1_w2 200
UP BD m2:a1_w3 200
UP BD m2:a2_w1 200
UP BD m2:a2_w2 200
UP BD m2:a2_w3 200
UP BD m1:w1_d1 200
UP BD m1:w1_d2 200
UP BD m1:w1_d3 200
UP BD m1:w2_d1 200
UP BD m1:w2_d2 200
UP BD m1:w2_d3 200
UP BD m1:w3_d1 200
UP BD m1:w3_d2 200
UP BD m1:w3_d3 200
UP BD m2:w1_d2 200
UP BD m2:w1_d3 200
UP BD m2:w1_d4 200
UP BD m2:w2_d2 200
UP BD m2:w2_d3 200
UP BD m2:w2_d4 200
UP BD m2:w3_d2 200
UP BD m2:w3_d3 200
UP BD m2:w3_d4 200
ENDATA

- 284 -
Appendix D Call MOMIP Solver in MATLAB

MOMIP version 2.3 is an optimisation solver for middle-size mixed integer programming
problems, based on the branch-and-bound algorithm. It is designed as part of a wider linear
programming modular library being developed within the IIASA (International Institute for
Applied Systems Analysis) project on “Methodology and Techniques of Decision Analysis”.
The library is a collection of independent modules, implemented as C++ classes, providing all
the necessary functions of data input, data transfer, problem solution, and result output.
[Ogryczak and Zorychta 1996].

“MEX-files are only officially supported in MATLAB if they are written in C or FORTRAN.
C++ MEX-files are not officially supported. With some work and tweaking on your own, you
may be able to get a C++ MEX-file to work as well” [Matlab Support, 2003]. In order to use
the MOMIP solver implemented in C++, the optimisation problem is formulated first and a
MPS file describing the optimisation problem is generated in Matlab by using a MEX-
function. Then the MPS data is to be passed to a separately running MOMIP solver that is out
of Matlab and under OS, after the problem has been solved the result is passed to the Matlab
S-function through the data interface. The communication between the MOMIP solver and S-
function in Matlab is implemented by using TCP/IP technology. The structure of the interface
is described in the following figure:

MOMIP
Solver

Data Communication Interface


TCP/IP

Mex-function

Matlab/Simulink
OS

Program of TCP/IP Communication Interface:

tcp_app.h

#define SERVER 1
#define CLIENT 0
#define SERVICE "9999"

tcp_app.c

#include <stdio.h>

- 285 -
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <netinet/in.h>
#include <netdb.h>
#include <strings.h>
#include <stdlib.h>

#include "tcp_app.h"

extern int errno ;

int init_client(char *service)


{
struct hostent *sh ;
struct servent *sp ;
struct sockaddr_in remote ;
int rc, sock_id ;
char *hostname = "maiktoli" , buf[32], serviceport[32] ;
FILE *fp ;

fp = fopen("/tmp/mip.hst", "r") ;
if(fp != NULL) {
fgets(buf, 24, fp) ;
sscanf(buf, "%s", hostname) ;
fclose(fp) ;
}
sh = gethostbyname(hostname) ;
if (sh == NULL) return(-1) ;

/*
sp = getservbyname(service, "tcp") ;
if (sp == NULL) return(-2) ;
*/

bzero(&remote, sizeof(remote)) ;
remote.sin_family = AF_INET ;
bcopy(sh->h_addr, &remote.sin_addr, sh->h_length) ;
/*remote.sin_port = sp->s_port ;*/
remote.sin_port = atoi(SERVICE) ;
fp = fopen("/tmp/mip.srv", "r") ;
if(fp != NULL) {
printf("get port in file\n") ;
fgets(buf, 24, fp) ;
sscanf(buf, "%s", serviceport) ;
fclose(fp) ;
remote.sin_port = atoi(serviceport) ;
}
sock_id = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) ;
if (sock_id < 0) return(-3) ;

rc = (connect(sock_id, (struct sockaddr *)&remote, sizeof(remote))) ;


if (sock_id <= 0) return(-4) ;

return(sock_id) ;
}

int init_server(char *service)


{
struct servent *sp ;

- 286 -
struct sockaddr_in local ;
int length, sock_id, rtn ;
FILE *fp ;
char buf[32], serviceport[24] ;

/*
sp = getservbyname(service, "tcp") ;
if ( sp == NULL ) return(-1) ;
*/

bzero((char *)&local, sizeof(local)) ;


local.sin_family = AF_INET ;
local.sin_addr.s_addr = htonl(INADDR_ANY) ;
/*local.sin_port = sp->s_port ;*/
local.sin_port = atoi(SERVICE) ;
fp = fopen("/tmp/mip.srv", "r") ;
if(fp != NULL) {
printf("get port in file\n") ;
fgets(buf, 24, fp) ;
sscanf(buf, "%s", serviceport) ;
fclose(fp) ;
local.sin_port = atoi(serviceport) ;
}
sock_id = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) ;
if(sock_id < 0) return(-2) ;

rtn = bind(sock_id, (struct sockaddr *)&local, sizeof(local)) ;


if(rtn < 0) {
printf("bind return %d error no %d\n", rtn, errno) ;
return(-3) ;
}

if( listen(sock_id, 1) < 0 ) return(-4) ;

length = sizeof(local) ;
sock_id = accept(sock_id, (struct sockaddr *)&local, &length) ;
if( sock_id <= 0) return(-5) ;

return(sock_id) ;
}

int tcp_read(int fd, char *ptr, int n)


{
int nleft = n, nread ;

while (nleft > 0) {


nread = read(fd, ptr, nleft) ;
if (nread < 0) {
return(-1) ;
}
else if (nread == 0) break ;

nleft -= nread ;
ptr += nread ;
}

return(n - nleft) ;
}

int tcp_write(int fd, char *ptr, int n)


{

- 287 -
int nleft = n, wc ;

while (nleft > 0) {


wc = write(fd, ptr, nleft) ;
if (wc <= 0) {
return(-1) ;
}
nleft -= wc ;
ptr += wc ;
}

return(n - nleft) ;
}

int tcp_init(int play_mode)


{
char msg[32] ;
int cnt, sock_id ;

if(play_mode == CLIENT) {
sock_id = init_client(SERVICE) ;
if(sock_id < 0) {
printf("init client recv error %d", sock_id) ;
return(-2) ;
}
else {
cnt = tcp_write(sock_id, "MOMIP", 5) ;
if(cnt == 5) printf("connected ok\n") ;
else printf("send fail %d\n", cnt) ;
}
}

if(play_mode == SERVER) {
printf("wait for connecting...") ;
sock_id = init_server(SERVICE) ;
if(sock_id < 0) {
printf("init server recv error: %d", sock_id) ;
return(-3) ;
}
else {
memset(msg, 0x00, sizeof(msg)) ;
cnt = tcp_read(sock_id, msg, 5) ;
if(strncmp(msg, "MOMIP", 5) == 0) printf("conncted ok\n") ;
else printf("read fialed %d\n", cnt) ;
}
}

return(sock_id) ;
}

int SendToMomip(int sock_id, char *msg, int n)


{
int cnt ;

cnt = tcp_write(sock_id, msg, n) ;


if(cnt != n) {
printf("send to MOMIP error %d\n", cnt) ;
return(-1) ;
}
else return(0) ;
}

- 288 -
int SendToMatlab(int sock_id, char *msg, int n)
{
int cnt ;

cnt = tcp_write(sock_id, msg, n) ;


if(cnt != n) {
printf("send to matlab error %d\n", cnt) ;
return(-1) ;
}
else return(0) ;
}

int ReceiveFromMatlab(int sock_id, char *msg, int n)


{
int cnt ;

cnt = tcp_read(sock_id, msg, n) ;


if(cnt != n) {
printf("read from matlab error %d\n", cnt) ;
return(-1) ;
}
else return(0) ;
}

int ReceiveFromMomip(int sock_id, char *msg, int n)


{
int cnt ;

cnt = tcp_read(sock_id, msg, n) ;


if(cnt != n) {
printf("read from momip error %d\n", cnt) ;
return(-1) ;
}
else return(0) ;
}

- 289 -
Appendix E Embedding EPANET2.0 into Matlab

Makefile of compiling s-function ENCl.mexsol

Home = /home/changt/matlab/epanet
INCLUDE = $(Home)
CFLAGS = -I$(INCLUDE)
LIB =
NULL: $(Home)/ENCl.mexsol
EPANET: $(Home)/epanet
MAIN = $(Home)/epanet.o
SUB = $(Home)/hash.o \
$(Home)/hydraul.o \
$(Home)/inpfile.o \
$(Home)/input1.o \
$(Home)/input2.o \
$(Home)/input3.o \
$(Home)/mempool.o \
$(Home)/output.o \
$(Home)/quality.o \
$(Home)/report.o \
$(Home)/rules.o \
$(Home)/smatrix.o
$(Home)/epanet: $(SUB)
cc -o $(Home)/epanet -Os $(MAIN) $(SUB) -lm
$(Home)/ENCl.mexsol: ENCl.c $(SUB)
mex ENCl.c $(SUB)
cp -f ENCl.mexsol ../UK2001

Main entry of the s-function ENCl.c, which is the modification and


extension of epanet.c

#define S_FUNCTION_NAME ENCl


#define S_FUNCTION_LEVEL 2

#include "simstruc.h"

#define U(element) (*uPtrs[element]) /* Pointer to Input Port0 */


#define DWDN(S) ssGetSFcnParam(S, 0)
#define ReportTime(S) ssGetSFcnParam(S, 1)
#define QualityStep(S) ssGetSFcnParam(S, 2)
#define InjectNode(S) ssGetSFcnParam(S, 3)
#define MonitorNode(S) ssGetSFcnParam(S, 4)

static void mdlInitializeSizes(SimStruct *S)


{
int errcode, i ;
char WaterNetworkName[128], InjectNode[128], MonitorNode[128], *tmp ;
ssSetNumSFcnParams(S, 5); /* Number of expected parameters */
if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) {
return; /* Parameter mismatch will be reported by Simulink */
}
mxGetString(DWDN(S), WaterNetworkName, 128) ;
mxGetString(InjectNode(S), InjectNode, 128) ;
mxGetString(MonitorNode(S), MonitorNode, 128) ;
InputNumber = 1 ;
for(i = 0 ; i < strlen(InjectNode) ; i++) {
if(InjectNode[i] == ',') InputNumber++ ;

- 290 -
}
OutputNumber = 1 ;
for(i = 0 ; i < strlen(MonitorNode) ; i++) {
if(MonitorNode[i] == ',') OutputNumber++ ;
}
printf("Input number=%d Output number=%d\n", InputNumber, OutputNumber) ;

ssSetNumContStates(S, 0);
ssSetNumDiscStates(S, 1);

if (!ssSetNumInputPorts(S, 1)) return;


ssSetInputPortWidth(S, 0, InputNumber);
ssSetInputPortDirectFeedThrough(S, 0, 1);

if (!ssSetNumOutputPorts(S, 1)) return;


ssSetOutputPortWidth(S, 0, OutputNumber);

ssSetNumSampleTimes(S, 1);
ssSetNumRWork(S, 0);
ssSetNumIWork(S, 0);
ssSetNumPWork(S, 0);
ssSetNumModes(S, 0);
ssSetNumNonsampledZCs(S, 0);

ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE);

/*=============Hydraulic calculation===============*/
printf("\nNetwork name is:<%s>\n", WaterNetworkName) ;
errcode = ENopen(WaterNetworkName, "epanet.rpt", "") ;
if (errcode != 0) {
printf("EPANET ENopen %d\n", errcode) ;
getchar() ;
}
errcode = ENsolveH() ;
if (errcode != 0) {
printf("EPANET ENsolveH %d\n", errcode) ;
getchar() ;
}

tmp = strtok(InjectNode, ",") ;


printf("\nInjection is: ") ;
for(i = 0 ; i < InputNumber ; i++) {
printf("%s ", tmp) ;
errcode = ENgetnodeindex(tmp, &(EN_input_idx[i])) ;
if (errcode != 0) {
printf("EPANET ENgetnodeindex %d\n", errcode) ;
getchar() ;
}
tmp = strtok(NULL, ",") ;
}

tmp = strtok(MonitorNode, ",") ;


printf("\nMonitoring is: ") ;
for(i = 0 ; i < OutputNumber ; i++) {
printf("%s ", tmp) ;
errcode = ENgetnodeindex(tmp, &(EN_output_idx[i])) ;
if (errcode != 0) {
printf("EPANET ENgetnodeindexO %d\n", errcode) ;
getchar() ;
}
tmp = strtok(NULL, ",") ;

- 291 -
}
printf("\n") ;

errcode = ENsetqualtype(EN_CHEM, "Chlorine", "mg/L", "") ;


if (errcode != 0) {
printf("EPANET ENsetqualtype %d\n", errcode) ;
getchar() ;
}
errcode = ENopenQ() ;
if (errcode != 0) {
printf("EPANET ENopenQ %d\n", errcode) ;
getchar() ;
}
errcode = ENinitQ(0) ;
if (errcode != 0) {
printf("EPANET ENinitQ %d\n", errcode) ;
getchar() ;
}
}

static void mdlInitializeSampleTimes(SimStruct *S)


{
ssSetSampleTime(S, 0, mxGetScalar(QualityStep(S))) ;
ssSetOffsetTime(S, 0, 0.0);
}

#define MDL_INITIALIZE_CONDITIONS
static void mdlInitializeConditions(SimStruct *S)
{
real_T *x0 = ssGetRealDiscStates(S);
int_T lp;

x0[0] = 0.0 ;
}

static void mdlOutputs(SimStruct *S, int_T tid)


{
int i, errcode, j ;
FILE *fp ;
float cl_tank ;
real_T *y = ssGetOutputPortRealSignal(S,0);
real_T *x = ssGetRealDiscStates(S);
InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);

printf("EPANET Input:") ;
for(j = 0 ; j < InputNumber ; j++) {
printf("%lf ", U(j)) ;
}
printf("\n") ;
for(i = 0 ; i < mxGetScalar(QualityStep(S)) / mxGetScalar(ReportTime(S)) ;
i++) {
errcode = 0 ;
for(j = 0 ; j < InputNumber ; j++) {
errcode += ENsetnodevalue(EN_input_idx[j], EN_SOURCEQUAL, U(j)) ;
}
errcode += ENrunQ(&EN_t) ;
if(errcode) {
printf("error in ENrunQ %d\n", errcode) ;
return ;

- 292 -
}
errcode = 0 ;
for(j = 0 ; j < OutputNumber ; j++) {
errcode += ENgetnodevalue(EN_output_idx[j], EN_QUALITY,
&EN_c_output[j]) ;
}
if(errcode) {
printf("error in ENgetnodevalueQ %d\n", errcode) ;
return ;
}
EN_tleft = 0 ;
errcode = ENstepQ(&EN_tleft) ;
if(errcode) {
printf("error in ENstepQ %d\n", errcode) ;
getchar() ;
return ;
}
if(EN_t == mxGetScalar(ReportTime(S)) - 60) i-- ;
}

printf("\nEPANET Output:") ;
for(j = 0 ; j < OutputNumber ; j++) {
y[j] = EN_c_output[j] ;
printf("%lf ", EN_c_output[j]) ;
}
printf("\n") ;

i = EN_t / 3600 ;
}

#define MDL_UPDATE
static void mdlUpdate(SimStruct *S, int_T tid)
{
int i, errcode ;
real_T tempX[2] = {0.0, 0.0};
real_T *x = ssGetRealDiscStates(S);
InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);

if(EN_t == 0) {
printf("input at t=0 is %f\n", U(0)) ;
}
}

static void mdlTerminate(SimStruct *S)


{
/*
ENcloseH() ;
ENcloseQ() ;
ENclose() ;
*/
}

#ifdef MATLAB_MEX_FILE /* Is this file being compiled as a MEX-file? */


#include "simulink.c" /* MEX-file interface mechanism */
#else
#include "cg_sfun.h" /* Code generation registration function */
#endif

- 293 -
Appendix F List of Publications

1. Brdys, M.A., Chang, T. and Duzinkiewicz, K. (2000) “Hierarchical control of integrated


quality and quantity in water distribution systems”. Proc. of the A.S.C.E. 2000 Joint
Conference on Water Resources Engineering and Water Resources Planning and
Management, Minneapolis, Minnesota, 30 July-2 August.

2. Brdys, M.A., Chang, T. and Duzinkiewicz, K. (2001) “Intelligent model predictive control of
chlorine residuals in water distribution systems”. Proc. World Water & Environmental
Resources Congress, 20-24 May, Orlando, Florida.

3. Brdys, M.A. and Chang, T. (2001) “Robust model predictive control of chlorine residuals in
water systems based on state space modeling”. Water Software Systems: theory and
applications VOLUME ONE (eds. Ulanicki, B., Coulbeck, B. and Rance, J.). Proc. Sixth
International Conference on Computing and Control for the Water Industry, 231-244, 03-05
September, Leicester, UK.

4. Brdys, M., Duzinkiewicz, K., Chang, T., Polycarpou, M.M., Wang, Z., Uber, J.G. and
Propato, M. (2002) “Hierarchical control of integrated quality and quantity in drinking water
distribution systems”. Proc. of I International Conference on Technology, Automation and
Control of Wastewater and Drinking Water Systems - TiASWiK’02, Sobieszewo –Gdansk,
Poland, 19-21 June.

5. Brdys, M.A. and Chang, T. (2002a) “Modelling for control of quality in drinking water
distribution systems”. Proc. of 1st Annual Environmental & Water Resources Systems
Analysis (EWRSA) Symposium, A.S.C.E. Environmental & Water Resources Institute (EWRI)
Annual Conference, Roanoke, Virginia, 19-22 May.

6. Brdys, M.A. and Chang, T. (2002b) “Robust model predictive control under output
constraints”. Proc. of the 15th IFAC World Congress, July 21-26, Barcelona.

7. Chang, T. and Brdys, M.A. (2002) “Performance comparison of chlorine controllers based on
input-output and state-space models”. 1st Annual Environmental & Water Resources Systems
Analysis (EWRSA) Symposium, A.S.C.E. Environmental & Water Resources Institute (EWRI)
Annual Conference, Roanoke, Virginia, May 19-22, 2002.

8. Chang, T. and Brdys, M.A., and Duzinkiewicz, K. (2003) “Decentralised robust model
predictive control of chlorine residuals in drinking water distribution systems”. Proc. of World
Water and Environmental Resources Congress 2003 and Related Symposia, Pennsylvania, 23-
26 June.

9. Chang, T. and Brdys, M.A. (2003) “Quantifying uncertainties for chlorine residual control in
drinking water distribution systems”. Proc. of World Water and Environmental Resources
Congress 2003 and Related Symposia, Pennsylvania, 23-26 June.

10. Duzinkiewicz, K., Brdys, M.A. and Chang, T. (In Press) “Hierarchical model predictive
control of integrated quality and quantity in drinking water distribution systems”. Urban
Water, 2002.

- 294 -

You might also like