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

KOM 3781

Discrete-Time Control Systems

Veysel Gazi
Lecture 4: Open-Loop and
Closed-Loop Discrete-Time
Systems
Outline
• The Relationship between X(z) and X*(s)
• The Pulse Transfer Function
• Open-Loop Systems Containing Digital Filters
• Closed-Loop Systems
• State-Variable Models
• Review of Continuous-Time State Variables
• Discrete-Time State Equations
• Practical Calculations
Relationship between X(z) and X*(s)
Recall that
• X*(s) is a periodic (sampled) form of X(s)
• X(s) may be recovered from X*(s) provided ωs > 2ωmax

Recall, from the Sample-ZOH derivation that


− kTs  1 − e 
− sT
 x(t )
X ( s ) =   x(kT )e  
x (k )
 S/ZOH
 0  s  X (s) X (s)
X *( s ) ZOH X ( z) X ( z)

Where 
X *( s ) =  x(kT )e − kTs = x(0) + x(T )e −Ts + x(2T )e −2Ts + ....
0

Also, recall the definition of the z-transform



X ( z ) =  x(k ) z − k = x(0) + x(1) z −1 + x(2) z −2 + ....
0
Relationship between X(z) and X*(s)
   1 − e − sT
 x(t )
X ( s ) =   x(kT )e  
− kTs x (k )
 S/ZOH
 0  s  X (s) X (s)
X *( s ) ZOH X ( z) X ( z)

Then we have
X *( s ) = X ( z ) z =esT or X ( z ) = X *( s) esT = z

Therefore, we can go to the table of z-transforms and


easily find the starred transform X*(s) from X(z).
Starred and z-transforms
So far, we have applied the residue theorem to evaluate
two functions
(1) x(k ) = 
at poles
 residues of X ( z ) z k −1 
of X ( z ) z k −1

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

One can derive a third from (2), by the substitution of esT = z


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

X ( z ) = X *( s) esT = z
Starred and z-transforms
We make the transition between X*(s) and X(z) in the
frequency domain with the substitution esT = z.

1 
X *( s ) = 
k =−
 T X ( s + jk  )
s 

From the definition of z
z = esT = e(σ+jω)T = eσTejωT = rejωT X*(s)
+3rd
Band
with the mapping between the z and s
planes defined by z = esT (with r = eσT). + 2nd
Band
z1=eσ1T e jω1T z-plane X(s) poles = σ1±jω1 s-plane ws
2
- jω1 - jω1

σ1 Primary
σ1
Band
- –jω1
- –jω1 ws
-
z2=eσ1T e–jω1T 2
– 2nd
Band
Example jω
X(s)
1 Sketch pole-zero configuration s-plane
Let: X ( s ) =
( s + 1)( s + 2) of X(s), X*(s), X(z) x x 
–2 –1

We found X*(s) before as


eTs (e −T − e −2T )
X *( s) = Ts −T Ts −2T X*(s)
+3rd
(e − e )(e − e ) Band

3w s
−T −2T
z (e − e ) o
X ( z ) = X *( s) eTs = z =
2

( z − e −T )( z − e −2T ) x x
+ 2nd
X(z) –2 –1 Band
z-plane Maps into ws
z =e–2T o 2
each band

o x x
Primary
x x Band
–2 –1
z=0 z =e–T ws
o -
2
–2nd
Band
Example Summary
(1) Poles of the Laplace transform map one-to-one from
the s-plane to the z-plane, and map one-to-many to the
sampled s-plane.

(2) Zeros of the Laplace transform do not map one-for-


one from the s-plane to either the z-plane or to the
sampled s-plane.

(3) The z-plane poles and zeros map into each band (strip)
of the sampled s-plane.
The Pulse Transfer Function
Consider an Ideal Sampler and Zero-Order Hold followed
by a plant
x(t ) x *(t ) x (t ) y (t )
T
Gho(s) Gp(s)
X (s) X *( s ) X (s) Y (s)
G(s)
T
Y*(s)
Y(s) = Gho(s)Gp(s)X*(s) = G(s)X*(s)
note that G(s)
Find the sampled output contains a ZOH
Y*(s) assuming y(0) = 0
1  y (0)
Y *( s ) = G ( s ) X *( s) * =  Y ( s + jns )  +
T − 2
1 
=  G ( s + jns ) X *( s + jns ) 
T n =−
The Pulse Transfer Function
1 
Y *( s ) =  G ( s + jns ) X *( s + jns ) 
T n =−
But X *( s + jns ) = X *( s )
1  
So Y *( s ) = X *( s )   G ( s + jns ) 
 T n =− 
= X *( s )G *( s )
Y *( s ) = G ( s ) X *( s ) * = G *( s) X *( s)

Recall X *( s ) = X ( z ) z −1 =e− Ts
The discrete (pulse)
Transfer Function (TF)
So X ( z ) = X *( s ) eTs = z
Y ( z)
Then Y ( z ) = G ( z ) X ( z ) G( z) =
X ( z)
Sample/Hold Step Response
x(t ) x *(t ) x (t )
T
Gho(s)
X (s) X *( s) X (s) As derived
before
   1 − e − sT
 for x(t ) = u (t )
X ( s ) =   x(kT )e  
− kTs

 0  s  X *( s ) =
1
1 − e −Ts
X *( s ) ZOH
− sT x (t ) = u (t )
 1  1− e 1 x(t) = u(t)
X (s) =  − sT 
=
1 − e  s s
x (t ) = u (t ) = u (t ) T 2T 4T 6T 8T t

The response of the sample/hold to the unit step


is the unit step.
Example

x(t ) x *(t ) x (t ) y (t )
T
Gho(s) Gp(s)
X (s) X *( s) X (s) Y (s)
G(s)
T
If Y*(s)
a
G p (s) =
s+a
Find the pulse transfer function G(z)

G ( s ) = Gho ( s )G p ( s) =
(1− e ) a
−Ts

s(s + a)
G ( z ) = ????
Example
G p (s)
G ( s ) = Gho ( s )G p (s) =
(1− e ) a −Ts

s
s(s + a)
 (1 − e ) a 
*
−Ts *
 
 = (1 − e −Ts ) 
a
G * ( s) =  
 s ( s + a )   s(s + a) 

1 1 
*
from the
= (1 − e −Ts )  − residues
 s s + a 
method
 1 
= (1 − e −Ts ) 
1

1 − e
−Ts
1 − e − aT e −Ts 
 1 
G ( z ) = (1 − e −Ts )
1

1 − e −Ts 1 − e − aT e −Ts  Ts
eTs = z
e =z
− aT
−1 1 1  1− e
= (1 − z )  −1
− − aT −1 
=
1 − z 1 − e z  z − e − aT
Example
Now, let the input, x(t), be the unit step, and find y(kT).
z
X ( z ) = u (t )  = Y ( z) = G( z) X ( z)
z −1
1 − e − aT  z  z z
Y ( z) = − aT   = −
z − e  z − 1  z − 1 z − e − aT
Taking the inverse z-transform
y (kT ) = 1 − e − akT

1
y(kT)

T 2T 4T 6T 8T t
Pulse Transfer Function
X (s) X*(s) Y (s) Y*(s) note that G(s)
T
G(s) T has a ZOH

In general
Y(s) = G(s)X*(s) NOTE
Y*(s) = [G(s)X*(s)]* Y(s) = G(s) + X(s)
= [G (s)]*X*(s) Y*(s) = [G(s) + X(s)]*
= G*(s)X*(s) = G*(s) + X*(s)

Y(s) = G(s)X(s)
So Y ( z) = G( z) X ( z)
Y *( s ) = G ( s ) X ( s )  *
 G *( s ) X *( s )
Y ( z)
G( z) =
X ( z)
Note carefully!
Example
1 − e −Ts 1
Let: A( s ) = = (1 − e −Ts ) Find A( z )
s ( s + 1) s ( s + 1)
In starred transform,
A( s ) = B( s) F *( s) s can only appear as e
−Ts

A( z ) = B( z ) F ( z )
z −1 (1 − e −T )
B( z ) =
(1 − z −1 )(1 − z −1e −T )
F ( z ) = F *( s) z =eTs = 1 − z −1
Hence
z −1 (1 − e −T )
A( z ) =
1 − z −1e −T
Pulse Transfer Function
Place a sampler between two transfer function blocks
(input not sampled)
*
X(s) G1 X Y(s) Y(z)
G1(s) G2(s) T
T

Y ( s ) = G2 ( s )  G1 ( s ) X ( s )  = G2 ( s )  G1 X ( s )
* *

Y *( s ) = G2 ( s )  G1 ( s ) X ( s )  = G ( s )  G1 X ( s )
* * * *
2

Y ( z ) = G2 ( z )  G1 X ( z ) We do not have X(z) but only


Y ( z) G1X(z).
= ????
X ( z)

If the input X(s) is not sampled, pulse transfer between


the input and the output cannot be defined!
Pulse Transfer Function
Include a sampler for the system input

X(s) X*(s) G1* X * Y(s) Y(z)


G1(s) G2(s)
T T T

Y ( s ) = G2 ( s )  G1* ( s ) X *( s)  = G2 ( s)G1* ( s) X *( s)
 
Y *( s ) = G2* ( s )G1* ( s) X *( s)
Y ( z ) = G2 ( z )G1 ( z ) X ( z )
Y ( z)
= G2 ( z )G1 ( z )
X ( z)

A transfer function can be defined for this configuration.


Open-Loop Systems Containing Digital
Filters
Zero-Order
Sampler Hold Plant
e(t ) e(k ) u (k ) u (t ) y (t )
A/D Computer D/A Gp(s)
E ( s) E( z) U ( z) U (s) Y (s)
D(z)
T Y(z)
The computer implements a set of difference equations,
which can be described by the transfer function
D(z) = U(z)/E(z).

e(t ) e *(t ) u (k ) u (t ) y (t )
D*(s) Gho(s) Gp(s)
E ( s) T E *( s ) U ( z) U (s) Y (s)
D(z)
E( z)
G(s) T Y(z)

We can view the ZOH as part of the plant.


Digital Controllers (continuous I/O
relation)
e(t ) e*(t) u (k ) u (t ) y (t )
T
D*(s) U *( s )
Gho(s) U (s)
Gp(s)
E ( s) E *(s) Y (s)
E(z) D(z) U ( z)
G(s) T Y(z)

U ( z ) = D( z ) E ( z ) Note again that G(s)


includes a ZOH
U *( s ) = D *( s ) E *( s )
U ( s ) = Gho ( s )U *( s )
U ( s ) = Gho ( s ) D *( s ) E *( s )
Y ( s ) = G p ( s ) U ( s ) = G p ( s )Gho ( s ) D *( s ) E *( s )
Digital Controllers (discrete I/O
relation)
e(t ) e*(t) u (k ) u (t ) y (t )
T
D*(s) U *( s )
Gho(s) U (s)
Gp(s)
E ( s) E *(s) Y (s)
E(z) D(z) U ( z)
G(s) T Y(z)

Y ( s ) = G p ( s )Gho ( s ) D *( s) E *( s) From the previous slide


*
Y *( s ) = G p ( s)Gho ( s) D *( s) E *( s) 
*
= G p ( s )Gho ( s )  D *( s) E *( s) = G *( s) D *( s) E *( s)
Y ( z ) = G ( z ) D( z ) E ( z )
Y ( z)
= D( z )G ( z )
E( z)
Digital Controllers (find the transfer
function)
e(t ) e*(t) u (k ) u (t ) y (t )
T
D*(s) U *( s )
Gho(s) Gp(s)
E ( s) E *(s) U (s) Y (s)
E(z) D(z) U ( z)
G(s) T Y(z)
Y ( z)
D( z )G ( z )
E( z)
Ts
1 e
G( z) Gho s G p s Gp s
s

1
Gp s
(1 z )
s

Y ( z) 1
Gp s
D( z )(1 z )
E( z) s
DC Gain
e(t ) e* ( t ) u (k ) u (t ) y (t )
T E * ( s)
D*(s) U * (s)
Gho(s) U (s)
Gp(s)
E ( s) Y (s)
E ( z) D(z) U ( z)

Y ( z) D( z )G ( z ) E ( z )
G(s) T Y(z)

1
Gp s
G( z) (1 z )
s
yss (k ) lim ( z 1)Y ( z ) lim ( z 1) D( z )G ( z ) E ( z )
z 1 z 1

The system dc gain is the system steady-state response


to a unit step
 z 
d.c.gain = lim ( z − 1) D( z )G ( z )
z →1
 z − 1 

(
= lim  D( z )G ( z ) z  = lim  D( z )  lim G ( z ) 
z →1 z →1
)( z →1
)
DC Gain
d.c. gain = ( lim  D( z ) ) ( lim G ( z ) )
z →1 z →1
Zero-Order
Hold Plant

u (k ) u (k ) y (t )
D/A Gp(s)
U ( z) U ( z) Y (s)
Y(z)
G(s) T

The dc gain of the D/A (the zero-order hold) is unity, so


the dc gain of G(z) is the dc gain of the plant.

lim G ( z )  = lim G p ( s) 


z →1 s →0

( )(
d.c. gain = lim  D( z )  lim G p ( s) 
z →1 s →0
)
Closed-Loop Systems
Procedures
• Use the open-loop tools to describe the A/D, the
computer, the D/A, and the plant.
• Close the loop and generate an error signal as the input to
the “open-loop” part of the system.
• Find the characteristic equation for the system and
determine stability & performance.
• Later, we will learn to design digital controllers to improve
the performance of a given system (design a transfer
function for the computer).
Zero-Order
Sampler Hold Plant
r (t ) + e(t ) e( k ) u (k ) u (t ) y(t)
A/D Computer D/A Gp(s)
R( s) − E (s) E( z) U ( z) U (s) Y(s) T Y(z)
D(z)
Preliminary Concepts
The arrangement and interconnection of samplers and
transfer function blocks are critically important in the
analysis and design of closed loop systems.

X(s) Y(s) Y ( s ) = G ( s ) X *( s )
G(s)
T Y ( z) = G( z) X ( z)
(Note: G(s) includes
a leading ZOH)

X(s) Y(s) Y*(s) Y ( s ) = G ( s ) X ( s )


G(s)
T
Y ( z ) = GX ( z )
(Note: G(s) has no ZOH)
Closing the Loop
R + X X* Y
T G(s)

T Y*
H(s)
X = R − HGX *
X * = R * −( HGX *)* = R * − HG * X *
R* Note: A ZOH is assumed
X* =
1 + HG * whenever an analog element
Y = GX * follows a sampler. It will be
G*R* noted by a purple dot
Y* = G * X * =
1 + HG *
Y* G*
=
R * 1 + HG *
Y ( z) G( z)
=
R( z ) 1 + HG ( z )
Closing the Loop
What happens if we locate the sampler between two blocks?
R + E1 E2 E2* Y
G1(s) T G2(s)

T Y*
H(s)
E2 = G1 E1 E1 = R − HY Y = G2 E2* Y * = G2* E2*
*
E = G1 E1
*
2

E = G1 ( R − HY )  = G1 R − G1 HY ) 
* * *
2
* * * *
= G1 R − G1 (G2 E ) H  = G1 R − G1G2 H E2*
*
2
* * *
G1 R G G1 R
E =
*
2 *
Y = * 2
*
1 + G1G2 H 1 + G1G2 H
This always happens when the input is applied No transfer function!
to an analog element before sampling.
Example
Y Transfer Function
E E*
R
+ G(s) Derivation
T
− *
E* = R * − H H1G E *
*
2
M* M
H2(s) H1(s) R*
E* =
T
*
1 + H 2 H1G
*

Signals
G*R*
E = R − H2M * E* = R * − H 2*M * Y* = *
1 + H H1G
*
2
*
M = H1GE * M * = H1G E * Y* G*
Y = GE * Y* = G * E * =
R * 1 + H * H G*
2 1

Note: H2(s) includes a The error signal is


ZOH (H1(s) does not)! sampled, so we have
a transfer function!
Representation of Discrete-Time
Control Systems
• Basic operations in discrete-time systems
o Addition (and subtraction)
o Multiplication by constant (gain)
o Delay – one or more sampling-interval time units
• Conventions or methods for representation
o Signal Flow Graphs (or Flow Graphs)
o Block (or Simulation) Diagrams
o State-Space (or state variable) Models
• The Same Transfer Function is Computed
o Equivalent representations
o Matter of preference
o Mixed representations possible
Block or Simulation Diagrams
f(k–1)
f(k) z-1
T

±af(k)
f(k) ±a

f1(k) ± f2(k)

Σ
f1(k) +

f2(k)
Signal Flow Graphs

z −1
f(k) f(k-1)

±a
f(k) ±af(k)

f1(k) a 1 af1(k) ± bf2(k)


F1(z) aF1(z) ± bF2(z)
±b
f2(k)
F2(z)
Mason’s Gain Formula
1
M=

 M k k

M is the overall transfer function


M k is the transmission of a forward path from input to output

 = 1 −  (individual loop gains )


+  ( products of non − touching loop gains taken 2 at a time)
− ( 3 at a time) +
+ ( 4 at a time)

 k is the value of that part of  that does not touch M k


Flow Graph Example
a2 a4 a6 a8
a1 a3 a10
a5 a7
a9

Suggestion: First find ∆ (the denominator).


a1a3a4 a6 a8 a10 (1) + a1a9 a10 (1 − a 4 a5 )
M=
1 − (a2 + a4 a5 + a6 a7 a8 ) + a2 a4 a5 + a2 a6 a7 a8
Flow Graph Example
a2 a4 a6 a8
a1 a3 a10
a5 a7
a9

Suggestion: First find ∆ (the denominator).

a1a3a4 a6 a8 a10 (1) + a1a9 a10 (1 − a 4 a5 )


M=
1 − (a2 + a4 a5 + a6 a7 a8 ) + a2 a4 a5 + a2 a6 a7 a8
Flow Graph Example
a2 a4 a6 a8
a1 a3 a10
a5 a7
a9

Suggestion: Trace the first forward path (dashed lines).

a1a3a4 a6 a8 a10 (1) + a1a9 a10 (1 − a 4 a5 )


M=
1 − (a2 + a4 a5 + a6 a7 a8 ) + a2 a4 a5 + a2 a6 a7 a8
Flow Graph Example
a2 a4 a6 a8
a1 a3 a10
a5 a7
a9

Suggestion: Trace the second forward path.

a1a3a4 a6 a8 a10 (1) + a1a9 a10 (1 − a 4 a5 )


M=
1 − (a2 + a4 a5 + a6 a7 a8 ) + a2 a4 a5 + a2 a6 a7 a8
Block Diagram Example
b2

g1
+ +
e(k) f1(k) y(k)
g3 T
+ –
g2 +

g2
+
f2(k)
g4 T
+ +
g1
f1 (k ) = g3e(k ) + g1 f1 (k − 1) − g 2 f 2 (k − 1) y (k ) = b2e(k ) + f 2 (k − 1)
f 2 (k ) = g 4 e(k ) + g1 f 2 (k − 1) + g 2 f1 (k − 1)
For this example,
f1 (k ) = g3e(k ) + g1 f1 (k − 1) − g 2 f 2 (k − 1)
f 2 (k ) = g 4 e(k ) + g1 f 2 (k − 1) + g 2 f1 (k − 1)
y (k ) = b2 e(k ) + f 2 (k − 1)

F1 ( z ) = g1 z −1 F1 ( z ) − g 2 z −1F2 ( z ) + g 3 E ( z )
F2 ( z ) = g 4 E ( z ) + g1 z −1 F2 ( z ) + g 2 z −1F1 ( z )
Y ( z ) = z −1 F2 ( z ) + b2 E ( z )
After some algebra,
Y ( z) g 4 z + ( g 2 g3 − g1 g 4 )
= b2 +
E( z) ( z − g1 ) 2 + g 2 2
Using Mason’s Gain Formula
b2
M1
gg11
+ +
e(k) f1(k) y(k)
gg33 T
+
M3 -
gg22 +

gg22
+
f2(k)
g4 T
M2 + +
g1g1
Check your results:
−1 −2
M 1 = b2 M 2 = g4 z M 3 = g 2 g3 z
1 =   2 = 1 − g1 z −1 3 = 1
−1 −1 2 −2 2 −2
 = 1 − g1 z − g1 z + g 2 z + g z 1

The numerator is

b2  + g 4 z −1 (1 − g1 z −1 ) + g 2 g3 z −2
After simplification and rearrangement, this yields
an identical result.
• This example shows two different ways to find the
transfer function.
• The structure used in the example is a form of a second-
order digital filter.
State Variables
Two ways to describe LTI control systems

Transfer Functions:
U(z) Y(z) Y ( z)
G(z) G( z) =
U ( z)
State-space (or state variable) representation:

x1 y1
u1
u2 x2 y2

⋮ ⋮ ⋮
xn yp
ur

Inputs States Outputs


Notation
Convention: matrices and vectors in bold
Definitions: In this course we
Inputs: ur, a (column) vector u consider single-
Outputs: yp, a (row) vector y input-single-output
States: xn, a (column) vector x (SISO) systems in
A general (non-linear) description is which ur and yp are
x(k + 1) = f [x(k ), u(k )] scalar (not vector)
y (k ) = g[x(k ), u(k )] functions.
A linear time-varying (LTV) system is described by
x(k + 1) = A(k )x(k ) + B(k )u(k )
y (k ) = C(k )x(k ) + D(k )u(k )
If the system is linear and time-invariant (LTI)
x(k + 1) = Ax(k ) + Bu(k )
y (k ) = Cx(k ) + Du(k )
State Space Notation Example
u(k) g(k) y(k)
Consider the difference equation: U(z) G(z) Y(z)

y (k + 3) − 2 y (k + 2) + 3 y (k + 1) − y (k ) = u (k ) → specifies g ( k )
and let
x1 (k ) = y (k )
x2 (k ) = y (k + 1) = x1 (k + 1)
x3 (k ) = y (k + 2) = x2 (k + 1) = x1 (k + 2)
Rewrite the original equation to get
x3 (k + 1) − 2 x3 (k ) + 3 x2 (k ) − x1 (k ) = u (k )
Which we can be written as
x1 (k + 1) = x2 (k )
x2 (k + 1) = x3 (k )
x3 (k + 1) = x1 (k ) − 3x2 (k ) + 2 x3 (k ) + u (k )
State Space Notation
x(k + 1) = Ax(k ) + Bu(k )
y (k ) = Cx(k ) + Du(k )
In matrix format, these equations become
 x1 (k + 1)  0 1 0   x1 (k )  0 
 x (k + 1)  = 0 0 1   x (k )  + 0  u ( k )
 2    2   
 x3 (k + 1)  1 −3 2   x3 (k )  1 
 x1 (k ) 
y (k ) = 1 0 0  x2 (k )  + 0  u ( k )
 x3 (k ) 

0 1 0  0 
A = 0 0 1  B = 0  C = 1 0 0 D = 0
1 −3 2  1 
Transfer Function to State Space Format

bn −1 z n −1 + bn − 2 z n − 2 + + b1 z + b0
G( z) = n −1
z + an −1 z + + a1 z + a0
n

Rewrite and expand to get the following


−1 −2 − n +1 −n
Y ( z) bn −1 z + bn − 2 z + + b1 z + b0 z E( z)
= G( z) =
U ( z) 1 + an −1 z −1 + + a1 z − n +1 + a0 z − n E(z)
Identify the numerator, Y(z), and the denominator U(z)
with the expressions
Y ( z ) = (bn −1 z −1 + + b1 z − n +1 + b0 z − n ) E ( z )
−1 − n +1 −n
U ( z ) = (1 + an −1 z + + a1 z + a0 z ) E ( z )
Transfer Function to State Space Format
Write the denominator first as:
U ( z ) = E ( z ) + an −1 z −1 E ( z ) + + a1 z − n +1E ( z ) + a0 z − n E ( z )
Then, as the inverse transform:
u (k ) = e(k ) + an −1e(k − 1) + + a1e(k − n + 1) + a0e(k − n)
Identify the state variables:
x1 (k ) = e(k − n)
x2 (k ) = e(k − n + 1) = x1 (k + 1)
x3 (k ) = e(k − n + 2) = x2 (k + 1) = x1 (k + 2)

xn (k ) = e(k − 1) = xn −1 (k + 1) = = x1 (k + n − 1) xn (k + 1) = e(k )

Substituting the state variables into the difference equation:


u (k ) = xn (k + 1) + an −1 xn (k ) + + a1 x2 (k ) + a0 x1 (k )
Transfer Function to State Space Format
From the preceding slide
u (k ) = xn (k + 1) + an −1 xn (k ) + + a1 x2 (k ) + a0 x1 (k )
Rearranging
xn (k + 1) = −a0 x1 (k ) − − an −1 xn (k ) + u (k )
and listing the next-state equations
x1 (k + 1) = x2 (k )
x2 (k + 1) = x3 (k )

xn −1 (k + 1) = xn (k )
xn (k + 1) = −a0 x1 (k ) − − an −1 xn (k ) + u (k )
Which may be written in matrix form.
Transfer Function to State Space Format
Express in matrix form:
A B
 x1 (k + 1)   0 1 0 0 0   x1 ( k )  0 
 x (k + 1)   0 0 1 0 0   x (k )  0 
 2    2   
 x3 (k + 1)  =  0 0 0 1 0   x3 (k )  + 0  u (k )
      
      
 xn (k + 1)   −a0 −a1 − a2 −a3 −an −1   xn (k )  1 

Repeat the procedure for the numerator:


 x1 (k ) 
 x (k ) 
C  2  D
y (k ) = [b0 b1 b2 bn ]  x3 (k )  + [0]u (k )
 
 
 xn (k ) 
Signal Flow Graphs
We can use previous results to construct a signal flow graph.
First, multiply the numerator and denominator of G(z) by z-n
Y ( z) bn −1 z −1 + bn − 2 z −2 + + b1 z − n +1 + b0 z − n E ( z )
= G( z) =
U ( z) 1 + an −1 z −1 + + a1 z − n +1 + a0 z − n E ( z )
Again, associate Y(z) with numerator, U(z) with denominator
U ( z ) = E ( z ) + an −1 z −1 E ( z ) + + a1 z − n +1E ( z ) + a0 z − n E ( z )
−1 −n
Y ( z ) = E ( z )(bn −1 z + + b0 z )
The first equation may be rewritten
E ( z ) = U ( z ) − an −1 z −1 E ( z ) − − a0 z − n E ( z )
Signal Flow Graphs
The equations for E(z) and Y(z) yield the flow graph
Y ( z ) = E ( z )bn −1 z −1 + + E ( z )b0 z − n

E ( z ) = U ( z ) − an −1 z −1E ( z ) − − a0 z − n E ( z )
Y

bn-1 b1 b0
E z-1 bn-2 bn-3
U ...
z-1 z-1 z-1 z-1
-an-1 -an-3
-an-2 -a1 -a0

Phase variable or control canonical form


Signal Flow Graphs
Example:
3z 2 + 5 z + 8 Y ( z) 3 z −1 + 5 z −2 + 8 z −3 E ( z )
G( z) = 3 = =
z +4 z + 7 z + 2 U ( z ) 1 + 4 z −1 + 7 z −2 + 2 z −3 E ( z )
2

E ( z ) = U ( z ) − 4 z −1 E ( z ) − 7 z −2 E ( z ) − 2 z −3 E ( z )
Y ( z ) = 3 z −1 E ( z ) + 5 z −2 E ( z ) + 8 z −3 E ( z )

The flow graph is Y


E 3 8
1 z-1 5
U
-4 z-1 z-1
-7
-2
Transfer Function to State Space Format
3z 2 + 5 z + 8
G( z ) = 3
z +4 z 2 + 7 z + 2
Expressing in the “control canonical” form:
 x1 (k + 1)   0 1 0   x1 (k )  0 
 x (k + 1)  =  0 0 1   x (k )  + 0  u (k )
 2    2   
 x3 (k + 1)   −2 −7 −4   x3 (k )  1 
 x1 (k ) 
y (k ) = 8 5 3  x2 (k )  + 0 u (k )
 x3 (k ) 
In the preceding cases, D = 0. This results from the fact
that there is no direct connection from the input to the
output (the degree of the numerator is less than the degree
of the denominator in G(z)). If not true, special care is
needed.
Example
0.5 z 3 + 0.7 z 2 − 0.8 z + 0.6 0.5 + 0.7 z −1 − 0.8 z −2 + 0.6 z −3
G( z) = 3 =
z + 0.4 z − 0.3z + 0.9
2
1 + 0.4 z −1 − 0.3z −2 + 0.9 z −3
We draw the flow graph as before:
Y
0.5
0.7 –0.8 0.6
U 1 E z -1
x3 z-1 x2 z-1 x1
–0.4
0.3 –0.9
The state equations are:
 x1 (k + 1)   0 1 0   x1 (k )  0 
 x (k + 1)  =  0 0 1   x (k )  + 0  u (k )
 2    2   
 x3 (k + 1)   −0.9 0.3 −0.4   x3 (k )  1 
y (k ) = 0.6 x1 (k ) − 0.8 x2 (k ) + 0.7 x3 (k ) + 0.5e(k ) not u(k)

x3(k+1) = e(k)
Example
e(k ) = u (k ) − 0.9 x1 (k ) + 0.3 x2 (k ) − 0.4 x3 (k )
Substituting this expression in the output equation we obtain
y (k ) = 0.5e(k ) + 0.6 x1 (k ) − 0.8 x2 (k ) + 0.7 x3 ( k )
= 0.5[u (k ) − 0.9 x1 (k ) + 0.3 x2 (k ) − 0.4 x3 (k )]
+ 0.6 x1 (k ) − 0.8 x2 (k ) + 0.7 x3 (k )
= 0.5u (k ) + 0.15 x1 (k ) − 0.65 x2 (k ) + 0.5 x3 ( k )
So, in matrix form B
A
 x1 (k + 1)   0 1 0   x1 (k )  0 
 x (k + 1)  =  0 0 1   x (k )  + 0  u (k )
 2    2   
 x3 (k + 1)   −0.9 0.3 −0.4   x3 (k )  1 

C  x1 (k )  D
y (k ) =  0.15 −0.65 0.50  x2 (k )  + 0.5u (k )
 x3 (k ) 
Derivation Procedure of Sampled-
Data System Transfer Function
Step-by-Step Procedure
1) Draw a flow graph, open at samplers.
2) Label sampler inputs and outputs (the latter are
“starred” transforms of the former).
3) Write the equations for sampler inputs and system
outputs - using the sampler outputs and the system
inputs as sources.
4) Take the “starred” transforms.
5) Solve by any convenient method:
a) Form a second flow graph and find the output
function.
b) Solve algebraically for the output function
Example
R E E* M M* Y
+ G1(s) + G2(s)
T T

H(s)

No Sampler
Steps 1 & 2

R 1 E E* G1 M M* G2 Y
T T
−1
−H
Example
Step 3
E = R − HG2 M *
Steps 1 & 2
M = G1 E * −G2 M *
R 1 E E* G1 M M* G2 Y
−1
Y = G2 M *
−H

Step 5
R* E* G1* –G2*
G2* Step 4
1 Y*
M* *
− G2 H * E* = R * − HG2 M *
* *
G2 G1 R *
OR M * = G1*E * −G2*M *
Y* =
*
1 + G2 + G1 HG2 * *
Y * = G2*M *

May be solved algebraically


Y ( z) G2 ( z )G1 ( z )
= from Step 4, or by Mason’s
R( z ) 1 + G2 ( z ) + G1 ( z ) HG2 ( z )
Gain rule from Step 5.
Example
G2(s)
Y
E E* G3(s)
G1(s) + T
D(z)Gho(s) +
R

H(s)
One Sampler

Steps 1 & 2 G2

G1 E E* D*Gho G3
T Y
R
−H
Example
G2
G3
Steps 1 & 2 R G1 E
T
E* D*Gho Y

−H

Step 3 Step 4
Y = G3 D * Gho E * +G3G2 R * *
E = G1 R − HG3 D * Gho E * − HG3G2 R Y = D G3Gho E + G3G2 R
* * *

* *
E = (G1 − HG3G2 ) R − HG3 D * Gho E * E = (G1 − HG3G2 ) R − D HG3Gho E *
* *

*
G3G2 R
E*
Step 5 1 * * Y*
(G1 − HG3G2 ) R D * G3 Gho
*
− D * HG3Gho
*
From Mason’s
* * *
(G1 − HG3G2 ) R D * G3 Gho + G3G2 R (1 + D HG3Gho ) *
Y* =
Gain Rule 1 + D * HG3Gho
*
State-Variable Models
We discussed before that systems describable by z-
transforms may also be modeled by discrete-time state
equations:
x k 1 Ax k Bu k
y k Cx k Du k

For an open-loop discrete-time system described by z-


transforms, we obtained a state-variable model by the
steps:

1) Draw a simulation diagram of the z-transform transfer


function.
2) Label each time-delay output as a state variable.
3) Write the state equations from the simulation diagram.
Review of Continuous-Time State
Variables
SISO System
m(t ) u (t ) y (t )
Gho(s) Gp(s)
M (s) T U (s) Y (s)
v (t ) = A c v (t ) + B c u (t )
y (t ) = Cc v(t ) + Dcu (t )
To move toward discrete case, first solve with Laplace
sV s v 0 Ac V s B cU s
1 1
V s Is Ac v 0 Is Ac B cU s

Define c t 1
[Is Ac ] 1
e Ac t
t
 v (t ) = c (t )  v(0) +  c (t −  )B c u ( ) d 
0

1 22 1 33 1 k k
c (t ) = e Act
= I + A ct + A c t + A ct + =  Ac t
2! 3! k =0 k !
Discrete-Time State Equations
from: v(t ) =  c (t )  v(0) + 0 (t −  )B cu ( )d 
t

More generally Starting at arbitrary time t = t0


t
v (t ) = c (t − t0 ) v(t0 ) +  c (t −  )B cu ()d 
t0

(t − t0 ) k k
c (t − t0 ) = e A c ( t − t0 )
= Ac
k!
Let t = kT + T and t0 = kT, and assume that the input is
from a zero-order hold and constant over the interval,
u(t) = u(kT):
kT +T
v (kT + T ) = c (T ) v(kT ) + u (kT ) 
kT
c (kT + T −  )B c d 

A comparison of this equation with the discrete state


equation shows: x k 1 Ax k Bu k
kT +T
A = c (T ) B= c (kT + T −  )B c d  y k Cx k Du k
kT
Discrete-Time State Equations

B= 
kT +T
c (kT + T −  )B c d  
 kT  =+ kT


=  c (T −  )d   B c
T

 0  =T −

  
=  c ()(− d ) B c =  c () d   B c
0 T

 T   0 
 T T2 2 T3 3  
=    I + TA c + A c + A c +  d   Bc
  2! 3!  
0

 T2 T3 2 T4 3 
= TI + Ac + Ac + Ac +  Bc
 2! 3! 4! 
Discrete-Time State Equations
Summary:
2 3
T T
A = c (T ) = e AcT = I + TA c + A c2 + A 3c +
2! 3!
 T2 T3 2 T4 3 
B = TI + Ac + Ac + Ac +  Bc
 2! 3! 4! 

• The discrete matrices may be obtained by determining


Φc(t) and evaluating at time t = kT.
• Alternatively, one can use the power series evaluation of
Φc(T) on a computer.
o We evaluate enough terms to get the desired
accuracy.
Example
Consider the following continuous time plant
s+2 s+2
G (s) = = 2
( s + 1)( s + 3) s + 4 s + 3

0 1 0 Assume the control


x(t ) =   x(t ) +   u (t )
 −3 −4  1  canonical (phase variable)
y (t ) =  2 1 x(t ) + 0u (t ) state-space representation.

 s+4 1 
  ( s + 1)( s + 3)  

−1
− −1  ( s + 1)( s + 3)
c (t ) = −1
 sI − Ac 
−1
= −1 

 s 1 

 3 s + 4  
= 
 −3 s


  ( s + 1)( s + 3) ( s + 1)( s + 3)  
 (3 / 2)e − t − (1/ 2)e −3t (1/ 2)e − t − (1/ 2)e −3t 
= −t −3t 
(−3 / 2)e + (3 / 2)e ( −1/ 2)e − t + (3 / 2)e −3t 
Example
Checking the result with MATLAB:
0 1
Ac =  
 −3 −4 
0
Bc =  
1 
Cc =  2 1 Dc = 0 c (t ) = −1
 sI − A  
c
−1

syms s t
Ac=[0 1;-3 -4]; B=[0;1];
Phit=ilaplace(inv(s*eye(2)-Ac));
pretty(Phit)

+- -+
| 3 exp(-t) exp(-3 t) exp(-t) exp(-3 t) |
| --------- - ---------, ------- - --------- |
| 2 2 2 2 |
| | The same result
| 3 exp(-3 t) 3 exp(-t) 3 exp(-3 t) exp(-t) |
| ----------- - ---------, ----------- - ------- |
| 2 2 2 2 |
+- -+
Example
 0.9965 0.0453
A = c (t ) t =T = c (0.05) =  
 −0.1358 0.8154 

B =   c ( ) d   B c
0.05

 0 
 (3 / 2)(1 − e−0.05 ) − (1/ 6)(1 − e−0.15 ) (1/ 2)(1 − e−0.05 ) − (1/ 6)(1 − e−0.15 )  0 
= −0.05 −0.15 −0.05 −0.15   
 ( −3 / 2)(1 − e ) + (1/ 2)(1 − e ) ( −1/ 2)(1 − e ) + (1/ 2)(1 − e )  1 
 0.0499 0.0012  0  0.0012 
=    = 
 − 0.0035 0.0453   
1 0.0453 
Example
T2 2 T3 3
A = I + TA c + Ac + Ac + Now we use the numerical
2! 3! technique and carry out the
 T2 T3 2 T4 3  calculations to four terms.
B = TI + Ac + Ac + Ac +  B c
 2! 3! 4! 

format long
Ac=[0 1;-3 -4]; Bc=[0;1]; T=0.05;
A=eye(2)+Ac*T+(Ac*T)^2/2+(Ac*T)^3/6
B=(eye(2)*T+Ac*T^2/2+(Ac*T)^2*T/6+(Ac*T)^3*T/24)*Bc

A =
0.996500000000000 0.045270833333333
-0.135812500000000 0.815416666666667
B =
0.001170052083333
0.045260416666667

 0.99650 0.04527  0.00117 


A=  B= 
 −0.13581 0.81542   0.04526 
Example
T2 2 T3 3 T4 4
A = I + TA c + Ac + Ac + Ac + Now carry out the
2! 3! 4! calculations to five
 T2 T3 2 T4 3 T5 4  terms.
B = TI + Ac + Ac + Ac + Ac +  Bc
 2! 3! 4! 5! 
Ac=[0 1;-3 -4]; Bc=[0;1]; T=0.05;
A=eye(2)+Ac*T+(Ac*T)^2/2+(Ac*T)^3/6+(Ac*T)^4/24
B=(eye(2)*T+Ac*T^2/2+(Ac*T)^2*T/6+(Ac*T)^3*T/24+(Ac*T)^4*T/120)*Bc

A =
0.996489843750000 0.045260416666667
-0.135781250000000 0.815448177083333
B =
0.001169947916667
0.045260731770833

 0.99649 0.04526   0.99650 0.04527  0.00117  0.00117 


A=  A =  −0.13581 0.81542  B =  0.04526  B =  0.04526 
 −0.13578 0.81545      
Practical Calculations
1. Derive the state model for the continuous part.
x(t ) = A c x(t ) + B cu (t )
y (t ) = Cc x(t ) + Dcu (t )

2. Calculate the transfer function of the continuous part.


G p ( s ) = Cc [ sI − A c ]−1 B c + Dc [ns,ds]=ss2tf(Ac,Bc,Cc,Dc)

3. Calculate the discrete matrices of the plant with ZOH.


T2 2 T3 3
A = I + TA c + Ac + Ac +
2! 3! [A,B]=c2d(Ac,Bc,T)
 T2 T3 2 T4 3  C=Cc
B = TI + Ac + Ac + Ac +  Bc D=Dc ZOH assumed
 2! 3! 4! 
C = Cc D = Dc
4. Calculate the pulse transfer function G(z)
G ( z ) = C[ zI − A]−1 B + D [nz,dz]=ss2tf(A,B,C,D)

You might also like