Virus Spread

Virus Spread preview image

1 collaborator

Light_dependent_reaction_background Luke Elissiry (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.1.0 • Viewed 767 times • Downloaded 30 times • Run 0 times
Download the 'Virus Spread' 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 model aims to replicate disease spread of SARS and other diseases using data from previous world outbreaks. Far from realistic, this model is still beneficial for learning how diseases spread and how certain disease traits affect the spread. SARS, or Severe Acute Respiratory Syndrome, is a disease caused by the SARS coronavirus which creates symptoms of fatigue, headaches, sore throat, vomiting, diarrhea, rash, and impaired kidneys and liver. Without medical attention, SARS can lead to death.

HOW IT WORKS

Every tick (day), agents (small green people) move around the world map. Each agent represents the number of people decided by #-people-per-agent (slider in interface tab). Each agent separately changes its course slightly, and, if necessary, will avoid water (white background). To maintain a proportional population spread to that of the earth, agents will stay within a certain distance of the world's megacities (cities with over 10 million people which are depicted as black dots). Patient zero, or the first agent infected, spreads the disease when it comes in contact with other agents. The disease variables, located in the interface tab, decide how each agent will respond to the disease. The newly infected agents subsequently have the ability to spread the disease to others. Airplanes are utilized to simulate the spread of disease across long distances.

HOW TO USE IT

To use the basic model, press the Setup button in the interface tab and then press the Run button. The Setup button will first setup the disease variables, megacities, people, and world map. The model will then distribute the people more evenly throughout the world and decide which agent to make patient zero. The Run button repeats a procedure for the main portion of the model in which the days counter increases, and the agents interact with one another.

To change certain variables found in the interface tab, first change the disease type to default and then change the sliders to the desired value. After changing the variables, pressing Setup button will include the values in the simulation

After the Run button is pressed, the mouse may be used to view details pertaining to the megacities. By hovering over one of the megacities (black dots), the city's name will appear in black. Pressing on the dot will cause the city's details to be revealed in the text display below the model labeled "City Information:".

THINGS TO NOTICE

The day counter on top of the simulation and the year counter to the right of the simulation are for keeping track of time in the model. The bottom left monitor labeled "Total Turtles" displays the number of agents the model creates. The three monitors to the right of the model labeled "Healthy", "Infected", "Dead", and "Total Infected" calculate their values by multiplying the number of agents for each state by #-people-per-agent. These values can be used to create data for an experiment. The graph to the right of those monitors visually displays these "States of Population" over time.

Additionally, the code tab is well documented to give insight on what each section does. This is helpful for understanding specific mechanics behind the model.

EXTENDING THE MODEL

One of the most unrealistic parts of the model is that the agents are not intelligent. They do not avoid infected agents nor do they try to prevent the spread of disease. Adding control methods such as infection quarantine, personal hygiene, cancelling flights, and seeking medical attention is necessary if one aims to realistically model disease spread.

MODEL REFERENCES

Average Annual Miles per Driver by Age Group. (2015, February 20). Retrieved March 23, 2015, from http://www.fhwa.dot.gov/ohim/onh00/bar8.htm

Berkowitz, B., & Gamio, L. (2014, October 14). How quickly Ebola spreads compared to other diseases. Retrieved March 23, 2015, from http://www.washingtonpost.com/wp-srv/special/health/how-ebola-spreads/

Hadjiliadis, D. (2013, January 28). Severe acute respiratory syndrome (SARS): MedlinePlus Medical Encyclopedia. Retrieved March 23, 2015, from http://www.nlm.nih.gov/medlineplus/ency/article/007192.htm

Hardy, R. (2013, January 5). How many people are in the air flying at any given time? Retrieved March 23, 2015, from http://www.quora.com/How-many-people-are-in-the-air-flying-at-any-given-time

ICAO MRTD Report. (n.d.). Retrieved March 23, 2015, from http://www.icao.int/publications/journalsreports/2014/MRTDReportVol9_No3.pdf

Measles. (2015, February 1). Retrieved March 23, 2015, from http://www.who.int/mediacentre/factsheets/fs286/en/

Equator. (n.d.). Retrieved March 23, 2015, from http://education.nationalgeographic.com/education/encyclopedia/equator/?ar_a=1

Math

  • 700,000 * 24 / 2 / 100,000 = about 78 people per flight
  • 7.78 million people per day

  • 24,901 / 711 = 35.0225 mi per patch

  • 13,476 / 365 = 36.9205 mi driven per day -mi per day / mile per patch = 1.0542 patches per day

Comments and Questions

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

Click to Run Model

globals [ ; general globals
  healthy
  infected
  dead
  total-infected
]
breed [people person]
breed [cities city] ; megacities with over 10 million people
breed [infecthalo] ; highlights patient zero
people-own [
  mode ; 0 (human) or "plane" (plane)
  destination ; for when mode = "plane", decides what city to land at
  ; infection variables
  infected? ; true (yes) or 0 (no)
  time-till-symptoms ; decided by avg.-incubation-period and incubation-period-range
  symptom-length ; days till recover or die, decided by symptom-length-(lowest/highest)
  reproductive-ratio ; how many people someone with the disease can spread it to? decided by avg.-reproductive-ratio and reproductive-ratio-range
  die-from-disease? ; how long till die? true or false (will recover)
  got-disease? ; if someone gets and recovers from disease, true or 0 (false)
]
cities-own [
  name
  population
]

to Setup
  ca ; clears everything
  reset-ticks ; resets clock
  decide-disease-variables
  make-cities
  import-pcolors "World Map with Country Borders.png"; image seen in background gets loaded in (must be in same folder)
  ask patches with [pcolor >= 8.1 and pcolor <= 8.3] [set pcolor 7.8] ; make more patches land
  ask patches with [pcolor >= 7.2 and pcolor <= 7.5] [set pcolor 7.8] ; make more patches land
  ask patches with [pcolor = 7.8] [if count neighbors with [pcolor = 7.8] = 0 [set pcolor 7]] ; so turtles don't get stuck on single patches of land
  ask patches with [pxcor > max-pxcor - 4 or pxcor < min-pxcor + 4 or pcolor = 39.9] [set pcolor 9.9] ; so more of white is water
  set-default-shape people "person"
  set-default-shape infecthalo "thin ring"
  let pre-move 100
  while [pre-move > 0] [ ; people move out from cities for (pre-move) number of cycles
    ask people [move]
    set pre-move pre-move - 1
  ]
  set healthy count people
  first-infected ; patient zero setup
end 

to decide-disease-variables ; depending on disease, inputs variables automatically
  if disease-variables = "SARS" [
    set patient0-x 205
    set patient0-y -21
    set fatality-rate 11
    set avg.-reproductive-ratio 2.5
    set reproductive-ratio-range .5
    set avg.-incubation-period 6.4
    set incubation-period-range 5
    set symptom-length-lowest 14
    set symptom-length-highest 24
    set get-again? true
  ]
  if disease-variables = "Measles" [
    set patient0-x -254
    set patient0-y 5
    set fatality-rate 10
    set avg.-reproductive-ratio 15
    set reproductive-ratio-range 3
    set avg.-incubation-period 14
    set incubation-period-range 14
    set symptom-length-lowest 7
    set symptom-length-highest 14
    set get-again? false
  ]
  if disease-variables = "Ebola" [
    set patient0-x -9
    set patient0-y -55
    set fatality-rate 50
    set avg.-reproductive-ratio 2
    set reproductive-ratio-range .5
    set avg.-incubation-period 10
    set incubation-period-range 8
    set symptom-length-lowest 8
    set symptom-length-highest 10
    set get-again? false
  ]
end 

to make-cities
  create-cities 35 [ ; creates the 35 mega-cities in the world (over 10 million population)
    set size 3
    set shape "circle"
    set color black
    set label-color black
    if who = 0 [ set name "Tokyo" set population 38 setxy 257 6] ; populations rounded to nearest half million
    if who = 1 [ set name "New Delhi" set population 27 setxy 135 -13]
    if who = 2 [ set name "Seoul" set population 26 setxy 232 7]
    if who = 3 [ set name "Shanghai" set population 25 setxy 216 -7]
    if who = 4 [ set name "Mumbai" set population 24 setxy 127 -33]
    if who = 5 [ set name "Mexico City" set population 22 setxy -221 -28]
    if who = 6 [ set name "Beijing" set population 22 setxy 208 14]
    if who = 7 [ set name "Sao Paulo" set population 21 setxy -112 -113]
    if who = 8 [ set name "Jakarta" set population 21 setxy 194 -85]
    if who = 9 [ set name "New York City" set population 20 setxy -165 20]
    if who = 10 [ set name "Karachi" set population 20 setxy 115 -19]
    if who = 11 [ set name "Osaka" set population 20 setxy 247 3]
    if who = 12 [ set name "Manila" set population 20 setxy 219 -39]
    if who = 13 [ set name "Cairo" set population 19 setxy 44 -9]
    if who = 14 [ set name "Dhaka" set population 18 setxy 159 -23]
    if who = 15 [ set name "Los Angeles" set population 18 setxy -254 5]
    if who = 16 [ set name "Moscow" set population 17 setxy 49 64]
    if who = 17 [ set name "Buenos Aires" set population 17 setxy -137 -143]
    if who = 18 [ set name "Kolkata" set population 16 setxy 151 -24]
    if who = 19 [ set name "London" set population 16 setxy -22 50]
    if who = 20 [ set name "Bangkok" set population 15 setxy 180 -42]
    if who = 21 [ set name "Lagos" set population 15 setxy -9 -55]
    if who = 22 [ set name "Istanbul" set population 15 setxy 40 16]
    if who = 23 [ set name "Rio de Janeiro" set population 15 setxy -104 -112]
    if who = 24 [ set name "Tehran" set population 14 setxy 83 4]
    if who = 25 [ set name "Guangzhou" set population 13 setxy 205 -21]
    if who = 26 [ set name "Kinshasa" set population 13 setxy 15 -78]
    if who = 27 [ set name "Shenzhen" set population 12 setxy 202 -23]
    if who = 28 [ set name "Lahore" set population 12 setxy 127 -3]
    if who = 29 [ set name "Rhine-Ruhr" set population 11 setxy -4 48]
    if who = 30 [ set name "Tianjin" set population 11 setxy 211 9]
    if who = 31 [ set name "Bengaluru" set population 11 setxy 133 -44]
    if who = 32 [ set name "Paris" set population 11 setxy -14 38]
    if who = 33 [ set name "Chennai" set population 10 setxy 136 -43]
    if who = 34 [ set name "Hyderabad" set population 10 setxy 134 -37]
  ]
  let citypop sum [population] of cities
  let worldpop 7300 / #-people-per-agent ; 7.30 billion people, if each agent = 5mil people, then 1460 agents
  ask cities [
    hatch-people (round ((population / citypop * worldpop) + .02)) [ ; each city creates proportional amount of people based on population
      set infected? false
      set color green
      set size 1
      set heading random 360
    ]
  ]
end 

to first-infected
  ifelse patient0-x = 0 and patient0-y = 0 ; if no patch chosen,
  [
    ask one-of people [ ; ask random person to be infected
      become-infected
      make-infecthalo
    ]
  ]
  [
    ask patch patient0-x patient0-y [ ; else, ask person closest to patch chosen
      ask min-one-of people [distance myself] [
        become-infected
        make-infecthalo
      ]
    ]
  ]
end 

to make-infecthalo
  hatch-infecthalo 1 [
    set size 10
    ;; Use an RGB color to make halo three fourths transparent
    set color lput 64 extract-rgb color
    ;; set thickness of halo to half a patch
    __set-line-thickness 2
    ;; We create an invisible directed link from the runner
    ;; to the halo.  Using tie means that whenever the
    ;; runner moves, the halo moves with it.
    create-link-from myself [
      tie
      hide-link
    ]
  ]
end 

;;=========================================;;

to become-infected
  set infected? true
  set infected infected + 1 ; updates appropriate globals
  if got-disease? != true [set total-infected total-infected + 1]
  set healthy healthy - 1
  set color red
  set time-till-symptoms round (avg.-incubation-period + random-float (.5 * incubation-period-range) - random-float (.5 * incubation-period-range)) ; days until can spread disease
  set symptom-length symptom-length-highest - round (random-float symptom-length-lowest) ; how long symptoms last until heal or die
  set reproductive-ratio round (avg.-reproductive-ratio + random-float (.5 * reproductive-ratio-range) - random-float (.5 * reproductive-ratio-range)) ; number of people that infected can infect
  ifelse random 100 < fatality-rate ; determines if will die from disease
  [
    set die-from-disease? true
  ]
  [
    set die-from-disease? false
  ]
end 

to become-healthy
  set infected? false
  set healthy healthy + 1 ; updates appropriate globals
  set infected infected - 1
  set color green
  set got-disease? true
end 

to become-dead
  set dead dead + 1 ; updates appropriate globals
  set infected infected - 1
  die ; a dead agent ceases to exist
end 

;;=========================================;;

to StartVirus
  city-selector ; visual to show city name
  ask people with [mode = 0] [
    move
    if infected? [ ; red person
      if time-till-symptoms = 0 [
        infect
        if symptom-length = 0 [
          ifelse die-from-disease?
          [
            become-dead
          ]
          [
            become-healthy
          ]
        ]
        if symptom-length > 0 [
          set symptom-length symptom-length - 1
        ]
      ]
      if time-till-symptoms > 0 [
        set time-till-symptoms time-till-symptoms - 1
      ]
    ]
  ]
  ask people with [mode = "plane"] [
    fd 1
    if distance destination <= 5 [ ; turn into person if close to city
      set mode 0
      set size 1
      move-to destination
      set destination 0
      set shape "person"
      set heading random 360
    ]
  ]
  ask cities [
    attract
    airport-run
  ]
  ask infecthalo [
    if infected != 1 [
      die
    ]
  ]
  tick
  wait .005
end 

to city-selector
  ask patch mouse-xcor mouse-ycor [ ; if mouse is over city, display name
    let x (cities in-radius 3)
    if any? x [
      ask x [
        set label name
        if mouse-down? [; if mouse clicks on city, displays city info
          clear-output
          output-print name
          output-type "Population = " output-type population output-print " million"
        ]
      ]
    ]
    ask cities with [label != "" and distance myself > 3] [ ; if mouse goes off city that is displaying info, resets
      set label ""
      clear-output
    ]
  ]
end 

to move
  if random 2 = 0 [ ; 50% chance to change direction
    set heading heading + random 20 - random 20 ; change direction
  ]
  while [patch-ahead 1 = nobody or [pcolor] of patch-ahead 1 = 9.9] [ ; change direction if water is ahead
    set heading heading + random 20 - random 20
  ]
  fd 1 ; moves forword a patch per day
  if distance min-one-of cities [distance myself] > 50 [ ; if too far from cities, face closest city
    face min-one-of cities [distance myself]
  ]
end 

to infect
  let x people in-radius 2 with [infected? = false and mode = 0] ; who can be infected
  if get-again? = false [ ; if disease cannot infect a person more than once, new restraint
    set x people in-radius 2 with [infected? = false and mode = 0 and got-disease? = 0]
  ]
  if any? x and reproductive-ratio > 0 [ ; if any people to infect and can infect more people
    ifelse count x <= reproductive-ratio ; if less people to infect than can infect
    [ ; infect those people and reduce reproductive-ratio
      set reproductive-ratio reproductive-ratio - count x
      ask x [
        become-infected
      ]
    ]
    [ ; else infect all people possible and set reproductive ratio 0
      ask n-of reproductive-ratio x [
        become-infected
      ]
      set reproductive-ratio 0
    ]
  ]
end 

to attract
  if count people with [mode = 0] in-radius 5 < population / 10  and count people with [mode = 0] > population / 10[ ; if less people in-radius than population,
    ask min-n-of (population / 10 - count people with [mode = 0] in-radius 5) people with [mode = 0] [distance myself] [ ; ask closest people to face city
      face myself
    ]
  ]
end 

to airport-run
  if random 175 = 0 and count people with [mode = 0] in-radius 5 > population / 10[ ; random chance to create airplane
    ask one-of people with [mode = 0] in-radius 5 [
      set mode "plane"
      set shape "airplane"
      set size 5
      set destination one-of cities
      face destination
    ]
  ]
end 

There is only one version of this model, created almost 5 years ago by Luke Elissiry.

Attached files

File Type Description Last updated
Virus Spread.png preview Preview for 'Virus Spread' almost 5 years ago, by Luke Elissiry Download
World Map with Country Borders.png png World Map used in Model - MAKE SURE TO INSTALL IN SAME FOLDER almost 5 years ago, by Luke Elissiry Download

This model does not have any ancestors.

This model does not have any descendants.