400 likes | 588 Views
Matlab program template. % enter plant transfer function Gp(s) nump = …. ; denp=…. ; %Draw root locus … %adjust window size, x-limit, y-limit, etc … % enter desired closed loop step response specification: % you may allow both uppper and lower limits … …
E N D
Matlab program template % enter plant transfer function Gp(s) nump = …. ; denp=…. ; %Draw root locus … %adjust window size, x-limit, y-limit, etc … % enter desired closed loop step response specification: % you may allow both uppper and lower limits … … % convert from specs to zeta, omegan, sigma, omegad … … % hold the graph, and plot allowable region for pole location on RL graph … … % obtain controller transfer function %if PD or lead needed, design a PD or lead … %if PI or lag needed, design a PI or lag … %design P, or final decision on overall gain … % get controller TF … % obtain closed loop transfer function from Gp(s) and C(s) … … numcl=…; dencl=…; … … % obtain closed-loop step response … … % compute actual step response specs, using your program from last week … … % are they good? % compute the actual closed-loop poles, place “x” at those locations … … % are they in the allowable region?
Controller design by R.L. Typical setup: C(s) G(s) Controller Design Goal: Select poles and zero of C(s) so that R.L. pass through desired region Select K corresponding to a good choice of dominant pole pair
Proportional control design • Draw R.L. for given plant • Draw desired region for poles from specs • Pick a point on R.L. and in desired region • Use ginput to get point and convert to complex # • Compute K using abs and polyval • Obtain closed-loop TF • Obtain step response and compute specs • Decide if modification is needed
When to use: If R.L. of G(s) goes through the desired region for c.l. poles What is that region: • From design specs, get desired Mp, ts, tr, etc. • Use formulae for 2nd order system to get desired ωn, ζ, σ, ωd • Identify / plot these in s-plane
Example: When C(s) = 1, things are okay But we want initial response speed as fast as possible; yet we can only tolerate 10% overshoot. Sol: From the above, we need that means: C(s)
This is a cone around –Re axis with ±60° area We also want tr to be as small as possible. i.e. : want ωn as large as possible i.e. : want pd to be as far away from s = 0 as possible • Draw R.L. • Pick pd on R.L., in cone & | pd | max
n=1; d=[1 6 0]; sys_p = tf(n,d); rlocus(sys_p) [x,y]=ginput(1); pd=x+j*y; Gpd = evalfr(sys_p,pd); K=1/abs(Gpd); K=25
sys_cl = feedback(K*sys_p,1); step(sys_cl);
C(s) • Example: • Want: , as fast as possible • Sol: • Draw R.L. for • Draw cone ±45° about –Re axis • Pick pd as the crossing point of the z= 0.7 line & R.L. pd=-0.9+j0.9
Overshoot is a little too much. Re-choose pd =-0.8+j0.8
Controller tuning: • First design typically may not work • Identify trends of specs changes as K is increased.e.g.: as KP , pole • Perform closed-loop step response • Adjust K to improve specse.g. If MP too much, the 2. says reduce KP
PD controller design • This is introducing an additional zero to the R.L. for G(s) • Use this if the dominant pole pair branches of G(s) do not pass through the desired region • Place additional zero to “bend” the RL into the desired region
Design steps: • From specs, draw desired region for pole.Pick from region, not on RL • Compute • Select • Select: Gpd=evalfr(sys_p,pd) phi=pi - angle(Gpd) z=abs(real(pd))+abs(imag(pd)/tan(pi-phi)) Kd=1/abs(pd+z)/abs(Gpd)
C(s) Example: Want: Sol: (pd not on R.L.) (Need a zero to attract R.L. to pd)
tsis OK But Mp too large To redesign: Reduce wd pd=-2+j1.5
Gpd = evalfr(sys_p, pd) Gpd = - 0.1600 + 0.2133i phi = pi - angle(Gpd) phi = 0.9273 z = abs(real(pd)) + abs(imag(pd)/tan(pi - phi)) z = 3.1250 Kd = 1/abs(pd+z)/abs(Gpd) Kd = 2 Kp = z*Kd Kp = 6.2500 sys_c=tf([Kd Kp], 1); sys_cl=feedback(sys_c*sys_p, 1) Transfer function: 2 s + 6.25 ---------------- s^2 + 4 s + 6.25 step(sys_cl); ylim([0 yss*(1+2*Mp)])
Drawbacks of PD • Not proper : deg of num > deg of den • High frequency gain → ∞: • High gain for noise Saturates circuits Cannot be implemented physically
Lead Controller • Approximation to PD • Same usefulness as PD • It contributes a lead angle:
C(s) G(s) • Lead Design: • Draw R.L. for G • From specs draw region for desired c.l. poles • Select pd from region • LetPick –z somewhere below pd on –Re axisLetSelect
There are many choices of z, p • More neg. (–z) & (–p) → more close to PD & more sensitive to noise, and worse steady-state error • But if –z is > Re(pd), pd may not dominate
Example: Lead Design MP is fine, but too slow. Want: Don’t increase MP but double the resp. speed Sol: Original system: C(s) = 1 Since MP is a function of ζ, speed is proportional to ωn C(s)
Draw R.L. & desiredregion Pick pd right at the vertex: (Could pick pd a little inside the region to allow “flex”)
Clearly, R.L. does not pass through pd, nor the desired region.need PD or Lead to “bend” the R.L. into region.(Note our choice may be the easiest to achieve) Let’s do Lead:
Change controller from to To reduce the gain a bit, and make it a little closer to PD