0

I have an OMNET++ simulation model which I am interested to simulate more than once (4 different simulations in this case). I am running Omnet++ 6 now.

I have defined the configuration file as follows.

Here, I do run the simulation for every configuration i.e for the 60s, then re-run the model to calculate for 120s and so on,

Is there any optimal way to run all the configurations i.e (60s, 120s, and so on till the last configuration) and save the .sca, .vec result?

[General] #General Configuration
ned-path = .;../queueinglib
network = MM1
*.srv.capacity = 100
*.srv.serviceTime = exponential(1s/24)
*.srv.queueLength.result-recording-modes = +histogram
*.sink.lifeTime.result-recording-modes = +histogram
*.Service.responseTime.result-recording-modes = +mean
*.src.interArrivalTime = exponential(1s/20)

[Config Run_01]        #Specific Conguration1
extends=General
sim-time-limit = 60s
[Config Run_02]       #Specific Conguration2
extends=General
sim-time-limit = 120s
[Config Run_03]       #Specific Conguration3
extends=General
sim-time-limit = 60s
[Config Run_04]       #Specific Conguration4
extends=General
sim-time-limit = 120s`
  • Generate configs with some script/shell and then run and copy results elsewhere – Severin Pappadeux Feb 22 '23 at 02:40
  • I have written run_simulations.sh to loop through each configuration section in the .ini file and extract the configuration name from the section header to run the simulation with the current configuration and save the results to a file but the .txt files have only a message "Starting the OMNeT++ IDE..." – Waqas Ahmad Feb 22 '23 at 10:52

1 Answers1

0

You can set mentioned parameters within a console command to run your simulation so that you may iterate over configurations in a bash or python script to run simulations with selected parameters either sequentially or parallel. Example for sequential runs that I often use:

./your_sim_exec -m -u CmdEnv -r $RUN_NUMBER -c $RUN_CONFIG --sim-time-limit=$TIME_LIMIT ...

you just need to define a list or a range for your bash variables and a loop to substitute them into a run command one-by-one or randomly. If you want a parallel (batch) execution, then it is the same mechanism but you need to use opp_runall, check here

gehirndienst
  • 424
  • 2
  • 13
  • Thanks for your answer, I wrote a .sh script as follows: #!/bin/bash mkdir -p results for i in {1..4} do echo "Running configuration Run_0$i" omnetpp -f MM1.ini -c "Run_0$i" -r 0 --debug-on-errors echo "Renaming output files" mv results/simtime.sca results/simtime_run_0$i.sca mv results/responseTime.vec results/responseTime_run_0$i.vec mv results/queueLength.vec results/queueLength_run_0$i.vec mv results/lifeTime.vec results/lifeTime_run_0$i.vec done echo "Simulation run complete" Although, I am unable to execute the simulation with success. – Waqas Ahmad Feb 22 '23 at 17:08
  • you miss your executable or `opp_run`, check [this](https://stackoverflow.com/a/43710733/12423880) answer – gehirndienst Feb 23 '23 at 08:53