Modeling concrete examples2

RE: Modeling concrete examples2
[Bjorn Simonsen(2003.11.21;12:05 EuSt)]

From Bill Powers (2003.11.20.1400 MST)

                    F - K*A*(T1 - T2)

    >change in T1 = ---------------- * dt

                            S*M

    >K = 0.0000999 (cal/(sec-deg-cm^2)

In our example 0,0000999* 450,000 cal/sec-deg = 44,955 cal/sec-deg. This is OK. If the inside temperature is 4 degrees and the outside temperature is -6 degrees, the temperature difference is 10 degrees and the heat loss at that moment is

449,55 cal/sec. Let us use this.

    >Now we can correct your result of 5.58E6 cal/sec to 549 cal/sec, You can pick a furnace

    >size to fit -- perhaps 2400 cal/sec, or 10 KW.

    >Do you agree with my modified equation above, and the new value of K? If so we can proceed to

    >your model after you adjust these parts of it. If you'd like to convert to a more convenient system of units, feel free.

I f we start with an inside temperature = 4 degrees and an outside temperature = -6 degrees (10 degrees in difference) and use your formula which is OK we get:

Change in T1 = [2400-0.000099945.000(4-(-6))]/(0,2455.000) = 1.78 degrees each second. That is too much. I prefer a furnace where F=1250 cal/sec. Let us use a furnace where F=1250 cal/sec

Then I am ready to exchange thoughts about the model. You find it on my web

http://home.c2i.net/bjornsimonsen/termostat5b.xls . (the URL is changed since 2003.11.20) But I send it as appendix to you and Rick (and other if they ask).

Down to the left you can vary outdoor, indoor and thermostat temperature. If you click Ctrl +l, you set the spreadsheet wit the values you have chosen. If you click Ctrl+a you start the thermostat. You can see how the inside temperature is increasing. When it reach the thermostat temperature (20), you can see that the indoor temperature changes over and under 20 degrees.

If the model should have a negative feedback, there should be a signal to the furnace to reduce the furnace effect so it at 20 degrees just balanced the heat loss effect.

It is no use to change the constant describing heat loss, but we can change the furnace to 2400 cal/sec. Then you will see that the heartening up time is extremely reduced. If you use too small furnace effect, e.g. 240 cal/effect, you will see that the temperature is decreasing.

What can you comment more?

In the right part of the model I have put Rick’s model functioning. I am grateful if you comment the slowing factor and the gain.

I think the slowing factor is among other factors the heat loss. What more?

The gain could be the air pressure (too small effect??), it could also be reflection from the walls ??

Of course we could say that the furnace is a disturbance relative to the room heartening. Maybe that is correct and only let reflection be the feedback effect from the output.

bjorn

[From Rick Marken (2003.11.21.0930)]

[Bjorn Simonsen(2003.11.21;12:05
EuSt)]
Then I am ready to exchange thoughts about
the model. You find it on my web

http://home.c2i.net/bjornsimonsen/termostat5b.xls
. (the URL is changed since 2003.11.20) But I send it as appendix
to you and Rick (and other if they ask).

OK. I’ve got it up and running. You have to change a couple statements
in Sub thermostate() as follows
Application.Run “termostat5b.xls!adjustment”

Application.Run "termostat5b.xls!start_heatening"

because you’ve changed the file name to termostat5b.xls.

It look pretty good. But I have to spend some time with it and see how
best to insert a control system, assuming that the physics model is no
OK. It will take some time to figure out what’s going on but it looks
like you’re on the right track.

Best

Rick

···

Richard S. Marken, Ph.D.

Senior Behavioral Scientist

The RAND Corporation

PO Box 2138

1700 Main Street

Santa Monica, CA 90407-2138

Tel: 310-393-0411 x7971

Fax: 310-451-7018

E-mail: rmarken@rand.org

[From Bill Powers (2003.11.20.0834 MST)]

Bjorn Simonsen(2003.11.21;12:05 EuSt)

···

All of your corrections are right. I am going back to school to learn how
to do arithmetic.

My spreadsheet stops on an error: it can’t find the file
termostat5.xls. Debug shows that the program stopped on the marked
statement

Sub thermostate()

’ thermostate Makro

’ Makro registrert 20.11.2003 av Anne Simonsen

’ Hurtigtast: CTRL+a

Application.Run

“termostat5.xls!adjustment”
<============= stopped here

Application.Run

“termostat5.xls!start_heatening”

Application.Goto Reference:="R1C1"

End Sub

I added the “b” to the file name. However, when I stored the
correction I got a warning that the program was created by a later
version of Excel. I stored it anyway – and the program ran!

So now we can talk about your model.

If I read it correctly, you compute the temperature rise by adding D15
(temperature rise in one iteration) to D7 to get the new value of D7. D7
starts at zero, I presume, so it represents the total number of degrees
added since the start.

I finally figured out that if the furnace is on, the heat gain (D19) is
the difference between furnace output and heat losses, otherwise it is
only the heat losses. And then it is divided by the heat capacity and the
mass to produce the temperature rise in degrees. So it is OK to add the
temperature rise to the previous temperature to get the new temperature
in D7. I thought at first you were adding calories to degrees.

In cell D19 (inside temperature) the formula is

If ((D7 = C22), C22,C22 + D7)

C22 is the beginning inside temperature, so you’re comparing the total
temperature rise (D7) with the beginning inside temperature (C24). If
these two numbers happened to be exactly equal, the value of this cell
would become the beginning temperature C22; otherwise the value would be
the initial inside temperature plus the temperature rise; in other words,
the current room temperature. So during the execution of the program, we
might or might not see one instant when the value of D19 jumped back to
the initial temperature, and then it would return to its steady rise or
fall. Since you’re comparing floating point numbers here, the chances of
exact equality would be very small. This formula gives the same result as
simply saying C22 + D7 – the initial temperature plus the temperature
rise. What was your thought here?

Anyway, the model works correctly and you have added the on-off control
system in the right way.

What
can you comment more?

You can make this into a continuous control system if you make the
furnace output continuously adjustable. Compute the difference between
actual temperature and reference temperature. Multiply the error by G
(gain) to compute furnace output.

A17 = G*(D21 - D19)

This will substitute for the “furnace on - furnace off” switch
in D23. Change the formula in A15 so the furnace is always on: A15 = A17

  • A19. Now with a big error the furnace will be putting out a lot of
    heat, and with a small error, a small amount of heat. Experiment to see
    the effect of the size of G. Also, you will probably want to add a
    statement limiting the amount of heat the furnace can emit. IF (( A17

1250),1250,A17), and also you will find that sometimes you need
another statement, IF ((A17 < 0),0, A17) to keep from turning your
furnace into an air-cooler when the outside temperature gets too
high.

In the right part of the model I have
put Rick’s model functioning. I am grateful if you comment the slowing
factor and the gain.

The gain applies only to a continuous control system. And you need
the slowing factor only when the environment does not contain any
integrations. In this case, the environment does all the slowing that is
needed so we don’t need the fancy kind of output function. (In general,
the control loop should contain no more than one integration, or one pure
integration and one leaky integration, to make the control
stable).

I
think the slowing factor is among other factors the heat loss. What
more?

The slowing factor is in the equation for heat gain: D7 = D7 + C15. That
is a pure integration, but C15 decreases as the temperature increases, so
there is also a leak. The heat loss does determine the slowing factor:
the smaller the thermal conductivity, the smaller the leak. If the
thermal conductivity were zero, there would be no leak and the room would
be a pure integrator.

The
gain could be the air pressure (too small effect??), it could also be
reflection from the walls ??

The gain is just a setting in the device that turns the error signal into
a furnace output. In the continuous system we can specify its value. The
loop gain would be a measure of all factors in one complete trip around
the loop.

In the on-off system, the gain is infinite: to change the furnace from on
to off or vice versa requires only the smallest possible change in
temperature: a change from D19 >= D21 to D19 < D21. The smallest
change in temperature needed to go from zero to full output is equal to
the least significant digit in the floating point numbers you use (that
is why there is seldom any reason to test for the truth of the
statement a = b when a and b are floating point numbers. The statement
will almost never be true). In this kind of system, the temperature is
always either too high or too low, by some small amount.

I find these spread-sheet models very hard to understand, because the
variables have no names to say what they mean – all you see is the cell
reference, like D19. And the formulas are hidden until you click on a
cell, and even then you can see only one formula at a time. My short-term
memory doesn’t function all that well without the reminders of the
variable names. But I get it eventually.

Best,

Bill P.

[From RIck Marken (2003.11.20.2320)]

Bill Powers (2003.11.20.0834 MST)--

Anyway, the model works correctly and you have added the on-off control system in the right way.

I hadn't even noticed that Bjorn has the on-off thermostat control working. Nice job, Bjorn.

The only thing I would change is what happens when the heater comes on (D23=1). Right now, when the heater comes on the rate of heat emission is at the maximum steady state value (1250.00). That can't be physically correct, can it? I think it must take some time for the heater to heat up to the point where it's emitting 1250 cal/sec. If this rate is allowed to increase slowly to 1250 when the heater is turned on and then decease slowly from where it iss when it is turned off this will introduce a slowing factor in the environment that will keep the heater from turning on and off so often (as it does now). Assuming that one iteration of the program is 1 sec, right now the thermostat furnace stays on for about 10 seconds and then goes off for only 2 seconds when it's keeping the temperature at the reference.

I find these spread-sheet models very hard to understand, because the variables have no names to say what they mean -- all you see is the cell reference, like D19.

There is a way to name the cells but it's somewhat tedious.

And the formulas are hidden until you click on a cell,
and even then you can see only one formula at a time.

There is a way to display the formulas in all the cells simultaneously without clicking on the cells.

My short-term memory doesn't function all that well without the reminders of the variable names. But I get it eventually.

Yes, and there are other shortcomings which can also be worked around. But I think the benefits of spreadsheet modeling outweigh the problems. The main benefit is that the spreadsheet is software that virtually everyone has and it runs on virtually every platform. And several people (including Bjorn) have actually used spreadsheet modeling to learn about control; for example, all of Kent McClelland's work on conflict was done using spreadsheet modeling. So I think spreadsheet modeling has it's place as a tool for teaching control theory.

Best

Rick

···

---
Richard S. Marken
marken@mindreadings.com
Home 310 474-0313
Cell 310 729-1400