ModSlaveSim help v3.04 - 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 shows the simple program underlying the simulation.
if $41 < $1 then 1 else if $41 > $2 then 0
$$ + (3000 * $0 - 105 * ($$ - $40 )) * CycleTime / 15000
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.
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 * $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 * ($$ - $40) (rate of heat flow to the outside)
Note that the correspondence between register names and names in the techniques section is contained in the Notes column.