kepler#
Two-body Keplerian orbit propagation.
Propagate satellite positions using two-body dynamics. Includes both RK4 numerical integration and analytic Kepler propagation (10-15x faster for elliptical orbits). The analytic solver converts state vectors to orbital elements, advances mean anomaly, and solves Kepler's equation via Newton-Raphson.
Installation#
Install with opam:
$ opam install kepler
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 kepler
Usage#
let propagate pos vel =
(* Analytic propagation with precomputed elements (fast path) *)
let elems = Kepler.Analytic.precompute ~pos ~vel in
let new_pos = Kepler.Analytic.at_precomputed elems ~dt:3600. in
Printf.printf "Period: %.1f s\n" (Kepler.Analytic.period elems);
(* Generate an orbit arc for visualization *)
let arc =
Kepler.Analytic.arc ~pos ~vel ~duration_s:5400. ~num_points:360
in
(new_pos, arc)
API Overview#
Analytic#
precompute-- Convert state vector to orbital elements (call once)at_precomputed-- Propagate from precomputed elements (~20 FLOPs)at-- One-shot propagation (analytic for e<1, RK4 fallback)arc-- Generate position array over a time spanperiod,eccentricity-- Query orbital elementssolve_kepler-- Solve Kepler's equation M = E - e*sin(E)
Propagate#
at-- RK4 numerical propagationarc-- RK4 orbit arc generation
License#
ISC