Vous êtes sur la page 1sur 57

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


y Continuous Disontinuous y*
signal signal

y y*

9 12
1 3 5 7 9 11 t (sec) 1 3 6 t (sec)

T = 1 sec

y*
(a) (b)

9 12
3 6 t (sec)

T = 3 sec
(c)
Continuous signal and its discrete-time representation with different sampling rates

y* y*
t t

t = nT t t = nT t
y* (b)
(a)
Impulse area nT

t = nT t
(c)
From the response of a real sampler to the response of an ideal impulse sample
The Sampling Process
Impulse
y (t) Sampler y*

y* t y(0) (t) y(T) (t - T) .... y(nT) (t - nT) ...



y(nT) (t - nT)
n 0

1. At sampling times, strength of impulse is equal to value of input signal.


2. Between sampling times, it is zero.

Laplacing

y (s) y(nT)L [ (t - nT)]
*

n 0


or y (s) y(nT) e -nTs
*

n 0
The Hold Process :
From Discrete to Continuous Time

discrete Continuous
impulses m* (t) m (t) output
Hold Device

Zero Order Hold :

m(t) m* (t) for nT t (n 1)T

Transfer Function :
Response of an impulse input : (t)
1

m* (t) m (t)

t T


-Ts
1 e 1
H(s) - 1 - e -Ts
s s s
First Order Hold
m(nT) - m[(n - 1)T]
m(t) m(nT) (t - nT)
T
nT t (n 1)T n 2,3,4....etc

Response to an impulse input

T 2T

-1

Transfer function: 2
1 sT 1 - e -sT
H(S)
T s
First Order versus Zero Order Hold
m* (nT)
m (t)

m (t)

0 t
1T 3T 5T 7T 0 t
1T 3T 5T 7T

(a) (b)

0 t
1T 3T 5T 7T
(c)

Comparison of reconstruction with zero-order and first-order holds, for slowly varying signals.
m* (nT)
m (t)

m (t)
0 2T 4T 6T 8T 10T t
0 2T 4T 6T 8T 10T t
(a) (b)

0 2T 4T 6T 8T 10T t
(c)

Comparison of reconstruction with zero-order and first-order holds, for rapidly changing signals.
Z-Transforms
Sample
y(t) yz(t)

y ( s ) y ( n )e nTs
z

n 0

Let z eTs

y ( s ) y ( n ) z n
z

n 0

y( z )



y (t ) y(z)
z
y(n )z
n 0
-n

Remarks
1. 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 w
ill be the same.

2. It is assumed that the summation exists and is finit.


Z-Transforms of Basic Functions
1. Unit Step Function

Z[u(t)] 1 1 z 1 1 z 2 1 z 3 ......
1 z

1 z 1 z-1
2. Exponential Function

e

Ze -at anT
z n
n , e -aT z 1
n 0 n 0

1

1
1
-aT 1
1-e z
z

z-e -aT
e -aT z 1 1 for convergence
Z-Transforms of Basic Functions -
Continued

3. Ramp Function

Z at S 0 aT(z 1 ) 2(aT)z 2 3(aT)z 3 ...


z 1S aTz 2 2(aT)z 3
1 1 2 aTz 1
3
(1 z ) S 0 aT(z ) (aT)z (aT)z ...
1 z 1

4. Trigonometric Functions
zsinwT
Z sinwt 2
z 2zcoswT 1
z 2 zcoswT
Z coswt 2
z 2zcoswT 1
Z-Transforms of Basic Functions -
Continued
5. Translation

Z f(t - kT) Z
e

kTs
f (s)
f (z)z k


Z f(t - kT) f(nT kT)z n
n 0

let l n - k,assume f()l 0 for l 0



f()z
l
n k
l k


l
f()z
-l
z

k

l 0

f (z) z k
Z-transform for Numerical
Derivative

z f(t - T) f (z)z 1

z-1 is like a back shift operator

dy ynt yn 1

dt T

y n y n 1 1 z
Z
1

y(z)

T T
Properties of z-Transforms
1. Linearity


Z a f a f

1 1 2

2

a f (z) a f (z)
1 1 2 2

2. Final Value Theorem


lim y(t) lim (1-z )y (z) -1

t z 1

Proof: (1-z )f y(z)(1 z ) y(nT ) z n y(nT ) z n y(nT ) z n 1
-1 -1

n0 n0 n0

lim y( 0 )-y( 0 )z -1 y(T )-y(T)z -1 z1 y( 2T)-y( 2T)z -1 z 2.... y(nT)



n




As z1 lim (1 z1 )y(z) lim y nT lim y(t)


z 1 n t
Numerical Integration in z-transform
t nT
y(t) f t dt
0
nT
y nT y (n-1 )T f(t)dt
(n-1 )T

Using Trapezoidal Rule


f(nT ) f n-1T
y (n 1 )T T
2

y(z) y (z) z 1 T f(z) z 1 f(z)



2
or solving

y z T 1 z f z
1

2 1 z 1
Inversion of z-transforms

1.Partial fraction expansion Q ( z 1 ) c1 c2 cn


y ( z ) ...
P ( z 1 ) 1 ( z 1 ) 2 ( z 1 ) n ( z 1 )

1, 2, n are low-order polynomials in z-1 compute c1,c2,cn.


Invert each part separately, we able
z z 1
y ( z ) 2
z 4 z 3 1 4 z 1 3 z 2
z 1 c1 c2

(1 z 1 )(1 3 z 1 ) 1 z 1 1 3 z 1
z 1 1
c1 z 1 1

1 3 z 1 2
z 1 1
c1 1
1 z 1 z 1 3 2
1 2 12
y ( z )
1 z 1 1 3 z 1
From Tables of z-transforms

y(nT) = -1/2 + 1/2 e11n


y:0,1,4,13,0,
z 1
y ( z )
1 4 z 1 3 z 2
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) = 0
y(T) = 1
y(2T) = 4
y(3T) = 13
z-transforms of various functions

Function Lalpace transform z-transform


in time domain

unit impluse 1 1
1
unit step 1/s 1 z 1
aTz 1
ramp: f(t) = at a/s2 (1 z 1 ) 2
n 1
lim (1) n
f(t) = tn n!/sn+1 a n 1 e aT z 1
a 0

1
f(t) = e-at 1/s+a 1 e aT z 1
e aT z 1
(1 e aT z 1 ) 2
f(t) =te-at 1/(s+a)2
z-transforms of various functions

Function Lalpace transform z-transform


in time domain

f(t) = sint z 1 sin T


s2 2 1 2 z 1 cos T z 2
f(t) = cost s 1 z cos T
s2 2 1 2 z 1 cos T z 2
a (1 e aT ) z
f(t) = 1-e-at
s( s a) (1 z 1 )(1 e aT z )
z e aT sin T
f(t) = e sint
-at
( s a)2 2 1 2 z 1e aT cos T e 2 aT z 2
sa 1 z 1e aT cos T
f(t) = e-at cost ( s a)2 2 1 2 z 1e aT cos T e 2 aT z 2
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.
en cn
Discrete System
Example of Discrete Systems
Let dc

ken c
dt
a discrete time approximation is
cn cn 1
ken cn
T

cn cn 1 kcn cn
T T

(1 )cn cn 1 ken
T T

Taking z-transform

(1 ) c( z ) z 1 c( z ) ke( z )
T T
c( z ) k
or
e( z ) (1 ) z 1
T T
Z-transform for a given continuous
system with transfer function G(s)
and a ZOH
1 e Ts
Z H ( s )G ( s ) Z G (s)
s
G s Ts G s
Z Z e
s s
G s 1 G s
Z z Z
s s
G s
1 z Z
1

s
Example: Pure Integrator with Hold
1 e ST Kp
c*(s) s s y*(s
)
1 e Ts K p
HG p ( s)
s s
1 e Ts K p Kp K p e Ts
Z HG ( s ) Z [ . ] Z[ 2 ] Z[ 2 ]
s s s s
1
Kp 1
K pTz K pT z 1
[1 - z ] Z [ 2 ] [1 z ]
-1

s (1 z 1 ) 2 (1 z 1 )

Step response

Hence of 1
c( s )
s
1
c( z )
1 z 1
K p z 1 1 K p z 1
y ( z )
(1 z 1 ) (1 z 1 ) (1 z 1 ) 2

which impulse a ramp response


Example First order lag system

1 e ST K p
H ( s )G p ( s )
s ps 1
1 e ST Kp
Z [ HG ( s )] Z [ ]
s s ( p s 1)
1
Kp
[1 z ]Z [ ]
s( p s 1)
1 1
K p [1 z 1 ]Z [ ]
s s 1 p
1 1
K p [1 z 1 ][ 1
T p 1
]
1 z 1 e z
T
(1 e p ) z 1
Kp T
1 e p z 1
Step Response for 1st order
lag system
From tables, for
1 1
c( s ) c( z )
s 1 z 1
p
K p (1 e ) z 1
y(z)
(1 z 1 )(1 e p z 1 )
Kp Kp y(t)

(1 z ) (1 e p z 1 )
1


nT p
y (nT ) K p [1 e ]

y (t ) K p to t

time
Note: Compare with discrete approximation to
First-order system
Generalization
cn a 0en a1en 1 ... aken k b1cn 1
b 2cn 2 ... bmcn m
c( z ) a 0e( z ) a1 z 1e( z ) ... ak e( z ) z k
b1c( z ) z 1 b2 c( z ) z 2 ... bm c( z ) z m

or c( z ) a0 a1 z 1 a2 z 2 ... ak z k
1 2 m
D( z )
e( z ) 1 b1 z b2 z ... bm z

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 t
o an impulse input e( z ) 1
Z-transform of a continuous
process with Sample and Hold
Hold Process
H (s) Gp (s)
discrete c*(s) y (s) y*(s)
input
discrete
continuous output
variables

we seek a relationship (Z-transfer function) between c and y.

Consider a impulse input c*(z)=1


c*(s)=1
Then y ( s ) H ( s)Gp ( s )c ( s)
H ( s)Gp ( s )
y ( z ) Z y s
Z [ H s Gp ( s)]
HGP ( z )

HGp(z) called the pulse transfer function


(since it represents the z-transform of the pulse response of Gp (s) )
Properties of pulse Transfer Function

1. Z G1 ( s)G2 ( s ) Z G1 ( s ) Z G2 ( s )

2.An impulse input is converted into a pulse input by the first or


der 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 c


ombined if there is a sample and hold in between.

c1 c2
c3
G1(z) G2(z)
T

c3 ( z ) c2 ( z ) c3 ( z )
G3 ( z ) G1 ( z ) G2 ( z )
c1 ( z ) c1 ( z ) c 2( z )
Closed-Loop System
disturbance
Hold Process y2 ( s)
T e( z ) T
+ D (z) H (s) Gp (s)
y(2)
set m (s)
ysp (z) - ( z )
c y1(s)
point

y ( z )
sampled output

y ( z ) Z y ( s ) Z y1 ( s ) y 2 ( s )
Z y1 ( s ) Z y 2 ( s )
HG p ( z )e( z ) y 2 ( z )
HG p ( z ) D ( z )e( z ) y 2 ( z )

HG p ( z ) D ( z ) y sp ( z ) y ( z ) y 2 ( z )

or HG p ( z ) D ( z ) y sp ( z ) y 2 ( z )
y ( z )
1 HG p ( z ) D( z ) 1 HG p ( z ) D ( z )

1. Roots of the Characteristic equation


1+HGp(z)D(z)=0
Determine stability of the closed-loop system
2. Note similarity to continuous system.
Example: closed-loop response of a
first-order system
kp
G p (s)
pS 1
T /
(1 e p
) z 1
HG p ( z ) k p T /
1 e p
z 1

For proportional control


D( z ) kc
T /
(1 e p
) z 1
kp T / p 1
kc y sp ( z )
( z)
y 1 e z
T / p
(1 e ) z 1
1 k p T / p 1
kc
1 e z
k p k c (1 b) z 1
sp ( z )
y

1 k p k c b1 k p k c z 1

where
T / p
be
1
For a unit step change in set point y sp ( z )
1 z 1

and k p k c (1 b) z 1 1
y ( z ) 1

1 [ k p kc b(1 k p kc )]z (1 z 1 )

y ( nT )
k p kc
1 k p kc
1 e nT / p

p
p
1 k p kc
The response is very similar to continuous control.

The steady state value of y(t) is


Kc K p
y
1 K p Kc

Hence the offset is


Kc K p 1
offset 1
1 Kc K p 1 K p Kc
Stability of Discrete Systems
A system is consider to be stable if output remains bounded for bounded
Inputs. Consider a discrete system with transfer function

c (z) a0 a1 z 1 am z m
D(z) 1 n
e (z) 1 b1 z bn z
c1 c2 cn
1
1

1 P1 z 1 P2 z 1 Pn z 1

Where P1,P2,,Pn are n roots of:

1 b1 z -1 b2 z -2 ..... bn z -n 0

For an impulse imput e(z) 1 and C(z) D(z)
consider the k th term
Ck
f K (z) 1
1 - PK z
f k (nT) C K e nlnPK

Let PK j | PK | e jw
ln Pk ln(PK ) jw
e lnPK
e ln(PK )
e jw

e nlnPK e nln(PK ) e njw


The second term is always bounded between(-1 and 1)
IF
| PK | 1 then ln | PK | 0 and e nln|PK | 0 as n
| PK | 1 then ln | PK | 0 and e nln|PK | 1
| PK | 1 then ln | PK | 0 and e nlnPK as n

Hence : if PK lies within the unit - circle on the complex


plane, PK will remain bounded.

" A discrete system is stable if all its poles lies inside


or on the unit circle in the complex plane"
Im

Unstable
roots

real

STABLE
REGION
Unit
circle
Location of poles
Consider the impule response of a system with
1
D(z)
1 - P1 z 1
1 2 -2
y(z) 1
1 P1 z -1
P1 z ....
1 - P1 z
y(1) P1
na
y(nT) P1
if | P1 | 1, y(t) as t
0 Pi 1 then y(t) 0 : exponential decay
- 1 P1 0 then y(t) 0 : oscillatory
Example: Stability of closed-loop

Proporhonal control of First - order Process characteristic equation

1 [K P K C - b(1 K P K C )]z -1 0

P1 (1 K P K C )b - K P K C
-T

(1 K P K C )e P
- K PKC
-T -T

e P
K P K C [e P
1]
Example: Stability of closed-
loop - Continued

p1 will cross the unti circle where


-T -T

1 e - K P K C [1 - e ]
P P

-T -T

or(1 - e ) - K P K C [1 - e ]
P P

-T

or since e P
1 K P K C -1
-T

1 e P
or K P K C -T
P
1- e
note that instabity may be caused by high values of K C or high values of T
Digital Feedback - Control
1.Digital Apperoximation of classical controllers
Displacement form
t
1 de
C(t) K C [e(t) 0C
e(t)dt] s
dt
t 0
n
T
C n K C [e n (e k ) D (e n -e n-1 )] Cs
k 0 T
I

Alternative form :
Velocity form
n 1
T
C n-1 K C [e n-1 e k D (e n-1 -e n-2 )] Cs
k 0 T
I

T 2
C n K C [1 D ]e n -K C [1 D
]e n-1 K C D
e n-2
T
I T T

(z) T 2
D(z)
K C [(1 D )-(1 D
)z -1 D
z -2 ]
e (z) T
I T T
Advantages of velocity Form

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

Disadvantages:
1. Since different modes are indistinguishable, on-line tuning
methods will not work.
2. Difficult to put constraints on integral and / or derivative term.

Tuning Digital Controllers:


1. Ziegler Nichols
2. Cohen Coon settings
3. Time - integral performance criteria
2.Deadbeat or Minimal Prototype controller
This control - law is designed such that the output(sampled values)
no error at the frist sampling following a set point change :
we have
HG(z)D(z)
y(z) y sp (z)
1 HG(z)D(z)
1
Let y sp -1
step - change
1- z
we want
z -1
y( z ) ex.y(t) goes to 1 after one sampling
1 - z -1
solving for D(z) :
1 z -1 Y(t)
D(z)
HG(z) 1 - z -1
actual
Possible responses :
ideal

time
Derivation of Deadbeat
Controller- Continued
HG(z)D(z)
y (z) ysp (z)
1 HG(z)D(z)
) 1 z 1
ysp z 1
; y z
1 z 1 z 1
y ( z ) z 1 HG(z)D(z)
)
ysp z 1 1 HG(z)D(z)
z -1 HG(z)D(z)
-1

1-z 1
z -1 1
D z -1
1-z HG(z)
Deadbeat
Deadbeat

0~10 sec
Deadbeat control for (1/(s+1)3)

1 Z 1 Z 3 0.406Z 2 0.05495Z 0.002479 Z 1


D Z
HG( Z ) 1 Z 1 0.3233Z 2 0.3073Z 0.01584 1 Z 1
1 0.406Z 1 0.05495Z 2 0.002479Z 3

0.3233 0.016Z 1 0.2915Z 2 0.01584Z 3

Sampling time: 2
Ringing and Pole-placement

Ringing
refers to excessive value movement caused by a widely oscillati
ng 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 zer
o 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

Scope1
Step

num(z) 1
den(z) den(s)
Subtract Zero-Order Scope
Discrete Transfer Fcn
Transfer Fcn Hold
1.4

1.2

0.8

0.6

0.4

0.2

0
0 5 10 15 20 25 30 35 40 45 50
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

1.0000 0.9
-0.1238 0.8

0.7

0.6
>> p1=[1 0];p2=[1 -0.99];p3=[1 0.1238];
>> c=conv(p1,p2) 0.5

0.4
c=
0.3

0.2
1.0000 -0.9900 0
0.1

>> c=conv(c,p3) 0
0 5 10 15 20 25 30 35 40 45 50

c=

1.0000 -0.8662 -0.1226 0


3.Dahlins Method
Require that the closedloop system behave like a first-order
system with dead-time.
e - S 1
y(S) (step response)
S 1 S
-T/ -1
(1 - e )z
we want y(z) z -k
(1 - z -1 )(1 - e -T/ z -1 )
1
for y sp (z)
1 - z -1
Solving for D
1 (1 - e -T/ )z -k-1
D(z)
HG(z) 1 - e -T/ z -1 - (1 - e -T/ )z -k -1

1. Choose , such that D(z) is realizable


2. Lot of algebra
Dahlins Method
Dahlins Method

0~10sec
0~50 sec
Dahlins Method for for (1/(s+
1)3)

T T


1 (1 e ) Z k 1 Z 3 0.406 Z 2 0.05495 Z 0.002479 (1 e
) Z k 1
D Z
HG ( Z )
T


T

0.3233Z 2 0.3073Z 0.01584
T


T

1 e Z 1 (1 e ) Z k 1 1 e Z 1 (1 e ) Z k 1
0.6321Z 1 0.2566 Z 2 0.03474 Z 3 0.001567 Z 4

0.3233 0.1884 Z 1 0.3016 Z 2 0.2001Z 3 0.01001Z 4

Sampling time: 2
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 ]

Remark
1. Problems can arise in practice if model parameters are not known

1 N
2. The above choice is equivalent to minimizing P (y n - y sp ) 2
N n 0

3. If dead-time is present control will be unrealizable

Vous aimerez peut-être aussi