Effects of Masks on Covid Spread
Model was written in NetLogo 6.1.1
•
Viewed 366 times
•
Downloaded 18 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
globals [ max-infected cumulative-output daily-delta total-infected avg-daily-delta total-delta moving-average day-1 day-2 day-3 day-4 day-5 transmissibility ] turtles-own[ infected? immune? mask? dead? ] to setup clear-all set-patch-size (275 / max-pxcor) setup-turtles setup-infected setup-unmasked set max-infected (count turtles with [infected?]) set cumulative-output (0) set transmissibility (1) reset-ticks end to setup-turtles create-turtles num-people [ set color blue set shape "person" set size 2 set infected? false set immune? false set mask? true set dead? false setxy random-pxcor random-pycor ] end to setup-unmasked ask n-of ((percent-unmasked / 100) * num-people) turtles [ set color white set mask? false ] end to setup-infected ask n-of init-infected turtles [ set infected? true ifelse mask? [set color red] [set color orange] ] end to go ;;stop if everyone or noone is infected ;;if (count turtles with [infected? and not dead?] = 0) ;;or (count turtles with [infected?] = num-people) infect-susceptibles recover-infected death recolor move-normal calculate-max-infected calculate-daily-delta if ticks > 0 [calculate-avg-daily-delta] calculate-total-infected recolor calculate-moving-average tick end to infect-susceptibles ;; S -> I ask turtles with [not infected? and not immune?][ let infected-masked-neighbors (count turtles-here with [infected? and mask?]) if (random-float 1 < 1 - (((1 - masked-transmissibility) ^ infected-masked-neighbors))) [set infected? true] let infected-neighbors (count turtles-here with [infected? and not mask?]) if (random-float 1 < 1 - (((1 - transmissibility) ^ infected-neighbors))) [set infected? true] ;let infected-neighbors (count other turtles with [infected?] in-radius 1) ; if (random-float 1 < 1 - (((1 - transmissibility) ^ infected-neighbors)) and not immune?) ;[set infected? true] ] end to recolor ask turtles with [infected? and not dead? and mask?] [ set color red] ask turtles with [infected? and not dead? and not mask?] [ set color orange] ask turtles with [mask? and not infected?] [set color blue] ask turtles with [not mask? and not infected?] [set color white] ask turtles with [immune?] [set color gray] ask turtles with [dead?] [ set color pink] end to move-normal ask turtles with [not dead?] [ right random 360 ;;get a new random heading forward random sociability ] end to recover-infected ;;I -> R ;;avg case length is 2 weeks. ;;should have 50% chance of becoming immune at 2 weeks ;;if we are saying each tick equals 1 day, ;;daily odds of recovering should be (1-x)^14=.5, x= 0.0483 ask turtles with [infected? and not dead?] [ if random-float 1 < 0.0483 [ set infected? false ifelse are-survivors-immune? [ set immune? true set color gray ] [set color white] ] ] end to death ;;avg case length is 2 weeks. ;;1% of infected die, ;;if we are saying each tick equals 1 day, ;;and 1% of sick patients should be dead at 2 weeks ;;daily mortality should be (1-x)^14=.99, x= 0.000717624 ask turtles with [infected?] [ if random-float 1 < 0.000717624 [set dead? true set color pink set infected? false ] ] end to calculate-max-infected let x (count turtles with [infected? and not dead?]) if x > max-infected [set max-infected x] end to calculate-total-infected set total-infected ((count turtles with [infected? and not dead?])) end to calculate-daily-delta set daily-delta (count turtles with [infected? and not dead?] - total-infected) end to calculate-avg-daily-delta let y (daily-delta) set total-delta (total-delta + y) set avg-daily-delta (total-delta / ticks) end to calculate-moving-average set day-1 (day-2) set day-2 (day-3) set day-3 (day-4) set day-4 (day-5) set day-5 (daily-delta) if (ticks > 4) [ set moving-average ((day-1 + day-2 + day-3 + day-4 + day-5) / 5) ] end to-report total-adjusted-output report cumulative-output / (num-people * 2 * (ticks)) end to-report max-infected-prop report max-infected / num-people end to-report prop-dead let y (count turtles with [dead?]) report y / num-people end to-report prop-uninfected report (count turtles with [not infected? and not immune?]) / num-people end
There is only one version of this model, created over 4 years ago by Alex Brown.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Effects of Masks on Covid Spread.png | preview | Preview for 'Effects of Masks on Covid Spread' | over 4 years ago, by Alex Brown | Download |
This model does not have any ancestors.
This model does not have any descendants.