1

I was wandering if I can change the number of cars in veins or is fixed? If so, which class in the code I can find the declaration of the number of cars?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

3 Answers3

3

If you use randomTrips.py to generate rou.xml you can specify the number of vehicles you want in your simulation. In this case a 50 vehicles rou.xml file will be created.

<SUMO_HOME>/tools/randomTrips.py -n input_net.net.xml -e 50 
pb772
  • 539
  • 1
  • 3
  • 14
  • The parameter `-e` actually defines the end time for the trips, not the number of vehicles. However, in this case of static routes it will be the same. – Julian Heinovski Jun 02 '18 at 10:45
1

Anything to do with vehicle movement in a Veins simulation (e.g., when a car starts, where it starts, how and where it drives, ...) is governed by the road traffic simulator SUMO. The SUMO simulator comes with an excellent tutorial (Hello SUMO) and an extensive online user manual, available on the documentation pages on the SUMO website. In brief, you want to change the .rou.xml file to change how many cars are driving.

Christoph Sommer
  • 6,893
  • 1
  • 17
  • 35
0

In the .rou.xml file, update the flow parameter number. For example the following setting:

"flow id="flow0" type="vtype0" route="route0" begin="0" period="3" number="2"/"

will change the number of vehicles to 2

pushkin
  • 9,575
  • 15
  • 51
  • 95