DIGITAL CONTROL (EEEE 789)
Dr. AbdullaIsmail
Professor of Electrical Engineering
[email protected]
Course Outline (Topics):
Introduction to Digital Control
Discrete Time Systems & Difference Equations
The Z-transform
Impulse Response and Step response of Discrete-Time
Systems
Modeling Digital Control Systems
Frequency Response of Discrete-Time Systems
Steady-State Error Computation for Digital Control Systems
Stability of Digital Control Systems
Digital Control System Design
State-Space Analysis of Discrete-Time Systems
Digital Control
Modeling Digital Control Systems
As in the case of analog control, mathematical models are needed for the
analysis and design of digital control systems.
A common configuration for digital control systems is shown in Figure 1.
The configuration includes a digital-to-analog converter (DAC), an
analog subsystem, and an analog-to-digital converter (ADC).
The DAC converts numbers calculated by a microprocessor or computer
into analog electrical signals that can be amplified and used to control an
analog plant.
The analog subsystem includes the plant as well as the amplifiers and
actuators necessary to drive it.
Figure 1
3
Digital Control
Modeling Digital Control Systems
The output of the plant is periodically measured and converted to a
number that can be fed back to the computer using an ADC.
Here, we develop models for the various components of this digital
control configuration.
Many other configurations that include the same components can be
similarly analyzed.
We begin by developing models for the ADC and DAC, then for the
combination of DAC, analog subsystem, and ADC.
4
Digital Control
Modeling Digital Control Systems
ADC Model
The ADC can be modeled as an ideal
sampler with sampling period T as shown
in Figure 2.
DAC Model
The input-output relationship of the DAC is given by
(1)
where {u(k)} is the input sequence.
This equation describes a zero-order hold (ZOH),
shown in Figure 3..
Figure 2.
5
Digital Control
Figure 3
Modeling Digital Control Systems
ADC
DAC
Digital Control
Modeling Digital Control Systems
Other functions may also be used to construct an analog
signal from a sequence of numbers.
For example, a first-order hold constructs analog signals in
terms of straight lines, whereas a second-order hold
constructs them in terms of parabolas.
In practice, the DAC requires a short but nonzero interval to
yield an output; its output is not exactly equal in magnitude
to its input and may vary slightly over a sampling period.
But the model given in (1) is sufficiently accurate for most
engineering applications.
The zero-order hold is the most commonly used DAC model
and is adopted in most digital control texts.
7
Digital Control
Modeling Digital Control Systems
Transfer Function of the ZOH
To obtain the transfer function of the ZOH, we replace the number or
discrete impulse shown in Figure 3 below by an impulse (t).
The transfer function can then be obtained by Laplace transformation
of the impulse response.
As shown in the figure, the impulse response is a unit pulse of width
T.
A pulse can be represented as a positive step at time zero followed by
a negative step at time T, i.e. u(kT) u(kT+T)
Digital Control
Modeling Digital Control Systems
Transfer Function of the ZOH
Figure. (a) Input signal to an ideal sampler. (b) Output signal of an ideal
sampler. (c) Output signal of a zero-order-hold (ZOH) device.
Digital Control
Modeling Digital Control Systems
Transfer Function of the ZOH
Using the Laplace transform of a unit step and the time
delay theorem for Laplace transforms,
Thus, the transfer function of the ZOH is
Next, we consider the frequency response of the ZOH:
10
Digital Control
Modeling Digital Control Systems
Transfer Function of the ZOH
We rewrite the frequency response in the form
We now have
11
Digital Control
Modeling Digital Control Systems
Transfer Function of the ZOH
The angle of frequency response of the ZOH hold is seen to decrease
linearly with frequency, whereas the magnitude is proportional to the
sinc function.
As shown in Figure 4, the
magnitude is oscillatory with its
peak magnitude equal to the
sampling period and occurring at
the zero frequency.
Digital Control
Figure 4
12
Modeling Digital Control Systems
Effect of the Sampler on the Transfer Function of a Cascade
In a discrete-time system including several analog
subsystems in cascade and several samplers, the location
of the sampler plays an important role in determining the
overall transfer function.
Figure 5
Assuming that interconnection does not change the
mathematical models of the subsystems, the Laplace
transform of the output of the system of Figure 5 is given
by
13
Digital Control
Modeling Digital Control Systems
Effect of the Sampler on the Transfer Function of a Cascade
Thus, the equivalent impulse response for the cascade is given
by the convolution of the cascaded impulse responses.
14
Digital Control
Modeling Digital Control Systems
Effect of the Sampler on the Transfer Function of a Cascade
The same conclusion can be reached by inversetransforming the product of the s-domain transfer functions.
The time domain expression shows more clearly that
cascading results in a new form for the impulse response.
The output of the system is sampled to obtain
For a linear time invariant (LTI) system with impulsesampled input, the output is given by
15
Digital Control
Modeling Digital Control Systems
Effect of the Sampler on the Transfer Function of a Cascade
Changing the order of summation and integration gives
Sampling the output yields the convolution summation
This is the equivalent to the following z-transform
Digital Control
16
Modeling Digital Control Systems
Effect of the Sampler on the Transfer Function of a Cascade
Example 1
Find the equivalent sampled impulse response sequence
and the equivalent z-transfer function for the cascade of
the two analog systems with sampled input
1. If the systems are directly connected.
2. If the systems are separated by a sampler.
Solution
1. In the absence of samplers between the systems, the
overall transfer function is
17
Digital Control
Modeling Digital Control Systems
Effect of the Sampler on the Transfer Function of a Cascade
Example 1 .. Solution
The impulse response of the cascade is
and the sampled impulse response is
Thus, the z-domain transfer function is
2. If the analog systems are separated by a sampler, then
each has a z-domain transfer function and the transfer
functions are given by
18
Digital Control
Modeling Digital Control Systems
Effect of the Sampler on the Transfer Function of a Cascade
Example 1 .. Solution
19
Digital Control
Modeling Digital Control Systems
DAC, Analog Subsystem, and ADC Combination Transfer Function
The cascade of a DAC, analog subsystem, and ADC,
shown is shown in Figure below.
Because both the input and the output of the cascade are
sampled, it is possible to obtain its z-domain transfer
function in terms of the transfer functions of the individual
subsystems as follows
20
Digital Control
Modeling Digital Control Systems
DAC, Analog Subsystem, and ADC Combination Transfer Function
Using the DAC model given before, and assuming that the
transfer function of the analog subsystem is G(s), the
transfer function of the DAC and analog subsystem
cascade is
The corresponding impulse response is
21
Digital Control
Modeling Digital Control Systems
DAC, Analog Subsystem, and ADC Combination Transfer Function
This impulse response is the analog system step response
minus a second step response delayed by one sampling period.
This response is shown in Figure shown below for a secondorder underdamped analog subsystem.
Figure: Impulse
response of a DAC and
analog subsystem.
(a) Response of an
analog system to step
inputs. (b) Response of
an analog system to a
unit pulse input.
22
Digital Control
Modeling Digital Control Systems
DAC, Analog Subsystem, and ADC Combination Transfer Function
This analog response is sampled to give the sampled
impulse response
By z-transforming, we obtain the z-transfer function of the
DAC (zero-order hold), analog subsystem, and ADC (ideal
sampler) cascade
The equation can be rewritten more concisely as
23
Digital Control
Modeling Digital Control Systems
DAC, Analog Subsystem, and ADC Combination Transfer Function
Example 2
Find GZAS(z) for the cruise control system for the vehicle
shown in Figure 1, where u is the input force, v is the velocity
of the car, and b is the viscous friction coefficient.
Solution
We first draw a schematic to represent the cruise control
system as shown in Figure right.
Using Newtons law, we obtain the following model:
Digital Control
24
Modeling Digital Control Systems
Example 2 .. Solution
which corresponds to the following transfer function:
We rewrite the transfer function in the form
25
Digital Control
Modeling Digital Control Systems
DAC, Analog Subsystem, and ADC Combination Transfer Function
Example 2 .. Solution
The corresponding partial fraction expansion is
where
Using
and the z-transform table,
the desired z-domain transfer function is
We simplify to obtain the transfer function
26
Digital Control
Modeling Digital Control Systems
DAC, Analog Subsystem, and ADC Combination Transfer Function
Example 3
Find GZAS(z) for the series R-L circuit shown
in Figure with the inductor voltage as
output.
Solution
Using the voltage divider rule gives
Hence, using
,we obtain
27
Digital Control
Modeling Digital Control Systems
The Closed-Loop Transfer Function
The closed-loop digital control system is given block
diagram of Figure 1.
The block diagram includes a comparator, a digital
controller with transfer function C(z), and the ADC-analog
subsystem-DAC transfer function GZAS(z).
The controller and comparator are actually computer
programs and replace the computer block in Figure 2.
Figure 1
Digital Control
Figure 2
28
Modeling Digital Control Systems
The Closed-Loop Transfer Function
The block diagram is identical to those commonly
encountered in s-domain analysis of analog systems with
the variable s replaced by z.
Hence, the closed-loop transfer function for the system is
given by
and the closed-loop characteristic equation is
The roots of the equation are the closed-loop system poles,
which can be selected for desired time response
specifications as in s-domain design.
Digital Control
29
Modeling Digital Control Systems
The Closed-Loop Transfer Function
Example 4
Find the Laplace transform of the analog and sampled
output for the block diagram of Figure below.
Solution
The analog variable x(t) has the Laplace transform
which involves three multiplications in the s-domain.
In the time domain, x(t) is obtained after three convolutions.
30
Digital Control
Modeling Digital Control Systems
The Closed-Loop Transfer Function
Example 4 .. Solution
From the block diagram
Substituting in the X(s) expression, after sampling, then
gives
Thus, the impulse-sampled variable x*(t) has the Laplace
transform
These terms are obtained by inverse Laplace transforming,
impulse sampling, and then Laplace transforming the
impulse-sampled waveform.
Digital Control
31
Modeling Digital Control Systems
The Closed-Loop Transfer Function
Example 4 .. Solution
Next, we solve for X*(s):
and then E(s)
With some experience, the last two expressions can be
obtained from the block diagram directly.
The combined terms are clearly the ones not separated
by samplers in the block diagram.
Digital Control
32
Modeling Digital Control Systems
The Closed-Loop Transfer Function
Example 4 .. Solution
From the block diagram the Laplace transform of the
output is Y(s) = G(s)D(s)E(s).
Substituting for E(s) gives
Thus, the sampled output is
With the transformation z = est, we can rewrite the
sampled output as
33
Digital Control
Modeling Digital Control Systems
Disturbances in a Digital System
Disturbances are uncontrolled variables that have
undesirable effects on the system response response.
They can be deterministic, such as load torque in a position
control system, or stochastic, such as sensor or actuator
noise.
However, almost all disturbances are analog and are inputs
to the analog subsystem in a digital control loop.
Digital Control
34
Modeling Digital Control Systems
Disturbances in a Digital System
Consider the system with disturbance input shown in
Figure below
The Laplace transform of the impulse-sampled output is
(1)
Solving for Y*(s), we obtain
35
Digital Control
Modeling Digital Control Systems
Disturbances in a Digital System
The denominator involves the transfer function for the
zero-order hold, analog subsystem, and sampler.
We can therefore rewrite (1) using the notation of
as
or in terms of z as
Digital Control
36
Modeling Digital Control Systems
Disturbances in a Digital System
Example
Consider the block diagram shown below with the
transfer functions
Find the steady-state response of the system to an impulse
disturbance of amplitude A.
Digital Control
37
Modeling Digital Control Systems
Disturbances in a Digital System
Example.. Solution
We first evaluate
The z-transform of the corresponding impulse response
sequence is
Digital Control
38
Modeling Digital Control Systems
Disturbances in a Digital System
Example.. Solution
Using
we obtain the transfer function
From
we obtain the sampled output
To obtain the steady-state response,
we use the final value theorem
Digital Control
39
Modeling Digital Control Systems
Steady-State Error and Error Constants
Here, we consider the unity feedback block diagram shown in
Figure 1in the next slide subject to standard inputs and determine
the associated tracking error in each case.
The standard inputs considered are the sampled step, the sampled
ramp, and the sampled parabolic.
As with analog systems, an error constant is associated with each
input, and a type number can be defined for any system from which
the nature of the error constant can be inferred.
All results are obtained by direct application of the final value
theorem.
E(z) = R(z) Y(z)
Digital Control
40
Modeling Digital Control Systems
Steady-State Error and Error Constants
From Figure 2, the tracking error is given by
where L(z) denotes the loop gain of the system.
Applying the final value theorem yields the steady-state error
Digital Control
Figure 2
Figure 1
41
Modeling Digital Control Systems
Steady-State Error and Error Constants
The limit exists if all (z 1) terms in the denominator
cancel.
This depends on the reference input as well as on the
loop gain.
To examine the effect of the loop gain on the limit, rewrite
it in the form
where N(z) and D(z) are numerator and denominator
polynomials, respectively, with no unity roots.
The following definition plays an important role in
determining the steady-state error of unity feedback
systems.
Digital Control
42
Modeling Digital Control Systems
Steady-State Error and Error Constants
The loop gain of
has n poles at unity and is therefore type n.
These poles play the same role as poles at the origin for an
s-domain transfer function in determining the steady-state
response of the system.
Note that s-domain poles at zero play the same role as zdomain poles at e0 or 1.
Digital Control
43
Modeling Digital Control Systems
Steady-State Error and Error Constants
Substituting from
in the error expression of e() to give
Next, we examine the effect of the reference input on the
steady-state error.
Digital Control
44
Modeling Digital Control Systems
Steady-State Error and Error Constants
Sampled Step Input
The z-transform of a sampled unit step input is
Substituting in
gives the steady-state
error
The steady-state error can also be written as
where Kp is the position error constant given by
Examining
shows that Kp is finite for type
0 systems and infinite for systems of type 1 or higher.
Therefore, the steady-state error for a sampled unit step
input is
45
Digital Control
Modeling Digital Control Systems
Steady-State Error and Error Constants
Sampled Ramp Input
The z-transform of a sampled unit ramp input is
Substituting in
gives the steady-state error
where Kv is the velocity error constant.
The velocity error constant is thus given by
46
Digital Control
Modeling Digital Control Systems
Steady-State Error and Error Constants
Sampled Ramp Input
From the above expression for e(), the velocity error
constant Kv is zero for type 0 systems, finite for type 1
systems and infinite for type 2 or higher systems.
The corresponding steady state error is
Digital Control
47
Modeling Digital Control Systems
Steady-State Error and Error Constants
Sampled Parabolic Input
Similarly, it can be shown that for a sampled parabolic
input, an acceleration error constant given by
can be defined, and the associated steady-state error is
Digital Control
48
Modeling Digital Control Systems
Summary of the error constants and the steady-state error
due to a Step input
due to a Ramp input
due to a Parabolic or
Exponential input
Digital Control
49
Modeling Digital Control Systems
Steady-State Error and Error Constants
Example 1
Find the steady-state position error for the digital position
control system with unity feedback and with the transfer
functions
Solution
The loop gain of the system is given by
The system is type 1.
50
Digital Control
Modeling Digital Control Systems
Steady-State Error and Error Constants
Example 1 .. Solution
Therefore, it has zero steady-state error for a sampled
step input and a finite steady-state error for a sampled
ramp input given by
Clearly, the steady-state error is reduced by increasing
the controller gain and is also affected by the choice of
controller pole and zero.
Digital Control
51
Modeling Digital Control Systems
Steady-State Error and Error Constants
Example 2
Find the steady-state error for the analog system
Solution
The transfer function of the system can be written as
Thus, the position error constant for analog control is K/a,
and the steady-state error is
52
Digital Control
Modeling Digital Control Systems
Steady-State Error and Error Constants
Example 2 .. Solution
For digital control, it can be shown that for sampling
period T, the DAC-plant-ADC z-transfer function is
Thus, the position error constant for digital control is
and the associated steady-state error is the same as that of
the analog system with proportional control.
In general, it can be shown that the steady-state error for
the same control strategy is identical for digital or analog
implementation.
53
Digital Control
Modeling Digital Control Systems
MATLAB Commands
The transfer function for the ADC, analog subsystem, and
DAC combination can be easily obtained using the MATLAB.
Assume that the sampling period is 0.1 s and that the transfer
function of the analog subsystem is G.
The MATLAB command to obtain a digital transfer function
from an analog transfer function is
where num is a vector containing the numerator coefficients of the analog
transfer function in descending order, and den is a similarly defined vector
of denominator coefficients.
54
Digital Control
Modeling Digital Control Systems
MATLAB Commands
For example, the numerator polynomial (2s2 + 4s + 3) is
entered as
The term method specifies the method used to obtain
the digital transfer function.
For a system with a zero-order hold and sampler (DAC
and ADC), we use
For a first-order hold, we use
55
Digital Control
Modeling Digital Control Systems
BACKUP SLIDES
Digital Control
56
The Sampling Theorem
Sampling is necessary for the processing of analog data using
digital elements.
Successful digital data processing requires that the samples reflect
the nature of the analog signal and that analog signals be
recoverable, at least in theory, from a sequence of samples.
Figure 1 shows two distinct waveforms with identical samples.
Obviously, faster sampling of the two waveforms would produce
distinguishable sequences.
Thus, it is obvious that sufficiently fast sampling is a
prerequisite for successful digital data processing.
The sampling theorem gives a lower bound on the
sampling rate necessary for a given band-limited
signal (i.e., a signal with a known finite bandwidth).
57
Digital Control
The Sampling Theorem
58
Digital Control
The Sampling Theorem
59
Digital Control
The Sampling Theorem
60
Digital Control
The Sampling Theorem
61
Digital Control
The Sampling Theorem
with F denoting the Fourier transform, can be reconstructed from the
discrete-time waveform
The spectrum of the continuous-time waveform can be recovered
using an ideal low-pass filter of bandwidth b in the range
62
Digital Control
The Sampling Theorem
Selection of the Sampling Frequency
In practice, finite bandwidth is an idealization associated with infiniteduration signals, whereas finite duration implies infinite bandwidth.
To show this, assume that a given signal is to be band limited. Band
limiting is equivalent to multiplication by a pulse in the frequency
domain.
By the convolution theorem, multiplication in the frequency domain is
equivalent to convolution of the inverse Fourier transforms.
Hence, the inverse transform of the band-limited function is the
convolution of the original time function with the sinc function, a
function of infinite duration.
We conclude that a band-limited function is of infinite duration.
In practice, the sampling rate chosen is often larger than the
lower bound specified in the sampling theorem. A rule of thumb
is to choose s as
The choice of the constant k depends on the application.
63
Digital Control
MATLAB Files
c2d
Convert model from continuous to discrete time
Syntax
sysd = c2d(sys,Ts)
sysd = c2d(sys,Ts,method)
sysd = c2d(sys,Ts,opts)
[sysd,G] = c2d(sys,Ts,method)
[sysd,G] = c2d(sys,Ts,opts)
Sys is Continuous-time
dynamic system model
Sysd is Discrete-time
dynamic system model
Ts is Sampling Time
Description
sysd = c2d(sys,Ts) discretizes the continuous-time dynamic system model sys using zero-order
hold on the inputs and a sample time of Ts seconds.
sysd = c2d(sys,Ts,method) discretizes sys using the specified discretization method method.
sysd = c2d(sys,Ts,opts) discretizes sys using the option set opts, specified using the
c2dOptions command.
[sysd,G] = c2d(sys,Ts,method) returns a matrix, G that maps the continuous initial conditions x0
and u0 of the state-space model sys to the discrete-time initial state vector x [0]. method is
64
optional. To specify additional discretization options, use [sysd,G] = c2d(sys,Ts,opts).
MATLAB Files
Example
Discretize the continuous-time transfer function:
with input delay Td = 0.35 second. To discretize this system using the triangle (firstorder hold) approximation with sample time Ts = 0.1 second, type
H = tf([1 -1], [1 4 5], 'inputdelay', 0.35);
Hd = c2d(H, 0.1, 'foh'); % discretize with FOH method and
% 0.1 second sample time
Transfer function:
0.0115 z^3 + 0.0456 z^2 - 0.0562 z - 0.009104
--------------------------------------------z^6 - 1.629 z^5 + 0.6703 z^4
Sampling time: 0.1
Digital Control
65
MATLAB Files
Example
The next command compares the continuous and discretized step responses.
step(H,'-',Hd,'--')
Digital Control
66
MATLAB Files
d2c Converts discrete-time dynamic system to continuous time.
SYSC = d2c(SYSD,METHOD)
computes a continuous-time model SYSC that approximates the discretetime model SYSD. The string METHOD selects the conversion method
among the following:
'zoh'
Zero-order hold on the inputs
'foh'
Linear interpolation of inputs
'tustin' Bilinear (Tustin) approximation
'matched' Matched pole-zero method (for SISO systems only)
The default is 'zoh' when METHOD is omitted.
Digital Control
67
MATLAB Files
Example
Consider the discrete-time model with transfer function
and sample time Ts = 0.1 s.
You can derive a continuous-time zero-order-hold equivalent model by typing
Hc = d2c(H)
Discretizing the resulting model Hc with the default zero-order hold method and
sampling time Ts = 0.1s returns the original discrete model H(z):
c2d(Hc,0.1)
To use the Tustin approximation instead of zero-order hold, type
Hc = d2c(H,'tustin')
As with zero-order hold, the inverse discretization operation
c2d(Hc,0.1,'tustin')
gives back the original H(z).
Digital Control
68