Simulation Scenario#

class SimulationScenario(snr=inf, snr_type=SNRType.PN0, *args, **kwargs)[source]#

Bases: Scenario[SimulatedDevice]

Parameters:
  • 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.

add_device(device)[source]#

Add a new device to the scenario.

Parameters:

device (Device) – New device to be added to the scenario.

Raises:
Return type:

None

arriving_channels(receiver, active_only=False)[source]#

Collect all channels arriving at a device.

Parameters:
  • receiver (Receiver) – The receiving modem.

  • active_only (bool, optional) – Consider only active channels. A channel is considered active if its gain is greater than zero.

Return type:

List[Channel]

Returns: A list of arriving channels.

Raises:

ValueError – Should receiver not be registered with this scenario.

channel(transmitter, receiver)[source]#

Access a specific channel between two devices.

Parameters:
Returns:

Channel between transmitter and receiver.

Return type:

Channel

Raises:

ValueError – Should transmitter or receiver not be registered with this scenario.

departing_channels(transmitter, active_only=False)[source]#

Collect all channels departing from a transmitting device.

Parameters:
  • transmitter (SimulatedDevice) – The transmitting device.

  • active_only (bool, optional) – Consider only active channels. A channel is considered active if its gain is greater than zero.

Return type:

List[Channel]

Returns: A list of departing channels.

Raises:

ValueError – Should transmitter not be registered with this scenario.

new_device(*args, **kwargs)[source]#

Add a new device to the simulation scenario.

Returns:

Newly added simulated device.

Return type:

SimulatedDevice

process_inputs(impinging_signals, cache=True, trigger_realizations=None)[source]#

Process input signals impinging onto the scenario’s devices.

Parameters:
  • impinging_signals (Sequence[DeviceInput | Signal | Sequence[Signal]] | Sequence[Sequence[Signal]] | Sequence[Sequence[ChannelPropagation]]) – List of signals impinging onto the devices.

  • cache (bool, optional) – Cache the operator inputs at the registered receive operators for further processing. Enabled by default.

  • trigger_realizations (Sequence[TriggerRealization], optional) – Sequence of trigger realizations. If not specified, ideal triggerings are assumed for all devices.

Return type:

List[ProcessedSimulatedDeviceInput]

Returns: List of the processed device input information.

Raises:

ValueError – If the number of impinging_signals does not match the number of registered devices.

propagate(transmissions)[source]#

Propagate device transmissions over the scenario’s channel instances.

Parameters:

transmissions (Sequence[DeviceOutput]) – Sequence of device transmissisons.

Return type:

List[List[ChannelPropagation]]

Returns: Propagation matrix.

Raises:

ValueError – If the length of transmissions does not match the number of registered devices.

receive_devices(impinging_signals, cache=True, trigger_realizations=None)[source]#

Receive over all simulated scenario devices.

Internally calls SimulationScenario.process_inputs() and Scenario.receive_operators().

Parameters:
  • impinging_signals (List[Union[DeviceInput, Signal, Iterable[Signal]]]) – List of signals impinging onto the devices.

  • cache (bool, optional) – Cache the operator inputs at the registered receive operators for further processing. Enabled by default.

  • trigger_realizations (Sequence[TriggerRealization], optional) – Sequence of trigger realizations. If not specified, ideal triggerings are assumed for all devices.

Return type:

Sequence[SimulatedDeviceReception]

Returns: List of the processed device input information.

Raises:

ValueError – If the number of impinging_signals does not match the number of registered devices.

set_channel(beta_device, alpha_device, channel)[source]#

Specify a channel within the channel matrix.

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

  • alpha_device (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).

Raises:

ValueError – If transmitter_index or receiver_index are greater than the channel matrix dimensions.

Return type:

None

transmit_devices(cache=True)[source]#

Generate simulated device transmissions of all registered devices.

Devices sharing trigger models will be triggered simultaneously.

Parameters:

cache (bool, optional) – Cache the generated transmissions at the respective devices. Enabled by default.

Return type:

Sequence[SimulatedDeviceTransmission]

Returns:

Sequence of simulated simulated device transmissions.

property channels: ndarray#

Channel matrix between devices.

Returns:

An MxM matrix of channels between devices.

Return type:

np.ndarray

property snr: float | None#

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.

property snr_type: SNRType#

Type of signal-to-noise ratio.

Returns:

The SNR type.

Return type:

SNRType

yaml_tag = 'SimulationScenario'#