Simulation Scenario#
- class SimulationScenario(snr=inf, snr_type=SNRType.PN0, *args, **kwargs)[source]#
Bases:
Scenario
[SimulatedDevice
]- Parameters:
- add_device(device)[source]#
Add a new device to the scenario.
- Parameters:
device (Device) – 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:
- arriving_channels(receiver, active_only=False)[source]#
Collect all channels arriving at a device.
- Parameters:
- Return type:
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:
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)[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:
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:
- 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:
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()
andScenario.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:
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:
- 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:
- 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.
- yaml_tag = 'SimulationScenario'#