Post on 01-Jan-2016
description
Chapter 5
On-Line Computer Control – The z Transform
Analysis of Discrete-Time Systems
1. The sampling process
2. z-transform
3. Properties of z-transforms
4. Analysis of open-loop and closed-loop discrete time systems
5. Design of discrete-time controllers
Continuous signal and its discrete-time representation with different sampling rates
3 t (sec)
y*
6
9 12
3 t (sec)1
y
7 9 115 3 t (sec)1
y*
6
9 12
y y*Continuoussignal
Disontinuoussignal
t
t = nT t
y*
t
t = nT t
y*
t = nT t
y*
nT area Impulse
From the response of a real sampler to the response of an ideal impulse sample
(a) (b)
(c)
(a) (b)
(c)
T = 1 sec
T = 3 sec
The Sampling Process
1. At sampling times, strength of impulse is equal to value of input signal.2. Between sampling times, it is zero.
0n
*
nT)-(ty(nT)
...nT)-(ty(nT)....T)-(ty(T)(t)y(0)ty
ImpulseSamplery (t) y*
nT)]-(t[y(nT)(s)y0n
* L
nTs-
0n
* e y(nT)(s)y
or
Laplacing
The Hold Process :From Discrete to Continuous Time
Zero – Order Hold :
m* (t) m (t)
Continuousoutput
discreteimpulses
Hold Device
t
t
m* (t)
T
m (t)
1
Transfer Function :Response of an impulse input : (t)
Ts--Ts
e-1s
1
s
e-
s
1 H(s)
1)T(n t nTfor (t)m m(t) *
First Order Hold
tc2,3,4....en 1)T(n t nT
nT)-(tT
1)T]-m[(n -m(nT) m(nT) m(t)
Response to an impulse input
1
1
2
T 2T
-1
Transfer function:2-sT
s
e-1
T
sT1 H(S)
First Order versus Zero Order Hold
Comparison of reconstruction with zero-order and first-order holds, for slowly varying signals.
Comparison of reconstruction with zero-order and first-order holds, for rapidly changing signals.
0 2T 4T 6T 8T 10T t
m* (nT)
0 2T 4T 6T 8T 10T t
m (t)
0 2T 4T 6T 8T 10T t
m (t)
0 1T 3T 5T 7T t
m (t)
0 1T 3T 5T 7T t
m (t)
0 1T 3T 5T 7T t
m* (nT)
(a)
(a)
(b)
(b)
(c)
(c)
Z-Transforms
y(t) yz(t)
Remarks1. z-transform depends only on the discrete values y(0), y(ז),y(ז)..etc. If two
continuous functions have the same sampled values , then z-transform will be the same.
2. It is assumed that the summation exists and is finit.
3. We can also view t in the form Z[ y (s) ] = ŷ(z)
Sample
z)y(n (z)y )(
)(y
)()(
)()(
n-
0n
0
0
tyΖ
z
znysy
ezLet
enysy
z
n
nz
Ts
n
nTsz
Z-Transforms of Basic Functions
11
1
1111
1
321
z-
z
z
......zzz Z[u(t)]
1. Unit Step Function
onvergence for c ze
z-e
z
z-e
λ
ze , λλzeeZ
-aT
-aT
-aT
-aT
n
nn
n
anT-at
1
1
11
1
1
1
1
00
2. Exponential Function
Z-Transforms of Basic Functions - Continued
12zcoswTz
zcoswTzcoswt Z
12zcoswTz
zsinwTsinwt Z
2
2
2
1
13211
321
321
10)1(
2
320
z
aTz...(aT)z(aT)z)aT(zSz
(aT)zaTzSz
...(aT)z(aT)z)aT(zSatZ
3. Ramp Function
4. Trigonometric Functions
Z-Transforms of Basic Functions - Continued
5. Translation
( )kTs k
n
n 0
k
n k
Z f(t - kT) Z e f s f (z)z
Z f(t - kT) f(nT kT)z
let n - k,assume f( τ) 0 for 0
f( τ)z
- k
0
k
f( τ)z z
f (z) z
Z-transform for Numerical Derivative
y(z)
T
z1
T
yyZ
T
yydtdy
11nn
1nnt
1(z)zfT)-f(tz
z-1 is like a back shift operator
Properties of z-Transforms
y(t)t
nTyn
(z)y)z(z
As z
y(nT)....z-T)zT)-y(y(z--y(T)zy(T -)z)-y(y( n
n
nzy(nTn
nzy(nT n
zy(nT)z( y(z)f)-zoof: (
(z)y)-z( z
y(t) t
n--
-
limlimˆ111
lim1
212211)100lim
0
1)0
)0
)1ˆ1Pr
ˆ11
limlim
11
1
(z)fa(z)f a fafaZ
22112211
1. Linearity
2. Final Value Theorem
zf zz zy T ˆ
11
2ˆ
1
1
nT
)T(n-f(t)dt )T(n- ynT y
dtnTt
tft) y(
11
0
Numerical Integration in z-transform
Using Trapezoidal Rule
(z)fz(z)fz(z)y(z) y
T
Tn-ff(nT )T(ny
T ˆ1ˆ2
1ˆˆ
2
1)1
or solving
1.Partial fraction expansion
λ1, λ2,… λn are low-order polynomials in z-1 compute c1,c2,…cn.
Invert each part separately, we able
)(...
)()()(
)()(ˆ
112
21
1
11
1
z
c
z
c
z
c
zP
zQzy
n
n
11
311
1
1
11
1
1
12
11
11
1
21
1
2
31
21
1
21)(ˆ
2
1
1
2
1
31
311)31)(1(
34134)(ˆ
1
1
zzzy
z
zc
z
zc
z
c
z
c
zz
z
zz
z
zz
zzy
z
z
Inversion of z-transforms
y(nT) = -1/2 + 1/2 e11n
y:0,1,4,13,0,…
2.Inversion by Long-Division
1z-1+4z-2+13z-3
1-4z-1+3z-2 z-1
z-1-4z-2+3z-3
4z-2+3z-3
4z-2-16z-3+12z-4
13z-3-12z-4
y(0) = 0y(T) = 1y(2T) = 4y(3T) = 13
21
1
341)(ˆ
zz
zzy
From Tables of z-transforms
z-transforms of various functions
Function Lalpace transform z-transformin time domain
unit impluse 1
unit step 1/s
ramp: f(t) = at a/s2
f(t) = tn n!/sn+1
f(t) = e-at 1/s+a
f(t) =te-at 1/(s+a)2
21
1
1
10
21
1
1
)1(
1
1
1
1)1(
)1(
1
1
1
lim
ze
ze
ze
zea
z
aTz
z
aT
aT
aT
aTn
nn
a
z-transforms of various functions
Function Lalpace transform z-transformin time domain
f(t) = sinωt
f(t) = cosωt
f(t) = 1-e-at
f(t) = e-at sinωt
f(t) = e-at cosωt
221
1
221
1
21
21
1
cos21
cos1
cos21
sin
)1)(1(
)1(
cos21
cos1
cos21
sin
zeTez
Tez
zeTez
Tez
zez
ze
zTz
Tz
zTz
Tz
aTaT
aT
aTaT
aT
aT
aT
22
22
22
22
)(
)(
)(
as
as
as
ass
as
ss
Discrete-Time Response of systems
In computer control:
measurements are taken periodically and
control actions implemented periodically,
This results in a discrete input/discrete
output dynamic system.
Discrete System
encn
Example of Discrete Systems
Let
a discrete time approximation is
ckedt
dcn
nnn
nnnn
nnnn
kecT
cT
ckccT
cT
ckeT
cc
1
1
1
)1(
1
1
)1()(
)(ˆ
)(ˆ)(ˆ)(ˆ)1(
zTT
k
ze
zcor
zekzczT
zcT
Taking z-transform
Z-transform for a given continuous system with transfer function G(s) and a ZOH
1
1
1( ) ( ) ( )
1
Ts
Ts
eZ H s G s Z G s
s
G s G sZ Z e
s s
G s G sZ z Z
s s
G sz Z
s
Example: Pure Integrator with Hold
)1()1(]1[][]-[1
][][].1
[)(
1)(
1
1
21
11
21-
22
z
zTK
z
TzKz
s
KZz
s
eKZ
s
KZ
s
K
s
eZsHGZ
s
K
s
esHG
ppp
Tsppp
Ts
pTs
p
s
e ST1
c*(s) s
K p
y*(s)
Step response
Hence of
which impulse a ramp response
21
1
11
1
1
)1()1(
1
)1()(ˆ
1
1)(ˆ
1)(
z
zK
zz
zKzy
zzc
ssc
pp
Example: First order lag system
1
1
11 1
1( ) ( )
1
1[ ( )] [ ]
( 1)
[1 ] [ ]( 1)
1 1 [1 ] [ ]
1
1 1 [1 ][ ]
1 1
(
p
STp
pp
STp
p
p
p
pp
p T
p
KeH s G s
s s
KeZ HG s Z
s s s
Kz Z
s s
K z Zs s
K zz e z
K
1
1
1 )
1
p
p
T
T
e z
e z
Step Response for 1st order lag system
tKty
eKnTy
ze
K
z
K
zez
zeK(z)y
zzc
ssc
p
nTp
pp
p
p
p
p
p
to)(
]1[)(
)1()1(
)1)(1(
)1(ˆ
1
1)(ˆ
1)(
11
11
1
1
y(t)
time
*
*
*
**
* * ** ** *
Note: Compare with discrete approximation to First-order system
From tables, for
Generalization
mm
kk
mnmn
nknknnn
zzcbzzcbzzcb
zzeazezazeazc
cbcb
cbeaeaeac
)(ˆ...)(ˆ)(ˆ
)(ˆ...)(ˆ)(ˆ)(ˆ
...
...
22
11
110
22
11110
)(...1
...
)(ˆ)(ˆ
22
11
22
110 zD
zbzbzb
zazazaa
ze
zcm
m
kk
or
D (z)=Transfer function relating e and c
Analogous to Laplace transfer
Discrete time input/output model
Remark:Note that D(z) is the z-transform of the response of the system to an impulse input 1)(ˆ ze
Z-transform of a continuous process with Sample and Hold
HoldH (s)
ProcessGp (s)
discrete input
c*(s)
continuousvariables
y (s) y*(s)
discreteoutput
we seek a relationship (Z-transfer function) between c and y.
Consider a impulse input c*(z)=1 c*(s)=1
)(
)]([
)(ˆ
)()(
)()()()(
zHG
sGsHZ
syZzy
sGsH
scsGsHsy
P
p
p
p
HGp(z) called the pulse transfer function (since it represents the z-transform of the pulse response of Gp (s) )
Then
Properties of pulse Transfer Function
1.
2.An impulse input is converted into a pulse input by the first order hold element . Hence HG(z) is the pulse response of G(s) sampled at z internals of T.
3.The pulse transfer function of two systems in series can be combined if there is a sample and hold in between.
)()()()( 2121 sGZsGZsGsGZ
)()(
)(1
1
2 zGzc
zc )(
)(2
)(2
3 zGzc
zc)(
)(
)(3
1
3 zGzc
zc
G1(z) G2(z)c1
Tc3
c2
Closed-Loop System)(ˆ ze
)(ˆ zc
)(2 sy
D (z) H (s) Gp (s)
set point
Hold Processdisturbance
ysp (z)
+
-
T
m (s)
T
y(2)y1(s)
sampled output)(ˆ zy
)(ˆ)(ˆ)()()(
)(ˆ)(ˆ)()(
)(ˆ)(ˆ)(
)()(
)()()()(ˆ
2
2
2
21
21
zyzyzyzDzHG
zyzezDzHG
zyzezHG
syZsyZ
sysyZsyZzy
spp
p
p
)()(1
)(ˆ
)()(1
)()()()(ˆ 2
zDzHG
zy
zDzHG
zyzDzHGzy
pp
spp
or
1. Roots of the Characteristic equation 1+HGp(z)D(z)=0 Determine stability of the closed-loop system2. Note similarity to continuous system.
Example: closed-loop response of a first-order system
1/
1/
1
)1()(
1)(
ze
zekzHG
S
ksG
p
p
T
T
pp
p
pp
)(ˆ11
)1(
1
)1(1
)(ˆ1
)1(
)(ˆ
)(
1
1
1/
1/
1/
1/
zyzkkbkk
zbkk
kze
zek
zykze
zek
zy
kzD
spcpcp
cp
cT
T
p
spcT
T
p
c
p
p
p
p
pTeb /
For proportional control
where
cp
pp
nT
cp
cp
cpcp
cp
kk
ekk
kknTy
zzkkbkk
zbkkzy
p
1
11
)(
)1(
1
)]1([1
)1()(ˆ
/
11
1
For a unit step change in set point
and
11
1)(ˆ
zzysp
The response is very similar to continuous control.
The steady state value of y(t) is
Hence the offset is
cp
pc
KK
KKy
1
cppc
pc
KKKK
KKoffset
1
1
11
Stability of Discrete Systems
0 zb.....zbzb1 -nn
-22
-11
1n
n1
2
21
1
1
nn
11
mm
110
zP1
c
zP1
c
zP1
c
zbzb1
zazaa
(z)e
(z)cD(z)
A system is consider to be stable if output remains bounded for boundedInputs. Consider a discrete system with transfer function
Where P1,P2,…,Pn are n roots of:
1) and between(-1 bounded always is termsecond The
eee
eee
jw)ln(PPkln
e|P|jβαPLet
eC(nT)f
zP-1
C(z)f
njw)nln(PnlnP
jw)ln(PlnP
K
jwKK
nlnPKk
1K
kK
KK
KK
K
termk heconsider t
D(z)C(z) and 1(z)eimput impulsean For th
bounded.remain willPplane,
complex on the circle-unit e within thlies P if:Hence
n as e and 0|P|ln then 1|P|
1e and 0|P|ln then 1|P|
n as 0e and 0|P|ln then 1|P|
IF
K
K
nlnPKK
|P|nlnKK
|P|nlnKK
K
K
K
plane"complex in the circleunit on theor
inside lies poles its all if stable is system discreteA "
Im
Unstable roots
real
Unit circle
STABLE
REGION
yoscillator:0y(t) then 0P1-
decay lexponentia:0y(t) then 1P0
tas y(t)1,|P| if
Py(nT)
Py(1)
....zPzP1zP-1
1(z)y
zP-1
1D(z)
withsystem a of response impule heConsider t
1
i
1
na1
1
2-21
1-11
1
11
poles of Location
Example: Stability of closed-loop
1][eKKe
KK- )eKK(1
KK-)bKK(1P
0)]zKKb(1-K[K1
PP
P
τ
T-
CPτ
T-
CPτ
T-
CP
CPCP1
1-CPCP
equation sticcharacteri Processorder -First of control lProporhona
Example: Stability of closed-loop - Continued
T of values highor K of values high by caused be may instabitythat note
where circle unti the cross will p
C
1
P
P
P
PP
PP
τ
T-
τ
T-
CP
CPτ
T-
τ
T-
CPτ
T-
τ
T-
CPτ
T-
e-1
e1KKor
-1KK 1 e sinceor
]e-[1KK-)e-1or(
]e-[1KK-e1
t
C 0 st 0
nD
n C n k n n-1 sk 0 I
n-1 C
1 de C(t) K [e(t) e(t)dt τ ] C
τ dt
τT C K [e (e ) (e -e )] C
τ T
C K [
1.Digital Apperoximation of classical controllers
Displacement form
Alternative form :
Velocity formn 1
Dn-1 k n-1 n-2 s
k 0 I
D D Dn C n C n-1 C n-2
I
-1 -2D D DC
I
τTe e (e -e )] C
τ T
τ 2τ τT ΔC K [1 ]e -K [1 ]e K e
τ T T T
τ 2τ τΔ τ(z) T D(z) K [(1 )-(1 )z z ]
τ T T Te(z)
Digital Feedback - Control
1. No initialization is necessary. [ Cs is not needed ] Bumpless transfer from manual / automatic
2. Automatic ‘reset-windup’ protection.3. Protection in case of computer failure
1. Since different modes are indistinguishable, on-line tuning methods will not work.
2. Difficult to put constraints on integral and / or derivative term.
1. Ziegler – Nichols
2. Cohen – Coon settings
3. Time - integral performance criteria
Disadvantages:
Tuning Digital Controllers:
Advantages of velocity Form
:responses Possible
controller Prototype Minimalor Deadbeat
1-
1-
1-
1-
1-sp
sp
z-1
z
HG(z)
1D(z)
:D(z)for solving
sampling oneafter 1 togoes ex.y(t) z-1
z)(y
want we
change-step z-1
1yLet
(z)yHG(z)D(z)1
HG(z)D(z)(z)y
have we
:changepoint set a following samplingfrist at theerror no
values)pledoutput(sam thesuch that designed is law-control This
2.
z
Y(t)
actual
time
ideal
Derivation of Deadbeat Controller- Continued
sp
1
sp 1 1
1
sp
-1
-1
-1
-1
HG(z)D(z)y (z) y (z)
1 HG(z)D(z)
1ˆy ;
1 1ˆ( ) HG(z)D(z)
y 1 1 HG(z)D(z)
z HG(z)D(z)
1-z 1
z 1
1-z HG(z)
zz y z
z z
y z z
z
D z
Deadbeat
Deadbeat
0~10 sec
Deadbeat control for (1/(s+1)3)
Sampling time: 2
321
321
1
1
2
23
1
1
01584.02915.0016.03233.0
002479.005495.0406.01
101584.03073.03233.0
002479.005495.0406.0
1)(
1
ZZZ
ZZZ
Z
Z
ZZ
ZZZ
Z
Z
ZHGZD
Ringing and Pole-placement
Ringing refers to excessive value movement caused by a widely oscillating controller output.
Caused by negative poles in D(z).
Hence avoid poles near -1.
Change controller design such that poles are on the side or near zero on negative side
SYS = TF(1,[1 3 3 1]) Transfer function: 1 --------------------- s^3 + 3 s^2 + 3 s + 1 >> sysd=c2d(SYS,2) Transfer function: 0.3233 z^2 + 0.3073 z + 0.01584 -------------------------------------- z^3 - 0.406 z^2 + 0.05495 z - 0.002479 Sampling time: 2 0.3233 0.6306 0.3231 0.0158
>> p1=[1 -1];p2=[0.3233 0.3073 0.01584]
p2 =
0.3233 0.3073 0.0158
>> c=conv(p1,p2)
c =
0.3233 -0.0160 -0.2915 -0.0158
Canceling the ringing pole at z=-0.8958
ans =
1.0000 -0.8958 -0.0547
>> p1=[1 0];p2=[1 -0.99];p3=[1 0.0547]; >> c=conv(p1,p2)
c =
1.0000 -0.9900 0
>> c=conv(c,p3)
c =
1.0000 -0.9353 -0.0542 0
Warning: Using a default value of 1 for maximum step size. The simulation step size will be limited to be less than this value.
>>
Smoothing the Control Action
p=[0.3233 -0.016 -0.2915 -0.01584]; r=roots(p) r = 1.0001 -0.8959 -0.0547 Delete the unstable pole z=-0.8959
p1=[1 -0.99]; p2=[1 0.0547]; c=conv(p1,p2)
c =
1.0000 -0.9353 -0.0542
Reconstruct the Control Loop
Zero-OrderHold
1
den(s)
Transfer FcnSubtract
Step
Scope1
Scope
num(z)
den(z)
DiscreteTransfer Fcn
0 5 10 15 20 25 30 35 40 45 500
0.2
0.4
0.6
0.8
1
1.2
1.4
The treatment of unstable poles sysd=c2d(SYS,1) Transfer function: 0.0803 z^2 + 0.1544 z + 0.01788 ----------------------------------- z^3 - 1.104 z^2 + 0.406 z - 0.04979
>> p2=[ 0.0803 0.1544 0.01788]
p2 =
0.0803 0.1544 0.0179
>> p1=[1 -1]
p1 =
1 -1
>> c=conv(p1,p2)
c =
0.0803 0.0741 -0.1365 -0.0179
The treatment of unstable poles
>> roots(c)
ans =
-1.7990 1.0000 -0.1238
>> p1=[1 0];p2=[1 -0.99];p3=[1 0.1238]; >> c=conv(p1,p2)
c =
1.0000 -0.9900 0
>> c=conv(c,p3)
c =
1.0000 -0.8662 -0.1226 0
0 5 10 15 20 25 30 35 40 45 500
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
3.Dahlin’s Method
Require that the closed–loop system behave like a first-order system with dead-time.
response) (step S
1
1S
e y(S)
S -
)ze-)(1z-(1
)ze-(1z (z)y
1-T/-1-
-1-T/k-
1-sp z-1
1(z)y
1-k-T/-1-T/-
1--k-T/
)ze-(1-ze-1
)ze-(1
HG(z)
1 D(z)
1. Choose , such that D(z) is realizable2. Lot of algebra
Solving for D
we want
for
Dahlin’s Method
Dahlin’s Method
0~10sec0~50 sec
Dahlin’s Method for for (1/(s+1)3)
Sampling time: 2
4321
4321
11
1
2
23
11
1
01001.02001.03016.01884.03233.0
001567.003474.02566.06321.0
)1(1
)1(
01584.03073.03233.0
002479.005495.0406.0
)1(1
)1(
)(
1
ZZZZ
ZZZZ
ZeZe
Ze
ZZ
ZZZ
ZeZe
Ze
ZHGZD
k
TT
k
T
k
TT
k
T
Regulatory Control
Consider a process described by
yn = a1yn-1 + a2yn-2 + … + b1mn-1 + … + bk mn-k
In regulatory control, we want to keep y close to zero in presence of disturbances.
Ideally choose mn such that
yn ≡ ysp
ysp = a1yn + a2yn-2 + … + bkyn-k+1 + b1 mn + b2mn-1 + bkmn-k+1
Or mn = -1/b1 [ ysp – a1yn – a yn-1 - akyn-k+1 – b2mn-1 + … - bkmn-k+1 ]
Remark1. Problems can arise in practice if model parameters are not known
2. The above choice is equivalent to minimizing
3. If dead-time is present control will be unrealizable
N
0n
2spn )y-(y
N
1 P