campaign module¶
-
campaign.add_iteration_variables_to_scenarions_ini_file(temp_ini_file, iteration_variables_dictionary)[source]¶ Scenarios with same iteration variables.txt
-
campaign.ask_for_scenarios_to_simulate(sim_scenarios_list)[source]¶ Select scenarios to include in the simulation campaign
- Args:
- sim_scenarios_list(list): List of scenarios found in .ini file specified as argument
@param sim_scenarios_list: @return:
-
campaign.build_simulation_campaign(max_processors, output_dir, omnet_path, sim_time, repetitions, sim_scenarios_list, variables_path, inifile, analyze, makefile, verbose, NED_files_dir)[source]¶ Execute parallel simulations of simulation campaign elements. If there is not enough processors, a bath is used for queue simulations and distribute among processors.
Args:
@param max_processors: (int) The max number of cpus to use. By default, all cpus are used. @param output_dir: (path) The space of structure.csv to export. @param omnet_path: (path) The OMNET++ installation path @param sim_time: (int) The simulation time. Common for all scenarios. @param repetitions: (int) The number of runs for each iteration parameter. @param sim_scenarios: (list) List of selected scenarios to include in the campaign @param inifile: (path) Path to .ini file of veins project. @param analyze: (bool) If true execute simulation campaign. Otherwise analyze result files @param makefile: (path) Path to executable veins project. @return:
-
campaign.create_temp_ini_file(output_results, repetitions, veins_ini_file_name, iteration_variables_dictionary)[source]¶ Instantiates a temp.ini file with simulation campaign configurations.
Parameters: - output_results (path) – The space of structure.csv to export.
- repetitions (int) – The number of runs for each iteration parameter.
- veins_ini_file_name (path) – Path to .ini file of veins project.
-
campaign.execute_sim(veins_exec_project_path, max_processors, omnet_path, scenario, batch, sim_time, runs, temp_ini_name, verbose, NED_files_dir)[source]¶ Execute scenario simulation using OMNET++ funcionality (opp_run all OMNET++ simulation manual 11.20 Running Simulation Campaigns)
Args: @param veins_exec_project_path: (path) Path to executable veins project. @param max_processors: (int) The max number of cpus to use. By default, all cpus are used. @param omnet_path: (path) Path to the OMNET++ installation. @param scenario: Scenario to simulate @param batch: Batch of simulations @param sim_time: (int) The simulation time. Common for all scenarios. @param runs: Bundle of runs (e.g. 0,1,2,3….) @param temp_ini_name: (string) VEINs ini configuration file name @return: :param verbose:
-
campaign.get_scenarios(veins_ini_file)[source]¶ Try to read simulation scenarios in VEINs project .ini file
OMNET++ defines [Config ] as the structure.csv in ini file to declare an scenario. This function return a list with [Config ] declarations found in ini file.
-
campaign.isNotBlank(myString)[source]¶ Check if string is empty or null.
Args:
@param myString: (string) Any string @return: (bool)
-
campaign.missing_files(total_sims, output_dir)[source]¶ Check in results folder if there are missing files of simulation campaign @param total_sims: (int) Total number of runs = scenarios * iter variable * repetitions_per_scenario @param output_dir: (path) The space of structure.csv to export. @return:
-
campaign.new_folder(new_directory)[source]¶ Create new folder and replace if it exists. Used to creates the results folder where results files are saved.
Parameters: new_directory (path) – Path of the new folder
-
campaign.parallel(max_processors, omnet_path, batch, sim_time, runs_bundle, temp_ini_name, sim_scenarios_list, makefile, verbose, NED_files_dir)[source]¶ Execute parallel summary. If the number of cpus < # of summary a batch of runs is set
Args: @param max_processors: (int) The max number of cpus to use. By default, all cpus are used. @param omnet_path: (path) Path to the OMNET++ installation. @param batch: (int) Number of simulations per cpu @param sim_time: (int) The simulation time. Common for all scenarios. @param runs_bundle: (int) Bundle of runs (e.g. 0,1,2,3..) @param temp_ini_name: (string) VEINs ini configuration file name @param iter_var_per_scenario: (dict) Dictionary with scenarios as keys and iterations as values @param makefile: (path) Path to executable veins project. @return:
-
campaign.read_iteration_variables_from_file(scenarios_to_sim, iter_parameters_file_path)[source]¶ Get the number of iteration structure.csv (defined as specified in OMNET++ Simulation manual 10.4 Parameter Studies) of each scenario (sim_scenarios) defined in .ini file.
e.g. OMNET++ study parameter definition -> *.numHosts = ${1, 2, 5, 10..50 step 10}
Args: sim_scenarios (list): List of selected scenarios to include in the campaign veins_ini_file_path (path): Path to .ini file of veins project.
Return a dictionary with scenarios as dic keys and read_iteration_variables_from_file as values. Values in read_iteration_variables_from_file dictionary are defined as follows:
scenario1: [parameters1, parameter2, … , # of read_iteration_variables_from_file] scenario2: [parameters1, parameter2, … , # of read_iteration_variables_from_file]
-
campaign.run(output_dir, max_processors, omnet_path, sim_time, repetitions, analyze, iter_path, inifile, makefile, verbose, NED_files_dir)[source]¶ Return the results relative to the desired parameter space in the form of an xarray data structure.csv.
Args: output_dir: (path) The space of structure.csv to export. max_processors: (int) The max number of cpus to use. By default, all cpus are used. omnet_path: (path) Path to the OMNET++ installation. By default the script try to find the installation path. sim_time: (int) The simulation time. Common for all scenarios. repetitions: (int) The number of runs for each iteration parameter. analyze: (bool) If true execute simulation campaign. Otherwise analyze result files from a simulation campaign to find missing simulations. inifile: (path) Path to .ini file of veins project. makefile: (path) Path to executable veins project.
-
campaign.scenario_runs_set(scenario_iteration_variables_dictionary, repetitions)[source]¶ Generate runs list per scenario in OMNET++ format (opp_run all OMNET++ simulation manual 11.20 Running Simulation Campaigns) for create batches e.g. -r 0,1,2,3.
Parameters: - scenario_iteration_variables_dictionary (dict) – Dictionary with scenarios as keys and the number of iteration variables.txt as values
- repetitions (int) – The number of runs for each iteration parameter.