# MIHS - CoronaVirus2.0

Model was written in NetLogo 6.0.2
•
Viewed 183 times
•
Downloaded 17 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 weeks, 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 days ;; cumulative number of days in simulation deaths ;; cumulative number of deaths due to virus lifespan ;; the lifespan of a turtle - the chance of dying when infected is higher for older turtles immunity-duration ;; how many weeks immunity lasts cumulative-age ;; used to calculate average age of population ticks-per-week ] ;; # of ticks to simulate 1 week of time ;; 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 10 are infectious, ;; and distribute them randomly to setup-turtles create-turtles number-people [ setxy random-xcor random-ycor set age ( random average-age + random lifespan * .75 ) ;; age is randomly distributed around the average value if age > lifespan + 30 [ set age lifespan + random 30 ] set cumulative-age cumulative-age + age set sick-time 0 set remaining-immunity 0 set size 1.5 ;; easier to see ;; set label age get-healthy ] ;; calculate average age set cumulative-age cumulative-age / number-people ask n-of 10 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 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 end ;; This sets up basic constants of the model. to setup-constants set lifespan 80 ;; average lifespan is assumed to be 80 years - the chance of dying when infected is higher for older turtles set immunity-duration 52 set ticks-per-week 70 end to go ask turtles [ update-sick-immune move if sick? [ recover-or-die ] if sick? [ infect ] ] 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 ] end to update-display ask turtles [ if shape != turtle-shape [ set shape turtle-shape ] set color ifelse-value sick? [ red ] [ ifelse-value immune? [ green ] [ grey ] ] ] end ;; turtle counting variables are advanced either daily or once per week (i.e. only after ticks-per-week ticks have passed) to update-sick-immune ;; turtle procedure ;; check that 1 day has passed and update sick-time if ticks mod ( ticks-per-week / 7 ) = 0 [ if sick? [ set sick-time sick-time + 1 ] ] ;; check that 1 week has passed and update remaining-immunity if ticks mod ticks-per-week = 0 [ if immune? [ set remaining-immunity remaining-immunity - 1 ] ] end ;; turtles move about at random. to move ;; turtle procedure right random 100 left random 100 forward 1 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 ] ] 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 ;; If the turtle has survived past the virus' duration, then [ ifelse ( random-float 150 * age / lifespan ) < chance-recover ;; either recover or die - older turtles have a lower chance of recovery [ become-immune ] [ set deaths deaths + 1 die ] ] end to-report immune? report remaining-immunity > 0 end to startup setup-constants ;; end ; Copyright 1998 Uri Wilensky. ; See Info tab for full copyright and license.

There is only one version of this model, created over 3 years ago by Larry Bencivengo.

## Attached files

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

MIHS - CoronaVirus2.0.png | preview | Preview for 'MIHS - CoronaVirus2.0' | over 3 years ago, by Larry Bencivengo | Download |

This model does not have any ancestors.

This model does not have any descendants.