Contents
- 1. Framework: four generators plus a scenario
- 2. Call order of one generation
- 3. Steps 1–12 at a glance
- 4. Step 1: Set environment, network layout, and antenna parameters
- 5. Step 2: Assign propagation condition (LOS/NLOS) and indoor state
- 6. Step 3: Compute pathloss
- O2I building penetration loss (§7.4.3.1, indoor UTs only)
- 7. Step 4: Generate large-scale parameters (LSPs)
- The two correlation matrices: cross-LSP vs. spatial-LSP
- Line-by-line walkthrough of _compute_lsp_spatial_correlation_sqrt() (lsp.py L333-446)
- 8. Step 5: Generate cluster delays
- 9. Step 6: Generate cluster powers
- 10. Step 7: Generate arrival and departure angles
- 11. Step 8: Random coupling of angles within a cluster
- 12. Step 9: Generate XPR
- 13. Step 10: Draw initial random phases
- 14. Step 11: Generate channel coefficients per cluster and element pair
- The standard equation (7.5-22)
- Term-by-term reading
- Subcluster expansion for the two strongest clusters (n=1,2)
- LOS specular component (Eq. 7.5-29)
- Final combination (Eq. 7.5-30)
- Sionna’s assembly order
- 15. Step 12: Apply pathloss and shadowing
- 16. Phase structure of Eq. (7.5-22): a symbol dictionary
- Total phase of one ray
- r^\hat rr^: spherical → unit direction vector (Eqs. 7.5-23/24)
- dˉrx,u\bar d_${rx,u}dˉrx,u: element position vector (§7.3)
- Closed-form inter-element phase (the beamforming mechanism)
- Doppler phase → Jakes spectrum
- Frequency-domain composition and the delay-phase sign
- Frx,u,θF_${rx,u,\theta}Frx,u,θ: the antenna response vector (§7.1, Eq. 7.1-11)
- Computing F_rx / F_tx: from vendor gain tables to field components
- κn,m\kappa_${n,m}κn,m: what XPR means physically
- Where ±45° polarization enters the formulas
- The two ±45° antennas at the TX and RX ends: how they differ in the formula
- Other polarization angles: slant_angle and non-standard polarization
- Worked numerical example: one ray from start to finish
- Sionna cross-reference
- 17. Does Sionna support the §7.6.3 spatial channel model?
- 18. Spatial consistency, mobility, and state transitions (five FAQs)
- 18.1 Is spatial consistency implemented?
- 18.2 If I give the UE a velocity, does its position move?
- 18.3 How often is the channel regenerated? Is it continuous across calls?
- 18.4 Does LOS/NLOS change during a simulation?
- 18.5 Is §7.6.3.3 (LOS/NLOS soft indoor/outdoor) implemented?
- 19. Consistency check against 38.901 §7.5
- 20. Quick reference
- 21. References
38.901 §7.5 Twelve-Step Channel Generation: Complete Guide to Framework, Computation, and Sionna Source Code
This post follows 3GPP TR 38.901 g10 draft §7.5 “Fast fading model”,
unpacks the twelve-step channel generation procedure for the UMa
(urban macro) scenario — first the framework structure and the call order
of one invocation, then every formula, parameter table, and distribution —
and maps each step to the Sionna 1.x implementation
(sionna/phy/channel/tr38901/).
This post is based on Sionna 1.x (the PyTorch implementation) in the
local repository; the 38.901 code lives in src/sionna/phy/channel/tr38901/.
Line numbers refer to that tree. The older Sionna 0.x (TensorFlow) packed
everything into a single 3gpp.py, so the file layout differs, but the
step-by-step mapping still carries over.
Version note: the g10 draft is structured differently from earlier releases. §7.4 now contains only pathloss (7.4.1), LOS probability (7.4.2), O2I penetration (7.4.3) and shadow-fading autocorrelation (7.4.4); the twelve-step procedure lives entirely in §7.5; and §7.6.3 is spatial consistency, no longer the “spatial channel model”. The channel-matrix synthesis (Eqs. 7.5-22–7.5-30) is now part of Step 11. Sionna’s code comments mix old and new numbering — keep this in mind. This post covers both sides: the framework and call order, and “what exactly is computed at each step”.
1. Framework: four generators plus a scenario
TR 38.901 §7.5 decomposes “one channel realization” into twelve steps. Sionna splits the work across four classes, orchestrated by a system-level base class:
UMa / UMi / RMa (uma.py / umi.py / rma.py — thin parameter wiring)
└── SystemLevelChannel (system_level_channel.py — the orchestrator)
├── UMaScenario (uma_scenario.py — geometry + model parameter tables)
├── LSPGenerator (lsp.py — Steps 1–4: large-scale parameters & pathloss)
├── RaysGenerator (rays.py — Steps 5–9: cluster/ray-level parameters)
└── ChannelCoefficientsGenerator
(channel_coefficients.py — Steps 10–11: random phases & channel matrices)
└── PanelArray (antenna.py — 38.901 array elements and patterns)
__init__.py (L7-21) exports LSP, LSPGenerator, Rays,
RaysGenerator, ChannelCoefficientsGenerator, SystemLevelChannel,
UMa, UMaScenario, PanelArray, and friends.
File responsibilities:
| File | Lines | Responsibility |
|---|---|---|
lsp.py | 585 | Steps 1–4: log-normal LSP sampling, cross-LSP correlation, spatial consistency, pathloss (§7.4.1) and O2I (§7.4.3) |
rays.py | 814 | Steps 5–9: cluster delays, cluster powers, cluster/ray angles, random coupling, XPR |
channel_coefficients.py | 1062 | Steps 10–11: random phases, polarization/array/Doppler matrices, LOS combination (i.e. the array-based method of the old §7.6.3) |
system_level_channel.py | 537 | Drives the whole flow + Step 12 (pathloss & shadow-fading weighting) |
uma_scenario.py | 347 | UMa geometry, LOS probability (§7.4.2.1), parameter tables such as UMa_LoS.json |
antenna.py | 755 | PanelArray: element positions, polarizations, 38.901 radiation patterns |
2. Call order of one generation
The minimal user-facing usage (from the uma.py L63-88 docstring):
from sionna.phy.channel.tr38901 import PanelArray, UMa
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 = UMa(carrier_frequency=3.5e9, o2i_model='low',
ut_array=ut_array, bs_array=bs_array,
direction='uplink')
channel_model.set_topology(ut_loc, bs_loc, ut_orientations,
bs_orientations, ut_velocities, in_state)
h, delays = channel_model(num_time_samples=100, sampling_frequency=1e6)
What UMa.__call__ actually runs, in order
(system_level_channel.py L234-353):
SystemLevelChannel.__call__()
├─ LSPGenerator.__call__() # Steps 1–4, lsp.py L112-175
│ └─ scenario already provides: LOS probability, basic pathloss, correlation matrix square roots
├─ RaysGenerator.__call__(lsp) # Steps 5–9, rays.py L118-171
│ ├─ _cluster_delays() # L264
│ ├─ _cluster_powers() # L325
│ ├─ _azimuth_angles_of_arrival/... # L393–L721 (four angle types)
│ ├─ _cross_polarization_power_ratios() # L780
│ └─ _random_coupling() # L750
├─ Build Topology (velocities/orientations/LOS state/3D distance) # L281-292
├─ For uplink, permute TX/RX angles & powers # L302-330
├─ ChannelCoefficientsGenerator.__call__() # Steps 10–11, channel_coefficients.py L282-317
│ ├─ _step_10() → phi # L544
│ └─ _step_11() → h, delays # L1011
├─ _step_12(h, sf) # Step 12, system_level_channel.py L508-537
└─ permute into (a, tau) outputs # L343-344
The three generators are created in SystemLevelChannel.__init__
(L74-104, created at L84/L85/L97); UMa itself only forwards constructor arguments to
UMaScenario (uma.py L104-117).
3. Steps 1–12 at a glance
The twelve steps group into four phases, and Sionna’s modules map onto them one-to-one:
Inputs Step 1 environment, network layout, antenna arrays
Large-scale Step 2 LOS/NLOS + indoor/outdoor state
(§7.4) Step 3 pathloss PL
Step 4 LSPs: DS/ASD/ASA/SF/K/ZSA/ZSD (+ correlations)
Small-scale Step 5 cluster delays
(§7.5) Step 6 cluster powers
Step 7 cluster angles + ray angle offsets
Step 8 random coupling within clusters
Step 9 XPR
Coefficients Step 10 random initial phases
Step 11 per-cluster/per-element channel coefficients
(incl. subclusters & LOS specular component)
Step 12 apply pathloss & shadow fading
The table below is the master mapping of the twelve steps to the Sionna
source (step numbers follow the g10 twelve-step scheme; Sionna’s
class-level docstrings split Steps 1–4 slightly differently, while
function-level comments such as rays.py L267 “step 5 of section 7.5,
TR 38.901” agree with g10 — trust the function comments). The detailed
walkthrough of each step follows in the sections after this table:
| Step | §7.5 content | Spec details | Sionna implementation |
|---|---|---|---|
| 1 | Set environment, network layout, antenna parameters (inputs) | §7.5 Step 1 | uma.py L91-117 constructor, set_topology() (system_level_channel.py L120-189), PanelArray (antenna.py L293-632) |
| 2 | Per-link LOS/NLOS + indoor/outdoor state | §7.4.2.1, Table 7.4.2-1 (UMa) | uma_scenario.py L87-122 los_probability; system_level_scenario.py L1066-1088 _sample_los(); user in_state selects O2I |
| 3 | Compute pathloss | §7.4.1, Table 7.4.1-1; O2I per §7.4.3 | uma_scenario.py L250-347 precomputes basic_pathloss; lsp.py L92-110 sample_pathloss(); O2I _o2i_low_loss()/_o2i_high_loss() |
| 4 | Draw LSPs (DS/ASD/ASA/SF/K/ZSA/ZSD, plus CSPD in some scenarios) and apply correlations | Table 7.5-6 (μ/σ and the cross-correlation matrix); spatial consistency per §7.6.3.1 | lsp.py L112-175: log-normal sampling, two matrix products at L129-137 (cross_lsp_correlation_matrix_sqrt and spatial_lsp_correlation_matrix_sqrt), 104°/52° clamps (L149-172) |
| 5 | Cluster delays | Eqs. 7.5-1–7.5-4 | rays.py L264 _cluster_delays() (includes per-ray delay offsets) |
| 6 | Cluster powers (extra cluster loss) | Eqs. 7.5-5–7.5-8 | rays.py L325 _cluster_powers() (per-cluster shadowing term & LOS specular handling) |
| 7 | Cluster angles and ray angle offsets | Eqs. 7.5-9–7.5-20, Tables 7.5-2/3/4 | rays.py L393-721: _azimuth_angles_*/_zenith_angles_*; ray offset constants hardcoded at L101-116 _ray_offsets |
| 8 | Random coupling of angles within a cluster | §7.5 Step 8 (shuffle AoA/AoD/ZoA/ZoD pairing) | rays.py L750-778 _random_coupling() → _shuffle_angles() |
| 9 | XPR (cross-polarization power ratio) | Eq. 7.5-21, Table 7.5-6 | rays.py L780-813 _cross_polarization_power_ratios(), reading scenario muXPR/sigmaXPR |
| 10 | Random phase per ray and polarization combination | §7.5 Step 10, θ ~ U(−π, π) | channel_coefficients.py L544-577 _step_10() |
| 11 | Generate per-path channel matrices (spatial channel model) | Eqs. 7.5-22–7.5-30, Table 7.5-5 (the old §7.6.3 array-based method, now folded into this step) | channel_coefficients.py L1011-1062 _step_11() — see the “Does Sionna support the §7.6.3 spatial channel model?” section below |
| 12 | Apply pathloss & shadow fading to path coefficients | §7.5 Step 12 | system_level_channel.py L508-537 _step_12() |
Implementation notes worth calling out:
- Where Steps 1–4 are split: the
LSPGeneratordocstring (lsp.pyL63-65) says it “implements steps 1 to 4 … as well as path-loss generation (Section 7.4.1) with O2I low- and high-loss models (Section 7.4.3)”. The LOS/NLOS decision itself is not in the generator — the scenario (SystemLevelScenario) computes it from BS/UT coordinates and blockage. RaysGeneratoractually covers Steps 5–9: the class docstring says “steps 6 to 9” (rays.pyL65), but the function-level comments start at step 5 (cluster delays). Trust the function comments.- Subclustering: system-level models (UMa/UMi/RMa) apply the spec’s
sub-cluster delay-spread treatment (Table 7.5-5, Eqs. 7.5-26–7.5-28);
the 20-ray → 3-subcluster grouping is hardcoded at
channel_coefficients.pyL182-193 (_sub_cl_1_indbuffers). CDL does not use subclustering. - Uplink vs downlink: rays are always generated for the downlink; for
uplink the angle/power tensors are
permuted to swap TX/RX (system_level_channel.pyL302-330) instead of re-implementing.
4. Step 1: Set environment, network layout, and antenna parameters
The standard requires: scenario choice (UMa), global coordinate system with zenith/azimuth definitions, numbers and 3D locations of BSs/UTs, LOS direction angles (ϕLOS,AOD/θLOS,ZOD/ϕLOS,AOA/θLOS,ZOA), antenna field patterns and array geometries, array orientations (Ωα bearing / Ωβ downtilt / Ωγ slant), UT speed and direction, center frequency and bandwidth.
Sionna: all of this is model input — no randomness:
- scenario / frequency / bandwidth / O2I model / link direction:
UMa(carrier_frequency, o2i_model, ut_array, bs_array, direction, ...)(uma.pyL91-117); - locations, orientations, velocities, LOS & indoor states:
set_topology(ut_loc, bs_loc, ut_orientations, bs_orientations, ut_velocities, in_state, los)(system_level_channel.pyL120-189); - arrays and 38.901 patterns:
PanelArray(antenna.pyL293-632).
Two implementation conventions worth knowing: velocity only feeds the
Doppler term — positions never move; and the LOS state is fixed at
set_topology time for the whole simulation call (see §18.2/§18.4 below).
5. Step 2: Assign propagation condition (LOS/NLOS) and indoor state
UMa LOS probability (Table 7.4.2-1, distance in meters):
with (0 when m). Conditions across BS-UT links are independent; all links of one UT share its indoor/outdoor state.
Sionna: uma_scenario.py L87-122 los_probability implements the
formula verbatim; the draw happens in system_level_scenario.py
L1066-1088 _sample_los(): Bernoulli() unless the user
pins los, and indoor UTs are forced NLOS (los & ~in_state).
6. Step 3: Compute pathloss
UMa (Table 7.4.1-1; fc in GHz, distances in meters):
-
LOS, :
-
LOS, :
-
NLOS:
-
breakpoint with effective heights . The environment height is drawn per link (Note 1): 1 m with probability , otherwise from the discrete uniform set m, where
and (hence m) when m or m.
Sionna vs. standard for hE: the split probability , the formulas, the zeroing branches for m and m, and all match the standard term by term (
uma_scenario.pyL265-318;h_e = r + (1.0 - r) * sis exactly the two-branch selection). However, the “otherwise” branch requires a discrete uniform draw from (3 m step), while Sionna approximates it with a continuous uniform (comment at L295-307: discrete uniform sampling does not support non-scalar bounds). The means are close, but the continuous version has slightly larger variance and can take values outside the set (e.g. 13.7 m), causing small deviations in the breakpoint distance and in the second LOS pathloss segment. Also, when m the standard set is empty (undefined in the spec); Sionna clamps to 12 m (L309-313).
O2I building penetration loss (§7.4.3.1, indoor UTs only)
The total pathloss of an O2I link is (Eq. 7.4-2):
where is the outdoor LOS pathloss evaluated with the outdoor 3D distance , and the last three terms come from the low-loss / high-loss models of Table 7.4.3-2:
| Term | Low-loss | High-loss |
|---|---|---|
| External wall | same form with | |
| Indoor propagation | ||
| Random term | 4.4 dB | 6.5 dB |
Material losses are from Table 7.4.3-1 (fc in GHz): standard multi-pane glass , IRR-coated glass , concrete . The indoor penetration depth is with for UMa/UMi (0–10 m for RMa), generated per UT. Applicability: both models for UMa/UMi (the choice is a simulation parameter), low-loss only for RMa, high-loss only for InF; below 6 GHz single-frequency simulations may instead use the backward compatibility model of Table 7.4.3-3 (fixed dB). The penetration loss is added to shadow fading in the log domain (UT-specific: the same O2I loss applies from a UT to every BS); outdoor UTs get 0 dB.
Sionna: uma_scenario.py L250-347 — and
sampling (L265-315, the discrete uniform is approximated by a continuous
one), pl_1/pl_2/pl_los (L322-330) and pl_nlos = max(pl_los, pl_3)
(L334-340) match the formulas term by term; O2I lives in lsp.py
_o2i_low_loss() L467-524 / _o2i_high_loss() L526-584 (material losses,
0.3/0.7 weights, 0.5·d2D_in, σP all per Table 7.4.3-1/2, with an
indoor_mask zeroing outdoor UTs). PL is only multiplied onto the
coefficients at Step 12 (lsp.py L92-110 sample_pathloss() returns
basic pathloss + O2I, without shadow fading).
7. Step 4: Generate large-scale parameters (LSPs)
Per link, draw the seven log-normal LSPs DS, ASD, ASA, SF, K, ZSA, ZSD from the UMa columns of Table 7.5-6 (fc in GHz):
| LSP | UMa LOS μ / σ | UMa NLOS μ / σ | O2I μ / σ |
|---|---|---|---|
| lg(DS/1s) | −6.955−0.0963·lg fc / 0.66 | −6.28−0.204·lg fc / 0.39 | −6.62 / 0.32 |
| lg(ASD/1°) | 1.06+0.1114·lg fc / 0.28 | 1.5−0.1144·lg fc / 0.28 | 1.25 / 0.42 |
| lg(ASA/1°) | 1.81 / 0.20 | 2.08−0.27·lg fc / 0.11 | 1.76 / 0.16 |
| lg(ZSA/1°) | 0.95 / 0.16 | −0.3236·lg fc+1.512 / 0.16 | 1.01 / 0.43 |
| SF [dB] | σ=4 | σ=6 | σ=7 |
| K [dB] | μ=9 / σ=3.5 | N/A | N/A |
| lg(ZSD/1°) | max(−0.5, −2.1·d2D/1000 − 0.01· | hUT−1.5 | + 0.75) |
Key points:
- Cross-LSP correlation: the mutual-correlation matrix in the lower half of Table 7.5-6 (e.g. UMa NLOS DS vs SF = −0.4, ASD vs SF = −0.6) is applied via its Cholesky square root to (order mandated by the g10 text).
- Caps: ASA/ASD = min(·, 104°), ZSA/ZSD = min(·, 52°).
- Co-sited sectors to the same UT share identical LSPs; UTs on different floors are uncorrelated.
- §7.4.4 shadow-fading autocorrelation: slow fading is correlated over horizontal displacement via the exponential autocorrelation function (Eq. 7.4-5, ITU-R P.1816)
with per-LSP correlation distances in the last block of Table 7.5-6 (UMa LOS: DS 30 m, ASD 18 m, ASA 15 m, SF 37 m, K 12 m, ZSA/ZSD 15 m; NLOS mostly 40–50 m). It also underpins spatial consistency (§7.6.3): after a UT moves, its LSPs evolve with correlation set by each instead of being resampled independently.
Sionna: lsp.py L112-175 __call__ — log-normal draws (L119-127),
Cholesky correlation (L129-137), caps (L149-172). The μ/σ values and
correlation coefficients are not hardcoded but shipped as data files
models/UMa_LoS.json, UMa_NLoS.json, UMa_O2I.json (paths at
uma_scenario.py L130-142); ZSD is the exception — being distance- and
height-dependent it is computed live at uma_scenario.py L176-184. The
Eq. 7.4-5 distances enter the JSONs as corrDist* fields and are consumed
by lsp.py L333-446 _compute_lsp_spatial_correlation_sqrt() in spatial
consistency mode.
The two correlation matrices: cross-LSP vs. spatial-LSP
LSPGenerator.__call__ (lsp.py L112-141) applies two matrix
multiplications in the log domain, each driven by a precomputed attribute:
① _cross_lsp_correlation_matrix_sqrt (cross-LSP correlation)
- Shape
[batch, num_bs, num_ut, 7, 7]— one 7×7 matrix per link. - Content: the Cholesky square root of the inter-LSP correlation matrix
from the lower half of Table 7.5-6 (10 non-zero coefficients such as
DS↔SF, DS↔ASD, ASA↔SF, ASD↔K), taken per state LOS/NLOS/O2I
(
lsp.pyL225-331_compute_cross_lsp_correlation_matrix()). - Acts on the LSP dimension: turns each link’s 7 independent standard normals into a correlated vector: , .
- Spec reference: §7.5 Step 4 verbatim (“taking into account cross correlation according to Table 7.5-6 … with the square root matrix being generated using the Cholesky decomposition”). Sionna orders the vector [DS,ASD,ASA,SF,K,ZSA,ZSD], different from the g10-specified , but the matrix is filled in the same order as the vector — statistically equivalent.
② _spatial_lsp_correlation_matrix_sqrt (spatial correlation)
- Shape
[batch, num_bs, 7, num_ut, num_ut]— one UT×UT matrix per BS and per LSP. - Content (
lsp.pyL333-446_compute_lsp_spatial_correlation_sqrt()): for each LSP , UTs and are correlated as
where is the 2D (X-Y plane) distance between the UTs and
is the decorrelation distance corrDist of LSP (UMa LOS: DS
30 m, ASD 18 m, ASA 15 m, SF 37 m, K 12 m, ZSA/ZSD 15 m). Each LSP’s
distance matrix is scaled by , exponentiated, then Cholesky
square-rooted.
- Acts on the UT dimension (
lsp.pyL134-137 permutes the UT axis into the matmul side). Samples of the same LSP from one BS to nearby UTs become partially correlated — the closer the UTs, the more similar their LSPs. This is the static implementation of spatial consistency. - Spec reference: §7.6.3.1 (LSP spatial consistency, i.e. SSC — spatial consistency for LSPs); the decorrelation-distance values come from Table 7.5-6 (and for SF also from the autocorrelation definition in §7.4.4 Eq. 7.4-5). Note it is not part of the original §7.5 Step 4 flow: Step 4 only requires cross-LSP correlation, while the spec places inter-link LSP spatial correlation in §7.6.3.1. Sionna merges both into a single sampling pass, so LSPs of multiple links within one batch naturally satisfy SSC.
- Two simplifications admitted in the docstring (L340-342): links to different BSs are not spatially correlated (one matrix per BS), and UT pairs in different states (LOS/NLOS/O2I) get zero correlation — the spec does not require decorrelation across state changes, so this is a conservative implementation choice.
Line-by-line walkthrough of _compute_lsp_spatial_correlation_sqrt() (lsp.py L333-446)
Notation: batch = batch size, num_bs/num_ut = number of BSs/UTs,
7 = number of LSPs.
| Lines | Code | Purpose | Output shape |
|---|---|---|---|
| L361-363 | indoor = scenario.indoor.unsqueeze(1).expand(-1, num_bs, -1) | Broadcast each UT’s indoor flag along the BS axis | [batch, num_bs, num_ut] |
| L365-366 | los_pair_bool = los_ut.unsqueeze(3) & los_ut.unsqueeze(2) | Build the “are both UTs LOS?” pairing matrix: outer AND of row-side and column-side LOS flags | [batch, num_bs, num_ut, num_ut] |
| L368-369 | nlos_pair_bool = nlos_ut.unsqueeze(3) & nlos_ut.unsqueeze(2) | Pairing matrix for “both NLOS” (outdoor and not LOS) | same |
| L371 | o2i_pair_bool = indoor.unsqueeze(3) & indoor.unsqueeze(2) | Pairing matrix for “both indoor” | same |
| L377-385 | for parameter_name in ("corrDistDS", ..., "corrDistZSD") | Loop over the 7 LSPs, in the same order as the LSP vector [DS,ASD,ASA,SF,K,ZSA,ZSD] | — |
| L390-397 | filtering_matrix = torch.eye(num_ut, ...).expand(batch, num_bs, -1, -1).clone() | Filter initialized to the identity: diagonal 1 means “a UT is always correlated with itself”; expand returns a view, so clone is required for safe writes | [batch, num_bs, num_ut, num_ut] |
| L399-403 | distance_scaling_matrix = broadcast_params(_params_los[name], _params_nlos[name], _params_o2i[name]) | Each UT picks the decorrelation distance of this LSP from the JSON tables (e.g. corrDistDS in UMa_LoS.json) according to its own state | [batch, num_bs, num_ut] |
| L404-406 | .unsqueeze(3).expand(-1, -1, -1, num_ut) | Broadcast along the “column UT” axis: row carries UT ‘s own , i.e. a pair uses the row-side UT’s value | [batch, num_bs, num_ut, num_ut] |
| L407 | = -1.0 / distance_scaling_matrix | Turn into so the next step computes by multiplication | same |
| L410-426 | torch.where(los/nlos/o2i_pair_bool, 1.0, filtering_matrix) | Three passes: UT pairs sharing a state (LOS/NLOS/O2I) are set to 1 to keep correlation; pairs in different states stay 0 (decorrelated); diagonal remains 1 | same |
| L431-432 | torch.stack(filtering_matrices, dim=2) and torch.stack(distance_scaling_matrices, dim=2) | Stack the 7 loop results along the LSP axis (dim=2) | [batch, num_bs, 7, num_ut, num_ut] |
| L434-436 | ut_dist_2d = matrix_ut_distance_2d.unsqueeze(1).unsqueeze(2) | Pairwise 2D distance matrix between UTs, with empty BS and LSP axes inserted for broadcasting (distances are BS-independent) | [batch, 1, 1, num_ut, num_ut] |
| L439-441 | spatial_lsp_correlation = torch.exp(ut_dist_2d * distance_scaling_matrices) * filtering_matrices | The core formula , yielding one UT×UT correlation matrix per BS per LSP | [batch, num_bs, 7, num_ut, num_ut] |
| L445 | chol, _ = torch.linalg.cholesky_ex(spatial_lsp_correlation, check_errors=False) | Cholesky factorization for the lower-triangular square root ; the _ex variant (no exception, returns info) keeps CUDA Graph compatibility | same |
| L446 | self._update_buffer("_spatial_lsp_correlation_matrix_sqrt", chol) | Write into the pre-registered buffer used by __call__ L136 | same |
Supplementary details (tensor shapes & broadcasting):
-
Shapes of
scenario.losvs.scenario.indoor.losis[batch, num_bs, num_ut](bool; defined atsystem_level_scenario.pyL237-241) — LOS is a property of the BS-UT link, so it carries the BS axis (the same UT may be LOS to one BS and NLOS to another).indooris[batch, num_ut]— indoor state is a UT property independent of the BS, hence L361-363 first broadcasts it viaunsqueeze(1).expand(-1, num_bs, -1)to matchlos’s shape before the pairing matrices are formed. -
filtering_matricesafter the loop and whattorch.stackdoes. Before L431,filtering_matricesis a Python list of 7 tensors, each[batch, num_bs, num_ut, num_ut](one per LSP).torch.stack(..., dim=2)inserts a new axis after the first two dims, producing a single 5-D tensor[batch, num_bs, 7, num_ut, num_ut]. Note the difference betweenstackandcat:stackpromotes each member by one dimension (new axis), whilecatjoins along an existing one. The new LSP axis aligns with the LSP vector order[DS,ASD,ASA,SF,K,ZSA,ZSD], enabling the one-shot batched computation over all LSPs below. -
The three operations at L439-441 and their broadcasting. ①
ut_dist_2d[batch, 1, 1, num_ut, num_ut]broadcasts its two singleton axes overnum_bsand 7 — distances are BS- and LSP-independent; ② the first elementwise product gives andexp()yields — the exponential decorrelation model of §7.6.3.1 / Eq. 7.4-5 (the decay scale differs per LSP and per state); ③ multiplying by the 0/1filtering_matricesforces cross-state UT pairs to zero correlation, keeps the exponential value for same-state pairs, and the diagonal is always . The result is one UT×UT correlation matrix per BS per LSP, batch Cholesky-factored at L445. -
Why 7 matrices instead of 1? Is the cost excessive? The 7 LSPs have different decorrelation distances (UMa LOS: SF 37 m, DS 30 m, ASD 18 m, ASA/ZSA/ZSD 15 m, K 12 m), so differs per LSP — the 7 correlation matrices and 7 Cholesky factorizations are essential work required by the spec and cannot be shared. The only truly redundant part is
filtering_matrices: it is LSP-independent, so the loop produces 7 identical copies; one copy could in principle be broadcast at L441. Sionna stacks same-shape copies for simpler code and static CUDA Graph shapes. More importantly, consider the call frequency: the whole function runs once perset_topology(topology change), not on the LSP-sampling hot path —__call__only does two batched matmuls. The 7-iteration loop merely collects parameters;exp, the elementwise product, and Cholesky all run as a single batch after stacking — for a GPU, one batched Cholesky beats seven small ones. -
Which axes
torch.linalg.cholesky_exoperates on, and output shapes. Alltorch.linalgfunctions (cholesky/inv/det/matmul, etc.) follow one convention: the last two axes are the matrix, all preceding axes are batch axes; each matrix is factorized independently and the output has the same shape as the input. Here that meansbatch × num_bs × 7independentnum_ut × num_utmatrices in one batched call: bothspatial_lsp_correlationandcholare[batch, num_bs, 7, num_ut, num_ut], and each slice ofcholis lower-triangular (, upper-triangle zero). The second return valueinfohas shape[batch, num_bs, 7]: 0 = success for that matrix, positive = the order at which the matrix is not positive definite; withcheck_errors=Falseno exception is raised and the code ignores it. This convention also explains the permute at__call__L134-137: the UT axis must be moved adjacent to the trailing matrix axes before it can matmul withchol.
How it is consumed: at __call__ L134-137 the noise tensor is first
permuted to [batch, num_bs, 7, num_ut, 1] (UT axis adjacent to the
matrix), then s @ chol.transpose(-1,-2) performs
as a batched matmul, and the result is squeezed back to
[batch, num_bs, num_ut, 7].
Two implementation details worth noting: ① a pair’s correlation distance comes from the row-side UT’s state (broadcast over columns at L404) — unambiguous since correlated pairs share a state; ② zeroing cross-state pairs is Sionna’s conservative simplification (docstring L340-342); §7.6.3.1 does not require decorrelation across state changes.
After both correlation steps, each LSP is scaled by σ and shifted by μ in
the log domain, converted with 10^x, and clamped to 104°/52°
(lsp.py L149-172).
8. Step 5: Generate cluster delays
Exponential delay distribution (Table 7.5-6: exponential for all three UMa states):
UMa : LOS 2.5, NLOS 2.3, O2I 2.2. Normalize and sort ascending:
For LOS links an extra K-factor compensation scaling is applied (the specular peak widens the measured delay spread):
is scenario-specific (Table 7.5-6). Note the scaled delays are not used for cluster power generation — which is why the next step uses .
Sionna: rays.py L264 _cluster_delays() (docstring: “step 5 of
section 7.5”); and come from the JSON parameter files.
9. Step 6: Generate cluster powers
Single-slope exponential power-delay profile:
is the per-cluster Gaussian shadowing term (UMa per-cluster shadowing σ = 3/3/4 dB, Table 7.5-6); is the extra cluster loss (N/A for UMa). Normalize:
For LOS, a specular ray of power is added to the first cluster (Eq. 7.5-7) and normalization switches to the δ-function form of 7.5-8; these powers are used only in 7.5-9/7.5-14 (angles), not in 7.5-22 (coefficients). Each ray receives with M=20. Finally, clusters more than −25 dB below the strongest cluster are removed.
UMa cluster count N: LOS/O2I 12, NLOS 20.
Sionna: rays.py L325 _cluster_powers() (includes LOS specular
handling and the −25 dB pruning).
10. Step 7: Generate arrival and departure angles
Azimuth (AOA): the composite PAS is a wrapped Gaussian; angles come from the inverse Gaussian function
where includes the cluster-count scaling factor (Table 7.5-2: N=12→1.146, N=20→1.289); for LOS the first cluster is forced to (Eq. 7.5-12), and is equally likely. Rays add offsets:
The 20 ray offsets of Table 7.5-3 (normalized to rms spread): ±0.0447, ±0.1413, ±0.2492, ±0.3715, ±0.5129, ±0.6797, ±0.8844, ±1.1481, ±1.5195, ±2.1551. AOD follows the same procedure.
Zenith (ZOA/ZOD): composite PAS is Laplacian via the inverse Laplacian function (Eqs. 7.5-14/7.5-15) with scaling factors from Table 7.5-4 (N=12→1.104, N=20→1.178); ZOD randomness and mirroring follow Eqs. 7.5-19/7.5-20 (involving the ZSD mean). UMa intra-cluster spreads (Table 7.5-6): cASA = 11/15/8°, cASD = 5/2/5°, cZSA/cZSD = 7/7/3° (LOS/NLOS/O2I).
Sionna: rays.py L393-721 (_azimuth_angles_*, _zenith_angles_*);
Table 7.5-3 offsets hardcoded at L101-116 _ray_offsets; Table 7.5-2 /
7.5-4 scaling factors live in the JSON parameters (scaling_*).
11. Step 8: Random coupling of angles within a cluster
Within each cluster (or subcluster of the two strongest clusters), the AOD↔AOA, ZOD↔ZOA and AOD↔ZOD pairs are shuffled randomly, removing the deterministic one-to-one mapping between departure and arrival angles.
Sionna: rays.py L750-778 _random_coupling() → _shuffle_angles()
(L722-748): the four angle arrays AOA/AOD/ZOA/ZOD are each shuffled
independently along the intra-cluster ray axis (a random permutation
from argsort of normal randoms), so ray indices are randomly re-paired
across the four angle sets; one permutation per BS, shared by all UTs,
which keeps same-site sector results identical.
12. Step 9: Generate XPR
Per ray, draw the cross-polarization power ratio (log-normal):
UMa: μXPR/σXPR = 8/4 (LOS), 7/3 (NLOS), 9/5 (O2I) dB.
Sionna: rays.py L780-813
_cross_polarization_power_ratios(): draws
per (cluster, ray) — μ/σ
read from the scenario table per LOS/NLOS/O2I state and broadcast to the
cluster/ray dims (L791-795) — then converts to linear-domain κ via
10^(X/10) (L810-812), stored in Rays.kappa. The standard notes that the
outcomes of Steps 1–9 must be identical for all links from co-sited
sectors to a UT (Sionna achieves this via LSP reuse and a shared RNG).
13. Step 10: Draw initial random phases
For every ray and each of the four polarization combinations (θθ/θϕ/ϕθ/ϕϕ), draw .
Sionna: channel_coefficients.py L544-577 _step_10() produces a
[batch, bs, ut, clusters, rays, 4] phase tensor in one shot.
14. Step 11: Generate channel coefficients per cluster and element pair
This is the core assembly step of the spatial channel model: Steps 1–10 only produce tabulated and random parameters (cluster powers, angles, delays, XPR, initial phases); Step 11 assembles them into the channel coefficient of every TX–RX element pair .
Reading map: this section proceeds as “standard equation → term-by-term table (each cell now states what the corresponding Sionna function does) → subclusters / LOS / combination / assembly order”. If the symbols , , , feel unintuitive, the next chapter “Phase structure of Eq. (7.5-22): a symbol dictionary” unpacks them one by one (including how the spherical basis vectors relate to antenna orientation, where ±45° polarization enters the formulas and how the TX and RX ends differ, and a reproducible numerical example). The Steps 1–12 main line is unaffected by that chapter.
The standard equation (7.5-22)
The g10 text reads: “For the N−2 weakest clusters, say n=3,4,…,N, the channel coefficients are given by” — note that (7.5-22) yields a cluster-level coefficient by coherently summing the rays inside the cluster:
The pattern arguments are omitted for brevity: the RX pair is evaluated at and the TX pair at ; are the unit sphere vectors of Eqs. 7.5-23/24; and is the Doppler shift of Eq. 7.5-25 (the standard contains only the moving-UT term; Sionna generalizes it to whichever end moves).
Term-by-term reading
| Factor | Physical meaning | Sionna implementation (what the function does) |
|---|---|---|
| Coherent superposition of the 20 rays (phase relations kept, not power addition) | channel_coefficients.py _step_11_reduce_nlos: sums the tensor h_full along dim=4 (the intra-cluster ray axis). CDL has no subclusters, so a single L946 h_full.sum(dim=4) does it; system-level models first split the 20 rays of the two strongest clusters into 3 subcluster groups per Table 7.5-5 and sum each group (L934-936), while the weak clusters are summed whole (L939) | |
| Equal-power ray amplitude (cluster power ÷ 20) | _step_11_nlos L868-870: computes power_scaling = √(P/M) and broadcasts it onto every ray coefficient, setting each ray’s amplitude | |
| The four random initial phases drawn in Step 10, indexed by polarization pair | _step_10 L544-577: draws four independent uniform phases per (cluster, ray), outputs a phi[...,4] tensor consumed by the four cells θθ/θφ/φθ/φφ of the 2×2 polarization matrix | |
| XPR attenuation: diagonal co-pol entries have unit amplitude, off-diagonal cross-pol entries are scaled by | _step_11_phase_matrix L579-608: assembles the four phases into h_phase=[[e^{jφ₀₀}, e^{jφ₀₁}],[e^{jφ₁₀}, e^{jφ₁₁}]] and multiplies the two off-diagonal cells by √(1/κ) (L594-597), applying the XPR weighting | |
| , | Element field patterns in the GCS (Eq. 7.1-11, including bearing/downtilt/slant rotations) | _step_11_field_matrix L726-840: the full antenna-response chain — GCS ray angles rotated to LCS by _gcs_to_lcs (L766/777) → each polarization calls field() (L781-801) to get → _l2g_response (L788-789) rotates back to the GCS spherical basis via ψ → matrix product with h_phase (L804-810) → gathered per element by polarization (L812-831) → rx/tx field vectors dotted (L835). See the “Computing F_rx / F_tx” section below |
| Geometric phase from the element’s projection along the ray direction (the beamforming mechanism) | _step_11_array_offsets L662-724: expresses each element position in the GCS via the rotation matrices, dots it with the ray unit vector , and scales by to get the per-element geometric phase | |
| Time-varying phase due to mobility | _step_11_doppler_matrix L610-660: computes per ray and multiplies by the sampling-time vector to produce the time-varying phase sequence |
Note: all
_step_*functions in the table live insrc/sionna/phy/channel/tr38901/channel_coefficients.py; κ is drawn inrays.pyL780-813.
Expanding the matrix product, each ray contributes four polarization paths:
The first and last terms are co-polarized (θ→θ, φ→φ); the middle two are cross-polarized (θ→φ, φ→θ) with amplitude — the meaning of “κ is the cross-polarization power ratio in linear scale”. The g10 note adds: if polarization is not considered, the 2×2 matrix degenerates to a scalar and only vertically polarized field patterns are applied. The four phases are mutually independent, so the four polarization paths of one ray are uncorrelated in the complex plane.
Subcluster expansion for the two strongest clusters (n=1,2)
Their 20 rays map onto 3 subclusters (Table 7.5-5): 10/20 rays at offset 0, 6/20 at 1.28, 4/20 at 2.56 (in units of the cluster delay spread ; UMa cluster DS = ns), with delay offsets per Eq. 7.5-26 and subcluster aggregation per Eqs. 7.5-27/28.
LOS specular component (Eq. 7.5-29)
Same structure as (7.5-22), but the polarization matrix becomes the deterministic (no random phases, no XPR).
Final combination (Eq. 7.5-30)
Sionna’s assembly order
The code mirrors the factor order of (7.5-22) exactly: _step_10 draws
the four phases → _step_11_phase_matrix builds the 2×2 polarization
matrix (h_phase: unit diagonal, off-diagonal scaled by
) → _step_11_field_matrix L726-840 computes the field
sandwich
(with GCS↔LCS rotations _gcs_to_lcs/_l2g_response) →
_step_11_array_offsets L662-724 and _step_11_doppler_matrix
L610-660 supply the three exponentials → _step_11_nlos L842-877
multiplies the factors and applies →
_step_11_reduce_nlos L879-958 performs and the Table 7.5-5
subcluster grouping (hardcoded at L182-193) → _step_11_los L960
computes the specular component → _step_11 L1011-1062 combines them
via the K-factor of Eq. 7.5-30.
For the detailed derivation of every phase source in (7.5-22) (closed form of the inter-element phase difference, the Jakes spectrum, the sign of the delay phase), see the later section “Phase structure of Eq. (7.5-22): a symbol dictionary”; how the sandwich is built from vendor pattern data (“Computing F_rx / F_tx”) and the three places where ±45° polarization enters the formulas (“Where ±45° polarization enters the formulas”) follow in the same part.
15. Step 12: Apply pathloss and shadowing
Sionna: system_level_channel.py L508-537 _step_12().
pl_db = sample_pathloss() is the basic PL + O2I (without SF); shadow
fading is passed separately in linear domain as sf, and the gain
gain = 10^(−pl_db/20)·√sf is multiplied onto h;
enable_pathloss/enable_shadow_fading control the two features.
16. Phase structure of Eq. (7.5-22): a symbol dictionary
Step 11’s Eq. (7.5-22) packs four phase sources and three vector symbols. This section unpacks each — the full answer to “how exactly is the per-element phase difference of a CDL/system-level channel computed”.
The subsections are organized in four groups, best read in order:
- A. Phase dictionary (total phase → → → closed form → Doppler → frequency-domain sign): each exponential factor reduced to one sentence of geometry;
- B. Antenna response & polarization ( definition → computing F_rx/F_tx → κ → where ±45° enters → TX vs. RX difference → non-standard polarization angles): answers “where the two vectors actually come from, what ±45° antennas change, and how to configure other polarization angles”;
- C. Worked numerical example: one ray computed by hand and checked against Sionna;
- D. Cross-reference: for later lookup.
Total phase of one ray
Collecting all exponential terms of (7.5-22), ray contributes at element pair :
(1) is Step 10; (2) and (3) are this section’s focus. In addition each cluster carries in time, which becomes the fourth source in frequency: the delay phase .
: spherical → unit direction vector (Eqs. 7.5-23/24)
A dimensionless unit vector translating the tabulated angles (AOA, ZOA) into a 3-D direction; the TX side builds symmetrically from (ZOD, AOD). Its job: dot-product projection onto a path-length difference.
: element position vector (§7.3)
Dimensioned (metres): the position of receive element in the array’s local frame. A UPA follows Eq. (7.3-1):
Example: 2×2 UPA at half-wavelength spacing → positions
. In Sionna this is exactly
AntennaArray.positions, shape [num_ant, 3] — printable for
verification.
Closed-form inter-element phase (the beamforming mechanism)
Substituting into , the z-component is killed by :
Phase step between adjacent columns (): . One ray imprints a planar phase gradient determined solely by — angle resolution and beam steering all come from this term.
Doppler phase → Jakes spectrum
Motion makes ; the time-varying part of (2) is (3), defining
One per ray over uniformly scattered directions yields the Jakes shape.
Frequency-domain composition and the delay-phase sign
Note the negative delay phase (longer path → lag) versus the positive geometric phase (element meets the wave earlier) — together they give the full MIMO-OFDM channel phase structure.
: the antenna response vector (§7.1, Eq. 7.1-11)
Three-layer definition chain for the θ component:
- Scalar pattern (§7.1.1/7.1.2): ;
- LCS polarization components (§7.1.2): and with slant angle (BS dual-pol: ±45°);
- Rotation back to the GCS (§7.1.3, Eq. 7.1-11):
where the local angles come from the
bearing/downtilt/slant rotations (Eqs. 7.1-27.1-5, 7.1-7/7.1-8) and
from Eqs. 7.1-127.1-15. Sionna’s
Antenna(pattern="38.901", polarization="dual") implements the whole
chain; pattern="omni" degenerates to .
Note on the ψ sign: the standard Eq. 7.1-11 writes the rotation matrix as ; Sionna’s
_l2g_response()implements the transposed form (L488-490), and its_compute_psi()defines ψ as the rotation angle of the spherical basis from GCS to LCS — the opposite sign to the standard definition (LCS→GCS). Matrix and definition are self-consistent and the numerical results agree.
Computing F_rx / F_tx: from vendor gain tables to field components
The previous section defined . This section answers the most common engineering question: vendor antenna datasheets give gain values of a single antenna in different directions (scalar dBi) — how do they become the field-component matrices required by (7.5-21/22)?
First, the frequent question: do the spherical basis vectors depend on the antenna orientation? The answer is “the basis itself does not; the component values do” — three layers:
- The basis is fixed by the ray direction alone. are the two unit spherical basis vectors at in the global coordinate system (GCS): points toward increasing zenith, toward increasing azimuth. They describe “where the wave travels” and are independent of how the antennas are mounted — for one ray, the TX end and the RX end share the same GCS spherical basis.
- The antenna’s polarization basis lives in its own LCS. The antenna’s vertical/horizontal/±45° polarization directions are defined in the local coordinate system (LCS) (set by the bearing/downtilt/slant rotations, Eqs. 7.1-2~7.1-5). The polarization unit vector projects onto the LCS spherical basis as — the “vertical/horizontal plane of the antenna” corresponds to the LCS , not to the GCS .
- ψ stitches the two bases together. Eq. 7.1-11 rotates the LCS spherical-basis components back into the GCS spherical basis, yielding that can be dotted with the ray’s electric field.
So relate to both: the definition of the basis vectors varies only with the ray direction (GCS), while the values of the components vary with the antenna polarization (γ) and orientation (bearing/downtilt/slant, through the LCS angles and ψ). The RX and TX ends use their own LCS, their own pattern lookup, and their own ψ for the same ray — the two F vectors are numerically independent (see the “TX vs. RX” subsection at the end of this chapter).
The full formula first. Eq. (7.5-21) writes one ray’s Jones vector as:
with the same-shaped antenna response matrix at both ends (rx evaluated at AOA/ZOA, tx at AOD/ZOD):
The matrix projects the antenna’s two Cartesian polarization components in its local coordinate system (LCS) onto the spherical basis of the ray direction — which is why the mix of the same antenna changes with look direction.
Vendor data → model field components: a four-step chain.
- Power → field amplitude. Datasheets give gain in dBi, a power quantity, while the formula needs field quantities: take the square root first, . Forgetting the sqrt is the most common mistake (amplitude off by a square).
- Single gain → polarization pair . One scalar
pattern implicitly assumes “isotropic polarization”; expand by antenna
type:
- isotropic: ;
- linear polarization with slant angle (vertical , horizontal , ±45° dual-pol ): , (i.e. §7.3 Eqs. 7.3-4/5);
- measured datasheets usually ship two dBi tables, co-pol and cross-pol: use as the co-polarized component and as the cross-polarized component on the LCS axes, then combine through the ±45° feed network into .
- Angle-system alignment. The pattern’s are LCS angles measured from the antenna boresine (z) axis, while (7.5-21) passes GCS (global) angles. With tilt/rotation, rotate the GCS angles into the LCS first (§7.1 Eqs. 7.1-7/8), then look up the pattern.
- Field rotation LCS→GCS. The looked-up LCS field components must be rotated back to GCS with the displacement angle (Eqs. 7.1-11/15) before dotting with the ray’s electric field .
Sionna implements exactly this chain (tr38901/antenna.py,
channel_coefficients.py):
| Conversion step | Sionna code |
|---|---|
| ① power→field + ② slant projection | AntennaElement.field(): f_theta = √A·cos(γ), f_phi = √A·sin(γ) |
| Pattern | _radiation_pattern_38901(): Eq. 7.3-3, |
| Polarization type → slant angles | PanelArray.__init__: VH→; cross→ |
| ③ GCS angles → LCS angles | _gcs_to_lcs(): Eqs. 7.1-7/8 |
| ④ LCS field → GCS field | _l2g_response() + _compute_psi(): Eqs. 7.1-11/15 |
| Full assembly | _step_11_field_matrix(): rotate angles → evaluate field() → rotate fields → dot with (carrying and ) to get the per-element response |
Hand check. Take cross dual polarization (pol1 has ) with
the 38.901 pattern at : , ,
, so and ; hence
and —
equal magnitude, opposite sign: the signature of a −45° slant; pol2
() has both components with the same sign. Sionna reproduces it:
import math, torch
from sionna.phy.channel.tr38901 import Antenna
ant = Antenna(polarization="dual", polarization_type="cross",
antenna_pattern="38.901", carrier_frequency=3.5e9)
theta = torch.tensor([math.pi / 2]) # 90°
phi = torch.tensor([0.0])
print(ant.ant_pol1.field(theta, phi)) # tensor([1.7762]) tensor([-1.7762])
print(ant.ant_pol2.field(theta, phi)) # tensor([1.7762]) tensor([1.7762])
Feeding a measured datasheet instead. AntennaElement only supports the
analytic omni/38.901 patterns; to use tabulated vendor data, implement
the four steps yourself — it boils down to “sqrt the dB table + bilinear
interpolation + two rotations”:
# G_co, G_xp: vendor co-pol / cross-pol dBi tables on an LCS grid
import numpy as np
A_co = np.sqrt(10 ** (G_co / 20)) # power → field amplitude
A_xp = np.sqrt(10 ** (G_xp / 20))
# interpolate at the ray's LCS angles (theta', phi'); dB-domain interp is smoother:
g_theta = interp2d(theta_grid, phi_grid, A_co, theta_p, phi_p) # co-pol component
g_phi = interp2d(theta_grid, phi_grid, A_xp, theta_p, phi_p) # cross-pol component
# combine via the ±45° feed, then rotate back to GCS with the 7.1-11 psi matrix
Three common pitfalls:
- dBi is a power quantity — always sqrt before the formula (, not );
- a “single gain value” assumes isotropic polarization, i.e. ; off boresine this can differ from a real ±45° antenna by several dB;
- datasheet angles are LCS angles: looking them up without aligning the array’s mechanical/electrical downtilt effectively “pastes the pattern facing the wrong way”.
: what XPR means physically
XPR = cross-polarization power ratio : scattering “leaks” power into the orthogonal polarization. Its only role in (7.5-22) is suppressing the off-diagonal entries of the 2×2 polarization matrix (). Larger XPR → better polarization isolation; smaller XPR raises the correlation between ±45° dual-polarized layers, degrading the channel rank and both multiplexing and diversity gains. CDL table values: A=10 dB, B=8 dB, C=7 dB (Eq. 7.7-0b permits ≈0.38 dB per-ray jitter — see Step 9 and the CDL/TDL article).
Where ±45° polarization enters the formulas
In the conversion chain above, polarization appeared once, through the slant angle . For a ±45° dual-polarized antenna it actually enters (7.5-21/22) in three places:
(1) Antenna response: the slant angle γ = ±45° sets the LCS field
components. Substituting into ,
: the two polarizations differ only by a sign —
pol2 (+45°) has both components with the same sign, pol1 (−45°) opposite
(the source of the measured 1.7762 / ±1.7762 in the previous section).
After the projection matrix (or the equivalent rotation) into GCS
spherical components, the closed form is very readable:
For the same ray, the two ±45° polarizations receive amplitudes differing only by an azimuth cosine — change the arrival azimuth and the power ratio between the two polarizations changes with it. That is the mechanism of polarization diversity, and why a datasheet must specify not just the pattern boresine but also the slant orientation around it.
(2) Polarization combinations and XPR: κ penalizes only the “cross” combinations. In (7.5-22) the coefficient carries polarization indices (rx and tx each taking one of the ±45° ports), and the polarization matrix together with its prefactor is:
The matrix has only two kinds of entries — “1” and "" — so
after the prefactor the two path amplitudes are and
: co-polarized combinations (same port polarization) carry
power , cross-polarized ones carry , with = XPR =
co-pol power ÷ cross-pol power (8 dB for CDL-B). Sionna implements this in
_step_11_phase_matrix():
h_phase = [[e0, e1], [e2, e3]] — two unit-magnitude entries for the co-pol
paths, two scaled by √(1/κ) for the cross-pol paths ( is folded
into power_scaling), each of the four carrying an independent uniform
random phase.
(3) Random initial phases: one per polarization combination. §7.5
Step 10 draws four uniform phases per ray,
, ,
, — one for
each combination, i.e. the phases of e0–e3 above (Sionna
_step_10()
generates phi[...,4]). Written as “V/H”, these are the HH/HV/VH/VV random
phases — the origin of in the definition of .
About the middle matrix in the screenshot formula: it is LOS-ray-only (NLOS uses the identity); the flips the second component, the phase reversal of the field component orthogonal to the plane of incidence under specular geometry. The ±45° antenna polarization information is not in this matrix — it lives in (1)(2)(3) above.
How Sionna assembles it (who uses ±45° at which step):
| Step | Code |
|---|---|
polarization_type="cross" → two slanted elements | PanelArray.__init__ |
| Per ray, per polarization → LCS field components | AntennaElement.field() |
| LCS→GCS field rotation () | _l2g_response() |
| Polarization matrix + 4 random phases (cross entries scaled by ) | _step_11_phase_matrix() |
| Each element gathers its own polarization’s response (gather indices) | _step_11_field_matrix() L812-L831 |
| rx/tx field-vector dot product → per-element-pair coefficient | _step_11_field_matrix() L833-L838 |
Worked example: polarization diversity in one line. Take a ray arriving along the antenna boresine: the two LCS spherical components are then just two orthogonal linear polarizations in the tangent plane, and the antenna response vector is . Let the incident wave be linearly polarized, ; the received amplitude is the inner product:
The −45° port receives everything, the +45° port zero — the received
amplitude is always (Malus’ law of polarization
mismatch). Verifying with the measured field() outputs from the previous
section:
import math, torch
# field() outputs at (θ=90°, φ=0) from the previous section, normalized by √A=2.5119
pol1 = torch.tensor([ 1.7762, -1.7762]) / 2.5119 # γ = -45°
pol2 = torch.tensor([ 1.7762, 1.7762]) / 2.5119 # γ = +45°
E = torch.tensor([1.0, -1.0]) / math.sqrt(2) # -45° linearly polarized wave
print(pol1 @ E, pol2 @ E) # tensor(1.0000) tensor(0.0000)
The two ±45° antennas at the TX and RX ends: how they differ in the formula
In (7.5-22) and form a symmetric “sandwich”, yet the inputs at the two ends are completely independent — the detail most easily missed when reading the formula:
| Input | RX end | TX end |
|---|---|---|
| slant γ | element ‘s slant (cross array: ) | element ‘s slant () |
| ray angles (GCS) | AOA/ZOA | AOD/ZOD |
| LCS angles | from the RX orientation (bearing/tilt/slant) | from the TX orientation |
| ψ | : RX orientation + AOA/ZOA | : TX orientation + AOD/ZOD |
For the same ray ZOD≠ZOA and AOD≠AOA, and the two arrays are mounted
differently, so and are numerically
unrelated — the “two ±45° antennas” in the formula are not one set of
components reused twice, but two independently computed antenna responses.
Sionna implements the symmetry literally: in
_step_11_field_matrix(),
L766 runs _gcs_to_lcs on the TX ray angles (AOD/ZOD) and L777 runs it
again on the RX angles (AOA/ZOA); L788-789 call _l2g_response once per
end (with tx_orientations/rx_orientations and their own ψ); L812-831
dispatch pol1/pol2 responses to the TX and RX arrays via
_gather_ind_tx/_gather_ind_rx; L835 dots the two field vectors into the
per-element-pair coefficient.
With cross arrays at both ends, element pairs split into two classes (most intuitive near boresight). For an element pair with slant combination :
- Same slant ( and ): both response vectors are identical, the polarization paths add in phase — co-pol dominates, power ≈ ;
- Orthogonal slant ( and ): the two response vectors are orthogonal, the dominant terms cancel and only cross-pol remains, power ≈ .
Every polarization path carries the product of the two ±45° projection weights , with the sign combination setting the direction of addition. In one sentence: γ enters each end’s F through ; the difference between the two ends’ γ decides each element pair’s co/cross identity; κ sets the cross-pol power discount; while the ray angles, LCS angles and ψ take entirely different values at the two ends.
Other polarization angles: slant_angle and non-standard polarization
±45° is only an engineering convention — the polarization degree of freedom in the formula is fully continuous, and Sionna controls it through two layers of parameters:
① Element level: AntennaElement(slant_angle=γ) is the true degree of
freedom.
AntennaElement.__init__
accepts the slant angle γ in radians, any continuous value, and γ enters
the formula at exactly one place —
field():
, . γ=0 is vertical,
π/2 horizontal, ±π/4 the usual ±45°, π/6 a 30° polarization — the formula is
fully general.
② Panel level: polarization_type exposes only an enumeration.
PanelArray.__init__ L422-435
hard-codes the enum to fixed γ:
| polarization | polarization_type | pol1 γ | pol2 γ |
|---|---|---|---|
| single | "V" / "H" | 0 / π/2 | — |
| dual | "VH" | 0 | π/2 |
| dual | "cross" | −π/4 | +π/4 |
Note that pol2 at L435 is always slant_angle + π/2 — Sionna assumes the
two polarizations are orthogonal, and ±45° is merely the cross special
case.
Two ways to get non-standard polarization (e.g., ±30°, 45°/135°):
- Element / array assembly:
AntennaElementis exported fromtr38901/__init__.py; constructAntennaElement(pattern="38.901", slant_angle=α)and callfield()directly for a single element; for an array, replace the panel’s_ant_pol1/_ant_pol2attributes with the custom elements (not an official injection point — it bypasses the enum). - Panel slant orientation: the third angle of the
(bearing, downtilt, slant)orientations passed toset_topology()(system_level_channel.pyL120-189) rotates the whole LCS about the normal (Eq. 7.1-4,_forward_rotation_matrix). Near boresight this is equivalent to adding a common offset to every γ; off axis the pattern rotates with the LCS, so it is not identical to changing γ alone — one rotates the whole antenna, the other only the feed direction.
Worked numerical example: one ray from start to finish
Take the real table values of CDL-B cluster 1 (Table 7.7.1-2: AOD , AOA , ZOD ZOA ) and assume:
| Parameter | Value |
|---|---|
| Carrier | 3.5 GHz → m |
| TX/RX arrays | 2×2 UPA each, , element index |
| UT velocity | 30 m/s along ( Hz) |
| Delay spread | DS = 100 ns (nominal) |
| Random phase | Set (example) |
① Direction vectors: ; .
The TX side is analogous (swap in AOD for ): .
② RX element geometric phases ():
The adjacent-column difference is and the adjacent-row difference is — exactly matching the closed form. For TX element : .
③ Doppler: Hz → the phase drifts at .
④ Delay phase (cluster 2’s normalized delay 0.1072 → ns): on a subcarrier 50 MHz off center, .
⑤ XPR: CDL-B table value 8 dB; with , dB, , and the cross-polarization amplitude factor .
⑥ Total phase (this ray at element pair , time ):
Sionna verification (geometric part):
import numpy as np
from sionna.phy.channel.tr38901 import Antenna, AntennaArray
lam = 3e8 / 3.5e9
arr = AntennaArray(Antenna(pattern="omni", polarization="single"),
num_rows=2, num_cols=2) # default 0.5λ spacing
d = arr.positions.numpy() # [4, 3], meters
r_hat = np.array([-0.2672, 0.9443, 0.1923]) # ① hand-computed direction
phase = 2 * np.pi / lam * (d @ r_hat) # ② per-element phase [rad]
print(np.degrees(phase))
# ≈ [-60.9, -109.0, 109.0, 60.9] — matches the hand calculation
Sionna cross-reference
| (7.5-22) ingredient | Sionna code |
|---|---|
| (1) | _step_10() uniform phases |
| polarization | e1/e2 in _step_11_phase_matrix() |
| (2) geometric phase | _step_11_array_offsets() |
| (3) Doppler | _step_11_doppler_matrix() |
_step_11_field_matrix() + Antenna | |
| intra-cluster | h_full.sum(dim=4) |
power_scaling |
17. Does Sionna support the §7.6.3 spatial channel model?
(Numbering note: in the g10 draft the array-based content of the old §7.6.3 “spatial channel model” has been folded into §7.5 Step 11, and the §7.6.3 number now denotes spatial consistency; this section keeps the customary usage of “§7.6.3” for the spatial channel model itself.)
Yes — Step 11 is the §7.6.3 implementation. More precisely, it is the array-based formulation, the main path of §7.6.3 where channel matrices are built from antenna-array steering vectors. The beamspace variant of §7.6.3 is not implemented (there is no beamspace code anywhere in the directory; matrices are always constructed per element).
In the array-based formulation each path’s matrix is an element-wise
product of four factors, implemented by four _step_11_* helpers in
channel_coefficients.py:
Source locations of each factor:
- Random-phase + XPR polarization matrix (Eq. 7.5-22):
_step_11_phase_matrix()L579-608. The four phases form a 2×2 polarization matrix; cross-polar terms are scaled by (L594-605). - Element responses :
_step_11_field_matrix()L726-840. GCS angles are rotated into each array’s local coordinate system via_gcs_to_lcs()(L766/L777), the per-element pattern responses come fromPanelArray.ant_pol1/ant_pol2.field()(L781-801), then_l2g_response()rotates back; the result is multiplied with (L804-810) and dual-polarized elements are assigned via precomputed gather indices (L812-831). - Array steering phases (the term of the
array-based method):
_step_11_array_offsets()L662-724._unit_sphere_vector()L323-342 builds from (θ, φ) (Eq. 7.1-6); it is dotted with element positions (_step_11_get_tx/rx_antenna_positionsL494-543, including array rotations) and exponentiated. - Mobility (Doppler) phases:
_step_11_doppler_matrix()L610-660. - Full NLOS matrix (Eq. 7.5-28):
_step_11_nlos()L842-877 multiplies the four factors and scales power by . - Ray → path reduction with subclustering (Eq. 7.5-27):
_step_11_reduce_nlos()L879. - LOS specular component + K-factor combination (Eq. 7.5-30):
_step_11_los()L960 generates the zero-delay LOS term;_step_11()L1011-1062 scales by and , folds the LOS term into the zero-delay NLOS cluster, and selects per link withtorch.where(los_indicator, h_los, h_nlos).
The output h has shape
[batch, num_tx, num_rx, num_paths, num_rx_ant, num_tx_ant, num_time]
(L125-129) — complex coefficients per antenna pair, per path, per time
sample, exactly what the array-based §7.6.3 is meant to produce. Downstream
layers such as GenerateTimeChannel / GenerateOFDMChannel then convert
it to time/frequency domain channel tensors.
Coverage of the neighboring subsections (clause numbers below are the old numbering; in the g10 draft CDL/TDL moved to §7.7 and the array-based formulas of the spatial channel model were folded into §7.5 Step 11):
| 38.901 clause | Model | Sionna |
|---|---|---|
| §7.6.1 | CDL (A/B/C/D/E) | cdl.py (859 lines), also array-based, no subclustering |
| §7.6.2 | TDL (A/B/C/D) | tdl.py (545 lines) |
| §7.6.3 | Spatial channel model (array-based) | ✅ channel_coefficients.py (this section) |
| §7.6.3 | Spatial channel model (beamspace) | ❌ not implemented |
18. Spatial consistency, mobility, and state transitions (five FAQs)
18.1 Is spatial consistency implemented?
Two layers to distinguish:
- LSP spatial consistency (SSC, §7.6.3.1): ✅ implemented. This is
the function walked through line by line above —
lsp.pyL333-446_compute_lsp_spatial_correlation_sqrt(), which builds the matrix square root of the correlation model (L348; is the 2D distance between the two UTs, the per-LSP correlation distance from Table 7.5-6), applied during LSP sampling (L134-137). Pairwise UT 2D distances are precomputed by the scenario (system_level_scenario.pyL1058-1064). So nearby UTs under the same BS get statistically correlated DS/SF/K, etc. - Spatially consistent cluster angles (SSLA, old numbering §7.4.4.1):
❌ not implemented. There is no SSLA code in
rays.py; cluster angles are drawn independently per link from Laplace distributions. - At the array-based (Step 11) level: within one realization, matrices are a deterministic function of the geometric angles, so element responses are inherently consistent; cross-position instantaneous consistency is only guaranteed at the LSP level (SSC), while small-scale parameters are resampled per call (see 18.3).
18.2 If I give the UE a velocity, does its position move?
No. The ut_velocities passed to set_topology only flows into
Topology.velocities (system_level_channel.py L282), whose sole
consumer is _step_11_doppler_matrix() (channel_coefficients.py
L610-660), which adds the per-ray phase
over the time
axis. Positions (ut_loc) are frozen at set_topology time; there is no
“position += velocity × time” integration anywhere inside the model.
Velocity changes the evolution rate of the channel (the Doppler
spectrum), not the geometry.
For actual motion you must update UT coordinates and call set_topology
again at each scheduling interval — which is exactly what the
system-level simulator in sionna.sys does; it is the responsibility of
the layer above the channel model.
18.3 How often is the channel regenerated? Is it continuous across calls?
- When: each call
channel_model(num_time_samples, sampling_frequency)produces one complete channel snapshot over the time grid , (channel_coefficients.pyL295-305). There is no re-generation inside a single call. - Within one call: continuous in time. The Doppler phase evolves smoothly with (L656) while ray angles/powers/delays stay fixed — the standard’s “single realization evolving over time” behavior.
- Across calls: statistically continuous, instantaneously discontinuous.
With the default
always_generate_lsp=False(uma.pyL100) the LSPs are reused (large-scale continuity unless the topology changes), butRaysGeneratorcluster/ray parameters and the_step_10random phases are freshly sampled every call — so consecutive snapshots do not transition smoothly. Withalways_generate_lsp=Trueeven the LSPs are resampled, weakening continuity further. - The 1.x code does not expose a
sample_at-style API for querying the channel at arbitrary time instants; the time axis is laid out once per call.
18.4 Does LOS/NLOS change during a simulation?
Not within one topology. The LOS state is decided at set_topology
time by _sample_los() (system_level_scenario.py L1066-1088):
- if the user pins
los, that value is used; otherwise a Bernoulli draw with the scenario’slos_probability(for UMa, the §7.4.2.1 Table 7.4.2-1 formula,uma_scenario.pyL87-122); - indoor UTs are forced to NLOS:
los & (~in_state)(L1088).
Every subsequent __call__ reuses that state (Topology.los,
system_level_channel.py L288), and _step_11 selects per link with
torch.where(los_indicator, h_los, h_nlos) (L1058-1059). Only a new
set_topology call (position/orientation/indoor-state change) resamples
LOS/NLOS — state transitions are event-driven, not a per-instant
random walk.
18.5 Is §7.6.3.3 (LOS/NLOS soft indoor/outdoor) implemented?
❌ Not implemented. TR 38.901 V17 added §7.6.3.3, where LOS/NLOS state and O2I loss interpolate smoothly over a transition distance as a UT crosses a building boundary. Sionna has no soft/transition mechanism:
in_stateis a boolean (system_level_channel.pyL152:Truemeans indoor) — indoor/outdoor is a hard switch;- O2I loss is added wholesale to the pathloss of indoor links
(
lsp.pyL92-110sample_pathloss(), low/high models per §7.4.3); - the indoor 2D penetration distance is sampled per §7.4.3.1
(
system_level_scenario.pyL1090+), but only feeds the O2I formula — it produces no state transition.
Scenarios that need soft O2I (NTN coverage edges, dense-urban crossings) must approximate it outside the model for now.
19. Consistency check against 38.901 §7.5
Comparing the Sionna implementation clause by clause with TR 38.901 g10 §7.5, conclusions fall into three classes: consistent, implementation deviation (departs from the spec text), and convention difference (different mathematical representation but statistically equivalent). A few formulas are embedded images in the g10 docx and cannot be verified character by character; they are flagged separately.
| Step | Verdict | Notes |
|---|---|---|
| 1 Inputs | Consistent | Scenario/positions/patterns/array orientation/velocity all provided by SystemLevelScenario + Topology |
| 2 LOS/NLOS + I/O | Consistent | UMa LOS probability matches term by term; indoor state assigned via simulation parameter; LOS fixed at set_topology, does not evolve over time |
| 3 Pathloss | Mostly consistent | Formulas match term by term; the hE “otherwise” branch uses a continuous uniform approximation of the spec’s discrete set {12,15,…} (see the Step 3 blockquote) |
| 4 LSPs | Consistent | Cholesky correlation and the 104°/52° clamps (lsp.py L149-172) both implemented; the LSP vector order differs from the spec’s sM but the correlation matrix uses the same order — statistically equivalent |
| 5 Cluster delays | Consistent (1 unverified) | 7.5-1/2 match; LOS scaling is a polynomial division (rays.py L310-321); the 7.5-4 formula body is an image and cannot be verified, though the division direction is physically sensible (compensating the zero-delay LOS peak pulling down the RMS DS) |
| 6 Cluster powers | Deviation | ① The spec removes clusters more than 25 dB below the max power; Sionna does not (path count stays at N); ② decay exponent is (rτ−1)/rτ (L367-371), the 7.5-5 formula body is an image and unverifiable; ③ everything else matches: unscaled delays for power, sum normalization, LOS first-cluster K/(K+1) combination (7.5-7/8), post-combination powers for angles vs. pre-combination for coefficients |
| 7 Angles | Deviation | ① Ray #16 offset in Table 7.5-3 is coded as −0.1481, spec value is −1.1481 (rays.py L110, likely a typo); ② random sign Xn has shape [batch, num_bs, 1, clusters] — all UT links of a BS share the signs, while the spec requires per-link independence; ③ rest matches: inverse Gaussian/Laplacian, Table 7.5-2/4 constants (1.146/1.104), LOS first-cluster direction enforcement, ZOD frequency offset, O2I 90°; LOS correction polynomial signs unverifiable |
| 8 Random coupling | Deviation | ① The spec couples within sub-clusters for the two strongest clusters; Sionna shuffles over all 20 rays of the cluster; ② shuffle permutations shared across UTs; ③ the three pairings (AOD↔AOA, ZOD↔ZOA, AOD↔ZOD) themselves are implemented correctly |
| 9 XPR | Consistent | Per-ray log-normal, μ/σ per Table 7.5-6 |
| 10 Phases | Consistent | Four polarization phase combos i.i.d. uniform; range (−π, π) equals the spec’s U(0, 2π) modulo 2π |
| 11 Coefficients | Consistent (2 remarks) | Sub-cluster splitting (two strongest, 10/6/4 rays, 0/1.28/2.56·c_DS), LOS specular matrix [[1,0],[0,−1]], K-factor combining 7.5-30 all match. Remarks: ① the spec defines Doppler only for UT velocity × arrival angles; Sionna’s moving-tx handling is a generalization, not a strict match; ② Doppler/propagation-delay use exp(+j·) where the spec often writes exp(−j·) — a global conjugation, |
| 12 PL/SF weighting | Consistent | gain = 10^(−PL/20)·√SF, gated by enable_pathloss/enable_shadow_fading |
Summary: the algorithm backbone (twelve-step flow, all parameter-table values, LOS/NLOS/O2I branch logic) matches §7.5 strictly; deviations concentrate in Step 6’s missing −25 dB cluster pruning, Step 7/8’s cross-link sharing of random quantities and the sub-cluster coupling scope, plus one numeric typo in Table 7.5-3. These do not affect the model’s overall statistics but matter when bit-exact alignment with spec outputs is required (e.g. cross-vendor simulation comparisons).
20. Quick reference
The step-by-step mapping (twelve steps → spec formulas → Sionna locations) is in the “Steps 1–12 at a glance” table near the top; here is a topic-oriented index:
| Looking for | Location |
|---|---|
| UMa class & usage example | uma.py L16-117 |
| Full orchestration | system_level_channel.py L234-353 |
| Antenna arrays & 38.901 patterns | antenna.py L293-632 |
| LSP spatial consistency (SSC) | lsp.py L333-446 |
| LOS/NLOS state sampling | system_level_scenario.py L1066-1088 |
| Doppler/velocity (no position update) | channel_coefficients.py L610-660 |
21. References
- 3GPP TR 38.901 g10 draft, “Study on channel model for frequencies from 0.5 to 100 GHz”, §7.4.1–7.4.4, §7.5, §7.6.3
- Sionna documentation:
sionna.phy.channel.tr38901API reference - Sionna source:
src/sionna/phy/channel/tr38901/ - Related posts on this blog: Sionna channel models, Sionna PHY architecture overview
Comments
Loading comments…
Want to leave a note? Sign in first — comments are open to every signed-in reader.