ParallelSimulator¶
-
class
NetworkSim.simulation.simulator.parallel.
ParallelSimulator
(until=None, convergence=None, sem_tr=None, bs=None, num_nodes=None, transmitter_type=None, receiver_type=None, traffic_generation_method=None, max_data_rate=None, average_data_rate=None, bidirectional=None, seed=None, n_jobs=- 1)[source]¶ Parallel simulator class to enable multiple simulations to be run in parallel with minimum input parameters.
All parameters of the simulation should be input as a list, and in one of the following fashions:
If the parameter is not specified, i.e. parameter value is
None
, the parameter is set to the default value.If one value of the parameter is specified, i.e. parameter=[param_value], all simulations run on the same specified value.
Parameter values for all simulations are specified. The indices of the values in the list indicate the numbers of the simulators. Therefore, if two simulations with TT-FR and FT-TR are to be run, the parameters should be set to: transmitter_type=[‘T’, ‘F’], receiver_type=[‘F’, ‘T’].
The number of simulators correspond to the length of the list in which all parameter values are specified. For example, if average_data_rate=[10, 20, 30, 40, 50], 5 simulations will be created, and the simulator number corresponds to the index of the parameter values in the list input. The summary() function can be called after the simulation for an inspection of detailed parameters of each simulator used.
- Parameters
until (float, optional) – The end time of the simulations. This should be specified if the simulation does not run on convergence. Default is
None
.convergence (bool, optional) – Automatic convergence mode of simulation. Default is
True
.sem_tr (float, optional) – The threshold standard error of mean (SEM) for convergence. Default is
None
.bs (int, optional) – The batch size for SEM calculation during convergence. Default is
None
.num_nodes (int, optional) – The total number of nodes in the network. Default value follows that in the Network class (
100
).transmitter_type (str, optional) – The type of transmitter, chosen from the following:
- tunable, t or T
Tunable transmitter (fixed receiver must be chosen).
- fixed, f, or F
Fixed transmitter (tunable receiver must be chosen).
Default is
tunable
.receiver_type (str, optional) – The type of receivers, chosen from the following:
- tunable, t or T
Tunable receiver (fixed transmitter must be chosen).
- fixed, f, or F
Fixed receiver (tunable transmitter must be chosen).
Default is
fixed
.traffic_generation_method (str, optional) – The source traffic generation method, chosen from the following:
- poisson
Poisson (biased negative exponential) distribution.
- pareto
Pareto distribution.
Default is
poisson
.max_data_rate (float, optional) – The maximum data rate at each node, in Gbit/s. Default is
100
.average_data_rate (float, optional) – The expected average data rate at each node, in Gbit/s. Default is
50
.bidirectional (bool, optional) – The type of network architecture, either bidirectional or unidirectional. Default is
False
, which is unidirectional.seed (int, optional) – The seed used for source traffic generation. Default is
1
.n_jobs (int, optional) – The number of processors used for parallel operations. Default is
-1
(all available processors).
-
info
(simulation_id, info_type, component_type, component_id)[source]¶ Obtain simulation information from individual simulators.
- Parameters
simulation_id (int) – The ID of the simulator.
info_type (str) – The type of information requested, chosen from the following:
- control or c
Information on control ring. When device_type == None, this returns all packet transmission information on the control ring, otherwise it refers to control packets transmitted by a transmitter or control packets received by a receiver. component_id is not required in this case.
- data or d
Information on data ring. When device_type == None, this returns all packet transmission information on the data ring, otherwise it refers to data packets transmitted by a transmitter or data packets received by a receiver. An component_id must be specified in this case.
component_type (str) – The type of component in the simulation, chosen from the following:
- ram or RAM
Transmitter RAM information, where data packets are generated. An component_id must be specified in this case, but info_type is not required.
- transmitter or t
Transmitter packet information. Both component_id and info_type must be specified.
- receiver or r
Receiver packet information. Both component_id and info_type must be specified.
component_id (int) – The ID of the component of choice.
-
summary
(simulator_id=None, summary_type=None)[source]¶ Obtain summaries of the simulations.
- Parameters
simulator_id (int, optional) – The simulator ID of choice. Default is
None
. If no ID is specified, a combined generic summary of the key parameters used in all simulators is produced.summary_type (str, optional) – The type of summary, chosen from the following:
- None
No summary_type input, and a generic summary is returned.
- latency or l
Latency summary, with latency information for all source-destination combinations.
- ram or RAM
Transmitter RAM data generation summary.
- transmitter or t
Transmitter summary.
- receiver or r
Receiver summary.
This is an individual summary of the specified simulator, and therefore a simulator_id must be specified.