Shop OBEX P1 Docs P2 Docs Learn Events
Temperatur...math and logic — Parallax Forums

Temperatur...math and logic

ArchiverArchiver Posts: 46,084
edited 2002-04-16 13:25 in General Discussion
Hi group,
since days I try to find clever solution to control a heating system.
I did only poor resolution.
It is a floor heating system and the floor has a big mass.
So it needs about 3 hour to remark the changing of the temperature.
To reduce this problem I controlled the floor temperature depending
on the outside temperature, but still the system is to slow.
(if it's getting colder or warmer q u i c k l y the system follows to slow)
Then I have the idea to use a "trend" (I am not sure if this is an good
idea..??)
I mean: Every 10 minutes I measure the Temp-outside
10 times. If the last Temp is always bigger then the one before
I have a trendUp = 10. If only the three last Temp are always bigger
then the one before I have a trendUp = 3 and so on.
Now, if the trend-Down (I use trend-Up and trend-Down) is growing
I overheat the floor-heating-system, overheating-factor and overheating
time depending an the trend
In my case:
Relevant outside temp = -30°C to +20°C
Not to have minus, I transferred it from 0 to 30
So temp-Outside = 0 to 30 (0= -30°C and 30= +20°C)
If for example the trend-Down=5, I deduct the "5" from the temp-Outside
And I deduct it for 50 minutes (5 x 10 minutes)
And every 10 minutes I reduce this "5" by one
In the first 10 minutes is TemOutside -5
The second 10 minutes is TempOutside -4
The last 10 minutes is TempOutside -1
If there is no more trend I don't manipulate the
TempOutside any more..
-If the trend is going down just the opposite-
My code for this way is getting rather big and confusing
A lot of if's and flags and timer and addresses.
Here I would like to be able to use more Tracys math-way
hi Tracy, in a passive way I understand Your examples
and your explanations, but to develop my own code I only can do little steps,
I like to "play with numbers" but with the stamp-math I need more
training before "getting an eye" for it. I like Your homepage, especially the
"BASIC Stamp integer math and related topics"

But any way, I am more and more unsure if my way to solve
the "temp-problem " is an clever and easy way ???
Every alternatives are thankful welcome!!

But also there is the next problem. I sure that the relations
between the TempFloor and TempOutside is not an linear
function. I tried to solve this with an table in the Eeprom, and to
modify this table automatically:
for every degree-Outside I have an correspond degree-Floor
And when there is no trend let's say for 1 hours, I check the
room-temperature and depending on the different how it is, and how it should be
the program change the according byte in the table in the eeprom.
So the program "find's it self" for each degreeOutside the precisely degreeFlor
to get the decided tempRoom.....?
But here is a lot to check too.. not always to change the
eeprom (one plus and one minus)
And w h e n exactly to change the eeprom
May be I have to think about an long-time-trend a n d an short-time trend
..but here too I am not sure that this is the way to do it ??
again: Every alternatives are thankful welcome!!

All the basic routines are working fine with the Stamp2p40:
4 x temp measure, RC-clock, Display, Infra-red-remote-control, valve and pump
control

to solve the last problem I still have one slot left and enough eeprom space

enough temp-problems have a nice evening Heinz Schwenk Germany

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-04-09 17:42
    >It is a floor heating system and the floor has a big mass.
    >So it needs about 3 hour to remark the changing of the temperature.
    >To reduce this problem I controlled the floor temperature depending
    >on the outside temperature, but still the system is to slow.
    >(if it's getting colder or warmer q u i c k l y the system follows to slow)
    >Then I have the idea to use a "trend" (I am not sure if this is an
    >good idea..??)

    Hi Heinz,

    Have you looked at the Stamps-in-class "industrial control" texts?
    Marty Hebel and Will Devenport have a lot of material there about
    control concepts that I think you would find valuable. You are
    looking at a problem of PID control, (Proportional, Integral,
    Differential). Your notion of "trend" I think corresponds to the
    "differential".

    Williard Gibbs (thermodynamicist), said, "There is nothing quite so
    practical as a good theory."

    >But also there is the next problem. I sure that the relations
    >between the TempFloor and TempOutside is not an linear
    > function. I tried to solve this with an table in the Eeprom, and to
    >modify this table automatically:
    >for every degree-Outside I have an correspond degree-Floor

    That is the "proportional" part, but the proportionality is not
    between the two temperatures directly. It is the heat flow in or out
    that is proportional to the difference in temperature. (In houses,
    this is due to the "R" rating" of the insulation.)

    >
    hi Tracy, in a passive way I understand Your examples
    >and your explanations, but to develop my own code I only can do little steps,
    >I like to "play with numbers" but with the stamp-math I need more
    >training before "getting an eye" for it. I like Your homepage, especially the
    >"BASIC Stamp integer math and related topics"

    Thanks! There is nothing like little steps. Myself, it is two
    forward, one back etc etc. Like an ant. Take enough of them and it
    looks like a big step. The main thing is always to frame the problem
    (or the house or the anthill) correctly, on a strong foundation.

    -- Tracy
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-09 18:19
    PID, Proportional, Integral & DERIVATIVE control will get you where you want
    to be. You may not even need the Derivative function in your algorithm.
    Think of the "Proportional" as gain controlled by the process temperature's
    relative differential from the set point. This is generally defined as a
    bandwidth bounded by temperature limits above and below your set point
    temperature. Ideally, when your temperature is AT the setpoint, your power
    output should be somewhere near 50% for best (quickest and with least
    hysteresis) performance. Thus, your system will need to retain the typical
    heat/cool selector switch used in home thermostats. The "Integral" function
    can be tought of as the timing for your power-on heating curve. It needs to
    set a rate at which your output will be increased, or turned on & off as it
    approaches the set point. You will always have some hysteresis about the set
    point, but the Integral will minimize it. The shortcoming you are describing
    is due to the complete absence of a derivative function. With the large mass
    you are working with, as an example, your final program will be turning the
    power on at 100% when a certain temperature below the setpoint is measured.
    As the temperature rises as a result of the heat being powered on fully,
    reaching a point nearer the setpoint will cause the derivative action to
    either adjust the output linearly, or with on/off control so as to slowly
    bump it up to the set point without grossly exceeding it. The power will
    need to be reduced before the setpoint is reached because of the large
    thermal "inertia" provided by that huge dense mass. Likewise, lpower will
    need to be incerased at the slightest reduction in temp, since the mass will
    be slow in heating again.
    "Derivative" describes a function that compensates for sudden swings in the
    setpoint by making large adjustments to the output. Although it seems that
    this may help you in this ap, the large mass again says that it would
    probably be a waste of time.

    I have been working on perfecting PID algoritms for Stamps and PICs for a
    few years now, and it takes nearly an entire semester of lecture and labs to
    teach all the details, but in a slow process like this, a simple version
    should work well. I would give the Stamps in Class project a try - it seems
    suited for this very well and is simple enough to implement.

    Chris


    > >It is a floor heating system and the floor has a big mass.
    > >So it needs about 3 hour to remark the changing of the temperature.
    > >To reduce this problem I controlled the floor temperature depending
    > >on the outside temperature, but still the system is to slow.
    > >(if it's getting colder or warmer q u i c k l y the system
    > follows to slow)
    > >Then I have the idea to use a "trend" (I am not sure if this is an
    > >good idea..??)
    >
    > Hi Heinz,
    >
    > Have you looked at the Stamps-in-class "industrial control" texts?
    > Marty Hebel and Will Devenport have a lot of material there about
    > control concepts that I think you would find valuable. You are
    > looking at a problem of PID control, (Proportional, Integral,
    > Differential). Your notion of "trend" I think corresponds to the
    > "differential".
    >
    > Williard Gibbs (thermodynamicist), said, "There is nothing quite so
    > practical as a good theory."
    >
    > >But also there is the next problem. I sure that the relations
    > >between the TempFloor and TempOutside is not an linear
    > > function. I tried to solve this with an table in the Eeprom, and to
    > >modify this table automatically:
    > >for every degree-Outside I have an correspond degree-Floor
    >
    > That is the "proportional" part, but the proportionality is not
    > between the two temperatures directly. It is the heat flow in or out
    > that is proportional to the difference in temperature. (In houses,
    > this is due to the "R" rating" of the insulation.)
    >
    > >
    hi Tracy, in a passive way I understand Your examples
    > >and your explanations, but to develop my own code I only can
    > do little steps,
    > >I like to "play with numbers" but with the stamp-math I need more
    > >training before "getting an eye" for it. I like Your
    > homepage, especially the
    > >"BASIC Stamp integer math and related topics"
    >
    > Thanks! There is nothing like little steps. Myself, it is two
    > forward, one back etc etc. Like an ant. Take enough of them and it
    > looks like a big step. The main thing is always to frame the problem
    > (or the house or the anthill) correctly, on a strong foundation.
    >
    > -- Tracy
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-11 21:55
    Hi Tracy, hi Chris
    Thanks for Your detailed replay.!!

    I have downloaded the industrial control,
    especially the:
    "Proportional-Integral-Derivative Control"
    (is it to find as .txt, or .doc somewhere or only as .pdf?)
    Yes it looks like going along with my "Temp-problem"
    But too I think I have to spend some nights with this
    "Guide"
    my "second problem" is that the relations
    between the TempFloor and TempOutside is not an linear
    function.
    Do I need to solve this with an table in the Eeprom
    or exist there an known function ?

    Hi Chris,
    As I use an proportional valve to mix hot water to the
    Floor-heating-system, I think it is not to see as an on/off control ?
    It is possible to increase speed of the pump too
    (The pump has different coils for 4 speeds).

    Chris, I am not sure to understand "gain controlled"?

    (I don't use much the English language, so sorry it is
    difficult for me to find and understand the right and pregnant words)

    PS
    my system is already working but I am not satisfied with the result.
    But I have the chance to monitor always the new realization

    Regards, Heinz Schwenk Germany

    ***********************************************
    > >It is a floor heating system and the floor has a big mass.
    > >So it needs about 3 hour to remark the changing of the temperature.
    > >To reduce this problem I controlled the floor temperature depending
    > >on the outside temperature, but still the system is to slow.
    > >(if it's getting colder or warmer q u i c k l y the system follows to slow)
    > >Then I have the idea to use a "trend" (I am not sure if this is an
    > >good idea..??)
    >
    > Hi Heinz,
    >
    > Have you looked at the Stamps-in-class "industrial control" texts?
    > Marty Hebel and Will Devenport have a lot of material there about
    > control concepts that I think you would find valuable. You are
    > looking at a problem of PID control, (Proportional, Integral,
    > Differential). Your notion of "trend" I think corresponds to the
    > "differential".
    >
    > Williard Gibbs (thermodynamicist), said, "There is nothing quite so
    > practical as a good theory."
    >
    > >But also there is the next problem. I sure that the relations
    > >between the TempFloor and TempOutside is not an linear
    > > function. I tried to solve this with an table in the Eeprom, and to
    > >modify this table automatically:
    > >for every degree-Outside I have an correspond degree-Floor
    >
    > That is the "proportional" part, but the proportionality is not
    > between the two temperatures directly. It is the heat flow in or out
    > that is proportional to the difference in temperature. (In houses,
    > this is due to the "R" rating" of the insulation.)
    >
    > >
    hi Tracy, in a passive way I understand Your examples
    > >and your explanations, but to develop my own code I only can do little steps,
    > >I like to "play with numbers" but with the stamp-math I need more
    > >training before "getting an eye" for it. I like Your homepage, especially the
    > >"BASIC Stamp integer math and related topics"
    >
    > Thanks! There is nothing like little steps. Myself, it is two
    > forward, one back etc etc. Like an ant. Take enough of them and it
    > looks like a big step. The main thing is always to frame the problem
    > (or the house or the anthill) correctly, on a strong foundation.
    >
    > -- Tracy
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and Body
    of the
    message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-12 02:40
    The types of controls discussed here I agree with and am not trying to
    say different. However, they are not the logic I would suggest when
    trying to solve problems that you discuss. I would tend to look at the
    problems in terms of energy transfer. If the temperature outside is -20
    degrees F and the room is cooling at a rate of 2 degrees per minute, we
    need to replace energy in the system at a 'rate' of 2 degrees per min to
    maintain the temperature. If we need to heat the room, we need to
    replace energy in the system at a rate greater than 2 degrees per min
    and how fast we want the temperature to increase, determins how much
    more than 2 degress per min we use. On another day if the outside
    temperature is 50 degrees F and the desired interior temperature is 76
    degrees F, the room may be loosing energy at a rate of 1 degree per
    hour. Once in my life I had a house with water heat and often though of
    redesigning the temperature control systems, such that it would respond
    to my desire for a correct temperature. Hope this helps. I have tried
    to verbalize your problem in english, that you might be able to come up
    with a suitable solution. Prior discussion about rate, derivative,
    reset, integral, period are all nice, but they don't add much to my
    understanding.

    regards,

    leroy
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-12 03:06
    At 21:40 04/11/02, Leroy Hall wrote:
    >The types of controls discussed here I agree with and am not trying to
    >say different. However, they are not the logic I would suggest when
    >trying to solve problems that you discuss. I would tend to look at the
    >problems in terms of energy transfer. If the temperature outside is -20
    >degrees F and the room is cooling at a rate of 2 degrees per minute, we
    >need to replace energy in the system at a 'rate' of 2 degrees per min to
    >maintain the temperature. If we need to heat the room, we need to
    >replace energy in the system at a rate greater than 2 degrees per min
    >and how fast we want the temperature to increase, determins how much
    >more than 2 degress per min we use. On another day if the outside
    >temperature is 50 degrees F and the desired interior temperature is 76
    >degrees F, the room may be loosing energy at a rate of 1 degree per
    >hour. Once in my life I had a house with water heat and often though of
    >redesigning the temperature control systems, such that it would respond
    >to my desire for a correct temperature. Hope this helps. I have tried
    >to verbalize your problem in english, that you might be able to come up
    >with a suitable solution. Prior discussion about rate, derivative,
    >reset, integral, period are all nice, but they don't add much to my
    >understanding.
    >
    >regards,
    >
    >leroy

    The following resources should go a long way to aiding the understanding of
    PID control.

    http://www.expertune.com/articles.html
    http://www.controleng.com/archives/1998/ctl0301.98/03a305.htm
    http://lorien.ncl.ac.uk/ming/pid/PID.pdf
    http://www.tpub.com/doeinstrument/instrumentationandcontrol84.htm

    http://www.stampsinclass.com/html_files/downloads_curriculum.htm
    Industrial Control (Version 1.1) Experiment #6: Proportional Integral
    Derivative Control.


    Jim H
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-12 16:37
    >my "second problem" is that the relations
    >between the TempFloor and TempOutside is not an linear
    >function.
    >Do I need to solve this with an table in the Eeprom
    >or exist there an known function ?

    Heinz,

    Could you give an example of the non-linearity or how you determined it?

    I don't know if this will help, but a simple electrical model of the
    system might be the following. You have a capacitor that represents
    the heat capacity of the floor and the air space above it. There is
    a resistor that represents the insulation between the inside and
    outside. The outside will be represented by a battery. The voltage
    across the capacitor (Vi) and the battery (Vo) respectively represent
    the temperatures inside and outside. Left alone, and the outside
    temperature never changes, eventually the inside and outside
    temperatures will be the same. If the outside temperature suddenly
    changes, the inside temperature will slowly follow, along an
    exponential curve. Finally, there is your source of heat to the
    floor, along with your sensors for "voltage" inside and outside, and
    your BASIC Stamp. The source of heat we can represent as another
    battery in series with another resistor (the heat transfer
    coefficient). The object is to hold the capacitor voltage, Vi,
    constant.

    [noparse][[/noparse]view with monospace font]
    Rs Rn
    ;
    /\/\----o
    /\/\
    ;
    | --> | --> |
    | Vs | Vi | Vo
    =====
    - | -
    |
    - | -
    | | |
    | | |
    `
    o
    '
    Vs controlled by Stamp based of Vi and Vo.

    In this example, suppose Vo is a constant. You can make Vi be
    anything you want by supplying current (heat) from your source. So I
    do not understand what you mean when you say "the relations between
    the TempFloor and TempOutside is not an linear
    function." It is really a dynamic relation involving time rates of
    change. The proportionality is that the currents (heat flow) is
    proportional to Rn*(Vi-Vo) and Ri*(Vs-Vi).

    The model itself needs to be refined. For example, in terms of
    physical processes, there may be additional RC constants from the
    floor to the room. And, outside the heat loss due to convection,
    conduction and radiation may not necessarily be correlated. The
    process of developing an accurate model of your system is called
    "system identification".

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-16 13:25
    Hi Tracy, hi Chris, hi Jim , hi Leroy, hi groupe

    Thanks for Your detailed replay.
    I have read the industrial control,
    especially the:
    "Proportional-Integral-Derivative Control"
    "Open and closed loop"
    and the links I got from Jim
    I have to spend some more time with PID,
    especially with the fine tuning.
    I will inform You about my result

    Regards, Heinz Schwenk Germany



    > PID, Proportional, Integral & DERIVATIVE control will get you where you want
    > to be. You may not even need the Derivative function in your algorithm.
    > Think of the "Proportional" as gain controlled by the process temperature's
    > relative differential from the set point. This is generally defined as a
    > bandwidth bounded by temperature limits above and below your set point
    > temperature. Ideally, when your temperature is AT the setpoint, your power
    > output should be somewhere near 50% for best (quickest and with least
    > hysteresis) performance. Thus, your system will need to retain the typical
    > heat/cool selector switch used in home thermostats. The "Integral" function
    > can be tought of as the timing for your power-on heating curve. It needs to
    > set a rate at which your output will be increased, or turned on & off as it
    > approaches the set point. You will always have some hysteresis about the set
    > point, but the Integral will minimize it. The shortcoming you are describing
    > is due to the complete absence of a derivative function. With the large mass
    > you are working with, as an example, your final program will be turning the
    > power on at 100% when a certain temperature below the setpoint is measured.
    > As the temperature rises as a result of the heat being powered on fully,
    > reaching a point nearer the setpoint will cause the derivative action to
    > either adjust the output linearly, or with on/off control so as to slowly
    > bump it up to the set point without grossly exceeding it. The power will
    > need to be reduced before the setpoint is reached because of the large
    > thermal "inertia" provided by that huge dense mass. Likewise, lpower will
    > need to be incerased at the slightest reduction in temp, since the mass will
    > be slow in heating again.
    > "Derivative" describes a function that compensates for sudden swings in the
    > setpoint by making large adjustments to the output. Although it seems that
    > this may help you in this ap, the large mass again says that it would
    > probably be a waste of time.
    >
    > I have been working on perfecting PID algoritms for Stamps and PICs for a
    > few years now, and it takes nearly an entire semester of lecture and labs to
    > teach all the details, but in a slow process like this, a simple version
    > should work well. I would give the Stamps in Class project a try - it seems
    > suited for this very well and is simple enough to implement.
    >
    > Chris
    >
    >
    > > >It is a floor heating system and the floor has a big mass.
    > > >So it needs about 3 hour to remark the changing of the temperature.
    > > >To reduce this problem I controlled the floor temperature depending
    > > >on the outside temperature, but still the system is to slow.
    > > >(if it's getting colder or warmer q u i c k l y the system
    > > follows to slow)
    > > >Then I have the idea to use a "trend" (I am not sure if this is an
    > > >good idea..??)
    > >
    > > Hi Heinz,
    > >
    > > Have you looked at the Stamps-in-class "industrial control" texts?
    > > Marty Hebel and Will Devenport have a lot of material there about
    > > control concepts that I think you would find valuable. You are
    > > looking at a problem of PID control, (Proportional, Integral,
    > > Differential). Your notion of "trend" I think corresponds to the
    > > "differential".
    > >
    > > Williard Gibbs (thermodynamicist), said, "There is nothing quite so
    > > practical as a good theory."
    > >
    > > >But also there is the next problem. I sure that the relations
    > > >between the TempFloor and TempOutside is not an linear
    > > > function. I tried to solve this with an table in the Eeprom, and to
    > > >modify this table automatically:
    > > >for every degree-Outside I have an correspond degree-Floor
    > >
    > > That is the "proportional" part, but the proportionality is not
    > > between the two temperatures directly. It is the heat flow in or out
    > > that is proportional to the difference in temperature. (In houses,
    > > this is due to the "R" rating" of the insulation.)
    > >
    > > >
    hi Tracy, in a passive way I understand Your examples
    > > >and your explanations, but to develop my own code I only can
    > > do little steps,
    > > >I like to "play with numbers" but with the stamp-math I need more
    > > >training before "getting an eye" for it. I like Your
    > > homepage, especially the
    > > >"BASIC Stamp integer math and related topics"
    > >
    > > Thanks! There is nothing like little steps. Myself, it is two
    > > forward, one back etc etc. Like an ant. Take enough of them and it
    > > looks like a big step. The main thing is always to frame the problem
    > > (or the house or the anthill) correctly, on a strong foundation.
    > >
    > > -- Tracy
    > >
    > >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and Body
    of the
    message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
Sign In or Register to comment.