Simulation

Inheritance diagram of hermespy.simulation.simulation.Simulation

The Simulation class extends HermesPy’s core distributed MonteCarlo simulation framework to support parameterized physical layer simulations of wireless communication and sensing scenarios. It manages the configuration of the physical layer description represented by SimulationScenarios. Once the user has configured the physical layer description, a call to run will launch a full Monte Carlo simulation iterating over the configured parameter grid.

During simulation runtime, the follwing sequence of simulation stages is repeatedly executed:

  1. Generate digital base-band signal models to be transmitted by the simulated devices

  2. Simulate the hardware effects of devices during transmission

  3. Realize all channel models

  4. Propagate the device transmissions over the channel realizations

  5. Simulate the hardware effects of devices during reception

  6. Digitally process base-band signal models received by the simulated devices

  7. Evaluate the configured performance metrics

class Simulation(scenario=None, num_samples=100, drop_interval=inf, plot_results=False, dump_results=True, console_mode=ConsoleMode.INTERACTIVE, ray_address=None, results_dir=None, verbosity=Verbosity.INFO, seed=None, num_actors=None, debug=False)[source]

Bases: Pipeline[SimulationScenario, SimulatedDevice], MonteCarlo[SimulationScenario]

Executable HermesPy simulation configuration.

Parameters:
  • scenario (SimulationScenario | None) – The simulated scenario. If none is provided, an empty one will be initialized.

  • num_samples (int) – Number of drops generated per sweeping grid section. 100 by default.

  • drop_interval (float) – Interval at which drops are being generated in seconds. If not specified, only a single drop is generated at the beginning of the simulation.

  • plot_results (bool) – Plot results after simulation runs. Disabled by default.

  • dump_results (bool) – Dump results to files after simulation runs. Enabled by default.

  • console_mode (ConsoleMode) – Console output behaviour during execution.

  • ray_address (str | None) – The address of the ray head node. If None is provided, the head node will be launched in this machine.

  • results_dir (str | None) – Directory in which all simulation artifacts will be dropped.

  • verbosity (str | Verbosity) – Information output behaviour during execution.

  • seed (int | None) – Random seed used to initialize the pseudo-random number generator.

  • num_actors (int | None) – Number of actors to be deployed for parallel execution. If None is provided, the number of actors will be set to the number of available CPU cores.

  • debug (bool) – Enables debug mode during simulation runtime. Debug mode will add performance-related information to the output and enable the ray dashboard.

drop(timestamp=0.0)[source]

Generate a drop at a specific timestamp.

Parameters:

timestamp (float) – Timestamp at which the drop is generated. Defaults to 0.0.

Return type:

SimulatedDrop

run()[source]

Execute the configuration.

Returns: The result of the run.

Return type:

MonteCarloResult

set_channel(alpha, beta, channel)[source]

Specify a channel within the channel matrix.

Convenience method to setting the channel of the managed of the managed SimulationScenario instance, which can be accessed via the scenario property.

Parameters:
  • receiver – Index of the receiver within the channel matrix.

  • transmitter – Index of the transmitter within the channel matrix.

  • channel (Channel | None) – The channel instance to be set at position (transmitter_index, receiver_index).

Return type:

None

property console: Console[source]

Console the Simulation writes to.

Returns: Handle to the console.

property console_mode: ConsoleMode[source]

Console mode during runtime.

Returns: The current console mode.

property devices: Sequence[SimulatedDevice][source]

Sequence of all devices registered in the simulation scenario

property drop_interval: float[source]

Interval at which drops are being generated in seconds.

Raises:

ValueError – For values smaller or equal to zero.

dump_results: bool[source]

Dump results to files after simulation runs.

property num_samples: int[source]

Number of samples per simulation grid section.

This represents the maximum number of samples a parameter combination will be sampled. The final number of collected samples may be smaller if the configured evaluators report confidence in their results before the maximum number of samples is reached.

Raises:

ValueError – If number of samples is smaller than one.

plot_results: bool[source]

Plot results after simulation runs

property_blacklist = {'console', 'console_mode', 'scenario'}[source]