The basics of control system design: Part 5 - Tuning a PID Controller
The PID controller adds differential gain to the PI controller. The most common use of differential gain is adding it in parallel with the PI controller shown in Figure 6-17 below.
Here, a low-pass filter with a break frequency (2000 Hz by default) is added to the derivative path. As with the PI controller, the differential and integral gains will be in line with the proportional gain; note that many controllers place all three gains in parallel.
|Figure 6-17. Experiment 6D, a PID controller.|
A PID controller is a two-zone controller. The P and D gains jointly form the higher frequency zone. The I gain forms the low-frequency zone. The benefit of the D gain is that it allows the P gain to be set higher than it could be otherwise.
As shown in Figure 6-18 below, the first step is to tune the controller as if it were a P controller, but to allow more overshoot than normal (perhaps 10%), understanding that the D gain will cure the problem.
|Figure 6-18. Tuning a PID controller.|
Typically, the P gain can be raised 25%-50% over the value from the P and PI controllers. The next step is to add a little D gain to cure the overshoot induced by the higher-than-normal P gain. The P and D gains together form the high-frequency zone.
Next, the integral gain is tuned, much as it was in the PI controller. The expectation is that the P and I gains will be about 20-40% higher than they were in the PI controller.
In addition to Figure 6-17 earlier, the results of the tuning procedure illustrated are in Figure 6-18 above are graphed in Figure 6-19 and Figure 6-20 below.
|Figure 6-19. Closed-loop Bode plot of PID controller (359-Hz bandwidth, 1.0dB peaking).|
|Figure 6-20. PID controller open loop (55° PM, 8.5 dB GM).|
The PID controller allowed the proportional gain to increase to 1.7, about 40% more than in the PI controller (Figure 6-5 in Part 2), and the integral gain to increase to 120, about 20% more than the PI. However, the PID controller overshoots no more than the PI controller.
The closed-loop Bode plot of Figure 6-19 above shows a dramatic increase in bandwidth; the PID controller provides 359 Hz, about 70% more than the 210 Hz provided by PI (Figure 6-7 in Part 2).
Notice, though, that the phase lag of the closed-loop system is 170°, which is about 45° more than the PI. That makes this PID system more difficult to control as an inner loop than the PI controller would be.
More phase lag at the bandwidth means an outside loop (such as a position loop surrounding this PID velocity controller) would have to deal with greater lag within its loop and thus have more stability problems.
The open-loop plot of the PID controller in Figure 6-20 above shows a PM of 55°, about the same as the PI controller. However, the GM is about 8.5 dB, 3 dB less than the PI controller. Less GM is expected because the high-frequency zone of the PID controller is so much higher than that of the PI controller, as evidenced by the higher bandwidth.
Reduced GM is a concern because the gains of plants often change during normal operation. This is of particular concern in systems where the gain can increase, such as saturation of an inductor (which lowers the inductance) in a current controller, declining inertia in a motion system, or declining thermal mass in a temperature controller; these effects all raise the gain of the plant and chip away at the GM.
Given the same plant and power converter, a PID controller will provide faster response than a PI controller but will often be harder to control and more sensitive to changes in the plant.
Noise and the Differential Gain
The problems with noise in the PI controller are exacerbated by the use of a differential gain. The gain of a true derivative increases without bound as the frequency increases. In most working systems, a low-pass filter is placed in series with the derivative to limit gain at the highest frequencies.
If the noise content of the feedback or command signals is high, the best cure is to reduce the noise at its source. Beyond that, lowering the frequency of the derivative's low-pass filter will help, but it will also limit the effectiveness of the D gain.
Noise can also be reduced by reducing the differential gain directly, but this is usually a poorer alternative than lowering the low-pass filter frequency. If the signal is too noisy, the D gain may need to be abandoned altogether.
|Table 6-1. Settings for P, I, and D gains according to the Ziegler-Nichols method|
The Ziegler-Nichols Method
A popular method for tuning P, PI, and PID controllers is the Ziegler-Nichols method. This method starts by zeroing the integral and differential gains and then raising the proportional gain until the system is unstable. The value of Kp at the point of instability is called KMAX; the frequency of oscillation is fo.
The method then backs off the proportional gain a predetermined amount and sets the integral and differential gains as a function of fo. The P, I, and D gains are set according to Table 6-1 above.
If a dynamic signal analyzer is available to measure the GM and phase crossover frequency, there is no need to raise the gain all the way to instability. Instead, raise the gain until the system is near instability, measure the GM, and add the GM to the gain.
For example, if a gain of 2 had a GM of 12 dB (a factor of 4), KMAx would be 2 plus 12 dB, or 2 times 4, or 8. Use the phase crossover frequency for fo. A flowchart for the Ziegler-Nichols method is shown in Figure 6-21 below.
|Figure 6-21. Ziegler-Nichols method for tuning P, PI, and PID controllers.|
Note that the form shown here assumes Kp is in series with KI and KD. For cases where the three paths are in parallel, be sure to add a factor of Kp to the formulas for KI and KD in Table 6-1 and Figure 6-21.
Note, also, that these formulas make no assumption about the units of Kp, but KI and KD must be in SI units (rad/sec and sec/rad, respectively). This is the case for the experimental model but often is not the case for industrial controllers. Finally, the Ziegler-Nichols method is frequently shown using To, the period of oscillation when Kp = KMAx; of course, To = 1/fp.
The Ziegler-Nichols method is too aggressive for many industrial control systems. For example, for a proportional controller, the method specifies a GM of just 6 dB, compared with the 12 dB in the P controller tuned earlier in this chapter (Figure 6-5 in Part 2).
In general, the gains from Ziegler-Nichols will be higher than from the methods presented here. Table 6-2 below shows a comparison of tuning the P, PI, and PID controllers according to the method describe in this series and to the Ziegler-Nichols method. (The terms KMAX = 4.8 and fo = 311 Hz were found experimentally.) Both sets of gains are stable, but the Ziegler-Nichols method provides smaller stability margins.
|Table 6-2. Comparison of results from tuning method and the Ziegler-Nichols method|
Popular Terminology for PID
Often PID controllers involve terminology that is unique within controls. The three gains, proportional, integral, and differential, are called modes and PID is referred to as three-mode control.
Error is sometimes called offset. The integral gain is called reset and the differential gain is called rate. The condition where the error is large enough to saturate the loop and continue ramping up the integral is called reset windup.
Synchronization, the process of controlling the integral during saturation, is called antireset wind-up. You can get more information from PID controller manufacturers, such as the Foxboro Company.
|Figure 6-22. Lead-lag schematic.|
Analog Alternative to PID: Lead-Lag PID presents difficulties for analog circuits, especially since extra op-amps may be required for discrete differentiation. The lead-lag circuit of Figure 6-22 above provides performance similar to that of a PID controller but does so with a single op-amp.
The differentiation is performed only on the feedback with the capacitor CA. The resistor, RA, forms a low-pass filter on the derivative with break frequency of RA x CA/27E Hz. Because the differential gain is only in the feedback path, it does not operate on the command; this eliminates some of the overshoot generated by a fast changing command.
Tuning a lead-lag circuit is difficult because the tuning gains are coupled. For example, raising CA increases the effective differential gain but also increases the proportional gain; the derivative from CA is integrated through CL to form a proportional term, although the main proportional term is the signal that flows through RF to RL.
Lead-lag is often not used in digital controls because numerical noise caused by the lead circuit (here, RA and CA) is fed to the integral (here, CL); such noise can induce DC drift in digital systems, which could be avoided with the standard PID controller.
On the other hand, lead circuits are sometimes used by digital designers to a larger extent than is practical in analog lead circuits. For example, multiple digital lead circuits can be placed in series to advance the phase of the feedback to increase the phase margin; this is usually impractical in analog circuits because of noise considerations.
|Figure 6.23. Alternative controller 4, a lead-lag controller.|
Tuning a lead-lag controller (Figure 6-23 above) is similar to tuning a PID controller. Set RA as low as possible without generating excessive noise. Often, RA will be limited to a minimum value based on experience with noise; a typical value might be RA >_ RF/3.
When tuning, start with a proportional controller: short CL and open CA, raise RL until the system just overshoots, and then raise it, perhaps 30% (how much depends on RA, because lower RA will allow CA to cancel more overshoot from RL).
Start with low CA and raise it to cancel overshoot. Then set CL to a high value and reduce it to provide a predetermined amount of overshoot.
Next in Part 6: Tuning a PID+
To read Part 1, go to "Moving beyond PID"
To read Part 2, go to "How to tune a Proportional Controller."
To read Part 3, go to "How to tune a PI controller"
To read Part 4, go to "Tuning a Pl+ Controller."
(Editor's Note: Experiments 6A-6F
All the examples in this series of articles were run on Visual Mode1Q. Each of the six experiments, 6A-6F, models one of the six methods, P, PI, PI+, PID, PID+, and PD, respectively.
These are models of digital systems, with sample frequency defaulting to 2 kHz. If you prefer experimenting with an analog controller, set the sample time to 0.0001 second, which is so much faster than the power converter that the power converter dominates the system, causing it to behave like an analog controller.
The default gains reproduce the results shown in this series, but you can go further. Change the power converter bandwidth and investigate the effect on the different controllers.
Assume noise is a problem, reduce
the low-pass filter on the D gain (fD), and observe how this reduces
the benefit available from the derivative-based controllers (PID, PID+,
and PD). Adjust the power converter bandwidth and the sample time, and
observe the results. )
George Ellis is senior scientist at Danaher Motion. He has designed and applied motion control systems for over 20 years and has written for Machine Control Magazine, Control Engineering, Motion Systems Design, Power Control and Intelligent Motion, EDN Magazine. In addition to Control System Design Guide, he is also the author of Observers in Control Systems (Academic Press).