The process to control
The model in Simulink
The control task
A simple ON-OFF-controller
Standard control block diagram
First we have to define a process to control. Here we look at a heating system for a normal living house. The control task is to control the heat output from the radiator until the room temperature is close to comfort temperature, i.e. +20°C - whatever might happen to heat losses and heat input from sun shine through windows etc.
The components in the system:
Figure 1a: Room temperature control model
In this figure:
SP = "Set Point" for the temperature, +20°C
PV = "Proces Variable" measured
e = "error" = SP-PV
TT = Temperature sensor and transmitter
TC = Temperature controller
The function is as follows: The temperature sensor measures the temperature in the room. Send the temperature to the controller (TC). The controller sends the control value, u, to the valve. The valve controls the energy flow (hot water, electrity, natural gas) to the heater/radiator.
The energy balance of the house is:
Figure 1: Room temperature model - energy balance
In this figure we have:
QH + QF - QL = CR dtR/dτ (1)
QL = K (tR - tA) (2)
The simulink model of the system is shown here:
Figure 2: Simulink model of a (simple) house
Free heat input is modeled as a step function - ie. the heat - 1000W - is added at 2 oclock.
The m-file running the model can be downloaded here: house1 - and the Simulink diagram here: house_model1.
Running the model for 6 hours gives this plot:
Figure 3: Temperature and heat flows, no control
The problem is now to establish a controller of the radiator heat output that gives a room temperature close to the comfort temperature, here defined as 20°C!
As you can see from figure 3, the room temperature is far from 20°C - as well before as after the input of the free heat after 2 hours!
Many electric radiator heaters are equipped with a simple ON-OFF controller, called a "thermostat". Let us try to build such a controller to test the performance of it.
First step is to re-arrange the model, i.e. to create a sub system, called "room model" see figure 4
Figure 4: Same model as in figure 2, but now with the Room model in a subsystem
Now we add the ON-OFF controller, see figure 5.
Figure 5: ON-OFF controller
Three blocks are quite new:
1) "Set point": This is a "Constant" block and the variable is the desired room temperature t_R_set, here 20°C.
2) "Relay" is the ON-OFF-device. This device turns the radiator heat ON and OFF depending on the "error" compared to the hysteresis, H.
Figure 6: Parameters in the Relay block
3)"Transfer function": You can find this block in "Continuities" - "Transfer", but here we have used a special version, where we can set the initial output value. This block is stored under "Simulink Extras" - "Additional discrete" - "Transfer fct - with initial outputs". This block simulates a temperature measuring device which is assumed to be a first order process with a given time constant.
Figure 7: Parameters in the "Transfer function (with initial output)" - block
All the yellow blocks are "To Workspace"-blocks, because we now want to see more details plotted.
Here you can download the new m-file house1_onoff and here the new Simulink file: house_model1_onoff.
Download the model and run it. You will get the following result.
Figure 8: Control performance - with ON-OFF control
There is a standard for a block diagram for control engineering, see figure 8. The model is the same as previously, but now we have arranged it in the more common way, see figure 1 in Introduction
Figure 9: Standard layout of the feed back control system
This model can be uploaded here: house_model1_onoff_normal