CH6

advertisement
Chapter 6
Model Predictive Control
Prof. Shi-Shang Jang
National Tsing-Hua University
Chemical Engineering
Department
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)
2
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)
3
Criteria for Controller QualityContinued


Constraints- Ability to deal with
constraints on inputs and states (no
windup)
Remark: 90% of loops can be handled
by PID type controllers.
4
Internal Model Control (IMC)
Structure
d
ys
+
-
e
u
GI
GP
Gm
+
+
ym -
y
+
dˆ
e=ys-y+ym
5
Analysis of Internal Model
Structure

From the block diagram:
yd
u
G p GI  y s  d 
1  GI (G p  Gm )
 ys  d GI
1  GI (G p  Gm )
6
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 Gp=Gm, then
y=GpGI(ys-d)+d
u=(ys-d) GI


Use IMC only on stable systems, unstable
systems can be stabilized by feedback control
Constraints on inputs has no effect on stability
7
Properties of IMC (Principles of
Internal Model Control)- continued
2. (Prefect Control) If model is perfect and
invertible, and GI=Gp-1, then y=ys for any d

Notes: (1) This is “optimal control”.
(2) Suppose Gp-1 is not realizable, then it is
recommended to factor this transfer function into two
terms: Gp(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: GI(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
GI=Gp-1 F(s) such that GI(s) realizable.
8
Example
G p (s) 
N ( s )  Ds
e
D( s)
GI ( s)  G p1 ( s) F ( s) 
D( s ) Ds
e F ( s)
N ( s)
Which is realizable if we choose:
e  Ds
F ( s) 
s  1n
Where n=degree of D(s)-degree of N(s)>0,  is chosen
9
Properties of IMC (Principles of
Internal Model Control)- continued
3. Zero Offset
There is no offset if we choose:
GI(0)=1/Gm(0)
Pf: y (0)  1  Gm (0)GI (0)d (0)  G p (0)GI (0) ys (0)

1  GI (0) G p (0)  Gm (0)

 y s ( 0)
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.
10
Properties of IMC (Principles of
Internal Model Control)- continued
4. Comparison with Feedback Controller
If we choose G s  
I
Gc
1  GcGm
Then we get classical output feedback control. Note
that GI(s) in the closed loop transfer function of the
following:
e(s)
+
-
Gc(S)
m(s)
Gm(S)
11
Properties of IMC (Principles of
Internal Model Control)- continued
Joining this with the IMC block diagram we get
ys +
-
e(s)+
-
Gc(S)
m(s)
Gp(S)
Gc(S)
d
Gp(S)
y(s)
+
-
which reduced to a classical feedback control:
ys(s)
+
-
Gc
Gp
d
12
Properties of IMC (Principles of
Internal Model Control)- continued
Notes:
(a) G s  
I
Gc
1  GcGm
may be looked upon as a “poor” approximation to Gm-1(s). For
large Kc, this approximation gets better.
(b) Note the similarity of this structure to Smith Predictor also
approximates the invertible part of Gm-1(s).
(c) This feedback structure implies use of a filter:
F s  
Gc s Gm s 
1  Gc s Gm s 
13
On-Line Tuning of IMC
1.
2.
3.
Choose a process model through plant tests
Choose a filter F s   e  Ds
to make GI(s)
n
s  1
realizable
Decrease  untill system becomes oscillatory. Brosilow
recommends the following time constant: (where u=min.
filter constant; Pu=period of oscillation)
2
  
4.
2
n
4
 u  Pu2   Pu2 
2

1/ 2
2
If /D<1, then IMC will yield better performance than a PID
controller. If 1< /D<2; then IMC and PID are competitive.
14
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.
15
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
16
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.
17
Review of least-square problem
Given a set of equations:
Ax=b+e
 We seed a solution which minimizes
iei2
 The solution is given by:
x=(ATA)-1ATb
 We term (ATA)-1AT to be pseudo inverse of
matrix A

18
A Discrete Input Plant Model
y( z) 
N ( z ) 
z m( z )  d ( z )
D( z )
Let


N ( z)
 h1  h2 z 1  h3 z 2    hN z  N 1 z 1
D( z )
Note that N/D is actually the impulse response of the system m(z)=1
without delay
y(t)
h3 h4
h1
h2
h5
h6 h7
t
19
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';
20
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
21
A Discrete Input Plant Model
yk 1  h1mk  h2 mk 1    hN mk  N 1
Let   0
for example,four step ahead forecast
 yk  4  h1
y  0
 k 3   
 yk  2   0

 
y
 k 1   0
h2
h3
h1
0
0
h2
h1
0
h4   mk 3   hN
h3  mk  2   



h2  mk 1  h3
 

h1   mk   h2
0   mk 1 
0   mk  2 
 hN 0    


h3  hN  mk  N 
0
hN
0
0
ˆ  Λm
yˆ  Am
22
A Discrete Input Plant ModelContinued
y( z )  z  1H ( z )m( z )  d ( z )
 G( z )m( z )  d ( z )
This expresses y in terms of past inputs m; i.e.:
Then
y( z )  z
 1
N
h z
i 1
l
l 1
m( z )  d ( z )
yk  1  h1mk  h2 mk 1    hN mk  N 1  d
 yˆ k  1  d
23
Approximate Inversion
Since we cannot make y(t)=yd(t) exactly, we pose the following least
square minimization problem:
P
min
m ( k ), m ( k 1),...,m ( k  M 1)
2
2
2 2
ˆ







y
k



l

y
k



l


l d
l m k  l  1
i 1
subject to the above process model:
y( z)  z
 1
N
h z
i 1
l
l 1
m( z )  d ( z )
m(k  M  1)  m(k  M )    m(k  P  1)
No control changes beyond M
24
The Solution

The previous problem can be solved
based on a Quadratic Programming
solver or using previous pseudo-inverse
of matrix approach.
25
MPC-Servo Control (A Feed-forward
Approach) Want yk+1=yk+2=…=yd
 yd  h1 h2
y  0 h
1
 d 
 yd   0 0
  
 yd   0 0

y d  Am  Λ m
h3
h2
h1
0
h4   mk 3   hN
h3  mk  2   

h2   mk 1   h3
 

h1   mk   h2
0   mk 1 
hN 0 0   mk  2 
 hN 0    


h3  hN  mk  N 
0
0
ˆ  A 1 y d  Λ m 
m
P=4; M=4
26
MPC-Servo Control (A Feedforward Approach) -Example
Y_real
Y_sample
time
time
P=4; M=4
27
MPC-Servo Horizon Control (A Feedforward Approach) Want
yk+1=yk+2=…=yd, but mk+1=mk+2=mk+3
 yd  h1  h2  h3 h4 
 hN
 m
y   h  h
 
h


1
2
3
 k 1  
 d 
 yd  h1
h2   mk   h3

  

y
0
h
 d 
 h2
1 

y d  Am  Λ m
ˆ  pinv( A)y d  Λ m 
m
0   mk 1 
hN 0 0   mk  2 
 hN 0    


h3  hN  mk  N 
0
0
P=4; M=2
28
MPC-Servo Horizon Control (A Feedforward Approach) Want
yk+1=yk+2=…=yd, but mk+1=mk+2=mk+3
Response
Time
P=4; M=2
29
MPC-Regulation Control (A
Feedback Approach)
 yd  h1 h2 h3
y  0 h h
1
2
 d 
 yd   0 0 h1
  
 yd   0 0 0
ˆ  Λm  d
y d  Am
h4   mk 3   hN
h3  mk  2   

h2   mk 1   h3
 

h1   mk   h2
0   mk 1  d 
0   mk 2  d 
 
 hN 0       

  
h3  hN  mk  N  d 
0
hN
0
0
ˆ  A 1 y d  Λ m  d 
m
d  yk  yˆ k
P=4; M=4
30
MPC-Regulation Control (A
Feedback Approach)
 yd  h1  h2  h3 h4 
 hN
 m
y   h  h
 
h


1
2
3
d
k

1

 



 yd  h1
h2   mk   h3

  

y
0
h
 d 
 h2
1 
ˆ  Λm  d
y d  Am
ˆ  pinv( A)y d  Λ m  d 
m
0   mk 1 
hN 0 0   mk  2 
 hN 0    


h3  hN  mk  N 
0
0
d  yk  yˆ k
P=4; M=2
31
MPC-Regulation Control (A
Feedback Approach)
Response
Response
Time
M=2
Time
M=4
32
Multi-variable Discrete Input
Plant Model
1
12 2
12 2
12 2
y1k 1  h111m1k  h211m1k 1    h11
N mk  N 1  h1 mk  h2 mk 1    hN mk  N 1
Let   0
for example,four step ahead forecast
 y1k  4  h111 h211 h311
 1  
11
11
 yk 3   0 h1 h2
 y1k  2   0
0 h111
 1  
0
0
 yk 1    0
2
 y  h 21 h 21 h 21
2
3
 k2 4   1
21
21
 yk 3   0 h1 h2
 y2   0
0 h121
 k2 2  
 yk 1   0
0
0
0
0
0 h512  h12
h412   m1k 3  h511  h11
N
N
  1   11
11
12
12
12
12
hN
0
0 h4 
0 h1 h2 h3  mk  2   h4 
1
11
11
12
12
 hN
0
h312
0
0 h1 h2   mk 1   h3
 

h311  h11
h212
0
0
0 h112   m1k   h211
N

h122 h222 h322 h422   mk23  h521  hN21 0
0
0 h522  hN22
 

0 h122 h222 h322  mk2 2   h421 
hN21 0
0 h422 
 

0
0 h122 h222   mk21   h321
 hN21 0
h322
0
0
0 h122   mk2   h221
h321  hN21 h222
h411 h112
h311
h211
h111
h421
h321
h221
h121
h212
h312
  m1k 1 


h12
0
0   m1k  2 
N
 h12
0   
N
 1 
h312  h12
 mk  N 
N
0
0
0   mk21 


hN22 0
0   mk2 2 


 hN22 0    
h322  hN22  mk2 N 
0
0
0
ˆ  Λm
yˆ  Am
33
Examples of Multivariable Control:
Control of a Mixing Tank
Hot
Cold
LT
TT
MV’s: Flow of Hot Stream
Flow of Cold Stream
CV’s: Level in the tank
Temperature in the tank
34
Example- Mixing Tank Problem
Height
Time
35
Example- Mixing Tank Problem
Temperature
Time
36
Dynamic Matrix Control (DMC)
Response
Response
a4,….
a1 a2
a3
h1 h2 h3
Time
Step response
h4,….
Time
Pulse response
37
Dynamic Matrix Control (DMC)Continued
y( z)  z
 1
N
h z
i 1
l 1
l
m( z )  d ( z )
1
1  z 1
1
 h3 z  2    hN z  N 1
 1 h1  h2 z
y( z)  z
 d ( z)
1
1 z
 z  1 h1  h2 z 1  h3 z  2    hN z  N 1 1  z 1  z  2  
Let
m( z ) 

 z  1
 z  1




h  h  h z  h  h  h z   d z 
a  a z  a z    a z 
1
1
1
1
2
2
2
1
1
2
3
2
3
hl  al  al 1   al (1  z 1 )
 N 1
N
38
Dynamic Matrix Control (DMC)Continued
y( z)  z
 1
N


l 1
1
a
z
1

z
m( z )  d ( z )
 l
i 1
But
1  z m( z )  mz 
1
Finally
y( z)  z
 1
N
l 1
a
z
 l m( z )  d ( z )
i 1
y 1  a1m1  a2 m0  a3 m1    a N m N 1  d
Effect of the past
disturbance
39
Dynamic Matrix Control (DMC)Continued
 yd   a1
y   0
 d
 yd   0
  
 yd   0
a2
a1
a3
a2
0
0
a1
0
a4   mk 3   aN
a3   mk  2  


a2   mk 1   a3
 

a1   mk   a2
0
aN
0
0
aN
a3
0   mk 1   d 
0   mk  2   d 

 
0 
  


aN   mk  N   d 
ˆ  Λm  d
y d  Am
ˆ  A 1  y d  Λm  d 
m
d  yk  yˆ k
P=4; M=4
40
Dynamic Matrix Control (DMC)Continued
 yd 
y  a  a
 d 1 3
 yd   0
 
 yd 
 aN
a2  a4   mk 1  




a1  a3   mk   a3

 a2
0
0
0
aN
0
aN
a3
0   mk 1   d 
0   mk  2   d 

 
0 
  


aN   mk  N   d 
mk  2  mk 3
ˆ  Λm  d
y d  Am
ˆ  pinv( A )  y d  Λm  d 
m
d  yk  yˆ k
P=4; M=2
41
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
42
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.
43
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
44
Download