xmlsimulationsumotraffic-simulation

How to add sensors in SUMO allowing me to get the instant and speed at which a car has passed through?


Recently I started using SUMO in order to simulate certain situations in the context of roundabouts. I would like a recommendation from you for a problem I am trying to solve:

I have a roundabout generated from OpenStreetMap and I have created random trips through the randomTrips.py script. My goal is to incorporate sensors into the roundabout access ways (entrances and exits) in order to know the exact moment (instant) and speed in which a car passed that sensor. This way, at the end of the simulation, I will be able to know how many cars have countour the roundabout successfully and for statistical analysis, the respective time and speed. How can I do this in SUMO?

Thanks in advance.


Solution

  • You could use instant induction loops for that task. Just write an XML file (let's call it additional.xml) using the following format:

    <additional>
        <instantInductionLoop id="3/1to2/1" lane="3/1to2/1_0" pos="200" file="detector.xml"/>
        <instantInductionLoop id="4/1to3/1" lane="4/1to3/1_0" pos="200" file="detector.xml"/>
    </additional>
    

    (you will probably need to adapt lane ids and positions here to match your network) and add it to your sumo run with the option -a additional.xml.

    The resulting output in the file detector.xml will contain speed and time of crossing vehicles, see the wiki for details.