SIR_ABM
Model was written in NetLogo 6.1.1
•
Viewed 216 times
•
Downloaded 23 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
undirected-link-breed [ sdist-links sdist-link ] ;; social distance link undirected-link-breed [ halo-links halo-link ] ;; halo link directed-link-breed [ infect-links infect-link ] ;; infection link breed [ peoples people ] breed [ circles circle ] breed [ halos halo ] peoples-own [ infected? ;; if infected? tested? ;; if tested for corona sick? ;; if sick. known? ;; knows if has corona virus: true = tested positive, sick sicktime ;; how long, in weeks, the turtle has been infectious recovered? ;; if recovered dead? ;; if dead age ;; how many weeks old the turtle is ] globals [ infection-radius2 cumulative ] links-own [ ] ;; The setup is divided into four procedures to setup clear-all ; ifelse fix-seed? [random-seed 30281][random-seed new-seed] set infection-radius2 3 ;infection-radius + 2 setup-people update-colors reset-ticks end to setup-people create-peoples number-people [ setxy random-xcor random-ycor ;random-xcor * 0.9 random-ycor * 0.9 set color green set shape "person" set size 1 set infected? false set sick? false set recovered? false ] end to setup-network ask peoples [ create-sdist-links-with other peoples in-radius infection-radius2 [ set hidden? true ] ] end to go move infect update-colors update-global if ticks = 300 [ stop ] if allow-social-distance? [ flex ] tick end to flex ask sdist-links with [link-length > infection-radius2] [die] ask peoples with [color = red] [ create-sdist-links-with other peoples in-radius infection-radius2 [ set hidden? true ] let temp peoples in-radius infection-radius2 if count temp > 1 [layout-spring temp sdist-links 0.2 (infection-radius2 + 2) 0.2] ] end to move ask peoples [ rt random 30 lt random 30 fd 0.1 ] end to infect ; if ticks = 50 [ ; ask one-of turtles with [infected? = false and recovered? = false] ; [ ; set infected? true ; ] ; ] ask infect-links [ die ] ask peoples with [ infected? = true] [ set sicktime sicktime + 1 if sicktime >= (14) [ set recovered? true set infected? false ask halos-here [ die ] ] let whome who ask other peoples with [infected? = false and recovered? = false] in-radius infection-radius2 [ if random 100 < 5 [ create-infect-link-from myself [ set color orange ] set infected? true ] ] ] end to update-colors ask peoples [ if infected? = true [set color red] if recovered? = true [set color gray] ] end to update-global set cumulative max list cumulative (count peoples with [infected? = true]) end
There are 8 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
SIR_ABM.png | preview | Preview for 'SIR_ABM' | over 4 years ago, by Asjad Naqvi | Download |
This model does not have any ancestors.
This model does not have any descendants.