Covid Epidemic

No preview image

1 collaborator

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 228 times • Downloaded 14 times • Run 0 times
Download the 'Covid Epidemic' 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

breed [CITIZENS CITIZEN]

globals[

]
citizens-own [
  is_infected
  remaining_infection
  if_infected_die_prob
  dead
  quarantine
  remaining_infection
  random_infect
  is_infected
  infection_prob
  is_quarantined
  infection_immunity
  infected_neighbours
  is_immuned
  once_infected
  once_quarantined
  under_quarantine
  lim
  recovery_rate
  ]

to setup
  clear-all


  create-citizens 0.7 * count patches [
    set shape "person"
    set random_infect random 100
    set if_infected_die_prob random 100
    set dead 0
    set quarantine random 100
    set is_quarantined 0
    set infection_prob 0
    set infected_neighbours 0
    set infection_immunity random 100
    set is_immuned 0
    set once_infected 0
    set once_quarantined 0
    set under_quarantine 0
    set recovery_rate 1 / days_required_for_healing
    move-to one-of patches with [not any? turtles-here]
    ifelse(random_infect <= initial_infect)
    [set remaining_infection 1
    set is_infected 1
    set color red]
    [set remaining_infection 0
    set is_infected 0
    set color gray]
  ]
 reset-ticks
end 

to update_indection_probability
  set infected_neighbours sum [is_infected] of citizens with [dead = 0 and is_quarantined = 0 and 1 - contamination_period * recovery_rate <= remaining_infection ] in-radius 1
  if(infected_neighbours = 0)
  [set infection_prob  0]
  if(infected_neighbours = 1)
  [set infection_prob  infection_rate]
  if(infected_neighbours = 2)
  [set infection_prob  infection_rate + (1 - infection_rate) *  infection_rate ]
    if(infected_neighbours = 3)
  [set infection_prob  infection_rate + (1 - infection_rate) *  infection_rate + (1 - infection_rate) * (1 - infection_rate) * (infection_rate) ]
    if(infected_neighbours = 4)
  [set infection_prob  infection_rate + (1 - infection_rate) *  infection_rate + (1 - infection_rate) * (1 - infection_rate) * (infection_rate) +
 (1 - infection_rate) * (1 - infection_rate) * (1 - infection_rate) * (infection_rate) ]
   if(infected_neighbours > 4)
  [set infection_prob  1]
end 

to get_infected
  ifelse(infection_prob * 100 >= infection_immunity  and is_infected = 0 and dead = 0 and is_quarantined = 0 and is_immuned = 0)
  [set color red
  set is_infected 1
  set remaining_infection 1
  set once_infected 1]
  [set infection_prob 0
  set infected_neighbours 0]
end 

to get_cured
  if(is_infected = 1 and remaining_infection > recovery_rate and dead < 1)
  [set remaining_infection (remaining_infection - recovery_rate)]
  if(is_infected = 1 and remaining_infection <= recovery_rate and dead < 1)
  [set is_infected 0
  set color green
  set is_immuned 1]
end 

to get_quarantine
  set lim ticks * isolation_policy_toughness
  if(is_immuned = 0 and quarantine <= min list  lim quarantine_threshold and is_quarantined = 0 and ticks > isolation_start_date)
  [set color yellow
    set is_quarantined 1
  set once_quarantined 1]
end 

to get_die
  if(is_infected = 1 and remaining_infection < 1 - recovery_rate * 5 and  if_infected_die_prob <= death_rate)
  [set dead 1
    set is_infected  0
  set color pink]
end 

to move
  if count patches in-radius movement_rate with [not any? turtles-here] > 0
   [move-to one-of patches in-radius movement_rate with [not any? turtles-here]]
end 

to update_under_quarantine
  set under_quarantine under_quarantine + 1
end 

to end_quarantine
  if(under_quarantine >= isolation_duration)[
    set is_quarantined 0
    set under_quarantine 0
    if(is_infected = 1)[
      set color red]
    if(is_immuned = 1)[
      set color green]
    if(is_infected = 0 and is_immuned = 0)
    [set color gray]
  ]
end 

to go
  ask citizens[
    if(dead = 0 and is_quarantined = 0)[
    move
    update_indection_probability
    get_infected
    if(once_quarantined = 0)
      [get_quarantine]
    get_die
    get_cured
    ]
    if(dead = 0 and is_quarantined = 1)[
    get_die
    get_cured
    update_under_quarantine
    end_quarantine
    ]
  ]
  tick
end 







There is only one version of this model, created about 4 years ago by fethi yılmazşamlı.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.