So typically there is proportionality and a continuously varying (analogue) output.
Correct. This could be an analog voltage or a digital value.
In the case of a simple process like a domestic gas boiler, the boiler is either fully on or fully off. Or, say a cooling fan that can only be switched on or off to keep something cold.
In these cases, can a PID controller be used at all? There is still an error term. Or would an alternative form of control be necessary?
It certainly could and is in many industrial control systems. Heating, for example, is very often controlled in this way using variable duty-cycle where full power is applied for a varying percentage of a fixed cycle time. This makes the power control system a simple on-off type which can be implemented using relays or SSRs (solid-state relays).
Figure 1. SSRs (solid-state relays) allow rapid switching while allowing varying duty cycle for heating loads. Source: Opto-triacs, solid-state relays (SSR), zero-cross and how they work.
The duty cycle is determined by the the thermal response of the system. A room heating system may have a response time in tens of minutes so a long duty cycle (several minutes) may be appropriate. On the other hand, a heat sealing station for welding plastic films together may have a response time of seconds and a duty cycle of a second or two may be appropriate.
If programming this control in a PLC the standard approach would be to use two timers.
- Timer 1 is the period timer. Let's say it's set to 5 s.
- Timer 2 is the duty cycle timer. If the PID output is 25% then Timer 2's timeout value is set to 5 × 0.25 = 1.25 s.
- The output turns on at the reset of the period timer (Timer 1) and turns off when
the duty cycle timer (Timer 2) reaches its timeout value.
+--|/|--------[T1 5000 ms]--
+--|/|--------[T2 1250 ms]--
| T2 HEAT
Figure 2. Pseudo PLC code.
- T1 runs and when it reaches 5000 ms it is energised, cuts its own feed and resets. The timer starts again.
- T2 resets every time T1 does and its is energised after the duty-cycle delay.
- The heat turns on until the duty-cycle timer is done.
Relays can be used for switching but when the switching period gets down below a minute or so mechanical wear becomes a problem.
SSRs solve the wear problem as they are solid-state and have no moving parts. Zero-cross types also eliminate both audible and electro-mechanical noise from the switching. (All the on periods in Figure 1 start on a zero-cross.)