0

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.

Nguyen Huy
  • 45
  • 9

2 Answers2

0

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.

Michael
  • 3,510
  • 1
  • 11
  • 23
  • Hello @Michael, thank you very much for your information. 1. I agree that there is nothing prohibiting the lane changing when there is an empty lane in the middle. However, there must be some code that facilitates the automatic lane changing, right?. that vehicle cannot just change by itself. 2. I did not know your second point before. I will try and dig deeper into that. However, since I create this scenario so that later I implement them into a network simulation (Omnetpp). So what do you suggest? – Nguyen Huy Apr 21 '23 at 07:59
  • I figured out the way. – Nguyen Huy Apr 21 '23 at 13:39
0

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

Nguyen Huy
  • 45
  • 9