13 - Digital Controller Design
13 - Digital Controller Design
Roy Smith
2018-5-22 13.1
Sampled-data closed-loop
y(k) r(k)
G(s) ZOH Kd (z) +
T
−
2018-5-22 13.2
Zero-order hold equivalence — transfer function
| {z }
GZOH (z)
(
1 k = 0,
Input: u(k) = , u(t) = step(t) − step(t − T ).
0 k 6= 0
G(s)
Output: y(s) = 1 − e−T s .
s
2018-5-22 13.3
| {z }
GZOH (z)
Z T
AT Aη
A B ZOH-equivalence e e B dη
0
C D =⇒
C D
2018-5-22 13.4
Zero-order hold equivalence — frequency domain
(2 − s)
Example: G(s) = , T = 0.6
(2s + 1)(s + 2)
0.1 1 π/T 10
log ω
1 (rad/sec)
GZOH (ejω )
0.1
G(jω)
G(jω)e−jωT /2
Magnitude
0.01
1 π/T 10
log ω
0 (rad/sec)
−90
G(jω)
−180
GZOH (ejω )
2018-5-22 13.5
Sampled-data closed-loop
K(s) approximation
≈ K(s)
y(k) r(k)
G(s) ZOH Kd (z) +
T
−
2018-5-22 13.6
Design approaches
Continuous-time
design
G(s) K(s)
ZOH-equivalence Approximation
of G(s) and of K(s) with
sample/hold Kd (z)
2018-5-22 13.7
Design approaches
Continuous-time
design
G(s) K(s)
Sampled-data
design
ZOH-equivalence Approximation
of G(s) and of K(s) with
sample/hold Kd (z)
2018-5-22 13.8
Design by approximation
2. Select a sample-rate, T
2018-5-22 13.9
Controller approximation
1
I F (z)
s
sx(s) x(s) zx(z) x(z)
A B A B
y(s) u(s) y(z) u(z)
C D C D
2018-5-22 13.10
Integration
x(t)
y(t) x(t)
1/s
x(kT +T )
Z t
y(t) = y(0) + x(τ ) dτ,
0
x(kT )
y(kT +T ) − y(kT )
Time
[sec.]
kT kT +T
2018-5-22 13.11
Trapezoidal approximation
ŷ(kT + T ) = ŷ(kT ) + T x(kT ) + (x(kT + T ) − x(kT ))T /2.
Taking z-transforms,
T
z ŷ(z) = ŷ(z) + T x(z) + (z − 1)x(z),
2
Approximation: x(t)
ŷ(z) T z+1
= F (z) = . x(kT +T )
x(z) 2 z−1
So the substitution is,
2 z−1 x(kT )
s ←− .
T z+1
ŷ(kT +T ) − ŷ(kT )
Time
[sec.]
kT kT +T
2018-5-22 13.12
Frequency mapping
Pole locations under bilinear transform:
bilinear
{ s | real(s) < 0 } { z | |z| < 1 }
−→
imag imag
2π/T 1
2 (z−1)
s= T (z+1)
π/T
−→ real
real
−1 1
−π/T
−1
−2π/T
2018-5-22 13.13
Frequency mapping:
Frequency distortion:
2
Ω= tan−1 (ωT /2)
T
2018-5-22 13.14
Bilinear frequency distortion
2
Ω= tan−1 (ωT /2)
T
Discrete frequency
Ω [rad/sample]
π
Bilinear distortion
Continuous frequency
ω [rad/sec]
−π
Ω = ωT
Prewarping
α(z − 1)
s= , α ∈ (0, π/T ), maps {real{s} < 0} to {|z| < 1}.
(z + 1)
α(ejωpw T − 1)
jω0 = = jα tan(ωpw T /2),
(ejωpw T + 1)
ωpw
which implies that: α= .
tan(ωpw T /2)
2018-5-22 13.16
Prewarping
2
Frequency distortion (bilinear:) Ω = tan−1 (ωT /2).
T
2
Frequency distortion (with prewarping): Ω = tan−1 (ω/α)
T
Discrete frequency
Ω [rad/sample]
π Prewarping distortion
Bilinear distortion
Continuous frequency
ωpw ω [rad/sec]
−π
Ω = ωT
2018-5-22 13.17
Controller approximations
Bilinear approximation: Kbl (ejω ), Prewarped Tustin approximation: Kpw (ejω )
10 Magnitude
Kbl (ejω )
10 ωpw K(jω)
1 log ω (rad/sec)
Kpw (ejω )
0.1
0.01
90
Kbl (ejω )
10
0 log ω (rad/sec)
ωpw
Kpw (ejω )
−90 K(jω)
Phase (deg.)
−180
2018-5-22 13.18
Choosing a prewarping frequency
The prewarping frequency must be in the range: 0 < ωpw < π/T .
I α = 2/T (standard bilinear) corresponds to ωpw = 0.
The best choice depends on the most important features in your control design.
2018-5-22 13.19
Example
Plant model:
IMC desgn
Tideal (s) = 3rd order Butterworth filter with bandwidth: 25 [rad./sec.]
2018-5-22 13.20
Loopshapes
100 Magnitude
L(jω)
10
K(jω)
G(jω) 1 10 100
1 log ω (rad/sec)
0.1
0.01
0.001
90
1 10 100
0 log ω (rad/sec)
K(jω)
−90
L(jω)
G(jω)
−180
Phase (deg.)
−270
2018-5-22 13.21
Magnitude
10
2
S(jω)
10 100
1 log ω (rad/sec)
T (jω)
0.1
2018-5-22 13.22
Step response
Output
Amplitude
1.4
1.2
1.0
0.8
0.6
0.4 y(t)
0.2
0 time (sec)
0.5 1.0 1.5 2.0
−0.2
2018-5-22 13.23
Step response
Actuation
Amplitude
1.4
1.2
u(t)
1.0
0.8
0.6
0.4
0.2
0 time (sec)
0.5 1.0 1.5 2.0
−0.2
2018-5-22 13.24
Bilinear/Trapezoidal/Tustin transform
Bilinear transform
π
Nyquist frequency: 100 radians/second =⇒ T = .
100
Kbl (z) = K(s) 2 z−1
s= T z+1
Discrete-time analysis
GZOH (z)
y(k) r(k)
G(s) ZOH Kd (z) +
T
−
2018-5-22 13.25
10
1 10 100
1 log ω (rad/sec)
Kd (ejω )
G(jω)
0.1
GZOH (ejω )
0.01 Ld (ejω )
K(jω)
0.001 L(jω)
90
1 10 100
0 log ω (rad/sec)
−90
G(jω)
−180
GZOH (ejω ) K(jω)
Phase (deg.)
−270 Ld (ejω ) Kd (ejω )
L(jω)
2018-5-22 13.26
Sensitivity and complementary sensitivity: bilinearly transformed controller
Magnitude
10
2
S(jω)
1 log ω (rad/sec)
10 100
Sd (ejω )
Td (ejω )
T (jω)
0.1
2018-5-22 13.27
Amplitude
1.4
y(k)
1.2
1.0
0.8
0.6 y(t)
0.4
0.2
0 time (sec)
0.5 1.0 1.5 2.0
−0.2
2018-5-22 13.28
Step response: bilinearly transformed controller
Actuation
Amplitude
1.4
1.2
u(t)
1.0
0.8
u(k)
0.6
0.4
0.2
0 time (sec)
0.5 1.0 1.5 2.0
−0.2
2018-5-22 13.29
π
Nyquist frequency: 100 radians/second =⇒ T = .
100
Select the prewarping frequency at ωpw = ωm (20 radians/sec.).
Kpw (z) = K(s) z−1
s=α z+1
where,
ωpw
α= .
tan(ωpw T /2)
2018-5-22 13.30
Loopshapes: prewarped Tustin controller
100 Magnitude
10
1 10 100
1 log ω (rad/sec)
Kd (ejω )
G(jω)
0.1
GZOH (ejω )
0.01 Ld (ejω )
K(jω)
0.001 L(jω)
90
1 10 100
0 log ω (rad/sec)
−90
G(jω)
−180
GZOH (ejω ) K(jω)
Phase (deg.)
−270 Ld (ejω ) Kd (ejω )
L(jω)
2018-5-22 13.31
Magnitude
10
2
S(jω)
1 log ω (rad/sec)
10 Sd (ejω ) 100
Td (ejω )
T (jω)
0.1
2018-5-22 13.32
Step response: prewarped Tustin controller
Output
Amplitude
1.4
y(k)
1.2
1.0
0.8
0.6 y(t)
0.4
0.2
0 time (sec)
0.5 1.0 1.5 2.0
−0.2
2018-5-22 13.33
Actuation
Amplitude
1.4
1.2
u(t)
1.0
0.8
u(k)
0.6
0.4
0.2
0 time (sec)
0.5 1.0 1.5 2.0
−0.2
2018-5-22 13.34
Sample rate selection
Main considerations
I Sampling/ZOH will (approximately) introduce a delay of T /2 seconds.
I Anti-aliasing filters will need to be designed and these will also introduce
phase lag.
I Very fast sampling makes all of the poles appear close to 1. The controller
design can become numerically sensitive.
2018-5-22 13.35
Sampled-data implementation
d(t)
Gd (s)
r(k)
y(t) u(t) u(k)
+ G(s) ZOH Kd (z)
Continuous-time design
d(t)
Gd (s)
r(t)
y(t) u(t)
+ G(s) e−sT /2 K(s)
2018-5-22 13.36
Sensitivity function
Magnitude
5
Ŝd1 (jω)
1 10
log ω
1 (rad/sec)
π/T1
ωB
S(jω)
0.1
0.01
2018-5-22 13.37
Sensitivity function
Magnitude
5
Ŝd1 (jω)
10 20
ω
1 (rad/sec)
π/T1
ωB
S(jω)
0.1
0.01
2018-5-22 13.38
Loop-shaping interpretation
For ω up to where |Fa (jω)G(jω)K(jω)| < and remains very small,
we want Fa (jω)G(jω)K(jω)e−jωT1 /2 ≈ Gd ejωT1 Kd ejωT1 .
(Gd (z) is the ZOH-equivalent of Fa (s)G(s))
imag
|S(jω)| > 1
−1 1 real
−j
L̂d1 (jω) L(jω)
2018-5-22 13.39
Magnitude
5
Sd1 (jω) Ŝd1 (jω)
1 10
log ω
1 (rad/sec)
π/T1
ωB
S(jω)
0.1
0.01
2018-5-22 13.40
Discrete-time loopshape: Ld1 (s) = Gd (s)Kd (s), T1 = 0.15 seconds
imag
|S(jω)| > 1
−1 1 real
Ld1 (jω)
−j
L̂d1 (jω) L(jω)
2018-5-22 13.41
Magnitude
50
Ŝd2 (jω)
10
Sd2 (jω)
S(jω)
1 10
log ω
1 (rad/sec)
π/T2
ωB
0.1
0.01
2018-5-22 13.42
Choosing a slower sample rate.
Choosing T2 = 0.5 seconds =⇒ π/T2 = 6.28 rad./sec.
imag
L̂d2 (jω)
−1 1 real
Ld2 (jω)
−j
L(jω)
2018-5-22 13.43
Fast sampling
2018-5-22 13.44