Channel Model#

class Channel(alpha_device=None, beta_device=None, gain=1.0, interpolation_mode=InterpolationMode.NEAREST, devices=None, seed=None)[source]#

Bases: ABC, RandomNode, Serializable, Generic[CRT]

Abstract base class of all channel models.

The channel model represents the basic configuration of two linked SimulatedDevices alpha_device and beta_device exchanging electromagnetic Signals.

Each invokation of propagate() and realize() will generate a new Channel Realization instance by internally calling _realize(). In the case of a propagate() call the generated Channel Realization will additionally be wrapped in a Channel Propagation. The channel model represents the matrix function of time \(t\) and delay \(\tau\)

\[\mathbf{H}(t, \tau; \mathbf{\zeta}) \in \mathbb{C}^{N_{\mathrm{Rx}} \times N_{\mathrm{Tx}}} \ \text{,}\]

the dimensionality of which depends on the number of transmitting antennas \(N_{\mathrm{Tx}}\) and number of receiving antennas \(N_{\mathrm{Rx}}\). The vector \(\mathbf{\zeta}\) represents the channel model’s paramteres as random variables. Realizing the channel model is synonymous with realizing and “fixing” these random parameters by drawing a sample from their respective distributions, so that a Channel Realization represents the deterministic function

\[\mathbf{H}(t, \tau) \in \mathbb{C}^{N_{\mathrm{Rx}} \times N_{\mathrm{Tx}}} \ \text{.}\]
Parameters:
  • alpha_device (SimulatedDevice, optional) – First device linked by this channel. Initializes the alpha_device property. If not specified the channel is considered floating, meaning a call to realize() will raise an exception.

  • beta_device (SimulatedDevice, optional) – Second device linked by this channel. Initializes the beta_device property. If not specified the channel is considered floating, meaning a call to realize() will raise an exception.

  • gain (float, optional) – Linear channel power gain factor. Initializes the gain property. \(1.0\) by default.

  • interpolation_mode (InterpolationMode, optional) – Interpolation behaviour of the channel realization’s delay components with respect to the proagated signal’s sampling rate. NEAREST by default, meaning no resampling is required.

  • devices (Tuple[SimulatedDevice, SimulatedDevice], optional) – Tuple of devices connected by this channel model.

  • seed (int, optional) – Seed used to initialize the pseudo-random number generator.

abstract _realize()[source]#

Generate a new channel realzation.

Abstract subroutine of realize(). Each Channel is required to implement their own _realize() method.

Returns: A new channel realization.

Return type:

TypeVar(CRT, bound= ChannelRealization)

propagate(signal, transmitter=None, receiver=None, interpolation_mode=InterpolationMode.NEAREST, cache=True)[source]#

Propagate radio-frequency band signals over this channel.

Generates a new channel realization by calling realize and propagates the provided signal over it.

Let

\[\mathbf{X} = \left[ \mathbf{x}^{(0)}, \mathbf{x}^{(1)},\, \dots,\, \mathbf{x}^{(M_\mathrm{Tx} - 1)} \right] \in \mathbb{C}^{N_\mathrm{Tx} \times M_\mathrm{Tx}}\]

be the signal transmitted by transmitter and

\[\mathbf{Y} = \left[ \mathbf{y}^{(0)}, \mathbf{y}^{(1)},\, \dots,\, \mathbf{x}^{(M_\mathrm{Rx} - 1)} \right] \in \mathbb{C}^{N_\mathrm{Rx} \times M_\mathrm{Rx}}\]

the reception of receiver, this method implements the channel propagation equation

\[\mathbf{y}^{(m)} = \sum_{\tau = 0}^{m} \mathbf{H}^{(m, \tau)} \mathbf{x}^{(m-\tau)} \ \text{.}\]
Parameters:
  • signal (DeviceOutput | Signal) – Signal models emitted by transmitter associated with this wireless channel model.

  • transmitter (Device, optional) – Device transmitting the signal to be propagated over this realization. If not specified alpha_device will be assumed.

  • receiver (Device, optional) – Device receiving the propagated signal after propagation. If not specified beta_device will be assumed.

  • interpolation_mode (InterpolationMode, optional) – Interpolation behaviour of the channel realization’s delay components with respect to the proagated signal’s sampling rate.

  • cache (bool, optional) – Should the generated realization be cached at this channel instance? Enabled by default.

Return type:

ChannelPropagation[TypeVar(CRT, bound= ChannelRealization)]

Returns: The channel propagation resulting from the signal propagation.

realize(cache=True)[source]#

Generate a new channel realization.

If cache is enabled, realization will be updated to the newly generated ChannelRealization.

Parameters:

cache (bool, optional) – Cache the realization. Enabled by default.

Return type:

TypeVar(CRT, bound= ChannelRealization)

Returns: A new channel realization.

abstract recall_realization(group)[source]#

Recall a realization of this channel type from its HDF serialization.

Parameters:

group (h5py.Group) – HDF group to which the channel realization was serialized.

Return type:

TypeVar(CRT, bound= ChannelRealization)

Returns: The recalled realization instance.

property alpha_device: SimulatedDevice | None#

First device linked by this channel.

Referred to as \(\alpha\) in the respective equations.

If not specified, i.e. None, the channel is considered floating, meaning a call to realize() will raise an exception.

property beta_device: SimulatedDevice | None#

Second device linked by this channel.

Referred to as \(\beta\) in the respective equations.

If not specified, i.e. None, the channel is considered floating, meaning a call to realize() will raise an exception.

property gain: float#

Linear channel power gain factor.

The default channel gain is 1. Realistic physical channels should have a gain less than one.

For configuring logarithmic gains, set the attribute using the dB shorthand:

from hermespy.core import dB

# Configure a 10 dB gain
channel.gain = dB(10)
Raises:

ValueError – For gains smaller than zero.

property interpolation_mode: InterpolationMode#

Interpolation behaviour of the channel realization’s delay components with respect to the proagated signal’s sampling rate.

property realization: CRT | None#

The last realization used for channel propagation.

Updated every time propagate() or realize() are called and cache is enabled. None if realize() has not been called yet.

property scenario: SimulationScenario | None#

Simulation scenario the channel belongs to.

Handle to the Scenario this channel is asigned to. None if the channel is not part of any specific Scenario.

The recommended way to set the scenario is by calling the set_channel method:

from hermespy.simulation import SimulationScenario

scenario = SimulationScenario()
alpha_device = scenario.new_device()
beta_device = scenario.new_device()

channel = Channel()
scenario.set_channel(alpha_device, beta_device, channel)