1

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.

ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
  • I know this is about 'output', and after (examples/sumo/grid.py) simulation, we can see there are some outputs: Round 0, return: 56.61810241121026 Average, std return: 56.61810241121026, 0.0 Average, std speed: 10.31087686612867, 0.0 How do these outputs be created? – user11795736 Jul 21 '19 at 13:25

2 Answers2

1

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

The result is that: enter image description here

0

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.

math.husky
  • 193
  • 1
  • 8
  • And, another question is : how to add detectors on the environment? – user11795736 Jul 22 '19 at 08:02
  • Not sure, but there is a `show_detectors` param in `TrafficLightParams`. Otherwise I guess they are systematically added to all traffic lights? I don't think you can do it without traffic lights. – math.husky Jul 22 '19 at 12:32
  • So, about the detector's type, on grid.py example, the detector's type is e1, right? If i want to change to e2, how to do ? – user11795736 Jul 24 '19 at 04:41
  • And, when I test 5x5 intersections and each intersection has four detectors, there are some warnings on the SUMO: Warning: Unused states in tlLogic 'center6', program '1' in phase 0 after tl-index 3 Warning: At actuated tlLogic 'center6', actuated phase 1 has no controlling detector Warning: At actuated tlLogic 'center6', actuated phase 3 has no controlling detector Warning: Unused states in tlLogic 'center4', program '1' in phase 0 after tl-index 3 , I am not sure if these warnings can influence my test results. I want to collect how many vehicles are runing/staying on one intersection. – user11795736 Jul 24 '19 at 05:17