Covid-19 virus - effects of various measures used to contain its spread
Model was written in NetLogo 6.0.2
•
Viewed 526 times
•
Downloaded 14 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
Click to Run Model
turtles-own [ status ;; either: healthy, contact-infected, contact-healthy, sick or immune ;; infectious-time ;; after being infetious for 14 days, become sick remaining-immunity ;; how many days of immunity the turtle has left contact-time ;; how long since last contact sick-time ;; this determines the point in time when the agent recovers age ;; how old is the turtle quarantined? ;; whether the person is quarantined number-of-links ;; number of links each turtle has ] patches-own [ ] globals [ %infected ;; what % of the population is infectious %immune ;; what % of the population is immune maximum-population ;; keep it the same as the number of people who started. lifespan ;; the lifespan of a turtle initial-ave-links ;; initial average number of links immunity-duration ;; turtle being immune in number of days total-died ;; total number of people died from the virus total-sick ;; total number of people who became sick max-sick ;; the highest number at one time hospitalised number-sick ;; number of sick people at any one moment number-infected ;; number of infeccted people but not sick at any one moment, ie contact-infected status max-number-sick-at-one-time ;; the maximum sick at any one moemnt, hence the max in hospital ] to setup clear-all resize-world 0 (size-of-world - 1) 0 (size-of-world - 1) set-patch-size (500 / max-pxcor) set maximum-population number-people ;; this is to keep the total populace constant even though some will die ;; ================================================== set lifespan 80 * 365.25 ;; life expectancy set to 80 set immunity-duration immunity-duration-yr * 365 ;; remain immune for number of years in days as indicated by immunity-duration-yr set max-number-sick-at-one-time 0 set total-died 0 ;; =================================================== create-turtles number-people [ set status "healthy" set age random lifespan set color green set sick-time 0 set contact-time 0 set remaining-immunity 0 set size 1.5 ;; easier to see set quarantined? false setxy random-xcor random-ycor ] ;; code for number of links ask turtles [make-links] set initial-ave-links count links / count turtles ;; ======================================================================= ;; the next two line is to get the mean of number-of-links of turtles with high number of links ; let max-links-turtles max-n-of 1000 turtles [number-of-links] ; show mean [number-of-links] of max-links-turtles ;; ======================================================================== ask n-of initial-infectious-number turtles [ set status "contact-infected" set infectious-time 1 set color magenta ] reset-ticks if hide-links? = true [ask links [hide-link]] end to go ask turtles [ get-older ;; everybody gets older if status = "healthy" [ reproduce ;; this is to keep population number constant when peole dies ] if status = "contact-healthy" and quarantined? = true [set contact-time contact-time + 1 if contact-time > 14 [ set status "healthy" set quarantined? false ;; since he is healthy, can be released from quarantine make-links ;; after 14 days, and shown to be not sick, can form links agai. set color green set contact-time 0] ] ;; if a contact has not been qurantined, depending on the efficiency in contact tracing and the delay (as measured by contact-time) in qurantine ;; he might be or might not be quarantine. that is determined by a raondom number. if status = "contact-healthy" and quarantined? = false [set contact-time contact-time + 1 if contact-time >= to-quarantine [ if random 100 < contact-tracing [getting-quarantine]] if contact-time > 14 [ set status "healthy" set color green ;; no need to make links as links are still intact since it is not quarantined set contact-time 0] ] if status = "contact-infected" and quarantined? = true [set infectious-time infectious-time + 1 if infectious-time > random 14 [ set status "sick" ;; if infectious-time > max incubation time of 14, but can be shorter set color yellow ask [my-links] of self [die] ;; hospitalised, no longer have links to infect set total-sick total-sick + 1 set sick-time sick-time + 1 ] ] if status = "contact-infected" and quarantined? = false [infect ;; these are the agents who were not quarantined, though infectious. set infectious-time infectious-time + 1 set contact-time contact-time + 1 if contact-time >= to-quarantine [if random 100 < contact-tracing [getting-quarantine]] if infectious-time > random 14 [ set status "sick" ;; if infectious-time > max incubation time of 14, but can be shorter set color yellow ask [my-links] of self [die] ;; hospitalised, no longer have links to infect set total-sick total-sick + 1 set sick-time sick-time + 1 ] ] if status = "sick" [ infect ;; this line of code comes before severing links, as he might infect other first before identified and go to hospital ;; if links are cut already in the previous round, he won't be able to infect others. (See procedure on "to infect" set sick-time sick-time + 1 ask [my-links] of self [die] ;; with links severed, it cannot infect anyone - equivalent of going to hospital if sick-time > random-exponential 14 [recover-or-die] ;; average sick time is 14 days, beween 6 to 42 days. ] if status = "immune" [set color grey ask [my-links] of self [die] set remaining-immunity remaining-immunity - 1 if remaining-immunity <= 0 [get-healthy] ;; no longer immune, and becomes like normal ] ] set number-sick count turtles with [status = "sick"] ;; this show the number sick at any ONE time set %infected (count turtles with [status = "sick"] + count turtles with [status = "contact-infected"]) / count turtles * 100 set %immune count turtles with [status = "immune"] / count turtles * 100 if number-sick > max-number-sick-at-one-time [set max-number-sick-at-one-time number-sick] if count turtles with [status = "sick"] + count turtles with [status = "contact-infected"] = 0 [stop] tick end to get-older set age age + 1 end to make-links ifelse max-number-of-links = 0 [let K exp(ln(random-float 1) / (- gamma)) if K > count turtles with [quarantined? = false] [ set K count turtles with [quarantined? = false] - 1] ;; only those not with quarantined? = true can form links set K round K create-links-with n-of K other turtles set number-of-links K] [let K exp(ln(random-float 1) / (- gamma)) if K > max-number-of-links [ set K max-number-of-links] ;; this will set the upper limit of links set K round K create-links-with n-of K other turtles set number-of-links K] end to reproduce if count turtles < number-people [hatch (number-people - count turtles) [set status "healthy" set age random lifespan set sick-time 0 set remaining-immunity 0 set size 1.5 ;; easier to see set quarantined? false make-links setxy random-xcor random-ycor] ] end to infect ask link-neighbors [ifelse random 100 <= chance-infected [set status "contact-infected" set color magenta set contact-time 1] ;; contact time is set as marker for when he is detected to be a contact [set status "contact-healthy" set color pink - 3 set contact-time 1 ] ;; contact time is set as market for when he is detected to be a contact ] end to getting-quarantine set quarantined? true ask [my-links] of self [die] ;; once the agentis quarantined, he is not linked to anyone end to recover-or-die ifelse random 100 > chance-recover [set total-died total-died + 1 die print total-died] [set status "immune" set color grey set sick-time 0 set contact-time 0 set quarantined? false set remaining-immunity immunity-duration-yr * 365.25 ] end to get-healthy set status "healthy" set color green set sick-time 0 set contact-time 0 set remaining-immunity 0 set quarantined? false make-links end
There is only one version of this model, created over 4 years ago by Ronald Paul Ng.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Covid-19 virus - effects of various measures used to contain its spread.png | preview | Preview for 'Covid-19 virus - effects of various measures used to contain its spread' | over 4 years ago, by Ronald Paul Ng | Download |
This model does not have any ancestors.
This model does not have any descendants.
Pradeesh K V
Very good model (Question)
Thanks for sharing the very good model. I too have developed a model pretty much along the same lines. Hoping to upload the model soon. A question I have is that in the plot you have shown the X-axis in 'weeks'. Whereas your 'tick' appears to be based on days. So how did you convert the day count to week count? Thanks!
Posted over 4 years ago