You are on page 1of 39

Lecture-5

Discrete Time Modeling


(Part-ii)

Nebiyu Tenaye
Addis Ababa University
Addis Ababa Institute of Technology
School of Electrical & Computer Engineering

Digital Control Systems


ECEG-5352
May, 2017
Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 1 / 39
Overview

Overview
1 Overview
2 Objective
3 Hybrid Control Systems
4 Properties of Sampled Data Systems
5 Discretization Methods
Forward Difference
Backward Difference
Trapezoidal (Tustin) Rule
6 Notes on Discretization Methods
7 Zero Order Hold
8 First Order Hold
9 System Modeling with MATLAB

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 2 / 39


Objective

Lecture Objectives

In this lecture you will learn the following:


The properties of sampled data systems,
The different discretization techniques,
The First-Order Hold (ZOH), and
Modeling tools in Matlab.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 3 / 39


Hybrid Control Systems

Hybrid Control Systems

In practice, several analog controllers and a number of micro-


controllers / control computers (which are synchronized by the
same clock) may be utilized as a part of a complex control scheme.
From the stand-point of control engineering, it is highly desirable
to develop equivalent (discrete-time) transfer functions
representing the essential features of such control systems.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 4 / 39


Properties of Sampled Data Systems

Properties of Sampled Data Systems

Property 1: (sampled signal)

Y (z) = Z{Y ∗ (s)}

Property 2: (re-sampled signal)

Y ∗ (s) = [Y ∗ (s)]∗
Y (z) = Z{Y ∗ (s)}

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 5 / 39


Properties of Sampled Data Systems

Property 3: (summation of sampled signals)

Y ∗ (s) = Y1∗ (s) ± Y2∗ (s) ± Y3∗ (s) ± · · · Yn∗ (s)


Y (z) = Z{Y1∗ (s)} ± Z{Y2∗ (s)} ± Z{Y3∗ (s)} ± · · · Z{Yn∗ (s)}
Y (z) = Y1 (z) ± Y2 (z) ± Y3 (z) ± · · · Yn (z)

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 6 / 39


Properties of Sampled Data Systems

Property 4: (sampled response)

Y (s) = G(s)X(s)
Y ∗ (s) = [G(s)X(s)]∗
Y (z) = Z{G(s)X(s)}

Notice that: Y ∗ (s) 6= G∗ (s)X ∗ (s)

Property 5: (sampled impulse response)

Y (s) = G(s)X ∗ (s)


Y ∗ (s) = [G(s)X ∗ (s)]∗
Y ∗ (s) = [G(s)]∗ X ∗ (s) = G(s)∗ X ∗ (s)

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 7 / 39


Properties of Sampled Data Systems

Property 6: (Cascaded impulse responses))

Y ∗ (s) = G∗n (s) · · · G∗2 (s)G∗1 (s)X ∗ (s)


Y (z) ≡ Gn (z) · · · G2 (z)G1 (z)X(z)

Property 7: (sampled impulse response of a cascaded system)

Y ∗ (s) = [Gn (s) · · · G2 (s)G1 (s)X ∗ (s)]∗


Y ∗ (s) = [Gn (s) · · · G2 (s)G1 (s)]∗ X ∗ (s)
Y ∗ (s) = Z{Gn (s) · · · G2 (s)G1 (s)}X(z)

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 8 / 39


Properties of Sampled Data Systems

Example (1)

Consider the block diagram of the illustrated system. Obtain the


following transfer functions:
(a) B(z)/R(z)
(b) Y (z)/R(z)

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 9 / 39


Properties of Sampled Data Systems

Example (1)
Solution:
(a) Using Property 3:
E ∗ (s) = R∗ (s) − B ∗ (s) ⇒ E(z) = R(Z) − B(z)
From Property 5:
M ∗ (s) = [Gc (s)E ∗ (s)]∗ = G∗c (s)E ∗ (s) ⇒ M (z) = Gc (Z)E(z)
where Gc (z) ≡ Z{G∗c (s)} = Z{Gc (s)}
Similarly, property 7 yields:
B ∗ (s) = [H(s)Gp (s)Gzoh (s)M ∗ (s)]∗
B ∗ (s) = [H(s)Gp (s)Gzoh (s)]∗ M ∗ (s) ⇒ B(z) = G(z)M (z)
where G(z) ≡ Z{H(s)Gp (s)Gzoh (s)}

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 10 / 39


Properties of Sampled Data Systems

Example (1)
Combining the previous (boxed) three equations gives:

[1 + G(z)Gc (z)]B(z) = G(z)Gc (z)R(z)

Thus
B(z) G(z)Gc (z)
=
R(z) 1 + G(z)Gc (z)

where

Gc (z) ≡ Z{Gc (s)}


G(z) ≡ Z{H(s)Gp (s)Gzoh (s)}

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 11 / 39


Properties of Sampled Data Systems

Example (1)
(b)

To obtain the desired transfer function Y (z)/R(z), a f ictitious


sampler must be added to the system.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 12 / 39


Properties of Sampled Data Systems

Example (1)
Using Property 3:
E ∗ (s) = R∗ (s) − B ∗ (s) ⇒ E(z) = R(z) − B(z)

From Property 5:
M ∗ (s) = [Gc (s)E ∗ (s)]∗ = G∗c (s)E ∗ (s) ⇒ M (z) = Gc (z)E(z)
where Gc (z) ≡ Z{G∗c (s)}

Similarly, property 7 yields:


Y ∗ (s) = [Gp (s)Gzoh (s)M ∗ (s)]∗
Y ∗ (s) = [Gp (s)Gzoh (s)]∗ M ∗ (s) ⇒ Y (z) = G1 (z)M (z)
where G1 (z) ≡ Z{Gp (s)Gzoh (s)}

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 13 / 39


Properties of Sampled Data Systems

Example (1)
Finally, property 7 gives:
B ∗ (s) = [H(s)Gp (s)Gzoh (s)M ∗ (s)]∗
B ∗ (s) = [H(s)Gp (s)Gzoh (s)]∗ M ∗ (s) ⇒ B(z) = G(z)M (z)
where G(z) ≡ Z{H(s)Gp (s)Gzoh (s)}

Dividing the previous (boxed) two equation results:

B(z) G(z)
= ≡ G2 (z)
Y (z) G1 (z)

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 14 / 39


Properties of Sampled Data Systems

Example (1)
Combining the previous equation with boxed equations of E(z),
M (z) and Y (z) gives:

Y (z) = G1 (z)Gc (z)[R(z) − G2 (z)Y (z)]

Thus
Y (z)[1 + G1 G2 (z) Gc (z)] = G1 (z)Gc (z)R(z)
| {z }
G(z)

Y (z) G1 (z)Gc (z)


=
R(z) 1 + G(z)Gc (z)

where, Gc (z) ≡ Z{Gc (s)}


G1 (z) ≡ Z{Gp (s)Gzoh (s)}
G(z) ≡ Z{H(s)Gp (s)Gzoh (s)}
Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 15 / 39
Discretization Methods

Discretization Methods

The design of control system consists of two main steps:


The mathematical model of the plant is obtained to analyze its
behavior.
Using the model, an appropriate controller is designed to get the
desired response from the controlled system.

In continuous-time domain, the dynamics of the plant are


represented by a set of differential equations.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 16 / 39


Discretization Methods

In control literature, there exist various approximation techniques


to convert such equations conveniently into discrete-time forms
without utilizing z-transforms.
The methods discussed here approximate the time derivative
(d/dt) in ODE using a corresponding difference equation:

1. Forward difference (Euler’s rule)


2. Backward difference
3. Trapezoidal (integration) rule
Also known as Tustin or bilinear transformation

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 17 / 39


Discretization Methods Forward Difference

1. Forward Difference
Utilizing the definition of derivative, we have
dx ∼ x((k + 1)T ) − x(kT ) x(k + 1) − x(k)
= = (1)
dt (k + 1)T − kT T
In terms of forward time-shift operator q:
dx ∼ q − 1 d ∼ q−1
= x(k) ⇒ = (2)
dt T dt T
Since d/dt corresponds to s variable while q operator is equivalent
to z variable, equation-2 can be rewritten as:
z−1
s∼
= (3)
T
The s-variable in the transfer function is conveniently replaced by
this expression leading to a new transfer function of z:
 
0 ∼ z−1
G (z) = G s = (4)
T
Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 18 / 39
Discretization Methods Backward Difference

2. Backward Difference
Utilizing the definition of derivative, we have
dx ∼ x(kT ) − x((k − 1)T ) x(k) − x((k − 1))
= = (5)
dt kT − (k − 1)T T
In terms of Backward time-shift operator q −1 :
dx ∼ 1 − q −1 d ∼ 1 − q −1
= x(k) ⇒ = (6)
dt T dt T
As d/dt corresponds to s variable while q −1 operator is equivalent
to z −1 variable, equation-6 can be rewritten as:
z−1
s∼
= (7)
Tz
The s-variable in the transfer function is to be replaced by this
expression leading to a new transfer function of z:
 
0 ∼ z−1
G (z) = G s = (8)
Tz
Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 19 / 39
Discretization Methods Trapezoidal (Tustin) Rule

3. Trapezoidal (Tustin) Rule


Let u(t) = dx/dt. The trapezoidal integration rule leads to

x((k + 1)T ) = x(kT ) + T2 [u((k + 1)T ) + u(kT )]


x((k + 1)T ) − x(kT ) = T2 [u((k + 1)T ) + u(kT )]
in terms of q:
(q − 1)x(k) = T2 (q + 1)u(k)

dx ∼ 2 q − 1 d 2 q−1
u(k) = = · · x(k) ⇒ = ·
dt T q+1 dt T q+1
As d/dt corresponds to s variable 2 q−1
while q operator is equivalent to z s∼
= · (9)
T q+1
variable, we have:  
0 ∼ 2 q−1
Therefore, G (z) = G s = · (10)
T q+1
Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 20 / 39
Notes on Discretization Methods

Notes on Discretization Methods

The discretization techniques discussed here approximate the


dynamics of a continuous plant better when the sampling intervals
are kept short.
Forward- and backward difference methods are quite vulnerable to
long sampling periods.
Despite its complexity, the Tustin transformation yields the best
results in most cases.
Since short sampling periods are essential for the successful
application of these techniques, the dynamics of output interfaces
(like ZOH) could be neglected under such circumstances.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 21 / 39


Notes on Discretization Methods

Example (2)

Consider the ODE representing the dynamics of a plant:

d2 y dy
+ 3 + 2y = x(t)
dt2 dt
If T = 0.01 s, obtain the discrete-time models for this system using
the following techniques:
(a) Forward difference
(b) Backward difference
(c) Tustin transformation
(d) Z-transform with ZOH

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 22 / 39


Notes on Discretization Methods

Example (2)
The transfer function of this plant in s-domain becomes:

Y (s) 1
(s2 + 3s + 2)Y (s) = X(s) ⇒ = 2
X(s) s + 3s + 2

(a) Forward Difference:


1
1
G0 (z) ∼
= = 10000
z−1 2 z−1 z 2 − 1.9700z + 0.9702
 
T +3 T +2

(b) Backward Difference:


1 2
1 10302 z
G0 (z) ∼
= =
z−1 2 z−1 z 2 − 1.9705z + 0.9707
 
zT +3 Tz +2

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 23 / 39


Notes on Discretization Methods

Example (2)
(c) Tustin Transformation:

1
1 40601 (z + 1)2
G0 (z) ∼
= 2 =
z 2 − 1.9700z + 0.9704
 
4 z−1 6 z−1
T 2 z+1
+ T z+1 +2

Be careful when rounding numbers in these transfer functions. Since


we are dealing with relatively small numbers, make sure to perform all
calculations to the highest precision and then display at least 4 digits
after decimal point!

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 24 / 39


Notes on Discretization Methods

Example (2)
(d) ZOH:

1 − e−sT 1 − e−sT
   
1 1 1
G(s) = = −
s2 + 3s + 2 s s+1 s+2 s
n  o n  o
1−e−sT
G0 (s) = Z 1
s+1 − 1
s+2 s = (1 − z −1 )Z 1
s+1 − 1
s+2 s
1

From Z-transform tables:


1 −1 −2T )
z −1 (1 − e−T ) 2 z (1 − e
G0 (z) = −
1 − z −1 e−T 1 − z −1 e−2T

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 25 / 39


Notes on Discretization Methods

Example (2)
Hence,
B1 z −1 + B2 z −2
G0 (z) =
1 − z −1 (e−T + e−2T ) + z −2 e−3T

where
1
B1 ≡ (1 − e−T ) − 1 − e−2T

2
1
B2 ≡ e−T 1 − e−2T − e−2T (1 − e−T )

2

In terms of the numerical values, the final value will be:

(4.9503 × 10−5 )z + 4.9010 × 10−5


G0 (z) =
Z 2 − 1.9702 + 0.9704

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 26 / 39


Notes on Discretization Methods

Why Z-transforms?

If compared to the discretization techniques discussed here,


the model development efforts in the previous lecture appear
to be tedious!
However, notice that the discrete-time models (with ZOH)
developed via z-transform techniques are NOT
approximations.
Independent of sampling rate, the outputs of such models
exactly match to those of their continuous-time counterparts
at sampling instances.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 27 / 39


Zero Order Hold

Zero Order Hold


Zero-order-hold (ZOH) is the interface
between the digital and analog world.
Consists of a latch and a D/A
converter:
Latch unit holds the binary
signals for one sampling period
(T),
D/A unit converts the binary
representation into a
corresponding output voltage.
Very simple and easy to implement!
If the sampling rate is too slow, the
output of a ZOH looks like a sequence
of boxcars.
Some information is lost during the
process,
Adelay of (T/2) is introduced.
Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 28 / 39
First Order Hold

First Order Hold

First-order-hold (FOH) and other


higher-order methods are developed to
overcome the representation difficulties
associated with ZOH.
FOH (or so called ramp-invariant hold)
does a simple linear interpolation
between m(k) and m(k + 1).
It generates a corresponding output
voltage m(t) when kT < t < (k + 1)T .

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 29 / 39


First Order Hold

Transfer Function of FOH

The FOH performs interpolation between sampling instances:


t − kT
m(t) = m(k) + [m(k + 1) −m(k)] (11)
T | {z }
future value

where kT < t < (k + 1)T . Without further elaboration, the


transfer function of a FOH can be simply given as:

(1 − e−sT )2 1 (1 − z −1 )2 1
GF OH (s) = · = · 2 (12)
T e−sT s2 T z −1 s
Since it requires the future (one-step ahead) value of its input
m(k), it is very difficult to implement it in practice.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 30 / 39


First Order Hold

Practical Implementation of FOH

Industry-standard “casual”
realization of a FOH interface
employs “extrapolation”
techniques.
When kT < t < (k + 1)T , the
slope of the output waveform
is [m(k) − m(k − 1)]/T .
The corresponding transfer
function of this practical
implementation differs from
the one given previously.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 31 / 39


System Modeling with MATLAB

System Modeling with MATLAB

Matlab provides excellent toolbox functions to model/design


control systems.
The following Matlab functions are commonly used for this
purpose:
tf: to create the transfer functions of both continuous-time and
discrete-time systems.
c2d: to convert continuous-time models into discrete- time ones.
impulse/step: to simulate the response of a system to
impulse/step inputs.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 32 / 39


System Modeling with MATLAB

MATLAB Functions

To illustrate the use of these functions, let us revisit our previous


example:

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 33 / 39


System Modeling with MATLAB

MATLAB Functions Continued

One can define a transfer function in z-domain as well:

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 34 / 39


System Modeling with MATLAB

MATLAB Functions Continued

To convert the continuous-time model into a discrete-time one:

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 35 / 39


System Modeling with MATLAB

MATLAB Functions Continued

To simulate the response of


this system to a step-input:

Other Matlab functions that


might interest you at this
point: poly, roots,
residue.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 36 / 39


System Modeling with MATLAB

Example (3)

(Q.) If T = 0.01 s, obtain the transfer function B(z)/M (z) for the
given system using MATLAB.

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 37 / 39


System Modeling with MATLAB

Example (3)

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 38 / 39


Questions?

Nebiyu Tenaye (AAiT/SECE) Lecture-5 May, 2017 39 / 39

You might also like