Model Predictive Control
Model Predictive Control
Model Predictive Control
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Model Predictive Control
(MPC)
Overview of Model Predictive Control
Impulse/Step Response Model Identification
Predictions for SISO and MIMO Models
Model Predictive Control Calculations
Selection of Design and Tuning Parameters
2
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
MPC - Motivation
Practical Problems
multivariable
difficult dynamic behavior
nonlinear
constraints (input, output)
Overall Objectives of MPC
Prevent violations of input and output constraints.
Drive some output variables to their optimal set points,
while maintaining other outputs within specified ranges.
Prevent excessive movement of the input variables.
3
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
MPC - Basic Concepts
1. Future values of output variables are predicted using a
dynamic model of the process and current measurements.
Unlike time delay compensation methods, the predictions are
made for more than one time delay ahead.
2. The control calculations are based on both future predictions
and current measurements.
3. The manipulated variables, u(k), at the k-th sampling instant
are calculated so that they minimize an objective function, J.
Example: Minimize the sum of the squares of the deviations
between predicted future outputs and specific reference
trajectory.
4. Inequality & equality constraints, and measured disturbances
are included in the control calculations.
5. The calculated manipulated variables are implemented as set
point for lower level control loops. (cf. cascade control).
4
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
MPC Block Diagram
Basic Elements of MPC
Reference Trajectory Specification
Process Output Prediction (using Model)
Control Action Sequence Computation (programming problem)
Error Prediction Update (feedback)
5
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Control Hierarchy
6
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
MPC - Calculations
1. At the k-th sampling instant, the values of the manipulated
variables, u, at the next M sampling instants, {u(k), u(k+1), ,
u(k+M -1)} are calculated.
This set of M control moves is calculated so as to minimize
the predicted deviations from the reference trajectory over the
next P sampling instants while satisfying the constraints.
Typically, an LP or QP problem is solved at each sampling
instant.
Terminology: M = control horizon, P = prediction horizon
2. Then the first control move, u(k), is implemented.
3. At the next sampling instant, k+1, the M-step control policy is
re-calculated for the next M sampling instants, k+1 to k+M, and
implement the first control move, u(k+1).
4. Then Steps 1 and 2 are repeated for subsequent sampling
instants.
Note: This approach is an example of a receding horizon
approach.
7
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Figure 20.2 Basic concept for Model Predictive Control
8
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Moving Horizon Concept of MPC
9
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
When Should MPC be Used?
1. Processes are difficult to control with standard PID
algorithm (e.g., large time constants, substantial time
delays, inverse response, etc.)
2. There is significant process interactions between u
and y.
i.e., more than one manipulated variable has a
significant effect on an important process variable.
3. Constraints (limits) on process variables and
manipulated variables are important for normal control.
Terminology:
y CV, u MV, d DV
10
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
MPC History
Model Algorithmic Control (MAC) (1978)
Finite impulse response model
Dynamic Matrix Control (DMC) (1980)
Step response model
Control calculation by least-squares method (no constraints)
Quadratic Dynamic Matrix Control (QDMC) (1984)
Step response model
Control calculation by quadratic programming (with constraints)
Generalized Predictive Control (GPC) (1987)
Transfer function model
Nonlinear Model Predictive Control (NMPC)
Over 5000 applications of MPC since 1980
(Qin and Badgwell, 2003)
11
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Dynamic Models for MPC
Could be either:
1. Physical or empirical (but usually empirical)
2. Linear or nonlinear (but usually linear)
3. Parametric or non-parametric
Typical linear models used in MPC:
1. Impulse response models
2. Step response models
3. Transfer function models
4. State-space models
Note: Can convert one type of linear model to the
other types
Discrete-time models are more convenient for
prediction
12
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Discrete Impulse Response Models
Consider a single input, single output process:
where u and y are deviation variables, u(k) and y(k) are
their measurements at k-th sampling instant.
Definition: impulse response is the response of a
relaxed process to a unit pulse (impulse) excitation at t = 0
Process input-output relationship
{ }
0 1 2 3 =
i
h i , , , ,
( ) ( )
0
i
i
y k h u k i
=
=
(convolution summation)
u y
Process
u (k)
y (k)
13
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
For a stable process: for i > N
Finite Impulse response (FIR)
For a multivariable process with r inputs and m outputs,
the representation becomes a impulse response
matrix
h
ij,k
: the FIR between the j-th input and the i-th output
0
i
h
( ) ( )
0
N
i
i
y k h u k i
=
=
11 1
1
0 1 2 3
r
m mr
,k ,k
k
,k ,k
h h
k , , , ,
h h
= =
H
( ) ( )
0
N
i
i
k k i
=
=
y H u
(h
0
= 0)
14
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Identification problem: given input u(k) and output
measurement y(k) find the FIR, h
i
Assumptions:
The input u(k) is a continuing driving function of the process.
We observe u(k) for where n > N.
The output sequence y(k) for is also observed.
The noise e(k) is a random sequence with zero mean and is
uncorrelated with u(k).
FIR Identification
0 k n N +
N k n N +
Process
(FIR, h
i
)
e(k)
u(k)
y(k) +
(noise)
w(k)
15
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Using the input-output relationship, we have n+1 eqs.
Written in vector form
( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( )
0 1
0 1
0 1
1 0
1 1 1 1 1
1
N
N
N
k N, y N h u N h u N h u e N
k N , y N h u N h u N h u e N
k N n, y N n h u N n h u N n h u n e N n
= = + + + +
= + + = + + + + + +
= + + = + + + + + + +
y = Uh +e
( )
( )
( )
( )
( )
( )
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )
0
1
1 0
1 1 1 1
; ; ;
1
N
h
y N e N u N u N u
h
y N e N u N u N u
y N n e N n u N n u N n u n
h
+ + +
= = = =
+ + + +
y e h U
=
T T
n
h
(Least-squares estimator)
( )
h h =
E
e y Uh =
Solution :
17
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Multivariable FIR Identification
Input-output relationship for the i-th output
Least-squares estimation
( ) ( )
[ ]
1 0
1 2
r N
i ij , j
j
i r i i i i
y k h u k
= =
=
= + = +
y U U U h e Uh e
( )
( )
( )
( )
( )
( )
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )
0
1
1 2
1 0
1 1 1 1
; ; ;
1
;
j j j
i i
j j j i i
i i j
i i
j j j
ij ,
T
ij ,
T T T
ij i i i ir
ij ,N
u N u N u
y N e N
u N u N u y N e N
y N n e N n
u N n u N n u n
h
h
h
+ + +
= = =
+ +
+ +
= =
y e U
h h h h h
( )
1
T T
i i
= h U U U y
18
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Discrete Step Response Models
The step response S
i
is related to the impulse response h
i
( ) ( )
0
0
N
k i
i
k
k i
i
S y k h u k i
S h
=
=
= =
=
=
= + + +
S
i
= the i-th step response coefficient
N = an integer (the model horizon)
= change in the input from one sampling instant to the next
( ) ( )
( )
( )
1
1 1
1 1 1
N N
i i i
i i
y k h u k i S S u k i
= =
+ = + = +
( ) ( ) ( ) 1 = k u k u k u
( ) ( ) ( )
1
1
1 1 1
N
i N
i
y k + S u k i S u k N
=
= + + +
( )
1
y k +
One-step-ahead prediction
20
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Rearrange as
Two-step-ahead prediction (k = k+1)
j -step ahead prediction
1
1
2
Effect of current
control action
Effect of past control actions
( 1) ( ) ( 1) ( 1)
N
i N
i
y k S u k S u k i S u k N
=
+ = + + + +
1
1 2
3
Effect of future Effect of current
control action control action Effect of past control actions
( 2) ( 1) ( ) ( 2) ( 2)
N
i N
i
y k S u k S u k S u k i S u k N
=
+ = + + + + + +
1
1 1
( ) ( ) ( ) ( )
j N
i i N
i i j
Effects of current and
Effects of past
future control actions
control actions
y k j S u k j i S u k j i S u k j N
= = +
+ = + + + + +
1
( ) ( ) ( )
j
o
i
i
y k j S u k j i y k j
=
+ = + + +
y k+
y k+
k +
y k+P
Y
( )
1
k + Y
( )
1
k +
o
Y
( )
k U
( )
( )
( )
( )
1
2
1
o
o
o
y k+
y k+
k +
y k+P
o
Y
( )
( )
( )
( )
1
1
u k
u k+
k
u k+M-
U
23
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
The MPC control calculations are based on calculating
so that the predicted outputs move optimally to the
new set-point
The model predictions can be written as
where S is the dynamic matrix
Dynamic Matrix Model
( ) ( ) ( )
1 1
k + = k k + +
o
Y S U Y
0 0
0
0
1
2 1
M M-1 1
M+1 M 2
P P-1 P-M+1
S
S S
S S S
S S S
S S S
S
P M
( )
k U
24
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Output feedback: Bias Correction
Sources of inaccurate prediction:
model inaccuracy and unmeasured disturbance
The model predictions can be corrected by utilizing the
latest measurement, y(k).
The corrected prediction is defined to be:
Adding this bias correction to each prediction gives
( ) ( ) ( )
( ) ( ) ( )
y k + j y k + j +d k + j
y k + j + y k y k
( ) ( ) ( )
d k + j y k y k =
Estimated disturbance
(Residual)
( ) ( ) ( ) ( ) ( )
1 1
k + = k k + y k y k + +
1
o
Y S U Y
Process
d(k)
u
y(k) +
(disturbance)
( )
y k
(Assume process disturbance is constant for j=1,2,,P)
25
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
EXAMPLE
The benefits of using corrected predictions will be illustrated by a simple
example, the first-order plus-time-delay model:
Assume that the disturbance transfer function is identical to the
process transfer function, G
d
(s)=G
p
(s). A unit step change in u
occurs at time t=2 min and a step disturbance, d=0.15, occurs at
t=8 min. The sampling period is t = 1 min.
(a) Compare the process response y(k) with the predictions that
were made 15 steps earlier based on a step response model with
N=80.
(b) Repeat part (a) for the situation where the step response coefficients
are calculated using an incorrect model:
-2
4
20 1
s
Y(s) e
=
U(s) s +
2
5
15 1
- s
Y(s) e
=
U(s) s +
26
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
(a) Without model error. (b) With model error.
( ) ( ) ( )
( ) ( ) ( )
15 15 15
15
y k + y k + +d k +
y k + + y k y k
y k + j i S u k N j j N
=
+ + + = + + + +
( ) ( ) ( ) ( ) ( )
1
22 2 22 2
1
1
21 1 21 1
1
2
N
,i ,
N
,i ,N
i
N
i
S u k j i S u k j S u k
y k + j i S u k N j j N
=
+ + + = + + + +
( ) ( ) ( ) ( ) ( )
1 1
k + = k k + k k + +
y y
o
Y S U Y
[ ]
1 2
T
m
y y y = y
[ ]
1 2
T
r
u u u = u
( )
( )
( )
( )
1
1
2
1
k+
k+
k +
k+P
y
y
y
mP
Y
( )
( )
( )
( )
1
1
2
1
k+
k+
k +
k+P
o
o
o
y
y
y
o
mP
Y
( )
( )
( )
( )
1
1
1
k
k+
k
k+M-
u
u
u
rM
U
28
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
The matrix is defined as
where denotes the identity matrix
The dynamic matrix is defined as
where S
i
is the matrix of step response coefficients
for the i-th time step
[ ]
times
T
P
=
m m m
I I I
mP m
m m
m
I
0 0
0
0
1
2 1
M M-1 1
M+1 M 2
P P-1 P-M+1
mP rM
S
S S
S S S S
S S S
S S S
11 1
1
r
m mr
,i ,i
i
,i ,i
S S
S S
=
S
m r
29
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Example: Individual step-response models for a distillation column
with three inputs and four outputs. Each model represents the step
response for 120 minutes. Reference: Hokanson and Gerstle (1992).
30
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Exponential Trajectory from y(k) to y
sp
(k)
A reasonable approach for the i-th output is to use:
for i=1,2,, m and j=1, 2, , P.
MPC Calculations
Reference Trajectory
A reference trajectory can be used to make a gradual
transition to the desired set point.
Let the reference trajectory over the prediction horizon P
be denoted as:
The control objective is to calculate a set of control moves
(input changes) that make the corrected predictions as close to
a reference trajectory as possible.
( )
( )
( )
( )
1
1
2
1
k+
k+
k +
k+P
r
r
r
r
mP
y
y
Y
y
( ) ( ) ( ) ( ) ( )
, ,
1
j j
i r i i i i sp
y k j y k y k
+ = +
( )
( )
0
j
i r sp
= = y y
31
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Unconstrained MPC
The control calculations are based on minimizing the predicted
deviations between the reference trajectory.
The predicted error vector is defined as:
Similarly, the predicted unforced error, , is defined as
( ) ( ) ( )
o o
1 1 1
k + k + k +
r
E Y Y
The objective of the control calculations is to determine the
control moves, , for the next M time intervals.
The rM-dimensional vector is calculated so that an
objective function (also called a performance index) is minimized.
( ) ( ) ( )
1 1 1
k + k + k +
r
E Y Y
( ) ( ) ( ) ( )
1 1
k + k + k k +
y y
o o
Y Y
( )
o
1
k + E
where the corrected prediction for unforced case is defined as
Note that all of the above vectors are of dimension, mP.
( )
k U
( )
k U
( ) ( ) ( )
o
1 1
k + k + k = E E S U
32
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
MPC Performance Index
The rM-dimensional vector U(k) is calculated so as to minimize:
a. The predicted errors over the prediction horizon, P.
b. The size of the control move over the control horizon, M.
Example: Consider a quadratic performance index:
( ) ( ) ( ) ( )
1 1
T T
( k )
min k k k k
= + + +
U
Q E E R J U U
where Q and R are weighting matrices used to weight the
most important outputs and inputs.
Both Q and R are usually diagonal matrices with positive
diagonal elements.
33
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
MPC Control Law: Unconstrained Case
The MPC control law that minimizes the quadratic objective
function can be calculated analytically
( )
( )
( )
o
1
where is the dynamic matrix.
-1
T T
k = k + + U S Q S R S Q E
S
This control law can be written in a more compact form
( ) ( )
o
1
c
k = k + U K E
where controller gain matrix K
c
is defined to be:
( )
-1
T T
c
+ K S Q S R S Q
rM mP
Note that K
c
can be evaluated off-line, rather than on-line,
provided that the dynamic matrix S and weighting matrices, Q and
R, are constant.
Dimension:
(a multivariable, proportional control law based on the predicted error)
( )
0 =
k
J
U
34
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
MPC Control Law:
Receding Horizon Approach
Note that the controller gain matrix, K
c
, is an matrix.
where:
In the receding horizon control approach, only the first step of
the M-step control policy, , is implemented.
MPC control law:
where matrix K
c1
is defined to be the first r rows of K
c
.
Thus, K
c1
has dimensions of . r mP
.
( ) ( )
1
1
k = k +
o
c
u K E
( ) ( )
o
1
c
k = k + U K E
( )
( )
( )
( )
1
1
1
k
k+
k
k+M-
u
u
u
rM
U
( )
k u
rM mP
Advantage: new information in the form of the most recent
measurement y(k) is utilized immediately
35
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Unconstrained MPC (DMC) Algorithm
The process output, y(k), is measured, and used to estimate
the disturbance.
The predicted unforced error, , is updated
(accounting for changes in set-point and effect of previous
controller moves).
Solve for control move.
(first step only) is implemented.
Counter is updated: k = k + 1.
( ) ( ) ( )
d k + j y k y k =
( ) ( ) ( ) ( ) ( )
o
1 1 1
k + k + k + k k =
y y
o
r
E Y Y
( )
o
1
k + E
( )
( )
( )
o
1
-1
T T
k = k + + U S Q S R S Q E
( )
k u
36
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
MPC with Inequality Constraints
Inequality constraints on input and output variables are
important characteristics for MPC applications
Input constraint: physical limitations on plant equipments
such as limits on input value and rate-of-change
Output constraint: related to plant operating strategy such
as constraint on product quality
MPC inequality constraints
The introduction of inequality constraints results in a
constrained optimization problem
Can be solved numerically using linear or quadratic
programming techniques
( ) ( ) ( )
( ) ( ) ( )
0,1, , 1
0,1, , 1
k k j k j M
k k j k j M
+
+
+ =
+ =
u u u
u u u
( ) ( ) ( )
1, 2, , k j k j k j j P
+
+ + + = y y y
37
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Selection of Design Parameters
Model predictive control techniques include a number
of design parameters:
N : model horizon
t : sampling period
P : prediction horizon (number of predictions)
M : control horizon (number of control moves)
Q : weighting matrix for predicted errors (Q > 0)
R : weighting matrix for control moves (R > 0)
38
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Selection of Design Parameters
1. N and t
These parameters should be selected so that N t > open-loop
settling time. Typical values of N:
30 < N < 120
2. Prediction Horizon, P
Increasing P results in less aggressive control action
Set P = N + M
3. Control Horizon, M
Increasing Mmakes the controller more aggressive and increases
computational effort, typically:
5 < M< 20 or N/3 < M< N/2
4. Weighting matrices Q and R
Diagonal matrices with largest elements corresponding to most
important variables
output weighting matrix Q : the most important variables having the
largest weights
input weighting matrix (move suppression matrix) R : increasing the
values of weights tends to make the MPC controller more conservative
by reducing the magnitudes of the input moves
39
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Example: SISO system
( )( )
10 1 5 1
-
( )
=
+ +
s
e
G s
s s
1 =70, t = N
Assume
The controller gain matrix, Kc, for two cases (Q
ii
= 1, R
ii
= 0):
Set-point response [MPC vs. PID (ITAE set-point tuning)]
MPC: small settling time
40
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Disturbance response [MPC vs. PID (ITAE disturbance tuning)]
MPC: small maximum deviations and non-oscillatory
41
M
o
d
e
l
P
r
e
d
i
c
t
i
v
e
C
o
n
t
r
o
l
Wood and Berry process