You are on page 1of 19

DISCRETE-TIME SYSTEMS AND

DIGITAL CONTROLLERS
In practice controllers are nowadays almost exclusively
implemented digitally. This means that the controller ope-
rates in discrete time, although the controlled systems
usually operate in continuous time.
Therefore, the digital controller has to be connected to
the system by interfaces which:
• transform the continuous-time system output y(t) to
a discrete sequence {yk } which the digital controller
can process, and
• transform the digital control sequence {uk } to a continuous-
time control signal u(t) sent to the system.

2
A typical digital control system is shown in the figure.

rk ek uk uH (t) u(t) y(t) yk


- g - Gd - D/A - H - Gp - A/D -
+ 6

Here:
• Gp is the system to be controlled.
• Gd is the digital controller.
• The block A/D transforms the continuous-time (ana-
log) system output y(t) to a discrete-time (digital)
sequence yk , k = 0, 1, 2, . . ..
• The block D/A transforms the (digital) control se-
quence uk , k = 0, 1, 2, . . . to a continuous-time (ana-
log) control signal uH(t).
• H is a filter to smooth out discontinuities due from
the digital-to -analog transformation.

3
The system output y(t) has first to be sampled at discrete
time instants kh in an A/D (analog-to-digital) transfor-
mer to generate a discrete sequence,
yk = y(kh), k = 0, 1, 2, . . .
Here h is the sampling time.
Sampling of a continuous-time signal implies loss of infor-
mation, since several analog signals can give rise to the
same discrete-time signal
Example: Sampling of three different sinusoidal signal
give the same discrete sequence (’o’).

4
Therefore, an analog low-pass prefilter is used to filter out
high frequency components before sampling:

y(t) yf (t) yk
- F - A/D -

The digital controller Gd then takes the sequence ek =


rk − yk , k = 0, 1, 2, . . . as its input to generate a discrete-
time control sequence uk , k = 0, 1, 2, . . ..

The discrete-time control sequence uk is then transfor-


med to a continuous-time control signal uH(t) using a
D/A (digital-to-analog) transformer. Typically the D/A
transformer generates a piecewise constant control signal
given by
uH (t) = uk , kh ≤ t < kh + h
Finally, the discontinuities in uH(t) are smoothed out by
a continuous-time filter H.
See figure:

5
XN

uk uH (t) u(t)
- D/A - H - NK

VH U

6
Digital controllers
The continuous-time standard P-, I-, PI- and PID-controllers
can be generalized in a straightforward way to obtain
their discrete-time counterparts:
Discrete-time (digital) P-controller:
uk = Kpek
Digital I-controller:
k

uk = Ki en
n=1

Digital PID-controller:
k

uk = Kpek + Ki en + Kd [ek − ek−1]
n=1

The digital PID-controller is usually implemented using


the so-called velocity form,
uk = uk−1+Kp [ek − ek−1]+Kiek +Kd [ek − 2ek−1 + ek−2]
which is obtained by subtracting uk−1 from uk .
An advantage of the velocity form is that there is no need
to keep track of the sum.

7
Discrete-time systems
In order to study systems under digital control we should
describe how the sampled, discrete-time, system output
yk depends on the discrete-time input uk .
The discrete-time counterpart of continuous-time systems
described by differential equations are systems described
by difference equations.
A first-order discrete-time system is described by the dif-
ference equation
yk+1 + ayk = buk
Similarly, a second-order discrete-time system is descri-
bed by the difference equation
yk+2 + a1yk+1 + a2yk = b1uk+1 + b2uk

Remark:
Observe that the systems above are discrete-time systems,
but not digital, as the signals real numbers.
A digital system has the additional property that the
signals and parameters are represented digitally.

8
Discrete-time transfer functions
The theory for continuous-time dynamical systems has a
counterpart for discrete-time systems.
In particular, instead of the differential operator, we can
for discrete-time systems define the forward shift opera-
tor q such that
qyk = yk+1
Then the first-order system
yk+1 + ayk = buk
takes the form
qyk + ayk = buk
or
b
yk = uk
q+a
Here
b
G[q] =
q+a
is the discrete-time transfer function.

9
Similarly, the second-order system
yk+2 + a1yk+1 + a2yk = b1uk+1 + b2uk
can be written as
q 2yk + a1qyk + a2yk = b1quk + b2uk
or
yk = G[q]uk
where
b1 q + b2
G[q] =
q 2 + a1 q + a2

10
Response of discrete-time systems
In analogy with continuous-time systems, the response of
a discrete-time systems is obtained by solving the diffe-
rence equation.
Example - First-order system
As a simple example, we can determine the output of the
first-order system
yk+1 + ayk = buk
By applying the system equation recursively to compute
y1, y2, . . . , yk we obtain
k−1

k
yk = (−a) y0 + (−a)k−n−1bun
n=0

In particular, the step response for the input uk = ustep


with initial condition y0 = 0 is
k−1

yk = (−a)k−n−1 b ustep
n=0
( )
= 1 − a + (−a) + (−a) + · · · + (−a)
2 3 k−1
b ustep
1 + (−a)k
= b ustep
1+a

The response of second-order and higher-order discrete-


time systems can be determined in a way similar to the
continuous-time case.
11
Stability
The above example shows that the output of the first-
order system remains bounded for bounded inputs if and
only if |a| < 1.
Equivalently, the pole qp = −a of the transfer function
b
G[q] =
q+a
should be less than 1 in magnitude.
This feature generalizes to higher-order discrete-time systems,
and we have:
A discrete-time system is stable if and only if all the po-
les qp,i of its transfer function G[p] (i.e., the zeros of its
denominator) satisfy |qp,i| < 1.
Observe that for second and higher order systems, the
poles may be complex numbers, and |qp,i| is then the
absolute value of this complex number.

12
Backward shift operator
An alternative to the forward shift operator q is to use
the backward shift operator q −1, such that
q −1yk = yk−1
Then the first-order system
yk+1 + ayk = buk
or, equivalently,
yk + ayk−1 = buk−1
takes the form
yk + aq −1yk = bq −1uk−1
or
bq −1
yk = uk = G[q]uk
1 + aq −1
where the discrete transfer function G[q] is given by
bq −1
G[q] =
1 + aq −1
Expressing G[q] in terms of q (instead of q −1), we have
b
G[q] =
q+a
which is the same expression as before.
13
Construction of discrete-time models for
continuous-time systems

When dealing with digital controller, an important ques-


tion is to construct a discrete-time model which rela-
tes the inputs, u(t) and d(t), to the sampled outputs
yk = y(kh) of a system described by a differential equa-
tion.
Example – consider the first-order system
dy(t)
+ ay(t) = bu(t) + cd(t)
dt
A simple way to construct an approximate discrete-time
model is to introduce the finite-difference approximation
dy(t) 1
≈ [y(t + h) − y(t)]
dt h
Using this approximation at time t = kh would give the
discrete-time approximation
1
[y(kh + h) − y(kh)] + ay(kh) = bu(kh) + cd(kh)
h
or
y(kh + h) + (ha − 1)y(kh) = hbu(kh) + hcd(kh)

14
Second derivative: similarly, a finite-difference approxi-
mation of a second derivative is given by

 
2
dy (t) 1  y(t + h) − y(t) y(t) − y(t − h) 
≈  − 
dt2 h h h
1
= 2 [y(t + h) − 2y(t) + y(t − h)]
h

Problems with finite-difference approximations of the de-


rivatives:
• the resulting discrete-time model is often not very
accurate.
• the discrete-time model may be unstable even though
the original system is stable, or vice versa. For examp-
le, in the above first-order example, the continuous-
time system is stable if a > 0, but the discrete-time
model will be unstable if the sampling time is too
long, so that ha − 1 > 1 (or h > 2/a) holds.

15
Tustin’s method (bilinear transform)
A more accurate way to discretize a continuous-time sy-
stem is to use the trapezoidal rule.
Again, we illustrate the method on the first-order system
dy(t)
+ ay(t) = bu(t)
dt
(omitting d(t) for simplicity).
Given y(kh) at time t = kh, we obtain y(kh + h) by
integration:
∫ kh+h
y(kh + h) = y(kh) + kh
[−ay(τ ) + bu(τ )] dτ
Here we can approximate the integral using the
trapezoidal rule:
∫ t t2 − t1
t1
2
f (τ )dτ ≈ [f (t2) + f (t1)]
2

16
This gives:
∫ kh+h
I = kh
[−ay(τ ) + bu(τ )] dτ
h
≈ [−ay(kh) + b(kh) − ay(kh + h) + b(kh + h)]
2
Introducing the approximation into the expression for
y(kh):
h
y(kh + h) = y(kh) + [−ay(kh) + bu(kh)
2
−ay(kh + h) + bu(kh + h)]
Solving for y(kh + h):
1 − ah/2 bh/2
y(kh+h) = y(kh)+ [u(kh + h) + u(kh)]
1 + ah/2 1 + ah/2
or
yk+1 + adyk = bduk+1 + bduk
where
1 − ah/2 bh/2
ad = − , bd =
1 + ah/2 1 + ah/2

17
There is an interesting and important relation between
the transfer function of the continuous-time system and
the discrete-time transfer function of the discretized sy-
stem obtain by the trapezoidal approximation.
Recalling the transfer function of a discrete-time system,
the discrete-time system can be expressed as
y(kh) = G[q] u(kh)
where the transfer function is given by
bd q + bd
G[q] =
q + ad
bh/2 q+1
= ×
1 + ah/2 q − 1−ah/2
1+ah/2

This can be simplified to:


b
G[q] = 2 q−1
h q+1 +a
Recalling that the original continuous-time system has
the transfer function
b
G(p) =
p+a
we see that G[q] and G(p) are related by according to:
G[q] = G(p)|p= 2 q−1
h q+1

18
This property can be generalized, so that approximating
the solution of a linear differential equation by the tra-
pezoidal rule is equivalent to substituting the differential
operator p in the continuous-time transfer function by
2q −1
p=
hq + 1
to obtain the corresponding discrete-time transfer func-
tion.
This transformation is known as the Tustin transform
or the bilinear transform.
An important and valuable property of the transforma-
tion is that it preserves stability properties. We have:
The discrete-time system G[q] = G(p)|p= 2 q−1
h q+1

is stable if and only if


the continuous-time system G(p) is stable

19

You might also like