disease propagatiion model

disease propagatiion model preview image

1 collaborator

Tags

covid19 

Tagged by Bernhard Diermaier over 5 years ago

disease control 

Tagged by Bernhard Diermaier over 5 years ago

humans carry disease 

Tagged by Bernhard Diermaier over 5 years ago

infectious disease model 

Tagged by Bernhard Diermaier over 5 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 627 times • Downloaded 48 times • Run 0 times
Download the 'disease propagatiion model' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

( This multi-agent simulation is a simple generic model on the spreading of a disease like #corona in 2020. Its purpose is to show the behavior of an epidemic disease propagation within a population. It is not suitable for quantitaive prognosis, but should rather allow users to get an idea of different propagation patterns, not only by varying disease-related parameters like infection radius, infection probability, infection paths (human to human, environment to human), but also the impact of personal behavior (mobility range of agents, potential contacts with other agents per day), and of counter measures (for the time being only to quarantine patients) to slow down the disease. )

HOW IT WORKS

( In the beginning of each simulation run, agents have the status "healthy", and one or more "patients zero" are placed on the playing field. On Pressing the "go" button, agents start moving around the playing field, having a certain number of "social contacts" with other agents. Potential "social contacts" are represented by the number of steps an agent makes each day. The average range of the single steps can be tuned in via the respective slider. Healthy agents can infect themselves via a direct way (human-to-human), or, if the switch "contamination?" is active, via an indirect (environment-to-humen) infection paths, according to a respective probability as tuned in via sliders. Infections of healthy agents can only occur, if there is at least one infectuous agent within a tuned in "infection radius", or if the agent is on a patch that has been contaminated by an infectuous agent before. Therefore, agents check for human-2-human as well as environment-to-human infection after each single step. Infectuous agents can, as mentioned, also contaminate patches they are on. Contamination of patches last to the end of the actual day. Once an agent is infected, its individual course of disease is set: duration of incubation time (status "infected"), the time span of the agent's infectivity before entering the acute stadium of the disease, as well as the duration of the acute stadium (status "sick"). The agent's status is set to infected, and once it is infectuous, it starts to infect other agents by performing abovementioned steps and to contaminate the patches it moves to. After the moving- and infection procedures are run through, the status the agents is updated: infected agents (yellow) update their infectivity status (orange) or switch to status "sick" (acute stadium, red), sick agents check if thex die according to their individual mortality, or switch their status to recovered (green). If the switch "containment?" is active, sick agents go to quarantine: therefore, they stop their movement on the playing field, and draw a cordon sanitaire of blue patches around themselves, which is avoided by all non-sick agents. If a sick agent dies or recovers, its cordon sanitaire is deleted. )

HOW TO USE IT

(

To run the simulation, (1) set simulation parameters via sliders and switches (see 2. settings), (2) press tue setup-button to set up the playing field, and start the simulation by (3) pressing the "go" button. The "go once"-button will run one simulation day, while pressing the go button will run the simulation will until there are no more infected or sick agents on the playing field.

1 buttons

1.1 "setup" runs the setup procedure. It prepares the playing field by creating a number of healthy agents and infecting the "patiens zero". 1.2 "go" runs the simulation. The simulation stops, as soon as there are no more infected and / or sick agents on the playing field. 1.3 "go once" runs the simulation for one round, which represents one day in the simulation.

2 settings

2.1 disease related settings 2.1.1 slider "incubationtime" sets the average time between infection and acute stadium of the disease. standard deviation is 0.3 * avg. [days] 2.1.2 slider "sicktime" sets the average duration of the acute stadium of the disease. standard deviation is 0.3 * avg. [days] 2.1.3 slider "ibs" sets the time of infectivity within the incubation time, BEFORE the acute stadium. next biggest integer from random between 0 and set value * 1.2. [days] 2.1.4 switch "immunity?" sets permanent immunity of recovered agents. 2.1.5 slider "immuity_duration" sets the avg duration of immunity after recovery.

2.2 infection related settings 2.2.1 slider "infection radius" sets the maximum distance two agents can have to each other for an infection event to be successful. 2.2.2 slider "H2Hinfection" sets the probability for success of human-to-human infection events. 2.2.3 switch "envcontamination" enables contamination of patches by infectuous agents. 2.2.4 Slider "Econtamination" sets the probability for an infectuous agent to contaminate a patch. Contaminated patches turn clean in the end of each day. 2.2.5 slider "E2Hinfection" sets the probability for success of environment-to-human infection events.

2.3 agent related setings 2.3.1 slider "population" sets the number of agents that is created during setup procedure. 2.3.2 slider "initialinfections" sets the number of "patients zero" that are infected during setup procedure. 2.3.3 slider "mobility" sets the average distance an agent moves during each step 2.3.4 slider "stepsper_round" sets the number of steps, each agent makes per day. Each step represents a potential "social contacts" per day. Agents check for infection- and contamination-events each step. 2.3.5 switch "containment?" enables quarantine of sick agents. Quarantined agents stop moving and draw a cordon sanitaire areound temselves, that is avoided by all other agents.Quarantine ends, when an agent recovers.

3 monitors & charts

3.1 monitor "Days" displays the simulation-internal time since start of the simulation run. 3.2 chart "new infections - new acute cases - new recoveries per day" display the new infections and acute cases per day. Also, the number of new human-to-human and environment-2-human infection events per day is shown here. 3.3 chart "global infected - global acute cases" displays the actual numbers of globally cumulated infected and acute cases as well as the number of infectuous agents on te playing field. 3.4 chart "global healthy - global recovered --- total H2H- and E2H infections - total body count" shows the actual number of healthy and recovered agents on the playing field as well as the cumulated total number of human-to-human and environment-to-human infection events as well as the total number of agents died from the disease

)

CREDITS AND REFERENCES

This multi-agemt-simulation has been created an programmed by B. Diermaier A big "Thank You" to Jörg Walter for testing, finding bugs and providing ideas and inputs!

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [          ;; definition of global variables
  day_counter      ;; counter
  bodycount        ;; counter for agents dying from disease
  new_infections   ;; counter for daily new infections
  new_sick         ;; counter for daily new sick agents
  new_recovered        ;; counter for daily new recovered agents
  new_h2h
  new_e2h
  new_bodycount
  total_h2h
  total_e2h
]

patches-own [       ;; definition of patch-related variables
  contamination?    ;; patch contaminated w/ virus: true/false
  cont_timer        ;; counter for duration of patch contamination
]

turtles-own [      ;; definition of agent-related variables
  age              ;; age of agent; random 0...90
  status           ;; health status of agent: healthy...infected...sick...recovered
  mortality        ;; mortality rate by age in case of infection
  daily_mortality  ;; daily mortality over duration of acute stadium
  inc_timer        ;; counter for duration of infection
  sick_timer       ;; counter for duration of acute stadium
  infectuous_timer ;; counter for duration if infectivity before acute stadium
  immune_timer     ;; counter for duration of immunity after sickness
  infectuous?      ;; agent infectuous?? true/false
  quarantine?      ;; sick agent under quarantine? true/false
]


;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Setup of playing field ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup
  clear-all
  crt population [                      ;; creation of agents
    set shape "circle"
    set color white
    set size 1
    set xcor random-xcor
    set ycor random-ycor
    set age random 90
    ifelse age >= 65 [                 ;; agents' mortality in case of infection, depending on agents' age
      set mortality 0.1
    ][
      ifelse age < 65 and age >= 35 [
        set mortality 0.01
      ][
        set mortality 0.005
      ]
    ]
    set inc_timer 0
    set status "healthy"
    set immune_timer 0
    set infectuous? false
    set quarantine? false
  ]

  ask patches [                         ;; preparation of patches on playing field
    set pcolor black
    set contamination? false
    set cont_timer 0
  ]

  set new_infections 0                 ;; global variables set to 0
  set new_sick 0
  set new_recovered 0
  set new_h2h 0
  set new_e2h 0
  set total_h2h 0
  set total_e2h 0
  set new_bodycount 0
  set bodycount 0

  ask n-of initial_infections turtles [                ;; infection of tuned in number of "patients zero"
    set status "infected"
    set color yellow
    set inc_timer round (abs (random-normal incubation_time (incubation_time * 0.5)))                  ;; incubation- sick- and infectivity-counter set to values according to sliders in GUI
    set sick_timer round (abs (random-normal sick_time (sick_time * 0.5)))
    set infectuous_timer (min (list (inc_timer) (random i_b_s)))
    set new_infections new_infections + 1
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the procedure "go" is the actual framework of the simulation, within which different procedures of agents and patches are organized ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go

  contain                                   ;; procedure "contain" is called (see further down)
  repeat (steps_per_round) [                ;; via the repetition according to slider "steps per round", the number of potentitial social contacts is simulated
    move                                  ;; non-quarantined agents start moving around...
    infect                                ;; ... and once in place, each of them calls the procedure "infect"
    if env_contamination? [               ;; in case "contamination" in the GUI is on, procedure "contaminate is called to carry out human-2-environment contamination events
      contaminate
    ]
  ]
  evolve                                                     ;; procedure "evolve" are called... (see further down)
  set day_counter day_counter + 1                            ;; "day" counter is increased by one
  update-plots                                               ;; plots are being updated
  set new_infections 0                                       ;; counters for daily infection data are reset
  set new_sick 0
  set new_recovered 0
  set new_h2h 0
  set new_e2h 0
  set new_bodycount 0
  if ( count turtles with [status = "infected"] = 0 ) and ( count turtles with [status = "sick"] = 0 ) [     ;; simulation is interrupted, if there are no more infected or sick agents on the playing field
    stop
  ]
  ;;contain
end 

to move
  ask turtles with [quarantine? = false] [                   ;; non-quarantined Agents move around on the playing field
    let reach random-normal mobility mobility / 3            ;; mobility range for each step via slider "mobility
    rt random 360
    while [ [pcolor] of patch-ahead reach = blue] [          ;; blue patches (cordon sanitaire around sick agents) shall be avoided
      set reach reach + 5]
    fd reach
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; agents check for human-2-human (and environment-2-human) infection events ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to infect
  ask turtles with [status = "healthy"] [                                       ;; "healthy" agents check for infectuous agents within the infection radius...
    let a count turtles in-radius infection_radius with [infectuous?]
    if random-float 1 <= (H2H_infection * a) [                                    ;; ...and check for human-to-human infection events according to infection probability and number of infected agents within infection radius
      set status "infected"
      set color yellow
      set inc_timer round (abs (random-normal incubation_time (incubation_time * 0.3)))             ;; individual incubation time...
      set sick_timer round (abs (random-normal sick_time (sick_time * 0.3)))                         ;; ... as well as individual duration of acute phase...
      set infectuous_timer (min (list (inc_timer) ceiling (1.2 * random i_b_s)))  ;; ... and the individual infectivity before outbreak of sickness are set
      set new_infections new_infections + 1
      set new_h2h new_h2h + 1
      set total_h2h total_h2h + 1
    ]
    if [contamination?] of patch-here = true and random-float 1 <= E2H_infection [                     ;; if their patch is contaminated, they check for environment-to-human infection according to the respective infection probability
      set status "infected"
      set color yellow
      set inc_timer round (abs (random-normal incubation_time (incubation_time * 0.3)))                  ;; incubation- sick- and infectivity-counter set to values according to sliders in GUI
      set sick_timer round (abs (random-normal sick_time (sick_time * 0.3)))
      set infectuous_timer (min (list (inc_timer) ceiling (1.2 * random i_b_s)))
      set new_infections new_infections + 1
      set new_e2h new_e2h + 1
      set total_e2h total_e2h + 1
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; patches check for human-2-environment contamination events ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to contaminate
  ask patches [
    if any? turtles-here with [status = "infected"] and random-float 1 <= E_contamination [      ;; contamination event according to contamination probability
      set contamination? true
      set cont_timer 1
      set pcolor grey                                                                            ;; contaminated patches are marked grey
    ]
  ]
end 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; agents individually check for necessity of quarantine measures ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to contain
  if containment? = true[
    ask turtles with [quarantine? = true] [    ;; in case the quarantine-marker is active, agents draw a cordon sanitaire of blue patches around themselves...
      ask patches in-radius (1.1 * infection_radius) [
        set pcolor blue
      ]
    ]
    ask turtles with [quarantine? = false] [   ;; ... and non-quarantined agents move off the blue patches
      while [ [pcolor] of patch-here = blue] [
        fd 5
      ]
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the procedure "evolve" prepares the agents and patches for the upcoming simulation round ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to evolve
  if immunity? = false [                                           ;; time for immunity after acute phase is limited, if switch is inactive.
    ask turtles with [status = "recovered"] [
      ifelse immune_timer > 0 [
        set immune_timer immune_timer - 1
      ][
        set status "healthy"
        set color white
        set mortality mortality / 3
        set inc_timer 0
        set immune_timer 0
        set infectuous? false
        set quarantine? false
      ]
    ]
  ]
  ask turtles with [status = "sick"] [                          ;; sick agents ceck, if they die from the disease within the acute stadium (sick timer > 0)...
    ifelse sick_timer = 0 [                                  ;; if the sick timer reaches zero, the agent can switch off the cordon sanitaire (set patches back to black)...
      set_back_patches
      set status "recovered"                ;; and set their status to "recovered", which also makes them immune to new infections
      set new_recovered new_recovered + 1
      set color green
      if immunity? = false [
        set immune_timer round (abs (random-normal immunity_duration (immunity_duration * 0.2)))
      ]
      set infectuous? false
      set quarantine? false

    ][
      set sick_timer max (list (0) (sick_timer - 1))                             ;; ... but first, the sich timer counts down by one...
      if random-float 1 <= daily_mortality [                    ;; ... and in case of bad luck, switch off their cordon sanitaire...
        set_back_patches
        set bodycount bodycount + 1                            ;; ...update the body count, and die
        set new_bodycount new_bodycount + 1
        die
      ]
    ]
  ]


  ask turtles with [status = "infected"] [                      ;; first, infected agents update their infectivity status and update counters related to their course of infection
    if inc_timer <= infectuous_timer [
      set infectuous? true
      set infectuous? true
      set color orange
    ]
    if inc_timer = 0 [                                          ;; then, they check for a status update from "infected" to "sick" (the acute stadium)
      set status "sick"
      set new_sick new_sick + 1
      set color red
      set daily_mortality mortality / max (list (1) (sick_timer))
      if containment? = true [                                  ;; quarantine marker is only set "true", if "containment" switch in GUI is activated
        set quarantine? true
      ]
    ]
    if inc_timer > 0 [
      set inc_timer max (list (inc_timer - 1) (0))                  ;; counter for course of infection is updated
    ]
  ]
  ask patches with [contamination? = true] [               ;; contamination timers of each contaminated patch count down by 1...
    ifelse cont_timer > 0 [
      set cont_timer max (list (0) (cont_timer - 1))
    ][                                                     ;; in case the timer is zero, contamination is switched off and tach color is set back to black
      set contamination? false
      set pcolor black
    ]
  ]
end 

to set_back_patches
  ask patches in-radius (1.1 * infection_radius) [
    set pcolor black
  ]
end 

There is only one version of this model, created over 5 years ago by Bernhard Diermaier.

Attached files

File Type Description Last updated
disease propagatiion model.png preview Preview for 'disease propagatiion model' over 5 years ago, by Bernhard Diermaier Download

This model does not have any ancestors.

This model does not have any descendants.