Weird error in SUMO simulation: automatic lane-shifting and vehicle absence

117 Views Asked by At

I am working with SUMO traffic simulation and I have 2 unexpected behaviors in my simulation. I declared 6 vehicles in three different types. However, one of the vehicles during simulation changed lanes and 2 vehicles were absent from my simulation. My code followed section 12.2.2 in this book

Below are my files:

  • highway.rou.xml: where I declare type and number of vehicles:
<?xml version="1.0"?>
<routes>
   <vType id="nonPlatoon" vClass="passenger" length="5" maxSpeed="45" speedDev="0.0" color="0,0.67,0"/>
   <vType id="platoonLeader" vClass="passenger" length="5" maxSpeed="40" speedDev="0.0" color="1,0,0.25"/>
   <vType id="laneLeader" vClass="passenger" length="5" maxSpeed="40" speedDev="0.0" color="1,0,0.25"/>
   <vType id="member" vClass="passenger" length="5" maxSpeed="40" speedDev="0.0" color="1,0,0.25"/>
   <route id="route0" edges="hw0"/>

   <vehicle id="car0" type="platoonLeader" route="route0" depart="3" departLane="0" departSpeed="max" />
   <vehicle id="car1" type="member" route="route0" depart="4" departLane="0" departSpeed="max" />
   <vehicle id="car2" type="member" route="route0" depart="5" departLane="0" departSpeed="max" />
   <vehicle id="car3" type="laneLeader" route="route0" depart="3" departLane="2" departSpeed="max" />
   <vehicle id="car4" type="member" route="route0" depart="4" departLane="2" departSpeed="max" />
   <vehicle id="car5" type="member" route="route0" depart="5" departLane="2" departSpeed="max" />
</routes>
  • highway.net.xml: where I declare the road.
<?xml version="1.0" encoding="UTF-8"?>
<net version="0.27" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/net_file.xsd">

    <location netOffset="0.00,0.00" convBoundary="0.00,0.00,1000.00,0.00" origBoundary="-10000000000.000000,-10000000000.000000,10000000000.000000,10000000000.000000" projParameter="+proj=tmerc +ellps=WGS84 +datum=WGS84 +lat_0=49 +lon_0=11 +units=m +no_defs"/>

    <edge id="hw0" from="hwStart" to="hwEnd" priority="1" type="highway">
        <lane id="hw0_0" index="0" allow="private emergency authority army vip passenger hov taxi bus coach delivery truck trailer motorcycle evehicle" speed="33.33" length="1000.00" width="3.00" shape="1000.00,7.75 0.00,7.75"/>
        <lane id="hw0_1" index="1" allow="private emergency authority army vip passenger hov taxi bus coach delivery truck trailer motorcycle evehicle" speed="33.33" length="1000.00" width="3.00" shape="1000.00,4.65 0.00,4.65"/>
        <lane id="hw0_2" index="2" allow="private emergency authority army vip passenger hov taxi bus coach delivery truck trailer motorcycle evehicle" speed="33.33" length="1000.00" width="3.00" shape="1000.00,1.55 0.00,1.55"/>
    </edge>

    <junction id="hwEnd" type="dead_end" x="0.00" y="0.00" incLanes="hw0_0 hw0_1 hw0_2" intLanes="" shape="0.00,9.25 0.00,0.05"/>
    <junction id="hwStart" type="dead_end" x="1000.00" y="0.00" incLanes="" intLanes="" shape="1000.00,0.05 1000.00,9.25"/>

</net>

I cannot figure out where the errors are from. Would you mind helping me?

Thank you, Huy Nguyen.

2

There are 2 best solutions below

0
Nguyen Huy On BEST ANSWER

the cause of this issue is as explained by @Michael above. Technically, I did not sort those vehicles based on depart time.

The way to do this, especially after you have an unsorted and complete .rou.xml file as mine in the post, is to use this python script. You will need to clone the sumo repository and then you can use the script as a stand-alone script like this example:

python tools/route/sort_routes.py input.rou.xml -o output.rou.xml

2
Michael On

Concerning lane change: There is nothing in the network or in the vehicle definition which prohibits lane changing and the middle lane is empty at the beginning so it seems reasonable to me that one vehicle changes there.

Concerning missing vehicles: sumo already reports that the route file is not sorted by departure time, so it just skips the unsorted entries. The easiest way to avoid this is to load the route file as additional: sumo-gui -n highway.net.xml -a highway.rou.xml. You could of course also sort the route file.