[From Bill Powers (980929.0158 MDT)]
Is it about time to proceed with the thermostat model? I'll assume that
everyone with difficulties has resolved them, and that we have 17 people
who are panting to get on with it.
What we have right now is a model of the environment of the thermostat, in
which turning a furnace on continuously raises the temperature of a house
until the heat losses through the walls equal the heat gain from the furnace.
But first ...
Call up the previous model,which should be called "thermo1.mdl." I
discovered that when I stored the model, I named it thermo1.mdl, and when I
just looked at it to see what I called it, it was named "thermo1.mdl.mdl".
So Vensim adds the ".mdl" without checking to see if that file extension is
already there. Be advised: when you store a NEW model, just type in its
name without the extension.
If you know how to call up the previous model and save it as "thermo2.mdl,"
then exit from it and call up "thermo2.mdl" as the new working file, skip
the following, which is for PC owners only (Mac owners will need a
different computer guru).
···
======================================================================
Some people are having trouble finding and moving files. To find a file,
click on "Files -- Open Model". This brings up a window for finding the
file and opening it. To save a file under a new name or for the first time,
click on "Files -- Save As ...".
"Files -- save as ...", works only when you have a model in the screen and
have clicked somewhere in that screen to make it active) "Files ... open"
works all the time. In either case, a new window opens.
The top line is the title of the window. The next line is marked "Save in",
(if you're doing "save as...") or "Look in" (if you doing an Open Model).
There's a rectangular opening and some buttons to the right of that legend.
In the rectangular window is (probably) a yellow folder icon and its name.
Just to the right of that is a yellow button with a crooked arrow pointing
up on it.
Just below this line is a big subwindow showing what is in the named
folder, a list of both folders (yellow) and files (other icons, mine are
all blue-green). To go _down_ a level in the directories, double-click on a
FOLDER, not a file, in this sub-window. All the folders and files in that
folder will be shown. There is a horizontal scroll bar for looking at
folders or files when there are too many to fit into the window. I'll
explain how that works if anyone needs me to.
If you want to delete a folder and its contents, or a single file,
highlight it with a single click and hit the Delete key. Don't forget to
empty your Recycle Bin now and then (double click the icon on the main
desktop, click on Files ... Empty recycle bin). Things aren't really
deleted off the disk until you do this. If you didn't know about the
Recycle Bin, you could save hundreds of megabytes of disk space by emptying
it.
To go _up_ a level, click on the folder with the crooked arrow in the line
above this sub-window. When you see the folder you want ("models", a folder
in the folder "Vensim", is the one I'm using), you can either double-click
on the file name in the big subwindow, or type in the name of a new file
name and hit Enter, or click once on the file name and then click on
"open". The box for typing in file names is labeled "File Name." When
you're saving a model for the first time, you have to type in a new name
for it.
If you're opening a file, look through the directories in this all-purpose
finder window until you see the file name you want, and double-click on the
icon or click once on the file name, then once on the "open" button. If
you're saving a new file as ..., find the right folder, so its name appears
in the second line of this window, and then type in the new file name
you've giving this file (WITHOUT the .mdl extension!). Then click the Save
or Open button (the label of this button changes as appropriate). If you
have created a new model but haven't saved it before, you can click Files
... Save and you'll get the "save as ..." window. If you've already named
and saved the file once, clicking Files ... Save (or control-s) saves the
file instantly without going through the special window.
When an attachment contains a model, you can copy it from \Eudora\attach to
the \Vensim\models folder using "My Computer", or you can Open it from
Vensim in \Eudora\Attach and then Save as ... into \Vensim\Models (then do
Files ... Close to close the source file, and File ... Open-model from the
r9ght folder to be sure you're working with the copy in \Vensim\models).
That's what I do, anyway. Then some other time you can delete all the .mdl
files from \Eudora\Attach.
That's enough of the mechanics of using Vensim under Windows 95. I'll
answer direct posts for those still having difficulties, but no more of
that level of detail in this series (unless it's something new). Back to
business.
I assume that you have now all called up the old file, Thermo1.mdl, saved
it as the file thermo2.mdl in the "models" directory (or wherever you're
saving these model files), closed the file, and opened thermo2.mdl.
--------------------------
The thermostat is a little box on one wall in one room in the house. Inside
this box is a bimetallic element carrying an electrical contact, and
another contact mounted on a lever that is calibrated in degrees. When
these contacts touch each other, the furnace turns on; when they break the
contact, it turns off. The contact on the bimetallic element moves away
from the other contact as the temperature of the bimetallic element rises.
The temperature of the bimetallic element rises when the room air
temperature rises, but after a little delay.
We need to make room on the screen to add the thermostat. Click on the
"pointer" arrow, then do the following. What you're going to do is to drag
a box so it encloses all the elements now on the screen, with as little
unnecessary space enclosed as possible, then move the box to the top of the
model window. So place the mouse arrow to the upper left of the diagram on
the screen, then click-drag the mouse down and to the right. This, as you
will discover, makes a rectangle which you can size so it just encloses the
diagram. Let go of the mouse button to accept what you see. If you've
included too much space or cut off some of the diagram, just click outside
the rectangle and start again.
When you're satisfied with the rectangle, click-hold on white space inside
it, and drag the rectangle where you want to move the diagram -- close to
the top of the screen. Release the mouse button to accept the position.
We need to add a bunch of auxiliary variables and constants to the diagram
now. After clicking on the VAR (no box) button, type in and arrange these
variables and constants roughly as follows in the space beneath the old
diagram:
o l d d i a g r a m
output quantity input sensitivity
output sensitivity perceptual signal
delay time
error signal
reference signal
We need arrows now to show causal relations among variables and the
influence of constants.
FROM TO
output quantity furnace output
output sensitivity, error signal output quantity
reference signal, perceptual signal error signal
delay time, input sensitivity, inside temperature perceptual signal
After entering all these arrows, hit control-s or click on Files -- Save.
We now have the whole causal loop diagram of the thermostat and its
environment. The thermostatic control system consists of all the new
variables and constants we just added. The environment of the control
system is the old diagram.
The next step is to click on the Equations button (Y=X2) and go through all
the variable names that have turned black (all that we just added, at
first), clicking on each of them in turn and filling in the Equation window
as appropriate. We're still ignoring the units; we'll fill them in when
we're done with this part.
Let's go clockwise around the loop, starting with the perceptual signal.
Inside the control system, all the variables represent contact positions
(measured in millimeters, mm) or signals (measured in volts).
First, inside temperature is converted to a perceptual signal which is the
position of the contact on the bimetallic element. Set the "input
sensitivity" factor to 1, arbitrarily, saying that a one-degree change in
temperature is represented by a 1-mm movement of the contact. If the actual
relationship were different, we would use the appropriate number other than 1.
There is a delay between changes in the inside temperature and movements of
the contact on the bimetallic element. Fill in "delay time", a constant,
with the value 0.05 (this is in hours, so we're saying there is a sensor
lag of about 3 minutes).
Now click on "perceptual signal" and fill in the equation:
perceptual signal = input sensitivity*DELAY3(inside temperature,delay time)
You could also write DELAY3(input sensitivity*inside temperature,delay
time) for the right side of the equation, implying that the delay is in a
somewhat different place.
Now we proceed to the error signal, which is
error signal = reference signal - perceptual signal.
The reference signal is the desired temperature translated into the
position of another electrical contact. The person operating the thermostat
can set a lever on a calibrated scale marked in degrees, but what is
actually being adjusted is the position of a contact in millimeters. We
will set the reference signal to 72 degrees, which corresponds to 72
millimeters, an unreasonably large value, but so what? We can use more
appropriate units when we take apart a thermostat and measure how far the
contact moves per degree.
The error signal is going to be measured in mm, so we will have
IF THEN ELSE(perceptual signal > reference signal,0,1)
This is how electrical contacts work: they are either closed (1) or open
(0). If the perceptual signal is less than the reference signal, they are
closed.
We are saying that "open" is equivalent to a 1 mm gap, and "closed" is a
zero-millimeter gap. I'm not sure how to handle logical variables in
Vensim, but this will get us there.
Next, the output function. The output sensitivity is 10000 (BTU per
millimeter of gap). The output quantity is
output quantity = error signal*Output sensitivity
And finally, the furnace output is simply
furnace output = output quantity.
The output function could be represented in more detail, with conversion of
fuel in cubic centimeters per hour into BTU per hour and so on, but this
way of doing it gives the overall effect: turning the furnace on and off,
and varying the furnace's heat output between 0 and 10000 BTU per hour.
We need a few little adjustments to make the plots come out conveniently
(mainly to be sure all the plots are visible, not lying behind other plots
or being off the chart).
Change the value of "insulation" to 0.016.
Set the outside temperature to 0 degrees.
Set the initial value of "heat content of house" to 5000.
Click on Model -- Time Bounds in the top menu line. Set the values as follows:
INITIAL TIME 0
FINAL TIME 5
TIME STEP 0.5
CHECK BOX: Save results every time step: CHECKED
Units: hour
Click on OK
Click on Files -- Save or type control-s.
Push the buttons "Set" and "Run," click "yes" if you're asked about
overwriting the "current" dataset, and when the run finishes, click on
control panel (the meter-face button).
In the control-panel window, click on the GRAPH tab, then on New...
In the graphics setup window, fill in the following:
Title: Thermo2
Y-DIVISIONS: 15
Using the SEL buttons, pick the following variables in this sequence, and
fill in the other entries on the same line as shown:
Variable LineW Units Y-Min Y-Max
inside temperature 2 deg -50 100
outside temperature 4 deg (note LineW)
furnace output 2 BTU/HR 0 10000
heat losses to outside 2 BTU/HR
Notice that the limits Y-min and Y-max have been left off of numbers 2 and
4 in the list. Click to check the box (on the left) between numbers 1 and
2, and between numbers 3 and 4. This make the units the same for each pair
of lines.
Click on OK
Click on Display. Don't worry about the plot yet.
Close the display window and the control panel window.
Click Files -- Save or type control-s.
Now for the last step -- filling in the units. We will need units for every
label on the screen, both in the old diagram part and in the part
representing the thermostatic controller. Poke the Equations button, "Y =
X2". Starting with furnace output and going approximately clockwise, we have
Variable Units
furnace output BTU/Hour
heat content of house BTU
Heat losses to outside BTU/Hour
Inside emperature Deg
Heat capacity BTU/Deg
Outside temperature Deg
Insulation Deg*Hour/BTU [Really Deg/(BTU/Hour)]
Input sensitivity mm/Deg
Delay time Hour
Perceptual signal mm
Reference signal mm
Error signal mm
Output sensitivity BTU/Hour/mm
Output quantity BTU/Hour
That completes the loop and we are back to furnace output in BTU/Hour.
Note the spellings of the units: the abbreviation for each unit must be
exactly the same everywhere; not mm one place and millimeters another, or
Hour in one place and HR in another, or BTU in one place and BTUS in
another. The only exception is in the Units column of the graphics setup
window, where you can call the units anything you like -- the abbreviations
or words are just labels to be put on the graph.
If you've entered all the units correctly, you can type control-u to call
up a "units check," and you will get a little window saying "Units are
A-OK". If you don't get that, you've typed the units wrongly somewhere.
Let's pause while everyone gets this model up and running properly. Check
in with a brief message, and we can get to discussion of the graphical
results (and some playing with parameters). For those who want to look
ahead, we'll be checking out the effects of varying the outside
temperature, and the reference signal. Some other interesting variations
for the venturesome: vary the perceptual delay (recalling that there is no
meaningful delay less than TIME STEP, set up through Model -- Time Bounds),
and the value of "insulation". Also try varying "output sensitivity," which
can be looked upon as being affected by the quality of the fuel. You can
also be thinking about why it's important to have a representation of the
perceptual lag in this model.
If everyone checks in with an OK message, we can avoid waiting around
needlessly. As usual, let me know on the net about glitches, so everyone
can see the fix.
Best,
Bill P.