Beruflich Dokumente
Kultur Dokumente
e(t) u(t)
y(t)
r (t) +
Controller Process
_
y(t)
Approximation of the transfer function
The aim in the approximation of a continuous transfer
function is to develop a discrete system, which
corresponds to the continuous transfer function. This
has earlier been done, but then assuming a zero order
or first order hold.
But the hold assumtion is not always valid (the output
signal y changes arbitrarily and the controller measures
the signal as such). Usually a discrete approximation
starts from the approximations of the derivative and the
integral, assuming that the signal is smooth.
Approximations of the derivative
Starting from the definition of the derivative
df (tn ) f (tn ) f (tn t ) f(t) .
f (tn ) lim . f + (t n )
dt t 0 t f - (t n )
df (tn ) f (t t) f (tn )
f (tn ) lim n
dt t 0 t t
tn
The results are the same for smooth functions
f ( t ) f ( t ) f ( t )
Approximations of the derivative
From these definitions the backward and forward
approximations are obtained. The ”Euler method” is
the same as forward derivation.
1
f ( kh ) f ( kh h ) 1 q
p f ( t ) f ( t ) f ( kh) f ( kh)
h h
f ( kh h) f ( kh) q 1
p f (t ) f (t ) f ( kh) f ( kh)
h h
Approximations are
1 q 1 q 1 1 q 1 q 1
p p 1
h qh q h h
Approximations of the integral
Correspondingly, integrals can be approximated as
sums
f(t) f(t)
hhh hhh h h h h h h h h
t t
z z k 1
t k t
1 1
f (t ) f ( )d f (ih) h f (t ) f ( ) d f (ih) h
p i p i
Approximations of the integral
c h
k
h
i
f (ih) h q f ( kh) h f ( kh) h q
j 0
j
j 0
1 j
1 q 1
f ( kh)
k 1
q 1h
f (ih) h q
i j 0
( j 1)
f ( kh)h q h f ( kh) q
1
j 0
j
1 q 1
f ( kh)
z
t k
Int f ( t ) f ( ) d f (ih) h
i
Approximations of the integral
z
kh k
Int f ( kh) f ( )d f (ih) h
i
k 1 k
Int f ( kh h) f (ih) h f (ih) h f ( kh h) h
i i
Int f ( kh) f ( kh h) h
Int f ( kh h) Int f ( kh) f ( kh h) h
(q 1) Int f ( kh) qf ( kh) h
qh h
Int f ( kh) f ( kh) 1
f ( kh)
q 1 1 q
Approximations of the integral
The integral approximations are
1
h
qh 1 q 1h h
and
p 1 q 1 q 1 p 1 q 1 q 1
1 q 1 q 1 1 q 1 q 1
p p 1
h qh q h h
Approximations of the integral
Let us derive one more integral approximation. The
use of the trapetsoidal rule to the integral leads to the
Tustin approximation or the bilinear approximation.
The result is:
z 1 k 1
t
1 1 k
f ( t ) f ( )d f (ih) h f (ih) h
p
2 i 2 i
1 qh 1 h h q 1
f ( kh) f ( kh) f ( kh)
2 q 1 2 q 1 2 q 1
1 h q 1 h 1 q 1 2 q 1 2 1 q 1
p
p 2 q 1 2 1 q 1 h q 1 h 1 q 1
Approximations of differential equations
Each derivative operator p is substituted by the shift
operator q or by a function of it.
Approximation of 1 q 1 q 1
p
backward h qh
differentiation
1 q 1 q 1
Euler approximation p 1
q h h
Tustin approximation 2 1 q 1 2 q 1
p 1
h 1 q h q 1
Approximations of the transfer functions
When playing with transfer functions and pulse transfer
functions, then instead of p and q the variables s and z
are used.
H ( z) GG
F 1 z I 1
J GG
F z 1I
J
H h K zh K H
Backward differences bd
F
H ( z) GG
1 z I
1
J GG
F z 1I
J
Euler approximation e
H hz K H h K
1
F
H ( z) GG
2 1 z I
J
1
F
G 2 z 1I
J
Tustin approximation t
H h 1 z K h z 1K
1
G
H
Approximations of the transfer function,
example
q 1
y (t ) 2 y (t ) u (t ) y (kh) 2 y (kh) u ( kh)
qh
(q 1) y (kh) 2hqy ( kh) hqu (kh)
y (kh h) y ( kh) 2hy (kh h) hu (kh h)
(1 2h) y (kh h) y (kh) hu (kh h)
1 h
y (kh h) y (kh) u (kh h)
1 2h 1 2h
Approximations of the transfer function,
example
the Euler approximation
q 1
y (t ) 2 y (t ) u (t ) y (kh) 2 y (kh) u (kh)
h
(q 1) y (kh) 2hy ( kh) hu ( kh)
y ( kh h) y ( kh) 2hy ( kh) hu (kh)
y (kh h) (1 2h) y (kh) hu (kh)
the Tustin approximation
2 q 1
y (t ) 2 y ( t ) u( t ) y ( kh) 2 y ( kh) u( kh)
h q 1
Approximations of the transfer function,
example
2(q 1) y(kh) 2h(q 1) y(kh) h(q 1)u(kh)
y(kh h) y(kh) hy(kh h) hy(kh) 12 hu(kh h) 12 hu(kh)
(1 h) y(kh h) (1 h) y(kh) 12 hu(kh h) 12 hu(kh)
1 h 1
h 1
2h
y(kh h) y(kh) 2
u(kh h) u(kh)
1 h 1 h 1 h
1 F 2 z 1I h 1
H ( z) GG J
2
z
h 1
2
G ( s)
s2
t
H h z 1K z h 1
h 1
Approximations of the transfer function,
example
Compare the different
approximations by simulation.
Try the step function input
(ZOH-assumption is valid)
1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 2 4 6 8 10 12 14 16 18 20
Approximations of the transfer function,
example
With high sampling frequencies all approximations work well;
however, this is not the case for lower sampling rates.
h=0.01 h=0.1
0.5 0.5
0 0
-0.5 -0.5
0 5 10 15 20 0 5 10 15 20
h=0.5 h=1
0.5 0.5
0 0
-0.5 -0.5
0 5 10 15 20 0 5 10 15 20
Approximations of the transfer function,
example
The ZOH-
approximation
works well for
all sampling
rates, because
the input signal
happens to be
constant
between the
sampling
instants.
Approximations of the transfer function,
example
The backward
difference
approximation
seems to work
well.
Approximations of the transfer function,
example
The Euler
approximation
gives an
unstable
response for
low sampling
rates.
Approximations of the transfer function,
example
The Tustin
approximation
works
reasonably
well
Approximations of the transfer function,
example
For smooth
signals all ZOH B.D
give a good
0 0
response. A
sinusoidal -0.5 -0.5
signal with 0 5 10 15 20 0 5 10 15 20
0 0
-0.5 -0.5
0 5 10 15 20 0 5 10 15 20
Stability of the approximated transfer functions
J F 2 z 1I
GG J
t
H h 1 z K h z 1K
1
H
Frequency folding
Compare the frequency response of the continuous process
G(s) to that of a Tustin equivalent H(z).
Continuous response: F ( ) G (i )
Discrete response: F ( ) H (eih )
By the Tustin approximation:
F
H (e ) G G
2 e 1I
i h F i h
2 e e
i2h
I GF 2 i sin( ) I
h
J GG JK GH h cos( ) JK
2
i h
H h e 1K H h e e
2
i h i h
2
i2h h
2
Gbi tan( ) g
2
h
h
2 G (i ) G bi tan(
2
h
h
2 )g
Frequency folding
That means that if the continuous system performance has
been optimized at a certain frequency w’, the Tustin
approximation folds the frequency scale into the frequency w,
for which it holds:
2
' tan
FG IJ
h 2
tan 1
' hFG IJ
' 1
(FG
' h ) 2
IJ
h H K
2 h 2 H K H
12 K
It is easy to modify the Tustin approximation such that the
frequency folding is removed at a given frequency w1.
F
(z) G G
z 1I
H tan( h / 2 ) z 1 JK
1
H t , pw
1
Discrete PID-controller
The discrete PID-controller is the most frequently used
controller in process industry today. It can easily be derived
from the continuous PID-controller. The “textbook version”
of the continuous PID-algorithm is
F
u(t ) K G e(t ) z e( s)ds T
t
de(t ) I
H T
1
I
D
dt K J P ( t ) I ( t ) D( t )
F
U ( s) G ( s) E ( s) K G1
1 I
T sJ E ( s) P( s) I ( s) D( s)
PID
H Ts K I
D
TD s TD i
TD s TD i
1 TD i N
1 TD s N
e( kh)
T
TD
T D
dt
D
h h
Discrete PID-controller
The Euler approximation cannot be used, because the
controller would not be causal (a future value would be
needed to calculate the derivative). For the integral part the
Euler approximation is usually used. A discrete PID-
controller is obtained by substituting the integral of the error
by a sum, the derivative by a difference, and by dividing the
parameters TI and TD with the sampling interval h.
F
u( kh) K G e( kh) e( kh)
1 TD I
e( kh)J
H TI
h
h
K
Discrete PID-controller
As a pulse transfer function the controller is
F
U ( z) K G1
1 1
TD z 1 IJ
E ( z ) H PID ( z ) E ( z )
H z 1
TI
h
h
z K
The algorithm is called absolute, because it calculates the
total value of the controller output. That means the
calculation of a sum at each time instant, which is not
effective algorithmically. The velocity form of the algorithm is
much more effective, because only the change of the
controller output is calculated at each step. Hence it is not
necessary to calculate a large sum.
Discrete PID-controller
The change becomes: u( kh) u( kh) u( kh h)
F k 1
u( kh) K G e( kh) e(ih) be( kh) e( kh h)gJ
1 TD I
H TI
h i
h
K
F k 1
u( kh) K G e( kh) e( kh h) e(ih) e(ih)
1 1 k 2
H TI
h i
TI
h i
F I
K G e( kh) e( kh h) e( kh h) be( kh) 2e( kh h) e( kh 2h)gJ
1 TD
H TI
h
h
K
F F I
K G d1 ie( kh) G 2 1J e( kh h) d ie( kh 2h)J
TD 1 TD TD
I
H h
H TI
h Kh h
K
Discrete PID-controller
The velocity form can also be z-transformed
F TD F
U ( z ) K G d1 i G 2
1 TD I 1I
1J d i J E ( z )
1 TD
H h
H TI
h
h
Kz z Kh 2
FG z 1IJ K FG1 1 z IJ
z 1
H PID ( z ) G PID
H zh K H z 1
TD
TI
h
h
z K
Discrete PID-controller
The discretization of a practical PID-controller is as
straightforward.
R|
R| ||
|| P ( s) KbbY ( s) Y ( s)g
m REF || P ( z) KbbY ( z) Y ( z)g
m REF
S| I ( s) T s E ( s)
K
S| I ( z) T z 1 K z 1
K h
TI
1 1
|| D ( s) KT s Y ( s) ||
I I h
D z 1
m
T 1 T s N
D
m || D ( z) KT Tzhz 1 Y ( z)
D
|T 1
D
N zh
Discrete PID-controller
If a difference equation form is needed
1 TD
Nh (1 q 1
) D m
( kh ) K TD
h (1 q 1
) y ( kh)