;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variable declarations ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; globals [ clock ;; the number of times thru the go procedure speed-index ;; the index for speed-list which gives the current speed of each of the turtles max-speed ;; the maximum speed that any molecule will have in a particular run num-speeds ;; the number of speeds for the molecules that were collected ;; quick start instructions variables quick-start ;; the current quickstart instruction displayed in the quickstart monitor qs-item ;; the index of the current quickstart instruction qs-items ;; the list of quickstart instructions speed-frequency-sum-list ;; the list of all the speeds all the turtles have moved thru now ] turtles-own [ speed ;; the speed of this turtle at this time user-id ;; the user-id of the calculator associated with this turtle speed-list ;; the list of all the speeds for this turtle ] ;;;;;;;;;;;;;;;;;;;;; ;; Setup Functions ;; ;;;;;;;;;;;;;;;;;;;;; to startup setup setup-quick-start hubnet-set-client-interface "TI-83+" [ "AAA - People Molecules 1.1" [ "L1" ] ] hubnet-reset end ;; Initializes the display, the plot, and the global variables. to setup cc cp ct clear-all-plots set clock 0 set speed-index 0 set max-speed 0 set num-speeds 0 set speed-frequency-sum-list [] set-default-shape turtles "circle" ask patches with [abs pxcor = screen-edge-x or abs pycor = screen-edge-y] [ set pcolor yellow ] setup-histograms end ;; setups the histogram to have the right pen color, etc. to setup-histograms set-current-plot "Speed Histogram" clear-plot set-histogram-num-bars 20 ;; set the number of bars to be the same as in the calc's histograms end ;; give the user some information about what the setup button does so they can ;; know whether they want to proceed before actually doing the setup to setup-prompt if user-yes-or-no? ("The SETUP button should only be used when starting " + "over with a new group (such as a new set of students) since " + "all data is lost. Use the RE-RUN button for continuing with " + "an existing group." + "\n\nDo you really want to setup the model?") [ user-message "Before closing this dialog, please do the following:" + "\n -Have everyone that is currently logged in, log off and " + "clear the calulator memory. (Press 2nd MEM 7 1 2)" + "\n -Open the teacher console for this activity and press the ERASE ALL DATA button." setup ] end ;; only used in testing- creates some turtles to test the activity to make-test-turtles cct 30 [ init-test-turtles ] set-color ask random-one-of turtles [ set num-speeds length speed-list ] set max-speed max values-from turtles [ max speed-list ] end ;; only used in testing- intializes the turtle's variables to init-test-turtles ;; turtle procedure locals [ index ] set user-id -1 setxy ((random-float (2 * screen-edge-x - 1)) - screen-edge-x + .5) ((random-float (2 * screen-edge-y - 1)) - screen-edge-y + .5) rt random-float 360 set index 0 set speed 0 set speed-list [] repeat 20 [ set speed-list (lput (random-float 5.0) speed-list) set index (index + 1) ] end ;;;;;;;;;;;;;;;;;;;;;;; ;; Runtime Functions ;; ;;;;;;;;;;;;;;;;;;;;;;; ;; receives information from the calculators and runs the simulation to go ;; stop running the simulation if the there are no more speeds in the speed-list if speed-index > num-speeds [ stop ] ;; every time clock is divisible by histogram-display-interval get a new speed and plot the histogram again if clock mod histogram-display-interval = 0 [ update-speed set-color do-histograms ] ;; make the turtles move forward by their current speed ask turtles [ move ] if max values-from turtles [ speed ] < 1 [ wait delay ] set clock (clock + 1) end ;; get the next speed from the speed-list, if there is one to update-speed if speed-index < num-speeds [ ask turtles [ set speed (item speed-index speed-list) ] ] set speed-index (speed-index + 1) end ;; color the turtles based on their speed, make them blue if they are slow, green if they have a medium speed, and red if they are fast ;; note: this range is based on the highest speed in all the turtles speed-list to set-color ask turtles [ ifelse speed <= (max-speed / 3) [ set color blue ] [ ifelse speed > (max-speed / 3) and speed <= (2 * max-speed / 3) [ set color green ] [ set color red ] ] ] end ;; move the turtles forward by their current speed to move ;; turtle procedure locals [ remaining-distance ] set remaining-distance speed ;; while the remaining distance to travel is not 0, move the turtle forward by 1 or the remaining amount if it is less than 1 while [ remaining-distance > 0 ] [ ;; slow the movement down so that it can be seen by the user and scale it so that the fast molecules move quickly and slow molecules move slowly every delay * ( max-speed / speed ) / 10 [ ;; change the heading of the turtle if it is hitting a wall if abs pxcor-of patch-ahead .1 >= screen-edge-x [ set heading (360 - heading) ] if abs pycor-of patch-ahead .1 >= screen-edge-y [ set heading (180 - heading) ] ;; move the turtle forward by 1 if remaining-distance is greater than 1 ifelse remaining-distance > .1 [ fd .1 ] [ fd remaining-distance ] ;; decrement remaining-distance set remaining-distance (remaining-distance - .1) ;; if there are other turtles here, give this turtle a new direction since the molecules hit each other if any? other-turtles-here [ rt random-float 360 ] ] ] end ;; reports the amount of seconds by which to slow the model down to-report delay ifelse simulation-speed <= 0 [ report ln (10 / 0.001) ] [ report ln (10 / simulation-speed) ] end ;; plot the histogram with the appropriate value to do-histograms set-current-plot "Speed Histogram" set-current-plot-pen "speed" ;; on the last time thru, show the cumulative histogram if speed-index > num-speeds [ set cumulative-histogram? true ] ;; put all the turtles' speeds in speed-frequency-sum-list so that we can draw the cumulative histogram ask turtles [ set speed-frequency-sum-list lput speed speed-frequency-sum-list ] ;; if cumulative-histogram? is true, histogram all the values in all the speed-lists up to this point ifelse cumulative-histogram? [ histogram-list speed-frequency-sum-list ] [ histogram-from turtles [ speed ] ] end ;; set certain variables to their appropriate intial values so that the same data can be run another time ;; also resets the histogram to reset set clock 0 set speed-index 0 set speed-frequency-sum-list [] set cumulative-histogram? false ask turtles [ setxy ((random-float (2 * screen-edge-x - 1)) - screen-edge-x + .5) ((random-float (2 * screen-edge-y - 1)) - screen-edge-y + .5) ] setup-histograms end ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Quick Start functions ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; initialize instructions to quickly setup the model, calculators, and TISchool webpage to run this activity to setup-quick-start set qs-item 0 set qs-items [ "Teacher: Follow these directions to setup the HubNet activity." "First, run the physical People Molecules activity by..." "having your students simulate a gas by wearing CBRs set to collect..." "speed information. See Information for details on use of..." "CBR's and how to run the physical People Molecules activity." "Then, run the Navigator activity to collect the data:" "Students: If you used a CBR in the previous activity,..." "login to the calculator that you used." "A histogram of your speed will be displayed." "When finished viewing your histogram, you can view the class'..." "histogram by pressing ENTER followed by the VIEW softkey." "It may be necessary to press the RFSH button to get all the class' data." "Compare your speed distribution with the class' distribution." "Teacher: In the NetLogo activity, the class can view..." "the time evolution of the speed distribution:" "Optional- Zoom In (see Tools in the Menu Bar) - optional" "Press the GET CALC DATA button." "When all the students' have appeared in..." "the NetLogo Graphics Window, press the GO button to..." "play the students' speeds." "To replay the same data-set of speeds, stop the GO button by..." "pressing it again, if it is still depressed." "Press the RE-RUN button, and the GO button once again." "Teacher: To rerun the activity, do not clear the server." "Stop the simulation by pressing the NetLogo GO button." "Students: Collect new data with the CBR's." "Login to each calulator used to collect data." "Teacher: Press the GET CALC DATA button." "When all the students' have appeared in..." "the NetLogo Graphics Window, press the GO button to..." "play the students' speeds." "Teacher: To start the simulation over with a new group,..." "stop the model by pressing the NetLogo GO button, if it is on." "Have everyone, including yourself, logout of their calculators." "Press the ERASE ALL DATA button on the TISCHOOL site." "Press the NetLogo SETUP button." "Follow these instructions from the beginning again." ] set quick-start item qs-item qs-items end ;; view the next item in the quickstart monitor to view-next set qs-item qs-item + 1 if qs-item >= length qs-items [ set qs-item length qs-items - 1 ] set quick-start item qs-item qs-items end ;; view the previous item in the quickstart monitor to view-prev set qs-item qs-item - 1 if qs-item < 0 [ set qs-item 0 ] set quick-start item qs-item qs-items end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Code for interacting with the calculators ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gather data from the calculators, create turtles if necessary, and set some variables if there are turtles to get-student-data while [ hubnet-message-waiting? ] [ hubnet-fetch-message exe-crt hubnet-message-source ] if any? turtles [ set-color ask random-one-of turtles [ set num-speeds length speed-list ] set max-speed max values-from turtles [ max speed-list ] ] end ;; only create a turtle with user-id equalling current-id if one doesn't already exist. ;; then initialize any turtles with user-id equalling current-id with the information from the server to exe-crt [ current-id ] if( not any? turtles with [ user-id = current-id ] ) [ cct 1 [ set user-id current-id ] ] ask turtles with [ user-id = current-id ] [ init-turtle-data ] end ;; initialize turtles to appropriate values to init-turtle-data locals [ index ] setxy ((random-float (2 * screen-edge-x - 1)) - screen-edge-x + .5) ((random-float (2 * screen-edge-y - 1)) - screen-edge-y + .5) rt random-float 360 set index 0 set speed-list [] repeat length hubnet-message [ set speed-list (lput (item index hubnet-message) speed-list) set index (index + 1) ] end ; ***NetLogo Model Copyright Notice*** ; This activity and associated models and materials was created as part of the project: ; PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS. ; The project gratefully acknowledges the support of the ; National Science Foundation ( REPP program ) -- grant number REC #9814682. ; Copyright 1999 by Uri Wilensky & Walter Stroup. Updated 2001,2002. All rights reserved. ; Permission to use, modify or redistribute this model is hereby granted, ; provided that both of the following requirements are followed: ; a) this copyright notice is included. ; b) this model will not be redistributed for profit without permission ; from the copyright holders. ; Contact the copyright holders for appropriate licenses for redistribution for ; profit. ; To refer to this model in academic publications, please use: ; Wilensky, U. & Stroup, W. (1999). NetLogo HubNet People Molecules model. ; http://ccl.northwestern.edu/netlogo/models/HubNetPeopleMolecules. ; Center for Connected Learning and Computer-Based Modeling, ; Northwestern University, Evanston, IL. ; In other publications, please use: ; Copyright 1998 by Uri Wilensky and Walter Stroup. All rights reserved. See ; http://ccl.northwestern.edu/netlogo/models/HubNetPeopleMolecules ; for terms of use. ; ; ***End NetLogo Model Copyright Notice*** @#$#@#$#@ GRAPHICS-WINDOW 236 94 671 550 12 12 17.0 1 12 1 1 1 CC-WINDOW 236 554 662 687 Command Center BUTTON 7 10 69 43 Setup setup-prompt NIL 1 T OBSERVER T BUTTON 126 10 230 43 Get Calc Data get-student-data NIL 1 T OBSERVER T BUTTON 68 49 169 82 Re-Run reset NIL 1 T OBSERVER T BUTTON 45 87 109 120 Go go T 1 T OBSERVER T SLIDER 4 219 232 252 histogram-display-interval histogram-display-interval 1 50 2 1 1 NIL MONITOR 28 128 84 177 clock clock 0 1 PLOT 1 294 235 515 Speed Histogram speed number 0.0 5.0 0.0 15.0 true false PENS "speed" 1.0 1 -65536 true MONITOR 243 10 642 59 Quick Start Instructions (more details in info tab) quick-start 0 1 BUTTON 461 60 539 93 <<< PREV view-prev NIL 1 T OBSERVER T BUTTON 538 60 622 93 NEXT >>> view-next NIL 1 T OBSERVER T BUTTON 259 60 377 93 Reset Instructions setup-quick-start NIL 1 T OBSERVER T BUTTON 119 87 193 120 Go Once go NIL 1 T OBSERVER T SWITCH 4 182 232 215 cumulative-histogram? cumulative-histogram? 1 1 -1000 SLIDER 4 254 232 287 simulation-speed simulation-speed 0 10 9.7 0.1 1 NIL MONITOR 87 128 214 177 num of molecules count turtles 3 1 @#$#@#$#@ WHAT IS IT? ----------- Students emulate gas molecules and collect speed data using CBR's. They can then aggregate this data and replay, in a limited sense, their actions. They can see how the distribution of speeds changes in time, and can use this as a jumping off point for learning about the Maxwell Boltzmann distribution. This activity requires the TI Navigator activity AAA - People Molecules 1.1 For further documentation, see the Participatory Simulations Guide found at http://ccl.northwestern.edu/ps/ HOW TO USE IT ------------- QUICKSTART INSTRUCTIONS: ------------------------ Contains instructions as to how to quickly setup the model, calculators, and TISchool web page so as to run this activity. The instructions can be found below: IMPORTANT: Follow the order described below. If the students run the Navigator activity before collecting their speed data, the Navigator program will crash. Teacher: First, run the physical People Molecules activity by having your students simulate a gas by wearing Calculator Based Rangers (CBR's) set to collect speed information. Divide the class into two sections, one to play the part of a gas molecule and one to hold up poster boards or large sheets of paper (at least 3 ft x 3 ft). The paper or poster boards are to reflect the sound waves emitted from the CBR. There must be enough of the people holding poster boards to be able to form a square large enough for the people holding the CBR's to move around in. Be sure to explain to each group what their role in the simulation is. Have a brief discussion where the students discuss the rules they think the people who are the gas molecules should follow, and what they think they will see. What sort of speed distribution do they expect? If they were to take "snapshots" where they could know everyone's speed at one moment, what would they expect to find? Everyone: If you are playing the part of a molecule, reset the RAM on your calculator (2nd MEM 7 1 2). Connect a CBR to a calculator using a calculator-to-calculator or a calculator-to-CBR linking cable. Download the program to use the CBR by: 1. On the calculator, going to the LINK Menu (by pressing 2nd followed by X,T,theta,n) 2. On the calculator, choosing the RECIEVE Menu (by pressing the RIGHT arrow key) 3. On the calculator, pressing ENTER 4. On the CBR, opening the flap that has the gold Sonic Sensor on it and pressing the 82/83 button Once the RANGER program has been received successfully, run it by pressing the PRGM key and selecting the RANGER program. prgmRANGER should appear on the Home screen of the calculator. Press ENTER. At the RANGER program's main menu, choose SETUP/SAMPLE. Change the DISPLAY to VEL and then select START NOW. If you are holding a sheet of paper or a poster board, form a square surrounding the people using the CBR's. The square should be large enough for the people with the CBR's to be able to move freely in. Once the square is formed around the people who are acting as gas molecules, the people who are simulating the gas molecules should hold the CBR to their chest, with the gold sound panel facing out horizontally. Then they should press ENTER on the calculators and begin simulating gas molecules. Once the physical simulation is done, the students quit the Ranger program by hitting ENTER (to exit the graph view) and then select the QUIT option from the RANGER Main Menu. Information on general use of CBR's can be downloaded from the TI website at http://education.ti.com/product/tech/cbr/down/download.html and clicking on the "Getting Started with CBR" link. Teacher: Now run the Navigator activity to collect the data: Open the TISchool site in your web browser. Enable activity AAA - People Molecules 1.1. Open the teacher console and press the ERASE ALL DATA button. Students who collected speed data with the CBR's: Login to the calculator that you used. A histogram of your speed will be displayed. When finished viewing your histogram, you can view the class' histogram by pressing ENTER followed by the VIEW softkey. It may be necessary to press the RFSH button to get all the class' data. Teacher: In the NetLogo activity, the class can view the time evolution of the speed distribution: If it is not open already, open the NetLogo model. If you are prompted by a Login dialog, enter your teacher id and password and any other necessary information. Optional- Zoom In (see Tools in the Menu Bar) Press the GET CALC DATA button. When all the students' have appeared in the NetLogo Graphics Window, press the GO button to play the students' speeds. To replay the same speeds, stop the GO button by pressing it again, if it is still depressed. Press the RE-RUN button, and the GO button once again. Teacher: To rerun the activity, do not clear the server. Stop the simulation by pressing the NetLogo GO button. Students: Collect new data with the CBR's. Login to each calculator used to collect data. Teacher: Press the GET CALC DATA button. When all the students' have appeared in the NetLogo Graphics Window, press the GO button to play the students' speeds. To start the simulation over with a new group, stop the model by pressing the NetLogo GO button, if it is on. Have everyone, including yourself, logout of their calculators. Press the ERASE ALL DATA button on the TISCHOOL site. Press the NetLogo SETUP button. Follow these instructions from the beginning again. BUTTONS: -------- SETUP - initializes the model GET CALC DATA - this gets the student speed data and creates gas molecules to reenact those speeds GO - runs the simulation by having the gas molecules move at same speed as the students' speeds GO ONCE - runs the simulation by having the gas molecules move thru the next speed in the list of the students' speeds RE-RUN - resets the model to be able to run it again with the same data set of speeds NEXT >>> - shows the next quick start instruction <<< PREVIOUS - shows the previous quick start instruction RESET INSTRUCTIONS - shows the first quick start instruction MONITORS: --------- CLOCK - the number of times thru the GO procedure. Every HISTOGRAM-DISPLAY-INTERVAL the histogram SPEED HISTOGRAM will update NUM OF MOLECULES - displays the number of gas molecules in the Graphics Window PLOTS: ------------- SPEED HISTOGRAM - histograms the speeds of all the gas molecules based on the value of CUMULATIVE-HISTOGRAM? slider SLIDERS: -------- HISTOGRAM-DISPLAY-INTERVAL - the histogram will be updated every this many number of clock ticks SIMULATION-SPEED - how fast the model runs SWITCHES: --------- CUMULATIVE-HISTOGRAM? - if this is true, the plot will histogram the sum of the all the speeds of the gas molecules up to this point. If false, the plot will histogram the speeds of the gas molecules for this histogram interval CALCULATOR INFORMATION ---------------------- TEACHER CALCULATOR: ------------------- Students and teacher have identical calculator programs. STUDENT CALCULATOR: ------------------- The QUIT softkey prompts you to quit the calculator program. Press the YES softkey if you really want to quit, and the NO softkey if you don't. The RFSH softkey collects any additional information from the TI server. It does nothing if there is no addition information. The VIEW softkey toggles between the histogram of all the class's data and the histogram with just the information for this calculator. In the histograms, you can find the values for each of the bars by pressing the RIGHT and LEFT arrow keys. Press ENTER to return to the softkey Menu. THINGS TO NOTICE ---------------- Where is the highest peek in the histogram? The lowest peak? What is the general shape of the histogram? Do the individual histograms resemble the cumulative histogram? THINGS TO TRY ------------- When collecting the data in the physical People Molecules activity, challenge the class to do things like make the gas -get warmer -get colder -increase the pressure of the gas -decrease the pressure of the gas How should these different properties affect the speed histograms? What needs to be done in order to make these properties happen? EXTENDING THE MODEL ------------------- Currently, the People Molecules activity only allows speed data to be collected. Modify the NetLogo model to collect data on distance traveled, and acceleration in addition to speed. CREDITS AND REFERENCES ---------------------- This activity and associated models and materials was created as part of the project: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS. The project gratefully acknowledges the support of the National Science Foundation ( REPP program ) -- grant number REC #9814682. Copyright 1999 by Uri Wilensky & Walter Stroup. Updated 2001,2002. All rights reserved. Permission to use, copy, or modify this software and its associated documentation, models and curricular materials for educational and research purposes only and without fee is hereby granted, provided that this copyright notice and the original authors' names appear on all copies and supporting documentation. For any other uses of this software, in original or modified form, including, but not limited to distribution in whole or in part, specific prior permission must be obtained from Uri Wilensky and Walter Stroup. These programs shall not be used, rewritten, or adapted as the basis of a commercial or hardware product without first obtaining appropriate licenses from Uri Wilensky & Walter Stroup. We make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. To refer to this model in academic publications, please use: Wilensky, U. & Stroup, W. (1999). NetLogo HubNet People Molecules model. http://ccl.northwestern.edu/netlogo/models/HubNetPeopleMolecules. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. In other publications, please use: Copyright 1999 by Uri Wilensky and Walter Stroup. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/HubNetPeopleMolecules for terms of use. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 circle false 0 Circle -7566196 true true 35 35 230 @#$#@#$#@ NetLogo 2.0beta5 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@