TD-Digital Control 3AI2S
TD-Digital Control 3AI2S
control
n◦ 1
H. Garnier
F. Collin
A knowledge of the z-transform is very important in digital control, as it is a valuable tool for representing,
analyzing and designing discrete-time control systems. The unilateral z-transform of a discrete-time sequence
is given by:
+∞
X
X(z) = x(k)z −k
k=0
The z-transforms of common discrete-time sequences have been calculated in closed form. They are usually
given in the form of table (see Appendix). Such table is particularly useful in finding the inverse z-transform.
Exercise 1.1
Plot each of the following discrete-time sequences. Find their z-transform:
where δ(k) and Γ(k) denotes the discrete-time unit impulse and step sequences respectively.
Exercise 1.2
Consider the following discrete-time signal
x(k) = − 1 + 2k Γ(k)
By using the table of z-transforms (see Appendix), find the z-transform Use the initial value theorem to
check the correctness of your z-transform calculation.
Deduce from X(z) the z-transform of y(k) = x(k − 2).
Exercise 1.3
Given the following z-transform of a discrete-time sequence,
X(z) = 4z −2 + 2 + 3z −1
1
Tutorials - Digital
control
n◦ 2
H. Garnier
F. Collin
Exercise 2.1
Given the following z-transforms of causal linear time-invariant signals, determine their inverse z-transform
by first expanding them into a power series using long division and then by using the partial fraction
expansion method.
z2 z
(a) X1 (z) = (b) X2 (z) =
(z − 1)(z − 2) (z − 1)(z − 2)
0.2z z(3z − 1)
(c) X3 (z) = (d) X4 (z) =
(z − 1)(z − 0.8) (z − 1)(z − 2)
z
(e) X5 (z) = 2
z + 6z + 8
Give, when it is possible, the first four terms of each sequence and the final value x(∞). Use the initial value
theorem to check the correctness of your inverse z-transform calculation.
Exercise 2.2
Using the z-transform, solve the following difference equation:
Exercise 2.3
Using the z-transform, solve the following difference equation:
Exercise 2.4
Consider the discrete-time system given by
3 1 5
s(k + 2) − s(k + 1) + s(k) = e(k), with the initial conditions s(0) = 1, s(1) = .
2 2 2
Show that its response to a discrete-time unit step input is given by.
2
Tutorials - Digital
control
n◦ 3
H. Garnier
F. Collin
Sampled systems
Exercise 3.1
1. Recall the closed-loop block-diagram of the digital control of a continuous-time systems described by
its transfer function G(s).
5. Recall the formula of the sampled transfer function GZOH (z) when the continuous-time plant is a first
b
order G(s) = s+a . Note the dependency of the sampled transfer function parameters to the sampling
period Ts .
Exercise 3.2
Consider a sampled system constituted by the cascade of a zero-order hold (ZOH) Bo (s), a continuous-time
transfer function G(s) and a sampler as shown in Figure ?? where:
2
G(s) =
1 + 2s
1. Give the steady-state gain, the time-constant, the pole and zero of G(s).
3
5. Recall the relationship between the poles of G(s) and GZOH (z).
6. Give the difference equation of the sampled system.
7. Calculate the response y(k) to a unit discrete-time step u(k) = Γ(k) for k = 0, 1, 2, 3, 4 and compare it
with the step response of the continuous-time system G(s) recalled below :
3. Given that the unit of time is minutes, determine the sampled transfer function GZOH (z) by using
Matlab and investigate the location of its zeros with respect to the unit circle when the sampling period
Ts is 2 and 0.5 min.
4. For each case, plot the step response of the sampled transfer function and check whether the sampled
transfer function exhibits an non-inverse response.
Exercise 3.4
Consider a sampled system constituted by the cascade of a zero-order hold (ZOH) Bo (s), a continuous-time
transfer function G(s) and a sampler where
−3s + 1
G(s) =
(2s + 1)(5s + 1)
1. Use Matlab to plot the step response of the continuous-time transfer function. Note that the continuous-
time second-order process exhibits an inverse step response which is due to its zero in the right half of
the s-plane.
2. Given that the unit of time is minutes, determine the sampled transfer function GZOH (z) by using
Matlab and investigate the location of its zero with respect to the unit circle when the sampling period
is 1, 2, 6, 7, 8, and 10 min.
3. For each case, plot the step response of the sampled transfer function and check whether the sampled
transfer function exhibits also an inverse response.
4
Tutorials - Digital
control
n◦ 4
H. Garnier
F. Collin
Y (z) 0.4z −1
GZOH (z) = =
U (z) 1 − 0.8z −1
1. Give the system order and determine its steady-state gain, its zero and pole.
2. Plot the zero-pole diagram. Conclude about the stability of the sampled system.
3. Check your answers by executing the following Matlab code:
Gd=tf([0 0.4],[1 -0.8],pi)
dcgain(Gd)
zero(Gd)
pole(Gd)
pzplot(Gd)
4. Determine the difference equation of the discrete-time system.
5. Compute its response to a sampled unit step input.
6. Use the final value theorem to determine the step response when k = ∞.
7. Determine the frequency response when the sampling frequency is ωs = 2 rad/s. Use Matlab to plot
the Bode diagram and observe of the main characteristics of the system in the frequency domain.
Exercise 4.2
Consider a sampled system given by the following second-order difference equation:
2. Give the system order and determine its steady-state gain, its zero and poles.
3. Plot the zero-pole diagram. Conclude about the stability of the sampled system.
4. Check your answers by using Matlab.
5
Exercise 4.3
Consider the sampled system given the following discrete-time transfer function
2z −5 0.2
GZOH (z) =
(z − 1)2 z − 0.8
Exercise 4.4
State whether the discrete-time transfer functions given below are stable, marginally stable or unstable.
Justify your answer.
5z 5z
G1 (z) = G2 (z) =
(z + 0.2)(z − 0.8) (z + 1.2)(z − 0.8)
5(z + 1) 5(z + 1.2)
G3 (z) = G4 (z) = 2
z(z − 1)(z − 0.8) z (z − 1)2 (z + 0.1)
Exercise 4.5
The characteristic equation of a linear digital feedback control system is given as
D(z) = z 2 + z + Kp
Find the range of values for Kp so that the digital feedback control system is stable.
6
Tutorials - Digital
control
n◦ 5
H. Garnier
F. Collin
7
Figure 5.1: Digital controller design via approximation of analog controller
2 z−1 2 1 − z −1
3. the bilinear ou Tustin rule: s = =
Ts z + 1 Ts 1 + z −1
In every case, write the difference equation and examine the stability of the resulting digital filter.
Type the following Matlab commands to compare the Bode diagram of the analog and digital controllers:
s = tf(’s’);
C=(s+1)/(s+10);
Ts=0.1;
Cf=tf([1 -0.9],[1 0],Ts)
Cb=tf([0.55 -0.5],[1 -0.5],Ts)
Ct=c2d(C,Ts,’tustin’)
bode(C,Cf,Cb,Ct)
legend(’Analog’,’forward’,’backward’,’tustin’)
Exercise 5.4 Write the Matlab code that implements the control for the digital controller
8
Tutorials - Digital
control
n◦ 6
H. Garnier
F. Collin
Exercise 6.2
A continuous-time system is modeled by the following first-order plus delay transfer function
1
G(s) = e−2s
1 + 8s
1. Find the PI controller that results by applying the Ziegler-Nichols tuning rules to the process
2. Determine the transfer function of the digital controller C(z) by using the forward difference approxi-
mation for the integral part when N = 10 and Ts = 0, 1s.
Exercise 6.3
The digital implementation in Python of a PID controller is given below. Determine the transfer function of
both digital and analog controllers.
def pid(sp,pv,pv_last,ierr,dt):
Kc = 10.0 # K
tauI = 50.0 # sec
tauD = 1.0 # sec
# Parameters in terms of PID coefficients
KP = Kc
KI = Kc/tauI
KD = Kc*tauD
# u0 for controller (initial heater)
u0 = 0
# calculate the error
9
error = sp-pv
# calculate the integral error
ierr = ierr + KI * error * dt
# calculate the measurement derivative
dpv = (pv - pv_last) / dt
# calculate the PID output
P = KP * error
I = ierr
D = -KD * dpv
u = u0 + P + I + D
Exercise 6.4
Write a Matlab program that implements the closed-loop control for the digital PID controller derived in
Exercise 6.2 and discuss its ability to track a set-point step.
Exercise 6.5
Write a Simulink program that implements the closed-loop control for the digital PID controller derived in
Exercise 6.2 and discuss its ability to track a set-point step.
10
English to French translation
11
Appendix
The table below provides a number of Laplace and z-transform pairs and their region of convergence (ROC).
Remarks:
1 z
Γ(t) s Γ(k) z−1 |z| > 1
1 zTs
tΓ(t) s2 kTs Γ(k) (z−1)2 |z| > 1
z
ak Γ(k) z−a |z| > |a|
e−at Γ(t) 1
s+a e−akTs Γ(k) z
z−e−aTs
|z| > |a|
Ts e−aTs z
te−at Γ(t) 1
(s+a)2 kTs e−akTs Γ(k) (z−e−aTs )2
|z| > |a|
s z(z−cos(ω0 Ts ))
cos(ω0 t)Γ(t) s2 +ω02
cos(ω0 kTs )Γ(k) z 2 −2 cos(ω0 Ts )z+1 |z| > |1|
ω0 sin(ω0 Ts )z
sin(ω0 t)Γ(t) s2 +ω02
sin(ω0 kTs )Γ(k) z 2 −2 cos(ω0 Ts )z+1 |z| > |1|
• The notation for z found in the table above may differ from that found in other tables. For example, the basic
z-transform of a unit discrete-time step Γ(k) can be written as either of the following two expressions, which are
equivalent:
z 1
Z(Γ(k)) = Γ(z) = =
z−1 1 − z −1
• The ROC for a given sequence x(k), is defined as the range of z for which the z-transform converges. Since the
z-transform is a power series, it converges when x(k)z −k is absolutely summable. Stated differently,
+∞
X
|x(k)z −k | < ∞ must be satisfied for convergence.
k=0
Property 1. if x(k) is of finite duration, then the ROC is the entire z-plane, except possibly z = 0 and/or z = ∞.
N
X
finite sum of geometric series qk = N + 1 if q = 1
k=0
N
X
k 1 − q N +1
q = if q 6= 1
1−q
k=0
N
X 1
infinite sum of geometric series lim qk = if |q| < 1
N →+∞ 1−q
k=0
12
Useful properties of the unilateral z-transform
Some useful properties which have found practical use are summarized below.
final value theorem lim x(k) = lim (z − 1)X(z) if the limit exists
k→+∞ z→1
——————————————————————————————————————
13
Sampled transfer functions of continuous-time systems
Consider a Zero-Order Hold (ZOH) Bo (s) cascaded with a continuous-time transfer function G(s) and a
sampler as shown in Figure ??, the corresponding sampled transfer function is given by:
Y (z) G(s) z−1 G(s)
= Z Bo (s)G(s) = 1 − z −1 Z
GZOH (z) = = Z
U (z) s z s
First-order systems
Consider a continuous-time first-order system given by its Laplace transfer function:
b
G(s) =
s+a
Its equivalent ZOH sampled transfer function is given by:
b1 z −1
−1
b
GZOH (z) = Z Bo (s)G(s) = 1 − z Z =
s(s + a) 1 + a1 z −1
where
a1 = −e−aTs
b
b1 = (1 + a1 )
a
where Ts denotes the sampling period.
Second-order systems
Consider a continuous-time second-order system given by its Laplace transfer function:
a×b
G(s) =
(s + a)(s + b)
then
−1
a×b
GZOH (z) = Z Bo (s)G(s) = 1 − z Z
s(s + a)(s + b)
b1 z −1 + b2 z −2
=
(1 + αz −1 )(1 + βz −1 )
Its equivalent ZOH sampled transfer function is given by:
α = −e−aTs
−bT
β = −e s
b×α−a×β
b1 = +1
b−a
b×β−a×α
b2 =
+α×β
b−a
——————————————————————————————————————
14
PID tuning by using empirical rules
Controller type Kp Ti Td
T
P
Kτ
T
PI 0.9 3τ
Kτ
T
PID 1.2 2τ 0.5τ
Kτ
Table 1: Ziegler-Nichols disturbance rejection tuning rules for a first-order-plus delay model determined from
an open-loop step response
15
Controller type Kp Ti Td
T
P 0.3
τ
T
PI 0.35 1.2T
τ
T
PID 0.6 T 0.5T
τ
Table 2: Chien-Hrones-Reswick setpoint tracking tuning rules for a first-order-plus delay model determined
from an open-loop step response
Appendix 4 - Digital position and velocity forms of the analog PID controller
where T above denotes the sampling period. Either the form of Eq. (26.1) or that of Eq. (26.2) can be used
for digitally implementing the analog PID controller.
16