Conjunction Data Message (CCSDS 508.0-B-1)
README.md

cdm #

Conjunction Data Messages (CCSDS 508.0-B-1) for OCaml.

When two objects in orbit are predicted to pass close to each other, a screening service such as Space-Track or TraCSS sends the satellite operators a Conjunction Data Message (CDM). It gives the time of closest approach (TCA), the miss distance, the state and covariance of both objects and, often, a probability of collision. cdm reads CDMs in the three formats operators receive: KVN (the CCSDS Keyword = Value Notation), JSON-ST (the Space-Track JSON format) and the CSV of the TraCSS conjunction assessment verification dataset. All three produce the same Cdm.t.

Installation #

Install with opam:

$ opam install cdm

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 cdm

Usage #

(* Parse CDMs from a TraCSS CSV file *)
let dump_csv path =
  match Cdm.Csv.of_file path with
  | Ok cdms ->
      List.iter (fun (cdm : Cdm.t) ->
        Printf.printf "TCA: %s  Pc: %e  miss: %.3f km\n"
          (Cdm.tca cdm) (Cdm.pc cdm) cdm.miss_distance)
        cdms
  | Error e -> Fmt.epr "%a\n" Cdm.pp_error e

(* Parse a single CDM from KVN format *)
let parse_kvn kvn_string = Cdm.Kvn.of_string kvn_string

API #

  • Cdm.t is one conjunction event: the two objects obj1 and obj2, the probability of collision, the miss_distance in km, the TCA as epoch, and the CCSDS header and relative metadata when the format carries them.
  • Cdm.object_data holds the data of one object: its state vector, its position covariance, and its metadata, orbit determination and physical parameters.
  • Cdm.state_vector is a J2000 position in km and velocity in km/s, and Cdm.covariance the upper triangle of the 3x3 position covariance in the RTN frame, in m^2. J2000 (also EME2000) is an Earth-centred inertial frame: its origin is the Earth's centre, its z axis the Earth's mean rotation axis and its x axis the mean vernal equinox, both as they were at noon on 1 January 2000, so the axes do not turn with the Earth. RTN is the frame that moves with the object: R points radially away from the Earth, N along the orbit's angular momentum, and T completes the triad, close to the direction of travel.
  • Cdm.Csv reads the TraCSS CSV (of_file, of_string, and fold_channel for a file too large to hold in memory).
  • Cdm.Json_st reads Space-Track JSON (of_string, of_single).
  • Cdm.Kvn reads CCSDS KVN (of_string).
  • Cdm.tca, Cdm.tca_ptime and Cdm.pc return the TCA and the probability of collision.

A CDM read from CSV carries no CCSDS header or metadata, so those fields are None.

Licence #

ISC. See LICENSE.md.