You are on page 1of 106

Predictive control

Anthony Rossiter
Department of Automatic Control
and Systems Engineering
University of Sheffield
www.shef.ac.uk/acse
MSc ACS6012: MPC Department of Automatic
© University of Sheffield 2009 This work is licensed under a Control and Systems
Creative Commons Attribution 2.0 License. Engineering
2
MPC

Predictive control technique is chosen as


being very widely implemented within
industry and hence of the widest potential
use.
Predictive control describes an ‘approach’ to
control design, not a specific algorithm.
A user would ideally interpret the approach
to define an algorithm suitable for their
own needs.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
3
Organisation
1. Introduction to the key concepts of
predictive control. MOST IMPORTANT
2. Some numerical/algebraic details.
OBVIOUS if CONCEPTS UNDERSTOOD
3. Some examples.
4. The laboratory session.
5. The assignment.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
4
Review main
components of MPC
1. Prediction The key to
effective
2. Receding horizon implementation is
real
3. Modelling understanding of
4. Performance index how MPC works!

5. Constraint handling Having reviewed


6. Multivariable these components,
we can talk about
algorithm design
MSc ACS6012: MPC and tuning.
Department of Automatic
Control and Systems
Engineering
5
Prediction
• Why is prediction
important?
• How far should
we predict?
• Consequences of
not predicting.
• How do we
predict?
• How accurate do
predictions need
to be?
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
6
Illustration

Road

CAR

MSc
Horizon
ACS6012: MPC Department of Automatic
Control and Systems
Engineering
7
Receding horizon

• What is a receding horizon?


• Why is it essential ?
(uncertainty/feedback)
• How is it embedded into MPC?
• What advantages does it bring and
what repercussions does it have on
prediction accuracy?

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
8
Illustration of initial
prediction

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
9
Illustration

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
10
Illustration

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
11
What do we learn

• Did not observe all constraints at


outset – ended up in a dead-end (or
DEAD).
• If had re-optimised at t=T, would not
be able to use previous optimum
trajectory.
Optimisation of Previous optimum
prediction is was not optimum!
meaningless unless it WHAT WAS IT
can be implemented. THEN?
MPC MSc
based on optimisation – make
ACS6012: MPC sure this Automatic!
well ofposed
Department
Control and Systems
Engineering
12
Modelling

1. What is the model used for ?


2. How does the model use impact on the
modelling steps?
3. What type of model is required: FIR, state
space, mental, etc. ?
4. How much effort should the modelling
take?
5. How accurate and/or precise should the
model be?
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
13
Performance index

1. What is the performance index used for ?


2. How should the performance index be
designed?
3. Trade offs between optimal and safe
performance.
4. What performance indices do humans use
in every day life? How do these change as
we get older e.g. (babies to adults)?
5. What horizons do we use and why? (skill
levels)
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
14
Constraint handling

1. How are constraints embedded into


most control strategies?
2. Do you use a posteriori or a priori
design?
3. How do humans embed constraints
into their behaviour and why?
4. How is MPC different from most
conventional approaches?
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
15
Multivariable

Ordinarily, how does industry cope


with MIMO loops and what are the
consequences?
How does MPC differ and what are the
pros and cons?

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
16
Who will
manage this
controller?
Summary – well posed Their needs are

MPC …?
1. Modelling efforts should be focussed on efficacy for
prediction, including dependence on d.o.f..
2. Predictions must capture all the transient and
steady-state behaviour.
3. Prediction class should include the desired closed-
loop behaviour.
4. Performance indices must be realistic and matched
to model accuracy. AND
5. Constraints must be built in from the beginning.
6. Efficient computation requires linear models and
simple parameterisations of d.o.f.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
17

Organisation
• Remainder of this talk looks at how we
might design an algorithm meeting these
requirements.
• KEY POINT: MPC is a concept – you must
design an algorithm to meet YOUR needs!
• By having clear insight, you should be able
to identify the cause when MPC is not
delivering.
I have designed this talk to help you become a
designer, not just a user
MSc
of existing products.
ACS6012: MPC Department of Automatic
HOWEVER, do ask whatever you most want Control andto
Systems
Engineering
18
Overview

1. Prediction with transfer function


and state space models.
2. Formulation of a GPC control law.
3. Modifying structures to improve
robustness.
4. Modifying performance indices to
improve stability and tuning.
5. Including constraints.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
19
Numerical and
algebraic details
1. Prediction with state space models.
2. Formulation of a GPC control law.
3. Robustness.
4. Performance and stability.
5. Including constraints.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
20
Prediction with state
space models.
You should be aware of the key result. All predictions
for linear models take the form:

y = H u + Px
Where x is measured data (e.g. current state), u is
future controls and y is predicted output.
Hence, one can manipulate predicted outputs directly
by changing predicted inputs.
Definitions of H, P are secondary issues.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
21
Philosophy of
prediction
Form a one step ahead prediction model and predict
y(k+1).
Use this model recursively, so given y(k+i) find
y(k+i+1).
Continue until one has predicted ny steps ahead and
group results as on previous slide.
Hence prediction is equivalent to solving a large set of
simultaneous equations.
In general some filtering is needed to reduce the
sensitivity to noisy measurements.
Coding is trivial if one has access to software with
matrix algebra.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
22
Remark

Different algorithms ∆u = u − u , ∆u = ..., ...


k k k −1 k +1
may choose the
future control δuk = uk − u ss , δuk +1 = ..., ...
sequence in
several ways.
Change in
KEY POINT: Your
predictions must ∆u control
be unbiased in the
δu
Distance from
steady-state. [See
notes] expected
steady-state
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
23
Prediction with transfer
function and state space
models.
You should be aware of the key result. All
predictions for linear models take the form:

y = H u + Px
Where x is measured data (current state and/or
past inputs and outputs).
Hence, one can manipulate predicted outputs
directly by changing predicted inputs.
Definitions of H, P are secondary issues.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
24
Philosophy of
prediction

Form a one step ahead prediction


model and predict y(k+1).
Use this model recursively, so given
y(k+i) find y(k+i+1).
In fact Diophantine equations replicate
this, but personally I think they obscure
what is happening and hence recommend
you DO NOT USE THEM!
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
25
Prediction
continued
1. Given prediction is a simple recursion, one
can write down all the relevant equations as
a group of simultaneous equations.
2. Hence prediction is equivalent to solving a
large set of simultaneous equations.
3. This approach gives insightful and compact
algebra. Also easy to code in MATLAB.
4. Easier extension to more complex cases
(e.g. MIMO and T-filter).

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
26
Prediction
illustrations in
1.
lecture
Steps for ARMA prediction with
summary.
2. Extension to MIMO.
3. Prediction with state space

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
27
GPC control law

Define a performance index which


measures predicted errors and
control activity over some horizons:

J = ∑i =1 (ri − yi ) + λ ∑i =0 ∆u
ny 2 nu −1 2
i

Choose the future control moves to


minimise the predicted cost, that is,
optimise expected performance.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
28
GPC control law

Write the performance index in more


compact form using vectors and matrices.
2 2
J = r − y + λ ∆u 2
2
2 2
= r − H∆u − Px 2 + λ ∆u 2
Find the optimum with a grad operator as
index is quadratic (always positive).

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
29
Gradient operations

A quick review of differentiation of


vector variables.
a = [a Let
,..., a ]T ; x = [ x ,..., x ]T
1 n 1 n

Then
 d T 
 dx ( a x ) 
 1
  a1 
d T  d ( a T x )   a2  d T
(a x) =  dx2  =   = a; ( x Ax) = Ax + AT x
dx     dx
  
 d T
  an 
 (a x)
 dxn 
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
30
Optimising J

Grad operation on J is now by


inspection 2 2
J = r − H∆u − Px 2 + λ ∆u 2

dJ
= 2 H T ( H∆u + Px − r ) + 2λ∆u
d∆ u
dJ
= 0 ⇒ ∆u = ( H T H + λI ) −1 H T (r − Px)
d∆ u

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
31
Control law

Take the first component of the input

∆u = e1T ∆u = e1T ( H T H + λI ) −1 H T (r − Px)


= Pr (r − Px)
= Pr r − Kx
We have ignored algebraic details
required for integral action,
disturbance rejection, etc. You can find
these in the text books.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
32
Control law

Take the first component of the input

∆u = e1T ∆u = e1T ( H T H + λI ) −1 H T (r − P∆u − Q y )


= Pr (r − P∆u − Q y )

= Pr r − Dk ∆u − N k y
where
Pr = e1T ( H T H + λI ) −1 H T

Dk = Pr P
N k = Pr Q
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
33
Control law in z-
transforms
Next we write the law in terms of z-
transforms so that we can analyse
poles. 
∆uk = Pr r − Dk ∆u − N k y

Dk = [ D1, ..., Dn ]; N k = [ N o ,..., N m ]
 ∆uk  ∆uk 
[1, Dk ]  = [1, D1, ..., Dn ]  ≡ Dk ( z )∆u ( z )
 ∆u   ∆u 
N k y ≡ N k ( z) y( z)
Dk ∆u ( z ) = Pr r − N k ( z ) y
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
34
Closed-loop poles

As the control law is fixed and linear, we


can find the equivalent closed-loop
poles.
In simplified terms, the loop controller and
hence poles are:
Nk b
K= ;G = and ( pc = 0) ≡ (1 + GK = 0)
Dk ∆ a
Dk ∆a + bN k = pc
Warning: b(z) will contain a delay.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
35
Closed-loop poles

As the control law is fixed and linear, we


can find the equivalent closed-loop
poles.
In simplified terms, the loop controller
and hence closed-loop system are:
u = − Kx 
 ⇒ x = ( A − BK ) x
x = Ax + Bu 
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
36
MIMO case

1. This is identical to the SISO case.


2. This is a major advantage of MPC,
the basic algebra is the same for
SISO and the MIMO case.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
37
Tuning to get good
poles
• Take a system and explore how the poles move
as the horizons are changed.
• You may find it difficult to see a pattern.
• Low output horizons can give fast responses but
possible unstable or poor otherwise. WHY?
• Low input horizons give cautious behaviour –
WHY?
• Large output horizons with unit input horizon give
open-loop behaviour. WHY?
• Control weighting is only effective if the output
horizon is close to the settling time. WHY?
• How many closed-loop poles are there?
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
38

GPC may not always be


good

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
39
Problems with GPC
1. Next few slides illustrate the potential
weaknesses of using GPC.
2. The fundamental concept is called ‘prediction
mismatch’.
3. Prediction mismatch means that the class of
predictions over which you optimise:
i. do not include the prediction you would really like.
ii. are not close to the actual closed-loop behaviour
that arises.

We leave aside issues about whether the tuning


parameters are intuitive for technical engineers. PFC
MSc ACS6012: MPC Department of Automatic
proposes tuning by time constants. Control and Systems
Engineering
40
Optimised predictions
with different nu (1,2,
∝)

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
41
Optimised predictions
one sample later
Optimum
at t

Optimum at
t+1

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
ny=50,nu=1,Wu=0 42

3 .1 Prediction
Input increments

Closed-loop
2
Input not LQRoptimal
1 close to
optimum!
0

-1
0 5 10 15 20 25 30 35 40 45 50

1.5

1
Outputs

0.5

0
0
MSc 5 10 15 20 25
ACS6012: 30
MPC 35 40 45
Department50of Automatic
Samples Control and Systems
Engineering
ny=50,nu=2,Wu=0 43

3 .1Input not
Prediction
2 close to
Input increments

Closed-loop
1 closed-loop! LQRoptimal

-1

-2
0 5 10 15 20 25 30 35 40 45 50

1.5

1
Outputs

0.5

0
MSc 0 5 10 15 20ACS6012:
25 MPC30 35 40 45
Department 50Automatic
of
Samples Control and Systems
Engineering
ny=5,nu=1,Wu=1 44

1
Prediction
0.8
Input increments

Closed-loop
0.6 LQRoptimal

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

0.25
Input not
0.2
close to
optimum!
Outputs

0.15

0.1

0.05

0
MSc
0 0.5 1 1.5 2 2ACS6012:
.5 3 MPC 3.5 4 4.5 Department
5 of Automatic
Samples Control and Systems
Engineering
45
Summary
• GPC algorithms can give ill-posed
optimisations.
• A consequence could be very poor behaviour.
• Good behaviour could be more luck than
design; receding horizon arguments are not
reliable!
• Fundamental problem is the choice of control
trajectories which may not match the desired
In behaviour
many large and slow
closely enough.
I would recommend
processes, the DMC
a careful check of
assumption is close to
potential mismatch
desired behaviour and
before using an
consequently it works well.
MSc ACS6012: MPC algorithm.
Department of Automatic
Control and Systems
Engineering
46
PFC approaches
Ideal path (not
actual)

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
47
The T-filter

1. Why is this introduced?


2. How is it introduced?
3. What impact does it have on the
predictions? (No simple analytic formulae
can be given, only intuition and a
posteriori observations.)

Summary: Filter data before predicting, then


anti-filter back to original domain.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
48
CARIMA model and
prediction
Focus on the key steps/philosophy. Fine
details are obvious once this is clear.
1. Write model in terms of filtered data.
2. Form predictions in terms of filtered data in
exactly same way as ARMA model.
3. Need unfiltered future for the performance
index. Filtered past are known values.
Translate future filtered values to future
unfiltered values. Leave past filtered values as
they are.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
49
CARIMA model and
prediction (b)
Compare the expressions with and without a T-
filter. ~ ~ ~~
y = H∆u + P ∆u + Q y
y = H∆u + P∆u + Q y

1. Clearly the matrices multiplying past (or known)


data have changed. The mapping from the past to
the future has changed.
2. This change in mapping, changes how noise in the
signals effects the predictions. If 1/T is low-pass, it
filters out high freq. and hence improves quality.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
50
Change filtered to
unfiltered
Use Toeplitz and Hankel matrices for
convenience of algebra.
~ y
y= ⇒ T~ y=y
T
CT ~
y + HT ~
y = y or ~
y = CT−1[ y − H T ~
y]
A similar statement can be applied to
u. Hence
~
y = H∆u~ + P∆u~ + Q ~ y ⇒
C −1[ y − H ~
T y ] = HC −1[∆u − H ∆u~ ] + P∆u~ + Q ~
T T T y
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
51
Optimising J with a
T-filter
Modify J to take appropriate prediction

~ ~ ~~ 2 2
J = r − H∆u − P ∆u − Q y + λ ∆u 2
2

dJ ~ ~
= 0 ⇒ ∆u = ( H T H + λI ) −1 H T (r − P ∆u~ − Q ~y )
d∆u

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
52
Control law

Modify control law accordingly


~ ~ ~~
∆u = e ∆ u = e ( H H + λ I ) H ( r − P ∆ u − Q y )
T
1
T
1
T −1 T

~ ~ ~ ~
= P r − D ∆u − N y
r k k

where
Pr = e1T ( H T H + λI ) −1 H T
~ ~
Dk = Pr P
~ ~
N k = Pr Q
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
53
Control law in z-
transforms
Eliminate the filtered variables using
~
∆u = ∆ u ~
; y= y
T t
~ ~ ~ ~
∆uk = Pr r − Dk ∆u − N k y
 ∆u ( z ) y( z)
−1 ~ ~
[T ( z ) + z Dk ( z ) ] = Pr r − N k ( z )
T T
~ ~
Dk ( z ) N k ( z)
∆u ( z ) = Pr r − y
T T
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
54
Closed-loop poles –
T-filter
In simplified terms, the loop controller
and hence poles are:
~
Nk b
K = ~ ;G = and ( pc = 0) ≡ (1 + GK = 0)
Dk ∆ a
~ ~
Dk ∆a + bN k = pc

NOTE: In fact the poles will include T(z)


as a factor (see notes).
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
55
Robustness

1. How can an MPC law be tuned to


give better robustness?
2. What is the role of the T-filter? How
can it be selected?
3. How can sensitivity be measured?
We give some introductory views on
these issues.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
56
Robustness
measures
Robustness can be defined for many
scenarios such as
1. Sensitivity to modelling errors.
2. Sensitivity to disturbances.
3. Sensitivity to noise.
In each case one can form the
transference from the uncertainty to
the input or output.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
57
Parameter
uncertainty
Consider first multiplicative
uncertainty in G(z). Poles are
determined from (1+GK)=0.
(1 + GK ) → (1 + GK (1 + δ ))
(1 + GK (1 + δ )) = (1 + GK + δGK ) = 0
GK GK
⇒ (1 + GK )(1 + δ ) = 0 ⇒ SG =
1 + GK 1 + GK
bN k
SG =
pc
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
58
Sensitivity to
disturbances
Find the transference from disturbance
to input (or output). Use forward path
over (1+return path).
b Nk
G= ; K=
a Dk ∆
1 aDk ∆ K aN k
S yd = = ; Sud = − =−
1 + GK pc 1 + GK pc

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
59
Sensitivity to noise

1. Find the transference from noise to input (or


output). Using forward path over (1+return path)
one gets a similar relationship to that for the
disturbances.
2. Technically, disturbances are embedded within G
and so more complex relationships can arise.
This is outside the remit of this course.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
60
Impact of the T-filter
on sensitivity
1. T-filter changes
sensitivity significantly, ~
bN k bN k
as observed below. SG = : S GT = ;
2. Notable change is a pc pc T
~
reduction in sensitivity at aDk ∆ aDk ∆
high frequency with some S yd = : S ydT =
loss at low/intermediate pc pcT
freq. ~
aN k aN k
3. Notice T in the Sud = : S ud =
denominator, but note
pc pc T
also that the numerator
has changed.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
61
Other ways of
changing sensitivity
1. The T-filter is known to be effective at reducing
input sensitivity to noise, and can help with
model uncertainty. However the impact is not
deterministic a priori.
2. T is not easy to design systematically and in
fact sometimes has the opposite effect to that
expected.
3. We need an alternative approach that gives
more direct handles on sensitivity, more akin to
formal robust control methods.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
62
Youla
parameterisations
1. Youla parameterisations change the control law without
having an impact on nominal tracking/poles!
2. The change is therefore used to impact on sensitivity with
loss of nominal performance.
b a
y= r; u = r; pc = bN k + aDk ∆
pc pc
Dk → Dk − bQ  pc = b( N k + a∆Q ) + a ( Dk − bQ)∆
 ⇒
N k → N k + a∆ Q  pc = bN k + aDk ∆ (unchanged )
3. As long as Q is stable, can be chosen however you please
and will not change nominal tracking!

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
63
Selecting Q

1. Because the control parameters, and


therefore the sensitivity functions, are
affine in Q, one can use simple optimisers
to identify the best Q to minimise some
freq. domain measure of sensitivity.
2. Can be extended to the MIMO case with
almost identical algebra (taking some care
of commutativity issues).

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
64
Robustness and T-
filter
1. Why is this introduced? Essential in
practice
2. How is it introduced? Filter data before
predicting, then anti-filter back to original
domain.
3. What impact does it have on the
predictions? Much less sensitive to noise
and other high frequency uncertainty
(better robustness).

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
65
Constraints

1. How are constraints introduced into


MPC?
2. How are constraint equations
constructed?
3. What is the impact on the control
law?

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
66
Typical constraints

Systems often have limits on:


1. Inputs
2. Input rates
3. Outputs
4. States
These constraints can be time varying but more
normally are constant and apply all the time.
These constraints must be satisfied by the
optimised predictions.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
67
Input constraints
and predictions
Consider the following limits and an
equation testing satisfaction over
the input horizon.
1 0  0 u 
0   
u ≤ uk ≤ u   1  0  u   u 
k
      u   
u ≤ u k +1 ≤ u  1   k +1  ≤ − u 
 ⇒ 0 0 
    
  −1 0 0 
   − u 
u ≤ u k + nu −1 ≤ u  0 −1 0  
u k + nu −1   
− u 

 
     
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
68
Input constraints
with increments
Note thatuk +i = uk −1 + ∆uk + ∆uk +1 +  + ∆uk +i
and hence:
1 0  0 1 u 
1     
u ≤ uk ≤ u   1  0   ∆u   1  u 
k
      ∆u     
u ≤ uk +1 ≤ u  1  1  + 1 uk −1 ≤ − u 
k +1 
 ⇒ 1     
  −1
 0  0   − 1 − u 
u ≤ uk + nu −1 ≤ u  − 1 ∆u
− 1  0  k + nu −1  − 1  
    − u 
       
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
69
Combining input rate
and input constraints
Input rate constraints and input constraints
together take the form

 I   0   L ∆u  1
− I   0    1
  ∆u +  uk −1 ≤ − L ∆u ; L =  
 E   L  Lu  
      
− E  − L   − Lu  1
Where E is lower triangular matrix of ones.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
70
Extension to the
MIMO case
Replace elements of 1 by identity
matrix of suitable dimension.
Otherwise, the structure will remain
the same except that individual
components have been replaced by
vectors or matrices as appropriate.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
71
Output or state
constraints
This can be a little more messy, but
not if you keep a clear head.
y ≤ y = H∆u + Px ≤ y
or
 H   P  y 
 − H  ∆ u +  − P  x ≤  − y ;
     

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
72
Summary of
constraints
The constraints all take the form

C∆u ≤ d ; d = d ( x, u , u ,...)
Note that d depends upon:
1. measurements (past inputs and outputs)
2. fixed values such as upper and lower limits.
3. Set point, disturbances.
Hence it must be updated every sample.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
73
Combining with the
cost function
Must minimise J, subject to predictions
satisfying constraints:
2 2
min J = r − H∆u − Px 2 + λ ∆u 2
s.t. C∆u ≤ d
∆u

1. This is called a quadratic


programming problem.
2. Solution is tractable and quick,
even for quite large problems.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
74
Interpreting a QP

I will give some illustrations in lectures


of what the optimisation looks like.
Once again we note that the only
difference between MIMO and SISO is
the dimension of the optimisation,
but not in structure or set up.
Discuss again the impact of constraints
on performance and control.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
75
Stability

1. We can find the poles of MPC aposteriori.


2. How do we decide, apriori:
a. what are good values for the horizons and
weights?
b. will the nominal closed-loop system be stable?
c. what happens when constraints are included?

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
76
Early work

1. In the 1980s many authors suggested very


specific combinations of horizons/weights
to gaurantee stability. However most of
this work is pointless as it gives little
useful insight, especially with regard to
performance.
2. We are most interested in, what choice of
horizons is likely to give good
performance, as stability is then
automatic.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
77
Accepted solutions

1. The academic literature has a globally


accepted method for ensuring stability and
good performance.
2. This method is powerful because it does
not rely on linear analysis and hence also
applies to the constraint handling case
(assuming recursive feasibility).
3. In fact, the underlying requirements are
common sense and similar to strategies
used by humans.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
78
The tail

1. The first requirement is that the prediction you choose


now, can also be used at the next sampling instant.
2. Hence, if you choose a sensible strategy now, and it is
working, you must be able to continue with that strategy
when you update your decisions.
3. We call this riding on the tail, you pick up the part of the
strategy as yet not implemented and continue with it.
4. This puts very specific requirements on the class of
predictions. The tail must always be in the class.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
79
Large horizons

1. You must always look far enough ahead so


that your predictions contain all the
dynamics.
2. That is, the predictions should be constant
beyond the horizon, otherwise the ignored
part of the predictions may include
undesirable behaviour, which will be
inherited in subsequent samples.
3. Large enough usually means input horizon
+ settling time.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
80
Summary

1. Infinite horizons and the inclusion of


the tail guarantee closed-loop
stability (nominal case).
2. There is no need to compute the
closed-loop poles.
3. The proof applies even in the
presence of constraints and therefore
extends to nonlinear behaviour.
Proof given next.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
81
With infinite horizons,
J is Lyapunov
Let the optimum predictions at k be
u = [uk |k , uk +1|k ,, uk + n|k ,]T ; y = [ yk +1|k , yk + 2|k ,, yk + n|k ,]T
Now at k+1, inclusion of the tail implies on
can select:

[uk +1|k +1 ,  , uk + n|k +1 ,]T = [uk +1|k , , uk + n|k ,]T


[ yk + 2|k +1 ,  , yk + n|k +1 ,]T = [ yk + 2|k ,  , yk + n|k , ]T
Next consider that the cost is defined as

J k = ∑ i =1 (rk + i − yk + i ) + λ ∑ i = o ∆u
MSc ∞ ACS6012: MPC 2 ∞ 2
Department of Automatic
Control and Systems
k +i
Engineering
82
With infinite horizons,
J is Lyapunov (b)
1. Now compare the cost at subsequent sampling
instants, assuming one uses the tail.

Jk = ∑ e + λ ∑i =o ∆u k2+ i|k
∞ 2 ∞
i =1 k + i|k

2. It should be clear thatJ k +1 = ∑ e + λ ∑i =o ∆uk2+i +1|k


∞ 2 ∞
i =1 k + i +1|k

J k +1 = J k − ek2+1|k − λ∆uk2|k
3. That is, J is always reducing unless (r=y) and Du=0.
This can only happen repeatedly if one is already at
the desired steady-state. Moreover, one can always
re-optimise at each sample to make K even smaller
still.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
83
Proof applies during
constraint handling
1. The only difference during constraint handling is
that J is minimised subject to constraints.
2. If predictions at time k satisfy constraints, then
so does the tail. Hence the tail can be used at
k+1 and the Lyapunov property still holds.
3. There is however a need for feasibility, that is
one must assume that there exists, at the
outset, a prediction class which satisfies
constraints.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
84
Proof applies with a
finite input horizon
1. This is obvious by simply going through
the steps of the proof but altering the
costing horizon on the inputs to be nu.
2. All the steps of the proof are identical
because restricting nu simply adds lots
of zeros for the future control
increments.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
85
Are infinite
horizons
1. You needimpractical
a Lyapunov equation to sum the
errors over an infinite horizon.
2. This is straightforward when the prediction
dynamics are linear.
xk +1 = Axk ; J = ∑∞ xkT+i xk +i = ∑∞ xkT ( Ai )T Ai xk
J = x Sxk ; S = ∑i =0 ( Ai )T Ai
T ∞
k


A SA = ∑i =1 ( Ai )T Ai = S − I
T ∞

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
86
Different ways of
implementing infinite
horizons
1. People usually use dual-mode
predictions.
a) Mode 1, immediate transients, one has
total freedom in the control chosen.
b) Mode 2, is the asymptotic behaviour and
is chosen with predetermined dynamics.
2. The choice of mode 2 is the main
flexibility in the design.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
87
Dual mode paradigm
(or closed-loop
prediction)
Initial state
traje
c tory

nc m Terminal
oves State
max
imu
m

Terminal region in which


the control law u=-Kx
satisfies constraints.
n at most nc samples, predicted
state moves into the terminal
regionMSc
while satisfying constraints.
ACS6012: MPC Department of Automatic
Control and Systems
Engineering
88
Open and closed-loop
prediction
Future inputs Future outputsOPEN LOOP
Model PREDICTION

Decision variables

Future outputs
K Model
r
CLOSED LOOP
PREDICTION
M
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
89
Stability and dual
mode paradigm
Historically: Now:
1. academics spent a 1. most people advise
lot of time discussing
the tuning and the dual mode
stability of MPC. paradigm.
2. it was thought that 2. the tuning parameter
input/output horizons is the terminal control
and control law.
weighting were
‘tuning’ parameters. 3. the ‘control horizon’
3. there were few affects feasibility and
stability results. computational load.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
90
Mode 2 choices

1. You need to make a choice between


cautious control with large feasible
regions and optimal control with better
performance but smaller regions of
applicability (and perhaps less
robustness).
2. I will outline typical choices in the
lecture.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
91
Feasible regions for
nc=1,2,3

nc=1

nc=2

nc=3

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
92
Terminal region
variation with
different feedback
gains

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
93
What about DMC?
DMC and similar algorithms have been successfully and
widely applied. Why is this ‘new’ approach needed?
Insights:
1. explain the success of DMC and therefore improve user
confidence.
2. give better understanding of the limitations of DMC and
what needs changing.
Summary:
1. DMC can be considered as a dual mode law with a
terminal control law of K=0 (open-loop) as industrial
practise has favoured large output horizons (effectively
equivalent to infinity).
2. Will be less effective when open-loop behaviour is poor.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
94
Closed-loop
prediction
Current thinking is that, ordinarily, one should predict in
the closed-loop.
1. Better conditioned predictions and embeds desired
behaviour.
2. Predictions automatically close to desired behaviour,
more robust optimisation.
3. Especially important for open-loop unstable plant.
4. Makes tuning more straightforward.
5. Handling feasibility can be easier.

NOTE: Differs from DMC which assumes default


behaviour is open-loop dynamics.
PFC partially meets this aim (uses open-loop predictions
but matches to a desired dynamic).
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
95
Closed-loop MPC
algorithm
Standard MPC objective ∞
J = ∑ x Qxk + u Quk
T
k
T
k
Decision variables are k =0
perturbations ck to
control trajectory
uk = − Kxk + ck k = 0,1, , nc − 1
uk = − Kxk k ≥ nc

J is equivalent toNominal Ideally c


behaviour =0
nc −1

MSc
J
ACS6012: MPC
= ∑ k Λck ;Department
c
k =0
T
Λ > 0of Automatic
Control and Systems
Engineering
96
Constraint handling

It is well known, that for  xk   ck 


an LTI model, one can x   c 
express predictions in  k +1  = Px + H c; c =  k +1 
the form.   k
  
   
 xk + n  ck + nc −1 
Therefore constraint
satisfaction of the
predictions is equivalent
to set membership of S.S = {xk : Mxk + N c ≤ d }

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
97

MPC algorithm with


constraint handling
Perform, each sample, the quadratic
programming optimisation
T
min J = c Λ D c s.t. Mxk + N c ≤ d
c

Implement the optimum control as


follows:
uk = − Kxk + ck ; ck = e1 c
T

More detail of these computations are in the


MSc ACS6012: MPC Department of Automatic
handout. Control and Systems
Engineering
98
Why does this
paradigm give
stability
Implicitly uses infinite horizons,
therefore anticipates and
allows for entire future.
As long as d.o.f. parameterised No dead
such that one can re-use old ends!
decisions, one can continue to
ride on good policies to
convergence.
Optimise around ‘good’
trajectories, therefore well
conditionned.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
99
Summary OMPC

Main components are prediction, optimisation


and explicit inclusion of constraints.
• Now accepted that the dual mode (or closed-
loop) paradigm is a good mechanism for
ensuring stability and well posed optimisation.
• Implicitly uses infinite costing horizons.
• Tuning depends on the terminal law and
feasibility on the terminal law and number of
d.o.f.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
100
Parametric
solutions
A major insight of the last few years is
the potential of parametric solvers for
MPC problems.
Instead of an online optimisation:
1. parameterise all possible
optimisations
2. solve these offline
3. Online: determine and implement
appropriate solution.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
Illustration of 101

regions

Each region has a


different control
law

x ∈ Si ⇒ c = − K i x + pi
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
102
Illustration of
regions (b)

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering
103
Parametric solvers

• Major benefit is transparency of control


law. Huge potential where rigorous testing
and validation is required.
• Downside is large number of regions.
Identifying active region can be more
demanding than solving original QP.
Data storage requirements for regions.
 For small dimension problems, may be
invaluable and far simpler to implement.
[In essence a Look-up table]
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
104
Conclusion
1. Focussed on some key concepts from linear MPC.
2. Quickly overviewed how understanding the key
concepts allows the development of algorithms
which:
i. Make good engineering sense
ii. Have a priori results on performance and stability.
iii. Allows the user to quickly identify what is wrong when MPC
fails.

MPC is very flexible. Don’t assume


you have to go with an off the
bench algorithm.
If you are unsure about anything
MSc ACS6012: MPC Department of Automatic
today, please come and talk Control
toEngineering
me.
and Systems
105
Today’s laboratory

You will be given the chance to


experiment with different:
1. Algorithms
2. Tuning parameters.
3. Uncertainty.
The software is simple to enable
insight and easy editing, but not
intended for general distribution.
MSc ACS6012: MPC Department of Automatic
Control and Systems
Engineering
This resource was created by the University of Sheffield and released as an open educational resource through the Open
Engineering Resources project of the HE Academy Engineering Subject Centre. The Open Engineering Resources project
was funded by HEFCE and part of the JISC/HE Academy UKOER programme.

© 2009 University of Sheffield

This work is licensed under a Creative Commons Attribution 2.0 License.

The JISC logo is licensed under the terms of the Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England & Wales Licence.  All
reproductions must comply with the terms of that licence.

The HEA logo is owned by the Higher Education Academy Limited may be freely distributed and copied for educational purposes only, provided that
appropriate acknowledgement is given to the Higher Education Academy as the copyright holder and original publisher.

The name and logo of University of Sheffield is a trade mark and all rights in it are reserved. The name and logo should not be reproduced without the
express authorisation of the University.

Where Matlab® screenshots are included, they appear courtesy of The MathWorks , Inc.

MSc ACS6012: MPC Department of Automatic


Control and Systems
Engineering

You might also like