I appreciated the reader interest in response to my Develop Your Potential column, “Criteria and procedure for controller tuning,” so I decided a follow-up discussion would be useful. The January article presented a heuristic approach to tuning a standard PID controller from scratch. The steps are: turn off I and D; choose P-on-e, adjust the gain so you can see the beginning of a third oscillation (prior to the system settling) in response to a setpoint change, and set the integral time-constant (and derivative if desired) based on the half period of the oscillation. (See the January issue for details.)
I find the procedure quick, easy, effective and acceptable. It's my appropriation of the Ziegler-Nichols Ultimate method and Auto-Tune Variation (ATV). Both of those classic approaches induce oscillations in a P-only controlled process, and determine tuning values from the oscillation response. Both are robust; however, in my opinion, those classic approaches lead to overly aggressive controllers, and create undesired (or wholly unacceptable) process oscillations during the data-gathering phase.
Often, one does not need to retune from the beginning. Usually, we come across a controller that was once tuned, but because of process changes, it now needs some fine tuning. One can spot an issue as it's revealed by patterns in the manipulated variable (MV, the controller output) and the controlled variable (CV, or process response) with the active controller, and fix the tuning by adjusting the right coefficient without starting from scratch. This article reveals some patterns to observe in undesired oscillations, and how to fine-tune PID controllers for open-loop stable processes.
It's a collection of insight I’ve received from several experts, and I'm very grateful to those who have shared the practical side of process control, especially Harold Wade. Before I met Harold, everywhere I turned for help, I found academic research artifices and obscurities of Laplace-z-Fourier transforms and other delightful mathematical diversions. Such fundamentals are valuable, but it's the simple things that are implementable, and which solve the real problems. Harold’s insight made the concepts practicable and enabling. Consider acquiring his book, Basic and Advanced Regulatory Control: System Design and Applications, third edition, published by ISA. Hopefully, I can pass such insight along to readers.
Essentials of PID
There are three functions in a PID controller. You need to understand their role to fine-tune controllers. Proportional, P, takes immediate action in response to the actuating error, the CV deviation from the setpoint (SP). But, P can't totally remove error. This persisting error is called steady-state (SS) offset. Integral, I, incrementally biases the controller output (MV) to seek to remove SS offset. Although integral is essential to remove SS offset, do not think it's the primary action. I-action must be kept slow because it remembers and tries to correct for long past events. Think of I-action as a helper to P—only there to remove SS offset. P&I join forces to push the CV toward the SP. Derivative, D, puts the brakes on. D overrides the P&I action when D anticipates that the P&I effort, seeking to push the process toward the SP, will actually push the CV beyond the SP in the future. D-action looks at the rate of change of the CV, the derivative, to sense what might happen in the future. D is a good thing, but it's misdirected by noise and adds complexity. Mostly, PI is fully adequate.
In the standard controller, the derivative time multiplies the rate of change of the CV, the integral time divides the integral (the accumulation, the memory) of past actuating errors, and the controller gain multiplies the sum of the actuating error and the I and D values. Note that the controller gain attenuates all three P, I and D actions. However, there are many alternate forms for the PID controller. This discussion is based on the standard version. If your controller is based on an alternate version, you’ll have to adapt the rules. Check what your controller is using. In calculus, the standard version is represented as:
= Κc (e + 1/i edt + d de/dt)
In Laplace notation, it is:
= (1 + 1/is + ds) ê
Notably, this is not an ISA standard. Here, the term “standard” refers to conventional use.
Simplify and pacify
In debugging controllers, first simplify by removing any D-action.
Most commonly, the undesired aspect is oscillations. Undesirable amplitude or persisting oscillations could be due to any number of situations, and patterns in the MV and CV can reveal where the problem is.
The oscillation might be induced from an upstream process or disturbance, which is either oscillating or responding to an on-off or fill-empty action. If so, tuning a downstream controller might temper the impact, but can't eliminate it. Seek to temper the upstream cause with slower response or intermediate inventory capacity.
The following examples are from a simulated PID-controlled flowrate process, representing the frequently encountered category of open-loop stable processes. Integrating processes (such as liquid level), processes dominated by deadtime, or inverse acting processes would have similar but different character and solutions.
Figure 1 shows a PI controller that's too aggressive. The MV is the dotted line and starts at a value of about 0.58 (58%, displayed on the left axis). The SP is the dashed line and makes a change from 0.65 (65%, on the right axis) at a time of 70 (arbitrary units), and the CV (solid line) eventually settles to the setpoint. The first CV overshoot (beyond-shoot is a better term because the CV goes on the other side of the SP) is about four times greater than the second, which might be confused with quarter-amplitude-damped tuning. However, note that the CV average is not at the new SP until after about five oscillations (eyeball an average CV value between any adjacent peaks or valleys in the cycle). Desirably, oscillations disappear after about one to three cycles. And, once the process changes direction after a first full oscillation, the CV should be averaging at the setpoint.
In Figure 1, the controller is too aggressive because the oscillations persist. And yet, the integral action isn't aggressive enough to remove SS offset within a full CV cycle. The problem is that the controller gain is too high, making the P-action too aggressive. A key clue that P-action is causing the oscillations is that the MV and CV are cycling nearly in phase (or nearly out of phase, depending whether the controller is set for reverse action (RA) or direct action (DA)). The peak of one signal corresponds in time to the peak (or valley) of the other. The solution is to reduce the gain.
The period of the CV oscillations is an indication of the time-constant for the process, of how quickly the process can be moved to and fro. I-action should be able to remove the offset within about one full CV cycle. A nominal value for τ_i should be about ¾ of the half-period of the CV. In this case, the CV cycle period is about six time units, the half-period is about three, and a good value for τ_i would be in the two-to-three range. “About” is fully adequate. Perfection is not justified.
For comparison, Wade recommends that τi be within the range 1/2 to 2/3 of the cycle period. This reveals personal preference, and gives permission to a reader to use their own feel.
In Figure 2, the controller also is undesirably aggressive. Note that the CV and MV are cycling about 90° out of phase (the peak of one is between the valley and peak of the other). This indicates that the I-action is too aggressive. Increase the integral time-constant.
Whether the CV appears to lead or lag, MV depends on the controller action (RA or DA). And however it appears, of course, CV must follow the MV. In either the too-aggressive case (Figures 1 or 2), adding D-action (anticipatory action) could temper the oscillations. But a proper solution is not to override bad tuning with D and complicate the controller. Instead, the solution is to reduce either gain or integral action.
If the MV is oscillating but the CV is not (Figure 3), this suggests the derivative time is too large. The MV is the dotted line, and it settles to a value of about 0.5 (50%), while the CV moves toward the SP. Note that settling time is about 10 units (CV reaches SP at a time of about 80, and SP change event was at 70, so the transition time is 80 - 70 = 10). However, the oscillations in the MV have a much smaller period (about 1.25 units). This means that the controller is changing its mind about how to push the process much faster than the process can change. Supporting this, also note that MV oscillations are barely detectable in the CV. If this is the case, reduce the derivative time. Nominally, τd should be about ¼ of the integral time.
Figure 4 reveals an alternate sort of persisting oscillation, one due to stiction. Here, the controller is properly tuned for the process, but the valve temporarily sticks at one position until the pneumatic pressure in the actuator rises enough to make the stem overcome friction and change position. This is similar to deadband in a linkage to a final process influence. Note that MV is the controller output, not the actual valve position. At a time of about 52, the controller told the valve to go to 0.7 (70%). When the valve did, the CV moved to too high a value, so the controller began reducing the MV.
At time 55, the controller said, “Valve go to 0.65.” But, even though the i/p device changed the pneumatic pressure on the actuator, the valve stem was held tight by packing, and the valve didn't change position. So, the CV remained too high, and the controller output dropped until a time of about 65, when it was directing the final control elements to make the valve go to 0.5, the pneumatic forces finally overcame the valve stem friction. Unfortunately, the valve jumped to 0.5, which is too low, and the CV dropped below the SP.
Nonlinearity is a special case
Processes are often nonlinear, and Figure 5 reveals the nonlinear response to two setpoint changes. The first down from 0.65 to 0.55 has the same CV change as the second, back up to 0.65. However, the first moves to a valve position of about 40%, while the second moves to about 60%. The controller is the same. Note that the tuning is relatively aggressive for the first SP change, but relatively sluggish for the second.
If your process is nonlinear, when you're tuning the controller, stay in a local region. Don’t move out of one operating region to another, from one process behavior to another. A nonlinear process may require separate tuning values for each operating range. One can't tune the linear PID controller with one set of coefficient values, and achieve desired performance in both operating ranges. Consider “gain scheduling” as a solution. When the controller moves from one region to another, use values for K_c,τ_i,τ_d that are appropriate for that region. Alternately, tune for the region that's more critical, and accept sluggish or oscillatory behavior for the other region.