IntroCtrlSys Chapter7
IntroCtrlSys Chapter7
MATHEMATICAL MODEL OF
DISCRETE TIME CONTROL SYSTEMS
I t d ti to
Introduction t discrete-time
di t ti system
t
The Z-transform
Transfer function of discrete-time system
State-space equation of discrete-time system
r(kT) u(kT)
(kT) uR(t) y(t)
Computer D/A Plant
yfb(kT)
A/D Sensor
yfb(kT)
Sampling Sensor
1 − e −Ts
GZOH ( s ) = t
s 0
k = −∞
where:
− z = eTs (s is the Laplace variable, T is the sampling period)
− X(z)
( ) : Z-transform
s o oof x(k).
Z
Notation: x ( k ) ←⎯→ X ( z )
+∞
If x(k) = 0, ∀ k < 0 then X ( z ) = Z {x ( k )} = ∑ x ( k ) z −k
k =0
Scale in Z-domain: Z {a k
x ( k )} = X ( a −1
z)
Di impulse:
Dirac i l δ(k)
⎧1 if k = 0
δ (k ) = ⎨ 1
⎩0 if k ≠ 0 k
Z {δ (k
( k )} = 1
0
The input-output
Th i t t t relation l ti shiphi off a discrete
di t system
t can be b
described by the difference equation:
a0 y ( k + n ) + a1 y ( k + n − 1) + ... + an −1 y ( k + 1) + an y ( k ) =
b0u( k + m) + b1u( k + m − 1) + ... + bm−1u( k + 1) + bmu( k )
where n>m, n is the order of the system.
T ki the
Taking th ratio
ti Y(z)/U(z)
Y( )/U( ) to
t obtain
bt i the
th transfer
t f function:
f ti
Y ( z ) b0 z m + b1 z m −1 + ... + bm −1 z + bm
G( z) = =
U ( z ) a0 z n + a1 z n −1 + ... + an −1 z + an
z 3Y ( z ) + 2 z 2Y ( z ) − 5zY ( z ) + 3Y ( z ) = 2 z 2U ( z ) + U ( z )
Y ( z) 2z2 + 1
⇒ G( z) = = 3
U ( z ) z + 2 z 2 − 5z + 3
Y ( z) z −1 ( 2 + z −2 )
⇔ G( z) = =
U ( z ) 1 + 2 z −1 − 5z −2 + 3z −3
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 18
Calculate transfer function from block diagram
R(s) Y(s)
+ GC(z) ZOH G(s)
− T
H(s)
Y ( z) GC ( z )G ( z )
The closed-loop TF: Gk ( z ) = =
R ( z ) 1 + GC ( z )GH ( z )
where
GC (z ) : TF of the controller, derive from difference equation
⎧⎪ G ( s ) ⎫⎪ ⎧⎪ G ( s ) H ( s ) ⎫⎪
−1
G ( z ) = (1 − z )Z−1
⎨ ⎬ GH ( z ) = (1 − z )Z ⎨ ⎬
⎪⎩ s ⎪⎭ ⎪⎩ s ⎪⎭
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 19
Calculate TF from block diagram – Example 1
Find the closed-loop transfer function of the system:
R(s) Y(s)
+ ZOH G(s)
−
T = 0.5
3
G (s) =
s+2
Solution: G ( z ) = (1 − z −1 )Z ⎧ G(s) ⎫ −1 ⎧ 3 ⎫
⎨ ⎬ = (1 − z )Z ⎨ ⎬
⎩ s ⎭ ( s + 2) ⎭
⎩ s (s
−2×0.5
−1 3 z (1 − e )
= (1 − z )
2 ( z − 1)( z − e −2×
2×0.5
)
⇒ 0.948 ⎧ a ⎫ z (1 − e − aT )
G( z) =
z − 0.368 Z⎨ ⎬= − aT
⎩ s ( s + a ) ⎭ ( z − 1)( z − e )
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 20
Calculate transfer function from block diagram – Example 1 (cont’)
0.948
= z − 0.368
G( z)
Gk ( z ) =
1 + G ( z ) 1 + 0.948
z − 0.368
⇒ 0.948
Gk ( z ) =
z + 0.580
H(s)
3e − s 1
Given that G ( s ) = H ( s) =
s+3 s +1
Solution:
The
h closed-loop
l dl transfer
f function:
f i
G( z)
Gk ( z ) =
1 + GH ( z )
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 22
Calculate TF from block diagram – Example 2 (cont’)
−1 ⎧ G( s) ⎫ 3e − s
• G ( z ) = (1 − z )Z ⎨ ⎬ G( s) =
⎩ s ⎭ ( s + 3)
−1 ⎧ 3 e −s
⎫
= (1 − z )Z ⎨ ⎬
⎩ s( s + 3) ⎭
−3×0.5
−1 −2 z (1 − e )
= (1 − z ) z
( z − 1)( z − e −3×0.5 )
⇒
0.777
G( z) = 2 ⎧ a ⎫ − aT
z (1 − e T )
z ( z − 0.223) Z⎨ ⎬= − aT
⎩ s ( s + a ) ⎭ ( z − 1)( z − e )
z = eTs = e0.5 s
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 23
Calculate TF from block diagram – Example 2 (cont’)
⎧ G ( s) H ( s) ⎫
−1 3e − s
• GH ( z ) = (1 − z )Z ⎨ ⎬ G ( s) =
⎩ s ⎭ ( s + 3)
−s
−1 ⎧ 3 e ⎫
= (1 − z )Z ⎨ ⎬ H (s) =
1
⎩ s ( s + 3)( s + 1) ⎭ ( s + 1)
−1 −2 z ( Az + B)
= 3(1 − z ) z
( z − 1)( z − e −3×0.5 )( z − e −1×0.5 )
(1 − e −3×0.5 ) − 3(1 − e −0.5 )
A= = 0.0673
3(1 − 3) ⎧ 1 ⎫ z ( Az + B)
Z ⎨ ⎬ = − aT −bT
⎩ −3×0.5
s ( s + a )( s + b ) ⎭ ( z − 1)( z − e )( z − e )
3e −3×0.5 (1 − e −0.5 ) − e −0.5 (1 − e ) −aT
B= b(1 − e = 0).−0346
a(1 − e −bT )
3(1 − 3) A=
ab(b − a)
⇒
0 .202 z + 0. 104
ae−aT (1 − e −bT ) − be −bT (1 − e −aT )
GH ( z ) = 2
z ( z − 0.223)( zB −= 0.607) ab(b − a)
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 24
Calculate TF from block diagram – Example 2 (cont’)
⇒
0.777( z − 0.607)
Gk ( z ) = 4
z − 0.83z 3 + 0.135z 2 + 0.202 z + 0.104
0.777
G( z) = 2
z ( z − 0.223)
0.202 z + 0.104
GH ( z ) = 2
G
z ( z − 0.223)( z − 0.607)
C l l t the
Calculate th closed-loop
l dl t
transfer
f function
f ti off the
th system:
t
R(s) e(k) u(k) Y(s)
+ GC(z) ZOH G(s)
− T=0.2
H(s)
−0. 2 s
Given that: G ( s ) = 5e
H ( s ) = 0.1
s2
The controller is described by the difference equation:
u( k ) = 10e( k ) − 2e( k − 1)
Solution:
S l ti
The closed-loop transfer function:
GC ( z )G ( z )
Gk ( z ) =
1 + GC ( z )GH ( z )
The TF of the controller is calculated from the difference
equation:
u( k ) = 10e( k ) − 2e( k − 1)
⇒ U ( z ) = 10 E ( z ) − 2 z −1E ( z )
U ( z)
⇒ GC ( z ) = = 10 − 2 z −1
E ( z)
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 27
Calculate TF from block diagram – Example 3 (cont’)
−1 ⎧ G ( s) ⎫ −0.2 s
• G ( z ) = (1 − z )Z ⎨ ⎬ G ( s) =
5e
⎩ s ⎭ s2
−0.2 s
−1 ⎧ 5e
5e ⎫ −1 −1 ( 0. 2) 2
z ( z + 1)
= (1 − z )Z ⎨ 3 ⎬ = 5(1 − z ) z
⎩ s ⎭ 2 ( z − 1 ) 3
⇒
0.1( z + 1)
G( z) =
z ( z − 1) 2
−1⎧ G (s) H ( s) ⎫
• GH ( z ) = (1 − z )Z ⎨ ⎬ H ( s ) = 0.1
⎩ s ⎭
−1 ⎧ G ( s) ⎫
= 0.1(1 − z )Z ⎨ ⎬ ⎧ 1 ⎫ T z ( z + 1)
2
⎩ s ⎭ Z ⎨ 3⎬=
⎩ s ⎭ 2( z − 1)
3
⇒
0.01( z + 1)
GH ( z ) =
z ( z − 1) 2 z = eTs = e0.2 s
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 28
Calculate TF from block diagram – Example 3 (cont’)
⇒ z 2 + 0.8 z − 0.2
Gk ( z ) = 4 −1
z − 2 z + 1.1z + 0.08 z − 0.02 C
3 2 G ( z ) = 10 − 2 z
0.1( z + 1)
G( z) =
z ( z − 1) 2
0.01( z + 1)
GH ( z ) =
z ( z − 1) 2
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 29
State--space model of discrete system
State
Cd = [1 0 K 0 0]
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 33
Derive SS equation from difference equation – Case 1 example
⎧ x( k + 1) = Ad x( k ) + Bd r ( k )
The state equations: ⎨
⎩ y ( k ) = Cd x( k )
where: 0⎡0⎤
⎡0 0 ⎤ Bd = 0 = ⎢ 0 ⎥
b0 ⎢ ⎥
0 1 0 1
Ad = 0 0 1 =⎢ 0 0 1 ⎥ ⎢⎣1.5⎥⎦
a3 a2 a1 ⎢ ⎥ a0
− − − ⎢⎣ − 2 − 2.5 − 0.5⎥⎦
a0 a0 a0 Cd = [1 0 0]
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 34
Derive SS equation from difference equation
Case 2: The right-hand side of the difference equation
involve the differences of the input:
a0 y ( k + n) + a1 y ( k + n − 1) + ... + an −1 y ( k + 1) + an y ( k ) =
b0u ( k + n − 1) + b1u ( k + n − 2) + ... + bn −2u ( k + 1) + bn −1u ( k )
Define
D fi ththe state
t t variable:
i bl
The first state variable is the
x1 ( k ) = y ( k )
output of the system;
x2 ( k ) = x1 (k + 1) − β1r ( k )
The ith state variable (i=2..n)
is set to be one sample time- x3 ( k ) = x2 ( k + 1) − β 2 r ( k )
advanced of the (i−1)th state M
variable minus a quantity xn ( k ) = xn −1 ( k + 1) − β n −1r ( k )
proportional
i l to the
h input
i
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 35
Derive SS equation from difference equation
Case 2 (cont
(cont’))
⎧ x( k + 1) = Ad x( k ) + Bd r ( k )
The state equation:q ⎨
⎩ y ( k ) = Cd x( k )
where:
⎡ 0 1 0 K 0 ⎤
⎡ β1 ⎤
⎡ x1 ( k ) ⎤ ⎢ 0 0 1 K 0 ⎥ ⎢β ⎥
⎢ x (k )⎥ ⎢ ⎥ ⎢ 2⎥
x(k ) = ⎢ 2 ⎥ A =⎢ M M M M ⎥ B =⎢ M ⎥
⎢ M ⎥ d ⎢ ⎥ d
0 0 0 K 1 ⎢ ⎥
⎢ ⎥ ⎢ a ⎥ ⎢ β n −1 ⎥
⎣ n ⎦
x ( k ) a a
⎢ − n − n −1 − n −2 K − 1 ⎥ a
⎢⎣ β n ⎥⎦
⎣⎢ 0
a a 0 a 0 a 0⎥⎦
Cd = [1 0 K 0 0]
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 36
Derive SS equation from difference equation
Case
C 2 (cont’)
( t’)
The coefficient βi in the vector Bd are defined as:
b0
β1 =
a0
b1 − a1β1
β2 =
a0
b2 − a1β 2 − a2 β1
β3 =
a0
M
bn −1 − a1β n −1 − a2 β n −2 − K − an −1β1
βn =
a0
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 37
Derive SS equation from difference equation – Case 2 example
⎧ x( k + 1) = Ad x( k ) + Bd u( k )
The state equations: ⎨
⎩ y ( k ) = Cd x( k )
where: ⎡ β1 ⎤
0 1 0 ⎡0 1 0 ⎤ Bd = ⎢ β 2 ⎥
⎢ ⎥
Ad = 0 0 1 =⎢ 0 0 1 ⎥ ⎣⎢ β 3 ⎥⎦
a3 a2 a1 ⎢ ⎥
− − − ⎢⎣ − 2 − 2.5 − 0.5⎥⎦
a0 a0 a0 Cd = [1 0 0]
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 38
Derive SS from difference equation – Case 2 example (cont’)
ffi i t βi in
Th coefficient
The i the
th vector
t Bd are calculated
l l t d as:
⎧ b0 1
⎪ β1 = a = 2 = 0.5
⎪ 0
⎪ b1 − a1β1 0 − 1 × 0.5
⎨β 2 = = = −0.25
⎪ a0 2
⎪ β = b2 − a1β 2 − a2 β1 = 3 − 1 × ( −0.25) − 5 × 0.5 = 0.375
⎪ 3
⎩ a0 2
⎡ 0.5 ⎤
⇒ Bd = ⎢ − 0.25⎥
⎢ ⎥
⎢⎣ 0.375 ⎥⎦
Φ ( s ) = (sI − A)
-1
where
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 40
Formulation of SS equations from block diagram (cont’)
⎧ Ad = Φ (T )
⎧ x[( k + 1)T ] = Ad x( kT ) + Bd eR ( kT ) ⎪⎪ T
⎨ with ⎨ Bd = ∫ Φ (τ ) Bdτ
⎩ y ( kT ) = Cd x( kT ) ⎪ 0
⎪⎩Cd = C
Step 4: Write the closed-loop discrete state equations
( hi h has
(which h input
i t signal
i l r(kT))
(kT))
⎧ x[( k + 1)T ] = [Ad − Bd Cd ]x( kT ) + Bd r ( kT )
⎨
⎩ y ( kT ) = Cd x( kT )
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 41
Formulation of SS equations from block diagram – Example
Formulate
l theh SS equations
i d
describing
ibi the
h system:
where a = 2, T = 0.5, K = 10
S l ti
Solution:
eR(t) 1 x2 1 x1 10 y(t)
Step 1:
s+2 s
X 2( s )
X 1 (s) = ⇒ sX 1 ( s ) = X 2( s ) ⇒ x&1 (t ) = x 2 (t )
s
E R ( s) ⇒ ⇒ x&2 (t ) = −2 x2 (t ) +e R (t )
X 2 ( s) = ( s + 2) X 2 ( s ) = E R ( s )
s+2
⎡ x&1 (t ) ⎤ ⎡0 1 ⎤ ⎡ x1 (t ) ⎤ ⎡0⎤
⎢ x& (t )⎥ = ⎢0 − 2⎥ ⎢ x (t )⎥ + ⎢1⎥ eR (t )
⎣ 2 ⎦ 1 ⎣ 4243⎦ ⎣ 2 ⎦ ⎣{⎦
⇒ A B
⎡ x1 (t ) ⎤
y (t ) = 10 x1 (t ) = [10 0]⎢
123 ⎣ x2 (t )⎥⎦
C
16 November 2011 © H. T. Hoàng - www4.hcmut.edu.vn/~hthoang/ 43
Formulation of state equations from block diagram – Example (cont’)
⎡ 1 −2t ⎤ ⎡ 1 − 2×0.5 ⎤
1 (1 − e ) 1 (1 − e )⎥ ⎡1 0.316⎤
Ad = Φ (T ) = ⎢ 2 ⎥ = ⎢ 2 =⎢ ⎥
⎢0 − 2t ⎥ ⎢ − 2×0.5 ⎥ ⎣ 0 0 . 368 ⎦
⎣ e ⎦ t =T ⎣0 e ⎦
T ⎧⎡
1 − 2τ ⎤ 0 ⎫ T ⎧⎡ 1 − 2τ ⎤ ⎫
T
⎪ 1 (1 − e )⎥ ⎡ ⎤ ⎪ ⎪⎢ (1 − e )⎥ ⎪
Bd = ∫ Φ (τ ) Bdτ = ∫ ⎨⎢ 2 ⎢ ⎥ d τ ⎬ = ∫⎨ 2 dτ ⎬
0 ⎪ ⎢0 − 2τ ⎥ ⎣1⎦ ⎪ 0 ⎪⎢ e −2τ ⎥ ⎪
⎩⎣ e ⎦ ⎭ ⎩⎣ ⎦ ⎭
0
T
⎡⎛ τ e − 2τ
⎞⎤ ⎡⎛ 0.5 e −2×0.5 1 ⎞⎤
⎢⎜⎜ + 2 ⎟⎟⎥ ⎢⎜⎜ + − 2 ⎟⎟⎥
= ⎢⎝ 2 2 ⎠⎥ = ⎢⎝ 2 2 2
2 ⎠⎥ = ⎡0.092⎤
⎢0.316⎥
⎢ e −2τ ⎥ ⎢ e − 2×0.5
1 ⎥ ⎣ ⎦
⎢ − ⎥ ⎢ − + ⎥
⎣ 2 ⎦0 ⎣ 2 2 ⎦
Cd = C = [10 0]
Gi
Given th state
the t t equation
ti
⎧ x( k + 1) = Ad x( k ) + Bd u( k )
⎨
⎩ y ( k ) = Cd x( k )
Th corresponding
The di transfer
f function
f i is:
i
Y ( z)
G( z) = = Cd ( zI − Ad ) −1 Bd
U ( z)