1 / 38

Matlab program template

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 … …

lavi
Download Presentation

Matlab program template

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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?

  2. 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

  3. 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

  4. 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

  5. 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)

  6. 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

  7. 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

  8. sys_cl = feedback(K*sys_p,1); step(sys_cl);

  9. 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

  10. Overshoot is a little too much. Re-choose pd =-0.8+j0.8

  11. ylim([0,yss*(1+Mp)])

  12. 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

  13. 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

  14. 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)

  15. C(s) Example: Want: Sol: (pd not on R.L.) (Need a zero to attract R.L. to pd)

  16. tsis OK But Mp too large To redesign: Reduce wd pd=-2+j1.5

  17. 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)])

  18. Drawbacks of PD • Not proper : deg of num > deg of den • High frequency gain → ∞: • High gain for noise Saturates circuits Cannot be implemented physically

  19. Lead Controller • Approximation to PD • Same usefulness as PD • It contributes a lead angle:

  20. 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

  21. 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

  22. 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)

  23. Draw R.L. & desiredregion Pick pd right at the vertex: (Could pick pd a little inside the region to allow “flex”)

  24. 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:

  25. Pick –z to the left of pd

  26. Speed is doubled, but over shoot is too much.

  27. Change controller from to To reduce the gain a bit, and make it a little closer to PD

  28. Particular choice of z :

More Related