DIGITAL CONTROLLER DESIGN via EMULATION
DIGITAL APPROXIMATION OF TRANSFER FUNCTIONS
In order to use emulation to design a digital controller, one needs to obtain a
difference equation or a TF C*(z) in z-domain to approximate the continuous
controller C(s) designed in previous lectures. In other words, we wish to find
the best C*(z) in the digital implementation to match the continuous controller
C(s) as shown in the following diagram
e(t) e(kT) u(kT) u(t) e(t) u(t)
C*(z) ZOH C(s)
T
Since the continuous controller C(s) responds to the complete time history of
e(t) whereas the digital controller C*(z) only has access to the sample e(kT),
there is no exact solution for this digitization procedure. Depending on the
different assumptions about what happens to e(t) between the sample points,
various approximation methods were proposed such as Euler’s method
presented early and the Tustin’s method presented in the following. Other
approximation techniques such as matched pole-zero (MPZ) method and
modified matched pole-zero (MMPZ) method are given in the textbook.
MATLAB command for this conversion is “c2dm”.
Tustin’s Method or Bilinear Approximation
This method is to approximate e(t) by a straight line between two samples.
Approximation of Integral Action:
e(t) e(kT) 1 z 1 u(kT) u(t) e(t) 1 u(t)
T
T
2 ( 1 z 1
) ZOH
s
Continuous Time Domain:
e(t)
U (s) 1
u e(t )
E (s) s
A kT kT
(k 1)T
udt
(k 1)T
e(t)dt
(k-1)T kT t
kT
u (kT ) u ((k 1)T )
e(t )dt
(k 1)T
Area A,
the area under the error curve e(t)
Digital Approximation:
e(t) Approximate A by A*:
A*
(k-1)T kT t
1
A
*
e((k 1)T ) e(kT ) T
2
T
e(k 1) e(k )
2
T
u (k ) u (k 1) e(k 1) e(k )
2
Take z-transform:
T T
1
U (z ) z U (z ) z E (z ) E (z ) z U (z ) [1 z 1 ]E (z )
1 1
2 2
U (z ) T 1 z 1 1
1
, approximation of the integral
E (z ) 2 1 z s
In other words,
1 T 1 z 1 2 1 z 1 2 z 1
1
or s 1
s 2 1- z T 1 z T z 1
Approximation of A TF C(s):
The digital approximation of C(s) by using the Tustin’s Method is:
C * (z ) C (s ) 2 z 1
s
T z 1
Ex21.1: Emulation Design of a Digital Controller:
Design a digital controller for the plant P(s)=1/s2 to have a closed-loop
natural frequency n0.3rad/s and a damping ratio less than 0.7.
Step 1: Design a Continuous Controller C(s) to Satisfy the Performance:
1.5
0.5
Imag A xis
-0.5
-1
-1.5
-2
-3 -2 -1 0 1 2
Real A xis
The specification can be met by using a lead compensation C(s):
Rs
() sa U ( s) 1 Y (s)
Kc
sb s2
-
Controller C(s) Plant P(s)
Choose a=0.2, b=2.0, the resulting Root-locus is shown in the figure. By
choosing Kc = 0.9, the three CL poles are:
Pc1 = -1.47, Pc2,3 = -0.264 0.23 j
which have a damping ration larger than 0.7 and n 0.3 rad/s.
Step 2: Determine A Sampling Rate and Obtain C*(z), Digital Approximation
of C(s):
Rule of Thumb:
Choose the sampling frequency s 2 / T faster than the CL
bandwidth by a factor of 20.
2 2
s 0.34 20 T 0.92 sec .
T 0.34 20
Let us choose
T = 0.9 sec (or a smaller T)
Use Tustin’s Method:
1
2 1 z
0.2
1 0.5163z 0.431 0.5163 0.431z 1
C * (z )=C ( s ) 2 1 z1 =0.9 0.9 1 z 1
s
T 1 z 1 2 1 z z 0.0526 1 0.0526z 1
1
2
0.9 1 z
which corresponds to the difference equation:
u(k) = 0.0526 u(k–1) + 0.5163 e(k) – 0.431e(k-1)
Step3: Use Simulation to Verify the Design:
The simulation results for both the continuous controller C(s) and the
digital controller C*(z) are shown in the following figure, which shows that
the emulation design approximates the continuous design quite well but not
perfect.
S te p R e s p o ns e
1 .4
1 .2
0 .8
A mplitude
0 .6
0 .4
0 .2
0
0 5 10 15 20 25
Tim e (s e c .)
This mismatch between the digital approximation and continuous controller
can be minimized by using a faster sampling time, which can be seen from the
simulation results shown below for the digital approximation by choosing a
sampling period T=0.2 sec and T=2sec.
clear
T=2;
numP=1; denP=[1,0,0];
numC=0.9*[1,0.2];
denC=[1,2];
[numL,denL]=series(numC,denC,numP,denP);
%Form L(s)=C(s)P(s)
[numT,denT]=cloop(numL,denL,-1);
%Find the closed-loop TF T(s) of your design
[numdC,dendC]=c2dm(numC,denC,T,'tustin');
[numdP,dendP]=c2dm(numP,denP,T,'zoh');
[numdL,dendL]=series(numdC,dendC,numdP,dendP);
%Form L(z)=C(z)P(z)
[numdT,dendT]=cloop(numdL,dendL,-1);
%Find the closed-loop TF T(z) of your design
[dy,dx]=dstep(numdT,dendT);
for j=1:1:length(dy)
tt(j)=(j-1)*T;
end;
plot(tt,dy,'*');
hold
step(numT,denT);