Simple SIR (static)

Simple SIR (static) preview image

1 collaborator

Default-person Georgia T (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.4 • Viewed 121 times • Downloaded 9 times • Run 0 times
Download the 'Simple SIR (static)' modelDownload this modelEmbed this model

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

turtles-own
[sick?
 recovered?
 susceptible?
 sick-time
]

globals
[ %infected
  %recovered
  %susceptible
]

to setup
  clear-all
  setup-turtles
  update-global-variables
  ;update-display
  reset-ticks
end 

to setup-turtles
  create-turtles number-people
  [setxy random-xcor random-ycor
    set shape "person"
    set size 1.5
    set sick-time 0
    set sick? 0
    set recovered? 0
    set susceptible? 1
    set color green]
  ask n-of 2 turtles
  [set sick? 1
    set susceptible? 0
  set color red]
end 

to go
  ask turtles [
    move
    age
    if sick? = 1 [recover]
    if sick? = 1 [infect]
  ]
  update-global-variables
  ;update-display
  tick
end 

to update-global-variables
  if count turtles > 0
  [set %infected (count turtles with [sick? = 1] / count turtles) * 100
   set %recovered (count turtles with [recovered? = 1] / count turtles) * 100
    set %susceptible (count turtles with [susceptible? = 1] / count turtles) * 100
  ]
end 

;to update-display
  ;ask turtles
  ;[if shape != turtle-shape [set shape turtle-shape]
  ; ifelse sick? = 1 [set color red] [ifelse recovered? = 1 [set color grey][set color green]]]
;end

to move
  rt random 100
  lt random 100
  fd 1
end 

to infect
  ask other turtles-here with [sick? = 0 and recovered? = 0]
  [if random-float 100 < infectiousness
    [set sick? 1
      set susceptible? 0
  set color red]]
end 

to age
  ask turtles with [sick? = 1]
  [set sick-time sick-time + 1]
end 

to recover
  if sick-time > (duration * 100)
  [if random-float 100 < 100
    [set recovered? 1
    set sick? 0
    set susceptible? 0
    set color grey]
  ]
end 


There is only one version of this model, created about 5 years ago by Georgia T.

Attached files

File Type Description Last updated
Simple SIR (static).png preview Preview for 'Simple SIR (static)' about 5 years ago, by Georgia T Download

This model does not have any ancestors.

This model does not have any descendants.