Olympia Virus Spread
No preview image
Model was written in NetLogo 6.1.0
•
Viewed 124 times
•
Downloaded 13 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
globals [ ; general globals healthy infected dead total-infected ] breed [people person] breed [cities city] ; megacities with over 10 million people breed [infecthalo infects] ; highlights patient zero people-own [ mode ; 0 (human) or "plane" (plane) destination ; for when mode = "plane", decides what city to land at ; infection variables infected? ; true (yes) or 0 (no) time-till-symptoms ; decided by avg.-incubation-period and incubation-period-range symptom-length ; days till recover or die, decided by symptom-length-(lowest/highest) reproductive-ratio ; how many people someone with the disease can spread it to? decided by avg.-reproductive-ratio and reproductive-ratio-range die-from-disease? ; how long till die? true or false (will recover) got-disease? ; if someone gets and recovers from disease, true or 0 (false) ] cities-own [ name population ] extensions [import-a fetch] to Setup ca ; clears everything reset-ticks ; resets clock decide-disease-variables make-cities import-pcolors "oly.png"; image seen in background gets loaded in (must be in same folder) ask patches with [pcolor >= 8.1 and pcolor <= 8.3] [set pcolor 7.8] ; make more patches land ask patches with [pcolor >= 7.2 and pcolor <= 7.5] [set pcolor 7.8] ; make more patches land ask patches with [pcolor = 7.8] [if count neighbors with [pcolor = 7.8] = 0 [set pcolor 7]] ; so turtles don't get stuck on single patches of land ask patches with [pxcor > max-pxcor - 4 or pxcor < min-pxcor + 4 or pcolor = 39.9] [set pcolor 9.9] ; so more of white is water set-default-shape people "person" set-default-shape infecthalo "thin ring" let pre-move 100 while [pre-move > 0] [ ; people move out from cities for (pre-move) number of cycles ask people [move] set pre-move pre-move - 1 ] set healthy count people first-infected ; patient zero setup end to decide-disease-variables ; depending on disease, inputs variables automatically if disease-variables = "COVID-19" [ set patient0-x 0 set patient0-y 0 set fatality-rate 2 set avg.-reproductive-ratio 6 set reproductive-ratio-range 1 set avg.-incubation-period 5 ; set incubation-period-range 5 set symptom-length-lowest 14 set symptom-length-highest 21 set get-again? true ] if disease-variables = "Measles" [ set patient0-x -254 set patient0-y 5 set fatality-rate 10 set avg.-reproductive-ratio 15 set reproductive-ratio-range 3 set avg.-incubation-period 14 set incubation-period-range 14 set symptom-length-lowest 7 set symptom-length-highest 14 set get-again? false ] if disease-variables = "Ebola" [ set patient0-x -9 set patient0-y -55 set fatality-rate 50 set avg.-reproductive-ratio 2 set reproductive-ratio-range .5 set avg.-incubation-period 10 set incubation-period-range 8 set symptom-length-lowest 8 set symptom-length-highest 10 set get-again? false ] end to make-cities create-cities 43 [ set size 3 set shape "circle" set color black set label-color black if who = 0 [ set name "School" set population .0002 setxy 0 0] ; populations rounded to nearest half million if who = 1 [ set name "Armington" set population .0001 setxy 45 -13] if who = 2 [ set name "Seoul" set population .0001 setxy 67 77] if who = 3 [ set name "Shanghai" set population .0001 setxy 86 -37] if who = 4 [ set name "Mumbai" set population .0001 setxy 57 -33] if who = 5 [ set name "Mexico City" set population .0001 setxy -61 -28] if who = 6 [ set name "Beijing" set population .0001 setxy 28 -84] if who = 7 [ set name "Sao Paulo" set population .0001 setxy -42 -33] if who = 8 [ set name "Jakarta" set population .0001 setxy 94 -85] ] let citypop sum [population] of cities let worldpop 7300 / #-people-per-agent ; 7.30 billion people, if each agent = 5mil people, then 1460 agents ask cities [ hatch-people (round ((population / citypop * worldpop) + .02)) [ ; each city creates proportional amount of people based on population set infected? false set color green set size 10 set heading random 360 ] ] end to first-infected ifelse patient0-x = 0 and patient0-y = 0 ; if no patch chosen, [ ask one-of people [ ; ask random person to be infected become-infected make-infecthalo ] ] [ ask patch patient0-x patient0-y [ ; else, ask person closest to patch chosen ask min-one-of people [distance myself] [ become-infected make-infecthalo ] ] ] end to make-infecthalo hatch-infecthalo 1 [ set size 20 ;; Use an RGB color to make halo three fourths transparent set color lput 64 extract-rgb color ;; set thickness of halo to half a patch ;; We create an invisible directed link from the runner ;; to the halo. Using tie means that whenever the ;; runner moves, the halo moves with it. create-link-from myself [ tie hide-link ] ] end ;;=========================================;; to become-infected set infected? true set infected infected + 1 ; updates appropriate globals if got-disease? != true [set total-infected total-infected + 1] set healthy healthy - 1 set color red set time-till-symptoms round (avg.-incubation-period + random-float (.5 * incubation-period-range) - random-float (.5 * incubation-period-range)) ; days until can spread disease set symptom-length symptom-length-highest - round (random-float symptom-length-lowest) ; how long symptoms last until heal or die set reproductive-ratio round (avg.-reproductive-ratio + random-float (.5 * reproductive-ratio-range) - random-float (.5 * reproductive-ratio-range)) ; number of people that infected can infect ifelse random 100 < fatality-rate ; determines if will die from disease [ set die-from-disease? true ] [ set die-from-disease? false ] end to become-healthy set infected? false set healthy healthy + 1 ; updates appropriate globals set infected infected - 1 set color green set got-disease? true end to become-dead set dead dead + 1 ; updates appropriate globals set infected infected - 1 die ; a dead agent ceases to exist end ;;=========================================;; to StartVirus city-selector ; visual to show city name ask people with [mode = 0] [ move if infected? [ ; red person if time-till-symptoms = 0 [ infect if symptom-length = 0 [ ifelse die-from-disease? [ become-dead ] [ become-healthy ] ] if symptom-length > 0 [ set symptom-length symptom-length - 1 ] ] if time-till-symptoms > 0 [ set time-till-symptoms time-till-symptoms - 1 ] ] ] ask people with [mode = "plane"] [ fd 10 if distance destination <= 5 [ ; turn into person if close to city set mode 0 set size 4 move-to destination set destination 0 set shape "person" set heading random 360 ] ] ask cities [ attract airport-run ] ask infecthalo [ if infected != 1 [ die ] ] tick wait .005 end to city-selector ask patch mouse-xcor mouse-ycor [ ; if mouse is over city, display name let x (cities in-radius 3) if any? x [ ask x [ set label name if mouse-down? [; if mouse clicks on city, displays city info clear-output output-print name output-type "Population = " output-type population output-print " million" ] ] ] ask cities with [label != "" and distance myself > 3] [ ; if mouse goes off city that is displaying info, resets set label "" clear-output ] ] end to move if random 2 = 0 [ ; 50% chance to change direction set heading heading + random 20 - random 20 ; change direction ] while [patch-ahead 1 = nobody or [pcolor] of patch-ahead 1 = 9.9] [ ; change direction if water is ahead set heading heading + random 20 - random 20 ] fd 1 ; moves forword a patch per day if distance min-one-of cities [distance myself] > 50 [ ; if too far from cities, face closest city face min-one-of cities [distance myself] ] end to infect let x people in-radius 2 with [infected? = false and mode = 0] ; who can be infected if get-again? = false [ ; if disease cannot infect a person more than once, new restraint set x people in-radius 2 with [infected? = false and mode = 0 and got-disease? = 0] ] if any? x and reproductive-ratio > 0 [ ; if any people to infect and can infect more people ifelse count x <= reproductive-ratio ; if less people to infect than can infect [ ; infect those people and reduce reproductive-ratio set reproductive-ratio reproductive-ratio - count x ask x [ become-infected ] ] [ ; else infect all people possible and set reproductive ratio 0 ask n-of reproductive-ratio x [ become-infected ] set reproductive-ratio 0 ] ] end to attract if count people with [mode = 0] in-radius 5 < population / 10 and count people with [mode = 0] > population / 10[ ; if less people in-radius than population, ask min-n-of (population / 10 - count people with [mode = 0] in-radius 5) people with [mode = 0] [distance myself] [ ; ask closest people to face city face myself ] ] end to airport-run if random 175 = 0 and count people with [mode = 0] in-radius 5 > population / 40 [ ; random chance to create airplane ask one-of people with [mode = 0] in-radius 5 [ set mode "plane" set shape "airplane" set size 5 set destination one-of cities face destination ] ] end
There are 3 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
oly.PNG | png | bg image | over 3 years ago, by Anna Singley | Download |
This model does not have any ancestors.
This model does not have any descendants.