Simulation#

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

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

HermesPy simulation configuration.

Args:

scenario (SimulationScenario, optional):

The simulated scenario. If none is provided, an empty one will be initialized.

num_samples (int, optional):

Number of drops generated per sweeping grid section. 100 by default.

drop_duration(float, optional):

Duration of simulation drops in seconds.

plot_results (bool, optional):

Plot results after simulation runs. Disabled by default.

dump_results (bool, optional):

Dump results to files after simulation runs. Enabled by default.

ray_address (str, optional):

The address of the ray head node. If None is provided, the head node will be launched in this machine.

results_dir (str, optional):

Directory in which all simulation artifacts will be dropped.

verbosity (Union[str, Verbosity], optional):

Information output behaviour during execution.

seed (int, optional):

Random seed used to initialize the pseudo-random number generator.

classmethod from_yaml(constructor, node)[source]#

Recall a new Simulation instance from YAML.

Parameters:
  • constructor (SafeConstructor) – A handle to the constructor extracting the YAML information.

  • node (Node) – YAML node representing the Simulation serialization.

Returns:

Newly created Simulation instance.

Return type:

Simulation

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 resolving to SimulationScenario.set_channel().

Parameters:
  • receiver (int | SimulatedDevice) – Index of the receiver within the channel matrix.

  • transmitter (int | SimulatedDevice) – 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

classmethod to_yaml(representer, node)[source]#

Serialize an Simulation object to YAML.

Parameters:
  • representer (SafeRepresenter) – A handle to a representer used to generate valid YAML code. The representer gets passed down the serialization tree to each node.

  • node (Simulation) – The Simulation instance to be serialized.

Returns:

The serialized YAML node

Return type:

Node

property console: Console#

Console the Simulation writes to.

Returns:

Handle to the console.

Return type:

Console

property console_mode: ConsoleMode#

Console mode during runtime.

Returms: The current console mode.

dump_results: bool#

Dump results to files after simulation runs.

property num_samples: int#

Number of samples per simulation grid element.

Returns:

Number of samples

Return type:

int

Raises:

ValueError – If number of samples is smaller than one.

plot_results: bool#

Plot results after simulation runs