You are on page 1of 44

Chapter 6

Model Predictive Control


Prof. Shi-Shang Jang
National Tsing-Hua University
Chemical Engineering
Department
2
Historical Development
Questions:
Given a system what are the absolute limitations to
output control?
How can one make use of a process model and account
for model error?
Smith Predictor(1955)
Feedforward Control
Inferential Control (1975, 1979)
Dynamic Matrix Control (Shell, 1979)
Model Algorithmic Control (France, 1979)
Internal Model Control (Garcia and Morari, 1982)
3
Criteria for Controller Quality
Regulatory Behavior Compensation for
(unmeasured disturbances)
Servo Behavior- Follow set point
changes (fast, smooth, no offset)
Robustness-Controller should be
effective when there are modeling errors
(both structure and parameters)
4
Criteria for Controller Quality-
Continued
Constraints- Ability to deal with
constraints on inputs and states (no
windup)
Remark: 90% of loops can be handled
by PID type controllers.
5
Internal Model Control (IMC)
Structure
G
I

G
m

G
P

y
s

e
d
y
y
m

u + +
+
-
-
+
d

e=y
s
-y+y
m
6
Analysis of Internal Model
Structure
From the block diagram:

( )
( )
) ( 1
) ( 1
m p I
I s
m p I
s I p
G G G
G d y
u
G G G
d y G G
d y
+

=
+

+ =
7
Properties of IMC (Principles of
Internal Model Control)
1. (Dual Stability) If the model is perfect,
stability of controller and plant is
sufficient for overall system stability
Proof: If G
p
=G
m
, then
y=G
p
G
I
(y
s
-d)+d
u=(y
s
-d) G
I
Use IMC only on stable systems, unstable
systems can be stabilized by feedback control
Constraints on inputs has no effect on stability

8
Properties of IMC (Principles of
Internal Model Control)- continued
2. (Prefect Control) If model is perfect and
invertible, and G
I
=G
p
-1
, then y=y
s
for any d
Notes: (1) This is optimal control.
(2) Suppose G
p
-1
is not realizable, then it is
recommended to factor this transfer function into two
terms: G
p
(s)=G
+
(s)G
-
(s) where G
+
(s) is not realizable
contains all time delays and RHP zeros. In this case
the best controller possible is: G
I
(s)=G
-
-1
(s), this
controller minimizes sum of the square of the errors
in output.
(3) This suggests the design of F(s) as
G
I
=G
p
-1
F(s) such that G
I
(s) realizable.


9
Example
) (
) (
) (
) ( ) ( ) (
) (
) (
) (
1
s F e
s N
s D
s F s G s G
e
s D
s N
s G
Ds
p I
Ds
p
= =
=

Which is realizable if we choose:


( )
n
Ds
s
e
s F
1
) (
+
=

Where n=degree of D(s)-degree of N(s)>0, is chosen


10
Properties of IMC (Principles of
Internal Model Control)- continued
3. Zero Offset
There is no offset if we choose:
G
I
(0)=1/G
m
(0)
Pf:
| |
| |
) 0 (
) 0 ( ) 0 ( ) 0 ( 1
) 0 ( ) 0 ( ) 0 ( ) 0 ( ) 0 ( ) 0 ( 1
) 0 (
s
m p I
s I p I m
y
G G G
y G G d G G
y
=
+
+
=
a. This means the output will attain the set point exactly in
presence of persistent disturbances and set-point changes -
integral feedback
b. Note that this is true even if the model is imperfect.
11
Properties of IMC (Principles of
Internal Model Control)- continued
4. Comparison with Feedback Controller
If we choose

Then we get classical output feedback control. Note
that G
I
(s) in the closed loop transfer function of the
following:

( )
m c
c
I
G G
G
s G
+
=
1
Gc(S)
Gm(S)
+
-
e(s)
m(s)
12
Properties of IMC (Principles of
Internal Model Control)- continued
Joining this with the IMC block diagram we get




which reduced to a classical feedback control:
Gc(S)
Gp(S)
+
-
e(s) m(s)
Gc(S)
Gp(S)
+
-
y
s
d
y(s)
+
-
Gc Gp
+
-
y
s
(s)
d
13
Properties of IMC (Principles of
Internal Model Control)- continued
Notes:
(a)

may be looked upon as a poor approximation to G
m
-1
(s). For
large K
c
, this approximation gets better.
(b) Note the similarity of this structure to Smith Predictor also
approximates the invertible part of G
m
-1
(s).
(c) This feedback structure implies use of a filter:

( )
m c
c
I
G G
G
s G
+
=
1
( )
( ) ( )
( ) ( ) s G s G
s G s G
s F
m c
m c
+
=
1
14
On-Line Tuning of IMC
1. Choose a process model through plant tests
2. Choose a filter to make G
I
(s)
realizable
3. Decrease c untill system becomes oscillatory. Brosilow
recommends the following time constant: (where c
u
=min.
filter constant; P
u
=period of oscillation)




4. If c/D<1, then IMC will yield better performance than a PID
controller. If 1< c/D<2; then IMC and PID are competitive.
( )
( )
n
Ds
s
e
s F
1 +
=

c
( )
t
c t
c
2
4 2
2 / 1
2 2 2
2
(

+
=
u u u
n
P P
15
Computation of Approximate
Inverses
In practice, it is easier to find an approximate
inverse of the process transfer function in the
time domain (using discrete models).
Time Domain View:
Given the past history of inputs to the process and
current estimate of the disturbance, compute the
current and future inputs which will make the output
follow the desired set point.
Limitation in Practice:
1. The future will be limited to a finite time horizon (3-4
times time-constant of system.
2. Attention must be limited to values of output at discrete
times.
16
Summary of MPC
MPC consists of three blocks:
Process model
A controller (approximate inverse)
A filter
Advantages:
Quality of response depends on controller design
Robustness depends on filter
Stability is not an issue
Implementation is straight forward
On-line tuning can be provided by the filter time
constant

17
Computation of Approximate
Inverses - Continued
3. Values of all future inputs may be limited to a few in the
immediate future.
4. Problem must be solved every so often (at discrete
sampling times) when new estimates of disturbance
become available.
5. We must limit the size and velocity of control input
variations.
6. On-line computations should be kept to a minimum.
7. Smooth transfer between auto/manual should be possible.
8. It should be recognize constraints on inputs.
9. There should be operator adjustable constant(s) to
account for plant/model mismatch.
18
Review of least-square problem
Given a set of equations:
Ax=b+e
We seed a solution which minimizes
E
i
e
i
2
The solution is given by:
x=(A
T
A)
-1
A
T
b
We term (A
T
A)
-1
A
T
to be pseudo inverse of
matrix A
19
A Discrete Input Plant Model
( )
1 1 2
3
1
2 1
) (
) (
) ( ) (
) (
) (
) (
+

+ + + + ~
+ =
z z h z h z h h
z D
z N
Let
z d z m z
z D
z N
z y
N
N

t
Note that N/D is actually the impulse response of the system m(z)=1
without delay
h1

h2
h3 h4
h5
h6
h7
t
y(t)
20
Example: G(s)=1/(s+1)
3
global m
m=1;TSPAN=[0 1];
Y0=[0 0 0];
Y_real=[];Y_sample=[];T_real=[];
T_sample=[0];Y_model=[0];
for i=1:29
[T,Y] =
ODE45('model_3',TSPAN,Y0);
TSPAN=[TSPAN(2),TSPAN(2)+1];
Y0(1)=Y(end,1);
Y0(2)=Y(end,2);
Y0(3)=Y(end,3);
TT=T(end);
Y_real=[Y_real;Y(:,1)];T_real=[T_
real;T];
m=0;
T_sample=[T_sample,TT];
Y_model=[Y_model,Y0(1)];
end

function dy=model_3(t,y)
global m
dy(1)=y(2);
dy(2)=y(3);
dy(3)=-3*y(3)-3*y(2)-y(1)+m;
dy=dy';
21
Example: G(s)=1/(s+1)
3
-
continued
TSPAN=[0 1];mm=zeros(1,29);
Y0=[0 0 0];
Y_real=[];Y_sample=[];T_real=[];
T_sample=[0];Y_pred=[0];
for i=1:50
m=randn(1,1);
for i=1:28
mm(29-i+1)=mm(29-i);
end
mm(1)=m;
[T,Y] = ODE45('model_3',TSPAN,Y0);
TSPAN=[TSPAN(2),TSPAN(2)+1];
Y0(1)=Y(end,1);
Y0(2)=Y(end,2);
Y0(3)=Y(end,3);
TT=T(end);
Y_real=[Y_real;Y(:,1)];T_real=[T_real;T];
yp=Y_model*mm';
Y_pred=[Y_pred,yp];
T_sample=[T_sample,TT];
end

22
A Discrete Input Plant Model
m m A y + =
(
(
(
(

(
(
(
(

+
(
(
(
(

(
(
(
(

=
(
(
(
(

=
+ + + =

+
+
+
+
+
+
+
+ + +

0
0 0
0 0 0
0 0 0
0 0
0
forecast ahead step four example, for
0 Let
2
1
3 2
3 1
2
3
1
2 1
3 2 1
4 3 2 1
1
2
3
4
1 1 2 1 1
N k
k
k
N
N
N
N
k
k
k
k
k
k
k
k
N k N k k k
m
m
m
h h h
h h
h
h
m
m
m
m
h
h h
h h h
h h h h
y
y
y
y
m h m h m h y

t
t
23
A Discrete Input Plant Model-
Continued

=
+
+ =
N
i
l
l
z d z m z h z z y
Then
1
1 1
) ( ) ( ) (
t
) ( ) ( ) (
) ( ) ( ) ( ) (
1
z d z m z G
z d z m z H z z y
+ =
+ =
t
This expresses y in terms of past inputs m; i.e.:
d y
d m h m h m h y
k
N k N k k k
+ =
+ + + + =
+ +
+ + +
1
1 1 2 1 1

t
t

24
Approximate Inversion
( ) ( ) | | ( ) 1 min
2 2
2
1
2
) 1 ( ),..., 1 ( ), (
+ + + + + +

=
+ +
l k m l k y l k y
l d
P
i
l
M k m k m k m
| t t
Since we cannot make y(t)=y
d
(t) exactly, we pose the following least
square minimization problem:
subject to the above process model:
) 1 ( ) ( ) 1 (
) ( ) ( ) (
1
1 1
+ = = + = +
+ =

=
+
P k m M k m M k m
z d z m z h z z y
N
i
l
l

t
No control changes beyond M
25
The Solution
The previous problem can be solved
based on a Quadratic Programming
solver or using previous pseudo-inverse
of matrix approach.
26
MPC-Servo Control (A Feed-forward
Approach) Want y
k+1
=y
k+2
==y
d
( ) m y A m
m m A y
d
1
d
=
+ =
(
(
(
(

(
(
(
(

+
(
(
(
(

(
(
(
(

=
(
(
(
(

+
+
+

0
0 0
0 0 0
0 0 0
0 0
0
2
1
3 2
3 1
2
3
1
2 1
3 2 1
4 3 2 1

N k
k
k
N
N
N
N
k
k
k
k
d
d
d
d
m
m
m
h h h
h h
h
h
m
m
m
m
h
h h
h h h
h h h h
y
y
y
y
P=4; M=4
27
MPC-Servo Control (A Feed-
forward Approach) -Example

time time
Y
_
r
e
a
l

Y
_
s
a
m
p
l
e

P=4; M=4
28
MPC-Servo Horizon Control (A Feed-
forward Approach) Want
y
k+1
=y
k+2
==y
d
, but m
k+1
=m
k+2
=m
k+3
( ) m y A m
m m A y
d
d
=
+ =
(
(
(
(

(
(
(
(

+
(

(
(
(
(

+
+ +
=
(
(
(
(

+
) (

0
0 0
0 0 0
0

2
1
3 2
3
1
1
2 1
3 2 1
4 3 2 1
pinv
m
m
m
h h h
h h
h
h
m
m
h
h h
h h h
h h h h
y
y
y
y
N k
k
k
N
N
N
N
k
k
d
d
d
d

P=4; M=2
29
MPC-Servo Horizon Control (A Feed-
forward Approach) Want
y
k+1
=y
k+2
==y
d
, but m
k+1
=m
k+2
=m
k+3
P=4; M=2
Time
R
e
s
p
o
n
s
e

30
MPC-Regulation Control (A
Feedback Approach)
( )
k k
N k
k
k
N
N
N
N
k
k
k
k
d
d
d
d
y y d
d
d
d
m
m
m
h h h
h h
h
h
m
m
m
m
h
h h
h h h
h h h h
y
y
y
y


0
0 0
0 0 0
0 0 0
0 0
0
2
1
3 2
3 1
2
3
1
2 1
3 2 1
4 3 2 1
=
=
+ + =
(
(
(
(

+
(
(
(
(

(
(
(
(

+
(
(
(
(

(
(
(
(

=
(
(
(
(

+
+
+
d m y A m
d m m A y
d
1
d

P=4; M=4
31
MPC-Regulation Control (A
Feedback Approach)
( )
k k
N k
k
k
N
N
N
N
k
k
d
d
d
d
y y d
pinv
m
m
m
h h h
h h
h
h
m
m
h
h h
h h h
h h h h
y
y
y
y

) (


0
0 0
0 0 0
0

2
1
3 2
3
1
1
2 1
3 2 1
4 3 2 1
=
=
+ + =
(
(
(
(

(
(
(
(

+
(

(
(
(
(

+
+ +
=
(
(
(
(

+
d m y A m
d m m A y
d
d

P=4; M=2
32
MPC-Regulation Control (A
Feedback Approach)
Time
R
e
s
p
o
n
s
e

Time
R
e
s
p
o
n
s
e

M=4
M=2
33
Multi-variable Discrete Input
Plant Model
m m A y + =
(
(
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(
(
(

+
(
(
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(
(
(

=
+ + + + + + + =

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +

0
0 0
0 0 0
0
0 0
0 0 0
0
0 0
0 0 0
0
0 0
0 0 0
0 0 0
0 0
0

0 0 0
0 0
0

0 0 0
0 0
0

0 0 0
0 0
0

forecast ahead step four example, for
0 Let
2
2
2
2
1
1
1
2
1
1
22 22
3
22
2
22 22
3
22 22
4
22 22
5
21 21
3
21
2
21 21
3
21 21
4
21 21
5
12 12
3
12
2
12 12
3
12 12
4
12 12
5
11 11
3
11
2
11 11
3
11 11
4
11 11
5
2
2
1
2
2
2
3
1
1
1
1
2
1
3
22
1
22
2
22
1
22
3
22
2
22
1
22
4
22
3
22
2
22
1
21
1
21
2
21
1
21
3
21
2
21
1
21
4
21
3
21
2
21
1
12
1
12
2
12
1
12
3
12
2
12
1
12
4
12
3
12
2
12
1
11
1
11
2
11
1
11
3
11
2
11
1
11
4
11
3
11
2
11
1
2
1
2
2
2
3
2
4
1
1
1
2
1
3
1
4
2
1
12 2
1
12
2
2 12
1
1
1
11 1
1
11
2
1 11
1
1
1
N k
k
k
N k
k
k
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
k
k
k
k
k
k
k
k
k
k
k
k
k
k
k
k
N k N k k N k N k k k
m
m
m
m
m
m
h h h
h h
h h
h h
h h h
h h
h h
h h
h h h
h h
h h
h h
h h h
h h
h h
h h
m
m
m
m
m
m
m
m
h
h h
h h h
h h h h
h
h h
h h h
h h h h
h
h h
h h h
h h h h
h
h h
h h h
h h h h
y
y
y
y
y
y
y
y
m h m h m h m h m h m h y


t
t
34
Hot
Cold
LT
TT
Examples of Multivariable Control:
Control of a Mixing Tank
MVs: Flow of Hot Stream CVs: Level in the tank
Flow of Cold Stream Temperature in the tank
35
Example- Mixing Tank Problem
Time
H
e
i
g
h
t

36
Example- Mixing Tank Problem
T
e
m
p
e
r
a
t
u
r
e

Time
37
Dynamic Matrix Control (DMC)
Time
R
e
s
p
o
n
s
e

R
e
s
p
o
n
s
e

Time
a1
a2
a3
a4,.
h1
h2 h3 h4,.
Step response Pulse response
38
Dynamic Matrix Control (DMC)-
Continued
( )
( )( )
( ) ( ) | | ( )
( )
( ) ) 1 (
1
) (
1
) (
1
1
) ( Let
) ( ) ( ) (
1
1
1 2
3
1
2 1
1
2
3 2 1
1
2 1 1
1
2 1 1 2
3
1
2 1
1
1
1 2
3
1
2 1
1
1
1
1 1

+

+

=
+
= =
+ + + + =
+ + + + + + + =
+ + + + + + + =
+

+ + + +
=

=
+ =

z a a a h
z a z a z a a z
z d z h h h z h h h z
z z z h z h z h h z
z d
z
z h z h z h h
z z y
z
z m
z d z m z h z z y
l l l l
N
N
N
N
N
N
N
i
l
l

t
t
t
t
t
39
Dynamic Matrix Control (DMC)-
Continued
( )
( ) ( )
d m a m a m a m a y
z d z m z a z z y
Finally
z m z m z
But
z d z m z z a z z y
N N
N
i
l
l
N
i
l
l
+ A + + A + A + A =
+ A =
A =
+ =
+ +
=
+

=
+

1 1 3 0 2 1 1 1
1
1 1
1
1
1 1 1
) ( ) ( ) (
) ( 1
) ( ) ( 1 ) (

t
t
t
Effect of the past
disturbance
40
Dynamic Matrix Control (DMC)-
Continued
( )
3 1 1 2 3 4
2 2 1 2 3
1 3 1 2
2 3 1
0 0 0
0 0 0
0 0 0
0 0 0

d k N k
d k N k
d k N
d k N k N
y m a m a a a a d
y m a m a a a d
y m a a a a
y m a a a m a d
d
+
+
+

A A
( ( ( ( ( (
( ( ( ( ( (
A A
( ( ( ( ( (
= + +
A ( ( ( ( ( (
( ( ( ( ( (
A A

= A + A +
A = A
d
1
d
y A m m d
m A y m d

k k
y y =
P=4; M=4
Dynamic Matrix Control (DMC)-
Continued
41
( )
1
1 3 2 4 1 2
1 3 3
2 3
2 3
0 0 0
0 0
0 0
0

( )

d N k
d k N k
d k N
d N k N
k k
k k
y a m d
y a a a a m a m d
y a a m a a
y a a a m d
m m
pinv
d y y

+ +
A
( ( ( (
( ( ( (
+ + A A
( (
( ( ( (
= + +
( (
+ A ( ( ( (

( ( ( (
A

A = A =
= A + A +
A = A
=
d
d
y A m m d
m A y m d
P=4; M=2
42
Tuning Procedures
Sampling time (T): stability is not
affected by T. Larger T leads to less
variations in m, but deteriorates system
performance in presence of frequent
disturbances
Horizon for m (M): Choosing M=P
(perfect control) leads to severe
oscillation in m(t). Reducing M, leads to
a more desired response
43
Tuning Procedures - Continued
Input penalty parameter |: Increasing |
makes system more sluggish and
nonzero | lead to offset, but can be
compensated by adding integral control
algorithm itself.
Optimization horizon, P: increasing P
gets better inverse for system of order n,
P>2n is generally sufficient.
44
Summary - Continued
Model Predictive Control (MPC) is the major
existed advanced process control in chemical
engineering industrial
The modeling in the MPC is crucial
The tuning of MPC using M (horizon of
suppression) is the most effective for stability.
All other parameters may also frequently
implement to improve the control quality

You might also like