1
如何在海龜離開建築物後激活報警時繪製直方圖。我添加了這段代碼,但是看起來好像工作不正常,時間也不正確。圖中的時間假設在「疏散時間」監視器中不像時間顯示一樣。有人可以在這方面給我建議。先謝謝了。如何在netlogo中繪製圖表
globals
[
percent-leader
flag-active-alarm
time-to-evacuate
flag-alarm
time-to-exits
]
to setup
clear-all
reset-ticks
set flag-active-alarm false
set time-to-exits []
setup-turtles
end
to go
ask turtles [wander fd 0.01]
if (flag-active-alarm)[active-alarm]
if all? turtles [ pcolor = red ] ;stops simulation
[ stop ]
if all? turtles [ pcolor = red ]
[
plot-time-to-exits
]
tick
end
to plot-time-to-exits
set-current-plot "PDF-Escape-Time"
set-plot-x-range min time-to-exits max time-to-exits
histogram time-to-exits
end