MERS in Hospital
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
breed [patients patient]
breed [docs doc]
breed [nurses nurse]
breed [people person]
patches-own [hospital?
emergency?
room?
door
jung
cho
radio
]
turtles-own [exposed?
exposured_length
infected?
health
]
docs-own [sex
age
count-down
]
nurses-own [sex
age
]
patients-own [sex
age
count-down
]
to setup
ca
reset-ticks
ask patches
[set pcolor grey
if (pxcor >= -27 and pxcor <= 28) and (pycor >= -18 and pycor <= 18) [set pcolor white]
if (pxcor >= -28 and pxcor <= -18) and (pycor >= -18 and pycor <= -8) [set pcolor grey]
if (pxcor >= -10 and pxcor <= -9) or (pycor >= 1 and pycor <= 2) [set pcolor 69.8 ] ; moving track
if (pxcor >= -8 and pxcor <= 4) and (pycor >= -5 and pycor <= -4) [set pcolor 69.8] ; moving track
if (pxcor = -24) and (pycor = 3) [set pcolor 69.8] ; moving track
if (pxcor = -3) and (pycor = 3) [set pcolor 69.8] ; moving track
;if (pxcor = 5) and (pycor = 3) [set pcolor 69.8] ; moving track
if (pxcor = 21) and (pycor = 3) [set pcolor 69.8] ; moving track
if (pxcor >= -30 and pxcor <= -28) and (pycor >= 1 and pycor <= 2) [set pcolor blue] ; Gate 1
if (pxcor >= -10 and pxcor <= -9) and (pycor >= -20 and pycor <= -19) [set pcolor blue] ; Gate 2
if (pxcor >= 4 and pxcor <= 10) and (pycor >= -20 and pycor <= -19) [set pcolor blue + 1] ; Emergency gate
if (pxcor >= 29 and pxcor <= 30) and (pycor >= 1 and pycor <= 2) [set pcolor blue] ; Byolgwan Corridor
if (pxcor >= -10 and pxcor <= -9) and (pycor >= 19 and pycor <= 20) [set pcolor blue] ; Gate 3
ifelse pcolor != grey [set hospital? true][set hospital? false]
if (pxcor >= -25 and pxcor <= -20) and (pycor >= 4 and pycor <= 14) [set pcolor green + 2 set jung 1] ;orthopedics(Junghyung)
if (pxcor >= -6 and pxcor <= -1) and (pycor >= 4 and pycor <= 14) [set pcolor green + 2 set cho 1] ;cardiography(Choumpa)
if (pxcor >= 15 and pxcor <= 25) and (pycor >= 4 and pycor <= 14) [set pcolor green + 2 set radio 1] ;Radiology
if (pxcor >= 4 and pxcor <= 15) and (pycor >= -18 and pycor <= -4) [set pcolor green + 1] ;Emergency room
if (pxcor >= 11 and pxcor <= 15) and (pycor >= -18 and pycor <= -17) [set pcolor white]
ifelse pcolor = green + 1 [set emergency? true][ifelse pcolor = blue + 1 [set emergency? true][set emergency? false]]
ifelse pcolor = green + 2 [set room? true][set room? false]
ifelse (pxcor = 3) and (pycor = -5) [set door true set pcolor 69.7][set door false]
]
;Make emergency beds
ask n-of beds patches with [(pxcor = 4 or pxcor = 15) and (pycor >= -15 and pycor <= -6)]
[if [pcolor] of neighbors != green + 1 [set pcolor 109]]
setup-docs
setup-nurses
setup-patients
setup-virus
end
to setup-docs
set-default-shape docs "person doctor"
create-docs (no-of-docs - 2) [set color black
set size 2
setxy random-xcor random-ycor]
create-docs 2 [set color black + 1
set size 2
setxy random-xcor random-ycor]
ask docs with [color = black][ifelse [pcolor] of patch-here = grey
[move-to one-of patches with [hospital? = true and pcolor = 69.8]]
[move-to one-of patches with [hospital? = true and pcolor = 69.8]]
set age 25 + random 10
ifelse age > 30 [set sex "Male"][set sex "Female"]
]
ask docs with [color = black + 1][ifelse [emergency?] of patch-here = false [move-to one-of patches with [emergency? = true]]
[move-to one-of patches with [emergency? = true]]
set sex "Male" set age 25 + random 6 set health 70 + random 30]
end
to setup-nurses
set-default-shape nurses "person service"
create-nurses (no-of-nurses * 2 / 3 ) [set color yellow + 1
set size 2
;setxy random-xcor random-ycor
]
ask nurses with [color = yellow + 1][ ifelse [hospital?] of patch-here = false
[move-to one-of patches with [hospital? = true and emergency? = false and door = false and room? = true ]]
[move-to one-of patches with [hospital? = true and emergency? = false and door = false and room? = true ]]
if [hospital?] of patch-here = true [set sex "Female" set age 20 + random 30 set health 50 + random 50]
]
create-nurses (no-of-nurses / 3) [set color brown + 2
set size 2
set health 50 + random 50
;set target min-one-of docs [distance myself]
setxy random-xcor random-ycor]
ask nurses with [color = brown + 2][ ifelse [hospital?] of patch-here = false
[move-to one-of patches with [hospital? = true and pcolor = 69.8]]
[move-to one-of patches with [hospital? = true and pcolor = 69.8]]
]
end
to setup-patients
set-default-shape patients "person"
create-patients no-of-patients [set size 2
set color pink
set health 20 + random 40
setxy random-xcor random-ycor ]
;every 10 [ask n-of 5 patches with [emergency? = true and pcolor = blue + 1] [ sprout 2 [set shape "person" set size 2 set color pink ]]]
ask patients [ifelse [pcolor] of patch-here != black
[move-to one-of patches with [emergency? = true and pcolor = blue + 1] ]
[setxy xcor ycor
]]
end
to setup-virus
ask one-of patients with [emergency? = true and health < 35][set color 117 set exposed? true]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to go
if(all? patients [infected? = true])[stop]
if(ticks > 300) [stop]
if(count patients with [[emergency?] of patch-here] = 0) [stop]
doctor-visit
duty
inroom
move-nurse
move-patients
quarantine
tick
end
to move-patients
ask patients with[[emergency?] of patch-here = true] [ifelse [pcolor] of patch-here = blue + 1 [move-to one-of patches with [emergency? = true and pcolor != blue + 1]]
[move-to one-of patches with [emergency? = true and pcolor != blue + 1]]
]
ask patients with [[emergency?] of patch-here = true and [pcolor] of patch-here != blue + 1]
[ifelse emergency? = true and pcolor != blue + 1
[move-to one-of patches with [emergency? = true and pcolor != blue + 1 or pcolor = 109]]
[move-to one-of patches with [emergency? = true and pcolor != blue + 1 or pcolor = 109]]
set health health - 1
; set count-down count-down + 1
; set label count-down
]
if(classify = "freedom")
[ask patients with[[emergency?] of patch-here = true] [if any? docs in-radius 2 [
set count-down count-down + 1 ;increment-timer
set label count-down]
if count-down > length-of-stay [move-to one-of patches with [door = true] set label ""]]]
ask patients with [pxcor = -10][set heading 180 fd 1]
ask patients with [pxcor = -9][set heading 0 fd 1 ]
ask patients with [pycor = 1][set heading 90 fd 1 ]
ask patients with [pycor = 2][set heading 270 fd 1 ]
; ask patients with [pycor = -5][set heading 270 fd 1 ]
; ask patients with [pycor = -4][set heading 270 fd 1 ]
ask patients with [[door] of patch-here = true][set heading 270 fd 1 ]
; ask patients with [pycor >= -5 and pycor <= -4 and pxcor > -9 and pxcor < 4][set heading 270 fd 1 ]
ask patients with [pxcor >= -9 and pxcor <= 2 and pycor = -5][set heading 270 fd 1 ]
;junction
ask patients with [pxcor = -9 and pycor = 0]
[let dice random 4
if(dice = 0) [move-to patch -8 1]
if(dice = 1) [move-to patch -9 3]
if(dice = 2) [move-to patch -11 2]
if(dice = 3) [move-to patch -10 0]
] ;central junction
ask patients with [pxcor = -7 and pycor = -4]
[let dice random 2
if(dice = 0) [move-to patch -9 -3]
if(dice = 1) [move-to patch -10 -6] ] ;emergency junction
ask docs with [pxcor = -9 and pycor = -5][set heading 270 * random 2 fd 1]
ask patients with [pxcor = -10 and pycor = -5][set heading 180 fd 1] ;emergency
ask patients with [pxcor = -28 and pycor = 2][set heading 180 fd 1] ;gate u-turn
ask patients with [pxcor = 29 and pycor = 1][set heading 0 fd 1] ;gate u-turn
ask patients with [pxcor = -9 and pycor = 19][set heading 270 fd 1] ;gate u-turn
ask patients with [pxcor = -10 and pycor = -19][set heading 90 fd 1];gate u-turn
;junghyungwegwa wander
ask patients with [pxcor = -24 and pycor >= 2 and pycor <= 3][
if [jung] of patch-here = 0 [move-to one-of patches with [jung = 1]]]
ask patients with [[jung] of patch-here = 1][ifelse [jung] of patch-here != 1 [move-to one-of patches with [jung = 1]]
[move-to one-of patches with [jung = 1]]
if any? docs in-radius 5 [set health health + 10]
set count-down count-down + 1 ;increment-timer
set label count-down
if count-down > 50 [move-to patch -18 1]
]
;choumpa wander
ask patients with [pxcor = -3 and pycor = 1 + random 3][
if [cho] of patch-here = 0 [move-to one-of patches with [cho = 1]]]
ask patients with [[cho] of patch-here = 1][ ifelse [cho] of patch-here != 1 [move-to one-of patches with [cho = 1]]
[move-to one-of patches with [cho = 1]]
if any? docs in-radius 5 [set health health + 10]
set count-down count-down + 1 ;increment-timer
set label count-down
if count-down > 50 [move-to patch -7 2]
]
;radio wander
ask patients with [pxcor = 21 and pycor >= 2 and pycor <= 3][
if [radio] of patch-here = 0 [move-to one-of patches with [radio = 1]]]
ask patients with [[radio] of patch-here = 1][ ifelse [radio] of patch-here != 1 [move-to one-of patches with [radio = 1]]
[move-to one-of patches with [radio = 1]]
if any? docs in-radius 5 [set health health + 10]
set count-down count-down + 1 ;increment-timer
set label count-down
if count-down > 50 [move-to patch 18 2 ]
]
exposure
infect
end
to duty
ask docs with [color = black + 1 ][ifelse [emergency?] of patch-here = false
[move-to one-of patches with [emergency? = true]]
[setxy xcor ycor] set heading random 360 fd 0.5
;if [pcolor] of patches in-radius 1 = 109 ;classify types of disease
;[ask patients [ set health health + 1]]
]
end
to doctor-visit
ask docs with [pxcor = -10][set heading 180 fd 1 set label ""]
ask docs with [pxcor = -9][set heading 0 fd 1 set label ""]
ask docs with [pycor = 1][set heading 90 fd 1 set label ""]
ask docs with [pycor = 2][set heading 270 fd 1 set label ""]
ask docs with [pycor = -5][set heading 90 fd 1 set label ""]
ask docs with [pxcor >= -9 and pxcor <= 2 and pycor = -4][set heading 270 fd 1 set label ""]
;junction
ask docs with [pxcor >= -10 and pxcor <= -9 and pycor >= 1 and pycor <= 2][set heading (random 4 * 90 ) fd 1] ;central junction
ask docs with [pxcor = -10 and pycor = -5][set heading 180 fd 1] ;emergency
ask docs with [pxcor = -9 and pycor = -5][set heading 270 * random 2 fd 1]
ask docs with [pxcor = -28 and pycor = 2][set heading 180 fd 1] ;gate u-turn
ask docs with [pxcor = 29 and pycor = 1][set heading 0 fd 1] ;gate u-turn
ask docs with [pxcor = -9 and pycor = 19][set heading 270 fd 1] ;gate u-turn
ask docs with [pxcor = -10 and pycor = -19][set heading 90 fd 1];gate u-turn
ask docs with [door = true][move-to patch 2 -4]; emergency u-turn
;junghyungwegwa visit
ask docs with [pxcor = -24 and pycor >= 1 and pycor <= 3][
if [jung] of patch-here = 0 [move-to one-of patches with [jung = 1]]]
ask docs with [[jung] of patch-here = 1][ifelse [jung] of patch-here != 1 [move-to one-of patches with [jung = 1]]
[move-to one-of patches with [jung = 1]]
set count-down count-down + 1 ;increment-timer
set label count-down
if count-down > 50 [move-to patch -18 1 ] ]
;choumpa visit
ask docs with [pxcor = -3 and pycor = 1 + random 2][
if [cho] of patch-here = 0 [move-to one-of patches with [cho = 1]]]
ask docs with [[cho] of patch-here = 1][ ifelse [cho] of patch-here != 1 [move-to one-of patches with [cho = 1]]
[move-to one-of patches with [cho = 1]]
set count-down count-down + 1 ;increment-timer
set label count-down
if count-down > 50 [move-to patch -7 2]]
;radio visit
ask docs with [pxcor = 21 and pycor = 1 + random 2][
if [radio] of patch-here = 0 [move-to one-of patches with [radio = 1]]]
ask docs with [[radio] of patch-here = 1][ ifelse [radio] of patch-here != 1 [move-to one-of patches with [radio = 1]]
[move-to one-of patches with [radio = 1]]
set count-down count-down + 1 ;increment-timer
set label count-down
if count-down > 50 [move-to patch 18 2 ]]
end
to inroom
ask nurses with [color = yellow + 1][
if [hospital?] of patch-here = false [move-to one-of patches with [hospital? = true and jung = 1 or cho = 1 or radio = 1]]]
ask nurses with [[jung] of patch-here = 1][ifelse [jung] of patch-here != 1 [move-to one-of patches with [jung = 1]]
[move-to one-of patches with [jung = 1]]]
ask nurses with [[cho] of patch-here = 1][ifelse [cho] of patch-here != 1 [move-to one-of patches with [cho = 1]]
[move-to one-of patches with [cho = 1]]]
ask nurses with [[radio] of patch-here = 1][ifelse [radio] of patch-here != 1 [move-to one-of patches with [radio = 1]]
[move-to one-of patches with [radio = 1]]]
end
to move-nurse
ask nurses with [color = brown + 2 and pxcor = -10][set heading 180 fd 1]
ask nurses with [color = brown + 2 and pxcor = -9][set heading 0 fd 1]
ask nurses with [color = brown + 2 and pycor = 1][set heading 90 fd 1]
ask nurses with [color = brown + 2 and pycor = 2][set heading 270 fd 1]
ask nurses with [color = brown + 2 and pycor = -5][set heading 90 fd 1]
ask nurses with [color = brown + 2 and pxcor >= -9 and pxcor <= 2 and pycor = -4][set heading 270 fd 1]
;junction
ask nurses with [color = brown + 2 and pxcor >= -10 and pxcor <= -9 and pycor >= 1 and pycor <= 2][set heading (random 4 * 90 ) fd 1] ;central junction
ask nurses with [color = brown + 2 and pxcor = -10 and pycor = -5][set heading 180 fd 1] ;emergency
ask nurses with [color = brown + 2 and pxcor = -9 and pycor = -5][set heading 270 * random 2 fd 1]
ask nurses with [color = brown + 2 and pxcor = -24 or pxcor = -3 or pxcor = 21 and pycor = 3][set heading 180 fd 1]
ask nurses with [color = brown + 2 and pxcor = -28 and pycor = 2][set heading 180 fd 1] ;gate u-turn
ask nurses with [color = brown + 2 and pxcor = 29 and pycor = 1][set heading 0 fd 1] ;gate u-turn
ask nurses with [color = brown + 2 and pxcor = -9 and pycor = 19][set heading 270 fd 1] ;gate u-turn
ask nurses with [color = brown + 2 and pxcor = -10 and pycor = -19][set heading 90 fd 1];gate u-turn
ask nurses with [color = brown + 2 and door = true][move-to patch 2 -4]; emergency u-turn
end
to exposure
ask turtles with [exposed? = true and health < 20][
let transmit one-of turtles in-radius 1
if transmit != nobody
[ ask transmit [
if (random-float 100 > prob-of-infection)
[ set color 117 set exposed? true]]]]
end
to infect
let incubation (random 100)
ask turtles with [exposed? = true]
[if exposured_length > incubation [set color red set infected? true]
set exposured_length exposured_length + 1]
end
to quarantine
if(classify = "quarantine")
[ask patients with [[emergency?] of patch-here = true ] [if any? docs in-radius 2 [
set count-down count-down + 1 ;increment-timer
set label count-down]]
ask patients with [count-down > length-of-stay][
ifelse infected? = true or exposed? = true [move-to one-of patches with [jung = 1]][
move-to one-of patches with [cho = 1 or radio = 1]] set label ""]
ask patients with [[jung] of patch-here = 1][ifelse [jung] of patch-here != 1 [move-to one-of patches with [jung = 1]]
[move-to one-of patches with [jung = 1]] set label ""]
ask patients with [[cho] of patch-here = 1][ifelse [cho] of patch-here != 1 [move-to one-of patches with [cho = 1]]
[move-to one-of patches with [cho = 1]] set label ""]
ask patients with [[radio] of patch-here = 1][ifelse [radio] of patch-here != 1 [move-to one-of patches with [radio = 1]]
[move-to one-of patches with [radio = 1]]set label ""]
]
end
There are 2 versions of this model.
Attached files
| File | Type | Description | Last updated | |
|---|---|---|---|---|
| MERS in Hospital.png | preview | Preview for 'MERS in Hospital' | over 9 years ago, by Hyesop Shin | Download |
This model does not have any ancestors.
This model does not have any descendants.
Download this model