- OCaml 98%
- Shell 2%
collision #
Probability of collision between two space objects, from a conjunction data message.
When a screening service predicts that two objects will pass close to each
other, it sends each operator a conjunction data message (CDM) with both
state vectors, their position covariances and the time of closest approach.
The operator then has to decide whether to manoeuvre, and the number that
drives that decision is the probability of collision (Pc). collision
computes it from a CDM parsed by the cdm library. The two objects are
reduced to one sphere, whose radius (the hard-body radius) encloses both,
and Pc is the probability that the relative position falls inside it.
collision implements the 2D method of Foster and Estes (1992), which the
NASA Conjunction Assessment Risk Analysis (CARA) programme uses. A
two-dimensional integral is enough because, at orbital speeds of several
km/s, the two objects cross each other's vicinity in a fraction of a
second: the relative motion is taken as a straight line and the position
uncertainty as constant during the encounter. Integrating the combined
Gaussian along the relative velocity then gives exactly one, and what
remains is the 2D Gaussian integrated over the hard-body disk in the plane
normal to that velocity. Chan's series expansion (2008) is a second method,
and Alfano's upper bound (2005) a third. The package also bands a result
into the CARA risk levels and refines the time of closest approach from
sampled ephemerides.
Install #
$ opam install collision
If opam cannot find the package, add the overlay repository first:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install collision
Usage #
The hard-body radius hbr is the radius, in kilometres, of the sphere that
encloses both objects; 0.015 is 15 m, typical for two small spacecraft in
low Earth orbit.
let report_pc (cdm : Cdm.t) =
(* Quick Pc from a CDM *)
let pc = Collision.pc ~hbr:0.015 cdm in
Fmt.pr "Pc = %e@." pc;
(* Step-by-step: project to conjunction plane, then compute *)
let enc = Collision.encounter_of_cdm ~hbr:0.015 cdm in
let pc_foster = Collision.pc_foster enc in
let pc_max = Collision.pc_max enc in
Fmt.pr "Foster Pc: %e, Max Pc bound: %e@." pc_foster pc_max
Collision.assess returns the Foster Pc, the Alfano bound, the miss distance
in metres and the relative velocity in km/s in one record, and
Collision.risk_level bands its Pc as Critical (above 1e-4), High (above
1e-5), Watch (above 1e-7) or Low.
API #
Collision.encounter_of_cdmprojects the two objects onto the conjunction plane, normal to their relative velocity, and sums their covariances there.Collision.pc_fosterintegrates the combined Gaussian over the hard-body disk by Gauss-Legendre quadrature (64 points by default).Collision.pc_chancomputes the same probability by Chan's series expansion.Collision.pc_maxis the Alfano bound,hbr^2 / (2 * sigma_x * sigma_y).Collision.pcispc_fosteron the projected encounter.Collision.assessandCollision.risk_levelsummarise a CDM.Collision.tcafinds the time of closest approach in two synchronised ephemerides and refines it with a quadratic fit.
Testing #
The unit tests check the Pc methods at zero and at large miss distances, under symmetry, against the Alfano bound, and against each other (Foster and Chan). Two further checks use external data:
- The TraCSS conjunction assessment verification
dataset
publishes a Pc for each of its conjunctions, in two sets that differ in how
conjunctions were screened: one with a constant spherical screening volume and
a default hard-body radius, and one with the rectangular screening volumes of
the Space Flight Safety Handbook (SFSH) and a hard-body radius per object. The
test samples every 500th CDM of both sets and requires at least half of the
sampled Pc values to fall within one order of magnitude of the published one.
The dataset is not shipped with the package; the test reads it from
tracss-ca/in the working directory and passes without checking anything when it is absent. - A two-satellite scenario from NASA GMAT
R2026a, with
the OEM ephemerides it produced committed under
test/interop/gmat/, checks the miss distance and relative velocity.REGEN=1 dune build @tracesregenerates them with a local GMAT.
License #
ISC. See LICENSE.md.