Chemical and Biological Engineering
Model Predictive Control: Background
- B. Wayne Bequette
- Concise Review of Undergraduate Process
Control
- Introduction to Discrete-time Systems
- Digital PID
- Discrete Internal Model Control (IMC)
January 2015
Model Predictive Control: Background B. Wayne Bequette Concise - - PowerPoint PPT Presentation
Model Predictive Control: Background B. Wayne Bequette Concise Review of Undergraduate Process Control Introduction to Discrete-time Systems Digital PID Discrete Internal Model Control (IMC) January 2015 Chemical and Biological
Chemical and Biological Engineering
January 2015
feedforward feedback
l Compares measured process output with desired setpoint,
l Proportional-integral-derivative (PID)
Ø Long history, “workhorse”, lower-level control loops
l Model predictive control (MPC)
Ø Most widely applied “advanced” control algorithm Ø Constraints, multivariable systems
D t I c
Manipulated Input Error = setpoint - measured output Proportional gain Integral time Derivative time
l
Single-input, single-output design
Ø
Problems with one controller can impact another controller
l
Constraints
Ø
Can cause “windup” problems
l
Does not explicitly require a process model
Chemical and Biological Engineering
l General “Lumped Parameter” Form
n
2 1
m
2 1
r
2 1
q
2 1
n
2 1
s s s s s s s s
u x j i ij u x j i ij u x j i ij u x j i ij
, , , ,
ns n s s
2 2 1 1
ms m s s
2 2 1 1
rs r s s
2 2 1 1
eqn i state j eqn i input j
B A B B A A A Af A
C k C k C V F dt dC C k C k C C V F dt dC
2 1 2 3 1
− + − = − − − =
Bs B Afs Af s Bs B As A
C C x y C C V F V F u C C C C x x x − = = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − − = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − − = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ =
2 2 1
, ,
, 1 , , 2
2 1 3 1
= = ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − = ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ − − − − − = D C C V F C C B k V F k C k k V F A
Bs s As Afs s As s
etc C A u x
As s s
C f x f A
, 1 , 1 1 11
∂ ∂ ∂ ∂ = =
“hidden slide” provided for additional background
m rm r m n rn r n r m nm n m n nn n n n
1 1 1 11 1 1 1 11 1 1 1 1 11 1 1 1 11 1
l Eigenvalues of A
Ø n x n A matrix = n eigenvalues = n states Ø If all eigenvalues have a negative real portion – stable Ø If any eigenvalue has a positive real portion – unstable Ø Complex – generally ‘oscillatory’
l Characteristic Polynomial (n roots):
Ø Must have at least 2 states to oscillate (be complex)
eigenvalues are the roots of the equation Identity matrix
Operating condition 1 Operating condition 2
1 =
2 1 1
Operating Point 2 = Unstable Operating Point 1 = Stable
Can show that the Eigenvalues for Operating Point 2 are:
“hidden slide” provided for additional background
l Convert Differential Equations to Algebraic Equations
Ø Design controllers using algebra rather than differential equations
l Easy Analysis of “Block Diagrams”
−stdt ∞
l Most Undergraduate Courses
Ø Much (perhaps too much) time is spent:
n Taking Laplace transform of process differential equation n Laplace transform of “forcing function” (typically a step) n Multiply, then perform partial fraction expansion n Invert each term back to the time domain for an analytical expression
l In Practice
Ø Step response behavior for process understanding Ø Main use of transfer function is for “controller synthesis” Ø Can easily convert from differential equations (“state space”)
to transfer function form using MATLAB, etc.
Ø Closed-loop block diagram analysis
Very painful, many nightmares?
Setpoint Error Manipulated input Measured output
p c p c
Closed-loop characteristic equation (roots determine stability) Routh Array, etc.
1 1
− −
Take the Laplace Transform (s = transform variable)
Transfer function matrix
1 −
1 1 1 1 1 1
n m n n m m m m p
− − − −
n m pz p
2 1 2 1
2 1 2 1
pn p p nm n n p p
1 1
p
Relative order = n-m
l Number of states = Number of poles (order of numerator
2
“hidden slide” provided for additional background
l More familiar with gain-time constant form l Most chemical processes are stable
Ø Exceptions: Exothermic or bioreactors, closed-loop systems
(mistuned)
Real axis Imaginary axis x x more oscillatory faster response
x unstable poles
“hidden slide” provided for additional background
p p
2 4 6 8 10 12 14 16 18 20 5 10 15 20 t, minutes y, deg C 2 4 6 8 10 12 14 16 18 20 2 4 6 8 10 t, minutes u, kW
input
p s p
−
θ
p p
time- delay time constant y u long-term change in process output change in process input 63.2 %
in process
time period of oscillation a b c rise time decay ratio = b/a
time to first peak
2s 2 + 2ζτs +1 ⋅u s
2 , 1 2 2 , 1
step response
10 20 30 40 50 60
0.2 0.4 0.6 0.8 1 1.2 time
3 10 15 20 various values of numerator time constant y
n p
n
n
n
l For stable systems, the steady-state gain is found from the
pn p p nm n n p
2 1 2 1
p p s t pn p p nm n n p s t
→ ∞ → → ∞ → 2 1 2 1
t p
∞ →
“hidden slide” provided for additional background
pΔ
p
p
p
l An infinite number of state space models can yield a given
l Two different state space “realizations” are normally used
Ø Controllable canonical form Ø Observable canonical form
p
2 1 22 21 12 11 2 1
2 22 1 21 2 2 12 1 11 1
p 1 −
1 p
2 1 2 2 1 1
2 1 2 2 1 1
2 p
p 1 −
1 p
2 1 2 2 1 1
2 1 2 2 1 1
2 p
p 1 −
2 1 2 2 1 1
3 p
T
T V U G
Σ
Left singular Vector matrix Right singular Vector matrix Matrix of singular values
Strongest input direction Strongest
direction Max singular value
T V U G
Σ
2 1
2 1
2 1
2 1
Input in Strongest Direction Output in Strongest Direction Input in Weakest Direction Output in Weakest Direction
y = Kp u
T V U G
Σ
G1 s
2.6 62s + 1 1.5 23s +1
1.4 30s +1
2.8 90s +1
⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥
G2 s
1.5 63s +1 2.5 39s +1
2.5 56s +1
1.6 91s +1
⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥
Operating Point 1 – Minimum Phase Operating Point 2 – Nonminimum Phase (RHPT zero) Matrix inverse is unstable “Transmission zeros” are both negative
l Can have right-half-plane “transmission zeros” even when
l Can have individual RHP zeros yet not have a RHPT zero
Ø Fine performance when constraints are not active Ø May fail when one constraint becomes active or a loop is “opened”
l Can exhibit “directional sensitivity” – with some setpoint
l Some of these MV properties cause challenges independent
l Nonlinear Model
Ø Solve for steady-state, then linearize (Taylor series expansion)
l State Space (linear) Model
Ø Deviation variable form (perturbations from steady-state)
l Dynamics
Ø Eigenvalues of A matrix = poles of transfer function matrix
n Pole-zero cancellation may reduce number of poles
Ø Right-half-plane zeros = inverse response Ø MV: Transmission Zeros
l Long term behavior from steady-state gain l Singular Value Decomposition (SVD)
l Work through Workshop on the Three Tank Model
Chemical and Biological Engineering
k k k k k k
+1
m k m k k k n k n k k k
− − − − − −
2 2 1 1 2 2 1 1
k
k 1 1 − − =
m m m m n n n n − + − − − − + − − −
1 1 1 1 1 1 1 1
Some texts/papers have different sign conventions
n n n n m m m m − + − − − − + − − −
1 1 1 1 1 1 1 1
1z −1 +... + b m−1z − m+1 + bmz − m
1z−1 + ... + an−1z− n+1 + anz− n
n + b 1z n−1 + ... + bmz n−m
1z−1 + ... + an −1z −n+1 + an n n
zeros = roots of numerator polynomial poles = roots of denominator polynomial ( )
n m pz p
2 1 2 1
Stable Stable
1u k −1
1z −1
1
a1 0.5
1.5
p
0.5
1.5 y(1)
0.5
1.5 y(2) 0.25 0.25 2.25 2.25 y(3)
0.125
3.375 y(4) 0.0625 0.0625 5.0625 5.0625 Characteristic behavior O s c i l l a t o r y, stable M o n o t o n i c , stable O s c i l l a t o r y, unstable M o n o t o n i c , unstable
Let y(0) = 1, u(k) = 0
Value of the pole
l Poles inside circle
Ø stable
l Poles outside circle
Ø unstable
l Negative poles
Ø oscillate
l First-order discrete systems can oscillate
Ø This cannot happen with continuous systems
l Zeros outside unit circle
Ø Inverse is unstable (not necessarily inverse response)
l Any continuous system with relative order >2 will
Astrom, KJ, P Hagander & J Sternby “Zeros of Sampled Systems,” Proceedings of the 1984 American Control Conference, 1077-1081
3
3
Sample time = 1
n→∞ y nΔt
z→1 1− z −1
t→ ∞ y t
z →1 1 − z −1
z →1 1 − z −1
−1 = lim z →1 gp z
t→0 y t
z →∞ 1− z −1
“hidden slide” provided for additional background
3
3
3
3 =
“hidden slide” provided for additional background
k k k k k k
+1
k k k k k k k k k
+ + + 1 1 1
How good are the approximations?
k t A k t A k t t t k A t A k t A k
k k
1 1 − Δ Δ + Δ + − Δ Δ
σ
t A t A 1 − Δ Δ
− Δ
1
t A
2 1 2 1 2 1
−1
2 1 2 1 2
− − − −
2 1 2 2
− − −
Poles/eigenvalues = 0.7408 & 0.8869 Poles/eigenvalues = 0.7 & 0.88
“hidden slide” provided for additional background
2 4 6 8 0.5 1 1.5 2 temp, deg C discrete-time step
2 4 6 8 0.2 0.4 0.6 0.8 1 discrete-time step psig
s
1
s s s s
2 4 5 3 Etc.
T
∞ − ∞ + − − + − − ∞ = −
k N N k N N k N k i i k i k
1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
− = − − ∞ − − + − − − ∞ − − + − − −
−
N i i k i N k N k u k N k N N k N k k N N k N N k N k k
N k
2 4 6 8 10 0.2 0.4 0.6 0.8 1 discrete-time step psig
2 4 6 8 10
0.2 0.4 0.6 0.8 1 discrete-time step temp, deg C
h h h 1 2 3
j=1 i
Impulse and step response coefficients are related
2 2 1 1 2 2 1 1 2 1 1 2 1 1 2 1 2 1 1 2 1 1
− − − − − −
N N N N N
− − − − − − 2 1 2 1 2 1 2 1 1 1 1
N N N N N
model output measured output known (measured) input time step index N pts could change sign on columns 1 & 2 of Φ
2 i=1 N
T Y − ˆ
T Y −ΦΘ
=
N i i i b b a a
1 2 , , ,
2 1 2 1
TΦ
−1Φ TY
parameter estimate vector measured
vector
0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.2 0.4 0.6 time, min y PRBS estimation example 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.5 1 time, min u
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ − − − − − = ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − = Φ 0502 . 1134 . 1162 . 1513 . 0172 . 3846 . 5007 . 2003 . 0463 . 1123 . 1879 . 0485 . 1558 . 2171 . 3446 . 1771 . 4618 . 1564 . 0137 . 1 1 1162 . 1134 . 1 1 1513 . 1162 . 1 1 0172 . 1513 . 1 1 3846 . 0172 . 1 1 5007 . 3846 . 1 1 2003 . 5007 . 1 1 0463 . 2003 . 1 1 1123 . 0463 . 1 1 1879 . 1123 . 1 1 0485 . 1879 . 1 1 1558 . 0485 . 1 1 2171 . 1558 . 1 1 3446 . 2171 . 1 1 1771 . 3446 . 1 1 4618 . 1771 . 1 1 1564 . 4618 . 1 1 0137 . 1564 . 1 1 0889 . 0137 . 1 1 0889 . Y
TΦ
−1Φ TY
5481 . 5716 . 274 . 2 0889 . 3133 . 1196 . 1 1 2021 . 0889 . 3133 . 1196 . 1 2021 . 0889 .
2 1 2 1 2 2 1 2 2 1
− − − − = + − + − = + − + − = + + + =
− − − −
z z z z z z z z z z a z a z b z b z g p
2 1 2 1 2 2 1 2 2 1
− − − −
2 1 2 1 − − − −
k k k k k
l Subspace ID can be used to develop discrete state
l Discrete models
Ø State space, ARX, discrete transfer function
l Zeros & poles
Ø Poles inside unit circle are stable (negative = oscillate) Ø Zeros inside unit circle have stable inverses
l Parameter estimation
Ø Example with PRBS input
l Step and impulse response models
Chemical and Biological Engineering
D t I c
Manipulated Input Error = setpoint – measured output Proportional gain Integral time Derivative time
= =
k i k i i k t
k
1 1 2 1
− = 1
k i D I c
0 + kc e k
i= 0 k
1e k −1
1 = −kc 1+ 2τ D
2 1
− −
1 2
2 1
− −
2 1 1 2 1
− − −
1 2 1 1 2
− − −
c
2 1 2 2
l Usually based on continuous-time methods, including: l Ziegler-Nichols closed-loop oscillations l Cohen-Coon l IMC-based PID l Skogestad’s tuning method l Frequency response l SWAG (most common)
l Continuous Model l PID Parameters
p p D p I p p c
λ is the tuning parameter – related to the closed-loop time constant
l Stability analysis l Poles of CLTF must be
CL c p c p
Closed-loop transfer function
l Work through Workshop on Digital PID Control
Manfred Morari
r(z) e(z) u(z) gc(z) gp(z) d(z) y(z) + + + _
l Digital Controller Design
Ø Response specification-based
CL c p c p
Desired response
CL CL p c c p c p CL
u(z) q(z) r(z) d(z) y(z) + + +
~ g (z)
p
d(z) ~ r(z) ~ g (z)
p
y(z) ~ Process Process model IMC controller
r(z) u(z) q(z) gp(z) y(z)
CL p
Desired response
p CL
p CL p CL 1
−
p c
l Deadbeat l Dahlin’s Controller l State Deadbeat l State Deadbeat with Filter (Vogel-Edgar) l Modified Dahlin’s Controller l NEW (IMC) DESIGN
John Ragazzini
l Achieve setpoint in the minimum time (if no time-delay,
k k
+1
1 −
p 1 1~− −
1 −
1 1 1
− − −
p c
1 1
− −
1 1 1
− − −
1 1 1 1 1 1 1 2 1 1
− − − − − − − − − −
1 1 1 1 1 1 1 1 1
− − − − − − − − −
c p p
1 1 1 1
− − − −
p p c
1 1 1 1 1 1 1 1
− − − − − − − −
k k k k k k k k c c
1e k −1
1 = −kc 1+ 2τ D
u(z) q(z) r(z) d(z) y(z) + + +
~ g (z)
p
d(z) ~ r(z) ~ g (z)
p
y(z) ~ Process Process model IMC controller
p
1 1 1 1 1 1 1 1 1
− − − − − − − − −
k k k k k k k k k k k k
1 1 1
− − −
k k k k k k k k k k k k
1 1
− −
k k k k k k k
2 4 6 8 0.5 1 time y deadbeat, FO example
2 4 6 8 5 10 time u
2 1 2 1
− − − −
2 2 2 1 3 2 1
− − − − −
5 10 15 20 25 30 0.5 1 1.5
5 10 15 20 25 30
50 100
Perfect control, at sample times “ringing” behavior (intersample)
l Desired first-order + time-delay response to setpoint
p p p CL 1 1 1 1
− − − −
1 1
− −
2 2 1 2 1 1 1
− − − − − −
Still “ringing”, but more damped than deadbeat For λ = 3, α = 0.3679
5 10 15 20 25 30 0.5 1 1.5 time y Dahlin, SO example
5 10 15 20 25 30
50 100 time u
First-order response, at sample times
l Substitute zeros at origin for unstable (|zero|>1) or ringing
l Problem: Dahlin applied this to gc(z), but should have
“hidden slide” provided for additional background
l Brings outputs & inputs to new steady-state in the
l Does not invert zeros at all
2 2 2 1 1
− − − −
p
2 1 2 1 2 1 2 1
− − − − − − − −
5 10 15 20 25 30 0.5 1 1.5 time y State Deadbeat, SO example
5 10 15 20 25 30
50 100 time u
n n k k pz p
+ − + + − −
1 1 1 1
Zafiriou & Morari notation Assumes stable poles
+ i
− i
zero inside unit circle = = zero outside unit circle
k pz n SD
− −
1 1
1 1 1 1
− − − −
n k pz n SD VE
Notice that neither the state deadbeat nor Vogel-Edgar controllers try to invert zeros (even good ones!)
l Model Factorization (“good stuff” and “bad stuff”)
p p p + −
positive zi outside the unit circle (but not the negative ones)
less than denominator
p 1
−
l Controller: Invert “good stuff” part of model
3
3
3 2
p p p + −
Sample time = 1
− − − −
p
2 3 1 1 2 3 1
Note gain is 1 (value at z = 1) where α = exp(-Δt/λ) zeros at -1.7990 (outside unit circle)
2 4 6 8 10 0.5 1 1.5 time y Discrete IMC, TO example
2 4 6 8 10
1 2 3 4 5 time u
For λ = 1, α = 0.135
792 . 1 162 . 162 . 1 1 162 . 1 1 1 792 . 162 . 1 779 . 819 . 905 . 162 . 1 1 1 162 . 1 1 792 . 1 162 . 01316 . ~ − ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ − ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ − + − ⋅ − − − ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ − ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ − − − = z z z z z z z z z z g p
Δt = 0.1
− −
p
where α = exp(-Δt/λ) zeros at 1.162 (outside unit circle)
−
1 2 3 4 5
0.5 1 1.5 time y Discrete IMC, RHPZ - Example 3 Z&M
1 2 3 4 5
2 4 6 8 10 time u
For λ = 0.5, α = 0.8187
l Have assumed a “perfect model” for these simulations. In
l Can approximate real-world challenges by having the
l Digital Control Techniques
Ø Deadbeat Ø Dahlin’s Ø State Deadbeat, State Deadbeat w/filter (Vogel-Edgar) Ø Modified Dahlin’s (mis-developed by Dahlin!)
l Internal Model Control
Ø Factorization of zeros outside unit circle and negative zeros inside the
circle
Ø Form “all-pass”(reflection of positive zeros outside the unit circle) Ø Invert “good stuff” and use first-order filter
l Work through Workshop on Discrete IMC