# Effects of testing and social distancing on the spread of infectious diseases ("Flattening the Curve")

Model was written in NetLogo 6.0.2
•
Viewed 446 times
•
Downloaded 22 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

breed [infecteds infected] breed [susceptibles susceptible] breed [recovereds recovered] infecteds-own [ clock tested? ] turtles-own [neighbours] to setup clear-turtles clear-ticks random-seed seed ;To make sure runs have same initial conditions create-turtles number [setxy random-xcor random-ycor set size 1 ifelse (who < number_sick) [set breed infecteds set clock 0 set tested? False] [set breed susceptibles] recolor ] reset-ticks end to recolor if (breed = susceptibles) [ set color green ] if (breed = infecteds) [ ifelse (tested? = True) [set color yellow] [set color red] ] if (breed = recovereds) [ set color blue ] end to move [dist] ifelse(SD?) [set neighbours other turtles in-radius ((SD_radius)) if (count(neighbours) >= 1) ;Move only if you have neighbours [facexy (mean [xcor] of neighbours) (mean [ycor] of neighbours) rt 180 ; Turn away from the mean x and y co_ordinates of your neighbours fd dist ] ] [rt random-float 360 ;Turn to a random direction fd dist] end to get_infected ;S _> I let sick_neighbours infecteds in-radius max_inf_radius if (breed = susceptibles and count sick_neighbours >= 1) [if ((random-float 1) < (1 - ((1 - transmissibility)^(count(sick_neighbours))))) [set breed infecteds set clock 0 set tested? False] ] end to recover ;I _> R if (clock >= infection_period and (random-float 1 < recovery_rate)) [set breed recovereds] end to lose_immunity ;R _> S if (random-float 1 < susceptibility) [set breed susceptibles] end to advance_clock ;For recovery of infected people set clock (clock + 1) end to runtest if (breed = infecteds) [die] end to test; ifelse (num_to_test <= count(turtles)) [let testsubjects n-of num_to_test turtles ask (testsubjects) [runtest]] [ask (turtles) [runtest]] end to go ask (recovereds) [lose_immunity] ask (susceptibles) [get_infected] ask (infecteds) [advance_clock] ask (infecteds) [recover] ask (turtles) [move 1] ask (turtles) [recolor] if (ticks mod test_freq = 0) [test] tick if (count(infecteds) = 0 or count(infecteds) = count(turtles)) ;Stop if nobody is infected, or everybody is infected [stop] end

There are 2 versions of this model.

## Attached files

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

Effects of testing and social distancing on the spread of infectious diseases ("Flattening the Curve").png | preview | Preview for 'Effects of testing and social distancing on the spread of infectious diseases ("Flattening the Curve")' | almost 3 years ago, by Shikhara Bhat | Download |

This model does not have any ancestors.

This model does not have any descendants.