Simulation
- class SimulationScenario(seed=None, snr=inf, snr_type=SNRType.PN0)
Bases:
Scenario
[SimulatedDevice
]- Parameters
seed (int, optional) – Random seed used to initialize the pseudo-random number generator.
snr (float, optional) – The assumed linear signal to noise ratio. Infinite by default, i.e. no added noise during reception.
snr_type (Union[str, SNRType], optional) – The signal to noise ratio metric to be used. By default, signal power to noise power is assumed.
- new_device(*args, **kwargs)
Add a new device to the simulation scenario.
- Returns
Newly added simulated device.
- Return type
- add_device(device)
Add a new device to the scenario.
- Parameters
device (DeviceType) – New device to be added to the scenario.
- Raises
ValueError – If the device already exists.
RuntimeError – If the scenario is not in default mode.
- Return type
None
- property channels: ndarray
Channel matrix between devices.
- Returns
An MxM matrix of channels between devices.
- Return type
np.ndarray
- channel(transmitter, receiver)
Access a specific channel between two devices.
- Parameters
transmitter (SimulatedDevice) – The device transmitting into the channel.
receiver (SimulatedDevice) – the device receiving from the channel
- Returns
Channel between transmitter and receiver.
- Return type
- Raises
ValueError – Should transmitter or receiver not be registered with this scenario.
- departing_channels(transmitter, active_only=False)
Collect all channels departing from a transmitting device.
- Parameters
transmitter (SimulatedDevice) – The transmitting device.
active_only (bool, optional) – Consider only active channels.
- Returns
A list of departing channels.
- Return type
List[Channel]
- Raises
ValueError – Should transmitter not be registered with this scenario.
- arriving_channels(receiver, active_only=False)
Collect all channels arriving at a device.
- set_channel(receiver, transmitter, channel)
Specify a channel within the channel matrix.
- Parameters
receiver (int) – Index of the receiver within the channel matrix.
transmitter (int) – Index of the transmitter within the channel matrix.
channel (Optional[Channel]) – The channel instance to be set at position (transmitter_index, receiver_index).
- Raises
ValueError – If transmitter_index or receiver_index are greater than the channel matrix dimensions.
- Return type
None
- property snr: Optional[float]
Ratio of signal energy to noise power at the receiver-side.
- Returns
Linear signal energy to noise power ratio. None if not specified.
- Return type
Optional[float]
- Raises
ValueError – On ratios smaller or equal to zero.
- propagate(transmitted_signals)
- Return type
ndarray
- class SimulationRunner(scenario)
Bases:
object
- Parameters
scenario (SimulationScenario) – Scenario to be run.
- transmit_operators(*, _ray_trace_ctx=None)
Generate base-band signal models emitted by all registered transmitting operators.
- Return type
None
- transmit_devices(*, _ray_trace_ctx=None)
Generate radio-frequency band signal models emitted by devices
- Return type
None
- propagate(*, _ray_trace_ctx=None)
Propagate the signals generated by registered transmitters over the channel model.
Signals receiving at each receive modem are a superposition of all transmit signals impinging onto the receive modem over activated channels.
The signal stream matrices contain the number of antennas on the first dimension and the number of signal samples on the second dimension.
- Return type
None
- receive_devices(*, _ray_trace_ctx=None)
Generate base-band signal models received by devices.
- Return type
None
- receive_operators(*, _ray_trace_ctx=None)
Demodulate base-band signal models received by all registered receiving operators.
- Return type
None
- class Simulation(scenario=None, num_drops=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)
Bases:
Serializable
,Pipeline
[SimulationScenario
],MonteCarlo
[SimulationScenario
]HermesPy simulation configuration.
Args:
- scenario (SimulationScenario, optional):
The simulated scenario. If none is provided, an empty one will be initialized.
- num_drops (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.
- yaml_tag: Optional[str] = 'Simulation'
YAML serialization tag.
- plot_results: bool
Plot results after simulation runs
- dump_results: bool
Dump results to files after simulation runs.
- property num_drops: int
Number of generated data drops.
Each drop is generated from a dedicated system triggering.
Returns: The number of drops.
- Raises
ValueError – For num_drops smaller than one.
- Return type
int
- 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.
- run()
Execute the configuration.
- Return type
- classmethod to_yaml(representer, node)
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
- classmethod from_yaml(constructor, node)
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