What this module models
The sidelink follows NR PC5 Mode 2 as described in 3GPP TS 38.321 Section 5.22, with an SL-ResourcePool of subchannels and slots (TS 38.331). NtnSlUeMac performs sensing-based autonomous selection: candidates in the T1 to T2 window, exclusion above an SL-RSRP threshold, the 20 percent rule with 3 dB steps, and periodic reservation with a reselection counter. NtnSlChannel applies the TR 37.885 highway LOS path loss with log-normal shadowing and NLOSv blockage, enforces half duplex, decodes on SINR with co-channel interference summed in linear power, and reports PRR by distance following TR 38.885. It is a MAC abstraction and does not decode PSCCH or PSSCH bits or combine HARQ.
Basic safety messages are SAE J2735 (2016) BSMcoreData, 21 octets on the wire with UPER offset-from-lower-bound integers and the standard's range clamps. SumoTraciBridge replays floating-car data offline and applies both position and velocity, so BSM speed and heading fields are real; live TraCI co-simulation is not implemented. V2xLeoRelay assigns each vehicle direct or relay service from a minimum direct SNR and a maximum V2V range, and a runtime transmit gate lets those decisions start and stop flows mid-run. The satellite leg uses SGP4 orbits over an NR NTN cell or a point-to-point path whose delay follows slant range, with TR 38.811 and TR 38.821 for its geometry and budget. V2xLeoDirect, a closed-form TR 38.821 Set-1 S-band budget, is kept as a reference. TS 23.287 is cited for the V2X architecture.
Outputs
- PRR by distance bucket for highway BSM broadcast (ntn-v2x-pc5-sidelink-bsm)
- BSM delay, jitter and loss measured at NtnOranSink (ntn-v2x-leo-relay-traffic)
- Per-second direct, relay and orphan counts from a measured baseline SINR (ntn-v2x-rural-highway)
- Age of information, delay and PDR at the server for canyon relaying (ntn-v2x-canyon-relay)
- Per-vehicle FCD replay samples exported through a TracedCallback
Standards
| Specification | What the module takes from it |
|---|---|
| 3GPP TS 38.321 | Section 5.22 sidelink Mode 2 resource selection |
| 3GPP TS 38.331 | SL-ResourcePool configuration |
| 3GPP TR 38.885 | V2X evaluation methodology and PRR (designation as written in the module docs) |
| 3GPP TR 37.885 | Highway and urban sidelink channels, PRR evaluation |
| 3GPP TS 23.287 | V2X architecture |
| SAE J2735 | Basic safety message core data and UPER encoding |
| 3GPP TR 38.811 | Satellite leg |
| 3GPP TR 38.821 | Satellite leg; Set-1 S-band defaults of V2xLeoDirect |
Key numbers
Stated in the module documentation, each with the conditions it was measured under.
- Measured sidelink PRR within 50 m at 10 vehicles, and at 30 and 60 vehicles
- 1.000 and 0.997
- Traffic from terminals allowed on air against traffic from gated terminals under the relay transmit gate
- 14 792 packets on air, 0 gated
Examples (7)
- Street-canyon relaying over sidelinkVehicles in an urban street canyon report status through LEO satellites; blocked vehicles relay over NR sidelink Mode 2 to a neighbor with line of sight. Compare policies.
- Edge AI braking: satellite or groundPlatoon control messages on a URLLC slice over a measured LEO cell. A hazard xApp runs on the satellite or on the ground, and the decision latency of each is measured.
- Safety messages relayed by a peer vehicleA shadowed vehicle sends BSMs through a nearby vehicle and a LEO satellite to a server. The default hops are point-to-point links gated by a closed-form link check; v2v=pc5 with uplink=nr runs PC5 Mode 2 and the relay uplink on the measured NR cell (at the Set-1 23 dBm the uplink barely closes).
- Vessel on a real AIS trackA vessel replayed from a Danish AIS trace is a UE on a measured NR LEO cell. Reports downlink SINR, TBLER and throughput as the satellite passes.
- PC5 sidelink BSM broadcastVehicles broadcast SAE J2735 BSMs over NR PC5 sidelink with Mode 2 sensing-based resource selection and no gNB. Reports packet reception ratio against distance (TR 38.885).
- Direct or relayed LEO uplinkVehicle UEs on a measured NR LEO cell in a street whose facades and a moving truck block the radio per RB (TR 38.901 blockage model B geometry). Relay selection uses measured RSRP; remote UEs leave Uu and reach the network through a relay over PC5 Mode 2 (scripted=1 for the old decision-only mode).
- Rural highway fleet on one satelliteVehicles replayed from an FCD trace share one LEO satellite. Each uses its measured direct link or relays through a peer, giving the direct, relayed and unserved split.
Run it
In the browser
Pick an example in the run panel above, set its parameters and press Run. The console streams live and the result opens with KPI charts.
In the ns-3 console
The browser console accepts ns-3 style commands, for example
ns3 run "ntn-v2x-canyon-relay --PrintHelp".Locally with Docker
The public image has the whole toolkit prebuilt. This runs
ntn-v2x-canyon-relaywith its built-in defaults.docker run --rm -it uzairdocker69/ns3-ntn-toolkit:latest ./ns3 run "ntn-v2x-canyon-relay"
Cite this
If you use this module, please cite the article that describes the toolkit: doi:10.1109/OJCOMS.2026.3745010.
M. Uzair, B. G. Aldahlan, A. A. Albar, H. Althumali and A. Alghammas, "ns3-ntn-toolkit: An integrated ns-3 platform for 6G non-terrestrial networks," IEEE Open Journal of the Communications Society, vol. 7, pp. 13440-13467, 2026, doi: 10.1109/OJCOMS.2026.3745010.
@article{uzair2026ns3ntntoolkit,
author = {Uzair, Muhammad and Aldahlan, Bassma G. and Albar, Ali A. and
Althumali, Huda and Alghammas, Adnan},
title = {ns3-ntn-toolkit: An Integrated ns-3 Platform for 6G
Non-Terrestrial Networks},
journal = {IEEE Open Journal of the Communications Society},
volume = {7},
pages = {13440--13467},
year = {2026},
doi = {10.1109/OJCOMS.2026.3745010}
}