Flatten the contagion curve (IT)

Flatten the contagion curve (IT) preview image

1 collaborator

Default-person Guglielmo Celata (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 76 times • Downloaded 9 times • Run 0 times
Download the 'Flatten the contagion curve (IT)' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

turtles-own [
  contagiato?
  contagiato-on
  sick?
  hospital?
  immune?
]
breed [people a-person]
globals [
  pen-color
  exp-risk
  exp-interaction
  max-sick-proportion
  max-hospitalization
  max-hospital-occupation
]

to setup
  ca
  create-people numero-di-persone [
    setxy random-xcor random-ycor
    set contagiato? false
    set sick? false
    set immune? false
    set color blue
    set shape "person"
  ]
  repeat count people * relazioni-medie-per-persona [
    ask one-of people [
      create-link-with min-one-of other people with [not member? self [link-neighbors] of myself] [distance myself]
    ]
  ]
  set exp-interaction 0
end 

to setup-experiment
  reset-ticks
  set max-sick-proportion 0
  set max-hospitalization 0
  set max-hospital-occupation 0
  if exp-interaction != probabilita-di-interazione [
    set pen-color 12 + (6 * probabilita-di-interazione) / 100
  ]
  ask people [
    set contagiato? false
    set immune? false
    set sick? false
    set hospital? false
    set contagiato-on 0
    set color blue
  ]
  set-current-plot "Contagiati"
  create-temporary-plot-pen (word "Interaction: " probabilita-di-interazione)
  set-plot-pen-color pen-color
  plot-pen-down
  set exp-interaction probabilita-di-interazione
  ask one-of people [
    set contagiato? true
    set color 45
    set contagiato-on ticks
  ]
end 

to go
  if not any? turtles with [sick?] and not any? turtles with [contagiato?] [
    plot-pen-up
    plotxy 1 0
    stop
  ]
  ask people with [(contagiato? or sick?) and not hospital?] [
    ask my-links with [random 100 < probabilita-di-interazione] [
      if random 100 < probabilita-di-interazione [
        ask other-end [
          if not contagiato? and not immune? and not sick? [
            set contagiato? true
            set contagiato-on ticks
            set color 45
          ]
        ]
      ]
    ]
  ]
  let current-infection count people with [contagiato? or sick?] / numero-di-persone
  let cur-hospital-occupation count people with [hospital?]
  let cur-require-hospitalization floor ((count people with [sick?] * perc-ospedalizzati) / 100)
  set max-sick-proportion max (list max-sick-proportion current-infection )
  set max-hospitalization max (list max-hospitalization cur-require-hospitalization )
  set max-hospital-occupation max (list max-hospital-occupation cur-hospital-occupation)
  ; At the end of incubation period, person turns sick
  ask people with [contagiato? and (ticks - contagiato-on) > tempo-di-incubazione] [
    set contagiato? false
    set sick? true
    set color red
  ]
  ; Recovery gives infinite immunity
  ask people with [sick? and (ticks - contagiato-on) > (tempo-di-guarigione + tempo-di-incubazione)] [
    set sick? false
    set immune? true
    set hospital? false
    set color gray
  ]
  ; Only some sick persons require hospitalization
  let cur-to-hospital 0
  if (cur-require-hospitalization - cur-hospital-occupation) > 0 [
    set cur-to-hospital cur-require-hospitalization - cur-hospital-occupation
  ]
  ask n-of cur-to-hospital people with [sick?] [
    if cur-hospital-occupation < posti-letto-ospedali [
      set hospital? true
      set color lime
      set cur-hospital-occupation cur-hospital-occupation + 1
    ]
  ]
  plotxy ticks current-infection
  tick
end 

There are 2 versions of this model.

Uploaded by When Description Download
Guglielmo Celata about 4 years ago Default and max number of persons reduced for web simulations Download this version
Guglielmo Celata about 4 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Flatten the contagion curve (IT).png preview Preview for 'Flatten the contagion curve (IT)' about 4 years ago, by Guglielmo Celata Download

This model does not have any ancestors.

This model does not have any descendants.