Lecture :Examples using compensators Venkata Sonti Department of Mechanical Engineering Indian Institute of Science Bangalore, India, This draft: March, 8 Example :Spring Mass Damper with step input Consider the earlier spring mass damper system with values: M=,C=,K=. The loop trsnafer function GH is given by GH = s + s + We need to design a controller for a step response with the specs zero steady state error less than % overshoot settling time less than sec Lets look at the bode diagram. Last lecture we found that lim s GH = k p. From the bode diagram this is just the low frequency asymptote of the amplitude plot. The value is - db which is log(.). The step response shows this value of steady state. The system is overdamped and stable so our ideas of bandwidth will not hold. Lets reduce the steady state error with a integral controller. Lets use /s. The step and bode plots are shown in figure. The PM is degrees and so the system is quite heavily damped. The steady state error has been reduced but the settling time is 8 sec. We can reduce the settling time by raising the gain. Again there is only integral controller, ki=. The phase margin has gone down to 8 deg. There is a big overshoot. Rise time is. sec. Settling time is 8 sec. It is obvious that the system is more unstable. The lead compensator as seen earlier brings an additional phase margin which also raises damping and reduces overshoot and settling time. So we design a lead compensator. We try to give an additional degrees phase margin. Right now we have about 8 degrees. However, lead compensator also adds gain at higher frequencies. Hence, the gain crossover frequency will shift to the right. It can be seen from the figure that as we move to the right the phase curve is dropping rapidly toward -8 and hence if we wish to add degrees phase margin, we should compensate for the dropping phase and curve and calculate for degrees. So φ m = o and a = + sin(φ m) sin(φ m )
- - - -8 - Bode diagram of M=,C=,k=.......... step response of M=,C=,k=.. Figure : Bode plot and step response for /s + s +. closed loop. Bode Diagrams Gm=. db (at. rad/sec), Pm=. deg. (at.9 rad/s.9.8....... step response of Integral Cont...8. 8 Figure : Bode plot and step response Int controller /s for /s + s +. closed loop.
Gm=. db (at. rad/sec), Pm=8.9 deg. (at. rad/sec step response for ki=.8....8... 8 Figure : Bode plot and step response Int controller /s for /s + s +. closed loop. At high frequencies the gain given by a is log(a) =.89dB. The question is where will this additional phase get added. Obviously, it gets added at the new gain crossover, which is yet unknown! However, the phase is added at the center of the lead compensator bode diagram where the amplitude is log(a)/ =.db. Hence, the frequency point which is currently the gain crossover (gain=db) point must have been at -. db prior to compensation. Hence, we look for the point where the current gain value is -. db and this is ω =.9rad/s. From a and ω we can find the value of T = /( a ω). The lead compensator is then given by C(s) = ats + Ts + =.9s +.s + With the above compensator applied the bode and step response change to what is given in figure. We use a second compensator to gain some more phase margin. However, as the curve rapidly moves toward -8 not much is possible. See figure.
First lead compensator Gm=. db (at.9 rad/sec), Pm=. deg. (at.8 rad/se.. Step response with the first lead compensator.8.. a=.9, om=.9.... Figure : Bode plot and step response after lead compensation Bode plot with the second lead compensator. Gm=.8 db (at 9.9 rad/sec), Pm=. deg. (at. rad/se..8... Step response after second lead compensator a=, om=8..... Figure : Bode plot and step response after lead compensation
Example: Lag compensation on the cart problem The open-loop transfer function for this problem is : Y (s) U(s) = ms + b m=, b=, U(s)= Y(s)=Velocity output The design criteria are: Rise time < sec Overshoot < % Steady state error <%. Bode plot and open-loop response The first step in solving this problem using frequency response is to determine what open-loop transfer function to use. Just like for the Root-Locus design method, we will only use a proportional controller to solve the problem. The open-loop transfer function are shown below. Y (s) U(s) = ms + b In order to use a Bode plot, the open-loop response must be stable. Let Kp equals for now and see how the open-loop response looks like. Create an new m-file and enter the following commands. m = ; b = ; u = ; Kp=; numo=[kp]; deno=[m b]; step (u*numo,deno) Running this m-file in the Matlab command window should give you the following plot (figure ) bode(numo,deno) should give you the following Bode plot also (figure ).. Proportional controller Let s see what system characteristics we can determine from the above Bode plot. Recall that the bandwidth frequency (BW) (the frequency at the gain M(dB)=- -.db) is roughly equals to the natural frequency (Wn). Using the equation Tr =.8/ω n =.8/BW the rise time (Tr) for our system can be determined to be extremely long since the gain shown above do not reach - -.db. The damping ratio is roughly equals to the phase margin (in degrees) divided by. Since our phase margin is approximately degrees, the damping ratio will be.. Thus, we know that the system is overdamped (since the damping ratio is greater than ). Finally, the steady-state error can be found from the following equation: e( ) = + mag.% and (M db/) = mag where M db is the low frequency gain. For our system, since the low frequency gain M(dB) is approximately -db, the steady-state error should be 98%. We can confirm these by generating a closed-loop step response (figure ).
Step response for the openloop system Bode plot of the openloop system 9 8 8 Figure : Step response and bode plot of the open loop cart system...8.. Step response for the closed loop system Kp=...8... 8 Figure : Step response of the closed loop cart system.
In terms of the Bode plot, if we can shift the gain upward so that both the bandwidth frequency and the low frequency gain increase, then both the rise time and the steady-state error will improve. We can do that by increasing the proportional gain (Kp). Let s increase the proportional gain (Kp) to,say, and see what happens. Change the m-file to the following. m = ; b = ; u = ; Kp=; numo=[kp]; deno=[m b]; bode(numo,deno) Running this m-file in the Matlab command window should give you the following Bode plot and step response(figure 8). Bode plot of the open loop system kp= Step response of the closed loop system kp= To: Y() To: Y() Figure 8: Step response and bode plot of the closed loop cart system kp=. Now, the low frequency gain is about db (magnitude ) which predicts the steady-state error of %. The bandwidth frequency is about. rad/sec so that the rise time should be around 8 seconds confirmed by figure 8. As we predicted, both the steady-state error and the rise time have improved. Let s increase the proportional gain even higher and see what happens. Change the m-file to the following and rerun it. You should get the following Bode plot. m = ; b = ; u = ; Kp=; numo=[kp/b]; deno=[m/b ]; bode(numo,deno) Now, the low frequency gain is approximately db (magnitude ) that predicts the steadystate error of 9%, and the bandwidth frequency is around. that predicts the rise time of sec (within the desired value). Thus, both the steady-state error and the rise time should have been improved. Again, let s confirm these by generating the closed-loop step response (figure 9). If you noticed, the steady-state error will eventually reach the desired value by increasing the proportional gain even higher. However, by the time the steady-state error reaches the desired value, the rise time becomes too fast (unrealistic for the real physical system). Thus, let s leave the Kp as it is and implement a lag controller to handle the steady-state error problem.
Bode plot of the open loop system kp= Step response of the closed loop system kp= 9 8... 9 Figure 9: Step response and bode plot of the closed loop cart system kp=.. Lag controller If you take a look at the Lag or Phase-Lag Compensator using Frequency Response section of the Lead and Lag Compensator page, the lag controller adds gain at the low freqencies while keeping the bandwidth frequency at the same place. This is actually what we need: Larger low frequency gain to reduce the steady-state error and keep the same bandwidth frequency to maintain the desired rise time. The transfer function of the lag controller is shown below. G(s) = + ats a + Ts a < Now, we need to choose a value for a and T. Recall from the Lag or Phase-Lag Compensator using Frequency Response page, the steady-state error will decrease by a factor of a. The value T should be chosen so that two corner frequencies will not be placed close together because transient response gets worse. So let a equals. and T equals and see what happens. Copy the following m-file and run it in the Matlab command window. You should see the following Bode plot. m = ; b = ; u = ; Kp=; numo=[kp/b]; deno=[m/b ]; a =.; T=; numlag = [a*t ]; denlag = a*[t ]; newnum = conv(numo,numlag); newden = conv(deno,denlag); bode(newnum,newden) figure [numc,denc]=cloop(newnum,newden); step (u*numc,denc) Since the low frequency gain has increased while the bandwidth frequency stayed the same, the steady-state error should be reduced and the rise time should stay the same. Let s confirm this by generating a closed-loop step response (figure ) We can see that the steady-state error has been met. However, the settling time is too long. To fix this, raise the proportional gain to Kp=. With this change made, the following Bode and step response plots can be generated. (figure ) 8
Bode plot of the open loop system with lag compensator kp= Step response of the closed loop system with lag compensator kp= 9 8 Figure : Step response and bode plot of the closed loop cart system with compensator kp=. Step response of the closed loop system with lag compensator kp=step response of the closed loop system with lag compensator kp= 9 8 8 Figure : Step response and bode plot of the closed loop cart system with compensator kp=. 9
As you can see, the overshoot is in fact zero, the steady state error is close to zero, the rise time is about seconds, and the settling time is less than. seconds. The system has now met all of the design requirements. No more iteration is needed.