Modelling and Control of Drinkable Water Networks. Presentation at the 1st technical workshop of the FP7 research project EFFINET in Limassol, Cyprus, 5-6 June 2013. The main developments within WP2 are presented: Understanding the water demand patterns, development of time-series models for the water demand, formulation and solution of Model Predictive Control (MPC) problems for the water network and quantification of the effect that the prediction errors have on the optimal solution and on the closed-loop behaviour of the controlled system.
2. The
Closed
Loop
Energy
Price
Water
Demand
DWN
Model
Predic?ve
Controller(s)
(running
on
GPUs+CPUs)
Online
Measurements
Flow
Pressure
Quality
Forecast
Module
Historical
Data
Data
Valida?on
Module
Validated
Measurements
3. The
Closed
Loop
1.
Time-‐series
Stochas4c
Models
2.
Hydraulic
Model
of
the
DWN
3.
Pressure
Constraints
4.
Model
Predic4ve
Controllers
Energy
Price
Water
Demand
DWN
Model
Predic?ve
Controller(s)
(running
on
GPUs+CPUs)
Online
Measurements
Flow
Pressure
Quality
Forecast
Module
Historical
Data
Data
Valida?on
Module
Validated
Measurements
4. Requirements
Requirements
of
WP2:
Involved
Partners:
IMTL,
IRI,
AASI,
SGAB,
WBL
• Construct
models
for
MPC
(Model
Predic?ve
Control),
based
on
mass-‐balance
equa?ons
accompanied
by
constraints,
• Define
risk-‐sensi?ve
cost
func?ons
to
be
op?mised,
• Devise
stochas?c
models
for
the
water
demand,
• Develop
stochas?c
models
for
the
energy
prices
in
the
day-‐ahead
market.
Implementa4on:
• Prototype
applica?on
in
MATLAB/Simulink,
• Control-‐Oriented
models
available
in
MATLAB.
5. Control-‐Oriented
Modelling
The
mass-‐balance
equa?ons
of
the
water
network
yield
an
Linear
Time-‐Invariant
dynamical
model
in
the
following
form:
Disturbance
Model
(Stochas?c):
Note:
The
uncertainty
is
considered
to
be
bounded
and
possibly
discrete.
The
demand
requirements
can
be
cast
as
equality
constraints:
The
state
and
input
variables
are
bounded
in
convex
sets
(usually
boxes):
xk 2 X, 8k 2 N
uk 2 U, 8k 2 N
Alterna?vely,
we
may
impose
bounds
on
the
probability
of
cosntraints’
viola?on,
e.g.,
xk+1 = Axk + Buk + Gddk
yk = xk
Euk + Eddk = 0
dk|k = dk
dk+i+1|k = ˆdk+i|k + ✏k+i|k
✏k ⇠ Ek
prob(xk 2 X) ✓x,
8k 2 N
J.
M.
Grosso,
C.
Ocampo-‐Matrínez
and
V.
Puig
(2013),
Learning-‐based
tuning
of
supervisory
model
predic4ve
control
for
drinking,
Engineering
Applica?ons
of
Ar?ficial
Intelligence,
In
Print.
6. Demand
Forecas?ng
Ini4al
Observa4ons:
• Non-‐sta4onarity:
Apparently
seasonally
governed
paNern,
• ACF
(AutoCorrela?on
Func?on):
Rather
high
MA
content
• PACF
(Par?al
ACF):
High
AR
content
7. Demand
Forecas?ng
Ini4al
Observa4ons:
• Non-‐sta?onarity:
Apparently
seasonally
governed
pacern,
• ACF
(AutoCorrela4on
Func4on):
Rather
high
MA
content
• PACF
(Par?al
ACF):
High
AR
content
8. Demand
Forecas?ng
Ini4al
Observa4ons:
• Non-‐sta?onarity:
Apparently
seasonally
governed
pacern,
• ACF
(AutoCorrela?on
Func?on):
Rather
high
MA
content
• PACF
(Par4al
ACF):
High
AR
content
9. Demand
Forecas?ng
Ini4al
Observa4ons:
• Non-‐sta?onarity:
Apparently
seasonally
governed
pacern,
• ACF:
Rather
high
MA
content
• PACF:
High
AR
content
Numerical
Experiments
SARIMA(
AR
z }| {
{1 : 4, 6 : 9},
I
z}|{
1 ,
MA
z }| {
{1 : 13, 15, 17};
s
z}|{
168 )⇥
SAR({168, 336})
10. SARIMA(
AR
z }| {
{1 : 4, 6 : 9},
I
z}|{
1 ,
MA
z }| {
{1 : 13, 15, 17};
s
z}|{
168 )⇥
SAR({168, 336})
About
this
model:
-‐ Exhibits
the
lowest
pMSE*
(0.1049)
and
pRMSE
(0.3239)
amongst
other
tested
models
-‐ Combines
simplicity
with
predic?ve
power:
the
lowest
AIC
(Akaike
Informa?on
Criterion)
value
(-‐8.50)
and
SC
(-‐8.45)
-‐ It
is
inver?ble
-‐ Its
residuals
pass
the
Ljung-‐Box
test
for
uncorrelated
residuals
with
p-‐value
0.29.
-‐ Its
parameters
were
determined
with
high
sta?s?cal
certainty.
However:
-‐ It
fails
to
pass
the
Kolmogorov-‐Smirnov
test
for
normality.
* pMSE : Prediction Mean Square Error
11. Demand
Forecas?ng
d
(!)
k =
(
d
(!)
k 1
! , ! 6= 0,
log (dk) , ! = 0,
d
(!)
k = lk 1 + bk 1 +
PX
i=1
s
(i)
k mi
+ hk,
lk = lk 1 + bk 1 + ↵dhk,
bk = bk 1 + dhk,
s
(i)
k = s
(i)
k mi
+ d,ihk,
hk =
pX
i=1
'ihk i +
qX
i=1
✓i"k i + "k.
B
A
T
S
Box-‐Cox
Transforma?on
Trend
ARMA
Errors
Seasonal
Mul4seasonal
decomposi4on
of
the
4me
series.
J.
M.
Grosso,
C.
Ocampo-‐Matrínez
and
V.
Puig
(2013),
Learning-‐based
tuning
of
supervisory
model
predic4ve
control
for
drinking,
Engineering
Applica?ons
of
Ar?ficial
Intelligence,
In
Print.
12. Demand
Forecas?ng
d
(!)
k =
(
d
(!)
k 1
! , ! 6= 0,
log (dk) , ! = 0,
d
(!)
k = lk 1 + bk 1 +
PX
i=1
s
(i)
k mi
+ hk,
lk = lk 1 + bk 1 + ↵dhk,
bk = bk 1 + dhk,
s
(i)
k = s
(i)
k mi
+ d,ihk,
hk =
pX
i=1
'ihk i +
qX
i=1
✓i"k i + "k.
B
A
T
S
Box-‐Cox
Transforma?on
Trend
ARMA
Errors
Seasonal
Distribu4on
of
the
residuals
A.M.
De
Livera,
R.J.
Hyndman,
and
R.D.
Snyder
(2011),
Forecas4ng
4me
series
with
complex
seasonal
paNerns
using
exponen4al
smoothing,
Journal
of
the
American
Sta?s?cal
Associa?on,
106(496),
1513–1527.
13. Model
Predic?ve
Control
• Op?mal
Control
Strategy
• Sa?sfac?on
of
state
and
input
constraints
• Perfectly
fit
for
real-‐life
applica?ons:
Works
with
inaccurate
models
&
in
presense
of
disturbances.
J.
B.
Rawlings
and
D.
Q.
Mayne
(2009),
Model
predic4ve
control:
theory
and
design,
Nob
Hil
Publishing.
14. Cost
Func?ons
Goal:
Introduce
cost
funcPons
so
as
to:
o Minimise
the
total
energy
consump?on
o Minimise
varia?ons
of
the
control
signal
(A
motor
consumes
6
to
8
?mes
its
nominal
opera?ng
current
on
startup)
o Op?mise
the
performance
of
the
water
network
o (Try
to)
Stay
over
minimum
safety
volume.
JHu,Hp (xk, uk, k) =
Electricity
z }| {X
i2N[0,Hu]
`w
(uk+i|k, k) +
Smooth Operation
z }| {X
i2N[0,Hu 1]
` ( uk+i|k)
+
X
i2N[0,Hp 1]
`S
(sk+i|k)
| {z }
Safety Storage
15. Cost
Func?ons
`w
(uk, ↵k) , k↵kukk1
`s
(xk) = k[xs
xk]+k2
Wx
Goal:
Introduce
cost
funcPons
so
as
to:
o Minimise
the
total
energy
consump?on
o Minimise
varia?ons
of
the
control
signal
(A
motor
consumes
6
to
8
?mes
its
nominal
opera?ng
current
on
startup)
o Op?mise
the
performance
of
the
water
network
o (Try
to)
Stay
over
minimum
safety
volume.
` ( uk) , k ukk2
Wu
16. The
MPC
Problem
P†
Hp,Hu
(xk, dk, k) :
J?
Hu,Hp
(xk, dk, k) = min
uk,⌅k
JHu,Hp
(xk, uk, ⌅k, uk, k)
subject to:
xmin
xk+i|k xmax
, 8i 2 N[1,Hp 1]
umin
uk+i|k umax
, 8i 2 N[0,Hu]
xk+i+1|k = Axk+i|k + Buk+i|k + Gd
ˆdk+i|k, 8i 2 N[0,Hp 1]
Euk+i|k + Ed
ˆdk+i|k = 0, 8i 2 N[0,Hu]
uk+j|k = uk+Hu|k, 8j 2 N[Hu+1,Hp 1]
⇠k+i|k xmax
xk+i|k, 8i 2 N[0,Hp]
⇠k+i|k 0, 8i 2 N[0,Hp]
ˆdk|k = dk
xk|k = xk
Given
the
current
(measured)
state
of
the
system,
the
current
demand
and
a
sequence
of
predicted
demands,
solve
the
following
op?misa?on
problem:
Constraints
Op?misa?on
Problem
C.
Ocampo-‐Matrínez,
V.
Puig,
G.
Cembrano,
R.
Creus
and
M.
Milnoves
(2009),
Improving
water
management
efficiency
by
using
op4miza4on-‐based
control
strategies:
The
Barcelona
Case
Study,
Water
Sci
&
Tech:
Water
Supply,
9(5),
565-‐575.
17. The
MPC
Problem
Given
the
current
(measured)
state
of
the
system,
the
current
demand
and
a
sequence
of
predicted
demands,
solve
the
following
op?misa?on
problem:
This
can
be
formulated
as
a
Constrained
QP
problem:
J?
Hu,Hp
(xk, dk, k) = min
y
V (y)
subject to:
Gy = (dk)
Fy (xk, dk)
yl y yh
from
which
the
control
acPon
is
calculated
and
applied
to
the
system.
C.
Ocampo-‐Matrínez,
V.
Puig,
G.
Cembrano,
R.
Creus
and
M.
Milnoves
(2009),
Improving
water
management
efficiency
by
using
op4miza4on-‐based
control
strategies:
The
Barcelona
Case
Study,
Water
Sci
&
Tech:
Water
Supply,
9(5),
565-‐575.
18. The
MPC
Problem
System
Size:
63
states
114
inputs
88
disturbances
Computa4onal
Time:
Formula?on:
2.21
s
Update:
0.055
s
Solu?on:
1.85
s
Closed-‐Loop
Simula?ons
in
15
LOC!
Op4misa4on
Problem
Size:
~4.2k
decision
variables
~4.5k
affine
inequali?es
~1.5
bound
constraints
~400
equality
constraints
E.
Caini,
V.
Puig
and
G.
Cembrano
(2009),
Development
of
a
simula4on
environment
for
Water
Drinking
Networks:
Applica4on
to
the
Valida4on
of
a
Centralized
MPC
Controller
for
the
Barcelona
Case
Study,
Technical
Report,
IRI-‐TR-‐09-‐03,
UPC/IRI.
19. Closed-‐loop
Simula?ons
The
predic4on
error
affects
the
shape
of
the
closed-‐loop
trajectories…
MPC
with
a
perfect
predictor
23. Open
Issues
• Formula?on
of
Control
problems
for
other
objec?ves
(leak
isola?on,
quality
control)
• Demand
Forecas?ng:
Exogenous
T.S.
Analysis
(JM).
• Numerical
Issues:
The
Hessian
appears
to
be
near-‐singular
Becer
precondi?oning
is
necessary
• Other
formula?ons
of
the
QP
to
be
examined
• The
MPC
control
law
should
be
recursively
feasible
• Formula?on
of
a
robust
control
problem
• Incorpora?on
of
nonlinear
pressure
constraints
• Experiment
with
Fast
MPC
methods
• Design
&
Establishment
of
an
API
Hessian’s sparsity
pattern
24. Risk-‐Sensi?ve
Cost
Func?ons
J(xk, uk, ⌅k, uk, k) =
(E + cD) {J(xk, uk, ⌅k, uk, k)}
Mean-‐Risk
Cost
Func?on
DJ = V @R↵(J)
= inf
t
{prob(J t) 1 ↵}
for
instance:
J?
(xk, dk, k) = min
uk,⌅k
J(xk, uk, ⌅k, uk, k)
subject to:
prob(xmin
xk+i|k xmax
) ✓x, 8i 2 N[1,Hp 1]
etc.
where:
Chance
Constraints
Measure
of
Dispersion
25. Acknowledgements
• Juan
Manuel
Grosso
Pérez,
UPC
• Ajay
Kumar
Sampathirao,
IMTL
• Carlos
Ocampo-‐Marqnez,
UPC
• Vicenç
Puig,
UPC
29. Feasibility
Analysis
#k+i+1|k = #k+i|k + ⌦uk+i|k + R✏k+i|k
✏k+i|k 2 E ⇢⇢ R
S
X ⇥ Rnd(L+1)
( # + ⌦u) RE
#
S ✓ Pre(S)
For
the
set
S
to
be
robustly
control
invariant,
the
following
has
to
hold
true:
But
we
should
keep
in
mind
that
p
is
the
uncontrollable
part
of
the
system,
i.e.,
:
p+
= Kp + M✏
Dimension:
~70.000
So
in
order
to
find
such
as
a
(nonempty)
set
S,
it
is
necessary
that
the
trajectory
of
p
is
bounded
for
all
ε.
*
The
feasibility
analysis
with
the
assumpPon
that
the
predictor
is
accurate
is
easier.
30. Feasibility
Analysis
Expanding
predic4on
error:
Impossible
to
guarantee
recursive
feasibility!
But,
we
know
that
the
disturbance
is
bounded!
d 2 D = {d|Cd g}
Thus,
the
predic?on
error
has
to
be
bounded
as
follows:
✏ 2 E(p) =
⇢
✏
CM✏ g CKp
|✏| ✏max , (✏, p) 2 gph(E)
We
then
need
to
determine
a
set
S
so
that:
2
4
x
p
✏
3
5 2 S )
2
4
x+
p+
✏
3
5 2 S, 8(✏, p) 2 gph(E)
31. J?
Hu,Hp
(xk, dk, k) = min
uk,⌅k
JHu,Hp
(xk, uk, ⌅k, uk, k)
subject to:
Box Constraints:
⇢
xmin
xk+i|k xmax
, 8i 2 N[1,Hp 1]
umin
uk+i|k umax
, 8i 2 N[0,Hu]
xk+i+1|k = Ixk+i|k + Buk+i|k + Gd
ˆdk+i|k, 8i 2 N[0,Hp 1]
Euk+i|k + Ed
ˆdk+i|k = 0, 8i 2 N[0,Hu]
uk+j|k = uk+Hu|k, 8j 2 N[Hu+1,Hp 1]
⇠k+i|k xmax
xk+i|k, 8i 2 N[0,Hp]
⇠k+i|k 0, 8i 2 N[0,Hp]
Fast
Solu?on
Methods
There
are
certain
characteris?cs
of
the
op?misa?on
problem
that
can
be
exploited
to
accelerate
the
computa?on
of
the
op?mal
solu?on:
E
and
Ed
are
very
sparse
P.
Patrinos,
P.
Sopasakis
and
.
Sarimveis
(2011),
A
global
piecewise
smooth
Newton
method
for
fast
large-‐scale
model
predic4ve
control,
Automa?ca
47,
2016-‐2022.