Thermostat

Thermostat preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

chemistry and physics 

Tagged by Reuven M. Lerner over 11 years ago

heat 

Tagged by Reuven M. Lerner over 11 years ago

negative feedback 

Tagged by Reuven M. Lerner almost 12 years ago

temperature 

Tagged by Reuven M. Lerner almost 12 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 455 times • Downloaded 100 times • Run 1 time
Download the 'Thermostat' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

A thermostat is a device that responds to the temperature of a room in order to maintain the temperature at some desired level. This is often used as an example of feedback control, where a system adjusts its behavior in response the effects of its prior behavior.

Generally speaking, heating systems have only two settings - on and off - and it is the job of the thermostat to turn the heater on and off at the appropriate times. A simple thermostat does this by switching the heater on when the temperature of the room has fallen below the set desired temperature, and switching the heater off once the desired temperature has been reached or exceeded.

HOW IT WORKS

In this model, the red turtles represent heat, and the yellow border demarcates the room whose temperature is being regulated. The yellow border is semi-permeable, allowing some of the heat that hits it to escape from the room. This heat disappears from the model once it reaches the edge of the world. A thermometer, indicated by the green square, measures the approximate temperature of the room (effectively, the density of red turtles). The heater is located in the center of the room, represented by a white patch.

It should be noted that use of turtles in this model to represent heat is not intended to be physically realistic. Instead, it is an example where a model is simplified in such a way so as to make another feature of the model more salient. In this case, it is the regulating function of the thermostat that we are primarily concerned with.

HOW TO USE IT

GO: Starts and stops the simulation.
SETUP: Resets the simulation, and sets the initial temperature according to init-temp.
TEMPERATURE: Monitors the temperature in the room, as detected by the green box near the top.
GOAL-TEMP: The thermostat aims to maintain the room at this temperature. It may be adjusted in the middle of a simulation.
HEATER-STRENGTH: The number of red turtles created by the heater in a tick (if the heater is 'on').
INSULATION: The efficiency of the room's insulation, or the rate at which heat escapes from the room. Higher numbers allow less heat to escape; lower number numbers allow more. This may be adjusted during a simulation.
INITIAL-TEMP: The initial temperature of the room. This takes effect only when the SETUP button is pressed.

There is also a plot, which tracks the temperature over time (in red) and the desired temperature (in green).

THINGS TO NOTICE

With some settings, the room cannot be heated to the desired temperature (for example, the room attains a maximum temperature that is lower than the desired temperature). Under what circumstances does this happen?

Look at the plot: does the thermostat do a good job of keeping the temperature at the desired level? If we hold the variables constant, to what factors can we attribute fluctuations of the temperature (in red) over the desired temperature (in green)?

Try adjusting the insulation of the room and the strength of the heater. Do these factors affect the efficiency of the thermostat (i.e. cause the temperature to stay closer or further from the desired temperature)?

Notice that there is a delay from the time the heater is turned on to the time when this added heat reached the thermometer. What are the consequences of this delay?

EXTENDING THE MODEL

The thermostat in this model uses a very simple rule to control the heater based on the temperature. It might be possible to improve the performance of this system by making it 'smarter'. One suggestion is to write a control program that turns the heater on and off before the temperature hits the desired temperature --- this would compensate for the delay mentioned above. Try rewriting the function THERMO-CONTROL. Keep in mind that the only inputs your control function should have are GOAL-TEMP and TEMPERATURE, and the only action should be to either call RUN-HEATER or not. Notice this leaves open the possibility of creating variables to store past information.

Much of observed instability in the temperature might simply be attributed to the thermometer that we are using. The current thermometer takes an average of the number of turtles occupying the green patches over the past ten ticks. Why do you suppose we are measuring the temperature in such a way, instead of simply counting the number of turtles inside the room? Can you design a better thermometer?

This model doesn't account for how the outside temperature (outside the yellow box) could effect the inside temperature. Alter the model so that this now becomes a factor.

The heater in this model puts out heat at a fixed rate, regardless of how long it has been on. Real heaters generally have a warm up period during which time they slowly increase their output, until they reach their maximum rate. Try adjusting the heater in this model to act more like a real heater. How does this affect the behavior or efficiency of the thermostat? How might we alter THERMO-CONTROL to account for this?

Begin a simulation with INITIAL-TEMP set to zero, and notice how long it takes to heat up the room. This means that if we wanted to warm the room up at a certain time it might make sense to turn the heater on beforehand. Introduce time into this model, and try adjusting the thermostat so that it heats the room according to some schedule.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Wilensky, U. (1998). NetLogo Thermostat model. http://ccl.northwestern.edu/netlogo/models/Thermostat. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 1998 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001.

Comments and Questions

HELP (Question)

how would i make the other buttons to control the internaltempature ?

Posted about 8 years ago

Click to Run Model

turtles-own [ new? ]

globals [
  temperature
  temperatures
]

to setup
  clear-all
  set-default-shape turtles "circle"
  set temperature initial-temp
  set temperatures n-values 10 [initial-temp]
  ask patches
  [
    ;; create the thermometer
    if (((abs pxcor) < 5) and
        (pycor < (max-pxcor - 15)) and
        (pycor > (max-pxcor - 25)))
    [ set pcolor green ]
    ;; create the sides of room
    if (((abs pycor) <= (max-pxcor - 7)) and
        ((abs pxcor) =  (max-pxcor - 7)))
    [ set pcolor yellow ]
    ;; create the front and back of room
    if (((abs pycor) =  (max-pxcor - 7)) and
        ((abs pxcor) <= (max-pxcor - 7)))
    [ set pcolor yellow ]
  ]
  ;; create enough turtles to fill room to init-temp temperature
  crt (round (initial-temp * (((world-width - 16) * (world-width - 16)) / 81)))
  [
    set color red
    fd (random-float (max-pxcor - 8))
  ]
  reset-ticks
end 

to go
  ask turtles
  [ circulate-heat ]
  take-temperature
  thermo-control  ;; the control for the thermostat
  tick
end 

to thermo-control
  ifelse (temperature < goal-temp )
  [
    run-heater
    ask patches  ;; show the heater
    [
      if (((distancexy 0 0) <= 2))
      [ set pcolor  white ]
    ]
  ]
  [
    ask patches
    [
      if (((distancexy 0 0) <= 2))  ;; hide the heater
      [ set pcolor black ]
    ]
  ]
end 

to run-heater
  crt heater-strength
  [
    if (new? = 0)
    [ set new? 1 ]
    set color red
  ]
end 

to circulate-heat  ;; turtle procedure
  if (pcolor = yellow)
  [
    ;; to be reflected back into the room, turtles choose a random point
    ;; inside and set their heading in that direction. This diffuses the
    ;; heat evenly around the room.
    if ((random-float insulation) > 1)
    [
      facexy ((random-float (world-width - 13)) - (max-pxcor - 6))
                            ((random-float (world-width - 14)) - (max-pxcor - 6))
    ]
  ]
  fd 1
  if not can-move? 1
  [ die ]
end 

to take-temperature
  set temperatures but-last fput count turtles with [ pcolor = green ] temperatures
  set temperature mean temperatures
end 


; Copyright 1998 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Thermostat Download this version

Attached files

File Type Description Last updated
Thermostat.png preview Preview for 'Thermostat' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.