MODELS: a thermostat

[From Bill Powers (980922.1536 MDT)]

Bruce Gregory (980922.1302 EDT)]

Let's work up a Vensim model of a thermostat. This would make a good
project for everyone just starting to do simulations. I'll go through this
as a lesson for everyone, starting with excruciating detail for those
really starting from scratch. If I violate conventions too much, I hope the
Vensim experts will speak up. But I won't do anything actually wrong, so it
would be better to defer such corrections until we all have working models
on our screens.

I suggest starting with a model of the furnace and the temperature of the
house. The physics you need to know is this:

1. The furnace adds heat to the house at a constant rate while it is on.
The furnace output can be called just that: "furnace output" with units of
BTU (British Thermal Units) per hour. We'll actually fill in the units later.

2. Heat, again in BTU per hour, is lost from the house at a rate that
depends on the difference between inside and outside temperature and on the
amount of insulation. So with T standing for temperature, the formula for
"heat loss rate" is

heat loss rate = (T inside - T outside)/insulation

3. The temperature inside the house in degrees depends on the BTUs of heat
the house contains divided by its "heat capacity" in BTUs per degree.

T inside = heat content of house/heat capacity

The total heat content of the house is a "level" variable because it is an
accumulation of a flow of heat BTUs. There will be two flows, which are
rates of heat flow in BTUs per hour, one entering and one leaving a single
level variable, the heat content of the house in BTUs.

I'll help you draw this first diagram. If you're having a problem at any
stage just speak up (anyone) and I or someone else will help you through it.

First start Vensim. I assume everyone can do that by now, either through
"Start ... Programs ... Vensim" or by clicking on an icon. You will get
either a blank screen with rows of buttons above and to the left, or a
screen with a previous model on it (which may take a while to appear).
Click on Files in the upper left corner, then on New Model. This will
create a blank screen for drawing a new model.

When you first start a new model, a window comes up asking you about time
variables. Just click OK to accept the default settings.

First let's create a box representing the heat content of the house, in the
middle of the screen. Since this variable is an accumulation, it's a "box
variable", or a Level variable, by Vensim conventions. There's a row of
icons just above the blank part of the screen, with two "var" buttons. The
one with a box around "var" is the one to click. If you put the tip of the
arrow on it and hold it still for a second or two, you'll see the
identification of the icon, in this case the legend "Box variable - Level."
When you click with the left mouse button, the arrow turns into a little
box with a vertical line in it. With the mouse, move this box to the center
of the screen and click. A rectangular window opens up. Type in, "Heat
content of house" and Enter. A box will appear with that legend in it.

Now move to the row of icons and select the "pointer" icon, the fat arrow
pointing up and left.

By the way, if you make a mistake placing variables or arrows, you can move
them later, or erase them and draw them again. The eraser is the "Pacman"
symnbol, the black circle with a segment missing. Click on that, then move
the Pacman to the item to be removed and click. Move to the original button
and click to go back to what you were doing. To move something, use the
Pointer button, point to the item to be moved, and click-drag it.

At the lower right corner of the new box is a little circle. Put the tip of
the arrowhead on the circle, hold down the left mouse button, and drag it.
The box will change size, so you can adjust it to make the legend look
right (without any word broken in the middle). It probably looks OK but
experiment anyway to see what happens.

We now have a Level variable representing the heat content of the house
(we'll convert that to a temperature later). Now we need to represent two
flows of heat, one into the house (from the furnace) and the other out of
the house (through the walls).

In the row of icons just above the drawing area, find the "rate" icon,
which looks sort of like ==X==>. If you hold the tip of the pointer arrow
still on the icon you can confirm that it is the "rate" symbol. Click on
this button. The arrow will turn into a movable imitation of the icon.

Let's do the furnace output first. The furnace grabs energy from some
un-named place (a fuel tank, perhaps) and converts it into a flow of BTUs,
which we want to go into the house. So place the tip of the arrow about an
inch and a half to the left of the box variable and click once. A little
cloud will appear, indicating some indefinite source of the flow. Now,
without clicking any more, move the mouse to stretch an arrow that comes
out of the cloud and put its tip on the words inside the box variable, and
then click once. A rectangular window will appear. Type the words "furnace
output" and Enter. You now have a Flow Variable putting something into the
Box Variable.

While the symbol you're moving around is still the "flow" symbol (as it
will be until you click a different button), let's put in the heat losses.
Click on the words "heat content of house." That becomes the source of the
flow (not a cloud now, because you've picked a specific source). Use the
mouse to stretch the arrow to the right about an inch and a half, and click
to create a cloud showing some indefinite place where the heat goes. In the
rectangle that appears, type "heat losses to outside", and Enter. Go click
on the first icon in the row of buttons, the arrow pointing up and left, so
you won't accidentally start another flow variable without meaning to.

We now have what is known in Vensim as a "sketch", a diagram of causes and
effects without any details in it. Heat comes out of the furnace on the
left and goes into the house; it comes out of the house to the right and is
lost. In the middle, the house contains a certain quantity of heat, which
we will convert to temperature later by dividing by the heat capacity of
the house.

Now we want to indicate how much the furnace output is. So we need to
indicate a value for the flow variable called "furnace output." Let's say
we want to set the furnace output to 10,000 BTUs per hour. How do we assign
a value?

There is a button in that same row we've been using labeled "Y=X2". Click
on this button, the "Equations" button. This is the button we use to put
the details into the model. You will notice that all our variables turn
into white-on-black legends.

Click on the "Furnace output" flow variable. Voila, a big window. Near its
top it says "furnace output," and just below that, "=". To the right of the
equal sign is a big sub-window, into which we will now type, "10000" with
no commas marking off the thousands. If you then hit "Enter," this window
will close and you will see that "furnace output" has gone back to
black-on-white. This means it has an acceptable value. Vensim has cleverly
taken care of some details which we don't need to worry about now -- for
instance, it has recognized that this variable is now a "constant" and has
given it that type designation.

That was easy. Now click on the box variable, "heat content of house."
Vensim has made life even easier -- the box to the right of the equal sign
is already filled in for us. Vensim has figured out that the level variable
is the integral ("INTEG") of an expression, "furnace output - heat losses
to outside". It has written in the right equation all by itself. It wants
you to type in an initial heat content, so type in 0. Then click on OK to
close the window.

Now we have to do some work. The heat losses depend on the difference
between inside and outside temperature, and on the amount of insulation. We
don't have any inside or outside temperature in the diagram, or any
insulation, or any temperature. So we have to put them there. First,
temperature.

In our row of useful icons, click on the "VAR" buttom _without_ a box. This
is the "auxiliary" variable, or constant, designator. All that means is
that the new variable will not normally be shown in a box, and it will not
represent an accumulation of something. The arrow has changed into a
vertical bar. Move it to a blank area of the screen and click.

A rectangle will appear, into which you can now type, "inside temperature."

Do the same thing again in different blank places on the screen, and create
three more "auxiliary/constant" variables: "heat capacity," "outside
temperature", and "insulation."

Now go click on the pointer button, the arrow pointing up and left. This is
always a good idea when you've finished using another button for a while,
to avoid accidents that are a pain to undo. But now we do it because we
want to move things, and the pointer button can do that.

Click and drag the new variables (the words themselves) so you end up with
the screen looking like this (except that I've left out the box around
"heat content of house" and abbreviated some words).

========X==========> Heat cont of house =========X==========>
   Furnace output heat losses to outside

                        inside temp outside temp insulation

                       heat capacity

Now we're going to use the curved arrow button, the one that shows causal
influences that are NOT flows. Click on it; the pointer arrow turns into a
copy of that "arrow" icon (the exact active place is the tip of the curved
arrow).

Now click (on-off) on the words "Heat content of house" and move the mouse
to drag the arrowhead to "inside temperature." Click again, and that arrow
will become permanent. Click on "heat capacity" and drag the arrow to
"inside temperature," clicking to finish that arrow connection.

Now click on the Equations button (Y=X2) and then click on "inside
temperature". We get that big window again. There is a small window with
two variable names in it -- the two variables that are connected by arrows
to "inside temperature." Click on "heat content of house" and that label
will appear in the window above next to the equal sign. Type a "/" for
"divided by," and click on "heat capacity". Now the equation is shown as

inside temperature

        heat content of house/heat capacity

···

=

which is a funny way to write equations, but complain to Bob :-).

Under a label "type" you will see "Auxiliary", which is correct for the
variable "inside temperature." Vensim figured that out, too. The units box
is unfilled, and we will leave it that way. Just click on OK. We can fix
the units later.

The "Y=X2" button, the equations button, is still pressed, so click on
"heat capacity" and set it to 200, exiting with the Enter key.

Now using the curved arrow key, connect FROM "inside temperature", "outside
temperature", and "insulation" TO "heat losses to outside" (but not to each
other). Using the Equation button, set "outside temp" to 0, and
"insulation" to 0.015.

Click on "heat losses to outside" and set the equation to

heat losses to outside

     (inside temperature - outside temperature)/insulation

This is now a runnable model.

The last step is to run it.

In the second row of icons above the model screen, there is a button called
SET with a runner poised at the start line. Click it. Ignore the window
that comes up. Next to it is a button with the runner running. Click it. A
window may appear saying that "Dataset Current already exists" and asking
if you want to overwrite it. Click on Yes, or type "Y". The model will run
briefly and invisibly, storing the results in a "dataset" that you can't
see. The name of the dataset is probably "Current", shown in a box next to
the "run" icon. Then click on what looks like a meter face at the end of
the same row of icons. This opens up the "control panel" window. Click on
the tab "Graph", which opens the graphing window.

If this is the first time a graph has been run for this model (it is),
click on "New..." over on the right side of the window. From then on, to
modify the graphics settings for this model, choose "Modify..." on the left
side.

A big complex window opens up. Find the SET buttons, and click the first
one. A list of the variables in this model will appear. Click on "Inside
temperature." To the right in the same line, click on the space in the
width column and type in "2". This determines the width of the trace on the
plot.

Click on the second SET button and choose "heat losses to outside", setting
width to 2, then click on the third button and select "furnace output",
again setting width to 2. Click OK. The Graph window comes back.

Now, at last, you can run the model. Click on "display". A plot of the
three variables you have selected shows up. On the left there is a separate
scale for each variable. The "inside temperature" rises to 150, and the
heat losses to outside rises to 10000, while the furnace output stays
constant at 10000.

Time to pause and troubleshoot. Please check in with me concerning any
problems you have, so everyone participating in this will end up with the
same model and the same plots. It's worthwhile to play around with this
model a bit to understand it, and we'll do that. Then we can go on to add
the control system.

Best,

Bill P.

[From Tim Carey (980823.2205)]

Hi Bill,

Thanks for an outstanding tutorial. I have the diagram up on the screen but
have had some problems with the last part of your post. If I could I'd like
to go through your post as I have some questions. These are probably fairly
basic and may have been included in previous posts so I apologise if this
is tedious for anyone but my mathematical ability is appalling and I really
like to know what terms mean when I'm getting started ...

First let's create a box representing the heat content of the house, in

the

middle of the screen. Since this variable is an accumulation, it's a "box
variable", or a Level variable, by Vensim conventions.

Can you explain the terms "box variable" and "level variable"? Are these
commonly used scientific terms or SD terms or purely Vensim terms?

(we'll convert that to a temperature later). Now we need to represent two
flows of heat, one into the house (from the furnace) and the other out of
the house (through the walls).

Is the term "flow" just referring to direction?

lost. In the middle, the house contains a certain quantity of heat, which
we will convert to temperature later by dividing by the heat capacity of
the house.

Again, just to demonstrate my dreadful maths and physics knowledge can you
explain why we need to divide quantity of heat by heat capacity to
determine temperature? Wouldn't the quantity of heat in the house =
temperature? What exactly is heat capacity referring to?

is already filled in for us. Vensim has figured out that the level

variable

is the integral ("INTEG") of an expression, "furnace output - heat losses

Can you explain a bit about what an integral is? I've seen the term used in
a lot of posts lately but I'm not really sure what it is.

Now we're going to use the curved arrow button, the one that shows causal
influences that are NOT flows.

What do you mean here by things that are causal influences but not flows?

In the second row of icons above the model screen, there is a button

called

SET with a runner poised at the start line.

I was fine up to here and then I got a bit lost. Did you mean SEL here
instead of SET? I can't find SET.

temperature." To the right in the same line, click on the space in the
width column and type in "2". This determines the width of the trace on

the

plot.

Is this the column with the heading "LineW"?

scale for each variable. The "inside temperature" rises to 150, and the
heat losses to outside rises to 10000, while the furnace output stays
constant at 10000.

I'm not sure where I should be reading the 150 from. I can't seem to see it
on the screen I have up at this stage.

This has been a real hoot Bill. I'm really looking forward to mastering
this stuff and learning a bit more about the modelling side of things.

Thanks,

Tim

[From Bill Powers (980923.0729 MDT)]

Tim Carey (980823.2205)--

Thanks for an outstanding tutorial.

I needed some praise, so thanks. And here it is again.

Thanks for an outstanding tutorial.
Thanks for an outstanding tutorial.
Thanks for an outstanding tutorial.
Thanks for an outstanding tutorial.
Thanks for an outstanding tutorial.

Aaaah!

Can you explain the terms "box variable" and "level variable"? Are these
commonly used scientific terms or SD terms or purely Vensim terms?

They're purely Vensim (or rather, Systems Dynamics by Jay Forester) terms.
They aren't used in other simulation schemes. The term "box variable" no
doubt arose because of the custom of putting level variables in boxes. A
Level variable -- well, perhaps we should ask Bob Eberlein to explain why
Level variables are different from auxiliary variables. The only difference
I can see is that a Level variable results from integrating another
variable over time. Since _any_ variable can be integrated over time, I
don't see what makes Level variables special.

But in defense of giving some special notice to the results of
integrations, Level variables are _necessary_ in control loops; we use them
in PCT to make control loops stable. We call them (leaky, usually)
integrators. In System Dynamics (or SD), the inputs to Level variables are
called flows or rates, but in fact they don't need to be associated with
any actual flow of something or rate of occurrance of something. If you
integrate acceleration, you get velocity; I don't think there's any way to
interpret acceleration as a literal flow of something. But where there ARE
literal rates or flows, this formulation is certainly appropriate.

(we'll convert that to a temperature later). Now we need to represent two
flows of heat, one into the house (from the furnace) and the other out of
the house (through the walls).

Is the term "flow" just referring to direction?

In the physical theory of heat, there is a flow of heat just as there is a
flow of water in hydrodynamics or a flow of electric charges in
electronics. Heat flows from hot objects to cooler objects. Temperature is
an indication of how much heat is contained in some object, just as water
level is an indication of how much water is contained in a tank. When heat
flows out of one object and into another, the temperature of the first
object falls and that of the second object rises until they're equal; there
is a direct analogy to water flowing through a pipe from a full tank into a
less full tank where the water level is lower. No heat flows between
objects of the same temperature, just as no water flows from one tank to
another tank when the water levels are equal. The insulation value of a
building material is analogous to a constriction in a pipe connecting tanks
with different water levels. The more constricted the pipe, the lower the
flow rate from one tank to the other, although eventually the water levels
will become equal and flow will stop -- this is like saying that the more
insulation value a material has, the slower is the rate of flow of heat
from a hot object to a cold object.

Notice that in the physical theory of heat, "heat" and "temperature" do NOT
mean the same thing. A quantity of heat is like a quantity of stored
energy. Temperature depends on how many units of heat have been stored in
an object. The analogy to water flow and water levels is just about
perfect. Water flow = heat flow; water level = temperature.

Again, just to demonstrate my dreadful maths and physics knowledge can you
explain why we need to divide quantity of heat by heat capacity to
determine temperature? Wouldn't the quantity of heat in the house =
temperature? What exactly is heat capacity referring to?

It's far simpler than you think it is. Heat capacity is like tank capacity.
The greater the tank diameter, the more water flow is required to raise the
water level by one centimeter, or any standard amount. The greater the heat
capacity of an object, the more units of heat have to flow into it to raise
its temperature by one degree. The British Thermal Unit is the amount of
heat required to raise the temperature of one pound of water by one degree F.

If it takes 10 BTUs of heat to raise the temperature of an object by 1 deg
F., then 20 BTUs of heat will raise its temperature by 2 deg F. The heat
capacity of the object is 10 BTU per degree. If you MULTIPLY the amount of
heat put into the object, in BTU, by the number of degrees per BTU, you
will get the temperature change of the object. Multiplying degrees/BTU is
the same as dividing by BTU/degree. So we divide the amount of heat in BTU
by the heat capacity in BTU/degree, and get degrees.

                                     BTU
BTU/(BTU/degree) = BTU*degree/BTU = ---- * degree = degree(s)
                                     BTU

By the way, Vensim's units checker does not recognize BTU/(BTU/degree) as
being the same as degrees. It doesn't, apparently, understand parentheses.
So you have to work out the final form of the units before entering them.
We'll get to units when we have the whole thermostat working.

Also, Vensim does not seem to know about plurals. BTU is not the same unit
as BTUs. So stick to one or the other throughout the model, when we get to
doing units.

is already filled in for us. Vensim has figured out that the level

variable

is the integral ("INTEG") of an expression, "furnace output - heat losses

Can you explain a bit about what an integral is? I've seen the term used in
a lot of posts lately but I'm not really sure what it is.

An integral is an accumulation done again and again through time. The
balance in your banking account is the integral of the deposits you have
made minus the withdrawals you have made, since it opened (ignoring
interest, service charges, and embezzlement). The volume of water in a tank
is the integral of all the little volumes that have entered it every
second, or millisecond, since the tank was empty. An integral takes into
account not only the number of units that have been accumulated in every
time-interval, but how big the units were, even if their size is varying
through time.

Now we're going to use the curved arrow button, the one that shows causal
influences that are NOT flows.

The heat capacity of the house has an arrow running into "inside
temperature", but there is nothing flowing from heat capacity to
temperature. The arrow merely shows that heat capacity plays a part in
calculating temperature. Likewise, the heat content of the house has an
arrow entering the same inside temperature variable. This does not
represent a flow of heat, but is just another number that helps determine
temperature. In fact, several kinds of causation are represented by arrows
in Vensim. I would much rather see some other way of showing parameters and
conversions, instead of using what look like causal connections to indicate
them. But it's not my program.

What do you mean here by things that are causal influences but not flows?

The heat capacity of the house can be said to be what makes the temperature
rise a certain amount when a given amount of heat is added to the house.
It's a _property_ of the house. So the heat capacity has a causal effect on
the relationship between heat flow and temperature rise, but is not itself
a "flow" of anything.

In the second row of icons above the model screen, there is a button

called

SET with a runner poised at the start line.

I was fine up to here and then I got a bit lost. Did you mean SEL here
instead of SET? I can't find SET.

I'm talking about the screen on which the model is drawn, not the graphics
setup screen that you get to through the control panel.

Ah, this may be the problem. I believe I forgot to tell you how to close
the graphics screen and the control panel before getting back to the main
modeling screen. The graph window closes by clicking the X in its upper
right corner or the - sign in the upper left corner, and the control panel
closes by clicking on the word Close in its lower right corner. Once you
are back in the main drawing window, the SET button is in the second row up
in the window, very small lettering over the image of a crouched runner.

When you're setting up the graph for the first time or modifying it, you
select variables to plot using the SEL (not SET) buttons. I think I called
them SET buttons by mistake.

temperature." To the right in the same line, click on the space in the
width column and type in "2". This determines the width of the trace on

the

plot.

Is this the column with the heading "LineW"?

Yes.

scale for each variable. The "inside temperature" rises to 150, and the
heat losses to outside rises to 10000, while the furnace output stays
constant at 10000.

I'm not sure where I should be reading the 150 from. I can't seem to see it
on the screen I have up at this stage.

I don't know what stage you're at, what you have done successfully, or
what's on your screen. Please inform.

If you have a graph showing, it should show two curves rising from zero and
leveling out at two different levels. The red line is temperature and
levels out at 150. Outside the left margin of the plot, the scales are
indicated like this:

  200
10000
10000

100
5000
9000

   0
   0
8000

Below the plot is a color key, showing

Inside temperature (red line)

Heat losses to outside (green line)

Furnace output (blue line)

The first variable, inside temperature, corresponds to the top number in
each set of three scale numbers. So the bottom, middle, and top background
lines on the plot indicate 0, 100, and 200 degrees for the inside
temperature curve. The red line levels out at the line between 100 and 200,
which is therefore 150 degrees.

The furnace output is constant at 10000, the top line. Its scale runs only
from 8000 to 10000 (automatically set by Vensim).

The heat losses run from zero (when the inside temperature is the same as
the outside temperature) to 10000 (when the loss rate has risen to equal
the furnace output and the temperature difference is 150 degrees (since the
outside temperature was set to zero).

Obviously, when we install the thermostatic control system, the house
temperature will not get to anything like 150 degrees.

Any other problems, anyone?

Best,

Bill P.

[From Bruce Gregory (980923.1215 EDT)]

Bill Powers (980922.1536 MDT)]

I greatly appreciate your starting with this example. I also appreciate your
hand holding, it helped me a great deal to make sense of the conventions.
I'm up and running.

Bruce Gregory

[From Tim Carey (980924.0605)]

Thanks again Bill for a wonderful post. Your replies to my queries have
helped a lot. (I'm a bit worried about praising you again though ... don't
I have to deprive you of my praise at some stage ;-))

Level variables are different from auxiliary variables. The only

difference

I can see is that a Level variable results from integrating another
variable over time. Since _any_ variable can be integrated over time, I
don't see what makes Level variables special.

OK. What then, is an auxilliary variable?

Notice that in the physical theory of heat, "heat" and "temperature" do

NOT

mean the same thing. A quantity of heat is like a quantity of stored
energy. Temperature depends on how many units of heat have been stored in
an object. The analogy to water flow and water levels is just about
perfect. Water flow = heat flow; water level = temperature.

To continue with the water analogy then what would be analogous to a
quantity of heat? Would a unit of heat be analogous to a droplet of water?

If it takes 10 BTUs of heat to raise the temperature of an object by 1

deg

F., then 20 BTUs of heat will raise its temperature by 2 deg F. The heat
capacity of the object is 10 BTU per degree. If you MULTIPLY the amount

of

heat put into the object, in BTU, by the number of degrees per BTU, you
will get the temperature change of the object.

I think I followed everything up to this point. Taking the top line as an
example: if I mutiply the amount of heat put into an object (10 BTUs) by
the number of degrees per BTU (1 deg) I get the temperature change of the
object. Does this mean the temperature has changed by 10 deg F?

second, or millisecond, since the tank was empty. An integral takes into
account not only the number of units that have been accumulated in every
time-interval, but how big the units were, even if their size is varying
through time.

What do you mean by "takes into account"? How does an integral take into
account what you describe above? Is this determined by a mathematical
expression?

The heat capacity of the house can be said to be what makes the

temperature

rise a certain amount when a given amount of heat is added to the house.
It's a _property_ of the house. So the heat capacity has a causal effect

on

the relationship between heat flow and temperature rise, but is not

itself

a "flow" of anything.

Would heat capacity be regarded as a constant in this instance?

I don't know what stage you're at, what you have done successfully, or
what's on your screen. Please inform.

I have a graph exactly as the one you describe below. Thanks for the
explanation, I was having trouble figuring out what the numbers mean.

If you have a graph showing, it should show two curves rising from zero

and

leveling out at two different levels. The red line is temperature and
levels out at 150. Outside the left margin of the plot, the scales are
indicated like this:

  200
10000
10000

100
5000
9000

   0
   0
8000

Below the plot is a color key, showing

Inside temperature (red line)

Heat losses to outside (green line)

Furnace output (blue line)

The first variable, inside temperature, corresponds to the top number in
each set of three scale numbers. So the bottom, middle, and top

background

lines on the plot indicate 0, 100, and 200 degrees for the inside
temperature curve. The red line levels out at the line between 100 and

200,

which is therefore 150 degrees.

The furnace output is constant at 10000, the top line. Its scale runs

only

from 8000 to 10000 (automatically set by Vensim).

The heat losses run from zero (when the inside temperature is the same as
the outside temperature) to 10000 (when the loss rate has risen to equal
the furnace output and the temperature difference is 150 degrees (since

the

outside temperature was set to zero).

So from the graph Bill, it seems that when the furnace out put is 10000 and
the outside temperature is 0 then heat losses level out at 10000. I think I
understand this based on your explanations above but why, then, does inside
temperature remain at 150? If heat losses to outside are the same as
furnace output, it seems to my very small brain that the inside temperature
would approach 0 which would then be the same as the outside temperature.
What am I missing?

Thanks for your help,

Cheers,

Tim

[From Bruce Abbott (980923.2005 EST)]

I've created the model as Bill has described it thus far. Conceptually it's
just another example of the leaky bucket, with heat substituting for water,
as Bill notes. One thing I might mention about entering equations: when you
use the Equations button and bring up the dialog box for entering the
equation, you will see a little "calculator keypad" immediately to the left
of the variables list. You can click on the keypad buttons to enter
numbers, symbols (e.g., / for divide), and brackets. This may be easier to
do than hunting around on your computer keyboard for these things.

Note to Rick: I've worked briefly on the "praise" model; should have
something soon if I can find a spare moment to work on it again.

Regards,

Bruce

[From Bill Powers (980924.0110 MDT)]

Level variables are different from auxiliary variables. The only

difference

I can see is that a Level variable results from integrating another
variable over time. Since _any_ variable can be integrated over time, I
don't see what makes Level variables special.

OK. What then, is an auxilliary variable?

Any variable that's not a level variable (i.e., not the result of an
integration). The positions of the two ends of a lever are related by a
constant of proportionality. So those positions are not Level variables.
They aren't constant, either, so according to Vensim they must be
"auxiliary" variables.

To continue with the water analogy then what would be analogous to a
quantity of heat? Would a unit of heat be analogous to a droplet of water?

Yes.

If it takes 10 BTUs of heat to raise the temperature of an object by 1

deg

F., then 20 BTUs of heat will raise its temperature by 2 deg F. The heat
capacity of the object is 10 BTU per degree. If you MULTIPLY the amount

of

heat put into the object, in BTU, by the number of degrees per BTU, you
will get the temperature change of the object.

I think I followed everything up to this point. Taking the top line as an
example: if I mutiply the amount of heat put into an object (10 BTUs) by
the number of degrees per BTU (1 deg) I get the temperature change of the
object.

No. The heat capacity of the object is 10 BTU per degree, so the number of
degrees/BTU is 0.1. Multiplying the amount of heat put in (10 BTU) by the
number of degrees per BTU (0.1) is the same as _dividing_ the amount of
heat put in by the heat capacity (10 BTU/degree). In either case, you
calculate a temperature change of 1 degree as you should.

If you know the amount of heat put into the object, you have to DIVIDE by
the heat capacity (BTU/degree) to get the resulting temperature rise.

I hope my definition of heat capacity didn't get lost in this example. Heat
capacity is defined as the number of BTUs's per degree, not the number of
degrees per BTU. The greater the heat capacity, the less the temperature is
raised by a given heat input (the greater the diameter of a tank, the less
its water level is raised by a drop of water). That'swhy we divide by the
heat capacity. The bigger the heat capacity, the less the temperature will
rise when a given number of BTUs is added to an object. To multiply by
degrees/BTU as in the example you have to divide by the heat capacity in
BTU/degree. ("To divide by a fraction, invert and multiply").

Does this mean the temperature has changed by 10 deg F?

No, if the heat capacity is 10 BTU/degree, then adding 10 BTU makes the
temperature change by 1 degree.

second, or millisecond, since the tank was empty. An integral takes into
account not only the number of units that have been accumulated in every
time-interval, but how big the units were, even if their size is varying
through time.

What do you mean by "takes into account"? How does an integral take into
account what you describe above? Is this determined by a mathematical
expression?

Suppose we want to integrate the velocity of a moving object to get its new
position relative to its starting position after 1 second. If the velocity
is 10 meters per second, and the initial position is defined as 0 meters,
then we know that in 1 second the object will have moved to a position 10
meters down the track. In this case we are integrating a constant so the
calculation is easy.

But suppose the velocity increases from 0 to 10 meters per second during
this one-second time interval. Now you can't just multiply velocity times
time (meters per second times seconds) to get the final position. You have
to break the time interval down into very small increments commonly
represented by "dt" or delta-time, calculate the average velocity during
each interval, and multiply that average velocity by the elapsed time dt to
get the distance moved during the time dt. In the next interval dt, the
velocity will be slightly greater and the object will move slightly
further, and so on. Then you add up all the distances moved during all
these tiny time intervals, and that will be the total distance moved. If dt
is 0.01 second, then you'll have 100 small changes in distance to add up,
since we're asking how far the object will have moved in 1 second. If the
velocity has increased from 0 meters per second to 10 meters per second
during this 1-second time interval, we will find that the object has moved
5 meters. But if we ask how far it will have moved in 2 seconds, the answer
will be not 10 meters but 20 meters -- 4 times as far, not twice as far.
That is because it is accelerating, not moving at a constant velocity.

In general, this method of "numerical integration" gets more accurate as
the size of dt is made smaller. If the velocity isn't increasing uniformly
with time but is following some other pattern of changes, then assuming
that the distance moved is just the average velocity times dt isn't
completely accurate, particularly if you compute average velocity v as
[v(final) + v(initial)/2. But such inaccuracies get smaller as dt gets
smaller (this can be proven mathematically), so by making dt 0.001 seconds
instead of 0.01, and adding up 1000 tiny distances moved instead of 100,
the calculated integral gets even more accurate. In the integral calculus,
one of the questions raised is what the final result would be if we let dt
become infinitely small and added up a corresponding infinity of the tiny
distances moved.

As it happens, the resulting integrals of certain simple mathematical forms
turn out to be EXACTLY other simple mathematical forms. The integral of a
constant c from time 0 to t is just c*t. The integral of c*t from 0 to t is
EXACTLY 0.5*c*t^2 (^2 = squared). The integral of c*t^2 is EXACTLY
(1/3)c*t^3. The integral calculus consists mainly of finding ways to
compute the new mathematical forms that will result from integrating a
given mathematical form.

In simulations, we are doing numerical integrations, not working out the
mathematical forms. We actually do all those calculations during each time
inteval dt and add up all the results. To get the new state of the modeled
system, we integrate all the little changes of variables to get the next
value of the variables, and we might do this a million times to model the
behavior of the system for 1000 seconds, using a dt of 0.001 second.
Obviously, this is a job for a computer, not a person.

That is how integration works.

The heat capacity of the house can be said to be what makes the
temperature rise a certain amount when a given amount of heat is added to
the house.

Would heat capacity be regarded as a constant in this instance?

Yes. Properties of objects are considered to be constants, or if they
change they change only slowly. Otherwise we would call them variables!

So from the graph Bill, it seems that when the furnace output is 10000 and
the outside temperature is 0 then heat losses level out at 10000. I think I
understand this based on your explanations above but why, then, does inside
temperature remain at 150?

If you will look at the plots, you will see that the temperature starts
rising right away as the furnace keeps putting heat in at the rate of 10000
BTU per hour. But the heat losses to outside, initially zero when inside
and outside temperatures are equal, rise as the difference in temperature
between inside and outside increases (the outside temperature is constant
at 0 degrees). As the heat losses increase, the rate at which the
temperature rises slows down. Finally, the temperature has reached the
point where for every BTU added by the furnace, a BTU is lost to the
outside, and the net gain in heat is zero. So that is where the temperature
stops rising.
If the temperature were any higher, more heat would be lost than the
furnace is adding every hour, and the house would cool off. If the
temperature were any less, the furnace would be adding more heat than is
lost, and the temperature would rise. So the final temperature of 150
degrees is an equilibrium point.

If the furnace were turned off suddenly, no more heat would be added to the
house. But with a temperature difference of 150 degrees between inside and
outside, heat is still being lost at 10000 BTU per hour. Take a guess as to
what the effect would be on the temperature of the house.

Before going on to install the thermostat, let's wait a few days for any
more comments from people who are trying to find time to follow along. If
anyone is confused about the meaning of what we see in the Vensim model or
plots, speak up. Now is the time to make sure there are no
misunderstandings that will come back to haunt us later. In mathematics and
in modeling, there is ABSOLUTELY NO POINT in going ahead until you
understand everything up to where you supposedly are. And if you DO
understand everything, going on to greater accomplishments isn't scarey at
all. If you can understand one thing, you can understand the next thing. If
I can teach it, you can learn it.

Best,

Bill P.

[From Tim Carey (980925.0545)]

Hi Bill,

Thanks for your reply. I think I'm beginning to catch on ...

since we're asking how far the object will have moved in 1 second. If the
velocity has increased from 0 meters per second to 10 meters per second
during this 1-second time interval, we will find that the object has

moved

5 meters. But if we ask how far it will have moved in 2 seconds, the

answer

will be not 10 meters but 20 meters -- 4 times as far, not twice as far.
That is because it is accelerating, not moving at a constant velocity.

I'm not sure about this part. Do you mean that the object had moved 5
meters in the first second because during this second velocity is changing
from 0 to 10 meters? What do you mean by accelerating? Is it just that it
is changing from 0 to 10? Once velocity reaches 10 it will remain constant
won't it?

That is how integration works.

A really clear description, thanks.

Cheers,

Tim

[From Bill Powers (980925.1055 MDT)]

Tim Carey (980925.0545)--

Do you mean that the object had moved 5
meters in the first second because during this second velocity is changing
from 0 to 10 meters? What do you mean by accelerating? Is it just that it
is changing from 0 to 10? Once velocity reaches 10 it will remain constant
won't it?

The velocity (measured in meters per second) increases from 0 to 10 meters
per second in one second. This means that the velocity changes according to
the following table:

time,sec velocity, m/sec
0 0
0.1 1
0.2 2
0.3 3
... ...
1.0 10

So this object is going faster and faster, "accelerating" at a pretty good
rate. Acceleration is the rate of change of velocity. If you look at the
table you'll see that the velocity changes by 1 meter per second every
tenth of a second, so the acceleration is constant at (1 meter/sec)/0.1 sec or

acceleration = 10 meters per sec per sec, a constant.

Now, what is the _average_ velocity during this 1 second? During the first
tenth of a second, the velocity starts at zero and ends up at 1 meter per
second, so it's (0 + 1)/2 or 0.5 meter per second. In the second tenth of a
second, the velocity starts at 1 meter per second and ends up at 2, so the
average is (1 + 2)/2 or 1.5 meter/sec. In the followiong tenths it goes
2.5, 2.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5. The sum is 50, and the overall
average velocity is 50/10 = 5 meters per second. Since this has gone on for
1 second, the distance travelled is 5 meters.

Now suppose that the same constant acceleration of 10 meters/sec/sec went
on for 2 seconds instead of 1. We know that in the first second, the object
traveled 5 meters, so we only have to see how far it went in the second
second and add the two up. From the 10th to the 11th tenth of a second, the
velocity begins at 10 and ends up at 11 meters/sec, for an average of 10.5
m/s. The rest of the values to the end of the second second are 11.5, 12.5,
13.5, 14.5, 15.5, 16.5, 17.5, 18.5, and 19.5 m/s. The total is 150, and
dividing by ten we have the average velocity during the second second: 15
meters/second. So the distance traveled is 15 meters, and the total
distance during the two seconds is 5 + 15 = 20 meters.

If you try this for the third and fourth seconds, you may start to see a
pattern. In the first second, accelerating at 10 meters per second per
second, the object travels 5 meters. After the second second it has
traveled 20 meters. After the third second, and the fourth and fifth
seconds, it has traveled ?? meters. When you double the time during which
the acceleration occurred, what happens to the total distance traveled?
This is what Galileo figured out by rolling balls down a slanted board.
Doing this instead of dropping the balls made their acceleration less so it
was easier to time them. When you have figured it out, you will know as
much as Galileo did.

Best,

Bill P.

[from Jeff Vancouver 980925.1630 EST]

I, too very much appreciated the thermostat tutorial. I am considering
this Chapter 2. I am making copies (appendixed with your answers to Tim's
question) for my students and an interested colleague. This should be
clearly be available in an organized manner because Rupert is right. New
people will come on board, get behind because of other work, or just get
Vensim, and they should be able to do this exercise.

Bill, your tutorial really is very well executed. Except for the one slip
with the graphing function (the archive files should make this correction),
you nicely gave all the detail needed to perform the task. What is truly
amazing about this is that you did it without the benefit of feedback from
the students. That is a real skill.

Looking forward to the next installment.

Sincerely,

Jeff