# Covid-19 variation on the theme

No preview image

Model was written in NetLogo 6.0.3
•
Viewed 119 times
•
Downloaded 3 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

Please start the discussion about this model!
(You'll first need to log in.)

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 age ] ;; how many weeks old the turtle is globals [ %infected ;; what % of the population is infectious %immune ;; what % of the population is immune max-%infected ;; maximun % infected population reached (at the peak) peak ;; day of the peak alive ;; total population alive that tick now-infected ;; number of people infected at the current day immune ;; number of people immune at the present day total-infected ;; total infected from the beginning 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 ;; The setup is divided into four procedures to setup clear-all reset-ticks 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 if age < 10 * 52 * 7 [set color blue] if age > 60 * 52 * 7 [set color yellow] set size .7 ;; easier to see get-healthy ] ask n-of init-infected turtles [ get-sick ] set total-infected (count turtles with [sick?]) end to get-sick ;; turtle procedure set sick? true set remaining-immunity 0 set total-infected (total-infected + 1) end to get-healthy ;; turtle procedure set sick? false set remaining-immunity 0 set sick-time 0 end to become-immune ;; turtle procedure set sick? 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.005 ;; birth rate per 1000 people per day set immunity-duration 52 * 7 if Weather = "Hot-Humid" [set chance-recover .98] if Weather = "Hot-Dry" [set chance-recover .96] if Weather = "Cold-Dry" [set chance-recover .95] if Weather = "Cold-Humid" [set chance-recover .94] end to go if all? turtles [not sick?] [stop] ask turtles [ get-older move if sick? [ recover-or-die ] ifelse sick? [ infect ] [ reproduce ] ] update-global-variables update-display tick 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 set alive (count turtles) set now-infected (count turtles with [sick?]) set immune (count turtles with [immune?]) if %infected > max-%infected [set peak ticks + 1] if %infected > max-%infected [set max-%infected %infected] ;;set peak ticks + 1] ] 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 ] ] ] 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 .93] if age < 60 * 52 * 7 [ set chance-recover .97] 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 fd mobility 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 100 < 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 sick-time > duration * 7 ;; If the turtle has survived past the virus' duration, then [ ifelse random-float 100 < chance-recover * 100 ;; either recover or die [ become-immune ] [ 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 100 < 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 ; Copyright 1998 Uri Wilensky. ; See Info tab for full copyright and license.

There are 2 versions of this model.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

COVID_19_DaVig view.png | png | view | 5 months ago, by Davide Vignoni | Download |

Screenshot_2020-04-14_14:34:54.png | png | screenshot | 5 months ago, by Davide Vignoni | Download |

This model does not have any ancestors.

This model does not have any descendants.