Module Key Study Points
- The benefiets of feedback
- Step response and tracking performance
- Stability judgment from transfer function pole locations
- Root-locus plot
- Disturbance attenuation performance
Figure 1 a simple proportional feedback controlNotice in this diagram that we wrap the output as negative feedback to the summing junction. This in effect feeds the difference between the step command and output to the gain block. Another learning point from this model file is how to push some variables to Scilab workspace using “To workspace” blocks. The reason for using these blocks is that we want to compare responses from 3 different proportional gain settings. Instead of creating 3 copies of the diagram in Xcos with different gain values, it is easier to change the output variable name and run the simulation 3 times, then plot the results in Scilab. Click on a To workspace block. There are 3 input fields. We need to adjust only the uppermost 2 –Size of buffer and Scilab variable name– and leave the Inherit field to 0. Here we run the simulation 3 times with 3 sets of small gains 0.001, 0.01, and 0.1. The output variable names are set to y1, y2, and y3. An output from To workspace block is a data structure with two fields, namely time and values. So, to compare the responses, issue the following codes
-->plot(r.time,r.values,y1.time,y1.values,y2.time,y2.values, ... y3.time,y3.values); -->xlabel('time (sec)'); -->ylabel('angle'); -->legend('Command','Gain=0.001','Gain=0.01','Gain=0.1');which gives the plot in Figure 2.
Figure 2 step responses from different proportional gain settings
Tracking PerformanceFrom the comparison in Figure 2, we observe in the lowest gain case that the step response gradually rises to the command level of 1. When the gain increases, the response is faster, but exceeds 1 further before settling more in an oscillating fashion. The step responses from most dynamical systems behave quite the same. So we can formulate time-domain parameters that can be used as control specifications like shown in Figure 3. Consult an undergrad control text for definition of these parameters, some of them may have slight variants among authors. For example, some may define rise time tr as the period the response goes from 0.1 to 0.9 of the command value, while the settling time could be specified as the time the response stays within 0.05 or 0.02 of the command value.
Figure 3 step response specificationsThe step response explained thus far is one of the feedback properties called tracking performance. The responses in Figure 1, even though they all converges to the command value, may not be satisfactory in practice, because it takes about 800 seconds (or 13 minutes!) to settle. We can improve this step response by adding some dynamics to the controller, instead of using only a proportional gain. The next example exploits a type of simple control, known as a (1st order) lead-lag compensator, that has the controller transfer function in the form
Our control design job is to select the control parameters K, z, p , to achieve a good tracking response. Note that z and p are called the zero and pole of C(s). In general, zeros and poles of a transfer function correspond to the roots of its numerator and denominator, respectively. Certain feedback properties can be determined from their locations. We will get back to this later. At this point, let us do some trial and error design with the lead-lag compensator feedback diagram in Figure 4. Download leadlag_feedback.zcos, adjust the parameters K, z, p to achieve the best step response possible. Actually, there exists some design procedure for a lead-lag feedback system discussed in a standard undergrad control textbook. At this point, consult one if you are hopeless. We will gradually learn about control design after a few basics are made clear to the reader.
Figure 4 a lead-lag compensator feedback modelUsing this ad-hoc design, we are satisfied with
that yields the step response in Figure 5. Obviously, tracking performance is vastly improved, since now the step response settles within 0.2 second, compared to 800 seconds when using only proportional gain.
Figure 5 response from lead-lag compensator (2)Is there any drawback in replacing the static gain with this dynamic controller? Go back to the proportional control gain simulation. You can verify by yourself that increasing the gain can never destabilize the system. For the lead-lag compensator, let’s see what happen when someone adjusts the compensator zero and pole wildly, say, he might inadvertently switch the zero and pole location to
Running the simulation with this compensator yields the response in Figure 6. This is an example of unstable response, as the output oscillates out of bound. So, in the next section, we study in more detail this important feedback property.
Figure 6 response from lead-lag compensator (3)
Closed-Loop StabilityWe should have put this statement before anything else: a feedback system must be stable. An unstable closed-loop system is not only useless, it can also cause harm to the operator and/or environment. Imagine an output such as in Figure 6 would cause the robot arm to swing wildly and hit anything in the area. As already well-known, for an SISO system like our DC motor robot joint, feedback stability can be checked from the poles of a closed-loop transfer function. For a stable system, all such poles must lie in the left half of complex plane. A system with pole(s) on the jω axis, which gives oscillatory response may be called marginally stable. For example, in the diagram of Figure 4, the transfer function from r to y with unity feedback can be computed as
To form Tyr in Scilab is straightforward
-->s=poly(0,'s'); -->P=syslin('c',1/(10*s^2+0.1*s)); -->C=syslin('c',20000*(s+0.01)/(s+100)); -->Tyr=C*P/(1+C*P) Tyr = 2000 -------------- 2 2000 + 100s + sIts poles can then be observed graphically by issuing command
plzr(Tyr)which gives the plot shown in Figure 7. The poles are indicated by x symbol. (The round symbol marks the origin of complex plane, not a zero, since this transfer function has none.) We conclude that the closed-loop system is stable since all poles lie within the left half plane.
Figure 7 pole zero display from plzr commandUnfortunately, I could not find a single Scilab command to compute the poles from a transfer function directly (please email me if there is such a command that I missed). Two ways to get around this 1) extract the denominator from the transfer function and compute the root with roots command, or 2) extract state-space data with abcd command and compute the eigenvalues of matrix A using spec command.
Stability versus Gain AdjustmentIn practice, a controller gain might be the easiest parameter to adjust, since it leaves the dynamic part intact. Sometimes we are interested to visualize the closed-loop pole locations as a function of gain value. This is known in the control literature as the root-locus method. To richen the problem a little more, suppose another pole at s = 100 is added to the lead-lag compensator (2) to become
Then form a so-called loop transfer function
This transfer function is normally used in a few control design schemes such as classical method and QFT. It is also used in the root-locus method. So we construct it in Scilab as before
-->C=syslin('c',20000*(s+0.01)/(s+100)^2); -->L = C*P L = 2000 ---------------- 2 3 10000s + 200s + sThe Scilab command for root-locus method is evans
-->evans(L); -->sgrid;gives the plot in Figure 8. This is simply the plot of 1+kL(s) . We see that as the gain increases, two of the poles travel towards the right half complex plane, resulting in closed-loop instability.
Figure 8 root-locus plot from command evansSuppose we want to know the maximum gain value before the system becomes unstable. Issue this command
-->[kmax,s]=kpure(L) s = 100.i kmax = 1000.The maximum value of k = 1000 moves the closed-loop poles to the location 100i on the jω axis. The reader should download leadlag2_feedback.zcos and verify that the output oscillates at this gain value. Increasing the gain more should destabilize the system.
Disturbance Attenuation PerformanceIn the exercise at the end of last module, we simulate the situation that the plant output is contaminated by some exogenous signal. For the open-loop case, using an LPF can improve the signal measured by a sensor, but actually does not suppress the effect of that signal on the plant output. Feedback control, on the other hand, can effectively attenuate a disturbance signal, whether it is injected at the input or output of the plant, provided that the controller is properly crafted for the type and spectrum of the disturbance. To experiment with disturbance attenuation, construct an Xcos model like in Figure 9, or download feedback_wdist.zcos.
Figure 9 feedback model with output disturbanceThis is the same lead-lag compensator with some disturbance signal added to the plant output. The disturbance can be selected as a step or sinusoid by means of a toggle switch. The step disturbance is of magnitude 1. The sinusoid disturbance signal has magnitude 0.5 and frequency 1 Hz . Both are set to active at t = 1.5 sec. The simulation results are shown in Figure 10 and 11, for the step and sinusoid disturbance inputs, respectively.
Figure 10 response to step disturbance
Figure 11 response to sinusoid disturbanceFor the case of step disturbance in Figure 10, we see the output is affected at the step time t = 1.5 sec, but is swiftly brought back to the command level of 1 in about 0.2 sec. An open-loop system could not perform such compensation. When the disturbance is a sinusoid signal like in Figure 11, the plant output oscillates with the same frequency as the disturbance, but with magnitude of about 0.2, while the disturbance input magnitude is 0.5. You may try altering the disturbance frequency to see how it affects the response. Is it possible to compute the level of attenuation as a function of frequency? The answer is yes. First we need to discuss another important closed-loop transfer function.
The Sensitivity Transfer FunctionGenerally speaking, the response at any measured point y to an input injected at any point x in the feedback loop is dictated by Tyx, the closed-loop transfer function from x to y. Let’s denote the disturbance signal and plant output by d and y, respectively. So to compute attenuation level for the feedback model in Figure 9, we need to derive the transfer function from the output disturbance to the plant output. With simple block diagram manipulation, it can be shown this transfer function equals
This closed-loop transfer function is well-studied in control literature. It bears a specific name the sensitivity transfer function, and is often denoted by capital letter S; i.e.,
So, to compute S(s) in Figure 8, and display Bode magnitude plot, issue the following commands
-->s=poly(0,'s'); -->P=syslin('c',1/(10*s^2+0.1*s)); -->C=syslin('c',20000*(s+0.01)/(s+100)); -->L = C*P L = 2000 -------- 2 100s + s -->S=1/(1+L) S = 2 100s + s -------------- 2 2000 + 100s + s -->gainplot(S)This yields Figure 12. The phase of sensitivity function has no useful information so no need to plot it. Take a note on the shape of sensitivity frequency system, which always looks more or less like this for a typical system that has nonzero DC gain. Attenuation is good in the low frequency range, then the response goes to 0 dB as frequency increases. We will study how to formulate this curve as control specifications in later module.
Figure 12 Bode magnitude plot of the sensitivity functionAt this point we are just interested on the attenuation level of sinusoid input disturbance in Figure 11. The disturbance frequency is 1 Hz. From the graph we have -10 dB attenuation. Convert this to absolute gain yields the value 0.32. So when the sinusoidal disturbance has magnitude 0.5, the output should swing at magnitude of about 0.16. This conforms to the simulation result in Figure 11.
SummaryIn this study module, we examine some important feedback properties, starting from step response in time-domain, which can be used to tune a commercial controller such as PID, or as specifications for custom control design. The most important property of a feedback system is stability. We show how to determine whether a system is stable by checking the poles of closed-loop transfer function. Root-locus is a technique to observe how pole locations change as controller gain is adjusted. In the last section, we discuss disturbance attenuation performance of a feedback system. In the discussion, we explicitly give definitions for 2 important transfer functions, namely the loop transfer function L(s) in (6), and the sensitivity transfer function in (8). To anticipate the development in later module, we have to mention that (4), often denoted simply as T(s), is referred to as complementary sensitivity transfer function. This is due to the fact that
(9) is called an algebraic constraint. We will see in the next module how this relationship could make feedback system design a challenge.
leadlag_design.sce : a script file for lead-lag compensator design. Also plot frequency responses of L(s), S(s), and T(s).