Child of CoVid19-abm

Child of CoVid19-abm preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Child of model CoVid19-abm preview imageCoVid19-abm
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 176 times • Downloaded 15 times • Run 0 times
Download the 'Child of CoVid19-abm' 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

extensions[shell py csv nw]

globals[
  dd ;mean desease duration
  trigger-pop; threshold of population for starting qurantine
  sr?; initialize social restriction
  N-hosp; how many hospitals per town
  max-Bed; maximum of icu  beds per hospital
]

turtles-own[
  edad
  is-healthy?
  is-sick?
  ti
  tc
  is_symptomatic?
  symptoms-type; 0-> mild , 1-> moderate, 2-> severe
]

breed[personas persona ]

;;;;;;SETUP;;;;;;;;;

to setup
  clear-all
  setup-globals
  setup-personas
  setup-patches
  reset-ticks
end 

to setup-globals
  set dd 14
  set trigger-pop qt
  set sr? false
end 

to setup-patches
   ask patches [let k count personas-here set pcolor cyan + 0.1 * k]
end 

to setup-personas
  create-personas N [set xcor random-poisson random 40 set ycor random-poisson random 40  ]
  create-personas N [set xcor -40 - random-poisson random 40 set ycor -40 - random-poisson  random  40 ]
  create-personas N [set xcor -40 - random-poisson random 40 set ycor random-poisson random 40 ]
  create-personas N [set xcor  random-poisson random 40 set ycor -40 - random-poisson  random  40 ]
  ask personas[set shape "person" set color green set edad random-poisson 36 set tc precision (36 + random-float 3) 2 set is-sick? false set is-healthy? true set is_symptomatic? false   set ti 0]
  ask up-to-n-of (0.1 * N) personas [set is-sick? true set is-healthy? false  set ti ti + 1 ifelse random 100 <= 8 [set is_symptomatic? true set color red set symptoms-type round(1 + random 2 - random-beta 1 1)][set is_symptomatic? false set color pink]]
end 

;;;;;;;;;;;;GO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go
  ask personas [
    move
    if is-sick?[set ti ti + 1 muere clear-out ]
    if ti < dd [infect ]
    colorear-personas
   ]
  begin-quarantine
end -quarantine
  ask patches [colorear-parche]
  tick
end 

;;;;;;;;;;;;;;;TURTLES;;;;;;;;;;;;;;;;;;

to move
  ifelse sr? [
    ifelse strategy = 1 [ifelse is-sick? and is_symptomatic? [ ][rt random 180 lt random 180 fd random-gamma 80 80]]
    [ifelse strategy = 2 [ask n-of (0.3 * ( count personas )) personas [ fd 0]][if strategy = 3 [ask n-of (0.8 * (count personas)) personas [fd 0] ]]]
  ]
  [rt random 180 lt random 180 fd random-gamma 80 80]
end 

to colorear-personas
  ifelse is-healthy? [set color green][ ifelse is-sick? [ifelse is_symptomatic? [set color red][set color pink]][set color black]]
end 

to infect
  let s count personas-on neighbors
  ask up-to-n-of 2.5  personas-on neighbors [if random 100 < 25 [set is-sick? true set is-healthy? false set ti ti + 1 ]]
end 

to show_symptoms
  if ti >= random 7 [ifelse random 100 < 40 [set is_symptomatic? true set tc 38 + random-float 1 set symptoms-type round(1 + random 2 - random-beta 1 1)][set is_symptomatic? false] ]
end 

to begin-quarantine
  if quarantine and (count personas with [color = red] > trigger-pop )[set sr? true]
end 

to end-quarantine
  if quarantine and (count personas with [color = black] > (count personas with [color = red] + count personas with [color = pink]) )[set sr? false]
end 

to clear-out
  if ti >= dd and random 100 <= 40[set is-healthy? false set is-sick? false set ti 0]
end 

to muere
  if ti > 15 and random 100 <= 1 [die]
end 

;;;;;;;;;;;;;PATCHES;;;;;;;;;;;;;;;;;;;;

to colorear-parche
  let k count personas-here set pcolor pcolor + 0.1 * k
end 

to create-hospital
  foreach range N-hosp []
end 
;;;;;;;;;;;;;;REPORTERS;;;;;;;;;;;

to-report infectados
  report ((count personas with [is-sick? = true]) / (count personas)) * 100
end 

to-report random-beta [ #alpha #beta ]
  let XX random-gamma #alpha 1
  let YY random-gamma #beta 1
  report XX / (XX + YY)
end 

There is only one version of this model, created almost 4 years ago by Augusto Cabrera-Becerril.

Attached files

File Type Description Last updated
Child of CoVid19-abm.png preview v almost 4 years ago, by Augusto Cabrera-Becerril Download

Parent: CoVid19-abm

This model does not have any descendants.

Graph of models related to 'Child of CoVid19-abm'