Channel

Inheritance diagram of hermespy.channel.channel.Channel

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

Each invokation of realize will generate a new ChannelRealization instance by internally calling ._realize. 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 ChannelRealization represents the deterministic function

\[\mathbf{H}(t, \tau) \in \mathbb{C}^{N_{\mathrm{Rx}} \times N_{\mathrm{Tx}}} \ \text{.}\]
class Channel(gain=1.0, seed=None)[source]

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

Abstract base class of all channel models.

Channel models represent the basic physical properties of a elemtromagnetic waves propagating through space in between devices.

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

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

add_sample_hook(callback, transmitter=None, receiver=None)[source]

Add a hook to be called after a channel sample is generated.

Parameters:
  • callback (Callable[[CST], None]) – Function to be called after the channel is sampled.

  • transmitter (SimulatedDevice, optional) – Transmitter device the hook is associated with. If not specified the hook will be called for all transmitters.

  • receiver (SimulatedDevice, optional) – Receiver device the hook is associated with. If not specified the hook will be called for all receivers.

Return type:

ChannelSampleHook[TypeVar(CST, bound= ChannelSample)]

propagate(signal, transmitter, receiver, timestamp=0.0, interpolation_mode=InterpolationMode.NEAREST)[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 (SimulatedDevice) – Device transmitting the signal to be propagated over this realization.

  • receiver (SimulatedDevice) – Device receiving the propagated signal after propagation.

  • timestamp (float, optional) – Time at which the signal is propagated in seconds. Defaults to 0.0.

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

Return type:

Signal

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.

remove_sample_hook(hook)[source]

Remove a hook from the list of hooks to be called after a channel sample is generated.

Parameters:

hook (ChannelSampleHook[CST], None]) – Hook to be removed from the list of hooks.

Return type:

None

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 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 sample_hooks: Set[ChannelSampleHook[CST]]

Hooks to be called after a channel sample is generated.

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)
class ChannelSampleHook(callback, transmitter, receiver)[source]

Bases: Generic[CST]

Hook for a callback to be called after a specific channel sample is generated.

Parameters:
  • callback (Callable[[CST], None]) – Function to be called after the channel is sampled.

  • transmitter (SimulatedDevice, optional) – Transmitter device the hook is associated with.

  • receiver (SimulatedDevice, optional) – Receiver device the hook is associated with.

class InterpolationMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: SerializableEnum

Interpolation behaviour for sampling and resampling routines.

Considering a complex time series

\[\mathbf{s} = \left[s_{0}, s_{1},\,\dotsc, \, s_{M-1} \right]^{\mathsf{T}} \in \mathbb{C}^{M} \quad \text{with} \quad s_{m} = s(\frac{m}{f_{\mathrm{s}}})\]

sampled at rate \(f_{\mathrm{s}}\), so that each sample represents a discrete sample of a time-continuous underlying function \(s(t)\).

Given only the time-discrete sample vector \(\mathbf{s}\), resampling refers to

\[\hat{s}(\tau) = \mathscr{F} \left\lbrace \mathbf{s}, \tau \right\rbrace\]

estimating a sample of the original time-continuous function at time \(\tau\) given only the discrete-time sample vector \(\mathbf{s}\).

NEAREST = 0

Interpolate to the nearest sampling instance.

\[\hat{s}(\tau) = s_{\lfloor \tau f_{\mathrm{s}} \rfloor}\]

Very fast, but not very accurate.

SINC = 1

Interpolate using sinc kernels.

Also known as the Whittaker-Kotel’nikov-Shannon interpolation formula [1].

\[\hat{s}(\tau) = \sum_{m=0}^{M-1} s_{m} \operatorname{sinc} \left( \tau f_{\mathrm{s}} - m \right)\]

Perfect for bandlimited signals, not very fast.