06 Modelling Discrete Control Systems
06 Modelling Discrete Control Systems
06 Modelling Discrete Control Systems
Introduction
The digital controller requires an up-to-date input value of 𝑒(𝑘) at the start of the k-th run of the algorithm and outputs a
corresponding control value 𝑢(𝑘) to the process at the end of the k-th run. When the rest of the system is discrete this presents
no problems as 𝑒(𝑘) will be available as a value in digital sequence and 𝑢(𝑘) will be in the required form of discrete output.
Typical examples of such a situation are most financial systems such as banks where account balances are updated only at
discrete times intervals.
When the rest of the system is continuous, the controller must be interfaced to the other system components as shown in figure
6.1. Such a system is called a sampled data system.
Figure 6.1
The analogue to digital converter (ADC) produces a sequence of discrete data values {𝑒(𝑘)} from a continuous signal 𝑒(𝑡) by
sampling 𝑒(𝑡) for each run, i.e at discrete times, 𝑡 = 0, 𝑇, 2𝑇, 3𝑇, ⋯ The digital to analogue converter (DAC) turns the sequence
of discrete values {𝑢(𝑘)} produced by the digital algorithm into a continuous signal 𝑢(𝑡), via data extrapolation (or
reconstruction), to the control process. Details of these actions will form the basis of the remainder of this topic.
𝑓(𝑇)
𝑓(2𝑇)
𝑓(𝑡) 𝑓(𝑡)
𝑓(0) 𝑓(3𝑇)
𝑓(4𝑇)
0 t 0 T 2T 3T 4T 0 T 2T 3T 4T kT
t
𝑓(𝑡) 𝑓 ∗ (𝑡)
ADC
Figure 6.2
46
The ideal sampler is represented by the impulse train:
𝛿𝑇 = 𝛿 (𝑡) + 𝛿 (𝑡 − 𝑇) + 𝛿 (𝑡 − 2𝑇) + ⋯ = ∑∞ 𝑘=0 𝛿 (𝑡 − 𝑘𝑇 ) (1)
Or 𝑓 ∗ (𝑡) = ∑∞
𝑘=0 𝑓 (𝑘𝑇 )𝛿 (𝑘 − 𝑘𝑇 ) (2)
When we defined the z-transform in the previous topic we had simply said that z was a suitably well-behaved complex variable.
If we are now more specific and define z as follows:
𝑧 = 𝑒 𝑇𝑠 (4)
The ADC can thus be modelled as an ideal sampler represented by using the z-transform of the continuous input function, i.e.
∑∞
𝑘=0 𝑓 (𝑘𝑇 )𝑧
−𝑘
= 𝐹 (𝑧) = 𝑍[𝑓 (𝑡)] = ℒ[𝑓 ∗ (𝑡)|𝑧=𝑒 𝑇𝑠 ] = 𝐹 ∗ (𝑠)|𝑧=𝑒 𝑇𝑠 (6)
Effects of sampling
In equation (4) we related the s-plane (representing a continuous function) with the z-plane (representing the sampled version
of the function) by:
𝑧 = 𝑒 𝑇𝑠 where T is the sampling period.
This represents a mapping of the s-plane onto the z-plane. Suppose 𝑠 = 𝜎 + 𝑗𝜔 in the s-plane, then:
𝑧 = 𝑒 𝑇𝑠 = 𝑒 𝑇(𝜎+𝑗𝜔 ) = 𝑒 𝜎𝑇 𝑒 𝑗𝜔𝑇 (7)
ln|𝑧| (∠𝑧)
Thus 𝜎= and 𝜔 = (9)
𝑇 𝑇
Example 6.1
For 𝑇 = 1 second what is the mapping of the point 𝑠 = −1 + 𝑗 to the z-plane:
𝜎 = −1 and 𝜔 = 1
Therefore |𝑧| = 𝑒 −1 = 0.368 and ∠𝑧 = 1𝑟𝑎𝑑 or 57°
47
Aliasing
From equation (7):
2𝑛𝜋
𝑧 = 𝑒 𝜎𝑇 𝑒 𝑗𝜔𝑇 = 𝑒 𝜎𝑇 𝑒 𝑗(𝜔𝑇±2𝑛𝜋) = 𝑒 𝜎𝑇 𝑒 𝑗(𝜔± )𝑇
𝑇 = 𝑒 𝜎𝑇 𝑒 𝑗(𝜔±𝑛𝜔𝑠 )𝑇 (10)
2𝜋
where 𝜔𝑠 = rad/s is the sampling frequency.
𝑇
Thus from equation (10), points 𝑠 = 𝜎 ± 𝑗(𝜔 + 𝑛𝜔𝑠 ) in the s-plane, 𝑛 = 0, 1, 2, ⋯ map into the same point z in the z-plane (a
many to one mapping). These sets of s-values represent strips in the s-plane which are:
1. parallel to the real s-axis.
𝜔 𝜔
2. Symmetrical about the primary strip defined by − 𝑠⁄2 ≤ 𝜔 ≤ 𝑠⁄2 as illustrated in figure 6.3.
Im
𝑗5𝜔𝑠⁄ Im
2
COMPLIMENTARY STRIP X
𝑗3𝜔𝑠⁄
2 X
COMPLIMENTARY STRIP X 𝑗𝜔𝑠⁄
2
PRIMARY STRIP X Re Re
0
0
−𝑗𝜔𝑠⁄
COMPLIMENTARY STRIP X
2
−𝑗3𝜔𝑠⁄
COMPLIMENTARY STRIP X 2
−𝑗5𝜔𝑠⁄
2
S-PLANE Z-PLANE
Figure 6.3
𝜔
Hence to avoid aliasing we require 𝑠⁄2 ≥ ℎ𝑖𝑔ℎ𝑠𝑒𝑡𝑠𝑡 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 in the sampled signal, i.e.
𝜔𝑠 ≥ 𝑡𝑤𝑖𝑐𝑒 𝑡ℎ𝑒 ℎ𝑖𝑔ℎ𝑒𝑠𝑡 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 in the sampled signal. (11)
The requirement that 𝜔𝑠 be at least twice as large as the highest frequency (Nyquist frequency) contained in the sampled signal
is known as the sampling theorem. Filtering of the signal before sampling is often required to ensure that the requirements of
the sampling theorem are met. An example of aliasing is shown in figure 6.4.
Actual signal
Aliased signal
0 T 2T
Figure 6.4
If a signal is sampled at intervals of T seconds, it is seen that another frequency with the same set of samples as the original
exists. Thus, the frequency component can be mistaken for another frequency component and this is what aliasing is about.
1. For 𝜎 = 0, then 𝑠 = 𝑗𝜔 → |𝑧| = 1 thus the imaginary s-axis maps into the unit circle in the z-plane.
2. For 𝜎 < 0, then 𝑠 = −|𝜎| + 𝑗𝜔 → |𝑧| = 𝑒 −|𝜎|𝑇 < 1 thus the LH s-plane maps into the interior of the unit z-circle.
48
3. For 𝜎 > 0, then 𝑠 = |𝜎| + 𝑗𝜔 → |𝑧| = 𝑒 |𝜎|𝑇 > 1 thus the RH s-plane maps into the exterior of the unit z-circle.
Im
Im
𝑧 = 𝑒 𝑇𝑠
Unit circle
PRIMARY Re Re
STRIP
S-PLANE Z-PLANE
Figure 6.5
Quantization errors
The analogue-to-digital conversion operation of an ADC has finite resolution due to the finite word-length of its internal register
this being typically 8,10,12 or 16 bits. This introduces quantization errors into the control system. We will assume that the
ADC has been chosen so that its resolution is sufficiently high so as not to impair system accuracy or be incompatible with the
accuracy of the measurement sensors. The ADC also performs the conversion operation in a finite, non-zero time. This may
depend on the number of bits and the technology used. Again, we will assume that the ADC has been suitably selected such
that this conversion time is negligible.
OUTPUT
U(t)
U(4T)
U(0)
U(T) U(3T)
U(2T) U(5T)
t
0 T 2T 3T 4T 5T 6T
Figure 6.6.
49
This process of removing the previous value and then applying the new current value gives the following continuous output:
𝑢(𝑡) = 𝑢(0)[1(𝑡) − 1(𝑡 − 𝑇)] + 𝑢(𝑇)[1(𝑡 − 𝑇) − 1(𝑡 − 2𝑇)] + 𝑢(2𝑇)[1(𝑡 − 2𝑇) − 1(𝑡 − 3𝑇)] + ⋯ (12)
Taking the Laplace transform of each side with zero initial conditions:
1 𝑒 −𝑇𝑠 𝑒 −𝑇𝑠 𝑒 −2𝑇𝑠 𝑒 −2𝑇𝑠 𝑒 −3𝑇𝑠
𝑈 (𝑠 ) = 𝑢 (0 ) [ 𝑠 − ] + 𝑢 (𝑇 ) [ − ] + 𝑢(2𝑇) [ − ]+⋯
𝑠 𝑠 𝑠 𝑠 𝑠
1−𝑒 −𝑇𝑠
𝑈 (𝑠 ) = ( ) [𝑢(0) + 𝑢(𝑇)𝑒 −𝑇𝑠 + 𝑢(2𝑇)𝑒 −2𝑇𝑠 + ⋯ ] (13)
𝑠
1−𝑒 −𝑇𝑠
Thus 𝑈 (𝑠 ) = ( ) 𝑈 ∗ (𝑠 )
𝑠
ZOH
{𝑢(𝑘)} 𝑢 (𝑡 )
From algorithm 𝐺0 (𝑠) To process
𝑈 ∗ (𝑠) 𝑈(𝑠)
Figure 6.7
Occasionally, other more complex forms of DAC are used; these include the first-order hold but we are going to restrict
ourselves to the ZOH during the remainder of this course.
Consider the process 𝐺(𝑠) shown in figure 6.8 which has a sampled input 𝑢∗ (𝑡) and output 𝑦(𝑡) which is also sampled. The
sampling period is T seconds and the input and output are considered to be sampled simultaneously.
𝑢 (𝑡 ) 𝑢 ∗ (𝑡 ) 𝑦 (𝑡 ) 𝑦 ∗ (𝑡 )
𝐺 (𝑠 )
𝑈(𝑠) 𝑈 ∗ (𝑠) 𝑌(𝑠) 𝑌 ∗ (𝑠)
Figure 6.8
Then,
𝑢∗ (𝑡) = ∑∞
𝑛=0 𝑢 (𝑛𝑇 )𝛿 (𝑡 − 𝑛𝑇 ) a sequence of impulses at 𝑡 = 0, 𝑇, 2𝑇, ⋯
Suppose 𝑔(𝑡) = ℒ −1 [𝐺(𝑠)], i.e. 𝑔(𝑡) is the impulse response of the process.
50
Thus, since the process is linear, we can add the outputs resulting from the separate input components in 𝑢(𝑡) to get 𝑦(𝑡), i.e.
input
𝑢∗ (𝑡) = 𝑢(0)𝛿(𝑡) + 𝑢(𝑇)𝛿 (𝑡 − 𝑇) + 𝑢(2𝑇)𝛿(𝑡 − 2𝑇) + ⋯
produces output:
𝑦(𝑡) = 𝑢(0)𝑔(𝑡) + 𝑢(𝑇)𝑔(𝑡 − 𝑇) + 𝑢(2𝑇)𝑔(𝑡 − 2𝑇) + ⋯
Now, 𝑈 (𝑧) = ∑∞
𝑛=0 𝑢 (𝑛𝑇 )𝑧
−𝑛
is the z-transform of input u(t).
Define 𝐺 (𝑧) = ∑∞
𝑛=0 𝑔(𝑛𝑇 )𝑧
−𝑛
as the z-transform of 𝑔(𝑡). (16)
Then
𝐺 (𝑧)𝑈(𝑧) = [𝑔(0) + 𝑔(𝑇)𝑧 −1 + 𝑔(2𝑇)𝑧 −2 + ⋯ ][𝑢(0) + 𝑢(𝑇)𝑧 −1 + 𝑢(2𝑇)𝑧 −2 + ⋯ ]
= 𝑔(0)𝑢(0) + [𝑢(0)𝑔(𝑇) + 𝑢(𝑇)𝑔(0)]𝑧 −1 + ⋯
= 𝑦(0) + 𝑦(𝑇)𝑧 −1 + 𝑦(2𝑇)𝑧 −2 + ⋯
= 𝑌 (𝑧 )
Thus 𝐺(𝑧) can be regarded as the z-transform block of the process where
𝐺 (𝑧) = 𝑍[𝑔(𝑡)] = 𝑍{ℒ −1 [𝐺 (𝑠)]} for 𝑡 = 𝑘𝑇. (17)
𝑈(𝑧) 𝑌(𝑧)
G(z)
Figure 6.9
Note that 𝐺(𝑧) is not 𝐺(𝑠) evaluated for 𝑠 = 𝑧. It is the z-transfer function of the process 𝐺(𝑠) with sampled input and output
and is found as follows:
1. Find 𝑔(𝑡) = ℒ −1 [𝐺 (𝑠)].
2. Put 𝑡 = 𝑘𝑇 to give a sequence {𝑔(𝑘𝑇)}.
3. Find 𝑍{𝑔(𝑘𝑇)} = 𝐺 (𝑧).
In practice, step 2 can be omitted and step 3 done directly from a table of z-transfer functions.
Example 6.2
1
Consider 𝐺 (𝑠) = 𝑠(𝑠+1)
𝑧 𝑧 𝑧(1−𝑒 −𝑇 )
3. 𝐺 (𝑧) = 𝑍{1 − 𝑒 −𝑘𝑡 } = 𝑍{1} − 𝑍{𝑒 −𝑘𝑡 } = 𝑧−1 − 𝑧−𝑒 −𝑇 = (𝑧−1)(𝑧−𝑒 −𝑇 )
51
Alternative approach
An alternative approach to that described above is:
T sec
𝑈(𝑧) 𝑌(𝑧)
ZOH Process 𝐺(𝑧)
𝑢 (𝑘 ) 𝑦 (𝑘 )
𝐺0 (𝑠) 𝐺𝑝 (𝑠)
Figure 6.10
Then if 𝐺(𝑧) is the transfer function of the ZOH + process, from equation (17):
𝐺 (𝑧) = 𝑍{ℒ −1 [𝐺0 (𝑠)𝐺𝑝 (𝑠)]}
(𝑧−1) 𝐺𝑝 (𝑠)
So 𝐺 (𝑧) = 𝑍{ } (20)
𝑧 𝑠
Example 6.3
1
Find 𝐺(𝑧) when 𝐺𝑝 (𝑠) = 𝑠+1
52
Process with a time lag
In the above analysis, if the process includes a lag (or dead-time or transport delay) of 𝑛𝑇 seconds (i.e. n sample periods),
where n is an integer, then the transfer function of the process is of the form 𝑒 −𝑛𝑇𝑠 𝐺𝑝 (𝑠). If a zero-order hold is placed in front
of this process, the combined 𝐺(𝑧) is:
(𝑧−1) 𝑒 −𝑛𝑇𝑠 𝐺𝑝 (𝑠) (𝑧−1) 𝐺𝑝 (𝑠)
𝐺 (𝑧 ) = 𝑍{ }= 𝑧 −𝑛 𝑍 { }
𝑧 𝑠 𝑧 𝑠
(𝑧−1) 𝐺𝑝 (𝑠)
= 𝑍{ } (21)
𝑧 𝑛+1 𝑠
If the time lag is not an integer number of sampling periods then a slightly more complicated analysis is needed which will not
be covered here. However, in many practical control problems the sample time can be chosen to ensure that the time lag is an
integer number of sample times.
Example 6.4
3𝑒 −2𝑠
Find 𝐺(𝑧) when 𝐺𝑝 (𝑠) = , i.e. the process includes a time lag of 2 sampling periods and 𝑇 = 1 second.
𝑠+1
a) SAMPLED PROCESS
b) CASCADED PROCESSES
𝑋 ∗ (𝑠)
𝑈(𝑠) 𝑈 ∗ (𝑠) 𝑌(𝑠) 𝑌 ∗ (𝑠) 𝑈(𝑧) 𝑌(𝑧)
𝐺1 (𝑠) 𝐺2 (𝑠) 𝐺1 (𝑧)𝐺2(𝑧)
𝑋(𝑠)
c) CASCADED SAMPLERS
Figure 6.11.
In (a), 𝑌(𝑠) = 𝐺 (𝑠)𝑈 ∗ (𝑠) so equation (18) gives 𝑌 ∗ (𝑠) = 𝐺 ∗ (𝑠)𝑈 ∗ (𝑠), i.e., 𝑌 (𝑧) = 𝐺 (𝑧)𝑈(𝑧)
In (b), 𝑌 (𝑠) = 𝐺1 (𝑠)𝐺2 (𝑠)𝑈 ∗ (𝑠) which gives 𝑌 ∗ (𝑠) = [𝐺1 𝐺2 (𝑠)]∗ 𝑈 ∗ (𝑠), i.e., 𝑌(𝑧) = 𝐺1 𝐺2 (𝑧)𝑈(𝑧)
Using these rules, a sampled-data system can be reduced correctly to z-transfer block diagrams and simplified as required.
53
Closed loop block diagrams
A complete closed loop, sampled data system is shown in figure 6.12. Although this is a commonly used configuration, and
the one used on this course, it is not the only one. The object of this section is to use the sampling rules discussed so far to
reduce the overall system to a single block with a z-transfer function 𝐹(𝑧). The digital algorithm is represented as 𝐷 ∗ (𝑠).
𝐺 (𝑧 )
𝐵 (𝑠 )
𝐻 (𝑠 )
𝑅 (𝑧 ) 𝑌 (𝑧 )
𝐹 (𝑧 )
Figure 6.12
Then,
∗
𝑌(𝑠) = 𝐺0 𝐺𝑝 (𝑠)𝑈 ∗ (𝑠), i.e., 𝑌 ∗ (𝑠) = [𝐺0 𝐺𝑝 (𝑠)] 𝑈 ∗ (𝑠)
𝑈 ∗ (𝑠 ) = 𝐷 ∗ (𝑠 ) ∗ 𝐸 ∗ (𝑠 )
𝐸 (𝑠 ) = 𝑅 (𝑠 ) − 𝐵 (𝑠 )
𝐸 (𝑠) = 𝑅 (𝑠) − 𝐺0 𝐺𝑝 (𝑠)𝐻(𝑠)𝑈 ∗ (𝑠)
That is,
∗
𝐸 ∗ (𝑠) = 𝑅 ∗ (𝑠) − [𝐺0 𝐺𝑝 𝐻(𝑠)] 𝑈 ∗ (𝑠)
∗
𝐸 ∗ (𝑠) = 𝑅 ∗ (𝑠) − [𝐺0 𝐺𝑝 𝐻(𝑠)] 𝐷∗ (𝑠)𝐸 ∗ (𝑠)
Thus
1
𝐸 ∗ (𝑠 ) = ∗ 𝑅 ∗ (𝑠 )
1+[𝐺0 𝐺𝑝 𝐻(𝑠)] 𝐷∗ (𝑠)
1
𝐸 (𝑧) = 1+𝐷(𝑧)𝐺 𝑅 (𝑧 ) (22)
0 𝐺𝑝 𝐻(𝑧)
54
2. Find the following z-transforms:
(i) Z t cosωt
(ii) Z e at
2
(iii) Z
5
(iv) Z
s5 s(s 2)
4. For the ZOH and process shown find G(z) when G p(s) is:
(i)
4
G(z)
2 1 e 2T
(ii)
4
s2 z e 2T s(s 2)
G(z)
z 2T e 2T 1 1 e 2T 2Te 2T
(z - 1)(z e 2T )
T sec
ZOH Gp(s)
11. Find G(z) for the ZOH and process with a time lag
0.5 sec
ZOH 4e s
s2
1.264
G(z) 2
z z 0.368
12. Find the overall transfer function for the sampled-data system shown below:
G1(s)
13. Find the transfer function for the system shown below for:
1 0.632 e -3s
(i) G p (s) F(z) z 0.264 (ii) G p (s)
s 1 s 1
0.632
F(z) 4
z 0.368 z 0.632
3
T = 1 sec
+
ZOH Gp(s)
-
55
14. In the sampled-data system shown below, find the output y(k) corresponding to a unit step input when:
(i) H(s) 1
y(k) 0.5 1 0.264k (ii)
H(s)
1
y(k) 1.020.795k sin 51k o
s
T = 1 sec
+
ZOH Gp(s)
-
H(s)
56