COVID-19 Educational Model

COVID-19 Educational Model preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.0 • Viewed 211 times • Downloaded 13 times • Run 0 times
Download the 'COVID-19 Educational Model' 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

globals [dt
  school
  housepatch
  gym
  library
	cafeteria
  hospital
  dining-halls
  playground
  num-students
  clock
  num-houses
  num-trees

  max-infected
  transmissibility
  infection-radius
  R0
  R0-avg
  length-of-infection
  mean-onset-time
  mean-recovery-time
]

breed[houses house]
breed[trees tree]
breed [students student]


breed [schoolso schoolo]
breed [libraryso libraryo]
breed [gyms gymnasium]
breed [hosps hosp]
breed [cafs caf]
breed [pebbles pebble]


students-own[
  target
  infected?
  exposed?
  immune?
  recovered?
  hospitalized?

  infectedcount
  count-down
  infectcount-down

  dorm
  contacts-per-tick
  masked?
]

to setup
  clear-all

	setup-circle
  set num-students 200
  set num-houses 25
  set num-trees 8




  ask patches with [pxcor > 5 and pxcor < 180 and pycor < 537 and pycor > 397] [set pcolor [255 255 255]]
  ask patches with [pxcor > 5 and pxcor < 180 and pycor < 744 and pycor > 582] [set pcolor [38 115 0]]
  ask patches with [pxcor > 5 and pxcor < 180 and pycor < 352 and pycor > 212] [set pcolor [168 0 132]]
  ask patches with [pxcor > 5 and pxcor < 180 and pycor < 167 and pycor > 5] [set pcolor brown + 3]
  ask patches with [pxcor > 287 and pxcor < 462 and pycor < 537 and pycor > 397] [set pcolor [255 170 0]]
  ask patches with [pxcor > 287 and pxcor < 462 and pycor < 167 and pycor > 5] [set pcolor brown + 3]
  ask patches with [pxcor > 287 and pxcor < 462 and pycor < 744 and pycor > 582] [set pcolor brown + 3]	
	ask patches with [pxcor > 287 and pxcor < 462 and pycor < 352 and pycor > 212] [set pcolor brown + 3]
	ask patches with [pxcor > 570 and pxcor < 745 and pycor < 352 and pycor > 212] [set pcolor brown + 3]
	ask patches with [pxcor > 570 and pxcor < 745 and pycor < 537 and pycor > 397] [set pcolor [0 112 255]]
	ask patches with [pxcor > 570 and pxcor < 745 and pycor < 167 and pycor > 5] [set pcolor [200 191 231]]
	

  set cafeteria patches with [pcolor =[255 255 255]]
  set school patches with [pcolor = [255 170 0]]
  set playground patches with [pcolor = [38 115 0]]
  set gym patches with [pcolor = [168 0 132]]
  set library patches with [pcolor = [0 112 255]]
  set housepatch  patches with [pcolor = brown + 3]
  set hospital patches with [pcolor = [200 191 231]]


  draw-sidewalk
  draw-roads
  draw-trees
  draw-houses


  ask turtle 2[
  create-link-to turtle 1 [set color white]
  show link 1 2
  ]

  ask patches with [pxcor > 570 and pxcor < 745 and pycor < 744 and pycor > 582] [set pcolor grey]
  set clock patches with [pcolor = grey]

   ;; Assign values for infection parameters
  set transmissibility 0.00075
  set infection-radius 10 / sqrt(200) * sqrt(num-students)
  set length-of-infection 336 ;; 2 ticks = 30 min :: 7 * 24 * 2
  set R0-avg 0
  set mean-onset-time 4
  set mean-recovery-time 10

  populate-students
  setup-infected


 draw-cafeteria
 draw-hospital
 draw-gym

 draw-school
 draw-library



  reset-ticks
end 

to draw-houses
   ask patches with [pcolor = brown + 3] [
    if count neighbors with [pcolor = brown + 3] = 8 and not any? turtles in-radius 50 [
      sprout-houses 1 [
        set shape one-of ["house" "house bungalow" "house ranch" "house colonial" "house efficiency" "house two story"]
        set size 40
        stamp
      ]
    ]
  ]
  ask patches with [pcolor = brown + 3] [
    if count neighbors with [pcolor = brown + 3] = 8 and not any? turtles in-radius 35[
      if random 100 > 90 [
        sprout-trees 1 [
          set shape one-of ["tree" "tree pine"]
          set size 35
          set color green
          stamp
        ]
      ]
    ]
  ]
  ask houses [die]
  ask trees [die]
end 

to draw-trees
  ask patches with [pcolor = [38 115 0]] [
    if count neighbors with [pcolor = [38 115 0]] = 8 and not any? turtles in-radius 50[

        sprout-trees 1 [
          set shape one-of ["tree" "tree pine"]
          set size 35
          set color green
          stamp
        ]

    ]
  ]
  ask trees [die]
end 

to draw-school
  ask school [
    if count schoolso < 1[
      sprout-schoolso 1[
        set xcor 375
        set ycor 445
        set shape "school"
        set color orange
        set heading 0
        set size 220

    ]
    ]
  ]
end 

to draw-library
  ask library [
    if count libraryso < 1[
      sprout-libraryso 1[
        set xcor 655
        set ycor 455
        set heading 0
        set shape "building institution"
        set color blue
        set size 140

    ]
    ]
  ]
end 

to draw-hospital
  ask hospital [
    if count hosps < 1[
      sprout-hosps 1[
        set xcor 655
        set ycor 75
        set heading 0
        set shape "hospital"
        set size 195

    ]
    ]
  ]
end 

to draw-gym
  ask gym [
    if count gyms < 1[
      sprout-gyms 1[
        set xcor 90
        set ycor 250
        set heading 0
        set shape "gym"
        set size 180

    ]
    ]
  ]
end 

to draw-cafeteria
  ask cafeteria [
    if count cafs < 1[
      sprout-cafs 1[
        set xcor 90
        set ycor 430
        set heading 0
        set shape "cafeteria"
        set size 210

    ]
    ]
  ]
end 

to draw-roads
  ;create crossroads

  ask patches with [(pxcor > 210 and pxcor < 257) or (pxcor > 492 and pxcor < 540) ] [
    set pcolor grey
    sprout 1 [
      set shape "road2"
      set color grey
      set heading 90
      set size 20

      stamp die
    ]
   ]
  ask patches with [(pycor < 567 and pycor > 552) or (pycor < 382 and pycor > 367) or (pycor < 197 and pycor > 182)  ] [
    set pcolor grey
    sprout 1 [
      set shape "road2"
      set color grey
      set heading 90
      set size 20

      stamp die
    ]
   ]
;  ask patches with [(pxcor > 230 and pxcor < 235) or (pxcor > 515 and pxcor < 520) and pycor mod 83 = 0  and meaning != "crossroad"] [
;    set pcolor grey
;    sprout 1 [
;      set shape "road"
;      set color grey
;      set heading 90
;      set size 15
;
;      stamp die
;    ]
;  ]
;  ask patches with [(pycor > 557 and pycor < 562) or (pycor > 372 and pycor < 377) or (pycor > 187 and pycor < 192) and pxcor mod 105 = 0  and meaning != "crossroad"] [
;    set pcolor grey
;    sprout 1 [
;      set shape "road"
;      set color grey
;      set heading 0
;      set size 15
;
;      stamp die
;    ]
;  ]
end 

to draw-sidewalk
  ask patches with [pcolor = black] [
;  sprout-pebbles 1 [
;    set shape "tile stones"
;    set size 15
;    set color 36
;    stamp
    ;die

;  ]
    set pcolor brown + 2
  ]
;  ask pebbles[die]
end 

to setup-infected
  ask n-of Initially-Infected students [
    set exposed? false
    set infected? true
    set color [255 0 0]


  ]
end 

to setup-circle
  ;;clear-all
  set-default-shape turtles "circle"
  ;; turtles should be evenly spaced around the circle
  crt 1 [make-sun-moon-start]
  crt 1 [make-center]


	let center clock
  create-ordered-turtles 12 [
   	move-to patch 660 665
    set size 4  ;; easier to see
    set color white
    fd 50
    rt 90
  ]
  crt 1 [make-top]
end 

to make-sun-moon-start
  set shape "moon"
  set color white
  set size 40
  set xcor 725
  set ycor 725
end 

to make-sun-moon
  if ticks = 28[
    set shape "sun"
    set color yellow
  ]
  if  ticks = 76 [
    set shape "moon"
    set color white
  ]

  if (ticks - 28) mod 96 = 0 and ticks != 0 [
    set shape "sun"
    set color yellow
  ]

  if (ticks - 76) mod 96 = 0 and ticks != 0 [
    set shape "moon"
    set color white
  ]
  set size 40
  set xcor 725
  set ycor 725
end 

to make-top
  set shape "circle"
  set color white
  set size 3
  set xcor 660
  set ycor 715
end 

to make-center
  set size 3.5
  set shape "circle"
  set color yellow
  set xcor 660
  set ycor 665
end 

to move-hour-hand
  ;fd ( pi * 50 / 180) * (480 / 60)
  ;rt 480 / 60

  let theta  6.25 * 180 / ( pi * 50 )
  rt theta / 2
  fd 6.25
  rt theta / 2
end 

to go


  ask turtle 2 [

      pen-down

      move-hour-hand
      	
  ]
  ask turtle 0
  [
    make-sun-moon
  ]

  if stay-at-home? [
    ask students [move-to one-of housepatch]
  ]
  if quarantine? [
    ask students with [infected?][move-to one-of housepatch]
  ]



	;;stop if everyone or no one is infected
  if (count students with [infected? and not hospitalized?] = 0)
  or (count students with [infected?] = num-students)
  [stop]

  infect-susceptibles

  ask students with [exposed? and count-down > 0][
  	set count-down count-down - 1
  ]

  ask students with [exposed? and count-down <= 0][
    ifelse (random-float 1 < 0.03)[
     hospitalize
    ]
    [infect]

  ]

  ask students with [infected? and infectcount-down >= 0][
    if infectcount-down = 0[
      setupinfect-timer
    ]
    set infectcount-down infectcount-down - 1
  ]

  ask students with [infected? and hospitalized? = false and infectcount-down <= 0][
    recover
  ]

  move-students

  student-schedule


  calculate-max-infected




  tick
end 

to setupexpose-timer
  set count-down 288
end 

to setupinfect-timer
  set infectcount-down 1440
end 

to infect-susceptibles

  ask students with [not immune? and not infected? and not exposed? and not recovered?] [
    let infected-neighbors-no-masks (count other students with [infected? and not masked?] in-radius infection-radius)
    let infected-neighbors-masked (count other students with [infected? and masked?] in-radius infection-radius)
    let effective-beta transmissibility

    if social-distancing? = false [set effective-beta 2 * transmissibility]
    if patch-here = playground  [set effective-beta 2 * effective-beta ]
    ;; Formula of transmissibility to avoid the probability exceeding 1
    if (random-float 1 <  (1 - ((1 - effective-beta) ^ (infected-neighbors-no-masks)) * ((1 - 0.2 * effective-beta) ^ (infected-neighbors-masked))))
    [

      expose

    ]
  ]
end 

to expose
  setupexpose-timer
  set exposed? true
  set color [225 175 0]
end 

to infect
    setupinfect-timer
    set exposed? false
    set infected? true
    set color [255 0 0]
end 

to hospitalize
  set exposed? false
  set infected? true
  set hospitalized? true
  set color blue
  move-to one-of hospital
end 

to recover
  set infected? false
  set recovered? true
  set immune? true
  set color gray
end 

to student-schedule

 	let fourth-of-students floor num-students / 4
  let half-of-students floor num-students / 2


  if ticks mod 97 = 0 [
    ask students [
    	set masked? false
  	]
  ]

  if ticks mod 97 = 0 [
    ask n-of (floor %mask-compliance * num-students / 100) students [
      set masked? true
    ]
  ]

  ;;1 tick = 15min
  ;;4 ticks = 1hr
  ;;96 ticks = 1 day


  ;;8 am School
	if ticks = 32 or ((ticks - 32) mod 96 = 0 and ticks != 0)
  [
    ask students with [infected? = false ][

      if stay-at-home? = false and hospitalized? = false and (quarantine? = false or infected? = false)[
 				move-to one-of school
  		]
    ]
  ]

 if ticks = 32 or ((ticks - 32) mod 96 = 0 and ticks != 0)
  [
    ask students with [infected? = true ][
      if stay-at-home? = false and hospitalized? = false and quarantine? = false[
 				move-to one-of school
  		]
    ]
  ]

  ;;12 pm lunch
  if ticks = 48 or ((ticks - 48) mod 96 = 0 and ticks != 0)
  [
    ask students with [infected? = true][
      if stay-at-home? = false and hospitalized? = false and quarantine? = false[
 				move-to one-of cafeteria
  		]
    ]
  ]

   if ticks = 48 or ((ticks - 48) mod 96 = 0 and ticks != 0)
  [
    ask students with [infected? = false][
      if stay-at-home? = false and hospitalized? = false and (quarantine? = false or infected? = false)[
 				move-to one-of cafeteria
  		]
    ]
  ]

  if ticks = 54 or ((ticks - 54) mod 96 = 0 and ticks != 0)
  [
    ask students with [infected? = false][
      if stay-at-home? = false and hospitalized? = false and (quarantine? = false or infected? = false)[
 				move-to one-of school
  		]
    ]
  ]

  if ticks = 54 or ((ticks - 54) mod 96 = 0 and ticks != 0)
  [
    ask students with [infected? = true][
      if stay-at-home? = false and hospitalized? = false and quarantine? = false[
 				move-to one-of school
  		]
    ]
  ]


  ;;2 pm activities
  if ticks = 56 or ((ticks - 56) mod 96 = 0 and ticks != 0)
	[
    let half (count students with [infected? = false]) / 2
    ask n-of half students with [infected? = false][
      if stay-at-home? = false and hospitalized? = false and (quarantine? = false or infected? = false)[
         move-to one-of gym
    	]
    ]
    ask n-of half students with [infected? = false][
      if stay-at-home? = false and hospitalized? = false and (quarantine? = false or infected? = false)[
         move-to one-of playground
    	]
    ]


  ]
  if ticks = 56 or ((ticks - 56) mod 96 = 0 and ticks != 0)
	[
    let half (count students with [infected? = true]) / 2
    ask n-of half students with [infected? = true][
      if stay-at-home? = false and hospitalized? = false and quarantine? = false[
         move-to one-of gym
    	]
    ]

    ask n-of half students with [infected? = true][
      if stay-at-home? = false and hospitalized? = false and quarantine? = false[
         move-to one-of playground
    	]
    ]


  ]


  ;;4 pm back home
  if ticks = 64 or ((ticks - 64) mod 96 = 0 and ticks != 0)
  [
    ask students with [infected? = false][
      if stay-at-home? = false and hospitalized? = false and (quarantine? = false or infected? = false)[
         move-to dorm
			]
    ]
  ]
  if ticks = 64 or ((ticks - 64) mod 96 = 0 and ticks != 0)
  [
    ask students with [infected? = true][
      if stay-at-home? = false and hospitalized? = false and quarantine? = false[
         move-to dorm
			]
    ]
  ]

  if ticks = 68 or ((ticks - 68) mod 96 = 0 and ticks != 0)
  [
    ask students with [infected? = false][
      if stay-at-home? = false and hospitalized? = false and (quarantine? = false or infected? = false)[
    		move-to one-of housepatch
			]
    ]
  ]
  if ticks = 68 or ((ticks - 68) mod 96 = 0 and ticks != 0)
  [
    ask students with [infected? = false][
      if stay-at-home? = false and hospitalized? = false and quarantine? = false [
    		move-to one-of housepatch
			]
    ]
  ]

  if ticks = 70 or ((ticks - 70) mod 96 = 0 and ticks != 0)
  [
    let half (count students with [infected? = false]) / 2
    ask n-of half students with [infected? = false][
      if stay-at-home? = false and hospitalized? = false and (quarantine? = false or infected? = false)[
        move-to one-of library
    	]
    ]
  ]
  if ticks = 70 or ((ticks - 70) mod 96 = 0 and ticks != 0)
  [
    let half (count students with [infected? = true]) / 2
    ask n-of half students with [infected? = true][
      if stay-at-home? = false and hospitalized? = false and quarantine? = false [
        move-to one-of library
    	]
    ]
  ]

	if ticks = 78 or ((ticks - 78) mod 96 = 0 and ticks != 0)
  [
  ask students with [infected? = false][
		if stay-at-home? = false and hospitalized? = false and (quarantine? = false or infected? = false)[
        move-to dorm
			]
    ]
  ]
  if ticks = 78 or ((ticks - 78) mod 96 = 0 and ticks != 0)
  [
  ask students with [infected? = true][
		if stay-at-home? = false and hospitalized? = false and quarantine? = false [
        move-to dorm
			]
    ]
  ]

  if ticks = 81 or ((ticks - 81) mod 96 = 0 and ticks != 0)
  [
  ask students with [infected? = false][
		if stay-at-home? = false and hospitalized? = false and (quarantine? = false or infected? = false)[
        move-to dorm
			]
    ]
  ]
  if ticks = 81 or ((ticks - 81) mod 96 = 0 and ticks != 0)
  [
  ask students with [infected? = true][
		if stay-at-home? = false and hospitalized? = false and quarantine? = false [
        move-to dorm
			]
    ]
  ]
end 

to move-students ;; Global procedure to move students
  ;; Procedue to make the students perform random walk
  ask students with [hospitalized? = false] [
    if quarantine? = false or infected? = false [
      let color-here [pcolor] of patch-here
      set target one-of patches in-cone 3 180 with [ pcolor = color-here]
      motion
      if pcolor != color-here [motion]]
  ]
end 

to motion ;; Turtle procedure to perform random walk
  rt random 30 - 15
  if target != nobody [
    face target
    move-to target
  ]
  fd random 0.05
end 

to populate-students ;; Procedure to create agents for students
  ask n-of num-students housepatch [ sprout-students 1]
  ask students [
    set size 10
    set shape "person"
    set color green
    set dorm patch-here
    set infected? false
    set immune? false
    set exposed? false
    set contacts-per-tick 0
    set masked? false
    set recovered? false
    set hospitalized? false
  ]
end 

to calculate-max-infected
  let x (count students with [infected?])
  if x > max-infected
  [set max-infected x]
end 

There is only one version of this model, created almost 3 years ago by Alexandra LaMattina.

Attached files

File Type Description Last updated
COVID-19 Educational Model.png preview Preview for 'COVID-19 Educational Model' almost 3 years ago, by Alexandra LaMattina Download

This model does not have any ancestors.

This model does not have any descendants.