ModMultiSim help v3.05 - 4.3.3. Room heater - on/off controller
Download manual: HTML
This example simulates a room heated by a fixed-output heater. The heater is controlled by a simple on/off controller (i.e. a thermostat).
(To load this simulation select the file Room heater on-off controller from File->Simulation Examples....)
When ready to start press Run Slave Simulation. Press it again to stop or pause the simulation.
Notice as you run the simulation that the heater turns on (Heater On value is 1) as the room temperature (RoomTemp) reaches the Min Temp (19.0) and turns off (Heater On value is 0) as RoomTemp reaches the Max Temp in the thermostat. You might try playing about with register values on screen, for instance, drop the outside temperature to -20, and you'll find the heater isn't powerful enough to keep the room temperature up to the minimum required.
Now reset OutsideTemp to 5, but this time increase $1: Min Temp to 19.9 and reduce $2 Max Temp to 20.1 (i.e. reduce the hysteresis). Once the room temperature has risen, you will see that it is maintained closer to the desired value of 20, but notice that this requires the heater to turn on and off much more rapidly.
For further guidelines see Running Example Simulations
The table below show the simple program underlying the simulation of the slave controller, in this instance the thermostat.
Table 4. Slave 1: thermostat
if $RoomTemp < $1 then 1 else if $RoomTemp > $2 then 0
The Heater On statement simulates the thermostat. It simply turns the heater on if the room temperature is below the Min Temp setpoint, and turns it off if the temperature is above the Max Temp setpoint.
The table below show the simple program underlying the simulation of the environment, which includes the temperature inside the room and outside of the building.
Table 5. Environment: temperatures
$$ + (3000 * $1$0 - 105 * ($$ - $OutsideTemp )) * CycleTime / 15000
RoomTemp. The room temperature changes as heat flows into or out of the room. The statement for RoomTemp above simulates this change and a breakdown of the underlying model is provided below. The rate of temperature change is equal to the rate of heat flow divided by the "thermal mass" (or "heat capacity"), which is 15000 joules/°C in this example.
Rate of temp change = Rate of heat flow / Heat capacity
The 'Rate of heat flow' is the heater output minus the rate of heat flow through the walls to the outside.
Rate of heat flow = Heater output - Rate of heat flow to the outside
The 'Heater output' in this example is 3000 watts when it is turned on (Heater On is 1),
3000 * $1$0 (Heater output)
The 'Rate of heat flow to the outside' is the difference in temperature between the room and the outside (RoomTemp - OutsideTemp) times the wall "thermal conductance" (105 watts/°C in this example).
105 * ($$ - $OutSideTemp) (rate of heat flow to the outside)
NB This simulation of the room temperature can be related to the differential equation in a simple first-order model. If you are mathematically inclined, and interested in the underlying mathematical equation, look at first-order model, and the following paragraphs, which describe the correspondence between that model and the simulation.
The relation between the model template (listed first) and the simulation of the $RoomTemp (the controlled variable $CV) (listed second) is below. Here $OutsideTemp is the disturbance $D:
1.$$+($Ks *$CO + ($Kd *$D -$$))*CycleTime/$Ts 2.$$+(3000*$1$0+ 105* (1 *$OutsideTemp-$$))*CycleTime/15000 ____ ___ _____ 105 105 105
This simulation uses the rate of heat flow (by multiplying by thermal conductance of 105). However, as an alternative, one could replace this rate (*105) by using how much the room temperature changes when the heater output changes - i.e. divide heater output by 105 (3000 (watts)/105), along with how quickly the room temperature changes when the heater output and outside temperature change: 15000 (joules)/105. These latter two would replace the existing multiplication by 105.
The code segment in the model template uses this alternative form, where 3000/105 corresponds to the system gain $Ks, and 15000/105 corresponds to the system time constant $Ts, and the difference between inner and outer temperatures would be multiplied by 1 (105/105). To complete the correspondence, the rate at which the room temperature changes when the outside temperature changes (the disturbance gain $Kd) is implicit here with a value of 1.
Note that the correspondence between register names and names in the techniques section is contained in the Notes column.