1

在示例程序examples/sumo/grid.py

在代码文件中,有关于这些探测器的任何代码。

4

2 回答 2

1

关于如何添加检测器,我找到了解决方案:

在代码上:

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

结果是:在此处输入图像描述

于 2019-07-23T03:09:45.750 回答
0

对于检测器,请查看类中add函数的文档字符串:flow/core/params.pyTrafficLightParams

file : str, optional
    which file the detector shall write results into

有关平均回报和速度,请查看flow/core/experiment.py第 145 行。

于 2019-07-21T20:46:37.683 回答