Skip to content

fix(indoor): sample d_2D-in as min(U1,U2) per TR 38.901 §7.4.3.1#1156

Open
Vinu2111 wants to merge 1 commit intoNVlabs:mainfrom
Vinu2111:fix/d2d-in-min-of-two-samples
Open

fix(indoor): sample d_2D-in as min(U1,U2) per TR 38.901 §7.4.3.1#1156
Vinu2111 wants to merge 1 commit intoNVlabs:mainfrom
Vinu2111:fix/d2d-in-min-of-two-samples

Conversation

@Vinu2111
Copy link
Copy Markdown

@Vinu2111 Vinu2111 commented May 2, 2026

Summary

Fixes #1108

The indoor 2D distance d_2D-in in _sample_indoor_distance() was computed from a single uniform sample U(min_2d_in, max_2d_in). Per TR 38.901 §7.4.3.1, it must be min(d_2D-in-1, d_2D-in-2) where both are independent uniform samples over the same range.

Root Cause

The previous implementation produced a flat uniform distribution. The correct min(U1, U2) of two i.i.d. uniforms follows a distribution skewed toward the lower bound — meaning indoor UTs are statistically placed closer to the building wall, which materially affects pathloss and O2I penetration loss calculations.

Fix

Draw two independent rand() samples and take torch.minimum(u1, u2) before applying indoor_mask:

u1 = rand(...) * (self.max_2d_in - self.min_2d_in) + self.min_2d_in
u2 = rand(...) * (self.max_2d_in - self.min_2d_in) + self.min_2d_in
distance_2d_in = torch.minimum(u1, u2) * indoor_mask

The fix applies to all three subclasses (UMa, UMi, RMa) since _sample_indoor_distance() lives in the base class SystemLevelScenario.

Changes

  • src/sionna/phy/channel/tr38901/system_level_scenario.py — replace single uniform sample with min(U1, U2)
  • test/unit/channel/test_3gpp_channel_scenario.py — two new tests added to TestRMaScenario:
    • test_d2d_in_range_and_outdoor_zero — verifies d_2D-in is within [0, max_2d_in] for all-indoor topology
    • test_d2d_in_outdoor_uts_are_zero — verifies d_2D-in is exactly 0 for all-outdoor topology

Testing

New tests cover range bounds and the indoor_mask zeroing logic. The existing test_distance_calculation continues to verify additive consistency (d_2D-in + d_2D-out == d_2D).

Per TR 38.901 §7.4.3.1, the indoor 2D distance d_2D-in must be
computed as min(d_2D-in-1, d_2D-in-2) where both are independent
uniform samples over [min_2d_in, max_2d_in].

The previous implementation sampled a single uniform value, producing
a flat U(min, max) distribution instead of the correct triangular-like
distribution skewed toward the lower bound. This materially affects
pathloss and O2I penetration loss calculations for indoor UTs.

Fix: draw two independent rand() samples u1 and u2 and take
torch.minimum(u1, u2) before applying the indoor_mask.

Adds two new tests to TestRMaScenario:
- test_d2d_in_range_and_outdoor_zero: verifies d_2D-in is within
  [0, max_2d_in] for all-indoor topology
- test_d2d_in_outdoor_uts_are_zero: verifies d_2D-in is exactly 0
  for all-outdoor topology

Fixes NVlabs#1108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

d_2D-in sampling wrong: Spec requires min(U1, U2) (minimum of TWO uniform samples), but uses a single uniform sample.

1 participant