Contents
Sionna Channel Models (channel/): From AWGN to 3GPP TR 38.901
channel/ is the part of a link simulation that sits closest to the physical world. Its interface design is very uniform: all channel models inherit from ChannelModel, and the call signature is
__call__(batch_size, num_time_steps, sampling_frequency)
which returns the path coefficients a and path delays tau (i.e., the channel impulse response, CIR); general utilities then convert it to the frequency or time domain.
1. Top-Level Files
| File | Function | Main public classes/functions |
|---|---|---|
__init__.py | Channel module package entry | Exports AWGN, ChannelModel, CIRDataset, OFDMChannel, TimeChannel, RayleighBlockFading, the flat-fading and spatial-correlation classes, the discrete-channel classes, DEFAULT_L_MIN, etc., and imports the tr38901 submodule |
channel_model.py | Abstract class defining the channel-model interface | ChannelModel(Object) |
awgn.py | AWGN channel simulation | AWGN(Block): adds complex white Gaussian noise of variance no to the input (no/2 per real dimension) |
cir_dataset.py | Builds a CIR sampler from a CIR generator (usable as a channel model) | CIRDataset(ChannelModel); internal _CIRIterableDataset, _InfiniteCIRIterableDataset, _collate_fn |
constants.py | Channel module constants | DEFAULT_L_MIN = -6 (default maximum negative delay for discrete complex-baseband channels) |
discrete_channel.py | Discrete channel models | BinaryMemorylessChannel, BinarySymmetricChannel (BSC), BinaryZChannel, BinaryErasureChannel (BEC) |
flat_fading_channel.py | Flat-fading channel simulation | GenerateFlatFadingChannel, ApplyFlatFadingChannel, FlatFadingChannel |
rayleigh_block_fading.py | Rayleigh block-fading simulation | RayleighBlockFading(ChannelModel): a single zero-delay path with Gaussian coefficients; all time steps of the same batch sample share the coefficients |
spatial_correlation.py | Spatially correlated flat-fading channel | SpatialCorrelation (abstract), KroneckerModel, PerColumnModel |
generate_ofdm_channel.py | Generate the channel frequency response | GenerateOFDMChannel(Object): computes the per-symbol/per-subcarrier h_freq from the CIR |
apply_ofdm_channel.py | Apply the single-tap OFDM channel in the frequency domain | ApplyOFDMChannel(Block): , optionally adding AWGN |
ofdm_channel.py | Ideal OFDM channel (single tap in the frequency domain) | OFDMChannel(Block): generates the frequency response and applies it (no ICI/ISI), optionally returning h_freq |
generate_time_channel.py | Generate the channel response in the time domain | GenerateTimeChannel(Object): computes the time-domain taps h_time assuming sinc pulse shaping/receive filtering |
apply_time_channel.py | Apply the channel response in the time domain | ApplyTimeChannel(Block): filters with the time-varying h_time, output length num_time_samples + l_tot - 1, optionally adding AWGN |
time_channel.py | Time-domain channel implementation | TimeChannel(Block): generates and applies the time-domain response; output length num_time_samples + l_max - l_min |
utils.py | Channel utility functions | subcarrier_frequencies, time_frequency_vector, time_lag_discrete_time_channel, cir_to_ofdm_channel, cir_to_time_channel, time_to_ofdm_channel, deg_2_rad, rad_2_deg, wrap_angle_0_360, drop_uts_in_sector, set_3gpp_scenario_parameters, relocate_uts, generate_uts_topology, random_ut_properties, gen_single_sector_topology, gen_single_sector_topology_interferers, exp_corr_mat, one_ring_corr_mat |
A few easily confused points, noted upfront:
OFDMChannelis the “ideal” frequency-domain channel. It assumes the cyclic prefix is long enough and treats each subcarrier as a single tap, so there is no ICI/ISI. To see the real time-domain filtering effects, useTimeChannel.- The spatial correlation of
KroneckerModelis constructed as , a different correlation assumption fromPerColumnModel. DEFAULT_L_MIN = -6is the default maximum negative delay for discrete complex-baseband channels, used together withtime_lag_discrete_time_channel.
2. tr38901/: The Full 3GPP TR 38.901 Model
This is the largest piece of channel/, with files split by specification section:
| File | Function | Main public classes |
|---|---|---|
__init__.py | Unified export entry | The antenna classes, TDL, CDL, LSP/LSPGenerator, Rays/RaysGenerator, Topology/ChannelCoefficientsGenerator, SystemLevelScenario/SystemLevelChannel, RMa/UMa/UMi and their scenarios |
antenna.py | Antenna modeling (§7.3, Eq. 7.3-4/5) | AntennaElement, AntennaPanel, PanelArray, Antenna, AntennaArray |
tdl.py | Tapped Delay Line (TDL) model | TDL(ChannelModel): generates coefficients by the sum-of-sinusoids method, emulating mobility aging; supports 'A'~'E' plus A30/B100/C300; supports spatial correlation matrices |
cdl.py | Cluster Delay Line (CDL) model (§7.7.1/7.7.3) | CDL(ChannelModel): optional "A"~"E", PDP normalized to 1, single-input single-output only (multi-antenna allowed) |
lsp.py | Large-scale parameter and path loss sampling (§7.5 steps 1-4, §7.4.1, §7.4.3) | LSP (DS/ASD/ASA/SF/K/ZSA/ZSD), LSPGenerator(Object) |
rays.py | Ray sampling (§7.5 steps 6-9) | Rays (delay/power/AoA/AoD/ZoA/ZoD/XPR), RaysGenerator(Object) |
channel_coefficients.py | Channel impulse response sampling (§7.5 steps 10-11) | Topology, ChannelCoefficientsGenerator(Object) (outputs h, delays) |
system_level_scenario.py | System-level simulation scenario base class (O2I in §7.4.3) | SystemLevelScenario(Object) |
system_level_channel.py | System-level channel model base class | SystemLevelChannel(ChannelModel): set_topology, show_topology, return_rays, etc. |
umi.py / umi_scenario.py | Urban micro (UMi) | UMi(SystemLevelChannel), UMiScenario(SystemLevelScenario) |
uma.py / uma_scenario.py | Urban macro (UMa) | UMa(SystemLevelChannel), UMaScenario(SystemLevelScenario) |
rma.py / rma_scenario.py | Rural macro (RMa) | RMa(SystemLevelChannel), RMaScenario(SystemLevelScenario) |
models/__init__.py | Package holding the parameter JSONs (exports nothing itself) | The same directory contains CDL-A~E.json, TDL-A/A30/B/B100/C/C300/D/E.json, and the LoS/NLoS/O2I.json files for RMa/UMa/UMi, 22 parameter files in total |
The two model families must be told apart:
- TDL / CDL are link-level models that directly specify a power delay profile (PDP), suited to fast single-link simulation;
- UMi / UMa / RMa are system-level models: you first
set_topologyto place the base stations and terminals, then sample LSP → Rays → channel coefficients step by step following the 11 steps of §7.5.
The file split of the latter (lsp.py / rays.py / channel_coefficients.py) maps almost one-to-one onto the sampling steps in the specification, so reading the code against the spec goes smoothly.
3. optical/: Optical Communication Channels
| File | Function | Main public classes |
|---|---|---|
__init__.py | Optical channel package entry | Exports EDFA, SSFM |
edfa.py | Erbium-doped fiber amplifier (EDFA) model | EDFA(Block): amplifies the optical signal by the gain and adds ASE noise, supports dual polarization |
fiber.py | Split-step Fourier method (SSFM) solving the nonlinear Schrödinger equation | SSFM(Block): numerically solves the NLSE (single polarization) / Manakov equation (dual polarization), optionally with Raman amplification noise |
This part is essentially unrelated to wireless links; it is there for fiber-optic link simulation.
4. From CIR to the Frequency/Time Domain
The three most core functions in utils.py convert the path coefficients into usable domains. The frequency response sums over paths:
where is shifted by the discrete delay index l_min so that negative delays can still be represented:
import torch
from sionna.phy.channel import (subcarrier_frequencies, cir_to_ofdm_channel,
cir_to_time_channel, time_lag_discrete_time_channel,
time_to_ofdm_channel)
from sionna.phy.channel.tr38901 import TDL
from sionna.phy.ofdm import ResourceGrid
rg = ResourceGrid(num_ofdm_symbols=1, fft_size=1024, subcarrier_spacing=15e3)
tdl = TDL("A", 100e-9, 3.5e9)
cir = tdl(batch_size=1, num_time_steps=1, sampling_frequency=rg.bandwidth)
frequencies = subcarrier_frequencies(rg.fft_size, rg.subcarrier_spacing)
h_freq = cir_to_ofdm_channel(frequencies, *cir, normalize=True).squeeze()
l_min, l_max = time_lag_discrete_time_channel(rg.bandwidth)
h_time = cir_to_time_channel(rg.bandwidth, *cir, l_min=l_min, l_max=l_max,
normalize=True)
h_freq_hat = time_to_ofdm_channel(h_time, rg, l_min).squeeze()
normalize=True normalizes by average power to keep the received power from drifting across different delay spreads. time_to_ofdm_channel transforms the time-domain taps back into the frequency domain.
5. Usage Examples
AWGN channel:
import torch
from sionna.phy.channel import AWGN
awgn_channel = AWGN()
x = torch.randn(64, 16, dtype=torch.complex64)
y = awgn_channel(x, no=0.1) # no is the noise power per complex dimension
TDL model + OFDM channel:
from sionna.phy.channel.tr38901 import TDL
from sionna.phy.channel import OFDMChannel
from sionna.phy.ofdm import ResourceGrid
rg = ResourceGrid(num_ofdm_symbols=14, fft_size=64, subcarrier_spacing=15e3)
tdl = TDL(model="A", delay_spread=300e-9, carrier_frequency=3.5e9,
min_speed=0.0, max_speed=3.0)
channel = OFDMChannel(channel_model=tdl, resource_grid=rg)
CDL model (with antenna arrays):
from sionna.phy.channel.tr38901 import Antenna, AntennaArray, CDL
bs_array = AntennaArray(antenna=Antenna(pattern="38.901", polarization="dual"),
num_rows=4, num_cols=4)
ut_array = AntennaArray(antenna=Antenna(pattern="omni", polarization="single"),
num_rows=1, num_cols=1)
cdl = CDL(model="A", delay_spread=300e-9, carrier_frequency=3.5e9,
ut_array=ut_array, bs_array=bs_array, direction="uplink")
# Generate the channel impulse response: path coefficients a and path delays tau
a, tau = cdl(batch_size=64, num_time_steps=100, sampling_frequency=1e6)
Time-domain channel:
import torch
from sionna.phy.channel import RayleighBlockFading, TimeChannel
channel_model = RayleighBlockFading(num_rx=1, num_rx_ant=2, num_tx=1, num_tx_ant=4)
channel = TimeChannel(channel_model, bandwidth=1e6, num_time_samples=100,
l_min=-6, l_max=20, return_channel=True)
x = torch.randn(32, 1, 4, 100, dtype=torch.complex64)
y, h_time = channel(x)
System-level scenario (UMi) with a single-sector topology:
from sionna.phy.channel.tr38901 import PanelArray, UMi
from sionna.phy.channel import gen_single_sector_topology
bs_array = PanelArray(num_rows_per_panel=4, num_cols_per_panel=4,
polarization='dual', polarization_type='cross',
antenna_pattern='38.901', carrier_frequency=3.5e9)
ut_array = PanelArray(num_rows_per_panel=1, num_cols_per_panel=1,
polarization='single', polarization_type='V',
antenna_pattern='omni', carrier_frequency=3.5e9)
channel_model = UMi(carrier_frequency=3.5e9, o2i_model='low',
ut_array=ut_array, bs_array=bs_array, direction='uplink')
topology = gen_single_sector_topology(batch_size=100, num_ut=4, scenario='umi')
channel_model.set_topology(*topology)
channel_model.show_topology()
The call order of system-level models cannot be reversed: first construct the antenna arrays and the scenario object, then set_topology to place the nodes, and only then call the channel to generate the CIR. The UT positions, distances and angles in the topology determine the sampling results of the LSPs and the rays.
6. Summary
After all this, the reading route through channel/ is:
channel_model.pydefines the interface;awgn.py/rayleigh_block_fading.pyare the two simplest implementations and a good place to start;ofdm_channel.pyandtime_channel.pyare the frequency-domain/time-domain application paths, understood together with thecir_to_*functions inutils.py;- read
tr38901/section by section against the specification —lsp.py/rays.py/channel_coefficients.pyform a three-step pipeline; optical/is independent; look at it as needed.
Comments
Loading comments…
Want to leave a note? Sign in first — comments are open to every signed-in reader.