COVID_19 spread with movement rules
Model was written in NetLogo 6.1.1
•
Viewed 1352 times
•
Downloaded 111 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Info tab cannot be displayed because of an encoding error
Comments and Questions
Click to Run Model
turtles-own [ sick? ;; if true, the turtle is infectious remaining-immunity ;; how many weeks of immunity the turtle has left sick-time ;; how long, in days, the turtle has been infectious movement-turtles ;; movement of each turtle sick-symptoms? ;; if true, the turtle is infectouss and knows it days_sick age ] ;; how many weeks old the turtle is globals [ %infected ;; what % of the population is infectious %immune ;; what % of the population is immune lifespan ;; the lifespan of a turtle chance-reproduce ;; the probability of a turtle generating an offspring each tick chance-recover ;; the probability of recovery at each tick ; carrying-capacity ;; the number of turtles that can be in the world at one time immunity-duration ;; how many weeks immunity lasts ; sick-not-know-min ;; how many days a person could be sick without notice ; sick-not-know-max number-people number-dead ] ;; how many turtles die ;; The setup is divided into four procedures to setup clear-all setup-constants setup-turtles update-global-variables update-display reset-ticks end ;; We create a variable number of turtles of which 1 are infectious, ;; and distribute them randomly to setup-turtles create-turtles number-people [ setxy random-xcor random-ycor set age random lifespan set sick-time 0 set remaining-immunity 0 set size .7 ;; easier to see get-healthy ] ask n-of 1 turtles [ get-sick ] end to get-sick ;; turtle procedure set sick? true set remaining-immunity 0 end to get-healthy ;; turtle procedure set sick? false set sick-symptoms? sick? set remaining-immunity 0 set sick-time 0 end to become-immune ;; turtle procedure set sick? false set sick-symptoms? false set sick-time 0 set remaining-immunity immunity-duration ask my-links [ die ] ;; remove link to turtle who infected us, if there was one end ;; This sets up basic constants of the model. to setup-constants set lifespan 80 * 52 * 7 ;; 80 times 52 weeks times 7 days = 50 years = 2600 weeks old = 18200 days ; set carrying-capacity 1000 set chance-reproduce 0.34 ;; birth rate per 1000 people per week ifelse inmune [set immunity-duration 10000] [set immunity-duration 4 * 7] ;; 4 weeks for immunity duration if Weather = "Hot-Humid" [set infectiousness .9 * infectiousness] if Weather = "Hot-Dry" [set infectiousness .95 * infectiousness] if Weather = "Cold-Dry" [set infectiousness .97 * infectiousness] if Weather = "Cold-Humid" [set infectiousness infectiousness] set number-people carrying-capacity ; set sick-not-know-min 4 ; set sick-not-know-max 14 end to go visitor-infected ask turtles [ get-older ifelse (age > 60 * 52 * 7) [set movement-turtles (movement * alpha)] [set movement-turtles movement] quarantine days-sick move if sick? [ recover-or-die ] ifelse sick? [ infect ] [ reproduce ] ] update-global-variables update-display tick if ticks = time-stop [stop] end to days-sick ifelse sick? [set days_sick days_sick + 1] [set days_sick 0] if ( days_sick > ( sick-not-know-min + 1 + random sick-not-know-max ) ) [set sick-symptoms? true ] end to update-global-variables if count turtles > 0 [ set %infected (count turtles with [ sick? ] / count turtles) * 100 set %immune (count turtles with [ immune? ] / count turtles) * 100 ] end to update-display ask turtles [ if shape != turtle-shape [ set shape turtle-shape ] set label ifelse-value show-age? [ floor (age / 364) ] [ "" ] set color ifelse-value sick? [ red ] [ ifelse-value immune? [ grey ] [ green ] ] if age < 10 * 52 * 7 [set color blue] if age > 60 * 52 * 7 [set color yellow] ] stop-inspecting-dead-agents if watch-a-person? and subject = nobody [ watch one-of turtles with [ not hidden? ] clear-drawing ask subject [ pen-down ] inspect subject ] if not watch-a-person? and subject != nobody [ stop-inspecting subject ask subject [ pen-up ask my-links [ die ] ] clear-drawing reset-perspective ] ask patches [ if Weather = "Hot-Humid" [set pcolor 68] if Weather = "Hot-Dry" [set pcolor 48] if Weather = "Cold-Dry" [set pcolor 38] if Weather = "Cold-Humid" [set pcolor 108] ] end ;;Turtle counting variables are advanced. to get-older ;; turtle procedure ;; Turtles die of old age once their age exceeds the ;; lifespan (set at 80 years in this model). set age age + 1 if age > lifespan [ die ] if age > 60 * 52 * 7 [ set chance-recover .95] if age < 60 * 52 * 7 [ set chance-recover .98] if immune? [ set remaining-immunity remaining-immunity - 1 ] if sick? [ set sick-time sick-time + 1 ] end ;; Turtles move about at random. to move ;; turtle procedure rt random 100 lt random 100 move-infected fd movement-turtles ; check if agents can be steady when they know that they're infected (1 period after) end ;; If a turtle is sick, it infects other turtles on the same patch. ;; Immune turtles don't get sick. to infect ;; turtle procedure ask other turtles-here with [ not sick? and not immune? ] [ if random-float 1000 < infectiousness [ get-sick if self = subject ;; if its the watched turtle getting sick [ create-link-with myself ;; create a link with the one that infected it [ set color red set thickness .3 ] ] ] ] end ;; Once the turtle has been sick long enough, it ;; either recovers (and becomes immune) or it dies. to recover-or-die ;; turtle procedure if age > 60 * 52 * 7 [ set chance-recover .90] if age < 60 * 52 * 7 [ set chance-recover .97] if sick-time > duration ;; If the turtle has survived past the virus' duration, then [ ifelse random-float 1 < chance-recover ;; either recover or die [ become-immune ] [ set number-dead number-dead + 1 die ]] end ;; If there are less turtles than the carrying-capacity ;; then turtles can reproduce. to reproduce if count turtles < carrying-capacity and random-float 1 < chance-reproduce [ hatch 1 [ set age 1 lt 45 fd 1 pen-up ;; in case we're hatched from the watched turtle get-healthy ] ] end to-report immune? report remaining-immunity > 0 end to startup setup-constants ;; so that carrying-capacity can be used as upper bound of number-people slider end to move-infected ifelse sick-symptoms? [set movement-turtles movement-turtles / 2] [set movement-turtles movement-turtles] end to visitor-infected if (random-float 1 < prob_infected) [crt 1 [setxy random-xcor random-ycor set age random lifespan set sick-symptoms? false set sick-time 0 set remaining-immunity 0 set size .7 ;; easier to see get-sick]] if ( count turtles > number-people ) [ ask one-of turtles [die]] end to quarantine if ( count turtles with [ sick-symptoms? ] > threshold-quarantine ) [set movement-turtles movement / 10] end ; Copyright 1998 Uri Wilensky. ; See Info tab for full copyright and license.
There are 10 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
COVID_19 spread with movement rules.png | preview | preview | over 4 years ago, by Emiliano Alvarez | Download |
Parent: COVID_19 Spread
This model does not have any descendants.
Giovani Thies
File doesn't open. Either In Zip, 7zip or explorer.
It is possible a new file? or... there are some tip to decompress the file? thanks, Giovani - Brazil
Posted over 4 years ago
Emiliano Alvarez
Answer to Giovani
Hi, You can unzip the model via Terminal (using Linux), type: unzip \*.zip \\\ On Windows OS, Modeling Commons zip files have drawbacks. \\\ Search for a zip extractor online, like https://extract.me/ or others. \\\ Thanks, Emiliano.
Posted over 4 years ago
Eric Gladstone
Question Regarding the Modeling of Network Hubs (Question)
Hi I wanted to demonstrate how important network hubs (areas of high density) are in transmitting Covid. Namely, to show people why going camping in large groups of people, and then going to a local hub (grocery story, etc), completely defeats the point of social distancing.
Posted over 4 years ago
Emiliano Alvarez
response to Eric
Well, one possible modification is to increase the density of agents (for example, from 1500 to 5000 agents). It's similar to percolation models (one example to look is "fire model" in netlogo). Another improvement would be to set agents regarding xy (for example, more density when x&rt;0 and y&rt;0). Thanks, Emiliano
Posted over 4 years ago