Kind of like the Omega Syndrome, but with turtles!

This model simulates the spread of an infectious disease traveling via contact through a randomly moving population. The user can draw walls, buildings, or obstacles in the environment to simulate different environments.

A video overview of the model can be found on my YouTube Channel - Complxity Geek.

powered by NetLogo

A working copy of the model can be downloaded from My Google Drive.

WHAT IS IT?

This model simulates the spread of an infectious disease traveling via contact through a randomly moving population. The user can draw walls, buildings, or obstacles in the environment to simulate different environments.

HOW IT WORKS

The agents wander randomly throughout the simulation grid. If a healthy agent occupies a patch with a sick or infected agent, the healthy agent has a chance to become infected. This is controled by the immune-chance slider. A healthy agent that does not become infected, becomes immune. An agent remains infected for a period determined by the incubation-period slider. During this time, the agent is contagious. Once the incubation period ends, the agent becomes sick. Sick agents remain contagious through the length of the disease period (controlled by the disease-period slider). At the end of the disease period, the agent either dies or recovers and becomes immune. This is determined by the terminal-chance slider.

HOW TO USE IT

1. Use the Draw Walls button to create different landscapes for the agents to move around.
2. Set the initial healthy and sick populations.
3. Set the incubation and disease period to desired levels.
4. Set the chance for immunity and terminal illness.
5. Click Setup to populate the simulation grid.
6. Click Go to set the agents in motion.

Note: Click Clear Turtles to remove agents and leave landscape in place. Click Clear All to restart from scratch.

EXTENDING THE MODEL

This model is for infectious disease that spreads via contact. Future models will show the progression of air-borne, food-borne and fixed source contact diseases.

CREDITS AND REFERENCES

This model was developed as a part of research work for The Center for Complexity in Health at Kent State University Ashtabula.

PROCEDURES

;;Infectious Disease Model ver. 1
;;This model simulates the spread of an infectious disease traveling via contact through
;;a randomly moving population.  The user can draw walls, buildings, or obstacles in the
;;environment to simulate different environments.

breed [healthy] ;;Different breeds of turtles to show heatlh state. 
breed [infected]
breed [sick]
breed [immune]
breed [dead]

globals [ ;; Global variables.
  total-healthy
  total-sick
  total-infected
  total-immune
  total-dead
]

turtles-own [  ;; Turtle variables.
  turn-check
  wall-turn-check
  incubate
  sickness
  terminal-check
  immune-check
]

to building-draw ;; Use the mouse to draw buildings.
  if mouse-down?     
    [
      ask patch mouse-xcor mouse-ycor
        [ set pcolor grey ]]
end

to setup  ;; Initialize the model.
  clear-turtles
  pop-check
  setup-agents
  update-globals
  do-plots
end

to go  ;; Run the model.
   disease-check
   repeat 5 [ ask healthy [ fd 0.2 ] display ]
   repeat 5 [ ask infected [ fd 0.2 ] display ]
   repeat 5 [ ask sick [ fd 0.2 ] display ]
   repeat 5 [ ask immune [ fd 0.2 ] display ]
   update-globals
   do-plots
   tick
end


to setup-agents  ;;  Setup the begining number of agents and their initial states.
  set-default-shape healthy "person"
  set-default-shape infected "person"
  set-default-shape sick "person"
  set-default-shape immune "person"
  set-default-shape dead "caterpillar"
  
  ask n-of initial-healthy patches with [pcolor  = black]
     [ sprout-healthy 1
      [ set color blue ] ]
      
  ask n-of initial-sick patches with [pcolor = black]
    [ sprout-sick 1
      [ set color yellow
        set sickness disease-period ] ]
      
end

to disease-check ;;  Check to see if an infected or sick turtle occupies the same patch.
  ask healthy[
    if any? other turtles-here with [color = yellow]
    [infect]
    if any? other turtles-here with [color = pink]
    [infect]
    wander
  ]
  
  ask sick[
    if any? other turtles-here with [color = blue]
    [infect]
    wander
    set sickness sickness - 1
    if sickness = 0
    [live-or-die]
  ]
  
  ask infected[
    if any? other turtles-here with [color = blue]
    [infect]
    wander
    set incubate incubate - 1
    if incubate = 0
    [get-sick]
  ]
  
  ask immune[wander]
  
end

to infect ;;  Infect a healthy turtle, test if it is immune and set the incubation timer if it isn't.
  set immune-check random 100
  ifelse immune-check < immune-chance
  [recover]
  [ask healthy-on patch-here[
    set breed infected
    set incubate incubation-period]
  ask infected-on patch-here [set color pink]]
  
end

to get-sick ;;  Change an infected turtle into an sick turtle and set the disease progression timer.
   set breed sick
   set color yellow
   set sickness disease-period
end

to terminate ;;  Kill a sick turtle who reaches the end of the disease progression and fails the terminal check.
  set breed dead
  set color white
end

to live-or-die ;; Test if the turtle dies from the disease.
  set terminal-check random 100
  ifelse terminal-check < terminal-chance
  [terminate]
  [recover]
end

to recover  ;;  Change turtle breed to immune.
  set breed immune
  set color sky
end


to wander ;; Random movement for agents.
    set turn-check random 20
    if turn-check > 15
    [right-turn]
    if turn-check < 5
    [left-turn]
     if [pcolor] of patch-ahead 1 != black
     [wall]

end

to wall ;;  Turn agent away from wall
    set wall-turn-check random 10
    if wall-turn-check >= 6
    [wall-right-turn]
    if wall-turn-check <= 5
    [wall-left-turn]
end

to wall-right-turn ;;Generate a random degree of turn for the wall sub-routine.
  rt 170
end

to wall-left-turn ;;Generate a random degree of turn for the wall sub-routine.
  lt 170
end
   
to right-turn ;;Generate a random degree of turn for the wander sub-routine.
  rt random-float 10
end

to left-turn   ;;Generate a random degree of turn for the wander sub-routine.
  lt random-float 10
end

to update-globals ;;Set globals to current values for reporters.
  set total-healthy (count healthy)
  set total-infected (count infected)
  set total-sick (count sick)
  set total-immune (count immune)
  set total-dead (count dead)
end

to do-plots ;; Update graph.
  set-current-plot "Population Totals"
  set-current-plot-pen "Healthy"
  plot total-healthy
  set-current-plot-pen "Infected"
  plot total-infected
  set-current-plot-pen "Sick"
  plot total-sick
  set-current-plot-pen "Immune"
  plot total-immune
  set-current-plot-pen "Dead"
  plot total-dead

end
  
to pop-check  ;; Make sure total population does not exceed total number of patches.
  if initial-healthy + initial-sick > count patches
    [ user-message (word "This simulation only has room for " count patches " agents.")
      stop ]
end

; *** NetLogo 4.1 Model Copyright Notice ***
;
; Copyright 2010 by Michael D. Ball.  All rights reserved.
;
; Permission to use, modify or redistribute this model is hereby granted,
; provided that both of the following requirements are followed:
; a) this copyright notice is included.
; b) this model will not be redistributed for profit without permission
;    from Michael D. Ball.
; Contact Michael D. Ball for appropriate licenses for redistribution for
; profit.
;
; To refer to this model in academic publications, please use:
; Ball, M. (2010).  Infectious Disease Model ver. 1.
; http://www.personal.kent.edu/~mdball/netlogo_models.htm.
; The Center for Complexity in Health,
; Kent State University at Ashtabula, Ashtabula, OH.
;
; In other publications, please use:
; Copyright 2010 Michael D. Ball.  All rights reserved.
; See http://www.personal.kent.edu/~mdball/netlogo_models.htm
; for terms of use.
;
; *** End of NetLogo 4.1 Model Copyright Notice ***