COVID-19 with social distancing

COVID-19 with social distancing preview image

1 collaborator

Iron_label_brush_2 CJ Castillo (Author)

Tags

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 668 times • Downloaded 20 times • Run 0 times
Download the 'COVID-19 with social distancing' 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

globals[social-distancing-please]
breed[healthys healthy]
;;healthys-own [color shape]
breed[sicks sick]
sicks-own [recovery]
turtles-own [susceptibility job PPE speed] ;;Probability of contracting the disease
;;either citizen, enforcer, health care professional
;; Yes or No. If the human has PPE, his susceptibility decreases.
;;status is either healthy, sick (infected), recovered, carrier (carrier has no symptoms but is infected)

to setup
  clear-all
  reset-ticks
  create-healthys 100 [
    setxy random-xcor random-ycor
    set susceptibility random-float 1
    set shape "person"
    set color green
    set breed healthys
    set job "Citizen"
    set heading random 360
    set speed 0.1
  ]
end 

to infect ;; creates an infection
 create-sicks 1 [
    setxy random-xcor random-ycor
    set heading random 360
    set shape "person"
    set breed sicks
    set color red
    set job "citizen"
    set recovery random-float .5
  ]
 ask one-of healthys [
    set breed sicks
    set color red
    set shape "person"
    set recovery random-float .5
    set speed 0.00001
  ]
end 

to go
  ask turtles [
    let current-turtle self
    forward speed display
    if distance current-turtle < 1 + (count sicks) [
      set heading heading + (random-float 5 - random-float 5)]
  ]
  stay-away
  epidemic
  get-well
  tick
end 

to epidemic
  ask sicks [
    let current-sick self
    ask healthys with [distance current-sick < 1] [
      set breed sicks
      set color red
      set shape "person"
      set recovery random-float 1
      set speed 0.00001
    ]
  ]
end 

to get-well
  ask sicks [
    set recovery recovery + (random-float .5) - (random-float .5)
    if recovery > .8 [
      set breed healthys
      set shape "person"
      set color green
      set speed 0.1
    ]
  ]
end 

to plot-agents
  plot count sicks
  plot count healthys
end 

to stay-away
  ask sicks [
    let current-sick self
    ask healthys with [distance current-sick < (count sicks)] [
      set heading towards current-sick
      set heading heading + 180
    ]
  ]
end 

to turn-away [new-heading max-turn]  ;; turtle procedure
  turn-at-most (subtract-headings heading new-heading) max-turn
end 

to turn-at-most [turn max-turn]  ;; turtle procedure
  ifelse abs turn > max-turn
    [ ifelse turn > 0
        [ rt max-turn ]
        [ lt max-turn ] ]
    [ rt turn ]
end 

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

Attached files

File Type Description Last updated
COVID-19 with social distancing.png preview Preview for 'COVID-19 with social distancing' almost 5 years ago, by CJ Castillo Download

This model does not have any ancestors.

This model does not have any descendants.