Search code examples
omnet++veinssumo

How to set number of nodes in omnet, veins and sumo simulation?


I am simulating a flooding protocol using omnet++, veins and sumo. I want to repeat the simulation with different number of nodes (say 50, 100 and 150). Is there a way to specify that how many (maximum) nodes are created in a particular simulation? Thank you in advance!


Solution

  • As you're using Veins, you can set the number of vehicles in the omnetpp.ini file. If you have a look to the configuration of the Erlangen scenario, you can find the parameters for the TraCIScenarioManager. By using that instance, you can specify the number of vehicles in your simulation by setting the numVehicles attribute. The result could look like this:

    *.manager.updateInterval = 1s
    *.manager.host = "localhost"
    *.manager.port = 9999
    *.manager.autoShutdown = true
    *.manager.launchConfig = xmldoc("erlangen.launchd.xml")
    *.manager.configFile = "erlangen.sumo.cfg"
    *.manager.numVehicles = 150
    

    With OMNeT++ you can do parameter studies, which are multiple simulation runs with different parameter values. The OMNeT++ TicToc tutorial shows you how to do that.

    The numVehicles attribute only sets the amount of vehicles inserted by Veins. If you specify additional vehicles in your SUMO configuration, they will be added as well.