Post on 10-Feb-2017
transcript
Chemical and Biological Engineering
Model Predictive Control: Background
B. Wayne Bequette
• Concise Review of Undergraduate Process Control
• Introduction to Discrete-time Systems• Discrete Internal Model Control (IMC)
Automation and Control
feedforward
feedback
Control Algorithm
Compares measured process output with desired setpoint, and calculates a manipulated input (often a flowrate)
Proportional-integral-derivative (PID)Long history, “workhorse”, lower-level control loops
Model predictive control (MPC)Most widely applied “advanced” control algorithmConstraints, multivariable systems
Common notation
r = setpoint (desired value of process output)
y = measured process output
e = error (setpoint – output, r – y)
u = manipulated input (often a flowrate)
Proportional-Integral-Derivative (PID) Control
( ) ( ) ( )
( ) ( ) ( ) ( )⎥⎦
⎤⎢⎣
⎡+++=
−=
∫ dttdedttetekutu
tytrte
D
t
Ic τ
τ 001
ManipulatedInput
Error = setpoint − measured output
Proportionalgain
Integral time Derivative time
Single-input, single-output designProblems with one controller can impact another controller
ConstraintsCan cause “windup” problems
Does not explicitly require a process model
Chemical and Biological Engineering
Continuous Linear Models
State Space and Transfer Function
B. Wayne Bequette
• Linearization• State Space Form• Transfer Function• Step Responses• MV Properties
Nonlinear ODE Models
General “Lumped Parameter” Form
( )puxfx ,,=&
y = g x,u, p( )
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
=
nx
xx
xM2
1
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
=
mu
uu
uM2
1
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
=
ry
yy
yM2
1
differential state equations
algebraic output equations
⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢
⎣
⎡
=
qp
pp
pM
2
1
⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
=
dtdx
dtdxdtdx
x
n
M
&2
1
states state derivatives(from accumulationterm)
inputs outputs parameters
Linearization
ssssssss uxj
iij
uxj
iij
uxj
iij
uxj
iij u
gDxgC
ufB
xfA
,,,,
∂∂
∂∂
∂∂
∂∂
====
uDxCyuBxAx
′+′=′′+′=′&
( )puxfx ,,=&
y = g x,u, p( )
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
−
−−
=′
nsn
s
s
xx
xxxx
xM
22
11
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
−
−−
=′
msm
s
s
uu
uuuu
uM
22
11
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
−
−−
=′
rsr
s
s
yy
yyyy
yM
22
11
‘perturbation’ or ‘deviation’ variables
eqn i state j eqn i input j
steady-state solution, us, xs, ys
Where:
Example: Van de vuuse Reaction
( )
BABB
AAAAfA
CkCkCVF
dtdC
CkCkCCVF
dtdC
21
231
−+−=
−−−=
[ ]BsBAfsAf
s
BsB
AsA CCxyCC
VFVFu
CCCC
xx
x −==⎥⎦
⎤⎢⎣
⎡−−
=⎥⎦
⎤⎢⎣
⎡−−
=⎥⎦
⎤⎢⎣
⎡= 2
2
1 , ,
[ ] [ ]00 ,10
,0
,02
21
31
==
⎥⎥
⎦
⎤
⎢⎢
⎣
⎡
−
−=⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
−−
−−−=
DC
CVFCCB
kVFk
CkkVF
ABs
sAsAfs
s
Ass
= f1
= f2
etcCAux AsssCf
xfA
,
1
,1
111 ∂
∂∂∂
==
“hidden slide” provided for additional background
Continuous State Space Model
DuCxyBuAxx
+=+=&
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡+
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡+
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
mrmr
m
nrnr
n
r
mnmn
m
nnnn
n
n
u
u
dd
dd
x
x
cc
cc
y
y
u
u
bb
bb
x
x
aa
aa
x
x
M
L
MLM
L
M
L
MLM
L
M
M
L
MLM
L
M
L
MLM
L
&
M
&
1
1
1111
1
1111
1
1
1111
1
1111
n by n n by m
r by n r by m
Assumes deviation variable form
StabilityEigenvalues of A
n x n A matrix = n eigenvalues = n states If all eigenvalues have a negative real portion – stableIf any eigenvalue has a positive real portion – unstableComplex – generally ‘oscillatory’
( ) 0det =− AIλ
Characteristic Polynomial (n roots): Must have at least 2 states to oscillate (be complex)
eigenvalues are the roots of the equation
Identity matrix
Example: CSTR at 2 Operating PointsOperating condition 1 Operating condition 2
A1 =−1.1680 −0.08862.0030 −0.2443
⎡
⎣ ⎢
⎤
⎦ ⎥ A2 =
−1.8124 −0.23249.6837 1.4697
⎡
⎣ ⎢
⎤
⎦ ⎥
( ) ( )( ) ( )( )04628.04123.1
0003.20886.02443.01680.1det2443.00030.2
0886.01680.1
21
1
=++=
=−−++=−
⎥⎦
⎤⎢⎣
⎡+−
+=−
λλ
λλλλ
λλ
AI
AI
λ = −0.8955 hr-1 and λ = −0.5168 hr-1
λ = −0.8366 hr-1 and λ = 0.4939 hr-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
Laplace Transform
Convert Differential Equations to Algebraic EquationsDesign controllers using algebra rather than differential equations
Easy Analysis of “Block Diagrams”
L f t( )[ ]= F s( ) = f t( )e− st dt0
∞
∫
L 1[ ]=1s
( ) ( ) ( )0fssFdt
tdfL −=⎥⎦⎤
⎢⎣⎡
Definition of Laplace Transform
Unit step
Derivative
Laplace Transforms, cont’d
Most Undergraduate CoursesMuch (perhaps too much) time is spent:
Taking Laplace transform of process differential equationLaplace transform of “forcing function” (typically a step)Multiply, then perform partial fraction expansionInvert each term back to the time domain for an analytical expression
In PracticeStep response behavior for process understandingMain 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?
Block Diagram AnalysisSetpoint Error Manipulated input Measured output
g c e(s)
controller
(s) u(s)g (s) p
y(s)r(s) +
−process
( ) ( ) ( )( ) ( ) ( )sr
sgsgsgsg
sypc
pc ⋅+
=1
Closed-loop characteristic equation(roots determine stability)
Routh Array, etc.
State Space to Transfer Function Form
DuCxyBuAxx
+=+=&
( ) ( ) ( )( ) ( ) ( )sDusCxsy
sBusAxssx+=+=
( ) ( ) ( )( ) ( )[ ] ( )
( ) ( ) ( )susGsy
suDBAsICsy
sBuAsIsx
1
1
=
+−=
−=−
−
Take the Laplace Transform (s = transform variable)
Transfer function matrix
usually, D = 0
( ) ( )[ ]BAsICsG 1−−=
Matrix Transfer Function Form
( ) ( ) ( )susGsy =
y1 s( )M
yr s( )
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
=g11 s( ) L g1m s( )
M
gr1 s( ) L grm s( )
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
u1 s( )M
um s( )
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
yi s( ) = gij s( )uj s( )
r outputsm inputs
output i input j
r rows by m columns
Transfer Function MatrixFirst subscript = outputSecond subscript = input
Dynamic Behavior: SISO
( )01
11
011
1
asasasabsbsbsbsg n
mn
n
mm
mm
p ++++++++
= −−
−−
L
L
( ) ( )( ) ( )( )( ) ( )n
mpzp pspsps
zszszsksg
−−−
−−−=
L
L
21
21
( ) ( )( ) ( )( )( ) ( )111
111
21
21
+++
+++=
ssssssk
sgpnpp
nmnnpp τττ
τττL
L
Polynomial
Pole-zero
Gain-time constant
Zeros = roots of numeratorPoles = roots of denominator = determine stability
11 1 pp −=τ Large time constant = small, negative, pole
Relative order= n-m
Example of Pole-Zero Cancellation
Number of states = Number of poles (order of numerator of transfer function), except when some poles and zeros ‘cancel’
[ ] [ ]0 018255.35301.1
5640.275.0
9056.00
==
⎥⎦
⎤⎢⎣
⎡−=⎥
⎦
⎤⎢⎣
⎡−−
=
DC
BA
( ) ( )( )( )2640.23.0
3.05302.16792.0564.2
4590.05302.12 ++
+−=
++−−
=ss
sss
ssg p
gp s( ) =−0.6758
0.4417s + 1
Bioreactormodel
“hidden slide” provided for additional background
Chemical Process Engineers
More familiar with gain-time constant formMost chemical processes are stable
Exceptions: Exothermic or bioreactors, closed-loop systems (mistuned)
Real axis
Imaginary axis
x
x
more oscillatory
faster response o
inverse response zeros
xunstable poles
x = poleo = zero
“hidden slide” provided for additional background
First-Order
( ) ( )susk
syp
p
1+=
τ
τ pdydt
+ y = kpudydt
= −1τ p
y +kp
τ p
uor
gain
time constant
0 2 4 6 8 10 12 14 16 18 200
5
10
15
20
t, minutes
y, d
eg C
0 2 4 6 8 10 12 14 16 18 200
2
4
6
8
10
t, minutes
u, k
W
Example: gain = 1.43 oC/kWtime constant = 5 minutes
output
input
First Order + Time-delay
( ) ( )susek
syp
sp
1+=
−
τ
θ
( )θτ −=+ tukydtdy
pp
gain
time constant
time- delay
time constant
y
u
long-term change in process output
change in process input
63.2 % of change in process output
time-delay
Second-order Underdamped
time
period of oscillation
a
b
c rise time
decay ratio = b/a
overshoot ratio = a/c
time to first peak
y s( ) =k
τ 2s 2 + 2ζτs +1⋅u s( )
Im Re
1
2,1
2
2,1
jp
p
±=
−±−=
τζ
τζ
1<ζ
step response
Numerator Dynamics
0 10 20 30 40 50 60-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
time
-15
-10
-3
3
10
15
20
various values of numerator time constant
y
( ) ( )( )( )11513
1++
+=
ssssg n
pτ
nz τ1−=
00 >→< znτ
“inverse response”(right-half-plane zeros)[challenging control problem]
responsefaster large →=nτ
Steady-state Gain
For stable systems, the steady-state gain is found from the long-term response
( ) ( )( ) ( )( )( ) ( ) s
usss
sssksy
pnpp
nmnnp Δ⋅
+++
+++=
111111
21
21
ττττττ
L
L
( ) ( ) ( )( ) ( )( )( ) ( )
( ) ( ) uksuksssyty
su
ssssssk
sssyty
ppst
pnpp
nmnnp
st
Δ=Δ
⋅⋅==
Δ⋅
+++
+++⋅==
→∞→
→∞→
0
21
21
0
limlim
111111
limlimττττττ
L
L
( )uy
u
tyk t
p ΔΔ
=Δ
= ∞→lim
Step input
Final value theorem
“hidden slide” provided for additional background
Process Gain: Controller Implications
Long-term behavior from steady-state information
Controller really serves as “inverse” of process
uky pΔ=Δ
yk
up
Δ=Δ1
Process with higher gain is generally easier to control, all else being equal…
Process Zero: Controller Implications
For “tight” control, controller is “inverse” of process
( ) ( )sysg
sup
1)( =
Inverse of gp(s) is unstable if gp(s) has a right-half-plane zero
( ) ( )susgsy p=)(
Transfer Function to State Space
An infinite number of state space models can yield a given transfer function model
Two different state space “realizations” are normally usedControllable canonical formObservable canonical form
Multivariable Systems: Properties
Matrix-vector Notation
( ) ( )suGsy p=
( )( )
( ) ( )( ) ( )
( )( )⎥⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡susu
sgsgsgsg
sysy
2
1
2221
1211
2
1
( ) ( ) ( ) ( ) ( )( ) ( ) ( ) ( ) ( )susgsusgsy
susgsusgsy
2221212
2121111
+=+=
2 input – 2 output Example
Similar to SISO, controller serves as “process inverse”
( ) ( )syGsu p1−=
Steady-state Implications
⎥⎦
⎤⎢⎣
⎡−
=1111
1pK
212
211
1111
uuyuuy
+−=+=
System 1
Which system will be more difficult to control?
System 2
212
211
1111
uuyuuy
+=+=
⎥⎦
⎤⎢⎣
⎡=
1111
2pK
yKu p1−=
Steady-state Implications
⎥⎦
⎤⎢⎣
⎡−
=1111
1pK
212
211
1111
uuyuuy
+−=+=
System 1
Inverse does not exist (Gain Matrix is singular, rank = 1)Cannot independently control both outputs
System 2
212
211
1111
uuyuuy
+=+=
⎥⎦
⎤⎢⎣
⎡=
1111
2pK
yKu p1−=
Another Example
212
211
1195.01
uuyuuy
+=+=
⎥⎦
⎤⎢⎣
⎡=
1195.01
3pK
Inverse exists – No longer singular (“gut feeling” that there may still be a problem…)
Directional Sensitivity:Singular Value Decomposition (SVD)
G = UΣVT
T
VUG44 344 2144 344 2144 344 2143421
⎥⎦
⎤⎢⎣
⎡−
−−⎥⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡−
−−=⎥
⎦
⎤⎢⎣
⎡
Σ
72.070.070.072.0
0253.00098.1
70.072.072.070.0
1195.01
Gain matrix Left singular Vector matrix
Right singular Vector matrix
Matrix of singularvalues
Example
Strongest input direction
Strongest output direction
Max singular value
Example, cont’d
T
VUG44 344 2144 344 2144 344 2143421
⎥⎦
⎤⎢⎣
⎡−
−−⎥⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡−
−−=⎥
⎦
⎤⎢⎣
⎡
Σ
72.070.070.072.0
0253.00098.1
70.072.072.070.0
1195.01
⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡41.138.1
70.072.0
1195.01
2
1
yy
⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡70.072.0
2
1
uu
⎥⎦
⎤⎢⎣
⎡−=⎥
⎦
⎤⎢⎣
⎡72.070.0
2
1
uu
⎥⎦
⎤⎢⎣
⎡−=⎥
⎦
⎤⎢⎣
⎡−⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡018.0018.0
72.070.0
1195.01
2
1
yy
Input in Strongest Direction Output in Strongest Direction
Input in Weakest Direction Output in Weakest Direction
Same magnitude input = very different magnitude output
y = Kp u
Example, cont’d
T
VUG44 344 2144 344 2144 344 2143421
⎥⎦
⎤⎢⎣
⎡−
−−⎥⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡−
−−=⎥
⎦
⎤⎢⎣
⎡
Σ
72.070.070.072.0
0253.00098.1
70.072.072.070.0
1195.01
High condition number indicates problems
Condition number = σ1/σ2 = 1.98/0.0253 = 78
Note: For SVD analysis it is important to properly scale the inputs and outputs
MV Dynamic Properties: Quadruple Tank
G1 s( ) =
2.662s + 1
1.523s +1( ) 62s +1( )
1.430s +1( ) 90s +1( )
2.890s +1( )
⎡
⎣
⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥
G2 s( ) =
1.563s +1
2.539s +1( ) 63s +1( )
2.556s +1( ) 91s +1( )
1.691s +1( )
⎡
⎣
⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥
z = −0.057 and + 0.013 sec-1
z = −0.060 and − 0.018 sec-1
Operating Point 1 – Minimum Phase
Operating Point 2 – Nonminimum Phase (RHPT zero)
Matrix inverse is unstable
“Transmission zeros” are bothnegative
Multivariable Systems
Can have right-half-plane “transmission zeros” even when no individual transfer function has a RHP zero
Can have individual RHP zeros yet not have a RHPT zero Fine performance when constraints are not activeMay fail when one constraint becomes active or a loop is “opened”
Can exhibit “directional sensitivity” – with some setpointdirections much easier to achieve than others
Some of these MV properties cause challenges independent of control strategy selected
Summary
Nonlinear ModelSolve for steady-state, then linearize (Taylor series expansion)
State Space (linear) ModelDeviation variable form (perturbations from steady-state)
DynamicsEigenvalues of A matrix = poles of transfer function matrix
Pole-zero cancellation may reduce number of polesRight-half-plane zeros = inverse responseMV: Transmission Zeros
Long term behavior from steady-state gainSingular Value Decomposition (SVD)
Chemical and Biological Engineering
Discrete Linear Models
B. Wayne Bequette
• Sampling Rules/Assumptions• Continuous to Discrete• Z-transform• Dynamic Properties of Discrete Systems
Discrete Models
Input held constant between sample times (zero-order hold)
Sample time is constant
Rule of thumb for discrete control – select sample time roughly 1/10 of dominant time constant
Discrete Models
kkk
kkk
DuCxyuxx
+=Γ+Φ=+1 State Space
Input-Output(ARX)mkmkkk
nknkkk
ububububyayayay
−−−
−−−
+++++−−−−=
L
L
22110
2211
( ) [ ]kyZzy = Z-transform
[ ] ( )zyzyZ k1
1−
− = Backwards shift operator
( ) ( )( ) ( )zuzbzbzbb
zyzazazam
mm
m
nn
nn
−+−−
−
−+−−
−
++++
=++++1
11
10
11
11
...
...1Solve for y(z)
usually b0 = 0
Some texts/papers have different sign conventions
Discrete Models
DiscreteTransfer Function
Multiply by
( ) ( )zuzazazazbzbzbbzy n
nn
n
mm
mm
−+−−
−
−+−−
−
++++++++
= 11
11
11
110
...1
...
gp z( ) =b0 + b1z
−1 + ... + bm −1z− m +1 + bmz− m
1 + a1z−1 + ... + an−1z
− n+1 + anz− n
gp z( ) =b0z
n + b1zn−1 + ... + bmzn− m
zn + a1z−1 + ... + an −1z
−n+1 + an
n
n
zz
zeros = roots of numerator polynomialpoles = roots of denominator polynomial
( ) ( )( ) ( )( )( ) ( )n
mpzp pzpzpz
zzzzzzKzg−−−−−−
⋅=L
L
21
21
Stability
DiscreteContinuous
StableStable
poles in LHP are stable poles inside unit circle are stable
Example
y k( ) = −a1y k − 1( )+ b1u k − 1( ) gp z( ) =b1z
−1
1 + a1z−1 =
b1
z + a1
p = −a1
a1 = 0.5,−0.5,1.5,−1.5 p = −0.5,0.5,−1.5,1.5
Monotonic, unstable
Oscillatory, unstable
Monotonic, stable
Oscillatory, stable
Characteristic behavior
5.06255.06250.06250.0625y(4)
3.375-3.3750.125-0.125y(3)
2.252.250.250.25y(2)
1.5-1.50.5-0.5y(1)
1.5-1.50.5-0.5p
-1.51.5-0.50.5a1
Let y(0) = 1, u(k) = 0
Value of the pole
Simple Example: Results
Poles inside circlestable
Poles outside circleunstable
Negative polesoscillate
First-order discrete systems can oscillateThis cannot happen with continuous systems
Discrete zerosZeros outside unit circle
Inverse is unstable (not necessarily inverse response)
Any continuous system with relative order >2 will have an unstable inverse with a small enough sample time
Astrom, KJ, P Hagander & J Sternby “Zeros of Sampled Systems,”Proceedings of the 1984 American Control Conference, 1077-1081
gp s( )=1
s +1( )3 ( ) ( )( )( )33679.0
1238.07990.10803.0−
++=
zzzzg p
Sample time = 1
poles = 0.3679 (multiplicity 3)zeros = -1.7990 & -0.1238
Unstable inverse
Relative order = 1Relative order = 3
poles = -1 (multiplicity 3)
Final & Initial Value Theorems
limn→ ∞
y nΔt( ) = limz→1
1 − z −1( )y z( )
y z( ) = gp z( )u z( ) = gp z( )⋅1
1− z−1
limt→ ∞
y t( )= limz →1
1 − z −1( )y z( ) = limz →1
1 − z −1( )gp z( ) 11− z−1 = lim
z →1 gp z( )
limt → 0
y t( ) = limz →∞
1 − z −1( )y z( )Initial value theorem
Final value theorem
Long-term step response
unit step
So, simply set z = 1 in gp(z) for long-term unit step response
“hidden slide” provided for additional background
Final Value Theorems
( )( )31
1+
=s
sg p
( ) ( )( )( )33679.0
1238.07990.10803.0−
++=
zzzzg p
( ) ( )( )( )
12525.02525.0
3679.011238.017990.110803.01 3 ==
−++
=→zg p
( )( )
110
10 3 =+
=→sg p
Long-term outputs for unit step inputs
continuous
discrete
“hidden slide” provided for additional background
State Space Models
DuCxyBuAxx
+=+=&
kkk
kkk
DuCxyuxx
+=Γ+Φ=+1
Continuous
?
Discrete
Finite differences approximation for derivative
( )( ) ( )
[ ] kkk
kkkk
kk
tuBxtAIx
BuAxt
xxt
xxt
tkxtkxx
Δ+Δ+=
+≈Δ−
Δ−
=Δ
Δ−Δ+≈
+
+
+
1
1
11&
Φ Γ How good are the approximations?
Exact Discretization
( ) ( ) ( )
( ) ktA
ktA
k
tt
t kAtA
ktA
k
BuAIexex
tBudeetxettx k
k
11
−ΔΔ+
Δ+ −ΔΔ
−+=
+=Δ+ ∫ σσ
( ) BAIee
tA
tA
1−Δ
Δ
−=Γ
=Φ
[ ]tB
tAIΔ=Γ
Δ+=Φ
Exact
Approximate
Example Discretization
( ) ⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡−
−−Φ=Γ
⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡−
−==Φ
−
Δ
0157.02592.0
01.0
04.004.001.0
8869.00974.007408.0
12.012.003.0
exp
1
I
e tA
⎥⎦
⎤⎢⎣
⎡=Γ
⎥⎦
⎤⎢⎣
⎡=⎥
⎦
⎤⎢⎣
⎡−
−+⎥
⎦
⎤⎢⎣
⎡=Φ
03.0
88.012.007.0
12.012.003.0
1001
Exact
Approximate
[ ] ⎥⎦
⎤⎢⎣
⎡=
⎥⎦
⎤⎢⎣
⎡+⎥
⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡−
−=⎥
⎦
⎤⎢⎣
⎡
2
1
2
1
2
1
10
01.0
04.004.001.0
xx
y
uxx
xx&
&
( ) ( )( )1251101
++=
sssg p
3=Δt
Example, Continued
Exact
Approximate
( ) ( ) DzICzg p +ΓΦ−= −1
( ) 21
21
2 65702.06277.110136.00157.0
65702.06277.10136.00157.0
−−
−−
+−+
=+−
+=
zzzz
zzzzg p
( ) 21
2
2 616.058.11036.0
616.058.1036.0
−−
−
+−=
+−=
zzz
zzzg p
Poles/eigenvalues = 0.7408 & 0.8869
Poles/eigenvalues = 0.7 & 0.88
Discrete Transfer Function
“hidden slide” provided for additional background
-2 0 2 4 6 8
0
0.5
1
1.5
2
temp, deg C
discrete-time step
-2 0 2 4 6 8
0
0.2
0.4
0.6
0.8
1
discrete-time step
psig
s 1
ss
s
s
2
4 53
Etc.
S = s1 s2 s3 s4 s5 L sN[ ]T
Example Step Response Model
Step Response Model
∞−∞+−−+−−
∞
=−
Δ++Δ+Δ++Δ=
Δ= ∑kNNkNNkNk
iikik
usususus
usy
LL 1111
1
( )
.
,
1
1
1111
1111
∑−
=−−
∞−−+−−−
∞−−+−−−
Δ+=
Δ++Δ+Δ++Δ=Δ++Δ+Δ++Δ=
−
N
iikiNkNk
u
kNkNNkNk
kNNkNNkNkk
ususy
uusususususususy
Nk
444 3444 21LL
LL
-2 0 2 4 6 8 10
0
0.2
0.4
0.6
0.8
1
discrete-time step
psig
-2 0 2 4 6 8 10-0.2
0
0.2
0.4
0.6
0.8
1
discrete-time step
temp, deg Ch
hh
1 2
3
hi = si − si −1
si = hjj=1
i
∑
Example Impulse Response Model
Impulse and step responsecoefficients are related
Parameter Estimation, ARX Models
22112211
021102112
120112011
ˆ
ˆˆ
−−−−
−−
++−−=
++−−=++−−=
NNNNN ububyayay
ububyayayububyayay
M
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡−−
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
=
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
−−−−
−−
2
1
2
1
2121
10101
....
....
ˆ..ˆ
bbaa
uuyy
uuyy
y
y
NNNNN
ΘΦ= Y
model output measured output known (measured) input
time step index
Npts
could changesign on columns1 & 2 of Φ
Optimization/Parameter Solution
yi − ˆ y i( )2
i =1
N
∑ = Y − ˆ Y ( )TY − ˆ Y ( )= Y − ΦΘ( )T Y − ΦΘ( )
( )∑=
−N
iiibbaa
yy1
2
,,,ˆmin
2121
Θ = ΦTΦ( )−1ΦTY
Objective Function
Solution
parameterestimatevector
measuredoutputvector
Example
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5-0.2
0
0.2
0.4
0.6
time, min
y
PRBS estimation example
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-1
-0.5
0
0.5
1
time, min
u
PRBSinput
Result
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
−
−
−−
−
=
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
−−−−−
−−−−
−−−
−−−−
−−−
−−−−−
−−
−−
−
=Φ
0502.01134.01162.01513.00172.03846.05007.02003.00463.01123.01879.00485.01558.02171.03446.01771.04618.01564.00137.0
111162.01134.0111513.01162.0110172.01513.0113846.00172.0115007.03846.0112003.05007.0110463.02003.0111123.00463.0111879.01123.0110485.01879.0111558.00485.0112171.01558.0113446.02171.0111771.03446.0114618.01771.0111564.04618.0110137.01564.0110889.00137.01100889.0
Y
Θ = ΦTΦ( )−1ΦTY
Θ =
1.1196−0.3133−0.0889
0.2021
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥
=
−a1
−a2
b1
b2
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥
( )
( )( )( )5481.05716.0
274.20889.0
3133.01196.112021.00889.0
3133.01196.12021.00889.0
21
21
221
221
−−−−
=
+−+−
=
+−+−
=++
+=
−−
−−
zzz
zzzz
zzz
azazbzbzg p
Identified Model
( )
( ) ( )
3133.01196.112021.00889.0
3133.01196.12021.00889.0
21
21
221
221
zuzzzzzy
zzz
azazbzbzg p
⋅+−+−
=
+−+−
=++
+=
−−
−−
2021.00889.03133.01196.1 2121 −−−− +−−= kkkkk uuyyy
Subspace Identification
Subspace ID can be used to develop discrete state space models from input-output data
SummaryDiscrete models
State space, ARX, discrete transfer function
Zeros & polesPoles inside unit circle are stable (negative = oscillate)Zeros inside unit circle have stable inverses
Parameter estimationExample with PRBS input
Step and impulse response models
Chemical and Biological Engineering
Discrete (Digital) Control
B. Wayne Bequette
• Review of Digital Control Techniques• Discrete Internal Model Control• Examples• Summary
Manfred Morari
Digital Feedback Control
r(z) e(z) u(z)gc(z) gp(z)
d(z)
y(z)+
++
_
Digital Controller DesignResponse specification-based
( ) ( ) ( )( ) ( ) ( )
( ) ( ) ( )zrzgzy
zrzgzg
zgzgzy
CL
cp
cp
1
=
⋅+
=
Desired response
Controller Design
( ) ( ) ( )( ) ( )
( ) ( )( )
( )zgzg
zgzg
zgzgzgzg
zg
CL
CL
pc
cp
cpCL
−⋅=
+=
11
1Desired responsesolve forcontroller
Internal Model Form
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
For controller design, consider perfect model and no disturbances
IMC Design
r(z) u(z)q(z) gp(z)
y(z)
( ) ( ) ( ) ( )( ) ( ) ( )zrzgzy
zrzqzgzy
CL
p
=
=
Desired response ( ) ( )( )zg
zgzqp
CL=
solve forcontroller
Really based on the model
( ) ( )( ) ( ) ( )zgzgzgzgzq pCL
p
CL 1~~
−==
Can implement IMC in Classic Feedback Form
( ) ( )( ) ( )zgzq
zqzgp
c ~1−=
Digital Controller Design
Deadbeat
Dahlin’s Controller
State Deadbeat
State Deadbeat with Filter (Vogel-Edgar)
Modified Dahlin’s Controller
NEW (IMC) DESIGN
John Ragazzini
Deadbeat
Achieve setpoint in the minimum time (if no time-delay, then one time step)
kk ry =+1
( ) ( )zrzzy 1−=Backwards shift operator
( ) ( )zgzzq p11~−−=
( ) 1−= zzgCL
IMC Form
( ) ( ) 1
11
1~
−
−−
−⋅=
zzzgzg pc Classic Feedback Form
Example 0, FO Process
( )110
1~+
=s
sg p ( ) 1
1
9048.010952.0~
−
−
−=
zzzg pΔt = 1
( ) ( )00952.0
9048.00952.0
9048.011
11
+−
=−
= −
−−
zz
zzzzq
( ) ( ) ( )
( )
( ) ( )( ) 1
1
1
1
1
11
21
1
1504.9
1504.10
1504.9504.10
10952.09048.0
stepunit 1
1
−
−
−
−
−
−−
−−
−
−−
+−
=
−−
=−
−=
=−
=
=
zz
zzu
zz
zzzzzu
zzrlet
zrzqzu
Large control action up,then down
Control action
setpoint change
Classic Feedback Form for Deadbeat Design
( )
( )
( )
1
1
1
1
1
11
1
1
19048.015.10
19048.01
0952.01
19048.0
0952.01
11
0952.09048.0
0952.09048.0
0952.09048.01~
9048.00952.0
9048.010952.0~
−
−
−
−
−
−−
−
−
−−
⋅=−
−⋅⎟
⎠⎞
⎜⎝⎛=
−−
⋅⎟⎠⎞
⎜⎝⎛=
−⋅
−=
−=
−=
−=
−=
zz
zz
zz
zzzg
zz
zzg
zzzzg
c
p
p
( ) ( ) ( )1
1~1
~ 11
11
−⋅=
−⋅= −
−
−−
zzg
zzzgzg ppc
Classic Feedback Implementation
( )
( ) ( ) ( )
( ) ( ) ( ) ( )
( )
( )11
11
11
1
1
9048.05.10
9048.05.10
9048.015.101
19048.015.10
−−
−−
−−
−
−
−⋅+=
−⋅=−
−⋅=−
=
−−
⋅=
kkkk
kkkk
c
c
eeuu
eeuu
zezzuz
zezgzu
zzzg
IMC Implementation
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
( ) ( ) ( )( ) ( ) ( )( ) ( ) ( )( ) ( ) ( )zrzqzu
zdzrzr
zyzyzd
zuzgzy p
~
~~
~~~~
=−=
−=
=( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )
( )1
1
111
11
11
~9048.0~0952.01
~9048.010952.01
~9048.010952.0
~~
~~0952.0~9048.0~
0952.0~9048.01
−
−
−−−
−−
−−
−⎟⎠⎞
⎜⎝⎛=
−⎟⎠⎞
⎜⎝⎛=
−=
−=
−=
+==−
kkk
kkk
kkk
kkk
rru
zrzzu
zrzzzuz
drr
yyd
uyyzuzzyz
Discussion
( )1
11
~9048.0~0952.01
~~
~~0952.0~9048.0~
−
−−
−⎟⎠⎞
⎜⎝⎛=
−=
−=
+=
kkk
kkk
kkk
kkk
rru
drr
yyd
uyy
( )11 9048.05.10 −− −⋅+=−=
kkkk
kkk
eeuuyre
Standard feedback control clearly has the current control actionas a function of the previous control action. Why doesn’t IMC?
Standard Feedback
IMC
Example 0 (First-order), Deadbeat Design
-2 0 2 4 6 8
0
0.5
1
time
y
deadbeat, FO example
-2 0 2 4 6 8
0
5
10
time
u
Example 1, Second-Order Process
( ) ( )( )1251101~
++=
sssg p ( ) 21
21
65702.06277.110136.00157.0~
−−
−−
+−+
=zz
zzzg pΔt = 3
( )00136.00157.0
65702.06277.10136.00157.0
65702.06277.12
2
21
321
+++−
=+
+−= −−
−−−
zzzz
zzzzzzq
“ringing” behavior as shown next
zero = -0.0136/0.0157 = -0.8694
controller has pole = -0.8694, which is stable, but oscillates
Example 1 (Second-order): Deadbeat Design
-5 0 5 10 15 20 25 30
0
0.5
1
1.5
time
ydeadbeat, SO example
-5 0 5 10 15 20 25 30-100
-50
0
50
100
time
u
Perfect control, at sample times
“ringing” behavior (intersample)
Dahlin’s Controller
Desired first-order + time-delay response to setpointchange
( ) ( )( )
( ) ( ) ( )( ) ( )zgz
zgzz
zgzgzq pp
p
CL 111
1~1~
11
~−−
−
−
⋅−−
=⋅−−
==αα
αα
( ) ( )1
1
11
−
−
−−
=zzzgCL α
αwhere α = exp(-Δt/λ)For no time-delay:
( ) ( )
( )( ) 0136.00157.0
65702.06277.11
0136.00157.065702.06277.11
11
2
21
21
1
1
++−
⋅−−
=
++−
⋅−−
= −−
−−
−
−
zzz
z
zzzz
zzzq
αααα
For the second-order example:
Second-order Process: Dahlin’s Controller
Still “ringing”, but more damped than deadbeat
For λ = 3, α= 0.3679
-5 0 5 10 15 20 25 30
0
0.5
1
1.5
time
y
Dahlin, SO example
-5 0 5 10 15 20 25 30-100
-50
0
50
100
time
u
First-order response, at sample times
Dahlin’s Modified Controller
Substitute zeros at origin for unstable (|zero|>1) or ringing (|zero|<1 but negative) zeros. Also, keep the gain the same
Problem: Dahlin applied this to gc(z), but should have applied it to the IMC form, q(z)!
“hidden slide” provided for additional background
State Deadbeat Controller Design
Brings outputs & inputs to new steady-state in the minimum number of time stepsDoes not invert zeros at all
( )000293.0
65702.06277.10293.0
65702.06277.11~2
2211
+++−
=+−
==−−
−− zz
zzzzgzq p
( )
0136.00157.00136.00157.0
65702.06277.110136.00157.0
65702.06277.110136.00157.0~
21
21
21
21
++
⋅+−+
=
+−+
=
−−
−−
−−
−−
zzzz
zzzzzg p
( )zg p−~ ( )zg p+
~
second-order example
Second-order Example: State Deadbeat Design
-5 0 5 10 15 20 25 30
0
0.5
1
1.5
time
y
State Deadbeat, SO example
-5 0 5 10 15 20 25 30-100
-50
0
50
100
time
u
Controller Forms
( ) ( ) ( ) ( )( ) ( )( ) ( )n
nkkpzp pzpz
azazazazKzGzg
−−
−−−−==
+−
++
−−
L
LL
1
111~
Zafiriou & Morari notation Assumes stable poles
+ia−
iazero inside unit circle = = zero outside unit circle
( ) ( ) ( )( ) ( ) n
kpz
nSD zaaK
pzpzzq −− −−−−
=11 1
1
L
L
( ) ( ) ( ) ( )( ) ( )
( )1
1
1
1
11
11 −
−
−− −−
⋅−−−−
==zz
zaaKpzpzzFqzq n
kpz
nSDVE α
αL
L
State Deadbeat:
State Deadbeat with Filter (Vogel-Edgar):
Notice that neither the state deadbeat nor Vogel-Edgar controllers try to invert zeros (even good ones!)
IMC Design SummaryModel Factorization (“good stuff” and “bad stuff”)
( ) ( ) ( )zgzgzg ppp +−= ~~~
• zeros outside unit circle• zeros inside unit circle that are negative• “all-pass” by including pole at 1/zi for each positive zi outside the unit circle (but not the negative ones)
• numerator one order less than denominator
( ) ( ) ( )zFzgzq p1~−−=
Controller: Invert “good stuff” part of model
• “Filter” for desired response, often first-order
Example 2: Third-Order (3-tank)
( )( )31
1~+
=s
sg p ( ) ( )( )( )33679.0
1238.07990.10803.0~−
++=
zzzzg p
( ) ( )( )( )
( )( )( )( ) 23
2
1238.17990.21238.07990.1
3679.01238.17990.20803.0~
zzz
zzzg p
++⋅
−=
( ) ( ) ( )zgzgzg ppp +−= ~ ~ ~
Sample time = 1
( ) ( ) ( ) ( ) ( )
( ) ( )αααα
−−
⋅−
=
−−
⋅−
== −
−−
−
zzz
zz
zzzFzgzq p
12526.0
3679.0
11
2526.03679.0~
2
3
1
1
2
31
Note gain is 1 (value at z = 1)
where α = exp(-Δt/λ)
zeros at -1.7990 (outside unit circle)-0.1238 (inside, but negative)
Example 2 (Third-Order) IMC Design
-2 0 2 4 6 8 10
0
0.5
1
1.5
time
y
Discrete IMC, TO example
-2 0 2 4 6 8 10-1
0
1
2
3
4
5
time
u
For λ = 1, α= 0.135
Third-Order, Inverse Response (Ex. 3, Z&M, 1985)
( ) ( )( )( )( )5.221
5.1333.3~+++
+−=
sssssg p ( ) ( )( )
( )( )( )779.0819.0905.0792.0162.101316.0~
−−−+−−
=zzzzzzg p
( )( )( )( )
( )( )( )
( )( )
( )( )792.1162.0162.11
162.111792.0162.1
779.0819.0905.0162.111
162.11792.1162.001316.0
~
−⎟⎠⎞
⎜⎝⎛ −
⎟⎠⎞
⎜⎝⎛ −+−
⋅−−−⎟
⎠⎞
⎜⎝⎛ −
⎟⎠⎞
⎜⎝⎛ −−−
=zz
zz
zzz
zzzg p
Δt = 0.1
( ) ( ) ( ) ( )( )( )( )
( )αα
−−
⋅−
−−−== −
− zzzzzzzFzgzq p
18606.002741.0
779.0819.0905.0~ 1
where α = exp(-Δt/λ)
zeros at 1.162 (outside unit circle)-0.792 (inside, but negative)
( ) ( )( )( )( )779.0819.0905.0
8606.002741.0~−−−
−=− zzz
zzzg p
Response (Ex. 3, Z&M ’85)
-1 0 1 2 3 4 5-1
-0.5
0
0.5
1
1.5
time
y
Discrete IMC, RHPZ - Example 3 Z&M
-1 0 1 2 3 4 5-2
0
2
4
6
8
10
time
u
For λ = 0.5, α= 0.8187
“Real-World” Discussion
Have assumed a “perfect model” for these simulations. In practice, the real-world “plant” is not perfectly modeled (indeed, there are usually nonlinearities involved).
Can approximate real-world challenges by having the “plant” be different than the model used for controller design. Also, it is important to incorporate constraints and noise in the simulations.
Summary
Digital Control TechniquesDeadbeatDahlin’sState Deadbeat, State Deadbeat w/filter (Vogel-Edgar)Modified Dahlin’s (mis-developed by Dahlin!)
Internal Model ControlFactorization of zeros outside unit circle and negative zeros inside the circleForm “all-pass”(reflection of positive zeros outside the unit circle)Invert “good stuff” and use first-order filter