Catto / Topic Map · Industrial Electronics II Year 7
Industrial Electronics II · 120 h · Topic 8 of 8

PID controllers

Three actions that look at the error in three different ways: the proportional action looks at how much error there is right now, the integral at how much error has built up, and the derivative at where it is heading. These three control the vast majority of industrial processes.

P I D Tuning Ziegler-Nichols Anti wind-up

01The three actions

setpointvariabletimeerrorP onlySteady-state error remains: the system settles where the residual error produces just the actionthat offsets the losses.PIThe integral action removes the steady-state error, but overshoot appears and settling takes longer.PIDThe derivative action damps and speeds up: less overshoot and a faster approach to the setpoint.P does most of the work, I removes the steady-state error and D damps. In noisy processes D is set to zero.
Figure 1. Step response, animated. With P alone a steady-state error remains; adding I makes that error disappear but overshoot appears; D damps and speeds up the settling.
u(t)=Kp[e(t)+1Ti∫edt+Tddedt] e is the error, the difference between the setpoint and the measurement. Ti is the integral time and Td the derivative time, both in seconds.
ActionWhat it doesIf overdone
PCorrects in proportion to the current error. It is the main action: the one that does most of the work.Sustained oscillation; the system becomes unstable.
IAccumulates the error over time and keeps acting as long as any is left. It is the only action that eliminates steady-state error.Sluggishness, large overshoot and long-period oscillations.
DReacts to the rate of change of the error: it anticipates and damps. It lets you raise P without oscillation.Amplifies measurement noise and produces abrupt jumps in the output.
Why P alone leaves a steady-state error

Because the output is proportional to the error: if the error were zero, the output would be zero, and then the furnace would not heat at all. The system settles exactly at the point where the residual error produces just the power that offsets the losses. The higher the gain, the smaller that error, but also the closer to oscillation.

Integral action solves that: as long as any error remains, it keeps summing and raising the output, however tiny the error. That is why any control that must reach the setpoint exactly needs I.

02Tuning

setpointLow KpKp = 1.0Slow, safe response: it takes a long time to get there, but does not oscillate.Suitable KpKp = 2.4Gets there quickly with a small overshoot and settles in a few cycles.TuCritical KpKp = 4.0Sustained oscillation that does not damp out: this is the critical gain Ku, and its period is Tu.Ziegler-Nichols starts from there: with Ku and Tu measured, a PID comes out as Kp = 0.6 Ku, Ti = Tu/2 and Td = Tu/8.It is an aggressive starting point: if the process cannot tolerate overshoot, lower Kp and lengthen Ti.
Figure 2. Effect of the gain, animated. With a low Kp the response is slow but safe; raising it speeds things up; past the critical point, the system oscillates without damping and no longer controls anything.
Ziegler-Nichols in closed loop
  1. Disable I and D: proportional action only.
  2. Raise Kp gradually until the system oscillates with constant amplitude. That gain is the critical gain, Ku, and the period of that oscillation is Tu.
  3. Apply the table and then fine-tune by hand according to the result.
ControllerKpTiTd
P0.50 · Ku——
PI0.45 · KuTu/1.2—
PID0.60 · KuTu/2Tu/8
Worked example · Tuning a furnace

With proportional action only, the furnace starts to oscillate steadily at Ku = 4.0 and a period of Tu = 20 s.

  • PI: Kp = 0.45 × 4.0 = 1.8; Ti = 20/1.2 = 16.7 s.
  • PID: Kp = 0.60 × 4.0 = 2.4; Ti = 20/2 = 10 s; Td = 20/8 = 2.5 s.

These values are a starting point, not a final result: Ziegler-Nichols aims for a fairly aggressive response, with overshoot on the order of 25%. If the process cannot tolerate that —a vat of product, for example— lower Kp and lengthen Ti until you get a smooth response.

Manual tuning, which is what is used on the plant floor
  1. P only. Raise Kp until a slight oscillation appears, and then cut it back to half.
  2. Add I: shorten Ti until the steady-state error disappears in a reasonable time. If slow oscillations appear, lengthen it.
  3. Add D only if damping is needed, and with small values. In processes with a noisy measurement —flow, pressure— it is often left at zero: most industrial loops are PI.
  4. Check with a real disturbance, not just a setpoint change.

03The PID inside the PLC

AspectWhat has to be solved
Sampling timeThe block must run at fixed intervals, in a periodic task. As a rule, 5 to 20 times faster than the process time constant.
ScalingInput and output in engineering units or in percent, not in converter counts. Changing the transmitter range should not force you to retune.
Output limitsThe output is clamped to the actuator's real range: 0 to 100%, or the minimum the valve needs so as not to close completely.
Anti wind-upFreeze the integrator when the output is saturated. Without this, the PID pointlessly accumulates error and then takes a very long time to recover.
Manual and automaticWith bumpless transfer: when switching to automatic, the PID starts from the output the manual mode had.
Direct or reverse actionHeating and cooling require opposite signs. Getting it wrong produces a loop that runs to the extreme immediately.
Integrator saturation

It is the most common failure of a poorly implemented PID. If the process cannot reach the setpoint —the heating element is burnt out, the valve is closed, the lid is open— the error persists and the integrator keeps accumulating long after the output is already at 100%. When the situation returns to normal, the controller holds the output at maximum for minutes until it discharges everything it accumulated, and the process overshoots the setpoint by a wide margin.

It is solved by freezing the integrator while the output is saturated. The PID blocks of modern PLCs already do this; home-made ones almost never do.

04When to use PID and when not to

On-off, with hysteresis

Switches on when the variable falls below one limit and off when it exceeds another. Simple, cheap and sufficient when the process has a lot of inertia and a wide tolerance band: a room thermostat, a tank level, a refrigerator.

Hysteresis is not a defect: it is what keeps the actuator from switching a hundred times a minute. In exchange, the variable always oscillates within the band.

PID

When you need to hold the variable at the setpoint and not around it, when the actuator allows continuous regulation —proportional valve, drive, phase-angle power control— and when disturbances are frequent.

If the actuator is a contactor that can only open and close, a pure PID makes no sense: it is combined with slow pulse-width modulation, switching on a fraction of the time of each cycle.

Before tuning, check the process

No PID adjustment compensates for a badly placed sensor, an oversized valve that works always at 5% of its travel, an enormous transport delay or a noisy measurement. When a loop “won't let itself be tuned,” the problem is almost never in the parameters: it is in the process or in the instrumentation. That is where to look first.

05In the lab

Lab 1 · Seeing the three actions

On a teaching temperature or level plant, apply a setpoint step and record the response with P only, with PI and with PID. In each case measure steady-state error, overshoot and settling time, and put together a comparison table.

Lab 2 · Ziegler-Nichols

Determine Ku and Tu experimentally, calculate the parameters with the table and apply them. Record the response and compare it with that of manual tuning. Discuss which is preferable depending on what the process tolerates.

Lab 3 · Provoking integrator saturation

Set an unreachable setpoint —for example with the lid open— for several minutes, and then close it. Observe how long the controller takes to recover and how far it overshoots. Enable anti wind-up and repeat: the difference is remarkable.

Lab 4 · Disturbance rejection

With the loop stable at the setpoint, introduce a real disturbance: open a leak, add cold load, change the flow. Measure how far the variable deviates and how long it takes to return. It is the test that truly tells you whether the tuning is any good.

06Common mistakes

SymptomUsual cause
A steady-state error remainsIntegral action is missing, or Ti is too long.
Fast, sustained oscillationKp too high.
Slow, long-period oscillationIntegral action too strong: Ti too short.
The output jumps abruptlyDerivative action on a noisy measurement. Filter it or disable D.
Huge overshoot after a long stopIntegrator saturation without anti wind-up.
Jump in the output when switching from manual to automaticTransfer without initialization from the manual value.
The loop runs to the extreme as soon as it is enabledWrong direct or reverse action.
The PID cannot be tuned no matter whatBadly placed sensor, oversized valve or large transport delay: the problem is in the process.

07Self-assessment

What does each of the three actions look at?

P looks at the current error, I at the accumulated error and D at the rate at which the error is changing.

Why does a proportional-only control leave a steady-state error?

Because its output is proportional to the error: if the error were zero, the output would be too, and the process would receive no action. It settles where the residual error produces just the action that offsets the losses.

Which action eliminates the steady-state error?

The integral: as long as any error remains, it keeps accumulating and changing the output, however small it is.

With Ku = 6 and Tu = 12 s, what parameters does Ziegler-Nichols give for a PID?

Kp = 0.6 × 6 = 3.6; Ti = 12/2 = 6 s; Td = 12/8 = 1.5 s.

Why is D set to zero in many industrial loops?

Because it amplifies measurement noise and produces abrupt jumps in the output. In flow and pressure, which are noisy measurements, most loops are PI.

What is integrator saturation and how is it avoided?

The accumulation of error while the output is already at maximum and the process cannot respond. It is avoided by freezing the integrator when the output is saturated.

What is bumpless transfer?

When switching from manual to automatic, the PID starts from the output the manual mode had, so the variable does not jump.

How often must the PID block run?

At fixed intervals, in a periodic task, 5 to 20 times faster than the process time constant.

When is on-off control enough?

When the process has a lot of inertia and the variable is allowed to oscillate within a band, and when the actuator can only open and close.

A loop cannot be tuned no matter what. What do you check?

The process and the instrumentation: sensor location, valve sizing, transport delay and measurement noise. It is almost never a matter of parameters.

Development of the topic “PID controllers” of Industrial Electronics II (Year 7), based on the “Curriculum Proposal – Second Cycle of the Technical-Vocational Track, Secondary Education – Electronics,” Ministry of Education of the Province of Córdoba, DGETyFP. Back to the Topic Map · catto.ar