05 Introduction To Digital Control
05 Introduction To Digital Control
Introduction
The basic aim of any control system is to make the controlled output variable y, produced by some process, behave in a specified
way as defined by the reference variable r. A controller is usually designed to ensure that the output y is as close as possible to
the reference variable r. Figure 5.1 shows the most common form of controller, that of a cascade controller as part of a feedback
control system, in this case the controller operates on the error signal, e, to produce the control signal u.
Controlled variable
Reference + CONTROLLER PROCESS
r(t) y(t)
-
MEASUREMENT
Figure 5.1
In the Part III module it was assumed that the controller is in the form of a continuous time or analogue circuit. An increasingly
common approach is to implement the controller in the form of a computer, microprocessor or microcontroller program. The
advantages of using digital controllers include the following:
greater flexibility and versatility
reduction of noise effects on the system
ability to use advanced control methods
storage of data e.g. for further processing
communication possibilities
increasing system cohesion and integration
possible cost advantages
The remainder of these lecture notes will look at the analysis and design of such digital control systems (often called discrete-
time control systems). It is important to realize that the basic ideas of control theory are common to both continuous-time and
discrete-time control systems, it is the details of analysis and design that may differ.
Because of time limitations we shall restrict ourselves to control algorithms which are linear constant coefficient difference
equations where the corresponding control systems are causal, SISO, and linear time invariant (LTI).
40
New error value, e
DIGITAL New control value, u
Old e values
MEMORY ALGORITHM
DATA Old u values
STORAGE
Figure 5.2
The most common approach and the one we will restrict ourselves to is the clock driven algorithm where the algorithm runs
every T seconds. Additionally, we will assume that the processing time of the algorithm is significantly less than T such that
the new control action occurs simultaneously with the measurement of e. Finally, we will assume that the processor (plus the
ADC and DAC) are all of sufficient word length to make quantization errors negligible. These simplifying assumptions are
reasonable for many real control problems. In cases where they do not apply modification of the basic analysis described here
are covered in textbooks on digital control.
Note that, when the program starts initially, these previous error and control action values must be given initial values, e.g. 0.0.
An equation of this form is called a linear difference equation with constant coefficients and is the form of control algorithm
we will consider in this course.
The Z-transform
The Z-transform does for linear difference equations what the Laplace transform does for linear differential equations, i.e. it
transforms them into polynomial forms which can be operated on using algorithmic methods.
Definition
Given the ordered sequence of numbers
{𝑓(𝑘)} = 𝑓 (0), 𝑓 (1), 𝑓(2), 𝑓(3), ⋯
defined for 𝑘 ≥ 0 (i.e. we assume 𝑓(𝑘) = 0 for 𝑘 < 0) then the one-sided z-transform of this sequence is defined as:
𝑍{𝑓(𝑘)} = 𝐹 (𝑧) = 𝑓 (0) + 𝑓 (1)𝑧 −1 + 𝑓 (2)𝑧 −2 + 𝑓(3)𝑧 −3 + ⋯
Or 𝑍{𝑓(𝑘)} = 𝐹 (𝑧) = ∑∞
𝑘=0 𝑓 (𝑘 )𝑧
−𝑘
(2)
where the complex number z is chosen such that 𝐹(𝑧) converges in some region in the z-plane. For example, for the sequence
{𝑓(𝑘)} = {1,2,3,43 ⋯ }, the z transform is
𝐹(𝑧) = 1 + 2𝑧 −1 + 3𝑧 −2 + 3𝑧 −3 + ⋯
41
The inverse operation is 𝑍 −1 [𝐹(𝑧)] = {𝑓(𝑘)}, 𝑘 = 0, 1, 2, ⋯
If 𝑍{𝑓(𝑘)} = 𝐹 (𝑧) and 𝑍{𝑔(𝑘)} = 𝐺 (𝑧), where a and b are constants, then:
𝑍{𝑎𝑓(𝑘) + 𝑏𝑔(𝑘)} = 𝑎𝑍{𝑓 (𝑘)} + 𝑏𝑍{𝑔(𝑘)} = 𝑎𝐹(𝑧) + 𝑏𝐺 (𝑧) (3)
In particular
𝑍{𝑒 −𝑎𝑘 𝑓(𝑘)} = 𝐹 (𝑒 𝑎 𝑧)
ADVANCE DELAY
f(k+1) f(k) f(k-1)
0 T 2T 3T 4T 5T 0 T 2T 3T 4T 5T 0 T 2T 3T 4T 5T 6T
Figure 5.3
Multiplication by index k
Given that 𝑛 > 0
𝑑 𝑛
𝑍{𝑘 𝑛 𝑓(𝑘)} = (−𝑧 𝑑𝑧) 𝐹(𝑧) for 𝑛 = 1, 2, 3, ⋯ (7)
In particular
𝑑𝐹(𝑧)
𝑍{𝑘𝑓 (𝑘 )} = −𝑧 𝑑𝑧
42
Convolution
𝑍{∑∞𝑛=0 𝑓 (𝑘 − 𝑛 )𝑔(𝑛 )} = 𝑍[𝑓 (𝑘 ) ∗ 𝑔(𝑘 )] = 𝐹 (𝑧)𝐺 (𝑧) (10)
Inverse Z-transform
To find the sequence {𝑓(𝑘)} which corresponds to a given 𝐹(𝑧), either of the following methods may be used.
Partial fractions
𝐴𝑧
Resolve 𝐹(𝑧) into linear factors of the form 𝐹(𝑧) = 𝑧−𝑐 then the required sequence is
{𝑘𝑓(𝑘)} = 𝐴𝑐 𝑘
Long division
𝑁(𝑧)
If the given z-transform is 𝐹(𝑧) = 𝑃(𝑧) then divide out to give 𝐹 (𝑧) = 𝑎0 + 𝑎1 𝑧 −1 + 𝑎2 𝑧 −2 + ⋯ and the required sequence
is thus {𝑓(𝑘} = {𝑎0, 𝑎1, 𝑎2, ⋯ }
𝑐𝑧
i.e. 𝑍{𝑐} = (11)
𝑧−1
Geometric sequence
𝑓(𝑘) = 𝑐 𝑘 , where c is a constant, i.e {𝑓 (𝑘)} = 𝑐 0 , 𝑐 1 , 𝑐 2 , ⋯
1
So 𝐹(𝑧) = 𝑐 0 + 𝑐 1 𝑧 −1 + 𝑐 2 𝑧 −2 + 𝑐 3 𝑧 −3 + ⋯ = (𝑐⁄𝑧)0 + (𝑐⁄𝑧)1 + (𝑐⁄𝑧)2 + ⋯ = 1−(𝑐⁄
𝑧)
𝑧
i.e. 𝑍{𝑐 𝑘 } = 𝑧−𝑐 (12)
𝑧
Thus if 𝑐 = 𝑒 𝑎𝑇 , then 𝑍{𝑒 𝑎𝑇𝑘 } = 𝑧−𝑒 𝑎𝑇 (13)
Ramp sequence
𝑓(𝑘) = 𝑇𝑘 where T is a constant, i.e. {𝑓 (𝑘)} = 0, 𝑇, 2𝑇, 3𝑇, ⋯
𝑇𝑧 −1
So 𝐹(𝑧) = 0 + 𝑇𝑧 −1 + 2𝑇𝑧 −2 + 3𝑇𝑧 −3 + ⋯ = 𝑇𝑧 −1 (1 + 2𝑧 −1 + 3𝑧 −2 + 4𝑧 −3 + ⋯ ) = (1−𝑧 −1)2
𝑇𝑧
i.e. 𝑍{𝑇𝑘} = (𝑧−1)2 (14)
The above z-transforms, together with those of other commonly met sequences, are summarized in the table of z-transforms
provided.
Z-Transfer Functions
The z-transform can be used to model the linear algorithm of equation 1 via a z-transfer function.
Example 5.1
Consider an algorithm of the form: 𝑢(𝑘) = 2𝑒(𝑘) + 𝑒(𝑘 − 1) − 0.5𝑢(𝑘 − 1) − 0.25𝑢(𝑘 − 2)
2+𝑧 −1
Or 𝑈(𝑧) = 1+0.5𝑧 −1 −0.25𝑧 −2 𝐸 (𝑧)
Or multiplying by 𝑧 2 :
𝑧(2𝑧+1)
𝑈(𝑧) = (𝑧 2−0.5𝑧+0.254) 𝐸 (𝑧) = 𝐷(𝑧)𝐸 (𝑧) say,
𝑧(2𝑧+1)
Where 𝐷(𝑧) = (𝑧 2−0.5𝑧+0.254) is a z-transfer function which models the linear digital algorithm.
A z-transfer function is usually the quotient of two polynomials in z, i.e of the form:
𝑁(𝑧)
𝐺 (𝑧) = 𝑄(𝑧)
The zeros of 𝐺(𝑧) are the roots of the equation 𝑁(𝑧) = 0 and the poles of 𝐺(𝑧) are the roots of the equation 𝑄(𝑧) = 0.
𝑄(𝑧) is the characteristic polynomial of 𝐺(𝑧), and 𝑄(𝑧) = 0 is the characteristic equation of 𝐺(𝑧).
Example 5.2
Solve 𝑥(𝑘 + 2) = 3𝑥(𝑘 + 1) − 2𝑥(𝑘) with 𝑥(0) = 0 and 𝑥(1) = 1.
SOLUTION
Take the z-transform of each side using the advance shift property.
𝑧 2 𝑋(𝑧) − 𝑧 2 𝑥(0) − 𝑧𝑥 (1) = 3[𝑧𝑋(𝑧) − 𝑧𝑥(0)] − 2𝑋 (𝑧)
(𝑧 2 − 3𝑧 − 2)𝑋(𝑧) = 𝑧 2 𝑥(0) + 𝑧𝑥(1) − 3𝑧𝑥(0)
𝑧 𝑧 𝑧
So 𝑋(𝑧) = (𝑧−2)(𝑧−1) = (𝑧−2) − (𝑧−1)
Example 4.3
Solve 𝑦(𝑘) = 2𝑒(𝑘) − 𝑦(𝑘 − 1) where 𝑒(𝑘) = 1, i.e a unit step.
SOLUTION
Take the z-transform of each side using the delay shift property:
𝑌(𝑧) = 2𝐸 (𝑧) − 𝑧 −1 𝑌 (𝑧) or (1 + 𝑧 −1 )𝑌 (𝑧) = 2𝐸 (𝑧)
44
2 2𝑧 2𝑧 2 𝑧
So 𝑌(𝑧) = 1+𝑧 −1 𝐸 (𝑧) = 𝑧+1 𝐸 (𝑧) = (𝑧−1)(𝑧+1) as 𝐸 (𝑧) = (𝑧−1)
𝑧 𝑧
Thus 𝑌(𝑧) = 𝑧−1 + 𝑧+1
(i) f(k) e a , (ii) f(k) ke a , (iii) f(k) sin ωk , (iv) f(k) ke ak
3z 3 3z 2
(i) (ii) (iii)
z 1z 2 z 1z 2 z 1z 2
2z 2
(i) u(k) 2e(k) 0.6u(k 1) 0.4u(k 2) D(z) 2
z 0.6z 0.4
z(z 0.5)
(ii) u(k) e(k) 0.5e(k 1) 1.5u(k 1) 0.5u(k 2) D(z) 2
z 1.5z 0.5
5z 2
(i) u(k) 5e(k) 2e(k 1) 2u(k 1) 3u(k 2)
z 1z 3
3z 2 z
(ii) u(k) 3e(k) e(k 1) 1.5u(k 1) 0.5u(k 2)
z 1z - 0.5
5. Determine the output sequence from the following digital algorithm:
u(k) 0.5 2
k
5z
6. Find the values of c(kT) when C(z)= , for k = 0 to 4.
z 3z 2
2
c(kT) e k ln2
1
45