I modified the erlagen.rou.xml using duarouter to get the random routes for the vehicles. It looks like this:
<vehicle id="0" depart="0.00"><route edges="31401017#0 4006688#0 4006688#1 4006688#2 4006688#3 4006688#4 29900561#0 29900561#1 32270595 33174302#0 33174302#1 4686970#0 4686970#1 122161381 30350448 30350449 4047309 30751813 -35842306#1 -35842306#0 -4900741 -4900739#2 -4900739#1"/>
</vehicle>
<vehicle id="1" depart="1.00">
<route edges="19796637 122161381 30350448 8364476 30350450#0 30350450#1 30350450#2 4006702#0 31255203#0 -31241851#2 -31241851#1 -31241851#0 31241816#3 31241835#1 31241834#0"/>
</vehicle>
<vehicle id="2" depart="2.00">
<route edges="31401017#0 4006688#0 4006688#1 4006688#2 4006688#3 4006688#4 29900561#0 29900561#1 32270595 33174302#0 33174302#1 4686970#0 4686970#1 122161381 30350448 8364476 30350450#0 30350450#1 30350450#2 4006702#0 31255203#0 31255203#1"/>
</vehicle> .......
In the original erlangen.rou.xml of VEINS, I could control the number of vehicles either by using " *.manager.numVehicles" in the omnetpp.ini file or by using the "number =198" inside " erlangen.rou.xml". But when i use only 5 vehicles using " *.manager.numVehicles = 5" in omnetpp.ini file, there are multiple vehicles generated from the "erlangen.rou.xml". How can I use the desired number of vehicles.
Thank you.
you can get approximate number of vehicles by increasing the end time in python command while you are generating the traffic in CMD like in following commands end time is 200 ,so you may get around 100 vehicles. python c:\sumo\sumo25\tools\randomTrips.py -n map.net.xml -e 200 -l
python c:\sumo\sumo25\tools\randomTrips.py -n map.net.xml -r map.rou.xml -e 200 -l
Veins 4.6 creates a new network node for every (eligible) vehicle created by SUMO (where eligibility can be limited by vehicle type and region of interest).
In addition, the
numVehicles
parameter of theTraCIScenarioManager
classes of Veins 4.6 takes care of ensuring that at least this many vehicles are present in a simulation after every time step (click here to see the source code responsible for this behavior).Thus, the
numVehicles
parameter cannot be used to limit the number of vehicles. For this, either SUMO needs to be instructed to create fewer vehicles -- or SUMO needs to be instructed to define some routes but to create no vehicles at all (thus letting thenumVehicles
parameter take over creation of vehicles)