control//feedback control//control loop//controller//on-off control
On-off control is the simplest control law, which switches the actuator fully on when the measurement is on one side of the setpoint and fully off on the other, and it runs thermostats, fridges, water heaters and tanks filled between two float switches. It needs no model, no tuning and a single comparison, and its result is a measurement that cycles around the setpoint instead of resting on it.
On-off control is the simplest control law, which switches the actuator fully on when the measurement is on one side of the setpoint and fully off on the other, and it runs thermostats, fridges, water heaters and tanks filled between two float switches. It needs no model, no tuning and a single comparison, and its result is a measurement that cycles around the setpoint instead of resting on it.
The naive version fails as soon as the sensor has noise. Near the setpoint the error changes sign tens of times a second, and the relay or contactor chatters until it dies. Hysteresis gives the controller a memory: it switches only when the error leaves a band of width hhh, and inside the band it keeps doing what it was doing.
uk={umaxek>h/20ek<−h/2uk−1otherwiseu_k=\begin{cases}u_{max} & e_k>h/2\\ 0 & e_k<-h/2\\ u_{k-1} & \text{otherwise}\end{cases}uk=⎩⎨⎧umax0uk−1ek>h/2ek<−h/2otherwise
Here uku_kuk is the command at step kkk, umaxu_{max}umax full power and ek=r−yke_k=r-y_kek=r−yk the error; the third line is the memory. The temperature then settles into a limit cycle: it leaves the band at the top, the heater cuts out, it leaves at the bottom, the heater comes back. The swing is somewhat larger than h/2h/2h/2, because the plant keeps heating for a while after each switch (the element is still hot, the heat is still travelling to the sensor), and the period grows with hhh.
The band trades precision against wear.
A narrow band holds the temperature closer and switches more often; a wide one spares the compressor or the contactor and lets the temperature swing more. On-off control with hysteresis is a legitimate design wherever the actuator is truly binary (a compressor, a contactor, a solenoid valve), the process is slow and a few tenths of a degree do not matter.
A slow process lets on-off fake a continuous command. Turning a heater on for a fraction of every one- or two-second cycle (time-proportioning control) lets the thermal mass average the pulses into a steady power; an ESC does the same to a motor's windings with PWM at tens of kilohertz.
It stops where precision or wear start to cost. A PID takes over when the process must sit inside the band, or when every switch wears something expensive; on a drone's attitude, on-off would give a violent oscillation, because attitude moves within milliseconds and nothing slow in the airframe averages the switching (PID controller).
The crudest controller is also an instrument. Replacing a PID by a relay for a minute makes the loop oscillate near its critical frequency with a chosen amplitude, which measures exactly what tuning needs (relay autotuning).
The name bang-bang has a second sense: the time-optimal control of a system with bounded force, which also switches between extremes but at instants computed from a model, a different problem with a different answer (time-optimal control).