0

How can I run the simulation with different configurations? I am using omnet++ version 4.6.

My omnetpp.ini file looks as below :

[General]

[Config Dcn2]

network = Dcn2

# leaf switch
#**.down_port = 2
**.up_port = 16 #12   # 4

# spine switch
**.port =  28 # 20 #2048

# crossconnect
**.cross_down_port = 28 # 20 #2048
**.cross_up_port = 28 # 20 #2048

# to set destination of packet
**.number_leaf_switch = 28 # 20 #2048

# link speed
#**.switch_switch_link_speed = 40 Mbps


**.interArrivalTime = ${exponential(.0001),exponential(0.0002),exponential(0.0003)}   

**.batch_length = 10
**.buffer_length = 10

sim-time-limit = 1000s

I want to run the code with different values of interArrivalTime. But I can neither run with different configs (one after another), nor can I run individual runs in parallel on separate cores.

I have tried with cmdev option in run configurations but the different runs doesn't show up apart from the 1st one. When I try mentioning the number of processes to be more than one then also only the first run gets simulated. I really cannot find out the reason.

user4786271
  • 1,555
  • 13
  • 18
Sampi
  • 87
  • 2
  • 4
  • 14
  • can you please add the commands that you tried for running on more than one core, and what you have tried in the cmdenv. That will help for me to provide the answer – user4786271 Jun 01 '15 at 10:57
  • I tried doing that by putting * in the run number field and mentioning the number of processes to be 4 or 5 – Sampi Jun 01 '15 at 14:24
  • "can you please add **the commands**...?" – user4786271 Jun 01 '15 at 14:36
  • i tried it in the omnet++ ide itself in the run configuration itself – Sampi Jun 01 '15 at 20:20
  • well, it does not work that way... any feedback from the approach provided in the answer below? – user4786271 Jun 02 '15 at 09:14
  • Yes it does work for few other codes that I tried but I don't know why it didn't this time. Thanks for your help. I can run 7 different configurations at a time from the command prompt. But ./run doesn't work. I had to use ./filename . – Sampi Jun 03 '15 at 10:12
  • yeap, `.fileName` or `.exampleName` is another option to run simulations... if you consider my answer to be helpful accept it so it helps for future reference to other SO members – user4786271 Jun 03 '15 at 13:15

1 Answers1

4

Config Examinataion

In your case you can perform config examination. OMNeT++ offers different options for that. They are explained under the Parameter Studies section of the OMNeT++ manual.

So you can try one of the following options to examine your configs and thus config file:

  • ./run –a - will show all the configurations in the omnet.ini
  • ./run -x <config_name> - will give more info about a specific config
  • ./run -x <config_name> -g - see all the combinations of configs

First you will have to navigate to your example folder, and there execute one of the aforementioned commands.


I executed: ./run -x Dcn2 -g and got the following resuls

OMNeT++ Discrete Event Simulation  (C) 1992-2014 Andras Varga, OpenSim Ltd.
Version: 4.6, build: 141202-f785492, edition: Academic Public License -- NOT FOR COMMERCIAL USE
See the license for distribution terms and warranty disclaimer
Setting up Tkenv...

Config: Dcn2
Number of runs: 3
Run 0: $0=exponential(.0001), $repetition=0
Run 1: $0=exponential(0.0002), $repetition=0
Run 2: $0=exponential(0.0003), $repetition=0

End.

This confirms indeed that you have 3 different runs for the simulation parameter you are trying to modify. However, variable name you are using for the interArrivalTime parameter is assigned to $0 by default because you have not specified it.

If you change the following line in your config:

**.interArrivalTime = ${exponential(.0001),exponential(0.0002),exponential(0.0003)}

to

**.interArrivalTime = ${interArrivalTime = exponential(0.0001),exponential(0.0002),exponential(0.0003)}

you will get a more descriptive output for ./run -x Dcn2 -g


Running different runs of a config:

Next step for you would be to run the different runs for your config. You can do that by navigating to your example directory and execute:

./run -c <config-name> -r <run-number> -u Cmdenv

Note that the <config-name> would be Dcn2 for you, and the -r specifies which of the runs given above you would like to execute.

In other words you can open three terminal windows and navigate to your example directory and do:

  1. ./run -c Dcn2 -r 0 -u Cmdenv - for interArrivalTime = exponential(0.0001)
  2. ./run -c Dcn2 -r 1 -u Cmdenv - for interArrivalTime = exponential(0.0002)
  3. ./run -c Dcn2 -r 2 -u Cmdenv - for interArrivalTime = exponential(0.0003)

Distinguishing Different run results

To be able to distinguish between the output result files of the different runs for your given config you can modify the default name of the output file.

The "how-to" is given in the 12.2.3 Result File Names section of the OMNeT++ manual.

output-vector-file = "${resultdir}/${configname}-${runnumber}.vec"
output-scalar-file = "${resultdir}/${configname}-${runnumber}.sca"

As you can see by default your output files will be distinguished by the ${runnumber} variable. You can further improve it by adding the interArrivalTime to the output file name.

Example:

output-scalar-file = "${resultdir}/${configname}-${runnumber}-IAtime=${interArrivalTime}.sca/vec"

I have not tested the final approach. So you might get some error along the path.

user4786271
  • 1,555
  • 13
  • 18
  • 1
    Sepcifying `**.interArrivalTime = exponential(${interArrivalTime = 0.0001, 0.0002, 0.0003}) ` would be even more natural + an additional tip: you can use the `opp_runall` command to run all iterations from the command line and can specify even `-j4` that it shoud use 4 cores in parallel. – Rudi Jul 06 '15 at 09:41