Search code examples
omnet++veinssumo

How is the number of vehicles determined? In Sumo route file or in omnetpp.ini?


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?


Solution

  • 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.