Channel¶

The channel model represents the basic physical propagation properties configuration of linked SimulatedDevices 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\)
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
- 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:
- abstract _realize()[source]¶
Generate a new channel realzation.
Abstract subroutine of
realize. EachChannelis required to implement their own_realize()method.Returns: A new channel realization.
- Return type:
TypeVar(CRT, bound= ChannelRealization)
- add_sample_hook(callback, transmitter=None, receiver=None)[source]¶
Add a hook to be called after a channel sample is generated.
- Parameters:
callback (
Callable[[TypeVar(CST, bound= ChannelSample)],None]) – Function to be called after the channel is sampled.transmitter (
SimulatedDevice|None) – Transmitter device the hook is associated with. If not specified the hook will be called for all transmitters.receiver (
SimulatedDevice|None) – 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
realizeand 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) – Time at which the signal is propagated in seconds. Defaults to 0.0.interpolation_mode (
InterpolationMode) – Interpolation behaviour of the channel realization’s delay components with respect to the proagated signal’s sampling rate.
- Return type:
Returns: The channel propagation resulting from the signal propagation.
- realize(cache=True)[source]¶
Generate a new channel realization.
If cache is enabled,
realizationwill be updated to the newly generatedChannelRealization.- Parameters:
cache (
bool) – Cache the realization. Enabled by default.- Return type:
TypeVar(CRT, bound= ChannelRealization)
Returns: A new channel realization.
- 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[TypeVar(CST, bound= ChannelSample)]) – Hook to be removed from the list of hooks.- Return type:
- serialize(process)[source]¶
Serialize this object’s state.
Objects cannot be serialized directly, instead a
Factorymust be instructed to carry out the serialization process.- Parameters:
process (
SerializationProcess) – The current stage of the serialization process. This object is generated by theFactoryand provides an interface to serialization methods supporting multiple backends.- Return type:
- 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()orrealize()are called and cache is enabled.Noneifrealize()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
Scenariothis channel is asigned to.Noneif the channel is not part of any specificScenario.The recommended way to set the scenario is:
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]¶
-
Hook for a callback to be called after a specific channel sample is generated.
- Parameters:
callback (
Callable[[TypeVar(CST, bound= ChannelSample)],None]) – Function to be called after the channel is sampled.transmitter (
SimulatedDevice|None) – Transmitter device the hook is associated with.receiver (
SimulatedDevice|None) – Receiver device the hook is associated with.
- class InterpolationMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
SerializableEnumInterpolation 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.