在示例程序examples/sumo/grid.py
(
在代码文件中,有关于这些探测器的任何代码。
关于如何添加检测器,我找到了解决方案:
在代码上:
tl_logic.add("center0", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
tl_logic.add("center1", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
tl_logic.add("center2", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
tl_logic.add("center3", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
tl_logic.add("center4", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
tl_logic.add("center5", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
有一个小问题是关于detectorGap
,关于params.py/TrafficLightParams
,关于detectorGap的描述是:
detectorGap : int, optional
used for actuated traffic lights
determines the time distance between the (automatically generated)
detector and the stop line in seconds (at each lanes maximum
speed), **used for actuated traffic lights**
所以,我设置detectorGap =1,最大速度=35km/h,探测器的距离为:最大速度(km/h?)*detectorGap(s)。我的理解对吗?@nathanlct
对于检测器,请查看类中add
函数的文档字符串:flow/core/params.py
TrafficLightParams
file : str, optional
which file the detector shall write results into
有关平均回报和速度,请查看flow/core/experiment.py
第 145 行。