Desired Bode plot shape

Preview:

DESCRIPTION

Desired Bode plot shape. High low freq gain for steady state tracking Low high freq gain for noise attenuation Sufficient PM near w gc for stability. Want high gain. Use PI or lag control. w gc. High freq Noise immu. w. Mid freq Speed, BW. 0dB. Low freq ess , type. - PowerPoint PPT Presentation

Citation preview

Desired Bode plot shape

0

-90

-180

0dB

gc

High low freq gain for steady state trackingLow high freq gain for noise attenuationSufficient PM near gc for stability

Low freqess, type

High freqNoise immu

Want high gain

Want low gain

Mid freqSpeed, BW

Want sufficientPhase margin

Use low pass filters

Use PI or lag control

Use lead or PD control

PM+Mp=70

Mr, Mp

Overall Loop shaping strategy• Determine mid freq requirements

– Speed/bandwidth gc

– Overshoot/resonance PMd

• Use PD or lead to achieve PMd@ gc

• Use overall gain K to enforce gc

• 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 gcd to be the freq at which PM is sufficient, and KP = 1/|G(jgcd)|

– For fixing speed: from td, tr, tp, or ts requirement, find out n, let gcd = (0.65~0.8)*n and KP = 1/|G(jgcd)|

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

PD control design Variation

• Restricted to using KP = 1

• Meet Mp requirement

• Find gc and PM

• Find PMd

• Let = PMd – PM + (a few degrees)

• Compute TD = tan()/wgcd

• KP = 1; KD=KPTD

Lead Design • From specs => PMd and gcd

• From plant, draw Bode plot

• Find PMhave = 180 + angle(G(jgcd)

• PM = PMd - PMhave + a few degrees

• Choose =plead/zlead so that max =PM and it happens at gcd

1

gcdgcdgcd

gcdgcd

max

max

)/()()(

*,/

sin1

sin1

leadlead

leadlead

pjjGzjK

pz

Alternative use of lead1.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

0.25 0.75gc gc/ ,Or: *lead leadz p

Lag Controller Design

lag

lag

ps

zsKsC

)(

00 Kpz laglag

Kp

zK

pj

zjKjC

lag

lag

lag

lag

0)(

1 1( ) tan ( ) tan ( ) 0,lag lag

destabilizin

C jz p

g

Lag and lead-lag Design Steps• From plant, draw Bode plot

• From specs => PMd and gcd

– If there is speed or BW req, gcd, • In this case, if PM not enough, design PD or lead

– Otherwise, choose gcd to have PM>PMd

• Find K to enforce gcd:

• Find Kp,v,a-have with K and C above

• Find Kp,v,a-des from ess specs

• zlag/plag = Kp,v,a-des/Kp,v,a-have

• Let zlag= gcd/5~20, depending on PM room

• Compute plag

lead

lead

s zC

s p

1C

1

gcd )(

jCGK

2

1

( ) ; /

( )

Gain: 20log(| ( ) |) 20log( )

20log 1

Phase: ( ) ( ) tan ( )2 2

IP P I P

P

P

K s zC s K K z K K

s sj z

C j Kj

C j K

z

C j z jz

PI Controller

s

KKsC IP )(

PI Controller Design

00 PI KK

0),/log(20

),log(20)(

asKI

asK

j

KKjC PIP

10,

( ) tan ( )90, 0

I

P

asKC j

asK

Use PI only when you have to increase system type, i.e., when you have to make a nonzero ess to zero!

0

5

10

15

20

25

30

35

40

45

50M

agn

itu

de

(dB

)

10-2

10-1

100

101

102

-90

-60

-30

0

Ph

ase

(deg

)Bode Diagram

Frequency (rad/sec)

/z

Gain/KpIn dB =zType ↑

LF gain ↑ ess ↓

Big phase ↓Detabilizing

Let wgc/zbig

PI controller design• Choice 1: first multiply G by 1/s, then do PD

• Choice 2: KP+KI/s=KP (s+z)/s

– Do proportional controller design for wgc, PM Kp

– Place zero of PI controller at 10 to 20 times smaller than wgc z=wgc/(10~20)

– KIK=KP z

0

20

40

60M

agn

itu

de

(dB

)

10-3

10-2

10-1

100

101

-90

-60

-30

0

Ph

ase

(deg

)Bode Diagram

Frequency (rad/sec)

gcd

Kill PM significantly

KI/KP=gcd/2

KI/KP=gcd/40

KI/KP=gcd/5KI/KP=gcd/10

KI/KP=gcd/20

-11.3

-26. 6

-5.7-2.8-1.4

Don’t want these:PM reduction!

Want these:DC gain boosting

Basic PI Design Steps• From plant, draw Bode plot

• From specs => PMd and gcd

– If there is speed or BW req, gcd, • In this case, if PM not enough, design PD or lead

– Otherwise, choose gcd to have PM>PMd

• Find K to enforce gcd:

• Let KP = K

• And KI = Kgcd/10~20, depending on extra PM room to spare

1

gcd( )K CG j

Need to increase type to make a nonzero ess to be zero. But no requirement on ess after type increase.

56

500)(

2

sssG

Want Mp <= 16%Steady state error = 0 when input is constant.

Analysis: steady state error = 0 when input is constant means that ess to step must be 0; or the system type must be 1 or higher.

Original system is type 0, so need PI control to increase the system type to 1.

Example

%PI control examplen=[500]; d=[1 6 5];figure(1); clf; margin(n,d); hold on; grid; V=axis;Mp = 16; PMd = 70 - Mp +10; %put in a large extra PM, because PI kills PMsemilogx(V(1:2),[PMd-180 PMd-180],':r'); %draw PMd linex=ginput(1); w_gcd = x(1); %get desired w_gcKP = 1/abs(polyval(n,j*w_gcd)/polyval(d,j*w_gcd));z = w_gcd/10; KI = z*KP;ngc = conv(n, [KP KI]); dgc = conv(d, [1 0]);figure(1); margin(ngc,dgc); grid; [ncl,dcl]=feedback(ngc,dgc,1,1);figure(2);step(ncl,dcl); grid;figure(3); margin(ncl*1.414,dcl); grid;

-20

0

20

40M

agn

itu

de

(dB

)

10-2

10-1

100

101

102

-180

-135

-90

-45

0

Ph

ase

(deg

)

Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 15.4 deg (at 22.1 rad/sec)

Frequency (rad/sec)

-60

-40

-20

0

20

40

60M

agn

itu

de

(dB

)

10-2

10-1

100

101

102

-180

-135

-90

-45

0

Ph

ase

(deg

)

Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 58.6 deg (at 4.1 rad/sec)

Frequency (rad/sec)

0 2 4 6 8 10 12 140

0.2

0.4

0.6

0.8

1

1.2

1.4

Step Response

Time (sec)

Am

plit

ud

e

Ess is 0

Can afford more overshoot!

Sluggish settling is typical of PI or lag controlled systems.

Can reduce it by moving the p and z of lag or PI controller to higher frequency.

-40

-20

0

Mag

nit

ud

e (d

B)

10-2

10-1

100

101

102

-180

-135

-90

-45

0

Ph

ase

(deg

)

Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 74.8 deg (at 6.13 rad/sec)

Frequency (rad/sec)

%PI control examplen=[500]; d=[1 6 5];figure(1); clf; margin(n,d); hold on; grid; V=axis;Mp = 16; PMd = 70 - Mp +10; %put in a large extra PM, because PI kills PMsemilogx(V(1:2),[PMd-180 PMd-180],':r'); %draw PMd linex=ginput(1); w_gcd = x(1); %get desired w_gcKP = 1/abs(polyval(n,j*w_gcd)/polyval(d,j*w_gcd));z = w_gcd/5; KI = z*KP;ngc = conv(n, [KP KI]); dgc = conv(d, [1 0]);figure(1); margin(ngc,dgc); grid; [ncl,dcl]=feedback(ngc,dgc,1,1);figure(2);step(ncl,dcl); grid;figure(3); margin(ncl*1.414,dcl); grid;

-100

-50

0

50

100M

agn

itu

de

(dB

)

10-2

10-1

100

101

102

-180

-135

-90

-45

0

Ph

ase

(deg

)

Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 52.8 deg (at 4.14 rad/sec)

Frequency (rad/sec)

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

1.2

1.4

Step Response

Time (sec)

Am

plit

ud

e

PI Design with ess specs• From plant, draw Bode plot

• From specs => Kv,a-des, PMd and gcd

– For required ess, Kv,a-des =1/ess

– With C(s)=1/s, compute Kv,a-have

– If there is speed or BW req, gcd, • In this case, if PM not enough, design PD or lead

– Otherwise, choose gcd to have PM>PMd

• Find K to enforce gcd:

• Let KP = K, KIdes= Kv,a-des/Kv,a-have

– If KIdes <= Kgcd/5~20, done, let KI = KIdes

– Else, increase gcd and go back to previous step

1

gcd )(

jCGK

Need to increase type by 1 to make a nonzero ess to be zero, and after type increase, there is further requirement on ess.

56

500)(

2

sssG

Want Mp <= 16%Steady state error <= 0.1 for ramp input.

Analysis: steady state error <= 0.1 for ramp implies that the system type must be 1 or higher.

Original system is type 0, so need PI control.

Ess to ramp <= 0.1 requires Kvd >= 10.

Previous design leaves Kv = KI*500/5 = 100KI = 4.44

Example

KI=0.0444

0 500 1000 15000

500

1000

1500Step Response

Time (sec)

Am

plit

ud

e

This is actually the ramp response, generated with the step command but the closed-loop TF is multiplied by 1/s.

499.8 500 500.2 500.4 500.6

499.5

500

500.5

Step Response

Time (sec)

Am

plit

ud

e

ess>0.1

In the previous design, KI=0.0444 is already at the maximum of the range Kgcd/5~20,

But KIdes = 0.1, which is a factor of 10/4.44 larger.

So need to increase KP.

Hence, try letting KI = KIdes = 0.1, and make KP larger by 10/4.44.

KP = KP*0.1/KI; KI =0.1;

ngc = conv(n, [KP KI]); dgc = conv(d, [1 0]);figure(1); margin(ngc,dgc); grid;[ncl,dcl]=feedback(ngc,dgc,1,1);figure(2);step(ncl,dcl); grid;figure(3); step(ncl,[dcl 0]); grid;

Ramp response

Old KI, new KI

0 500 1000 15000

500

1000

1500 Step Response

Time (sec)

Am

plit

ud

e

499.85 499.9 499.95 500 500.05 500.1 500.15 500.2

499.7

499.8

499.9

500

500.1

500.2

Step Response

Time (sec)

Am

plit

ud

e

ess = 0.1

0 0.5 1 1.5 2 2.50

0.2

0.4

0.6

0.8

1

1.2

1.4Step Response

Time (sec)

Am

plit

ud

e

Can play with KP, but difficult to achieve the best KP

PI Design with PD Design Steps• From required ess, Kv,a-des =1/ess

• With C(s)=1/s, compute Kv,a-have

• Let KI = Kv,a-des/Kv,a-have

• Multiply G(s) by KI/s

• Do a PD design for KIG(s)/s, with DC gain=1:– Find gc and PM

– Find PMd

– Let = PMd – PM + (a few degrees)

– Compute TD = tan()/wgcd

• KP = KI*TD

%Alternative PI control by PD designclear all; n=[0 0 500]; d=[1 6 5];ess2ramp = 0.1; Kvd = 1/ess2ramp;Kva = n(end)/d(end); %after introducing 1/sKI = Kvd/Kva;%multiplying G(s) by KI/s and get new Bodeni=KI*n; di=[d 0];figure(1); clf; margin(ni,di); hold on; grid;[GM,PM,wpc,wgc]=margin(ni,di);PMd=54+6; phi = (PMd-PM)*pi/180;Td = tan(phi)/wgc; KP=KI*Td;ngc = conv(n, [KP KI]); dgc=di;figure(1); margin(n,d); margin(ngc,dgc);[ncl,dcl]=feedback(ngc,dgc,1,1);figure(3);step(ncl,dcl); grid;

-100

-50

0

50

100M

agn

itu

de

(dB

)

10-2

10-1

100

101

102

-270

-180

-90

0

Ph

ase

(deg

)

Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 38.8 deg (at 6.2 rad/sec)

Frequency (rad/sec)

0 0.5 1 1.5 2 2.50

0.2

0.4

0.6

0.8

1

1.2

1.4Step Response

Time (sec)

Am

plit

ud

e

clear all; n=[0 0 500]; d=[1 6 5];ess2ramp = 0.1; Kvd = 1/ess2ramp;Kva = n(end)/d(end); %after introducing 1/sKI = Kvd/Kva;%multiplying G(s) by KI/s and get new Bodeni=KI*n; di=[d 0];figure(1); clf; margin(ni,di); hold on; grid;[GM,PM,wpc,wgc]=margin(ni,di);PMd=50+3; phi = (PMd-PM)*pi/180;Td = tan(phi)/wgc; KP=KI*Td;ngc = conv(n, [KP KI]); dgc=di;figure(1); margin(n,d); margin(ngc,dgc);[ncl,dcl]=feedback(ngc,dgc,1,1);figure(3);step(ncl,dcl); grid;

-100

-50

0

50

100M

agn

itu

de

(dB

)

10-2

10-1

100

101

102

-270

-180

-90

0

Ph

ase

(deg

)

Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 40.2 deg (at 5.04 rad/sec)

Frequency (rad/sec)

0 0.5 1 1.5 2 2.50

0.2

0.4

0.6

0.8

1

1.2

1.4Step Response

Time (sec)

Am

plit

ud

e

Alternative PI Design Steps• For required ess, Kv,a-des =1/ess

• With C(s)=1/s, compute Kv,a-have

• Let KI = Kv,a-des/Kv,a-have

• Rewrite char eq: (KP + KI/s)G(s) + 1=0• KP*n/d + KI*n/d/s +1 = 0• KP *n*s + KI*n+d*s =0, KP*n*s/(KI*n+d*s) + 1 =0• So do a KP design for n*s/(KI*n+d*s), with KI above

– Draw Bode plot for n*s/(KI*n+d*s)– Select max PM frequency– Compute KP to make that frequency wgc

%Alternative PI control exampleclear all; n=[0 0 500]; d=[1 6 5]; %note same lengthess2ramp = 0.1; Kvd = 1/ess2ramp;Kva = n(end)/d(end); %after introducing 1/sKI = Kvd/Kva;%get TF after closing the G(s) and KI/s loopni=[n 0]; di=[d 0]+KI*[0 n];figure(1); clf; margin(ni,di); grid;x=ginput(1); w_gcd = x(1); %get desired w_gcKP = 1/abs(polyval(ni,j*w_gcd)/polyval(di,j*w_gcd));ngc = conv(n, [KP KI]); dgc = conv(d, [1 0]);figure(2); margin(n,d); hold on; margin(ngc,dgc);[ncl,dcl]=feedback(ngc,dgc,1,1);figure(3);step(ncl,dcl); grid;

-40

-20

0

20

40

60M

agn

itu

de

(dB

)

10-1

100

101

102

-315

-270

-225

-180

-135

-90

Ph

ase

(deg

)

Bode DiagramGm = -43.5 dB (at 2.89 rad/sec) , Pm = 15.1 deg (at 22.1 rad/sec)

Frequency (rad/sec)

Pick wgc here

-100

-50

0

50

100M

agn

itu

de

(dB

)

10-2

10-1

100

101

102

-180

-135

-90

-45

0

Ph

ase

(deg

)

Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 29.5 deg (at 3.43 rad/sec)

Frequency (rad/sec)

0 1 2 3 4 50

0.5

1

1.5Step Response

Time (sec)

Am

plit

ud

e

-40

-20

0

20

40

60M

agn

itu

de

(dB

)

10-1

100

101

102

-315

-270

-225

-180

-135

-90

Ph

ase

(deg

)

Bode DiagramGm = -43.5 dB (at 2.89 rad/sec) , Pm = 15.1 deg (at 22.1 rad/sec)

Frequency (rad/sec)

Pick wgc here

-100

-50

0

50

100M

agn

itu

de

(dB

)

10-2

10-1

100

101

102

-180

-135

-90

-45

0

Ph

ase

(deg

)

Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 36.2 deg (at 3.89 rad/sec)

Frequency (rad/sec)

0 0.5 1 1.5 2 2.5 3 3.5 40

0.2

0.4

0.6

0.8

1

1.2

1.4Step Response

Time (sec)

Am

plit

ud

e

-40

-20

0

20

40

60M

agn

itu

de

(dB

)

10-1

100

101

102

-315

-270

-225

-180

-135

-90

Ph

ase

(deg

)

Bode DiagramGm = -43.5 dB (at 2.89 rad/sec) , Pm = 15.1 deg (at 22.1 rad/sec)

Frequency (rad/sec)

Pick wgc here

0 0.5 1 1.5 2 2.50

0.2

0.4

0.6

0.8

1

1.2

1.4 Step Response

Time (sec)

Am

plit

ud

e

Numerical sweep of KP indicates that ~30% Mp is about the best one can achieve.

We conclude that it is impossible to meet the specifications with a PI controller.

Both of our design procedures came very close to the best achievable.

Of course, we can fix the excessive overshoot with an additional lead design.

56

500)(

2

sssG

Want Mp <= 16%Steady state error <= 0.1 for ramp input.

Overall design:1.Ess2ramp <=0.1, PI with KI=1/0.1*5/500=0.12.Close the I-loop and select KP for best PM shape, KP = 0.0843.Use a lead controller with DC gain = 1 to reduce Mp from 30% to <= 16%

clear all; n=[0 0 500]; d=[1 6 5];ess2ramp = 0.1; Kvd = 1/ess2ramp;Kva = n(end)/d(end); %after introducing 1/sKI = Kvd/Kva;%get TF after closing the G(s) and KI/s loopni=[n 0]; di=[d 0]+KI*[0 n];figure(1); clf; margin(ni,di); grid;x=ginput(1); w_gcd = x(1); %get desired w_gcKP = 1/abs(polyval(ni,j*w_gcd)/polyval(di,j*w_gcd));ngc = conv(n, [KP KI]); dgc = conv(d, [1 0]);figure(2); margin(n,d); hold on; margin(ngc,dgc);[ncl,dcl]=feedback(ngc,dgc,1,1);figure(3);step(ncl,dcl); grid;

%follow with a lead controller with DC gain =1 %to make Mp=30% ==> Mp<=16%[GM,PM,wpc,wgc]=margin(ngc,dgc);w_gcd=wgc; PMd=54+6; phimax = (PMd-PM)*pi/180;alpha=(1+sin(phimax))/(1-sin(phimax));zlead=w_gcd/alpha^.25; plead=w_gcd*alpha^.75;ngcc = conv(ngc, alpha*[1 zlead]);dgcc = conv(dgc, [1 plead]);figure(2); margin(ngcc,dgcc); grid;[ncl,dcl]=feedback(ngcc,dgcc,1,1);figure(5);step(ncl,dcl); grid;figure(6);step(ncl,[dcl 0]); grid; %ramp response

-100

-50

0

50

100M

agn

itu

de

(dB

)

10-2

10-1

100

101

102

103

-180

-135

-90

-45

0

Ph

ase

(deg

)

Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 53.9 deg (at 7.1 rad/sec)

Frequency (rad/sec)

Original system

After PI alone

With PI and lead

0 0.5 1 1.5 20

0.2

0.4

0.6

0.8

1

1.2

1.4Step Response

Time (sec)

Am

plit

ud

e

Mp <= 16% is met.

0 500 1000 15000

500

1000

1500Step Response

Time (sec)

Am

plit

ud

e

499.6 499.7 499.8 499.9 500 500.1 500.2 500.3499.5

499.6

499.7

499.8

499.9

500

500.1

500.2

500.3Step Response

Time (sec)

Am

plit

ud

e Ess=0.1

y=t

Recommended