GenerateOFDMChannel#

class sionna.phy.channel.GenerateOFDMChannel(channel_model: sionna.phy.channel.channel_model.ChannelModel, resource_grid: sionna.phy.ofdm.resource_grid.ResourceGrid, normalize_channel: bool = False, precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs)[source]#

Bases: sionna.phy.object.Object

Generates channel frequency responses.

The channel impulse response is constant over the duration of an OFDM symbol.

Given a channel impulse response \((a_{m}(t), \tau_{m}), 0 \leq m \leq M-1\), generated by the channel_model, the channel frequency response for the \(s^{th}\) OFDM symbol and \(n^{th}\) subcarrier is computed as follows:

\[\widehat{h}_{s, n} = \sum_{m=0}^{M-1} a_{m}(s) e^{-j2\pi n \Delta_f \tau_{m}}\]

where \(\Delta_f\) is the subcarrier spacing, and \(s\) is used as time step to indicate that the channel impulse response can change from one OFDM symbol to the next in the event of mobility, even if it is assumed static over the duration of an OFDM symbol.

Parameters:
  • channel_model (sionna.phy.channel.channel_model.ChannelModel) – Channel model to be used.

  • resource_grid (sionna.phy.ofdm.resource_grid.ResourceGrid) – Resource grid.

  • normalize_channel (bool) – If set to True, the channel is normalized over the resource grid to ensure unit average energy per resource element. Defaults to False.

  • precision (Literal['single', 'double'] | None) – Precision used for internal calculations and outputs. If set to None, precision is used.

  • device (str | None) – Device for computation (e.g., ‘cpu’, ‘cuda:0’). If None, device is used.

Inputs:

batch_sizeNone (default) | int. Batch size. Defaults to None for channel models that do not require this parameter.

Outputs:

h_freq – [batch size, num_rx, num_rx_ant, num_tx, num_tx_ant, num_ofdm_symbols, num_subcarriers], torch.complex. Channel frequency responses.

Examples

import torch
from sionna.phy.channel import GenerateOFDMChannel, RayleighBlockFading

# Create a simple resource grid-like object
class SimpleResourceGrid:
    num_ofdm_symbols = 14
    fft_size = 64
    subcarrier_spacing = 15e3
    cyclic_prefix_length = 4

    @property
    def ofdm_symbol_duration(self):
        return (1 + self.cyclic_prefix_length / self.fft_size) / self.subcarrier_spacing

rg = SimpleResourceGrid()
channel_model = RayleighBlockFading(num_rx=1, num_rx_ant=2, num_tx=1, num_tx_ant=2)
gen_ch = GenerateOFDMChannel(channel_model, rg)
h_freq = gen_ch(batch_size=32)
print(h_freq.shape)
# torch.Size([32, 1, 2, 1, 2, 14, 64])