2. Tutorial - V2Xgithub/WiLabV2Xsim GitHub Wiki

2. Tutorial

2.1 Quick start

  1. Open the script "Simulations.m": this is an example script which calls WiLabV2Xsim main function with some example parameters

  2. Press "Run" on MATLAB or call the WiLabV2Xsim function from the MATLAB command window. If a popup appears, press "change folder"

  3. The script will start some example simulations. You can stop it whenever you want since now it has automatically updated the path folder. Please note that if you stop the simulation before its conclusion, no output will be printed. You can change the simulation time as an input when you call the function " WiLabV2Xsim "

  4. The main entrance of the simulator is the function "WiLabV2Xsim.m". You can enter the following command in the command window to get a list of the options and parameters you can modify before running the simulation:

    WiLabV2Xsim('help')
    

    You can edit the file "simulations.m" and add your simulation settings or create another script for your simulation in which you call the function "WiLabV2Xsim" with your custom input parameters.

  5. Simulation results will be stored in the “Output” folder. The file “MainOut.xls” will contain a summary of the parameters and the results.

2.2 Parameters

The input parameters could be set in 3 ways, listed with acreasing priority, and the 2nd and 3rd ways are recommended:

  1. Default

    The default value is set by the simulator. It is not recommended to change it unless you think it is necessary.

  2. Config File

    Build a new text file named "your_config_file.cfg". Listing the variable name and its values as same as the following format, and then pass the path of your config file into the functin WlLabV2Xsim.m:

    [variableName1]    Value1
    [variableName2]    Value2
    

    e.g. your_config_file.cfg

    [simulationTime]    10
    [seed]    2
    % [beaconSizeBytes]   350  % this line was comment
    [printPacketReceptionRatio]     true    % output PRR
    
  3. Arguments

    You could also pass the arguments into the function WlLabV2Xsim.m with name and value pair as shown in the example file "Simulations.m"

    or in YourSimulationScript.m. e.g.

    configFile = '...\the_path_of\your_config_file.cfg';  % config file
    myOutput = "D:\my_project\my_output\";  % output folder
    
    WiLabV2Xsim(configFile,"seed",3,'beaconSizeBytes',350,'outputFolder',myOutput);  % running simulator
    

    In current version, it is nessessary that passing the "configFile" into the function WlLabV2Xsim as the first parameter. If you do not want write parameters in the configFile, you could give WlLabV2Xsim an empty text file.

If there was a confiliction during the parameters' setting, the value with higher priority would overwrite the lower one.

More details please find the Table of input parameters

2.3 Output

The related parameters and format of the output files could be found in page: Output-File-Format-Description

2.n Simulation with SUMO

This part is under consideration...

Before using this part, additional settings should be done first.