 The basics of control system design: Part 5 - Tuning a PID Controller - Embedded.com

# The basics of control system design: Part 5 – Tuning a PID Controller

The PID controller addsdifferential gain to the PI controller. The most common use ofdifferential gain is adding it in parallel with the PI controller shownin 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, thedifferential and integral gains will be in line with the proportionalgain; note that many controllers place all three gains in parallel.  Figure6-17. Experiment 6D, a PID controller.

A PID controller is a two-zone controller. The P and D gains jointlyform the higher frequency zone. The I gain forms the low-frequencyzone. The benefit of the D gain is that it allows the P gain to be sethigher 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%), understandingthat the D gain will cure the problem.  Figure6-18. Tuning a PID controller.

Typically, the P gain can be raised 25%-50% over the value from theP and PI controllers. The next step is to add a little D gain to curethe overshoot induced by the higher-than-normal P gain. The P and Dgains together form the high-frequency zone.

Next, the integral gain is tuned, much as it was in the PIcontroller. The expectation is that the P and I gains will be about20-40% higher than they were in the PI controller.

In addition to Figure 6-17 earlier, the results of the tuningprocedure illustrated are in Figure 6-18 above are graphed in Figure 6-19 and Figure 6-20 below .  Figure6-19. Closed-loop Bode plot of PID controller (359-Hz bandwidth, 1.0dBpeaking).  Figure6-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 toincrease to 120, about 20% more than the PI. However, the PIDcontroller overshoots no more than the PI controller.

The closed-loop Bode plot of Figure6-19 above shows a dramatic increase in bandwidth; the PIDcontroller provides 359 Hz, about 70% more than the 210 Hz provided byPI (Figure 6-7 in Part 2 ).

Notice, though, that the phase lag of the closed-loop system is170°, which is about 45° more than the PI. That makes this PIDsystem more difficult to control as an inner loop than the PIcontroller would be.

More phase lag at the bandwidth means an outside loop (such as aposition loop surrounding this PID velocity controller) would have todeal with greater lag within its loop and thus have more stabilityproblems.

The open-loop plot of the PID controller in Figure 6-20 above shows a PM of55°, about the same as the PI controller. However, the GM is about8.5 dB, 3 dB less than the PI controller. Less GM is expected becausethe high-frequency zone of the PID controller is so much higher thanthat of the PI controller, as evidenced by the higher bandwidth.

Reduced GM is a concern because the gains of plants often changeduring normal operation. This is of particular concern in systems wherethe gain can increase, such as saturation of an inductor (which lowersthe inductance) in a current controller, declining inertia in a motionsystem, or declining thermal mass in a temperature controller; theseeffects all raise the gain of the plant and chip away at the GM.

Given the same plant and power converter, a PID controller willprovide faster response than a PI controller but will often be harderto 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 useof a differential gain. The gain of a true derivative increases withoutbound as the frequency increases. In most working systems, a low-passfilter is placed in series with the derivative to limit gain at thehighest frequencies.

If the noise content of the feedback or command signals is high, thebest cure is to reduce the noise at its source. Beyond that, loweringthe frequency of the derivative's low-pass filter will help, but itwill also limit the effectiveness of the D gain.

Noise can also be reduced by reducing the differential gaindirectly, but this is usually a poorer alternative than lowering thelow-pass filter frequency. If the signal is too noisy, the D gain mayneed to be abandoned altogether.  Table6-1. Settings for P, I, and D gains according to the Ziegler-Nicholsmethod

The Ziegler-Nichols Method
A popular method for tuning P, PI, and PID controllers is theZiegler-Nichols method. This method starts by zeroing the integral anddifferential gains and then raising the proportional gain until thesystem is unstable. The value of Kp at the point of instability iscalled KMAX ; the frequency of oscillation is fo .

The method then backs off the proportional gain a predeterminedamount 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 andphase crossover frequency, there is no need to raise the gain all theway to instability. Instead, raise the gain until the system is nearinstability, 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), KMAxwould be 2 plus 12 dB, or 2 times 4, or 8. Use the phase crossoverfrequency for fo. A flowchart for the Ziegler-Nichols method is shown in Figure 6-21 below.  Figure6-21. Ziegler-Nichols method for tuning P, PI, and PID controllers.

Note that the form shown here assumes Kp is in series with KI andKD. For cases where the three paths are in parallel, be sure to add afactor of Kp to the formulas for KI and KD in Table 6-1 and Figure6-21.

Note, also, that these formulas make no assumption about the unitsof 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 isnot the case for industrial controllers. Finally, the Ziegler-Nicholsmethod 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 industrialcontrol systems. For example, for a proportional controller, the methodspecifies a GM of just 6 dB, compared with the 12 dB in the Pcontroller tuned earlier in this chapter (Figure 6-5 in Part 2 ).

In general, the gains from Ziegler-Nichols will be higher than fromthe methods presented here. Table 6-2below shows a comparison of tuning the P, PI, and PIDcontrollers according to the method describe in this series and to theZiegler-Nichols method. (The terms KMAX = 4.8 and fo = 311 Hz werefound experimentally.) Both sets of gains are stable, but theZiegler-Nichols method provides smaller stability margins.  Table6-2. Comparison of results from tuning method and the Ziegler-Nicholsmethod

Popular Terminology for PIDControl
Often PID controllers involve terminology that is unique withincontrols. 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 resetand the differential gain is called rate. The condition where the erroris large enough to saturate the loop and continue ramping up theintegral is called reset windup.

Synchronization, the process of controlling the integral duringsaturation, is called antireset wind-up. You can get more informationfrom PID controller manufacturers, such as the FoxboroCompany.  Figure6-22. Lead-lag schematic.

AnalogAlternative to PID: Lead-LagPID presents difficulties for analog circuits, especially since extraop-amps may be required for discrete differentiation. The lead-lagcircuit of Figure 6-22 above provides performance similar to that of a PID controller but does sowith a single op-amp.

The differentiation is performed only on the feedback with thecapacitor CA. The resistor, RA, forms a low-pass filter on thederivative with break frequency of RA x CA/27E Hz. Because thedifferential gain is only in the feedback path, it does not operate onthe command; this eliminates some of the overshoot generated by a fastchanging command.

Tuning a lead-lag circuit is difficult because the tuning gains arecoupled. For example, raising CA increases the effective differentialgain but also increases the proportional gain; the derivative from CAis integrated through CL to form a proportional term, although the mainproportional term is the signal that flows through RF to RL.

Lead-lag is often not used in digital controls because numericalnoise caused by the lead circuit (here, RA and CA) is fed to theintegral (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 digitaldesigners to a larger extent than is practical in analog lead circuits.For example, multiple digital lead circuits can be placed in series toadvance the phase of the feedback to increase the phase margin; this isusually impractical in analog circuits because of noise considerations.  Figure6.23. Alternative controller 4, a lead-lag controller.

Tuning a lead-lag controller (Figure6-23 above ) is similar to tuning a PID controller. Set RA as lowas possible without generating excessive noise. Often, RA will belimited to a minimum value based on experience with noise; a typicalvalue might be RA >_ RF/3.

When tuning, start with a proportional controller: short CL and openCA, raise RL until the system just overshoots, and then raise it,perhaps 30% (how much depends on RA, because lower RA will allow CA tocancel more overshoot from RL).

Start with low CA and raise it to cancel overshoot. Then set CL to ahigh value and reduce it to provide a predetermined amount ofovershoot.

Next in Part 6: Tuning a PID+controller
To read Part 1, go to “Moving beyond PID
To read Part 2, go to “Howto tune a Proportional Controller.”
To read Part 3, go to “How to tune a PIcontroller
To read Part 4, go to “Tuning a Pl+Controller.

(Editor's Note: Experiments 6A-6F
All the examples in this series ofarticles were run on Visual Mode1Q. Each of the sixexperiments, 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 experimentingwith an analog controller, set the sample time to 0.0001 second, whichis so much faster than the power converter that the power converterdominates the system, causing it to behave like an analog controller.

The default gains reproduce the resultsshown in this series, but you can go further. Change the powerconverter bandwidth and investigate the effect on the differentcontrollers.

Assume noise is a problem, reducethe low-pass filter on the D gain (fD), and observe how this reducesthe benefit available from the derivative-based controllers (PID, PID+,and PD). Adjust the power converter bandwidth and the sample time, andobserve the results. )

This series of articles was excerptedfrom ControlSystem Design Guide by George Ellis with the permission of thepublisher – Elsevier/Academic Books – and can be purchased online whichretains all copyrights.

George Ellis is senior scientistat Danaher Motion. He hasdesigned and applied motion control systems for over 20 years and haswritten for Machine Control Magazine, Control Engineering, MotionSystems Design, Power Control and Intelligent Motion, EDN Magazine. Inaddition to Control System Design Guide, he is also the author ofObservers in Control Systems (Academic Press).

## 1 thought on “The basics of control system design: Part 5 – Tuning a PID Controller”

1. edu says:

“hello, would you help me understand:nwhy in open loop bode plot, curve can be affected by the velocity loop Kp ?ni thought that open loop cannot use PID gain?? nthank you”