KOM 3781 Discrete-Time Control Systems: Veysel Gazi

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

KOM 3781

Discrete-Time Control Systems

Veysel Gazi
Lecture 3: Sampling and
Reconstruction
Outline

• Sampled-Data Control Systems


• The Ideal Sampler
• Evaluation of the Starred Transform
• Results from the Fourier Transform
• Properties of the Starred Transform
• Data Reconstruction
Sampled-Data Control Systems
For a continuous-time control system

r(t) + e(t) u(t) y(t)


Gc(s) G(s)
-
• Often, digital controllers are more practical
– Cheaper
– Easier to construct
– More quickly revised
• We utilize a sampler (A/D converter) to create
_ a digital
input to the discrete controller.
• We utilize a hold (D/A converter) to create an analog
(i.e., continuous-time) input to the continuous time plant.
r(t) + e(t) u(t) y(t)
A/D Gc(z) D/A G(s)
-
Sampled-Data Control Systems
r(t) + e(t) u(t) y(t)
A/D Gc(z) D/A G(s)
-
Consider the A/D and the D/A components of the system

e(t) e(kT) u(t)


Gc(z) ZOH

• For development purposes let's leave out the controller


for now (i.e., connect the ZOH directly to the sampler).
• We also use the general variable x for the following
analysis
Sampler -
x(t) x(kT) -
x(t) x(t) x(t)
X(s)
ZOH
-
X(s) X(s)
&
ZOH -
X(s)

• This is like sample the signal then reconstruct it.


Sampled-Data Control Systems
In a sampled data control system, discrete signals are held
or reconstructed at specific values, normally changing after
one time interval (sampling period).
The sampled signals are represented as a weighted series
of impulse functions (below the height indicates the
strength or area of the impulse)

0 k
Practical Implementation: An A/D to sample, and a digital
register to hold the value. This is modeled as an ideal
sampler followed by a “zero-order hold” (ZOH).
Ideal Sampler and Zero-Order Hold
x (t ) x(t )

Signal

0 T 2T 3T 4T t
Symbolically, the ideal sampler and ZOH are shown as

0 t 0 k
0 k

x(t ) x *(t ) x (t )
ZOH
X (s) T X *( s)
Ideal Sampler and Zero-Order Hold
x (t ) = x(0) u (t ) − u (t − T )  + x(T ) u (t − T ) − u (t − 2T )  +

 1 e − sT   e − sT e −2 sT 
X ( s ) = x (0)  −  + x(T )  −  +
s s   s s 
1 − e − sT  

− ksT
= x ( kT ) e
 s  0

This equation has several features


1. It is a function of x(t) and T.
2. We call the SUM portion X*(s).
3. Part of it looks like a transfer function.
4. Separately, the two terms have no meaning, but combined,
they form a useful model for the sampler and ZOH.
5. Different x(t) signals may have identical X*(s).
Characteristics of the Ideal Sampler
and Zero-Order Hold
 − ksT  1 − e − sT 
X ( s ) =   x(kT )e   s 
 k =0   
function of x(t) independent
of the input
x(t) x*(t) -
x(t)
X(s)
Sampler
X*(s)
ZOH
-
X(s)

1 − e − sT
 x
k =0
( kT ) e − ksT

s
We cannot consider the sampler & ZOH as TFs independently.
1) The sampler equation is a function of the input.
2) The ZOH equation acts like a transfer function
- but only for a pulse train input (a series of delta functions)
The Ideal Sampler
1 − e − sT   − ksT 

X (s) =    X ( kT ) e  X *( s ) =  x(kT )e − ksT
 s  k = 0  0

1 − e − sT 
X (s) =   X *( s )
 s 

The inverse Laplace transform of X*(s) is

x *(t ) = x(0)(0) + x(T )(t − T ) +

0 T 2T 3T t
The Ideal Sampler
Define

T (t ) =  (t − nT ) = (t ) + (t − T ) + (t − 2T ) +
n =0

Then
x *(t ) = x(t )T (t ) = x(0)(t ) + x(T )(t − T ) + x(2T )(t − 2T ) +
 x(t ), t  0 
with x(t ) =  
 0, t  0 

Then, with x(kT) = x(kT+) at the discontinuities


 
x *(t ) =  x(t )(t − nT ) = x(t ) (t − nT ) = x(t )T (t )
n =0 n =0

X *( s ) =  x(nT )e − nTs
n =0
Example
Let x(t) = u(t) (unit step) Find X*(s)

Then x(nT) = 1 for all n (n = 0,1,2…) and



X *( s ) =  x(nT )e − nTs = x(0) + x(T )e −Ts + x(2T )e −2Ts +
n =0

= 1 + e −Ts + e −2Ts + e −3Ts +

1
from = 1 + x + x 2 + x3 + ... for x  1
1− x

1
X *( s ) = for e −Ts  1 For a unit step input
1 − e −Ts
Example
Let x(t ) = e − t u (t ) Find X*(s)

Then

X *( s ) =  x(nT )e − nTs
= x(0) + x(T )e −Ts
+ x(2T )e −2Ts
+ .....
n =0

= 1 + e −T e −Ts + e −2T e −2Ts + e −3T e −3Ts + .....


− (1+ s )T − (1+ s )T 2 − (1+ s )T 3
= 1+ e + (e ) + (e ) + ....
1 − (1+ s )T
= − (1+ s )T
for e 1
1− e
For a decaying exponential input
Example 
X *( s ) =  x(kT )e − ksT
Find X*(s) when x(t) = sin(ωt) 0

X *( s ) = sin(0)e0 + sin(T )e − sT + sin(2T )e −2 sT +


e j T − e − j T − sT e j 2 T − e − j 2 T −2 sT
= 0+ e + e +
j2 j2
1 j T − sT
= e e + e j 2 T e −2 sT + e j 3 T e −3sT + 
j2
1 − j T − sT
− e e + e − j 2 T e −2 sT + e − j 3 T e −3sT + 
j2
e j T e − sT
= 1 + e j T e − sT + e j 2 T e −2 sT + 
j2
e − j T e − sT
− 1 + e − j T e − sT + e − j 2 T e −2 sT + 
j2
Example
Utilizing 1
1− x
= 1 + x + x 2 + x 3 + ... for x 1

e jT e− sT  1  e − jT − sT
e  1 
X *( s) = −
j 2 1 − e jT e − sT  j 2 1 − e − jT e − sT 
After some manipulation
e − sT sin(T )
X *( s ) =
1 − 2e − sT cos(T ) + e −2 sT

From the similarity between this expression and z-transform


z sin( T ) z −1 sin( T )
sin( t ) = 2 =
z − 2 z cos( T ) + 1 1 − 2 z −1 cos( T ) + z −2

We see that −1 −Ts is a mapping between


z =e the s and the z planes
More on X*(s)

At this point, X*(s) was defined as an infinite series.



X *( s ) =  x(kT )e − ksT
0

It will be useful to express X*(s) in closed form (for our


development).
More on X*(s)
1. Residue Method
[most useful for evaluating X*(s) ]

  1 
X *(s ) =   residues of X ()  1 − e −T (s − )  
poles _ of _ X (  )   

2. Periodic Laplace Transform Method


[most useful for theoretical development]

1  x(0)
X *( s) =   X ( s + jk s )  +
k =−  T  2
2
where s = = 2f s
T
Example
  1    1 
 residues of X (  )  −T ( s −  )  
= (  −  )  X (  )  −T ( s −  )  
 1− e  1− e
1
    =1     =1

Residue Method
− t A
Let x(t ) = Ae , then X ( s) =
s +
Applying the residue method
 A 1   A 
X *( s) =  Res −T ( s −  ) 
= ( +  ) −T ( s −  ) 
 (  +  ) (1 − e )   =−  (  +  )(1 − e )   =−

 A  A
= −T ( s −  ) 
= −T ( s + )
 (1 − e )   =− 1 − e

Set A = α = 1 to get the same result as before.


Example
1
Let X ( s ) =
( s + 1)( s + 2)
Applying the residue method
1 1
with X ( ) =
1 − e −T ( s − ) ( + 1)( + 2)(1 − e −T ( s − ) )
  1 
X *( s ) =  
poles _ of _ X (  ) 
residues of X (  ) 
 1− e
−T ( s −  )  


= (residue) =−1 + (residue)  =−2


 1   1 
= ( + 1) −T ( s −  ) 
+  (  + 2) −T ( s −  ) 
 (  + 1)(  + 2)(1 − e )   =−1  (  + 1)(  + 2)(1 − e )   =−2
1 1
= −
1 − e −T ( s +1) 1 − e −T ( s + 2)
Example
 
Let x(t ) = sin t , then X ( s) = =
s 2 + 2 ( s + j)( s − j)
Applying the residue method
1 
with X () =
1 − e −T ( s − ) ( + j)( − j)(1 − e −T ( s − ) )
  1 
X *( s ) =  
poles _ of _ X (  ) 
residues of X (  ) 
 1− e
−T ( s − )  


     
= ( − j) −T ( s − ) 
+ ( + j)
 (  + j)(  − j )(1 − e )   = j  ( + j)( − j)(1 − e −T ( s − ) )   =− j
1  1 1  e −Ts sin T
= −  = 1 − 2e −Ts cos T + e −2Ts
2 j 1 − e −Ts e jT 1 − e −Ts e − jT
Example
1
Let x(t ) = (1 − e − t ) , then X ( s) =
s ( s + 1)
Applying the residue method
 1  1 
X *( s ) =   residues of  −T ( s −  )  
(  = 0, −1)   (  + 1)  1 − e 

 1 1  1 1 
= −T ( s −  ) 
+   1 − e −T ( s − ) 
 (  + 1) 1 − e   =0  =−1

1 1
= −
1 − e −Ts 1 − e −T ( s +1)
X*(s) and DELAY
Consider the case in which x(t) contains a time delay

x(t) = x1(t – t0) u(t – t0) where [x1(t)] = X1(s)

From the shifting property of the Laplace Transform

t0 s t0 s
X ( s) e x1 (t ) e X1 ( s)

For the special case where t0 = kT (shift of whole sample


periods), we have
  1 

*
e − kTs
X 1 ( s )  = e − kTs  residues of X (  )  −T ( s − )  

1
poles _ of _ X (  )   1 e 
Example The previous example
with a unit delay

Let x(t ) = (1 − e − ( t −1) ) u (t − 1)


e− s e− s e− s 1
Then X ( s ) = − = Let X 1 ( s) =
s s + 1 s ( s + 1) s ( s + 1)
Applying the residue method T = 0.5, k = 2
t0 = kT = 1 delay
− kTs
 X 1 (s) =e −s
 X 1 (s)
* *
e
 1  1 
= e   residues of
−s
 −T ( s − ) 
( = 0, −1)   (  + 1)  1 − e 

from the previous example

=e −s  1 1  (1− e ) e−0.5 −1.5 s

1 − e −Ts − 1 − e −T ( s +1)  = 1 − e


( )(1 − e
−0.5 s −0.5( s +1)
)
Results from the Fourier Transform
The Fourier transform is defined as
[ x(t )] X ( j) –
x(t )e – jt dt

The Laplace transform is given by

[ x(t )] X ( s) 0
x(t )e – st dt

For x(t) = 0 for t < 0:


X ( j)
0
[ x(t )] –
x(t )e – jt dt x(t )e – jt dt
0

0
x(t )e – jt dt [ x(t )] |s j

Thus, in general
[ x(t )u (t )] [ x(t )u (t )] |s j
Results from the Fourier Transform
The plot of X ( j) gives the frequency spectrum of x(t).
X ( j) | X ( j)|e j( j) | X ( j)| ( j)
For analog systems with input x(t), output y(t), and transfer
function G(s) (provided that the initial conditions are zero)
Y ( s) G ( s) X ( s)
If x(t) is a unit impulse function, then Y(s) = G(s) and
–1
y (t ) g (t ) [G ( s )]
For a causal system, g(t) = 0 for t < 0. A practical system
cannot respond before an input is applied. Consequently, for
a causal system, the Fourier transform of the unit impulse
response G(jω) is the Laplace transform G(s) with s
replaced by jω.
For a causal system Y ( j) G( j) X ( j)
Properties of the “Starred” Transform
1. X*(s) is periodic in s, with period jωs. To show this

X *( s ) =  x(kT )e − ksT
0


X *( s + jms ) =  x(nT )e − nT ( s + jms )
n =0
 
=  x(nT )e − nTs − jnTms
e =  x(nT )e − nTs = X *( s )
n =0 n =0

Holds because

e − jnTms = e − jnm ( sT ) = e − jnm (2  ) = 1

for m an integer.
Properties of the “Starred” Transform
2. If X(s) has a pole at s = s1,
then X*(s) has poles at s = s1 + jmωs (m = 0, ±1, ±2, . . .)

This follows from


1  x(0) 2
X *( s ) =   X ( s + jns )  + s = = 2f s
T n =− 2 T

1  1

T n =−
X ( s + jns ) = [X ( s ) + X ( s + js ) + X ( s + j 2s ) +
T
+ X ( s − js ) + X ( s − j 2s ) + ]

However, the zeros of X*(s) do not necessarily follow from


the zeros of X(s).
Properties of the “Starred” Transform
Consider the sampling theorem

Example Spectrum of X(s) | X ( j ) |


1

–ωs/2 0 ωs/2 
Properties of the “Starred” Transform
The spectrum of the corresponding stared transform is
1/T

-ωs -ωs/2 0 ωs/2 ωs ω


If now we reduce the sampling frequency ωs we get
1/T

-ωs -ωs/2 0 ωs/2 ωs 3ωs/2 ω


Properties of the “Starred” Transform
This demonstrates the Nyquist Sampling Theorem, which
states that the highest frequency signal component must be
less than half of the sampling frequency. In other words, if
a signal has components to 20 kHz, a sampling frequency of
40 kHz or more must be used.

Practical suggestion:
• Select fs to be 5 to 10 times faster than the highest
frequency in the signal being sampled.
• For system’s identification, select fs to be 20 to 40
times faster.
Example
Consider the sinusoids f1 = sin(7t/4) and f2 = – sin(t/4)

On the plot, the red dots indicate the sampling interval set
at T = 1s. It would appear, then, that both functions have
the same X*(s) when both are sampled at this time interval.
Example
Plotting in MATLAB
>> T=1;
t=linspace(0,8,801); % Plot resolution is 0.01 s
f1=sin(7*pi*t/4);
f2=-sin(pi*t/4);
plot(t,f1,t,f2), grid
Data Reconstruction
1 − e − sT 
The Zero-Order Hold X (s) =   X *( s )
 s 

X ( s ) = Gho ( s ) X *( s )
• The ZOH has a “transfer function”
− sT
1− e
Gho ( s ) =
s
which, along with the sampling function accurately and
practically describes the sample and hold function.

• Many signals could have the same X*(s).


• The overall sampling process is thus described by the
combination (product) of the ZOH TF and X*(s).
Zero-Order Hold
1 − e − sT
Gho ( s ) =
s
• The ZOH forces the approximation
x(t) = x(kT), kT ≤ t < (k+1)T,
• For each sample period, the ZOH transforms an impulse
into a pulse
xin (t ) =  (t )
(t)
area = 1 X in ( s) = 1

0 T t

1 xout (t ) = u (t ) − u (t − T )
area = T 1 e − sT 1 − e − sT
X out ( s ) = − =
s s s
0 T t
Frequency Response of ZOH
1 − e − jT  1 − e − jT  2T j2T − j2T 1 − e − sT
Gho ( j ) =  =  e e Gho ( s ) =
 j   j  2T
s
 + j2T − jT
 − jT
 e − e 2
  2    T   2  − j2T
=T  e
2
= T  sin    e
 2j   T    2  T 
 
− j 
sin(  / s ) s
=T e
  / s Plotting in MATLAB
>> T=2;
arg Gho (angle) = ws=2*pi/T;
w=linspace(-2.5*pi,2.5*pi,251);
− / s , sin( )  0 w1=T*sin(pi*w/ws);
− / s +  , sin( )  0 w2=pi*w/ws;
magzoh=abs(w1./w2);
plot(w,magzoh), grid
Magnitude of ZOH
T

0.637T
0.637T

T/2

−2ωs −ωs −ωs/2 ωs/2 ωs 2 ωs


Example
5
Find the starred transform of X (s) =
s ( s + 1)

Three ways to find the starred transform of


1) Series: X *( s ) =  x(kT )e- ksT
0

  1 
2) Residues: X *( s ) =   residues X ( )  1 − e −T ( s − )  
poles _ of _ X (  )   

3) z-Transform: X *( s ) = X ( z ) z −1 =e− Ts
Example 5
E ( s) =
Determined previously s( s + 1)
using the residue method
Residues
 1 1   e −Ts (1 − e −T ) 
X * ( s) = 5  −Ts
−  = 5 −Ts −T 
 1− e 1 − e −T ( s +1)   (1 − e −Ts
)(1 − e e )

z-Transform  a   z (1 − e − aT ) 
 s ( s + a )  =  ( z − 1)( z − e − aT ) 
   

5 z (1 − e −T )  z −1 (1 − e −T ) 
X ( z) = = 5  −1 −T 
( z − 1)( z − e −T )  (1 − z −1
)(1 − z e )
 z −1 (1 − e −T )   e −Ts (1 − e −T ) 
X * ( s) = 5  −1 −1 −T 
= 5 −Ts −Ts −T 
 (1 − z )(1 − z e )  z −1 =e− Ts  (1 − e )(1 − e e )

You might also like