# On-off control system

In an industrial plant, a closed-loop control system has the role of keeping a measured physical signal to a predefined value (setpoint). The physical signal, also called controlled variable, can be of any kind, electrical (voltage, current, power), mechanical (position, speed, force, torque), hydraulic (pressure, flow) or thermal (temperature). The difference between the controlled variable (measured) and the predefined value is called error.

The input of the controller is the error and the controller output is an actuation signal which is send to an actuator. The controlled variable is further measured with a sensor and the information is feed back to the controller.

Image: Closed-loop (feedback) control system

The difference between the setpoint and the plant output (measured) occurs because of the disturbances which affect the plant (process). The role of the controller is to reject these disturbances and keep the plant output (controlled variable) to the predefined value (setpoint).

The ways in which the controller reacts to the error are called control laws or control modes. In industrial applications there are several control laws used, most of them being on-off control, PID control or other more advanced laws (fuzzy, neuro-fuzzy, optimal, etc.).

The on-off control is the simplest form of a controller, which switches ON when the error is positive and switches OFF when the error is zero or negative. An on-off controller doesn’t have intermediate states but only fully ON or fully OFF states. Due to the switching logic, an on-off controller is often called a bang-bang controller or a two-step controller.

Regardless of the size of the error, the output of the on-off controller can only be fully ON or fully OFF, it is not proportional with the error.

Let’s take as example the temperature control of an industrial oven. The temperature inside the oven is measured with a sensor and feed back to the controller. Based on the error (difference between setpoint temperature and measured temperature), the heating elements are turned ON or OFF by the controller. There are no intermediate values of the heating element, they are fully ON or fully OFF.

Image: Industrial oven on-off control

If we compare this system with the generic closed-loop system explained above, we can identify the following elements:

• controller: switch
• plant: oven
• feedback (measured output): temperature

The industrial oven has two important characteristics which need to be explained, because they affect the response of the controller:

• capacitance (inertia)

In most of the control systems with feedback loop, the system can not respond instantly to any disturbance and it takes time (delay) until the controller output has any effect on the measured (plant) output. This time delay is know as dead time. In the case of the industrial oven, if the access door is opened, it takes time until the temperature drops, the controller senses the difference, turns the heaters on and the temperature is brought back to setpoint. Dead time has the effect of hiding the disturbance from the controller and limits its ability to react quickly.

The capacitance of a system is seen as the resistance to changing inputs. The higher the capacitance of a system, the longer the time it takes to react to changes. With the oven cold, even if turning the heaters on, takes time for the temperature to start increasing and reach the nominal value. The advantage is that capacitance has the tendency to filter (dampen) out the effect of disturbances on a system.

In the theory of control systems, the industrial oven is defined as a first order process with dead time. The transfer function of a first order process with dead time is:

$H(s) = \frac{K}{T \cdot s + 1} \cdot e^{- \tau \cdot s} \tag{1}$

where:

K – gain
T – time constant

The time constant is a measure of the capacitance of the system. The higher the time constant, the longer it takes for the system to react to changing inputs or disturbances.

If an on-off controller is set to control a first order process with dead time, the output of the controller and the plant (controlled variable / temperature) will have the following behaviour.

Image: On-off control example

Let’s assume that the setpoint temperature of the oven is 120 °C and the initial temperature is 0 °C. The dead time of the oven is 30 s.

When activated, the controller will sense the temperature difference via the temperature feedback and switch ON (1) the heating elements. Due to the dead time, only after 30 s, since the heating elements have been turned on, we can notice a rise in temperature. The rise in temperature is not abrupt but slow and it takes around 300 s until the temperature reaches the setpoint value. When the temperature is higher than 120°C, the controller switches OFF (0) the heating elements. Since the heating elements are still hot, the temperature will continue to rise for a short time, followed by a decrease. When the temperature goes below 120°C the on-off controller switches ON the heating elements. Since it takes time for the heating elements to reach nominal temperature, the temperature in the oven will still decrease for a short time, followed by an increase.

As you can see, the on-off controller can not keep a steady temperature in the oven but always goes above and below the setpoint. This cycling around the setpoint value is called “hunting“.

Image: On-off control output

The response of an on-off controller can be summarised as in the image above. When the error is positive, the controller is switched ON. When the error is zero or negative, the controller output is set to OFF.

Example 1. Implement an on-off controller for an industrial oven temperature control system with the following parameters:

• open loop response of the oven at step input: 180 °C
• time constant of the oven: 240 s
• dead time of the process: 30 s

which will control the temperature for a setpoint of 120°C.

From the input parameters, we can write the transfer function of the plant as:

$H(s) = \frac{180}{240 \cdot s + 1} \cdot e^{- 30 \cdot s} \tag{2}$

In Xcos, the plant can be modelled as a first order Transfer Function with a Continuous fix delay:

Image: Plant model (industrial oven)

The on-off controller can be modelled in Xcos with a Dynamic Switch, which can output 1 (ON) or 0 (OFF) function of the sign of the temperature error.

Image: On-off controller Xcos block diagram

The setpoint is defined as a Constant block. The error is calculated as the difference between the setpoint and the current value of the temperature (plant output). Both the plant model and on-off controller are grouped together under User Defined Function blocks.

Image: On-off control Xcos block diagram

The simulation is run for 1000 s. The controller output and the plant output are plotted in the image below.

Image: On-off control Xcos plot

We can see how the on-off controller is switching the output from ON to OFF around the setpoint value. The constant switching, with high frequency around the setpoint, can lead to stress on the actuators and potential failure. For this reason, most of the on-off controlles have an integrated hysteresis.

The on-off controller with hysteresis will not switch around the setpoint but between an upper and a lower limit. This way, the frequency of the switching will decrease but the variation (overshoot) around the setpoint will increase.

Image: On-off control with hysteresis output

The error is not anymore compared against zero but against a hysteresis value. The higher the hysteresis value, the lower the switching frequency and the higher the overshoot.

For our particular example, if the oven temperature is set to 120 °C and the hysteresis to 20 °C, the on-off controller will switch OFF when the temperature is higher than 130 °C and switch ON when it is less than 110 °C.

Example 2. For the same plant defined in Example 1, design an on-off controller with a hysteresis of 20 °C.

For this example, as a on-off controller, we are going to use a Xcos standard Hysteresis block, with the following parameters:

• switch on at: 10
• switch off at: -10
• output when on: 1
• output when off: 0

Image: On-off hysteresis control Xcos block diagram

The simulation is run for 1000 s. The controller output and the plant output are plotted in the image below.

Image: On-off hysteresis control Xcos plot

The controller switching frequency has decreased but the variation of the temperature (overshoot) around the setpoint has increased. In practice, for a particular application, the hysteresis is set in order to get the best compromise between switching frequency and overshoot.

Instead of a hysteresis, an on-off controller can also have a dead band. The dead band represents the lower and upper limits of the error between which the controller doesn’t react. In this case the controller will have three states.

Image: On-off control with deadband output

As an application we can imagine an electric motor which needs to position roughly a component between some limits. The on-off controller will rotate the motor forward (FWD), backward (BWD) or wait (IDLE). If the position of the component is between the dead band, the controller will be in IDLE state.

The main advantages of on-off controllers are: simplicity, inexpensive and digital output (only two states). The main disadvantages are: the controlled parameter will continuously switch around the setpoint and if the hysteresis is not correctly set, the deviation from the setpoint could be quite significant.

On-off control is primarily used in non critical applications, where the error between the setpoint and plant output can vary with a relatively large amount. For example, temperature control systems for houses (heating and cooling), freezers and other home appliances are using on-off control.

How an on-off controller works it’s important because it lays the foundations for more complicated controllers. Understanding what are the disadvantages of a simple controller helps in the design phase of a more advanced controller.