Professional Documents
Culture Documents
Unit 09 Digital Controller Design - Part 1 - Lead - Lag Using W - Transform and PID
Unit 09 Digital Controller Design - Part 1 - Lead - Lag Using W - Transform and PID
(Chapter 8)
Main Focus:
9.1 Phase-Lead and Phase Lag -
(w-transformation)
9.2 PI, PD and PID - (Integration
and Differentiation)
Learning Objectives
• Perform digital implementation of the Lead, Lag, PID and
Lead-Lag controllers and develop block diagrams for
implementation.
• Realize the implementation of digital controllers through direct
decomposition of the transfer function.
• Design a discrete-data control system using the w-
transformation in the frequency domain and the z-plane.
• Design a digital controller transfer function (difference equation)
using phase-lead, phase-lag compensation and w-domain root-
locus techniques that will satisfy design specifications for a
given discrete control system.
• Design a digital controller transfer function (difference equation)
using PI, PD compensation and z-domain root-locus
techniques that will satisfy design specifications for a given
discrete control system.
Specification of System Desired
Characteristics
e(t) 1/(s)
e(kT) f(kT)
gz1=c2d(gs,1,'imp')
Transfer function:
ds= 1/s z
-----
z-1
Sampling time: 1
Impulse used to transform a plant into z-domain without ZOH, this will give the same
result as the ZT Table.
Summary
Continuous to Discrete using Matlab
Plant to G(z) using ‘zoh’
G(z)
gz1=c2d(gs,1,'zoh')
Transfer function:
1
-----
z-1
Sampling time: 1
Summary
Continuous to Discrete using Matlab
Controller to D(z) using Tustin
Trapezoidal Integration: Make use of trapezoidal-
integration rule in conjuntion with the difference
equation
D(z)=c2d(ds,1,'tustin')
Transfer function:
2 z -1 0.5 z + 0.5
ds= 1/s s= -----------
T z +1 z-1
Sampling time: 1
Tustin, Bilinear Transformation and Trapezoidal Rule
Summary
Continuous to Discrete using Matlab
Controller to GC(z) using Matched Pole Zero Method
Digital Differentiation/Integration using Backward-Rectangular
e(t) 1/(s)
e(kT) f(kT)
gz1=c2d(gs,1,'matched')
Transfer function:
1.001
-----
z-1
ds= 1/s 1 z -1
s=
T 1 Sampling time: 1
>> gz1=c2d(gs,2,'matched')
Transfer function:
2.001
-----
z-1
Sampling time: 2
Designing Discrete Controllers
• Methodology 1 (9.1): Frequency Domain Design (using
controlSystemDesigner)
Given or determine GP(z) that include zoh, find w-transformation used to
design lead/lag/pid controllers, using Tustin. Hence transfer back to GC(z),
again using Tustin. 2
2 z -1 2+T ×w T
+w
w= z= =
T z +1 2 -T ×w 2 - w
T
• Methodology 2 (9.2): PID controller design, use z-domain Root Locus
(using controlSystemDesigner and/or simulink –Trapeziodal/Tustin &
Forward-Rectangular/Matched)
T é z + 1ù é z - 1ù
D( z ) = K P + K I ê ú + K Dê ú
2 ë z - 1û ë Tz û
9.1 Digital controller design (a) phase lag
dB
G ( jw w )
G ( jw w ) D( jw w )
Gain margin
0
w wp w w0 Logw w
a0w wp
20 log
w w0
ÐG ( jw w ) D( jw w )
Phase
w wp w w0
0
Logw w
ÐG ( jw w )
- 180
fm
9.2 Digital controller design (b) Phase-Lead
dB
Gain margin
w wp
w w0 Logw w
G ( jw w )D( jw w )
w w0 w wp
Logw w
ÐG ( jw w )D( jw w )
-180°
Fm
ÐG ( jw w )
Phase-Lead controller (p.297-306) – same as before
For phase-lead compensators, w w 0 < w wp . A typical frequency response
is shown in the following illustration:
dB
1
20 log
a 0 w wp
w w0
wm =
aT
20 log a 0
w w0 w wp Logw w
a -1
sin fm =
Phase
a +1
QM
1 + sin fm
a=
w w0 w wm w wp Log w w
1 - sin fm
General Design Outline/Guideline for Phase-
1. Find G(z), including ZOH.
Lead/phase-lag remain same !!
T 2
2. Substitute z = 1+ w +w
z= 2 = 2+T ×w = T
T 2
3. Obtain Bode Diagram of Uncompensated 1- w 2 - T × w -w
Process. Adjust the value of K need to be 2 T
adjusted upward once the value of a is
determined. 1
wm =
4. Determine the phase and gain margin of the aT
uncompensated system, determine the amount of
phase lead needed to realize the phase margin. a -1
Determine a and hence T. sin fm =
a +1
5. Place corner frequencies eg ωzero=1/aT and
ωpole= 1/T such that phase Φm is located at the 1 + sin fm
new gain-crossover frequency. From the bode a=
diagram of phase-lead controller the Gain in dB at
this point is -10 log a. Record ωm. 1 - sin fm
6. Adding the controller gain will cause the 1 + aTw
magnitude curve of the compensated system to
go through 0dB at ωm.
a >1
1 + Tw
Problem 1: Design a Phase-Lead
Digital Controller GC(z) that yields
a phase margin of 60o
Given the plant, determine the forward-path
transfer function, Gp(z) =ZOH+G(z), @
some sampling frequency T=0.1sec
r(t) + e(t) y(t)
GC(s) ZOH 4
- T T S 2
GC(z)
Forward Path Transfer
! 4 $ 0.02 z + 1 ( )
(
G(z) = GhoG p (z) = 1− z Z # 3 & =
−1
)
" s % z z −1
2
( )
2
+ w 20 + w
gz1=c2d(g1,0.1,'zoh') z=T =
2
g1=tf(n,d) - w 20 - w
Transfer function: T
Transfer function: 0.02 z + 0.02
gw=d2c(gz1,'tustin')
4 -------------
--- z^2 - 2 z + 1
Transfer function:
s^2 -1.11e-018 s^2 - 0.2 s + 4
Sampling time: 0.1
--------------------------
s^2
Aside, Evaluate Closed Loop
(stability??) of discrete system
Y ( z) Gho G p ( z ) 0.02 ( z + 1)
= =
1 + Gho G p ( z ) z - 1.98 z + 1.02
2
R( z )
z= T = n1=[0.02 0.02];
2 20 - w d1=[1 -2 1]
-w gz=tf(n1,d1,0.1)
T Transfer function:
0.02 z + 0.02
-------------
4 (1 - 0.05w )
z^2 - 2 z + 1
>> gw=d2c(gz,'tustin')
Transfer function:
G ( w) = 2
-0.2s + 4
-----------
w s^2
4 (1 - 0.05w )
Bode Plot G ( w) = 2
w
Unstable
select fm = 75, hence
1 + sin 75
a= = 57
1 - sin 75
then, select freq at :
gain = -10 log 57 = -17.62
use :
1
wm =
aT
1 1
5.65 = = ...hence
aT 57.8T
T = 0.0233 and aT = 1.347
1 + aTw 1 + 1.347w
Gc ( w) = =
1 + Tw 1 + 0.023w
n_controller = [1.347 1]
n_controller =
1.3470 1.0000
d_controller =
0.0230 1.0000
>> gz_controller=c2d(gs_controller,0.1,'tustin')
Transfer function:
19.14 z - 17.77
---------------
z + 0.3699
Implementation in Simulink
Discrete Systems Toolbox
Example 2:
Design a Phase-Lead Digital
Controller GC(z) that yields a
phase margin of 45o
Given the plant, determine the forward-path
transfer function, Gp(z) =ZOH+G(z), @
some sampling frequency T=0.01sec
r(t) + e(t) y(t)
GC(s) ZOH 1
- T T 0.1* S 2
GC(z)
Phase-Lead Design
2
+w
T 200 + w
z= = n1=[0.05 0.05];
2
2 Bilinear - w 200 - w d1=[1 -2 1]
T gz=tf(n1,d1,0.01)
transformation w = Transfer function:
0.05 z + 0.05
-------------
T é z + 1ù é z - 1ù
D( z ) = K P + K I ê ú + K Dê ú
2 ë z - 1û ë Tz û
Design a Discrete PD Controller to meet Specification
1.6 Enter the transfer function into ACSYS and create a z-domain root locus and design a
PD controller to meet the following performance requirement, overshoot < 30%:
K D ( z - 1)
GC ( z ) = K ( K P + )
T
Show the uncompensated and compensated root locus and step response.
(10)
R(z)
+ Gc(z) G P _ Hold ( z )
Y(z)
-
Integrated Exam Question –
PD Design using z-Domain Rootlocus
Shown in Figure 4(a) and 4(b) is the model and
the block diagram of one joint of a robot arm,
respectively. The input U(s) is the controlling
signal, Ea(s) is the servomotor input voltage, is
the motor shaft angle (degrees), and the output
is the angle (degrees) of the arm. The
inductance of the armature of the servomotor
has been neglected such that the servomotor
transfer function is of second order. The
servomotor transfer function includes the inertia
of both the gears and the robot arm.
Figure 4: Industrial Robot Arm Discrete Control System
Determine Closed Loop System Performance
without the D(z):
Consider the addition of the A/D (sampler, T=0.1), D(z)
(controller, D(z)=1), Gain (K = 1.0) and D/A converter
(ZOH):
3.1 Determine the pulse transfer function for a
sampling period of T=0.1 sec. Find the roots of the
transfer function. (3)
3.2 Develop the discrete state space model for the
pulse transfer function in Question 3.1. (2)
3.3 Derive the closed-loop system transfer function.
Determine the characteristic equation and its roots in
the z-domain. Determine ζ, τ and ωn. (5)
3.4 Make use of the Jury Test to determine the range
of K that will keep the system stable. (5)
3.1 Pulse Transfer Function
> n1=[20]
>> d1=[1 5 0]
>> gs1=tf(n1,d1)
Transfer function:
20
---------
s^2 + 5 s
>> ghz=c2d(gs1,0.1,'zoh')
Transfer function:
0.08522 z + 0.07216
----------------------
z^2 - 1.607 z + 0.6065
c=
x1 x2
y1 0.1704 0.1443
d=
u1
y1 0
3.4 Perform Stability Test using Jury Test
PD Controller Design
Uncompensated
(From 3.1, include
ZOH,
Select T = 0.1) then
RHS rootlocus and
response will appear !!
PD Controller Design
Uncompensated
(From 3.1, include ZOH,
Select T = 0.1) then RHS
rootlocus and response will
appear !!
Compensated
K D (z −1)
GC (z) = K(K P + )
T
0.1(z −1)
= 0.369(1+ )
0.1
Discrete Implementation of
Integration and Differentiation
PID Control
(p.310 – 327)
T é z + 1ù é z - 1ù
D( z ) = K P + K I ê ú + K Dê ú
2 ë z - 1û ë Tz û
Digital controller design T é z + 1ù é z - 1ù
P( z ) = K P + K I + K
2 êë z - 1 úû
Dê ú
ë Tz û
Integration and Differentiation filters: Section 8.8 p.311
The following illustration shows a numerical integration method.
Replace a
1/w with:
T é z + 1ù
M ( z) = ê z - 1ú E ( z)
2 ë û
T é z + 1ù é z - 1ù
Digital controller design P( z ) = K P + K I
2 êë z - 1 úû
+ K Dê ú
ë Tz û
M ( w) T é z + 1ù 1
DI ( w) = = ê z - 1 ú 2 +T × w = w
E ( w) 2 ë û z=
2 -T ×w
....used Tustin
The following illustration shows a numerical differentiation method.
e(t )
e(kT )
Replace a
e[(k - 1)T ]
w with:
(k - 1)T kT t
PID P _ Hold
Tune controller to satisfy: -
Tsettling < xx sec
%OS < 5%
ess < 1%
What is the best this controller can achieve? Note: Create Z-Domain Root Locus.
(4)
Method 1: Enter into ACSYS Unit Step Response
1 Continuous to Discrete,
GP ( s ) =
s 2 + 1.1s + 11 Ts=0.1
GzPD=1+3.8(z-1)
0.1
Also,
integral
control:
(1+0.25w)
w
= 1/w + 0.25 and
s + 2zw n s + wn2
1, 2 n n
- ln r = zw nT also wnT 1 - z 2 = q
Taking ..Ratio :
- ln r
z =
ln 2 r + q 2
1
wn = ln 2 r + q 2
T
1 -T
t = time cons tan t = =
zw n ln r
r = e -T /t
Method 2: Enter into Simulink Unit Step Response
T é z + 1ù é z - 1ù
P( z ) = K P + K I ê z - 1 ú + K D ê Tz ú
2 ë û ë û
Section 8.11
1.0 Determine the pulse transfer function for a sampling period of T=0.01 sec. (2)
2.0 With GC(z) = 1.0 and K = 1.0, derive the closed-loop system transfer function. Determine
the characteristic equation and its roots in the z-domain. Determine ζ and ωn. (7)
3.0 With GC(z) = 1.0. Make use of the w-transformation to create a Bode plot and hence
determine the system gain and phase margin. Determine what value of loop gain K
would make the system marginally stable-unstable. (11)
Determine the pulse transfer function for a sampling period of T=0.01 sec
n=[100];
>> d=[0.04 1.0 0.0];
>> gs=tf(n,d)
Transfer function:
100
------------
0.04 s^2 + s
>> gzoh=c2d(gs,0.01,'zoh')
Transfer function:
0.1152 z + 0.106
----------------------
z^2 - 1.779 z + 0.7788
Transfer function:
0.1152 z + 0.106
----------------------
z^2 - 1.664 z + 0.8848
ans =
0.8320 + 0.4388i
0.8320 - 0.4388i
Select K=1.0
ωn= 49 rads/sec
ζ=0.125
%OS=0.73
With GC(z) = 1.0. Make use of the w-transformation to create a Bode plot and hence
determine the system gain and phase margin. Determine what value of loop gain K
would make the system marginally stable-unstable
2
+w
T 200 + w
z= =( )
2 200 - w
-w
T
200 + w
0.1152( ) + 0.106
G ( w) = 200 - w
200 + w 2 200 + w
( ) - 1.779( ) + 0.7788
200 - w 200 - w
- 0.0092w2 - 42.4 w + 8848
G ( w) =
3.558w2 + 88.4w
Note: In order not to influence the steady state error of the system, we set KP = 1. Vary
KD to achieve the minimum amount of overshoot. ALSO, NOTE CL Transfer Function !!!
hence, from characteristic equation, 1 + GH = 0
K D (11.52 z 2 - 0.92 z - 10.6)
1+
z 3 - 1.6636 z 2 + 0.8848 z
Desired Equation
gz=tf(nz,dz, 0.01)
Transfer function:
0.1152 z + 0.106
----------------------
z^2 - 1.779 z + 0.7788
Sampling time: 0.01
>> [A,B,C,D]=tf2ss(nz,dz)
A = 1.7790 -0.7788
1.0000 0
B= 1
0
C = 0.1152 0.1060
D= 0
>> K=acker(A,B,[0.5 0.5])
K=
0.7790 -0.5288
Fin