What ntn-digital-twin does
ntn-digital-twin is a Python service for the ns-3 NTN toolkit that propagates satellite two-line elements with SGP4, applies an A3 handover guard, and serves the constellation state over REST, CZML and InfluxDB line protocol. It writes a handover schedule on a shared epoch that OranNtnTwinPredictionConsumer in the oran-ntn module loads and actuates inside a running ns-3 simulation.
What it models
The twin mirrors a satellite constellation and predicts handovers from ephemeris. Every loop interval it fetches TLEs from CelesTrak through a 6 h on-disk cache, or generates deterministic Walker elements on the same epoch the ns-3 scenario uses, then propagates them with SGP4 from the ntn-constellation package. It writes CZML for a Cesium viewer and ntn_sat_pos line protocol in the ntn-observability schema for InfluxDB and Grafana. A FastAPI server on port 8090 answers GET /health, GET /constellation/state and POST /predict/handover, computing elevation in closed form from ECEF to ENU on the hot path.
Handover prediction and actuation share one A3 guard, following the 3GPP TS 38.331 A3 event: a dB link-budget margin, hysteresis, time-to-trigger and a minimum service time. The guard ranks and compares on the same quantity, does not count initial acquisition as a handover, and restarts time-to-trigger when the best target changes. emit_predictions_file writes lines of t_s, ueId, recommendedGnbId and confidence, where t_s equals ns-3 simulation time. On the ns-3 side, OranNtnTwinPredictionConsumer fires a HANDOVER_TRIGGER into the E2 and CHO loop at each t_s whose confidence clears a floor. A C++ metric, CompareHandovers, replays the twin's TLEs in Sgp4MobilityModel and compares handover instants. The direction from simulator back to twin is not implemented: the twin does not ingest ns-3 state.
Measured numbers
handovers the twin exported, at 280, 610, 1100, 1650 and 2180 s, each to a different satellite, with confidence 0.13 to 0.23
one deterministic run: Walker source, 66 satellites in 6 planes of 11 at 53 deg, observer at 33.68 N 73.05 E, 2700 s horizon, 10 s step; confidence is the elevation margin over the runner-up divided by 30 deg, clipped to [0, 1]Each number states the run it comes from; the README of the module lists the command that reproduces it.
Standards it follows
| 3GPP TS 38.331 | A3 event and conditional reconfiguration behind the shared handover guard |
| 3GPP TR 38.821 | NTN link budget and geometry |
| SGP4 / SDP4 | orbit propagation of two-line elements |
| CelesTrak two-line element format | live constellation input |
| CZML | constellation export for a Cesium viewer |
| InfluxDB line protocol | satellite position export for InfluxDB and Grafana |
New on 6g-ntn.live
The toolkit now runs in the browser at 6g-ntn.live: pick an example of ntn-digital-twin or any other module, change its parameters, and the real ns-3 binary runs on the server.
Type ./ns3 run with your own arguments; the real binary runs on the server and streams its output.
Open →115 runnable examplesEvery example of the 14 modules, each with a typed parameter form and its measured KPIs.
Open →Live 3D globeReal constellations from CelesTrak elements, propagated with SGP4, with their service and feeder links.
Open →Open datasetsEvery finished run becomes a dataset under CC BY 4.0, with its provenance and configuration.
Open →Validation690 test cases in 41 toolkit suites, and a health check on every example.
Open →Shared scenariosResearchers post a configuration with its parameters and results; anyone can rerun it.
Open →Watch
Watch on YouTube: the NTN Control Center running and visualizing the toolkit examples, in five minutes.
Install
Every module ships in the ready-built container image of the toolkit (version 3.0.1):
docker pull uzairdocker69/ns3-ntn-toolkit:latest
docker run --rm -it uzairdocker69/ns3-ntn-toolkit:latest bash
To build from source, clone ns3-ntn-toolkit, which vendors this module under contrib/, or follow the README of this repository (branch ntn-digital-twin-v4).
Cite
If you use ntn-digital-twin, please cite the toolkit article (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}
}