Running parallel simulations (using the Command Line)

前端 未结 1 1580
生来不讨喜
生来不讨喜 2021-01-17 07:07

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

My omnetpp.ini file looks as below :

         


        
相关标签:
1条回答
  • 2021-01-17 07:29

    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.

    0 讨论(0)
提交回复
热议问题