4

When using veins as the framework coupling SUMO and omnet++, how is the number of vehicles determined? I know in the SUMO route file, we can put the number of vehicles in the flow tag. For example, <flow id="f" begin="0" end="100" number="23" from="beg" to="end"/>. In the omnetpp.ini file, we can also config the vehicle number by: *.manager.numVehicles = 4000. So, when both are set, which one eventually decide the number of vehicles in the simulation. Also, is there a way to set penetration rate in the SUMO config file?

J.G
  • 190
  • 2
  • 12

1 Answers1

2

The way this works is that the SUMO route file determines where vehicles drive, and the omnetpp.ini file gives parameters to TraCIScenarioManager, which creates the vehicles in the OMNeT++/VEINS environment. Thus, the flow parameter you set specifies how many vehicles exist in the "real" simulated environment, and the TraCIScenarioManager parameters specify how many of those are maximally present in VEINS. So basically, your value for the amount of vehicles is an upper limit for vehicles that can exist at any time. See also this answer.

edit: I had a closer look at the source code, and it turns out penetration rates are already implemented in VEINS (I kind of assumed you had checked for this). If you want a specific penetration rate, then you should use the penetration rate parameter in TraCIScenarioManager (see here. If you want to have 2000 vehicles active in the simulation (with or without radio), then you should leave numVehicles at 2000 and set the penetration rate to 0.5.

  • So, if I want 1000 out of 2000 vehicles having a radio, then I have two ways: 1) set the vehicle number to 2000 in both SUMO and omnetpp, with 0.5 penetration; or 2) set SUMO to 2000 and omnetpp to 1000, with 1.0 penetration. Is this correct? – J.G Apr 11 '18 at 13:42
  • If you want a specific penetration rate, you should use the `penetrationRate` variable. I'll update my answer with some details. – Rens van der Heijden Apr 11 '18 at 14:14
  • In [this answer](https://stackoverflow.com/a/46346676/), I am confused by Dr. Sommer's reply about "at least this many vehicles are present in a simulation after every time step". If the update interval is 1s, and `numVehicles` is 1000, I don't actually see 1000 vehicles in every 1s. Can you help explain? – J.G Apr 11 '18 at 21:04
  • My understanding is some are inserted, but with positions before the begin of the road, so I can't see. Please correct me if this is wrong. – J.G Apr 11 '18 at 21:10