Covid 19 Contagion Dynamics

Covid 19 Contagion Dynamics preview image

3 collaborators

Perfil150 Santiago Linares (Team member)
Tisnes Adela Tisnes (Team member)

Tags

contagion 

Tagged by Cristian Jimenez Romero almost 4 years ago

forecast 

Tagged by Cristian Jimenez Romero almost 4 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 4265 times • Downloaded 244 times • Run 0 times
Download the 'Covid 19 Contagion Dynamics' 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

About the model

The model presented here is a multi-agent simulation that visualises emerging dynamics from the interaction and influence of a small subset of multiple biological and social factors in the development of the covid-19 pandemic. Given the scale of the pandemic, and the complexity of global societal structures, the simulation may not be viewed as a precise model of universal application. The simulation may however be tailored to locales to enable governments to assess strategic interventions and outcomes at local, municipal and regional levels. In facilitating such analysis, variables that play a critical role in the development of the pandemic have been singled out for manipulation in the model.

Posted almost 4 years ago

Download

If you get any trouble downloading or opening the model please contact me and I will be happy to send you the code via email.

Posted almost 4 years ago

Helping with the model

Hi, I am Olufemi, a PhD student who is still learning NetLogo but I would not mind helping out with the model in any little way I can. Similarly, I am interested in modeling the spread of the disease in Nigeria what with our dismal health sector. Kind Regards, Olufemi

Posted almost 4 years ago

Re. Helping with the model

Hi Olufemi, thanks for your message. It would be very interesting to model the spread of the disease in Nigeria. There is some data that the model would require, including: distribution of population per age group, number of hospital beds per 1000 people, density of population, etc. Please write me a private message on cristianjimenez.org Kind Regards, Cristian

Posted almost 4 years ago

good model (Question)

Very interesting ABM. I would like to apply this kind of model but also looking on economic imbalances on wages, employment, production, etc. I think on the possibilities of merging economic ABM's and contagion dynamics ABM's, in a way to explore the economic consequences of pandemics.

Posted almost 4 years ago

Re. good model

Thanks for your message Emiliano. I you need any help applying or modifying the model for your own applications please let me know. I will be happy to help.

Posted almost 4 years ago

Basemap request (Question) (Question)

The model is fantastic, I am going to apply it to my city (Tandil, Argentina). I would need the file California_outline_white.png to run the model in a specific area. Can you send it to me. Thank you very much and congratulations, a great contribution.

Posted almost 4 years ago

request

i'm an engineering student , really i'm interested by the model , but a don't why i didn't work for me , they told me about import-a and fetch

Posted almost 4 years ago

request

please i need your help this model don't work for me

Posted almost 4 years ago

request

i need the filname used for the p colors

Posted almost 4 years ago

request (Question)

Dear iliasse, About you request Argentina city_map I recently uploaded the Argentina.png file, it is the filename used for the p colors. Regards

Posted almost 4 years ago

question about # people recovered (Question)

Thank you for the extremely interesting model, it is very helpful. I have a question regarding the "# people recovered" field in the monitors on the top. After the model runs for a while, this number sometimes begins to go down. Can you explain what is happening? How can the total # of recovered people since the simulation started go down? Thank you!

Posted almost 4 years ago

question about # people recovered

Hi Aaron, Thanks for your message and for your question. If you set the slider "people_entering_city_per_day" with a value greater than 0 it will cause that new agents enter in the city every day but also some agents already living in the city (including recovered ones) will go away. It will make the counter "# people recovered" to go down. This is something that needs correction in order to keep a cumulative counting of recovered agents. Thank you for spotting this behaviour and raising the question!

Posted almost 4 years ago

downloading the model file (Question)

I am not able to extract the model from downloaded zip file. Can you please send me the model

Posted over 3 years ago

can not open the code

Hello Thanks for sharing! This is a really brilliant and interesting model. But I have trouble to open. the error is that it can not unable to open model with current format. Can you share the code with me Thanks

Posted over 3 years ago

Trying to execute the model

Hi, as my colleages I am having issues running the model, it sends a error about the format. I tried to directly use the code but there are some missing variables like average_days_for_contagion Could you update the model for 6.2? (I also tried with 6.1.1 but same issue) Or give us some guidance to run it? I am very interested on creating a COVID model to study it's behaviour and I'd like to use your model as foundation. Thank you in advance.

Posted about 3 years ago

Trouble while downloading the model. (Question)

Hi, Cristian, Iam really inspired by the model. A lot of appreciation for this amazing work. Bravo!! Iam having an issue while downloading this model, would you like to please send it to iqb.986@gmail.com.

Posted almost 2 years ago

Click to Run Model

breed [humans human]
breed [statistic_agents statistic_agent]

globals [
  age_group_0_9
  age_group_10_19
  age_group_20_29
  age_group_30_39
  age_group_40_49
  age_group_50_59
  age_group_60_69
  age_group_70_79
  age_group_80
  elapsed-day-hours
  medical_care_used
  number_of_deaths
  death_list
  city_area_patches
  roads_area_patches
  change_lockdown_condition?
  cumulative_infected
  last_cumulative
  cumulative_aware_of_infection
  last_cumulative_aware_of_infection
  logged_transmitters
  R0_global
]

humans-own [
  infected?
  infection-length
  aggravated_symptoms_day
  age-group
  ontreatment?
  gotinfection?
  contagion-chance
  death-chance
  ongoing-infection-hours
  symptoms_delay
  aware_of_infection?
  infectedby
]

statistic_agents-own [
  age-group
  recovered
  deaths
]

patches-own [
  original_map_color
]

to-report calculate_R0
  let list_of_transmitters remove-duplicates logged_transmitters
  let current_case 0
  let sum_repetitions 0
  foreach list_of_transmitters [
    patient -> set current_case patient
    let transmitter_repeated length filter [ i -> i = current_case] logged_transmitters
    set sum_repetitions sum_repetitions + transmitter_repeated
  ]
  ifelse length list_of_transmitters > 0 [
    report sum_repetitions / ( length list_of_transmitters )
  ]
  [
    report 0
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;   HUMANS PROCEDURES   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to-report moore-neighborhood
  report humans at-points [[-1 1] [1 1] [-1 -1] [-1 0] [1 0] [0 1] [0 0] [0 -1] [1 -1]]
end 

to infection_exposure
  if (not gotinfection?) [
    let people_around moore-neighborhood
    let infected_around people_around with [infected? = true and not ontreatment? and ( ongoing-infection-hours > (average_days_for_contagion * 24)) ]
    let number_of_infected_around count infected_around
    if number_of_infected_around > 0 [
      let within_contagion_distance (random(metres_per_patch * 2 + 1)) ;; Assuming each patch represents up to metres_per_patch distance units (meters)
      set within_contagion_distance within_contagion_distance + random-float ( keep_social_distancing ) ;; Assuming the ordered social distance is not followed accurately but more randomly and proportionate to the ordered distance
      ;;;;;;;;; Chance of Contagion according to age group:
      if (contagion-chance >= (random(100) + 1) and within_contagion_distance <= maximum_contagion_distance) [
        let transmitter_person nobody
        ask one-of infected_around [ set transmitter_person who ]
        set logged_transmitters lput transmitter_person logged_transmitters
          if length ( logged_transmitters ) > 800 [ ;;Do not allow the list to grow without end, delete older elements.
            set logged_transmitters but-first logged_transmitters
          ]
        get_infected
      ]
    ]

  ]
end 

to get_infected
  set color red
  set size 3
  set infected? true
  set gotinfection? true
  set infection-length 24 * ( random-normal average_infection_length 5.0 ) ;; mean of infection length and standard-deviation multiplied by 24 hours
  set aggravated_symptoms_day round (infection-length / 2.5) ;; Aggravated infection may happen after the first week
  set symptoms_delay 24 * ( random-normal average-symptoms-show 4.0 )
  set ongoing-infection-hours 0
  set cumulative_infected cumulative_infected + 1
end 

to get-healthy
  set infected? false
  set gotinfection? true
  set infection-length 0
  set ongoing-infection-hours 0
  set aggravated_symptoms_day 0
  if ontreatment? [ free-medical-care set ontreatment? false]
  set color green
  set size 1
  set aware_of_infection? false
  update-recovered-statistics age-group
end 

to check_health_state
  if infected? [
    if ongoing-infection-hours >= ( symptoms_delay + random(diagnosis_delay) ) and not ontreatment? [
      if not aware_of_infection? [
        set aware_of_infection? true
        set cumulative_aware_of_infection cumulative_aware_of_infection + 1
      ]
      ifelse prioritise_elderly? [
        ifelse age-group >= age_group_60_69 [
          if get-medical-care = true [
            set ontreatment? true
          ]
        ]
        [
          if %medical-care-availability >= 25 [ ;;If not an elderly person then only take medical care if availability >= 25%
            if get-medical-care = true [
              set ontreatment? true
            ]
          ]
        ]
      ]
      [
        if get-medical-care = true [
          set ontreatment? true
        ]
      ]
    ]
    if (ongoing-infection-hours = aggravated_symptoms_day) ;;Check if patient is going to die
    [
      ;;;;;;;;;; Decide if patient survived or not the infection:
      let chance_to_die 0
      let severity_factor 1
      if ( ( chance_of_severe_infection * 1000 ) >= random(100000) ) [ ;;Patient got a severe infection increasing the death chance by a severity factor
        set severity_factor severity_death_chance_multiplier
      ]
      ifelse (ontreatment?) [
        set chance_to_die ((death-chance * 1000) * severity_factor) * 0.5 ;; Death chance is reduced to 50%, Survival chance is increased by 50%
      ]
      [
        set chance_to_die (death-chance * 1000) * severity_factor
      ]

      if (chance_to_die >= (random(100000) + 1)) [
        update-death-statistics age-group
        set number_of_deaths number_of_deaths + 1
        delete-person
      ]
    ]

    ifelse (ongoing-infection-hours >= infection-length)
    [
      set ongoing-infection-hours 0
      get-healthy
    ]
    [
      set ongoing-infection-hours ongoing-infection-hours + 1
    ]
  ]
end 

to move [ #speed ]
  if not ontreatment?
  [
    rt random-float 360
    let next_patch_color white
    ask patch-ahead 1 [ set next_patch_color original_map_color ]
    if (next_patch_color = white ) [ fd #speed ]
  ]
end 

to delete-person
  if ontreatment? [ free-medical-care ]
  die
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   SETUP PROCEDURES   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to draw_road_lines
  let rows 1
  repeat 8 [
    ask patches with [pxcor > -260 and pxcor < 260 and pycor = -250 + (rows * 60) and pcolor = white ][set pcolor yellow]
    let roads 1
    repeat 3 [
      ask patches with [pxcor = -260 + (rows * 60) + roads and pycor > -250 and pycor < 260 and pcolor = white ][set pcolor yellow]
      set roads roads + 1
    ]
    set rows rows + 1
  ]
end 

to create_city_map
  ask patches with [pxcor > -270 and pxcor < 270 and pycor > -270 and pycor < 260 ] [ set pcolor white ]
  let rows 1
  repeat 8 [
    ask patches with [pxcor > -260 and pxcor < 260 and pycor = -250 + (rows * 60) ][set pcolor yellow]
    let roads 1
    repeat 3 [
      ask patches with [pxcor = -260 + (rows * 60) + roads and pycor > -250 and pycor < 260 ][set pcolor yellow]
      set roads roads + 1
    ]
    set rows rows + 1
  ]
end 

to setup-globals
  ifelse load_city_map? [
    import-pcolors "Argentina_outline.png"
    draw_road_lines
  ]
  [
    create_city_map
  ]
  ask patches [ set original_map_color pcolor ]
  set age_group_0_9 9
  set age_group_10_19 19
  set age_group_20_29 29
  set age_group_30_39 39
  set age_group_40_49 49
  set age_group_50_59 59
  set age_group_60_69 69
  set age_group_70_79 79
  set age_group_80  80
  set elapsed-day-hours 0
  set medical_care_used 0
  set number_of_deaths 0
  set cumulative_infected 0
  set last_cumulative 0
  set city_area_patches patches with [ pcolor != black ]
  set roads_area_patches patches with [ pcolor = yellow ]
  set complete_lockdown? false
  set change_lockdown_condition? false
  set prioritise_elderly? false
  set partial_lockdown? false
  set cumulative_aware_of_infection 0
  set last_cumulative_aware_of_infection 0
  set logged_transmitters[]
  set R0_global 0
end 

to setup_statistic_agent [ #age-group ]
  create-statistic_agents 1
  [
    set age-group #age-group
    set recovered 0
    set deaths 0
    ht
  ]
end 

to setup-people [#number #age-group]
  create-humans #number
    [
      let random_x 0
      let random_y 0
      ask one-of city_area_patches [ set random_x pxcor set random_y pycor ]
      setxy random_x random_y
      set shape "circle"
      set infected? false
      set aggravated_symptoms_day 0
      set ongoing-infection-hours 0
      set color green
      set age-group #age-group
      set ontreatment? false
      set gotinfection? false
      set symptoms_delay 0
      set aware_of_infection? false
      set infectedby nobody

      ifelse age-group <= age_group_0_9 [
        set contagion-chance chance_of_infection_0-9
        set death-chance chance_of_death_0-9
      ]
      [
        ifelse age-group <= age_group_10_19 [
          set contagion-chance chance_of_infection_10-19
          set death-chance chance_of_death_10-19
        ]
        [
          ifelse age-group <= age_group_20_29 [
            set contagion-chance chance_of_infection_20-29
            set death-chance chance_of_death_20-29
          ]
          [
            ifelse age-group <= age_group_30_39 [
              set contagion-chance chance_of_infection_30-39
              set death-chance chance_of_death_30-39
            ]
            [
              ifelse age-group <= age_group_40_49 [
                set contagion-chance chance_of_infection_40-49
                set death-chance chance_of_death_40-49
              ]
              [
                ifelse age-group <= age_group_50_59 [
                  set contagion-chance chance_of_infection_50-59
                  set death-chance chance_of_death_50-59
                ]
                [
                  ifelse age-group <= age_group_60_69 [
                    set contagion-chance chance_of_infection_60-69
                    set death-chance chance_of_death_60-69
                  ]
                  [
                    ifelse age-group <= age_group_70_79 [
                      set contagion-chance chance_of_infection_70-79
                      set death-chance chance_of_death_70-79
                    ]
                    [
                        set contagion-chance chance_of_infection_80
                        set death-chance chance_of_death_80
                    ]
                  ]
                ]
              ]
            ]
          ]

        ]
      ]
     ]
end 

to setup
  clear-all
  ;random-seed 25000000
  setup-globals
  setup-people population_0-9 age_group_0_9
  setup-people population_10-19 age_group_10_19
  setup-people population_20-29 age_group_20_29
  setup-people population_30-39 age_group_30_39
  setup-people population_40-49 age_group_40_49
  setup-people population_50-59 age_group_50_59
  setup-people population_60-69 age_group_60_69
  setup-people population_70-79 age_group_70_79
  setup-people population_80 age_group_80
  let affected_number round (count humans * (initial_infected_population / 100))
  infect_people affected_number

  setup_statistic_agent age_group_0_9
  setup_statistic_agent age_group_10_19
  setup_statistic_agent age_group_20_29
  setup_statistic_agent age_group_30_39
  setup_statistic_agent age_group_40_49
  setup_statistic_agent age_group_50_59
  setup_statistic_agent age_group_60_69
  setup_statistic_agent age_group_70_79
  setup_statistic_agent age_group_80
  reset-ticks
end 

;;;;;;;;;;;;;;;;;;;;;;;;;   ENVIRONMENT - STATISTIC_AGENTS PROCEDURES   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to update-recovered-statistics [ #age-group ]

  ask statistic_agents with [ age-group = #age-group ] [ set recovered recovered + 1 ]
end 

to update-death-statistics [ #age-group ]

  ask statistic_agents with [ age-group = #age-group ] [ set deaths deaths + 1 ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   ENVIRONMENT - HUMAN PROCEDURES   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to infect_people [#affected_number]
  ask n-of #affected_number humans with [ not gotinfection? ] [ get_infected ]
end 

to-report get-medical-care
  if medical_care_used < medical_care_capacity [
    set medical_care_used medical_care_used + 1
    report true
  ]
  report false
end 

to-report %medical-care-availability
  report ( (medical_care_capacity - medical_care_used) / medical_care_capacity ) * 100
end 

to free-medical-care
  set medical_care_used medical_care_used - 1
end 

to people-enter-city [#people_entering #percentage_entering_infected_population]
  let entering_per_age_group #people_entering / 9
  setup-people entering_per_age_group age_group_0_9
  setup-people entering_per_age_group age_group_10_19
  setup-people entering_per_age_group age_group_20_29
  setup-people entering_per_age_group age_group_30_39
  setup-people entering_per_age_group age_group_40_49
  setup-people entering_per_age_group age_group_50_59
  setup-people entering_per_age_group age_group_60_69
  setup-people entering_per_age_group age_group_70_79
  setup-people entering_per_age_group age_group_80
  infect_people #people_entering * #percentage_entering_infected_population / 100
end 

to people-leave-city [#people_leaving]
  ask n-of #people_leaving humans with [not ontreatment?] [ delete-person ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;   SOCIAL INTERACTIONS - HUMANS PROCEDURES   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to gather_in_schools
  if partial_lockdown? [ stop ]
  let gatherings_size 200 ;Students per school 200
  repeat active_schools [
    let place_x 0
    let place_y 0
    ask one-of city_area_patches [ set place_x pxcor set place_y pycor]
    ask up-to-n-of gatherings_size humans with [ ( age-group = age_group_0_9 or age-group = age_group_10_19 ) and not aware_of_infection? ][set xcor place_x - 4 + random(8) set ycor place_y - 4 + random(8) ]
  ]
end 

to gather_in_colleges
  if partial_lockdown? [ stop ]
  let gatherings_size 300 ;Students per college
  repeat active_colleges [
    let place_x 0
    let place_y 0
    ask one-of city_area_patches [ set place_x pxcor set place_y pycor]
    ask up-to-n-of gatherings_size humans with [ age-group = age_group_20_29 and not aware_of_infection? ][set xcor place_x - 4 + random(8) set ycor place_y - 4 + random(8) ]
  ]
end 

to gather_in_hosp_venues
  if partial_lockdown? [ stop ]
  let gatherings_size 40 ;40 people per venue
  repeat active_hosp_venues [
    let place_x 0
    let place_y 0
    ask one-of city_area_patches [ set place_x pxcor set place_y pycor]
    ask up-to-n-of gatherings_size humans with [ not aware_of_infection? ][set xcor place_x - 2 + random(3) set ycor place_y - 2 + random(3) ]
  ]
end 

to gather_in_public_transport_lines
  if partial_lockdown? [ stop ]
  let gatherings_size 60 ;60 people per bus/tram line
  repeat active_public_transport_lines [
    let place_x 0
    let place_y 0
    ask one-of roads_area_patches [ set place_x pxcor set place_y pycor]
    ask up-to-n-of gatherings_size humans with [ not aware_of_infection? ][set xcor place_x - 2 + random(3) set ycor place_y - 4 + random(10) ]
  ]
end 

to gather_in_adult_venues
  if partial_lockdown? [ stop ]
  let gatherings_size 40 ; 40 people per venue
  repeat active_adult_venues [
    let place_x 0
    let place_y 0
    ask one-of city_area_patches [ set place_x pxcor set place_y pycor]
    ask up-to-n-of gatherings_size humans with [ ( age-group != age_group_0_9 and age-group != age_group_10_19 ) and not aware_of_infection? ][set xcor place_x - 2 + random(3) set ycor place_y - 2 + random(3) ]
  ]
end 

to gather_in_senior_venues
  if partial_lockdown? [ stop ]
  let gatherings_size 40 ; 40 people per venue
  repeat active_adult_venues [
    let place_x 0
    let place_y 0
    ask one-of city_area_patches [ set place_x pxcor set place_y pycor]
    ask up-to-n-of gatherings_size humans with [ ( age-group = age_group_60_69 or age-group = age_group_70_79 or age-group = age_group_80 ) and not aware_of_infection? ][set xcor place_x - 2 + random(3) set ycor place_y - 2 + random(3) ]
  ]
end 

to gather_in_food_shops
  if partial_lockdown? [ stop ]
  let gatherings_size 50 ; 50 people in a supermarket, bakery, small shop
  repeat active_adult_venues [
    let place_x 0
    let place_y 0
    ask one-of city_area_patches [ set place_x pxcor set place_y pycor]
    ask up-to-n-of gatherings_size humans with [ age-group != age_group_0_9 and not aware_of_infection? ][set xcor place_x - 2 + random(4) set ycor place_y - 2 + random(4) ]
  ]
end 

to go_back_home
  ask humans with [ not aware_of_infection? ]
  [
    let random_x 0
    let random_y 0
    ask one-of city_area_patches [ set random_x pxcor set random_y pycor ]
    setxy random_x random_y
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;   GO PROCEDURE   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go

  ifelse prioritise_elderly? [
    foreach sort-on [(- age-group)] humans
    [ patient -> ask patient [ check_health_state ] ]
  ]
  [
      ask humans [ check_health_state ]
  ]
  ask humans [
    ;check_health_state
    if elapsed-day-hours > 6  [ infection_exposure ]
    ifelse not complete_lockdown? [ move 1.5 ][ move 0.1 ]
  ]
  ifelse elapsed-day-hours >= 24
  [
    set R0_global calculate_R0
    print cumulative_aware_of_infection
    if log_infection_data? [
      ;let delta_cumulative cumulative_infected / (last_cumulative + 1)
      ;print ( word ceiling (ticks / 24) "," cumulative_infected "," number_of_deaths "," delta_cumulative )
      let delta_cumulative cumulative_aware_of_infection / (last_cumulative_aware_of_infection + 1)
      print ( word ceiling (ticks / 24) "," cumulative_infected "," number_of_deaths "," delta_cumulative )
      set last_cumulative_aware_of_infection cumulative_aware_of_infection
      set last_cumulative cumulative_infected
    ]
    set elapsed-day-hours 1
  ]
  [
    if not complete_lockdown? [
      if elapsed-day-hours mod 7 = 0 [ gather_in_hosp_venues ] ;;3 times a day
      if elapsed-day-hours mod 10 = 0 [ gather_in_food_shops ] ;;2 times a day
      if elapsed-day-hours > 6 and elapsed-day-hours mod 2 = 0 [ gather_in_public_transport_lines ] ;; 8 times a day
      ifelse elapsed-day-hours = 7 [ ;;Rush Hour
         ;;;;; People enter and leave the city once a day:
        people-leave-city people_entering_city_per_day; people_leaving_city_per_day
        people-enter-city people_entering_city_per_day infected_visitors;[#people_entering #percentage_entering_infected_population]
        ;;;;; Gatherings once a day
        gather_in_schools
        gather_in_colleges
        gather_in_senior_venues
      ]
      [
        if elapsed-day-hours = 22 [
          gather_in_adult_venues
        ]
      ]

    ]
    set elapsed-day-hours elapsed-day-hours + 1
  ]
  if change_lockdown_condition? != complete_lockdown? [
    set change_lockdown_condition? complete_lockdown?
    go_back_home
  ]

  tick
end 

to-report %infected
  ifelse any? humans
    [ report (count humans with [infected?] / count humans) * 100 ]
    [ report 0 ]
end 

There are 13 versions of this model.

Uploaded by When Description Download
Cristian Jimenez Romero almost 4 years ago Removed experiment buttons Download this version
Cristian Jimenez Romero almost 4 years ago New version 0.13 including Diagnosis delay Download this version
Cristian Jimenez Romero almost 4 years ago Bug fix in R0 calculation and reporting Download this version
Cristian Jimenez Romero almost 4 years ago Bug fix in R0 calculation Download this version
Cristian Jimenez Romero almost 4 years ago R0 Value calculated during simulation Download this version
Cristian Jimenez Romero almost 4 years ago Reverted to older version Download this version
Cristian Jimenez Romero almost 4 years ago Reverted to older version Download this version
Cristian Jimenez Romero almost 4 years ago Improved interface layout Download this version
Cristian Jimenez Romero almost 4 years ago Reverted to older version Download this version
Cristian Jimenez Romero almost 4 years ago Reverted to older version Download this version
Cristian Jimenez Romero almost 4 years ago Previous file did not open. Download this version
Cristian Jimenez Romero almost 4 years ago Improved interface layout Download this version
Cristian Jimenez Romero almost 4 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Argentina.png png Argentina city_map almost 4 years ago, by Santiago Linares Download
Argentina_outline.png png Argentina Outline Map almost 4 years ago, by Cristian Jimenez Romero Download
Covid 19 Contagion Dynamics.png preview PresentacionArgentina almost 4 years ago, by Cristian Jimenez Romero Download
Covid 19 Contagion Dynamics.png preview Presentacion almost 4 years ago, by Cristian Jimenez Romero Download

This model does not have any ancestors.

This model does not have any descendants.