None Notebook

This notebook contains material from cbe30338-2021; content is available on Github.

< 3.2 Setpoints | Contents | Tag Index | 3.4 Implementing Controllers in Python >

Open in Colab

Download

3.3 Relay Control

3.3.1 Relay Control for the Temperature Control Lab

Relay control is perhaps the simplest form of feedback control that comes to mind for controlling common heaters. This is the on/off control familiar from home thermostats, air conditioners, and other devices where the manipulated variable is in either an "on" state or an "off" state.

The following code implements relay control for temperature T1 on the Temperature Control Lab. At each time step $t_k$, the value of

\begin{align} U_{k} & = \begin{cases} U^{max} &\text{if $T_k \leq T^{SP}_k$}\\ U^{min} & \text{if $T_k \geq T^{SP}_k$} \end{cases} \end{align}

where $ 0\% \leq U_{k} \leq 100\%$ refers to percentage of the maximum heater power, $T_k$ is the measured temperature at time $t_k$, and $T^{SP}_k$ is the temperature setpoint at time $t_k$. Typically $U^{min}$ and $U^{max}$ will be set to 0% and 100%, respectively, but other choices are possible.

Relay control can be implemented as a single line of code in the standard clock-driven loop of the Temperature Control Lab.

3.3.2 Relay Control with Deadzone (Hysteresis) or Deadtime

One of the issues with simple relay control is the potential for 'chattering' where the manipulated variable (in this case heater power) exhibits periods of rapid on-and-off switching. This can be caused by systems that are highly response to control inputs, or where sensor measurements carry significant noise.

There are several simple and highly effective solutions to the problem of chattering.

The control algorithm for relay control with a deadzone extending $d$ above and below the setpoint, a closed form is given by

\begin{align} U_{k} & = \begin{cases} U^{max} &\text{if $T_k \leq T^{SP}_k$} - d\\ U^{min} & \text{if $T_k \geq T^{SP}_k$} + d\\ U_{k-1} & \text{ otherwise} \end{cases} \end{align}

where $d$ is the tolerance or hysteresis.

For home heating systems a typical value is in the range of 0.5 to 1 degree F. This image shows how hystersis was adjusted on a typical home thermostat in common usage in the late 20th century.

Honeywell thermostat open

The furnance is turned on for temperatures below the range

\begin{align} T^{SP} - d \leq T \leq T^{SP} + d \end{align}

and is turned for temperatures above the range. Within the range, however, the furnance may be on or off depending on what happened at the last decision point.

The following code implements relay control with hystersis.


Study Question: Examining the closed-loop responses, it's obvious that the heater is oversized for the purpose of control at 40 deg C. Try other values for $Q^{\max}$ to see if you can improve closed-loop performance.

Study Question: What is the effect of sample time on control performance? What happens if you make the controller sample time longer?

Study Question: In a new cell, create a modification of the script to include a change in setpoint from 40 deg C to 50 deg C at the 300 second mark. Run the experiment for at least 10 minutes to see the full effect.

Study Question: For a relay control with deadzone (also called hysteresis), try to sketch a graph of the manipulated variable $Q$ as a function of the process variable $T$. Assume the setpoint is 50 and $d = 3$. Can you draw a unique function? Why not?


< 3.2 Setpoints | Contents | Tag Index | 3.4 Implementing Controllers in Python >

Open in Colab

Download