Please enable JavaScript to view this site.

Vensim Help

(thrmstat.mdl)

 

A simple mechanical system that is often encountered is a thermostatic control attached to a furnace.  This system is interesting because it is designed to oscillate.  The purpose of a thermostat is to keep a room in a comfortable temperature range, without constantly switching the furnace on and off.  To do this, the control must establish a buffer range.  When the temperatures goes below the bottom of the range the furnace comes on, when it goes above the top of the range the furnace turns off.  For all temperatures within the range the furnace stays on if is it on, and stays off if it is off.

The reason that this is different from the other models we have considered so far is that it involves a discrete event - the furnace turning on or off.  To make matters worse, the way the problem has been described, the switching of the furnace is dependent on whether the furnace is already on.  This seems to be a paradox.  The solution to the paradox, in this case, has to do with the granularity of time.  The switching on and off of a furnace is not really a discrete event, it is just relative to the processes of heating and cooling that it seems instantaneous.  For modeling purposes, we resolve this paradox by tracking the last known state of the furnace:

The equations for the model are:

Temperature = INTEG(heating-cooling,70)

Units: Degrees Fahrenheit

cooling = (Temperature - outside temperature)/cooling time

Units: Degrees Fahrenheit / Hour

cooling time = 8

Units: Hour

outside temperature = 35

Units: Degrees Fahrenheit

The formulation for cooling is the same as the stock adjustment formulation for net  hire  rate used in the Workforce-Inventory model.  If heating is zero the cooling effect will take Temperature from its current value toward outside temperature over cooling time.  The interpretation of cooling time as the average time for an individual particle of the room to cool is not useful here since individuals are molecules and the concept of temperature requires averaging over molecules. cooling time, instead, should be thought of as the time over which most (63%) of the gap between the current room temperature and the target or equilibrium temperature is closed.  For example, if the outside temperature was 0, and the inside temperature was 100, then after 8 hours (with the furnace off) the inside temperature would be 37.  The temperatures would never become exactly equal to 0, but after 24 hours it would be very close (5 degrees).

heating = furnace is on * furnace capacity

Units: Degrees Fahrenheit /Hour

furnace capacity = 10

Units: Degrees Farenheit/Hour

heating represents the addition of energy to the house.  It is very much like turning on a faucet and letting water run into a sink.  The logic for turning the furnace on is what keeps the temperature within the target range.

furnace is on = IF THEN ELSE(furnace was on :AND:

  Temperature < target temperature + thermostatic buffer,1,

  IF THEN ELSE(Temperature < target temperature -
 thermostatic buffer,1,0))

Units: Dmnl

This formulation indicates that if the furnace is already on, and Temperature is below the target plus the buffer, the furnace should be left on.  Otherwise, the furnace is turned on only if Temperature is below the target minus the buffer.

target temperature = 70

Units: Degrees Fahrenheit

thermostatic buffer = 2

Units: Degrees Fahrenheit

furnace was on = DELAY FIXED(furnace is on,0,0)

Units: Dmnl

furnace was on needs to have a memory so it must be a dynamic variable.  The DELAY FIXED function  provides this memory.  The minimum delay for the DELAY FIXED function is TIME  STEP, and the delay time of 0 is used to emphasize that we are concentrating on the most recent state of the furnace.   It would be possible to formulate furnace was on  as

furnace was on = INTEG((furnace is on - furnace was on) / 
       TIME STEP,0)

This would give the same results, but might have numerical problems leaving furnace was on with a non-zero value different from one.  This is especially likely to be a problem if an integration technique other than Euler integration is used.

You will notice that the formulation of furnace was on always starts this variable at 0.  If you were to attempt to start this variable at the value of furnace is on,  as in:

furnace was on = DELAY FIXED(furnace is on,0,furnace is on)

a simultaneous initial value condition would result.  You need to give furnace is on an initial numerical value to get simulation underway.

The control constants have been set to run this model for 24 hours in intervals of 1/16 (.0625) of an hour.