Two-body Keplerian orbit propagation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

OCaml 93.6%
Dune 1.5%
Other 5.0%
31 1 0

Clone this repository

https://tangled.org/gazagnaire.org/ocaml-kepler https://tangled.org/did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-kepler
git@git.recoil.org:gazagnaire.org/ocaml-kepler git@git.recoil.org:did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-kepler

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

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 span
  • period, eccentricity -- Query orbital elements
  • solve_kepler -- Solve Kepler's equation M = E - e*sin(E)

Propagate#

  • at -- RK4 numerical propagation
  • arc -- RK4 orbit arc generation

License#

ISC