⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 epiet.nlogo.txt

📁 netlogo模拟疾病传播,设定相应参数
💻 TXT
📖 第 1 页 / 共 3 页
字号:
    [set heading-to-bus 0
    ;;show "Im getting of!"
    ;;SHOW heading-to-bus
    ]
end

to go-to-work
if hours >= 8 and hours < 16 and weekend = 0 [                                ;;if it is a weekday, turtles should head for work at 8.
  ask persons with [at-home = 1 and employed = 1 and disease = 0]  [
    ifelse heading-to-bus = 1 [
      ride-bus-to-work
      ]
      [ifelse residence-of patch-ahead 1 = 1 
        [rt random 90]
        [fd 1
         face-nowrap my-work
        ]
      ]
   ]
 ]
  
    
  ask persons with [patch-here = my-work and at-home = 1] [  ;;checks if the turtles have arrived at work. If positive, the turtles-own "at-home" is turned of, and "at-work is turned on"
    set at-home 0
    set at-work 1
    set job-leave-time time + 480                           ;; specifies when the turtles may leave job ( 8 hours after arrival)
    if busrider = 1 [set heading-to-bus 1]
    ]
end


to go-home
ask persons with [
  at-work = 1 and
  job-leave-time <= time] [
    ifelse heading-to-bus = 1 [
     ride-bus-home
     ]
     [
     ifelse residence-of patch-ahead 1 = 1 and patch-ahead 1 != my-home 
       [rt random 90]
       [fd 1
        face-nowrap my-home
       ]
     ]
   ] 
   
 ask persons with [at-work = 1 and patch-here = my-home] [
  set at-work 0
  set at-home 1
  if busrider = 1 [set heading-to-bus 1]
  ]

end

to go-home-if-sick
  ask persons with [disease = 1 and patch-here != my-home] [
    ;;set label "Im going home, Im sick"
    set job-leave-time time
    ifelse heading-to-bus = 1 [
     ride-bus-home
     ]
     [ifelse residence-of patch-ahead 1 = 1 and patch-ahead 1 != my-home 
        [rt 90]
        [fd 1
         face-nowrap my-home
        ]
      ]
  ]
end

;;--------------------------------------------------------------------------------------------------

to let-time-pass
  set minutes time mod 60
  if minutes = 0 [set hours hours + 1]
  if time mod 1440 = 0 [
     set hours 0
     set days days + 1
     clear-drawing
     ]
  
  ifelse (days + 1) mod 7 = 0 or days mod 7 = 0                  ;;checks if it is weekend - either Saturday or Sunday
    [set weekend 1]
    [set weekend 0]
  set time time + 1  

end

to define-cases
;;defintions of diseases - controlled by the case-selector at the UI


if case = "Influenza" [
  set incubation 1.9         
  set latency 1.9                    ;;reported in MODELREL 2005
  set infectious_period 4.1                    ;;reported in MODELREL 2005
  set case-fatality 10
  ]

  
if case = "Ebola" [
  set incubation 8 + (- 1 + random 2)
  set latency 1
  set clinical_disease_period 10 + (- 5 + random 10)
  set case-fatality 80
  ]
  
if case = "Smallpox" [
  set incubation 7 
  set latency incubation + 2
  set clinical_disease_period 7 + random 7
  set infectious_period clinical_disease_period
  set case-fatality 20
  ]
end

to define_function_parameters_for_sprouting
set a 1.1139153
set b -0.736802
end

;;-------------------------------------------------------------------
to test-connectedness
  let result-1 result
  ask turtles with [infected = 1] [
    ask turtles with [my-home = my-home-of myself or my-work = my-work-of myself] [
      set color red
      set infected 1]
  ]
  set result (count turtles with [infected = 1] / count turtles)
  set stopper  (result - result-1) + 1
 ;; show result
 ;; show stopper
end


@#$#@#$#@
GRAPHICS-WINDOW
177
10
709
563
75
75
3.46
1
10
1
1
1
0
1
1
1
-75
75
-75
75

CC-WINDOW
5
648
1026
743
Command Center
0

BUTTON
2
429
57
462
NIL
setup
NIL
1
T
OBSERVER
T
NIL

BUTTON
58
429
113
462
NIL
go
T
1
T
OBSERVER
T
NIL

SLIDER
1
95
173
128
immunity
immunity
0
100
30
1
1
NIL

SLIDER
2
10
174
43
population
population
0
10000
455
1
1
NIL

SLIDER
0
220
172
253
incubation
incubation
0
14
1.9
0.1
1
days

SLIDER
0
290
172
323
infectious_period
infectious_period
0
14
4.1
0.1
1
days

SLIDER
0
325
173
358
clinical_disease_period
clinical_disease_period
0
14
4.1
0.1
1
days

SLIDER
0
255
172
288
latency
latency
0
14
1.9
0.1
1
days

SLIDER
1
395
173
428
Radius
Radius
0
10
1
1
1
NIL

PLOT
713
10
1008
212
Main Plot
NIL
NIL
0.0
10.0
0.0
10.0
true
true
PENS
"Ill" 1.0 0 -2674135 true
"Immune" 1.0 0 -13345367 true
"dead" 1.0 0 -16777216 true

MONITOR
714
377
775
426
 % immune
 (count turtles with [immune = 1] / population) * 100
3
1

SLIDER
1
360
173
393
case-fatality
case-fatality
0
100
10
1
1
%

MONITOR
831
377
881
426
Alive
count persons
3
1

BUTTON
118
429
173
462
re-infect
ask one-of turtles with [immune = 0] [get-infected]
NIL
1
T
OBSERVER
T
NIL

MONITOR
778
377
828
426
% dead
(init_count_turtles - (count turtles - 1)) / init_count_turtles * 100
3
1

SLIDER
1
130
173
163
Init-seed
Init-seed
0
100
10
1
1
NIL

PLOT
713
213
1009
374
Rt Plot
NIL
NIL
0.0
10.0
0.0
10.0
true
false

SWITCH
715
428
818
461
Trace?
Trace?
1
1
-1000

SWITCH
821
428
982
461
show-immune-as-blue?
show-immune-as-blue?
1
1
-1000

TEXTBOX
719
469
1017
634
Trace? allows agents to report when and by whom they got infected, as well as the total number each agent has infected.\n\nRt plots the reproduction rate of infection. How many became infected today compared to yesterday.\n\nIn the Main Plot, 'Infected' shows the number of new infections each day while 'Immune' shows the percentage, divided by ten, of the total intitial population who has been infected and are now immune.

CHOOSER
0
174
173
219
Case
Case
"Smallpox" "Influenza" "Ebola" "User defined"
1

SWITCH
883
392
992
425
trace-route?
trace-route?
0
1
-1000

MONITOR
3
464
60
513
NIL
Minutes
3
1

MONITOR
62
464
119
513
NIL
Hours
3
1

MONITOR
122
464
172
513
NIL
Days
3
1

MONITOR
106
516
171
565
NIL
Weekend
3
1

MONITOR
4
45
174
94
Initial population
init_count_turtles
3
1

MONITOR
563

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -