SGP4/SDP4 satellite orbit propagator
SGP4 - SGP4/SDP4 Orbit Propagator (Spacetrack Report #3)#
Pure OCaml implementation of the standard algorithm for predicting satellite positions from Two-Line Element (TLE) data. Used by NORAD, NASA, and most space agencies.
The algorithm handles:
- SGP4: Near-Earth objects (orbital period < 225 minutes)
- SDP4: Deep-space objects (orbital period >= 225 minutes)
Installation#
Install with opam:
$ opam install sgp4
If opam cannot find the package, it may not yet be released in the public
opam-repository. Add the overlay repository, then install it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install sgp4
Usage#
open Sgp4
(* Parse TLE and propagate *)
let tle_string =
"ISS (ZARYA)\n\
1 25544U 98067A 21073.51041667 .00001264 00000-0 29621-4 0 9993\n\
2 25544 51.6442 21.2413 0002180 62.8608 47.5454 15.48915328273145"
let propagate_iss minutes_since_epoch =
match parse_tle_string tle_string with
| Error e -> Error e
| Ok tle -> (
match init tle with
| Error e -> Error e
| Ok state -> propagate state tle minutes_since_epoch)
Testing#
- Vallado test suite: 33 satellites from Vallado et al. (2006), verified against python-sgp4
tcppver.out - GMAT interop: High-fidelity reference ephemeris from NASA GMAT R2026a (20x20 gravity, MSISE90 drag, SRP, lunisolar). Validates OEM parsing and physical bounds. See
test/interop/gmat/.
Reference#
- Hoots & Roehrich, "Spacetrack Report No. 3", 1980
- Vallado's improvements (2006)