desired bode plot shape ess requirement noise requirement 0 -90 -180 0db gcd high low-freq-gain for...
TRANSCRIPT
Desired Bode plot shape
Ess requirement
Noise requirement
0
-90
-180
0dB
wgcd
High low-freq-gain for steady state trackingLow high-freq-gain for noise attenuationSufficient PM near wgc for stability
w
w
PMd
Mid frequency
Desired Bode plot shape
0
-90
-180
0dB
wgc
High low freq gain for steady state trackingLow high freq gain for noise attenuationSufficient PM near wgc for stability
w
w
Low freq
High freq
Want high gain
Want low gain
Mid freq
Want sufficientPhase margin
Use low pass filters
Use PI or lag control
Use lead or PD control
PM+Mp=70
C(s) Gp(s)
21
21)(psps
zszsKsC
Controller design with Bode
From specs: => desired Bode shape of Gol(s)Make Bode plot of Gp(s) Add C(s) to change Bode shapeGet closed loop systemRun step response, or sinusoidal response
Mr and BW are widely used
Closed-loop phase resp. rarely used
Important relationships• Closed-loop BW are very close to wn
• Open-loop gain cross over wgc ≈ (0.65~0.8)* wn,
• When z <= 0.6, wr and wn are close
• When z >= 0.7, no resonance• z determines phase margin and Mp:
z 0.4 0.5 0.6 0.7
PM 44 53 61 67 deg ≈100z Mp 25 16 10 5 %
PM+Mp ≈70
Mid frequency requirements• wgc is critically important
– It is approximately equal to closed-loop BW– It is approximately equal to wn
• Hence it determines tr, td directly
• PM at wgc controls z– Mp 70 – PM
• PM and wgc together controls s and wd – Determines ts, tp
• Need wgc at the right frequency, and need sufficient PM at wgc
Low frequency requirements• Low freq gain slope and/or phase
determines system type• Height of at low frequency determine error
constants Kp, Kv, Ka• Which in turn determine ess
• Need low frequency gain plot to have sufficient slope and sufficient height
High frequency requirements• Noise is always present in any system• Noise is rich in high frequency contents• To have better noise immunity, high
frequency gain of system must be low
• Need loop gain plot to have sufficient slope and sufficiently small value at high frequency
Overall Loop shaping strategy• Determine mid freq requirements
– Speed/bandwidth wgc
– Overshoot/resonance PMd
• Use PD or lead to achieve PMd@ wgc
• Use overall gain K to enforce wgc
• PI or lag to improve steady state tracking– Use PI if type increase neede – Use lag if ess needs to be reduced
• Use low pass filter to reduce high freq gain
Proportional controller design• Obtain open loop Bode plot• Convert design specs into Bode plot req.• Select KP based on requirements:
– For improving ess: KP = Kp,v,a,des / Kp,v,a,act
– For fixing Mp: select wgcd to be the freq at which PM is sufficient, and KP = 1/|G(jwgcd)|
– For fixing speed: from td, tr, tp, or ts requirement, find out wn, let wgcd = (0.65~0.8)*wn and KP = 1/|G(jwgcd)|
clear all;n=[0 0 40]; d=[1 2 0];figure(1); clf; margin(n,d);%proportional control design:figure(1); hold on; grid; V=axis;Mp = 10; %overshoot in percentagePMd = 70-Mp + 3;semilogx(V(1:2), [PMd-180 PMd-180],':r');%get desired w_gcx=ginput(1); w_gcd = x(1);KP = 1/abs(evalfr(tf(n,d),j*w_gcd));figure(2); margin(KP*n,d);figure(3); mystep(KP*n, d+KP*n);
Bode Diagram
Frequency (rad/sec)
Ph
ase
(deg
)M
agn
itu
de
(dB
)
-10
0
10
20
30
40
50Gm = Inf, Pm = 17.964 deg (at 6.1685 rad/sec)
10-1
100
101
-180
-135
-90
G(s)=40/s(s+2)
Mp=10%
0 1 2 3 4 5 60
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
Time (sec)
Am
plit
ud
e
Unit Step Response
ts=3.65 tp=0.508
Mp=60.4%
ess tolerance band: +-2%
td=0.159
tr=0.19
yss=1
ess=0
Bode Diagram
Frequency (rad/sec)
Ph
ase
(deg
)M
agn
itu
de
(dB
)
-40
-20
0
20
40Gm = Inf, Pm = 63.31 deg (at 1.0055 rad/sec)
10-1
100
101
-180
-135
-90
1 2 3 4 5 60
0.2
0.4
0.6
0.8
1
1.2
Time (sec)
Am
plit
ud
e
Unit Step Response
ts=3.98 tp=2.82
Mp=6.03%ess tolerance band: +-2%
td=0.883
tr=1.33
yss=1
ess=0
2
1
( ) (1 )
( ) (1 )
Gain: 20 log(| ( ) |) 20 log( )
20 log( 1
Phase: ( ) (1 ) tan ( )
DP D P
P
DP D P
P
P
D
P
D D
P P
KC s K K s K s
K
KC j K K j K j
K
C j K
K
K
K KC j j
K K
PD Controller
20
30
40
50
60
70
Mag
nit
ud
e (d
B)
10-2
10-1
100
101
102
0
45
90
Ph
ase
(deg
)
Bode Diagram
Frequency (rad/sec)
20*log(KP)
KP/KD
Place wgcd here
Bad for noise
gcd
gcd
gcd
gcd
gcd
gcd
From specs, find and
( )
a few degrees
tan( ) /
1/ (1 ) ( )
; ( )
( ) ( ) ( ) / 1 ( ) ( )
Perform c.l. step response, tune C
d
D
P D s j
D D P P D
cl
PM
PM angle G j
PM PMd PM
T PM
K T s G s
K T K C s K K s
G s C s G s C s G s
(s) as needed
PD control design
n=[0 0 1]; d=[0.02 0.3 1 0];
figure(1); clf; margin(n,d);
Mp = 10/100;
zeta = sqrt((log(Mp))^2/(pi^2+(log(Mp))^2));
PMd = zeta * 100 + 3;
tr = 0.3; w_n=1.8/tr; w_gcd = w_n;
PM = angle(polyval(n,j*w_gcd)/polyval(d,j*w_gcd));
phi = PMd*pi/180-PM; Td = tan(phi)/w_gcd;
KP = 1/abs(polyval(n,j*w_gcd)/polyval(d,j*w_gcd));
KP = KP/sqrt(1+Td^2*w_gcd^2); KD=KP*Td;
ngc = conv(n, [KD KP]);
figure(2); margin(ngc,d);
figure(3); mystep(ngc, d+ngc);
Could be a little less
PD control design Variation
• Restricted to using KP = 1
• Meet Mp requirement
• Find wgc and PM
• Find PMd
• Let f = PMd – PM + (a few degrees)
• Compute TD = tan(f)/wgcd
• KP = 1; KD=KPTD
n=[0 0 5]; d=[0.02 0.3 1 0];
figure(1); clf; margin(n,d);
Mp = 10/100;
zeta = sqrt((log(Mp))^2/(pi^2+(log(Mp))^2));
PMd = zeta * 100 + 18;
[GM,PM,wgc,wpc]=margin(n,d);
phi = (PMd-PM)*pi/180; Td = tan(phi)/wgc;
Kp=1; Kd=Kp*Td;
ngc = conv(n, [Kd Kp]);
figure(2); margin(ngc,d);
figure(3); stepchar(ngc, d+ngc);
2
200Example: ( )
4 4
When ( ) 1, 16 , 64%
Want: 16%
o
G ss s
C s PM Mp
Mp
C(s) G(s)
ssssG
23 3.002.0
1)(
Example
Want: maximum overshoot <= 10% rise time <= 0.3 sec
Can use Lead or PD
Bode Diagram
Frequency (rad/sec)
Ph
ase
(deg
)M
agn
itu
de
(dB
)
-100
-80
-60
-40
-20
0
20Gm = 23.522 dB (at 7.0711 rad/sec), Pm = 73.367 deg (at 0.9768 rad/sec)
10-1
100
101
102
-270
-225
-180
-135
-90
0.5 1 1.5 2 2.5 3 3.5 4 4.5 50
0.2
0.4
0.6
0.8
1
1.2
Time (sec)
Am
plit
ud
e
Unit Step Response
ts=2.68 tp=3
Mp=-1.06%
ess tolerance band: +-2%
td=0.841
tr=1.52
yss=1
ess=0
n=[0 0 1]; d=[0.02 0.3 1 0];
figure(1); clf; margin(n,d);
Mp = 10; %overshoot in percentage
PMd = 70 – Mp + 3;
tr = 0.3; w_n=1.8/tr; w_gcd = w_n;
PM = angle(polyval(n,j*w_gcd)/polyval(d,j*w_gcd));
phi = PMd*pi/180-PM; Td = tan(phi)/w_gcd;
KP = 1/abs(polyval(n,j*w_gcd)/polyval(d,j*w_gcd));
KP = KP/sqrt(1+Td^2*w_gcd^2); KD=KP*Td;
ngc = conv(n, [KD KP]);
figure(2); margin(ngc,d);
figure(3); mystep(ngc, d+ngc);
Could be a little less
Bode Diagram
Frequency (rad/sec)
Ph
ase
(deg
)M
agn
itu
de
(dB
)
-60
-40
-20
0
20Gm = Inf, Pm = 62.116 deg (at 6 rad/sec)
100
101
102
-180
-135
-90
0.2 0.4 0.6 0.8 1 1.2 1.40
0.2
0.4
0.6
0.8
1
1.2
Time (sec)
Am
plit
ud
e
Unit Step Response
ts=0.655 tp=0.461
Mp=6.67%ess tolerance band: +-2%
td=0.154
tr=0.225
yss=1
ess=0
Less than spec
Variation
• Restricted to using KP = 1
• Meet Mp requirement
• Find wgc and PM
• Find PMd
• Let f = PMd – PM + (a few degrees)
• Compute TD = tan(f)/wgcd
• KP = 1; KD=KPTD
KP=5; n=KP*[0 0 1]; d=[0.02 0.3 1 0];
figure(1); clf; margin(n,d);
figure(3); stepchar(n, d+n);
Bode Diagram
Frequency (rad/sec)
Ph
ase
(deg
)M
agn
itu
de
(dB
)
-80
-60
-40
-20
0
20Gm = 9.5424 dB (at 7.0711 rad/sec), Pm = 32.613 deg (at 3.7468 rad/sec)
100
101
102
-270
-225
-180
-135
-90
0.5 1 1.5 2 2.5 3 3.5 4 4.5
0.2
0.4
0.6
0.8
1
1.2
1.4
Time (sec)
Am
plit
ud
e
Unit Step Response
ts=3.17 tp=0.814
Mp=38.9%
ess tolerance band: +-2%
td=0.317
tr=0.317
yss=1
ess=0
KP=5; n=KP*[0 0 1]; d=[0.02 0.3 1 0];
figure(1); clf; margin(n,d);
Mp = 10;
PMd = 70 – Mp + 10;
[GM,PM,wgc,wpc]=margin(n,d);
phi = (PMd-PM)*pi/180; Td = tan(phi)/wgc;
KP=1; KD=KP*Td;
ngc = conv(n, [KD KP]);
figure(2); margin(ngc,d);
figure(3); stepchar(ngc, d+ngc);
Bode Diagram
Frequency (rad/sec)
Ph
ase
(deg
)M
agn
itu
de
(dB
)
-60
-40
-20
0
20Gm = Inf, Pm = 52.605 deg (at 3.9488 rad/sec)
100
101
102
-180
-150
-120
-90
0.5 1 1.5 2 2.50
0.2
0.4
0.6
0.8
1
1.2
Time (sec)
Am
plit
ud
e
Unit Step Response
ts=1.56 tp=0.728
Mp=15.6%ess tolerance band: +-2%
td=0.236
tr=0.321
yss=1
ess=0
KP=5; n=KP*[0 0 1]; d=[0.02 0.3 1 0];
figure(1); clf; margin(n,d);
Mp = 10;
PMd = 70 – Mp + 18;
[GM,PM,wgc,wpc]=margin(n,d);
phi = (PMd-PM)*pi/180; Td = tan(phi)/wgc;
KP=1; KD=KP*Td;
ngc = conv(n, [KD KP]);
figure(2); margin(ngc,d);
figure(3); stepchar(ngc, d+ngc);
Bode Diagram
Frequency (rad/sec)
Ph
ase
(deg
)M
agn
itu
de
(dB
)
-60
-40
-20
0
20Gm = Inf, Pm = 57.956 deg (at 4.1131 rad/sec)
100
101
102
-180
-135
-90
0 0.5 1 1.5 20
0.2
0.4
0.6
0.8
1
1.2
1.4
Time (sec)
Am
plit
ud
e
Unit Step Response
ts=1.07 tp=0.695
Mp=10.7%ess tolerance band: +-2%
td=0.22
tr=0.305
yss=1
ess=0
lead
lead
ps
zsKsC
)(
Lead Controller Design
00 Kzp leadlead
lead
lead
pj
zjKjC
)(
0)(tan)(tan
)()()(
11
leadlead
leadlead
pz
pjzjjC
101520253035404550
Mag
nit
ud
e (d
B)
10-2
10-1
100
101
102
103
0
30
60
90
Ph
ase
(deg
)Bode Diagram
Frequency (rad/sec)
zlead
plead
leadlead zp
20log(Kzlead/plead)lead
leadz
p
)(tan)(tan 11max lea d
lea d
lea d
lea d
pz
zp
Goal: select z and p so that max phase lead is at desired wgc and max phase lead = PM defficiency!
max
max
1 sinLet
1 sin
gcd gcd/ , *lead leadz p
Lead Design • From specs => PMd and wgcd
• From plant, draw Bode plot• Find PMhave = 180 + angle(G(jwgcd)
• DPM = PMd - PMhave + a few degrees
• Choose a=plead/zlead so that fmax = DPM and it happens at wgcd
1
gcdgcdgcd
gcdgcd
max
max
)/()()(
*,/
sin1
sin1
leadlead
leadlead
pjjGzjK
pz
Lead design example• Plant transfer function is given by:
• n=[50000]; d=[1 60 500 0];
• Desired design specifications are:– Step response overshoot <= 16%– Closed-loop system BW>=20;
n=[50000]; d=[1 60 500 0]; G=tf(n,d);figure(1); margin(G); Mp_d = 16/100; zeta_d =0.5; % or calculate from Mp_dPMd = 100*zeta_d + 3;BW_d=20;w_gcd = BW_d*0.7; Gwgc=evalfr(G, j*w_gcd);PM = pi+angle(Gwgc);phimax= PMd*pi/180-PM;alpha=(1+sin(phimax))/(1-sin(phimax));zlead= w_gcd/sqrt(alpha);plead=w_gcd*sqrt(alpha);K=sqrt(alpha)/abs(Gwgc);ngc = conv(n, K*[1 zlead]);dgc = conv(d, [1 plead]);figure(1); hold on; margin(ngc,dgc); hold off;[ncl,dcl]=feedback(ngc,dgc,1,1);figure(2); step(ncl,dcl);
-100
-50
0
50M
agn
itu
de
(dB
)
10-1
100
101
102
103
-270
-225
-180
-135
-90
Ph
ase
(deg
)
Bode DiagramGm = 13.8 dB (at 38.3 rad/sec) , Pm = 53 deg (at 14 rad/sec)
Frequency (rad/sec)
Before designAfter design
-150
-100
-50
0
50M
agn
itu
de
(dB
)
10-1
100
101
102
103
104
-270
-180
-90
0
Ph
ase
(deg
)
Bode DiagramGm = 8.8 dB (at 38.3 rad/sec) , Pm = 40.6 deg (at 25.2 rad/sec)
Frequency (rad/sec)
Closed-loop Bode plot by:
Magnitude plot shifted up 3dBSo, gc is BW
margin(ncl*1.414,dcl);
0 0.1 0.2 0.3 0.4 0.5 0.6 0.70
0.2
0.4
0.6
0.8
1
1.2
1.4Step Response
Time (sec)
Am
plit
ud
e
Alternative use of lead• Use Lead and Proportional together
– To fix overshoot and ess– No speed requirement
1.Select K so that KG(s) meet ess req.
2.Find wgc and PM, also find PMd
3.Determine phi_max, and alpha
4.Place phi_max a little higher than wgc
maxgc gc
max
1 sin/ , *
1 sin
( )
lead lead
lead lead lead
lead lead lead
z p
p s z s zC s K K
z s p s p
Alternative lead design example• Plant transfer function is given by:
• n=[50]; d=[1/50 1 0];
• Desired design specifications are:– Step response overshoot <= 20%– Steady state tracking error for ramp input <=
1/200;
– No speed requirements– No settling concern– No bandwidth requirement
n=[50]; d=[1/5 1 0];figure(1); clf; margin(n,d); grid; hold on;Mp = 20/100; zeta = sqrt((log(Mp))^2/(pi^2+(log(Mp))^2));PMd = zeta * 100 + 10;ess2ramp= 1/200; Kvd=1/ess2ramp;Kva = n(end)/d(end-1); Kzp = Kvd/Kva;figure(2); margin(Kzp*n,d); grid;[GM,PM,wpc,wgc]=margin(Kzp*n,d);w_gcd=wgc; phimax = (PMd-PM)*pi/180;alpha=(1+sin(phimax))/(1-sin(phimax));z=w_gcd/alpha^.25; %sqrt(alpha); %phimax located higherp=w_gcd*alpha^.75; %sqrt(alpha); %than wgcngc = conv(n, alpha*Kzp*[1 z]); dgc = conv(d, [1 p]);figure(3); margin(tf(ngc,dgc)); grid;[ncl,dcl]=feedback(ngc,dgc,1,1);figure(4); step(ncl,dcl); grid;figure(5); margin(ncl*1.414,dcl); grid;
-40
-20
0
20
40
60M
agn
itu
de
(dB
)
10-1
100
101
102
-180
-135
-90
Ph
ase
(deg
)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 18 deg (at 15.4 rad/sec)
Frequency (rad/sec)
-20
0
20
40
60M
agn
itu
de
(dB
)
10-1
100
101
102
-180
-150
-120
-90
Ph
ase
(deg
)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 9.04 deg (at 31.4 rad/sec)
Frequency (rad/sec)
-50
0
50
Mag
nit
ud
e (d
B)
10-1
100
101
102
103
104
-180
-150
-120
-90
Ph
ase
(deg
)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 52.3 deg (at 50.1 rad/sec)
Frequency (rad/sec)
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.160
0.2
0.4
0.6
0.8
1
1.2
1.4Step Response
Time (sec)
Am
plit
ud
e
-80
-60
-40
-20
0
20M
agn
itu
de
(dB
)
100
101
102
103
104
-180
-135
-90
-45
0
Ph
ase
(deg
)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 77.5 deg (at 82.2 rad/sec)
Frequency (rad/sec)
-100
-50
0
50
Mag
nit
ud
e (d
B)
10-1
100
101
102
103
104
-180
-135
-90
Ph
ase
(deg
)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 52.3 deg (at 50.1 rad/sec)
Frequency (rad/sec)
Lead design tuning example
C(s) G(s)
2
1( )
( 5)G s
s s
Design specifications: rise time <=2 secovershoot <16%
4. Go back and take wgcd = 0.6*wn so that tr is not too small
Desired tr < 2 secWe had tr = 1.14 in the previous 4 designs
n=[1]; d=[1 5 0 0]; G=tf(n,d);Mp_d = 16; %in percentagePMd = 70 - Mp_d + 4; %use Mp + PM =70tr_d = 2; wnd = 1.8/tr_d; w_gcd = 0.6*wnd;Gwgc=evalfr(G, j*w_gcd);PM = pi+angle(Gwgc);phimax= PMd*pi/180-PM;alpha=(1+sin(phimax))/(1-sin(phimax));zlead= w_gcd/sqrt(alpha);plead=w_gcd*sqrt(alpha);K=sqrt(alpha)/abs(Gwgc);ngc = conv(n, K*[1 zlead]);dgc = conv(d, [1 plead]);[ncl,dcl]=feedback(ngc,dgc,1,1);stepchar(ncl,dcl); gridfigure(2); margin(G); hold on; margin(ngc,dgc); hold off; grid
-200
-100
0
100
200M
ag
nit
ud
e (
dB
)
10-3
10-2
10-1
100
101
102
103
-270
-225
-180
-135
-90
Ph
ase (
deg
)Bode Diagram
Gm = 22.3 dB (at 3.45 rad/sec) , Pm = 60 deg (at 0.54 rad/sec)
Frequency (rad/sec)
0 5 10 15 20 25 30 350
0.2
0.4
0.6
0.8
1
1.2
1.4
Time (sec)
Am
pli
tud
eUnit Step Response
ts=20.9 tp=5.85
Mp=16.5%ess tolerance band: +-2%
td=1.56
tr=1.95
yss=1
ess=0
Lead design
C(s) G(s)
40( )
( 2)G s
s s
Design specifications: Keep tr, td, butreduce overshoot to <16%
Lag design
C(s) G(s)
50( )
(0.02 1)G s
s s
• Desired design specifications are:– Step response overshoot <= 20%– Steady state tracking error for ramp
input <= 1/200;
Alternative lead design example• Plant transfer function is given by:
• n=[50]; d=[1/50 1 0];
• Desired design specifications are:– Step response overshoot <= 20%– Steady state tracking error for ramp input <=
1/200;
– No speed requirements– No settling concern– No bandwidth requirement