On the example program(examples/sumo/grid.py
), when on simulation, we can observe there are four detectors around an intersection, so how do we get the data from these detectors?
On the code file, there are any codes about these detectors.
On the example program(examples/sumo/grid.py
), when on simulation, we can observe there are four detectors around an intersection, so how do we get the data from these detectors?
On the code file, there are any codes about these detectors.
About how to add detectors, I find the solution:
On the code:
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")
There is a small question is about detectorGap
, on params.py/TrafficLightParams
, the description about detectorGap is that:
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**
So, I set detectorGap =1 , and the maximum speed =35km/h, the distance of the detector is: maximum speed(km/h?) * detectorGap(s). My understanding is right? @nathanlct
For the detectors, look at the docstring of the add
function in flow/core/params.py
in the class TrafficLightParams
:
file : str, optional
which file the detector shall write results into
For the average return and speed, have a look in flow/core/experiment.py
, line 145.