Disease
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model simulates the spread of a disease through a population. This population can consist of either students, which are turtles controlled by individual students via the HubNet Client, or turtles that are generated and controlled by NetLogo, called androids, or both androids and students.
Turtles move around, possibly catching an infection. Healthy turtles on the same patch as sick turtles have a INFECTION-CHANCE chance of becoming ill. A plot shows the number of sick turtles at each time tick, and if SHOW-ILL? is on, sick turtles have a red circle attached to their shape.
Initially, all turtles are healthy. A number of turtles equal to INITIAL-NUMBER-SICK become ill when the INFECT button is depressed.
For further documentation, see the Participatory Simulations Guide found at http://ccl.northwestern.edu/ps/
HOW TO USE IT
Quickstart Instructions:
Teacher: Follow these directions to run the HubNet activity. Optional: Zoom In (see Tools in the Menu Bar) Optional: Change any of the settings. If you want to add androids press the CREATE ANDROIDS button. Press the GO button. Everyone: Open up a HubNet client on your machine and type your user name, select this activity and press ENTER. Teacher: Have the students move their turtles around to acquaint themselves with the interface. Press the INFECT button to start the simulation. Everyone: Watch the plot of the number infected. Teacher: To run the activity again with the same group, stop the model by pressing the NetLogo GO button, if it is on. Change any of the settings that you would like. Press the CURE-ALL button to keep the androids, or SETUP to clear them Teacher: Restart the simulation by pressing the NetLogo GO button again. Infect some turtles and continue. Teacher: To start the simulation over with a new group, stop the model by pressing the GO button, if it is on, have all the students log out or press the RESET button in the Control Center, and start these instructions from the beginning
Buttons:
SETUP - returns the model to the starting state, all student turtles are cured and androids are killed. The plot is advanced to start a new run but it is not cleared. CURE-ALL - cures all turtles, androids are kept. The plot is advanced to start a new run but it is not cleared. GO - runs the simulation CREATE ANDROIDS - adds randomly moving turtles to the simulation INFECT - infects INITIAL-NUMBER-SICK turtles in the simulation NEXT >>> - shows the next quick start instruction <<< PREVIOUS - shows the previous quick start instruction RESET INSTRUCTIONS - shows the first quick start instruction
Sliders:
NUMBER - determines how many androids are created by the CREATE ANDROIDS button ANDROID-DELAY - the delay time, in seconds, for android movement - the higher the number, the slower the androids move INITIAL-NUMBER-SICK - the number of turtles that become infected spontaneously when the INFECT button is pressed INFECTION-CHANCE - sets the percentage chance that every tenth of a second a healthy turtle will become sick if it is on the same patch as an infected turtle
Switches:
WANDER? - when on, the androids wander randomly. When off, they sit still SHOW-SICK? - when on, sick turtles add to their original shape a red circle. When off, they can move through the populace unnoticed SHOW-SICK-ON-CLIENTS? - when on, the clients will be told if their turtle is sick or not.
Monitors:
TURTLES - the number of turtles in the simulation NUMBER SICK - the number of turtles that are infected
Plots:
NUMBER SICK - shows the number of sick turtles versus time
Client Information
After logging in, the client interface will appear for the students, and if GO is pressed in NetLogo they will be assigned a turtle which will be described in the YOU ARE A: monitor. And their current location will be shown in the LOCATED AT: monitor. If the student doesn't like their assigned shape and/or color they can hit the CHANGE APPEARANCE button at any time to change to another random appearance.
The SICK? monitor will show one of three values: "true" "false" or "N/A". "N/A" will be shown if the NetLogo SHOW-ILL-ON-CLIENTS? switch is off, otherwise "true" will be shown if your turtle is infected, or "false" will be shown if your turtle is not infected.
The student controls the movement of their turtle with the UP, DOWN, LEFT, and RIGHT buttons and the STEP-SIZE slider. Clicking any of the directional buttons will cause their turtle to move in the respective direction a distance of STEP-SIZE.
THINGS TO NOTICE
No matter how you change the various parameters, the same basic plot shape emerges. After using the model once with the students, ask them how they think the plot will change if you alter a parameter. Altering the initial percentage sick and the infection chance will have different effects on the plot.
THINGS TO TRY
Use the model with the entire class to serve as an introduction to the topic. Then have students use the NetLogo model individually, in a computer lab, to explore the effects of the various parameters. Discuss what they find, observe, and can conclude from this model.
EXTENDING THE MODEL
Currently, the turtles remain sick once they're infected. How would the shape of the plot change if turtles eventually healed? If, after healing, they were immune to the disease, or could still spread the disease, how would the dynamics be altered?
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. and Stroup, W. (1999). NetLogo HubNet Disease model. http://ccl.northwestern.edu/netlogo/models/HubNetDisease. 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 1999 Uri Wilensky and Walter Stroup.
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 activity and associated models and materials were created 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.
Comments and Questions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variable and Breed declarations ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; globals [ run-number ;; variables used to assign unique color and shape to clients shape-names ;; list that holds the names of the non-sick shapes a student's turtle can have colors ;; list that holds the colors used for students' turtles color-names ;; list that holds the names of the colors used for students' turtles used-shape-colors ;; list that holds the shape-color pairs that are already being used max-possible-codes ;; total number of possible unique shape/color combinations ;; quick start instructions variables quick-start ;; current quickstart instruction displayed in the quickstart monitor qs-item ;; index of the current quickstart instruction qs-items ;; list of quickstart instructions num-infected-last-plotted ;; used in plotting only ;; number of turtles that had infected? = true the last time we plotted. ] turtles-own [ infected? ;; if a turtle is sick, infected? is true, otherwise, it is false base-shape ;; original shape of a turtle step-size ;; the amount that a turtle will go forward in the current direction ] breed [ androids android ] ;; created by the CREATE ANDROIDS button; not controlled by anyone, but can become sick and spread sickness breed [ students student ] ;; created and controlled by the clients students-own [ user-id ;; unique id, input by the client when they log in, to identify each student turtle ] ;;;;;;;;;;;;;;;;;;;;;; ;; Setup Procedures ;; ;;;;;;;;;;;;;;;;;;;;;; to startup hubnet-reset setup-vars setup-quick-start reset-ticks end to setup ask androids [ die ] cure-all reset-ticks end ;; heals all sick turtles, clears and sets up the plot, ;; and clears the lists sent to the calculators to cure-all ask turtles [ set infected? false if breed = students [ update-sick?-monitor ] set shape base-shape ] set run-number run-number + 1 reset-ticks end ;; initialize global variables to setup-vars set shape-names ["box" "star" "wheel" "target" "cat" "dog" "butterfly" "leaf" "car" "airplane" "monster" "key" "cow skull" "ghost" "cactus" "moon" "heart"] ;; these colors were chosen with the goal of having colors ;; that are readily distinguishable from each other, and that ;; have names that everyone knows (e.g. no "cyan"!), and that ;; contrast sufficiently with the red infection dots and the ;; gray androids set colors (list white brown green yellow (violet + 1) (sky + 1)) set color-names ["white" "brown" "green" "yellow" "purple" "blue"] set max-possible-codes (length colors * length shape-names) set used-shape-colors [] set run-number 1 end ;; creates turtles that wander at random to make-androids create-androids number [ move-to one-of patches face one-of neighbors4 set color gray set infected? false set base-shape "android" set shape base-shape set step-size 1 ] end ;;;;;;;;;;;;;;;;;;;;;;;; ;; Runtime Procedures ;; ;;;;;;;;;;;;;;;;;;;;;;;; to go ;; get commands and data from the clients listen-clients every 0.1 [ ;;allow the androids to wander around the view if wander? [ androids-wander ] ask turtles with [ infected? ] [ spread-disease ] ;; keeps track of the number of times through the go procedure (if there is at least one turtle infected) ;; use an ifelse here to avoid redundant displays because tick forces a display. ;; we only want to keep track of time once the first turtle has been infected. ifelse count turtles with [infected?] > 0 [ tick ] [ display ] ] end ;; controls the motion of the androids to androids-wander every android-delay [ ask androids [ face one-of neighbors4 fd 1 ] ] end ;; additional check infect called when student moves to new patch ;; added to avoid rewarding movement to student-move-check-infect if infected? [ spread-disease ] ask other turtles-here with [ infected? ] [ ask myself [ maybe-get-sick ] ] end ;; spread disease to other turtles here to spread-disease ask other turtles-here [ maybe-get-sick ] end ;; turtle procedure -- roll the dice and maybe get sick to maybe-get-sick if not infected? [ if ((random 100) + 1) <= infection-chance [ get-sick ] ] end ;; turtle procedure -- set the appropriate variables to make this turtle sick to get-sick set infected? true set-sick-shape if breed = students [ update-sick?-monitor ] end ;; turtle procedure -- change the shape of turtles to its sick shape ;; if show-sick? is true and change the shape to the base-shape if ;; show-sick? is false to set-sick-shape ifelse show-sick? [ ;; we want to check if the turtles shape is already a sick shape ;; to prevent flickering in the turtles if shape != word base-shape " sick" [ set shape word base-shape " sick" ] ] [ ;; we want to check if the turtles shape is already a base-shape ;; to prevent flickering in the turtles if shape != base-shape [ set shape base-shape ] ] end ;; causes the initial infection in the turtle population -- ;; infects a random healthy turtle until the desired number of ;; turtles are infected to infect-turtles let healthy-turtles turtles with [ not infected? ] ifelse count healthy-turtles < initial-number-sick [ ask healthy-turtles [ get-sick set-sick-shape ] user-message "There are no more healthy turtles to infect. Infection stopped." stop ] [ ask n-of initial-number-sick healthy-turtles [ get-sick set-sick-shape ] ] end ;;;;;;;;;;;;;;;;;;;;;;; ;; HubNet Procedures ;; ;;;;;;;;;;;;;;;;;;;;;;; ;; determines which client sent a command, and what the command was to listen-clients while [ hubnet-message-waiting? ] [ hubnet-fetch-message ifelse hubnet-enter-message? [ create-new-student ] [ ifelse hubnet-exit-message? [ remove-student ] [ ask students with [ user-id = hubnet-message-source ] [ execute-command hubnet-message-tag ] ] ] ] ask students [ update-sick?-monitor ] end ;; NetLogo knows what each student turtle is supposed to be ;; doing based on the tag sent by the node: ;; step-size - set the turtle's step-size ;; Up - make the turtle move up by step-size ;; Down - make the turtle move down by step-size ;; Right - make the turtle move right by step-size ;; Left - make the turtle move left by step-size ;; Get a Different Turtle - change the turtle's shape and color to execute-command [command] if command = "step-size" [ set step-size hubnet-message stop ] if command = "Up" [ execute-move 0 stop ] if command = "Down" [ execute-move 180 stop ] if command = "Right" [ execute-move 90 stop ] if command = "Left" [ execute-move 270 stop ] if command = "Change Appearance" [ execute-change-turtle stop ] end ;; Create a turtle, set its shape, color, and position ;; and tell the node what its turtle looks like and where it is to create-new-student create-students 1 [ setup-student-vars send-info-to-clients ;; we want to make sure that the clients all have the same plot ranges, ;; so when somebody logs in, set the plot ranges to themselves so that ;; everybody will have the same size plots. set-plot-y-range plot-y-min plot-y-max set-plot-x-range plot-x-min plot-x-max ] end ;; sets the turtle variables to appropriate initial values to setup-student-vars ;; turtle procedure set user-id hubnet-message-source set-unique-shape-and-color move-to one-of patches face one-of neighbors4 set infected? false set step-size 1 end ;; pick a base-shape and color for the turtle to set-unique-shape-and-color let code random max-possible-codes while [member? code used-shape-colors and count students < max-possible-codes] [ set code random max-possible-codes ] set used-shape-colors (lput code used-shape-colors) set base-shape item (code mod length shape-names) shape-names set shape base-shape set color item (code / length shape-names) colors end ;; report the string version of the turtle's color to-report color-string [color-value] report item (position color-value colors) color-names end ;; sends the appropriate monitor information back to the client to send-info-to-clients hubnet-send user-id "You are a:" (word (color-string color) " " base-shape) hubnet-send user-id "Located at:" (word "(" pxcor "," pycor ")") update-sick?-monitor end to update-sick?-monitor ifelse show-sick-on-clients? [ hubnet-send user-id "Sick?" infected? ] [ hubnet-send user-id "Sick?" "N/A" ] end ;; Kill the turtle, set its shape, color, and position ;; and tell the node what its turtle looks like and where it is to remove-student ask students with [user-id = hubnet-message-source] [ set used-shape-colors remove my-code used-shape-colors die ] end ;; translates a student turtle's shape and color into a code to-report my-code report (position base-shape shape-names) + (length shape-names) * (position color colors) end ;; Cause the students to move forward step-size in new-heading's heading to execute-move [new-heading] set heading new-heading fd step-size hubnet-send user-id "Located at:" (word "(" pxcor "," pycor ")") ;; maybe infect or get infected by turtles on the patch student moved to student-move-check-infect end to execute-change-turtle ask students with [user-id = hubnet-message-source] [ set used-shape-colors remove my-code used-shape-colors show-turtle set-unique-shape-and-color hubnet-send user-id "You are a:" (word (color-string color) " " base-shape) if infected? [ set-sick-shape ] ] end ;;; this procedure is handy for testing out additional shapes and colors; ;;; you can call it from the Command Center to show-gamut ca setup-vars create-ordered-turtles max-possible-codes [ fd max-pxcor * 0.7 if who mod 3 = 0 [ fd max-pxcor * 0.3 ] if who mod 3 = 1 [ fd max-pxcor * 0.15 ] set heading 0 set-unique-shape-and-color ] ask patch 0 0 [ ask patches in-radius 2 [ sprout-androids 1 [ set shape "android" set color gray ] ] ] user-message (word length shape-names " shapes * " length colors " colors = " max-possible-codes " combinations") end ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Quick Start Procedures ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; instructions to quickly setup the model, and clients to run this activity to setup-quick-start set qs-item 0 set qs-items [ "Teacher: Follow these directions to run the HubNet activity." "Optional: Zoom In (see Tools in the Menu Bar)" "Optional: Change any of the settings." "If you want to add androids press the CREATE ANDROIDS button" "Press the GO button." "Everyone: Open up a HubNet Client on your machine and..." "type your user name, select this activity and press ENTER." "Teacher: Have the students move their turtles around to..." "acquaint themselves with the interface." "Press the INFECT button to start the simulation." "Everyone: Watch the plot of the number infected." "Teacher: To run the activity again with the same group,..." "stop the model by pressing the GO button, if it is on." "Change any of the settings that you would like." "Press the CURE-ALL button to keep the androids, or SETUP to clear them" "Teacher: Restart the simulation by pressing the GO button again." "Infect some turtles and continue." "Teacher: To start the simulation over with a new group,..." "stop the model by pressing the GO button, if it is on..." "have all the students log out..." "or press the RESET button in the Control Center" "start these instructions from the beginning" ] 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 ; Copyright 1999 Uri Wilensky and Walter Stroup. ; See Info tab for full copyright and license.
There are 7 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Disease.png | preview | Preview for 'Disease' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.