You are on page 1of 47

ECE4540/5540: Digital Control Systems 2–1

EMULATION OF ANALOG CONTROLLERS

2.1: Control design via time-domain emulation


■ There are two main approaches to digital controller design:

1. Emulation—we look at this now (two methods).


2. Direct digital design—subject of the rest of the course.
■ Emulation is when a digital computer approximates an analog
controller design.
■ Analog:
e(t) u(t)
r (t) D(s) G(s) y(t)

■ Digital:
w(t)
A2D D2A
e(t) e[k] u[k] zoh
u(t)
r (t) Q D(z) G(s) y(t)

v(t)

■ Analog controller computes u(t) from e(t) using differential equations.


■ Digital controller computes u(kT ) from e(kT ) using difference
equations.
■ To interface the computer controller to the “real world” we need an
analog-to-digital converter (to measure analog signals) and
digital-to-analog converter (to output signals).
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–2
■ Sampling and outputting usually done synchronously, at a constant
(system
rate. If sampling period = T, frequency = 1/T .
■ The signals inside the computer (the sampled signals) are noted as
y(kT ), or simply y [k]. y [k] is a discrete-time signal, where y(t) is a
continuous-time signal.
y(t) y(kT )

■ Discrete-time signals are usually converted to continuous-time


signals using a zero-order hold:

e.g., to convert u [k] to u(t).

■ We will spend more time on these topics as the course progresses.


Only a conceptual understanding is needed now.

“Digitization”

■ Continuous-time controllers are designed with Laplace-transform


techniques. The resulting controller is a function of “s”.
dx(t)
x(t) s y(t) =
dt

■ So, “s” is a derivative operator. There are several ways of


approximating this in discrete time. We look at one now called the
“forward rectangular” rule.
! δx(t) x(t + δt) − x(t)
ẋ(t) = lim = lim .
δt→0 δt δt→0 δt

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–3
■ If T is small,
x((k + 1)T ) − x(kT ) x[k + 1] − x[k]
ẋ(kT ) ≈ i.e., ẋ[k] ≈ .
T T
■ To use this approximation, we set T = t
k+1 − tk = sampling interval.

■ We “digitize” a controller D(s) by


1. Noting that controller output is related to controller input via
U (s) = D(s)E(s).
2. Performing term-by-term inverse Laplace transform to get a
differential equation relationship between u(t) and e(t)
n m
! dk u(t) ! dk e(t)
ak k
= bk k
.
k=0
dt k=0
dt
3. Replace derivatives with differences.
EXAMPLE :
U (s) s+a
■ Consider D(s) = = k0 ... a lead or lag controller.
E(s) s+b
1. (s + b)U (s) = k0(s + a)E(s).
2. u̇(t) + bu(t) = k0ė(t) + ak0e(t).
3. Use “forward rectangular rule” to digitize
" #
u[k + 1] − u[k] e[k + 1] − e[k]
+ bu[k] = k0 + ae[k]
T T
u[k + 1] = u[k] +
$ " #%
e[k + 1] − e[k]
T −bu[k] + k0 + ae[k]
T
u[k + 1] = (1 − bT )u[k] + k0(aT − 1)e[k] + k0e[k + 1].
■ Note that we often re-index the difference equation to be in more
familiar terms of “k” instead of “k + 1”
u[k] = (1 − bT )u[k − 1] + k0(aT − 1)e[k − 1] + k0e[k].
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–4
■ Present output of digital controller u[k] depends on previous output
u[k − 1] as well as the previous and current errors e[k − 1] and e[k].

Real-Time Controller Implementation

x = 0. (initialization of “past” values for first loop through)

Define constants:

α1 = 1 − bT .

α2 = k0 (aT − 1).

READ A/D to obtain y[k] and r [k].

e[k] = r [k] − y[k].

u[k] = x + k0 e[k].

OUTPUT u[k] to D/A and ZOH.

Now compute x for the next loop through:

x = α1 u[k] + α2 e[k].

Go back to “READ” when T seconds have elapsed since last READ.

■ Code is optimized to minimize latency between A2D read and D2A


write.
T
RCW I RCW I RCW I

R = read. W = write.
C = compute. I = idle.

■ Rule of thumb: Sampling frequency must be ≈ 30 times the


bandwidth of the analog system for comparable performance.
EXAMPLE : This one with numbers:
(s + 2) 1
■ Let D(s) = 70 , G(s) = .
(s + 10) s(s + 1)
■ Choose to try a sample rate of 20 Hz and also try 40 Hz.

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–5

(Note,
] BW of analog system is ≈ 1 Hz or so).
1
➠ Use formula from before to digitize D(s).
■ 20 Hz: u[k + 1] = 0.5u[k] + 70e[k + 1] − 63e[k].
■ 40 Hz: u[k + 1] = 0.75u[k] + 70e[k + 1] − 66.5e[k].
Sampled at 20Hz Sampled at 40Hz
1.5 1.5
analog analog
digital digital
Plant output

Plant output
1 1

0.5 0.5

0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1

Time (sec) Time (sec)


■ IMPORTANT NOTE: The closed loop system with digital controller
has poorer damping than the original analog system. This will always
be true when emulating an analog controller. We see why next . . .

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–6
2.2: The importance of the D2A “hold” operation
u u(kT )
u(t)

avg. u(t)

■ Even if u(kT ) is a perfect re-creation of the output of the analog


controller at t = kT , the “hold” in the D2A causes an “effective delay.”
■ The delay is approximately equal to half of the sampling period: T /2.
■ Recall from frequency-response analysis and design, the magnitude
of a delayed response stays the same, but the phase changes:
T
!phase = −ω .
2
■ For the previous example, sampling now at 10 Hz, we have:
1
10
Magnitude

0
10

−1
10 −1 0 1 2
10 10 10 10
Phase (Deg)

−100
−120
−140
−160
−180 −1 0 1 2
10 10 10 10
Frequency (rad/sec)
■ The PM has changed from ≈ 50◦ to ≈ 30◦.
PM
■ ζ ≈ . . . ζ changed from 0.5 to 0.3 . . . much less damping.
100
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–7
1.5

Nominal
■ M p from about 20% to about

Plant output
1

30% . . .
■ Faster sampling. . . smaller T . . . 0.5

smaller delay. . . smaller change


in response. 0
0 0.2 0.4 0.6 0.8 1

Time (sec)

Root-locus view of the delay

■ Recall that we can model a delay using a Padé approximation.


T 1 − sT /4
delay −→ e−sT /2 ≈ .
2 1 + sT /4
■ Poles and zeros reflected about the jω-axis.

I(s)

As T → 0, delay dynamics → ∞.
4 4 R(s)

T T

1
■ Impact of delay: Suppose D(s)G(s) = .
s+a
I(s) I(s)
With
delay
−a R(s) ➠ 4 −a 4 R(s)

T T

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–8
■ Does the delayed locus make sense?
1 − sT /4 (sT /4 − 1)
=− .
1 + sT /4 (sT /4 + 1)
■ Gain is negative! We need to draw a 0◦ root locus, not the 180◦ locus
we are more familiar with.
■ Conclusion: Delay destabilizes the system.

PID Control via Emulation



P: u(t) = K e(t) ⎪
⎪ $ & t %
& t
K

⎬ 1
I: u(t) = e(τ ) dτ PID: u(t) = K e(t) + e(τ ) dτ + TD ė(t)
TI 0
0 TI ⎪ $ %

⎪ 1
⎭ or, u̇(t) = K ė(t) + e(t) + T ë(t) .
D: u(t) = K TD ė(t) D
TI
■Convert to discrete-time (use rule twice for ë(t)).
$" # " # %
T TD 2TD TD
u[k] = u[k−1]+K 1+ + e[k] − 1 + e[k − 1] + e[k − 2] .
TI T T T
EXAMPLE :
360000
G(s) = K = 5, TD = 0.0008, TI = 0.003.
(s + 60)(s + 600)
■ Bode plot of cts-time OL system D(s)G(s) with the above PID D(s)
shows that BW ≈ 1800 rad s−1 ≈ 320 Hz.

10 × BW ➠ T = 0.3 ms.

■ From above,
$ %
u[k] = u[k − 1] + 5 3.7667e[k] − 6.333e[k − 1] + 2.6667e[k − 2] .

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–9
1.4
continuous
■ Performance not great, so tried 1.2 digital: T=0.3msec

Speed (rads/sec)
digital: T=0.1msec
again with T = 0.1 ms. Much 1

better. 0.8

0.6
■ Note, however, that the error is 0.4

mostly due to the rise time 0.2

being too fast, and the damping 0


0 2 4 6 8 10

too low. Time (msec)


1.5
continuous
digital: T=0.3msec

■ FIDDLE with parameters ➠ Speed (rads/sec) 1

increase K to slow the system


down; Increase TD to increase 0.5

damping. ➠ New K = 3.2, new


TD = 0.3 ms. 0
0 2 4 6 8 10

Time (msec)

KEY POINT: We can emulate a desired analog response using the


forward-rectangular rule, but the delay added to the system due to the
D2A hold circuit will decrease damping. This could even destabilize
the system!!! This delay can be minimized by sampling at a high rate.
(EXPENSIVE). Or, we can change the digital controller parameters,
as in the last example, to achieve the desired system performance
BUT NOT BY emulating the specific analog controller D(s).
■ How do we design the digital controller if we cannot use D(s) as a
prototype? Need Laplace-like tools for discrete-time.

THE z-TRANSFORM!

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–10
2.3: Definition of the z-transform

■ In ECE4510/5510, we saw that the Laplace transform is a very


powerful tool for analysis and design of analog control systems.
■ We are now looking at discrete-time (digital) control systems, and we
need a similar tool. Enter the z-transform. . .

DEFINITION: The (one-sided or unilateral) z-transform is defined as

X (z) = x(0) + x(T )z −1 + x(2T )z −2 + x(3T )z −3 + · · ·


!∞
= x(kT )z −k
k=0
" ∞
! #
or, X (z) = x[k]z −k .
k=0

■ Like the Laplace-transform variable “s,” the z-transform variable “z” is


a complex number.
■ Like the Laplace-transform, convergence of the transform is an
important consideration.

• For the above definition of the z-transform, convergence is always


of the form
X (z) = something, |z| > ρ,
where ρ is a disc on the z-plane.

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–11

EXAMPLE : Define the digital impulse (unit pulse) function to be


+
1, k = 0;
δ[k] =
0, otherwise.
−4 −2 0 2 4 6 8
■ Note: This is very different from an analog impulse (e.g., δ[0] is
defined), but plays a similar role.

so, let x[k] = δ[k]


!∞
X (z) = x[k]z −k
k=0

= x[0]z 0 + x[1]z −1 + x[2]z −2 + · · ·

= x[0] = 1.

■ Since this sum converges to 1 regardless of the value of z,


ROC = {|z| > 0}.

EXAMPLE : Consider a delayed impulse:

−4 −2 0 2 4 6 8

x[k] = δ[k − kd ]

!
X (z) = x[k]z −k
k=0

= x[0] + x[1]z −1 + · · · + x[kd ]z −kd + · · ·

= x[kd ]z −kd = z −kd .


■ Again, ROC = {|z| > 0}.

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–12

EXAMPLE : Let x[k] be the discrete unit-step function.


+
1, k ≥ 0;
x[k] = 1[k] =
0, otherwise.

!
1(z) = 1[k]z −k
k=0
−4−2 0 2 4 6 8

!
= z −k = 1 + z −1 + z −2 + · · ·
k=0
■ Multiply both sides of this equation by (z − 1).
(z − 1)1(z) = (z + 1 + z −1 + z −2 + · · · ) − (1 + z −1 + z −2 + · · · )

= z − z −∞ (in the limit)

=z if |z| > 1.
z
so 1(z) = , ROC = {|z| > 1}.
z−1
EXAMPLE : Let x[k] = a k 1[k] where a is a complex number.

!
X (z) = a k z −k
k=0

= 1 + az −1 + a 2 z −2 + · · · −4−2 0 2 4 6 8
■ Multiply both sides of this equation by (z − a).

(z − a)X (z) = (z + a + a 2 z −1 + · · · ) − (a + a 2 z −1 + a 3 z −2 + · · · )

= z − a ∞ z −∞ (in the limit)

=z if |z| > |a|


z
so X (z) = , ROC = {|z| > |a|}.
z−a

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–13
2.4: Delay properties of the z-transform

Linearity:
■ The standard linearity rule:
• If x[k] ↔ X (z) and v[k] ↔ V (z),
• Then ax[k] + bv[k] ↔ a X (z) + bV (z). (prove for yourself)
EXAMPLE : Let y[k] = 1[k] + a k 1[k].
■ Then,
z z 2z 2 − (1 + a)z
Y (z) = + = .
z−1 z−a (z − 1)(z − a)
Right shift in time (delay); Theorem 1:
■ Suppose x[k] ↔ X (z), and q is a positive integer.
y[k] = x[k − q]1[k − q]

!
Y (z) = x[k − q]1[k − q]z −k let k̄ = k − q
k=0

!
= x[k̄]1[k̄]z −(k̄+q)
k̄=−q

!
−q
=z x[k̄]z −k̄
k̄=0

= z −q X (z).
■ So, a delay of q samples multiplies the z-transform by z −q .
EXAMPLE : +
1, k = 0, 1, . . . N − 1;
p[k] =
0, otherwise.
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–14
■ Note that p[k] = 1[k] − 1[k − N ].
■ By linearity and by the right-shift theorem,

P(z) = 1(z) − z −N 1(z)


z z
= − z −N
z−1 z−1
zN − 1
= N −1 .
z (z − 1)
Right shift in time (delay); Theorem 2:

■ The first delay theorem states: x[k − q]1[k − q] ⇐⇒ z −q X (z).


■ The second delay theorem states: x[k − q] ⇐⇒ . . .
■ The first version is generally used on causal signals. The second
version is generally used on non-causal signals or when analyzing
effect of systems that may have initial conditions.

x[k − 1] ⇐⇒ z −1 X (z) + x[−1]

x[k − 2] ⇐⇒ z −2 X (z) + x[−2] + z −1 x[−1]


...

x[k − q] ⇐⇒ z −q X (z) + x[−q] + z −1 x[−q + 1] + · · · + z −q+1 x[−1].

■ Proof for the first case:


!∞
x[k − 1] ⇐⇒ x[k − 1]z −k let k̄ = k − 1
k=0

!
= x[k̄]z −(k̄+1)
k̄=−1

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–15

!
= x[−1] + x[k̄]z −(k̄+1)
k̄=0

= x[−1] + z −1 X (z). Proof of other cases by induction.

EXAMPLE : z-transform of LCCDE.


■ Many discrete-time systems are described by Linear Constant
Coefficient Difference Equations (LCCDEs). These are of the form
!n m
!
ai y[k − i] = bi x[k − i],
i =0 i =0
where n > m.
■ We can find the transfer function of this system by taking the
z-transform of both sides of this equation.
■ System transfer functions always assume zero initial conditions, so
we can use Delay Theorem 1.
! n m
!
ai z −i Y (z) = bi z −i X (z),
i =0 i =0
Y (z)
H (z) =
X (z)
,m −i
i =0 bi z
= ,n −i
.
a
i =0 i z
■ We can multiply numerator and denominator by z n to get it in terms of
positive powers of z.
EXAMPLE : Find the output of a system described by difference equation
y[k] + 0.5y[k − 1] = x[k],
where x[k] = 1[k] and y[−1] = 6.
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–16
■ There are initial conditions, so we use Delay Theorem 2,
- −1 .
Y (z) + 0.5 z Y (z) + y[−1] = X (z)
z
Y (z)[1 + 0.5z −1] = −3
z−1
z − 3(z − 1)
Y (z) =
(z − 1)(1 + 0.5z −1)
3z − 2z 2
=
(z − 1)(z + 0.5)
−(8/3)z (2/3)z
= +
z + 0.5 z−1
2 8
y[k] = · 1[k] − (−0.5)k 1[k].
3 3

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–17
2.5: Time multiplication and the z-transform

Multiplication by k and k 2.

■ What happens when we multiply a time sequence x[k] by k or k 2?


■ Recall: ∞
!
X (z) = x[k]z −k .
k=0
■ Then,

d !
X (z) = −kx[k]z −k−1
dz k=0

!
−1
= −z kx[k]z −k .
/k=0 01 2
Y (z)

■ Thus,
d
kx[k] ⇐⇒ −z X (z).
dz
■ Also
2
d 2 2 d
k x[k] ⇐⇒ z X (z) + z 2 X (z).
dz dz
k z
EXAMPLE : Recall that a 1[k] ↔ .
z−a
" # $ %
d z −z 1 −a
= + =
dz z − a (z − a)2 z − a (z − a)2
az
so, ka k 1[k] ↔
(z − a)2
z
and, k1[k] ↔ . (ramp)
(z − 1)2
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–18
Multiplication by a k :

■ Multiply a time sequence x[k] by a k (a complex).



!
a k x[k] ↔ a k x[k]z −k
k=0

! 3 z 4−k
= x[k]
k=0
a
= X (z/a).

Multiplication by cos[ωk] and sin[ωk].

■ Multiply a time sequence x[k] by cos[ωk] or sin[ωk].


■ Recall from Euler’s theorem
e j ωk + e− j ωk e j ωk − e− j ωk
cos[ωk] = and sin[ωk] = .
2 2j
■ So,
1 5 6 1 5 6
cos[ωk]x[k] ⇐⇒ X e− j ω z + X e j ω z
2 2
1 5 − jω 6 1 5 jω 6
sin[ωk]x[k] ⇐⇒ X e z − X e z .
2j 2j
EXAMPLE : Find the z-transform of x[k] = cos[ωk]1[k].
z
■ Recall that 1[k] ⇐⇒ .
z−1
" #
1 e j ωz e− j ω z
X (z) = +
2 e j ω z − 1 e− j ω z − 1
" #
1 e j ω z(e− j ω z − 1) + e− j ω z(e j ω z − 1)
=
2 (e j ω z − 1)(e− j ω z − 1)

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–19
" #
1 z 2 − e j ω z + z 2 − e− j ω z
=
2 z 2 − (e j ω + e− j ω)z + 1
z 2 − cos[ω]z
cos[ωk]1[k] ⇐⇒ 2 .
z − (2 cos[ω])z + 1
■ Also,
z sin[ω]
sin[ωk]1[k] ⇐⇒ .
z 2 − (2 cos[ω])z + 1

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–20
2.6: Convolution, initial/final value and the z-transform

Convolution
■ Discrete-time convolution is analogous to continuous-time
convolution:
!k
(x ∗ v)[k] = x[i]v[k − i] k≥0
i =0
k
!
or, = v[i]x[k − i]. k ≥ 0.
i =0

■ Assuming that x[k] and v[k] are zero for negative k,



!
(x ∗ v)[k] = x[i]v[k − i] k≥0
i =0

7∞ 8
! !
⇐⇒ x[i]v[k − i] z −k
k=0 i =0
∞ !
! ∞
= x[i]v[k − i]z −k
i =0 k=0

7∞ 8
! !
= x[i] v[k − i]z −k k̄ = k − i
i =0 k=0
⎡ ⎤

! ∞
!
= x[i] ⎣ v[k̄]z −(k̄+i )⎦
i =0 k̄=−i
⎡ ⎤

! !∞
= x[i] ⎣ v[k̄]z −k̄ ⎦ z −i
i =0 k̄=0

= X (z)V (z).
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–21
Initial-value theorem
■ If x[k] ⇐⇒ X (z), x[0] = lim X (z).
z→∞
■ Proof:

!
X (z) = x[k]z −k
k=0

= x[0] + x[1]z −1 + x[2]z −2 + · · ·

as z → ∞, = x[0] + x[1] · 0 + x[2] · 0 + · · ·

= x[0].

■ Also,
x[1] = lim (z X (z) − zx[0])
z→∞
5 6
x[2] = lim z 2 X (z) − z 2 x[0] − zx[1]
z→∞
...

Final value theorem


■ Proof not too enlightening:
lim x[k] = lim (z − 1)X (z)
k→∞ z→1

assuming the limit on the left exists! Conditions for existence: All
poles of X (z) must be inside unit circle | pi | < 1 ∀ i, except possibly a
single pole on the unit circle at z = 1. The residue of the pole at z = 1
is the final value and is found from above.
EXAMPLE :
3z 2 − 2z + 4
■ Suppose X (z) = .
z 3 − 2z 2 + 1.5z − 0.5
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–22
■ Factoring the denominator:
3z 2 − 2z + 4
X (z) =
(z − 1)(z 2 − z + 0.5)
=
3z 2 − 2z + 4 ==
x ss = 2
(z − z + 0.5) = z=1
5
= = 10.
0.5

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–23
2.7: The inverse z-transform

1.] Power-series method:


z2 − 1
■ Suppose X (z) = ,
3
z + 2z + 4
■ Dividing:

6 z −1 +0z −2 −3z −3 −4z −4 ···


z 3 + 2z + 4 z2 −1
z2 +2 +4z −1
−3 −4z −1
−3 −6z −2 −12z −3
−4z −1 +6z −2 +12z −3
−4z −1 −8z −3 −16z −4
6z −2 +20z −3 +16z −4
...

■ So, X (z) = z −1 − 3z −3 − 4z −4 · · · .
■ and x[0] = 0, x[1] = 1, x[2] = 0, x[3] = −3, x[4] = −4, . . .

2.] Partial-fraction expansion


■ Recall that partial-fraction expansion was used to take
inverse-Laplace transforms of things like:
num(s)
H (s) = ,
den(s)
where the order of num(s) <order of den(s).
■ z-transforms almost always have the same order numerator and
denominator which requires modifying the technique slightly.
N (z)
■ Let X (z) = and let D(z) have distinct poles.
D(z)
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–24
X (z) N (z)
■ Do partial-fraction expansion on = .
z z D(z)
X (z) r0 r1 r2 rn
= + + + ···+
z z z − p1 z − p2 z − pn
$ %
X (z)
r0 = z = X (0)
z z=0
$ %
X (z)
ri = (z − pi ) i = 1, . . . , n.
z z= pi
■ So,
r1 z r2 z rn z
X (z) = r0 + + + ···+ .
z − p1 z − p2 z − pn
• Transforming: r0 ⇐⇒ r0 δ[k].
ri z
• Transforming: ⇐⇒ ri pik 1[k].
z − pi
• Note:
- .
r1 p1k + r̄1 p̄1k = 2 |r1| | p1|k cos k ̸ p1 + ̸ r1 k = 0, 1, . . .

if r1 and p1 complex.

EXAMPLE :

■ Suppose
z3 + 1
X (z) = 3
z − z2 − z − 2
z3 + 1
= 3 √ 43 √ 4
1 3
(z − 2) z + 2 + j 2 z + 2 − j 23
1

X (z) r0 r1 r̄1 r2
= + √ + √ + .
z z 1
z+2+ j 23 1
z+2− j 2 3 z − 2

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–25
■ Find the residues:
−1
r0 = X (0) =
2
⎡ ⎤
3

⎢ z +1 1⎥ 3 3
r1 = ⎣ 3 √ 4 ⎦ = +j
(z − 2) z + 12 − j 23 z √
7 21
z=− 12 − j 2
3

$ %
X (z) 9
r2 = (z − 2) = .
z z=2 14
■ So,
@ √ Ak @ √ Ak
1 1 3 1 3 9
x[k] = − δ[k]+r1 − −j 1[k]+r̄1 − + j 1[k]+ 2k 1[k].
2 2 2 2 2 14
■ Note: | p1| = 1, ̸ p1 = 4π/3. |r1| = 0.436, ̸ r1 = 10.89◦.
■ So,
" #
1 4π 9
x[k] = − δ[k] + 0.873 cos k + 10.89◦ 1[k] + (2)k 1[k].
2 3 14
Repeated poles:
■ There is a special rule for repeated poles, just as with
Laplace-transform partial-fraction expansion.
■ Suppose p1 is repeated “n” times.
X (z) r0 r1,1 r1,2 r1,n
= + + + · · · + + other poles
z z z − p1 (z − p1)2 (z − p1)n
■ Then, the residues are calculated as
$ %
X (z)
r1,n = (z − p1)n
z z= p1
$ " #%
1 d X (z)
r1,n−1 = (z − p1)n
1! dz z z= p1

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–26
$ " #%
1 d2 n X (z)
r1,n−2 = (z − p 1 )
2! dz 2 z z= p1
...
$ n−1 " #%
1 d n X (z)
r1,1 = (z − p 1 ) .
(n − 1)! dz n−1 z z= p1
■ MATLAB’s residue command automates partial-fraction expansion:
num=[ ] % coefficients of numerator.
den=[] % coefficients of denominator.
[r,p,k]=residue(num,[den 0]) % don't forget '1/z'!

■ Or, there is a somewhat easier way:


num=[ ] % coefficients of numerator.
den=[] % coefficients of denominator.
[r,p,k]=residuez(num,den)

■ Be sure to type help residue or help residuez if there are


repeated roots to understand the format of the results that MATLAB
returns.

3.] Inversion formula:


■ A third way to invert a z-transform is to use the relationship:
B
1
x[k] = X (z)z k−1 dz
2π j )
where this is a counter-clockwise contour integral over the path ) in
the z-plane. ) must be in the region of convergence.
■ This looks terrible, but the theorem of residues makes it simpler. It
reduces to: ⎡ ⎤
!
[residues of X (z)z k−1]⎦ 1[k].
⎢ ⎥
x[k] = ⎣
all poles of X (z)z k−1

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–27

■ For a simple pole of X (z)z k−1 at a, the residue is:


=
k−1 =
[residue]z=a = (z − a)X (z)z z=a
.

■ For a repeated pole of X (z)z k−1 at a, repeated m times,


1 dm−1 - m k−1
.
[residue]z=a = (z − a) X (z)z z=a
.
(m − 1)! dz m−1
EXAMPLE :
z
X (z) = .
(z − 1)(z − 2)
■ So,
$ = = %
z k == z k ==
x[k] = + 1[k]
z − 2 =z=1 z − 1 =z=2
- .
= −1 + 2k 1[k].

EXAMPLE :
z
X (z) = .
(z − 1)2
$ $ % %
1 d2−1 z
x[k] = 2−1
(z − 1)2 2
z k−1 1[k]
(2 − 1)! dz (z − 1) z=1
$ = %
d k ==
= z 1[k]
dz =z=1
=
= kz k−1=z=1 1[k]

= k1[k].

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
Laplace transform Time function z-Transform Modified z-transform
E(s) e(t) E(z) E(z, m)
1 z 1
s 1(t) z−1 z−1
1 Tz mT T
s2
t1(t) (z−1)2 z−1 + (z−1)2
1 t2 T 2 z(z+1) T2 m2 2m+1 2
s3 2 1(t) 2(z−1)3 2 z−1 + (z−1)2
+ (z−1)3
(k−1)! ∂ k−1 z ∂ k−1
C D

e−amT
sk
t k−1 1(t) lima→0 (−1)k−1 ∂a k−1 z−e−aT
lima→0 (−1)k−1 ∂a k−1 z−e−aT
1 z
C D C D

e−amT
s+a e−at 1(t) z−e−aT z−e−aT
1 T ze−aT T e−amT [e−aT +m(z−e−aT )]
(s+a)2
te−at 1(t) (z−e−aT )2 (z−e−aT )2
(k−1)! k ∂k k ∂k e
(s+a)k
t k e−at 1(t) (−1) ∂ak z−ez−aT (−1) ∂ak z−e −aT

a 1
C D C −amT D

z(1−e−aT ) e−amT
s(s+a) 1 − e−at (z−1)(z−e−aT ) z−1z−e−aT

a 1−e−aT z[(aT −1+e−aT )z+(a−e−aT −aT e−aT )] T −1 e−amT
s 2 (s+a) a (z−1)2
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS

a(z−1)2 (z−e−aT )
t− + amT
a(z−1) + a(z−e−aT )
a2 z z aT e−aT z 1 1+amT aT e−aT
s(s+a)2
1 − (1 + at)e−at z−1 − z−e−aT − (z−e−aT )2 z−1 − z−e−aT
+ (z−e−aT )2
e−amT
b−a
C D

(e−aT −e−bT )z e−amT e−bmT


(s+a)(s+b) e−aT − e−bT (z−e−aT )(z−e−bT ) z−e −aT − z−e−bT
a z sin(aT ) z sin(amT )+sin((1−m)aT )
s 2 +a 2
sin(at) z 2 −2z cos(aT )+1 z 2 −2z cos(aT )+1
s z(z−cos(aT )) z cos(amT )−cos((1−m)aT )
s 2 +a 2
cos(at) z 2 −2z cos(aT )+1 z 2 −2z cos(aT )+1
b ze−aT sin(bT ) e −amT [z sin(bmT )+e−aT sin((1−m)bT )]
(s+a)2 +b2
e−at sin(bt) z 2 −2ze−aT cos(bT )+e−2aT z 2 −2ze−aT cos(bT )+e−2aT
s+a z 2 −ze−aT cos(bT ) e−amT [z cos(bmT )+e−aT sin((1−m)bT )]
(s+a)2 +b2
e−at cos(bt) z 2 −2ze−aT cos(bT )+e−2aT z 2 −2ze−aT cos(bT )+e−2aT
a 2 +b2 z(Az+B) 1
s[(s+a)2 +b2 ]
1 − e−at cos(bt) + ab sin(bt) (z−1)(z 2 −2ze−aT cos(bT )+e−2aT ) z−1 − . . .
5 6

e−amT [z cos(bmT )+e−aT sin((1−m)bT )]


A= 1 − e−aT cos(bT ) + ab sin(bT ) z 2 −2ze−aT cos(bT )+e−2aT
+ ...
a −amT
b (e [z sin(bmT )−e−aT sin((1−m)bT )])
5 6

B = e−2aT + e−aT b sin(bT ) − cos(bT ) z 2 −2ze−aT cos(bT )+e−2aT


1 1 e−at e−bt (Az+B)z
5a 6

s(s+a)(s+b) ab a(a−b) b(b−a)

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
(z−e−aT )(z−e−bT )(z−1)
+ +
−aT )−a(1−e−bT )
A = b(1−e ab(b−a)
ae−aT (1−e−bT )−be−bT (1−e−aT )
B= ab(b−a)
2–28
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–29
2.8: Time responses versus pole locations

■ We found that the Laplace-transform pole locations determined time


response. The same is true of the z-transform.
Unit step:

■ x[k] = 1[k].
z
■ X (z) = , |z| > 1.
z−1
−4−2 0 2 4 6 8

Exponential (geometric):

■ x[k] = a k 1[k], |a| < 1.


z
■ X (z) = , |z| > |a|.
z−a −4−2 0 2 4 6 8

General cosinusoid:

■ x[k] = a k cos[ωk]1[k], |a| < 1.


■ X (z) =
z(z − a cos ω)
, |z| > |a|. −4−2 0 2 4 6 8
z 2 − 2a(cos ω)z + a 2

■ The radius to the two poles is a.


■ The angle to the poles is ω.
■ The zero (not at the origin) has the same real part as the two poles.
z
■ Note: If ω = 0, X (z) = . . . exponential!
z−a
z
■ If ω = 0, a = 1, X (z) = . . . step!
z−1
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–30
■ Radius of pole locations is the exponential factor, and determines
settling time.

1. |a| > 1, Growing signal which will not decay.


2. |a| = 1, Signal with constant amplitude; either step or cosine.
3. |a| < 1, Decaying signal. Small a = fast decay (see below).

a ≈ duration N

0.9 43

0.8 21

0.6 9

0.4 5

4. |a| = 0, Finite-duration response. e.g., δ[k − N ] ⇐⇒ z −N .


■ Angle of pole locations, ω, determines number of samples per
oscillation.

• That is, require cos[ωk] = cos[ω(k + N )].


= =
2π =
= 360 ==
N= = samples/cycle.
ω =rad ω =deg
N =4 N =5

N =3 N =8
N = 10

N = 20

N =2

■ Solid lines are constant damping ratio ζ .


■ Dashed lines are constant natural frequency ωn .
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–31

I(z)

R(z)

Discrete Impulse Responses versus Pole Locations

Correspondence with continuous signals


■ Let x(t) = e−at cos(bt)1(t).
■ Suppose ⎫
a = 0.3567/T ⎬
π/4 T = sampling period.
b = ⎭
T
■ Then,
# "
5 πk 6
−0.3567 k
x[k] = x(kT ) = e cos 1[k]
4
" #
πk
= 0.7k cos 1[k].
4
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–32

(This is the example used previously).


■ X (s) has poles at s1,2 = −a + jb and −a − jb.
■ X (z) has poles at radius e−aT angle ω = ±bT or at e−aT ± j bT .
s1 T
• So, z 1,2 = e and es2 T .
■ In general, poles convert between the s-plane and z-plane via

z = esT .

EXAMPLE : Some corresponding pole locations:

π
j
T

π
−j
T
s-plane z-plane
■ jω-axis maps to unit circle.
■ Constant damping ratio ζ maps to strange spiral.

Good Good Good

Damping ζ Frequency ωn Settling Time

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–33
■ Higher-order systems:

• Pole moving toward z = 1, system slows down.

• Zero moving toward z = 1, overshoot.

• Pole and zero moving close to each other cancel.

Where from here?

■ We have now seen the most important aspects of z-transform theory.


■ Our next step is to start applying this theory to digital-controller
analysis and design.
■ We begin by revisiting the concept of emulating an analog
controller—what insight and techniques can we gain now that we
understand the z transform?
■ We then move on to direct digital control analysis and design.

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–34
2.9: Emulation in frequency domain

■ With a further understanding of the z-transform, we are now in a


better position to understand “design-by-emulation”.
■ Can we design better D(z) to “emulate” D(s)?

• Qualified “yes”.

• Method: Numerical integration.

EXAMPLE : Consider
U (s) a
= D(s) = ,
E(s) s+a
or
u̇(t) + au(t) = ae(t).
■ Rewrite as
& t
u(t) = (−au(τ ) + ae(τ )) dτ
0
& (k−1)T & kT
u(kT ) = (−au(τ ) + ae(τ )) dτ + (−au(τ ) + ae(τ )) dτ
0 (k−1)T
& kT
= u ((k − 1)T ) + (−au(τ ) + ae(τ )) dτ .
/ (k−1)T 01 2
area of −au(τ )+ae(τ ) over kT −T ≤τ ≤kT

■ Can approximate this area several ways:

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–35
f (t)

Forward Rectangular Rule


Area ≈ f ((k − 1)T ) · T
t
kT
f (t)

Backward Rectangular Rule


Area ≈ f (kT ) · T
t
kT
f (t)
Trapezoid Rule
(a.k.a., Tustin Rule or Bilinear Rule)
f ((k − 1)T ) + f (kT )
t Area ≈ ·T
kT 2

Method 1: Use the forward-rectangular rule


■ Using the forward rectangular rule on our example:
u(kT ) ≈ u ((k − 1)T ) + T [−au ((k − 1)T ) + ae ((k − 1)T )]

= (1 − aT ) u ((k − 1)T ) + aT e ((k − 1)T )

■ The transfer function of this is :


U (z) = (1 − aT )z −1U (z) + aT z −1 E(z)

U (z) [z − 1 + aT ] = aT E(z)
U (z) a
= z−1 .
E(z) T
+ a
z−1
• “s” has been replaced by “ ”. Seen already as Euler’s rule.
T
Method 2: Use the backward-rectangular rule
■ Using the backward rectangular rule, we get a different result:
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–36
u(kT ) ≈ u ((k − 1)T ) + T [−au(kT ) + ae(kT )]

u(kT )(1 + aT ) = u ((k − 1)T ) + aT e(kT )


u ((k − 1)T ) + aT e(kT )
u(kT ) = .
1 + aT
■ Finding the transfer function:
(1 + aT )U (z) = z −1U (z) + aT E(z)
- .
U (z) 1 + aT − z −1 = aT E(z)
U (z) aT a a
= = 1−z −1
= z−1
.
E(z) 1 + aT − z −1 +a Tz
+a
T
z−1
• “s” has been replaced by “ ”.
Tz
Method 3: Use the bilinear/Tustin/trapezoid rule
■ Using the bilinear rule:
u(kT ) ≈ u((k − 1)T ) + (T /2) [−au((k − 1)T ) + ae((k − 1)T )

−au(kT ) + ae(kT )]
$ % $ %
aT aT aT
u(kT ) 1 + = u((k − 1)T ) 1 − + [e ((k − 1)T ) + e(kT )] .
2 2 2
■ Finding the transfer function:
$ % $ %
aT aT aT - .
U (z) 1 + = z −1U (z) 1 − + E(z) z −1 + 1
2 2 2
U (z) aT (z + 1) a
= = 2
- z−1 . .
E(z) (2 + aT )z + aT − 2 T z+1
+a
" #
2 z−1
• “s” has been replaced by “ ”.
T z+1

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–37
2.10: Stability and prewarping

■ Each of these transformations maps the s-plane to the z-plane. How


do they compare?
■ Consider mapping s = jω (the stability boundary).

1. Forward rectangular rule:


z−1
s=
T
z = 1 + Ts

= 1 + T jω.
2. Backward rectangular rule:
z−1
s= ➠ z(T s − 1) = −1
Tz
1 1
z= =
1 − Ts 1 − T jω
" # " #
1 1 1 1 1 1 + T jω
= + − = + .
2 1 − T jω 2 2 2 1 − T jω
• The term in the parenthesis has magnitude 1 for all ω.

3. Bilinear rule:
" #
2 z−1
s=
T z+1
zT s + T s = 2z − 2

z(T s − 2) = −2 − T s
2 + Ts 2 + T jω
z= = .
2 − Ts 2 − T jω
• Constant magnitude 1 for all ω.

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–38
COMMENTS :

■ Rule (1) may possibly map a stable D(s) into an unstable D(z) (!!)
■ Rule (2) always maintains stability (can even map an unstable D(s)
into a stable D(z) (!) but does not do a good job of mapping
frequency response, especially at high frequencies.
■ Rule (3) maps stability information EXACTLY (important later in the
course). The jω-axis in the s-plane mapped directly to the unit circle
in the z-plane. ω from 0 . . . ∞ mapped to an angle 0 . . . π. Frequency
compression/warping.
■ Since the bilinear/Tustin rule is by far the most used, let us examine
the frequency warping some more.
■ Let frequency in the digital domain be ωz , and corresponding
frequency in the analog domain be ωs .
■ Convert H (s) to H (z).

H (z) = H (s)|s= 2 z−1 .


T z+1

■ Let z = e j ωz T (a sinusoid of frequency ωz ).


5 6
H e j ωz T = H (s)|s= 2 e j ωz T −1
T e j ωz T +1

= H (s)|s= 2 3 e j ωz T/2 −e− j ωz T/2 4


T e j ωz T/2 +e− j ωz T/2

= H (s)|s= j 2 tan3 ωz T 4
T 2

" # " #
2 ωz T 2 ω s T
■ So, ω =
s tan and ωz = tan−1 .
T 2 T 2

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–39
■ Near ωz = 0, ωs ≈ ωz , but wz T
frequencies do not match π

anywhere else. Important?


■ What if H (s) is designed using ws
Bode techniques to have a certain
bandwidth? This bandwidth will be
−π
warped!
■ One solution: Redesign H (s) to take into account eventual warping.

1. We want our controller to have bandwidth = ωz1 .


2 ωz T
2. “Pre-warp” our design spec. ωs1 = tan 1 .
T 2
3. Design H (s) to have bandwidth ωs1 .
4. Convert H (s) to H (z) via bilinear transform. Bandwidth = ωz1 .
■ Note: ωz1 is just some critical frequency to be matched. It does not
need to be bandwidth.
■ Another solution: Force warped frequency axis to match at desired
frequency:
z−1
let s = α
z+1
H (z) = H (s)|s=α z−1
z+1
5 j ωz T 6
H e = H (s)|s=α e j ωz T −1
e j ωz T +1

= H (s)|s=α3 e j ωz T/2 −e− j ωz T/2 4


e j ωz T/2 +e− j ωz T/2

= H (s)|s= j α tan3 ωz T 4 .
2

ω1
■ So, ωs = α tan(ωz T /2). Let α = .
tan(ω1 T /2)
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–40
■ Then, at frequency ωz = ω1,
ω1
ωs = tan(ω1 T /2) = ω1.
tan(ω1 T /2)
■ A match! Drawback: Can match at only one frequency.
■ In MATLAB:
sysd=c2d(sys,T,'tustin'); % bilinear
sysd=c2d(sys,T,'prewarp',w1); % w/ freq. match.

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–41
2.11: Examples and hold-based methods
1
EXAMPLE : Convert H (s) = to digital.
3 2
s + 2s + 2s + 1
z−1
Method 1) s = .
T
1
H (z) = (z−1)3 2
T3
+ 2 (z−1)
T2
+ 2 (z−1)
T
+1
T3
= 3
(z − 3z 2 + 3z 1 − 1) + 2T (z 2 − 2z + 1) + 2T 2(z − 1) + T 3
T3
= 3 .
z + z 2(2T − 3) + z 1(3 − 4T + 2T 2) + (2T − 2T 2 + T 3 − 1)
z−1 1
Method 2) s = . Gives: H (z) = (z−1)3 2
.
Tz
(T z)3
+ 2 (z−1)
(T z)2 + 2 (z−1)
Tz
+1
■ The rest of the math is up to you...
2z−1 1
Method 3) s = . Gives: H (z) = 8 (z−1)3 (z−1)2
.
T z+1
T 3 (z+1)3
+ 2 T42 (z+1)2 + 2 T2 (z−1)
(z+1)
+1
■ Again, the rest of the math is up to you.
■ For a fast sampling rate, these compare as:
T = 0.1, ωs = 2π/0.1 = 20π , ωs = 63ω p
1.5
cts
1 bilinr
warp
backwd
0.5 fwd

0 ωp
0 0.5ω p 1.5ω p 2ω p 2.5ω p
0
−100
−200
−300 ωp
0 0.5ω p 1.5ω p 2ω p 2.5ω p

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–42
■ For a medium sampling rate, these compare as:
(system T = 1, ωs = 2π/1 = 2π , ωs = 6.3ω p
1 cts
bilinr
warp
0.5 backwd
fwd

0 ωp
0 0.5ω p 1.5ω p 2ω p 2.5ω p
0
−50
−100
−150
−200
−250 ωp
0 0.5ω p 1.5ω p 2ω p 2.5ω p

■ For a slow sampling rate, these compare as:


T = 2, ωs = π , ωs = 3.14ω p
1 cts
bilinr
warp
0.5 backwd
fwd

0 ωp
0 0.5ω p 1.5ω p 2ω p 2.5ω p
0
−50
−100
−150
−200
−250 ωp
0 0.5ω p 1.5ω p 2ω p 2.5ω p

Zero-pole matching

■ There are other methods for emulating continuous-time systems with


discrete-time systems.
■ For example, we have seen before that if we take the z-transform of a
signal, the poles of the z-transform are related to the poles of the
s-transform via z = esT .
Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–43
■ There was no direct mapping of zeros.
■ Now, we consider transforming a system. Rules:

1. Poles map as z = esT .


2. Finite zeros map as z = esT .
3. Zeros at ∞ (high freq.) map to z = −1 (high freq).
(but, may want to move one zero from z = −1 to ∞ to give
processing time: zero at ∞ = pole at 0 = 1/z = delay).
4. Match the gain of H (s) and H (z) at dc.

EXAMPLE : First method: move zero at ∞ to z = −1:


a
H (s) = ➠ pole at − a, zero at ∞
s +a
z+1
H (z) = k .
z − e−aT
2k 1 − e−aT
■ Match at dc: H (0) = 1, Hz (1) = ... k = .
s
1 − e−aT 2
(z + 1)(1 − e−aT )
H (z) = .
2(z − e−aT )
EXAMPLE : Second method: move zero at ∞ to origin:
k
H (z) = .
(z − e−aT )
k
■ Match at dc: Hs (0) = 1, Hz (1) = −aT
. . . k = 1 − e−aT .
1−e
" #
1 − e−aT
H (z) = .
z − e−aT

sysd=c2d(sys,T,'matched');

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–44
Hold equivalents

■ Two other methods I won’t discuss in detail.


F E
H (s) z−1
■ ZOH: sysd=c2d(sys,T,’zoh’) H (z) = Z
s z
E F
(z − 1)2 H (s)
■ FOH: sysd=c2d(sys,T,’foh’) H (z) = Z
Tz s2
• The Z{·} notation will be explored in detail in Chapter 3.

■ System from pg. 2–41 revisited. . .


T = 1, ωs = 2π/1 = π , ωs = 6.3ω p
1.5
cts
zoh
1 matched
foh
0.5
0 ωp
0 0.5ω p 1.5ω p 2ω p 2.5ω p
0
−100
−200
−300
−400 ωp
0 0.5ω p 1.5ω p 2ω p 2.5ω p
T = 2, ωs = 2π/2 = π , ωs = 3.14ω p
1.5
cts
zoh
1 matched
foh
0.5
0 ωp
0 0.5ω p 1.5ω p 2ω p 2.5ω p
0
−200
−400
−600
−800 ωp
0 0.5ω p 1.5ω p 2ω p 2.5ω p

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–45
2.12: Design by emulation

■ These emulation techniques approximate an open-loop system D(s)


with an open-loop system D(z).
■ What happens when D(z) is placed in a feedback loop?
w(t)
A2D D2A
e(t) e[k] u[k] zoh
u(t)
r (t) Q D(z) G(s) y(t)

v(t)

■ We will look at this in more detail later.


■ Recall, though, that the biggest difference in performance will be due
to the T /2 second delay in the ZOH.

EXAMPLE :
1
G(s) = .
s(10s + 1)
■ Specifications for the design:

1. M p < 16%.
2. ts < 10 s to 1%.
3. ess for ramp input < 0.01, slope of ramp = 0.01.
4. Sampling time to give ≥ 10 samples in rise time.
■ Step 1: Design D(s).
“1” ➠ ζ ≥ 0.5.
“2” ➠ σ ≥ 0.46.
0.01
“3” ➠ K v = = 1.0.
0.01

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–46

Choose D(s) to cancel plant pole approximately.

10s + 1
D(s) = .
s+1

−2 −1.5 −1 −0.5
−1

K = 1 . . . ➠ . . . K v = 1 and good pole locations.


ωn ≈ 1 for pole locations, so tr ≈ 1.8 sec.
“4” T = tr /10 = 0.18 ➠ choose T = 0.2.
■ Step 2: D(s) ⇒ D(z): Use pole-zero matching.

• D(s) has zero at −1/10 ➠ D(z) has zero at z = e−0.1T .


−T
• D(s) has pole at −1 ➠ D(z) has pole at z = e .
• D(s) has dc-gain 1 ➠ D(z) has dc-gain 1.
(z − 0.9802)
D(z) = K .
(z − 0.8187)
(1 − 0.9802)
• DC-gain of D(z) = lim D(z) = K . . . K = 9.15.
z→1 (1 − 0.8187)
(z − 0.9802)
D(z) = 9.15 .
(z − 0.8187)

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett
ECE4540/5540, EMULATION OF ANALOG CONTROLLERS 2–47

10s+1 1
(system dela Step s+1 10s 2+s
ycont

Sum D(s) Plant To Workspace

udisc

To Workspace1

9.15(z−0.9802) 1
ydisc
(z−0.8187) 10s 2+s
Sum1 D(z) Zero−Order Plant2 To Workspace2
Hold

■ Try again, but with 1.0 sec sampling period.


(z − 0.9048)
D(z) = 6.64 .
(z − 0.3679)
■ Much more overshoot, poorer damping.
Simulation for T = 0.2 Simulation for T = 1
1.5 1.5

Disc. Disc.
1 1

Cont. Cont.
Output

Output

0.5 0.5

0
u/10 0
u/10

−0.5 −0.5
0 5 10 15 20 0 5 10 15 20

Time (sec) Time (sec)


Where to from here?

■ We have completed our look at design by emulation.


■ We now move in the direction of direct digital-control design.
■ First, we need to spend some time understanding the D2A and A2D
operations thoroughly.

Lecture notes prepared by Dr. Gregory L. Plett. Copyright © 2017, 2009, 2004, 2002, 2001, 1999, Gregory L. Plett

You might also like