sidereon_core/lib.rs
1//! # sidereon-core
2//!
3//! The complete Sidereon engine in one crate. It folds the numerical
4//! astrodynamics core (orbit propagation, force models, frames, time, SGP4)
5//! together with the GNSS domain layer (SP3, broadcast ephemeris, multi-GNSS
6//! positioning, RTK/PPP, ionosphere/troposphere, DOP).
7//!
8//! - The propagation/astro layer is always present under the [`astro`] module.
9//! - The GNSS layer lives behind the default-on `gnss` cargo feature, so a
10//! propagation-only consumer can build with `--no-default-features` (plus
11//! any astro features it wants) and never compile the IONEX/SP3 parsers.
12//!
13//! The GNSS façade is organized by user-facing tasks:
14//!
15//! - [`ephemeris`] - precise SP3 and broadcast ephemeris products,
16//! - [`rinex`] - RINEX navigation/observation parsing and CRINEX decoding,
17//! - [`antex`] - ANTEX receiver and satellite antenna calibration parsing,
18//! - [`combinations`] - observable linear combinations such as ionosphere-free,
19//! - [`observables`] - forward range, Doppler, and azimuth/elevation prediction,
20//! - [`velocity`] - receiver velocity and clock-drift solve from range-rate data,
21//! - [`positioning`] - single-point positioning and DOP diagnostics,
22//! - [`dgnss`] - code-differential pseudorange correction and rover pairing,
23//! - [`quality`] - pseudorange weighting, RAIM, and FDE integrity checks,
24//! - [`observation_qc`] - RINEX observation completeness and signal rollups,
25//! - [`signal`] - GPS C/A code generation, correlation, and acquisition,
26//! - [`ppp_corrections`] - static-arc PPP correction precomputation,
27//! - [`atmosphere`] - ionosphere and troposphere corrections,
28//! - [`orbit`] - compact reduced-orbit fitting/evaluation.
29//!
30//! Implementation modules (`sp3`, `rinex_nav`, `spp`, etc.) are crate-private.
31//! This is a clean public surface rather than a compatibility shim around the
32//! original implementation-shaped module layout.
33//!
34//! ## Units policy (internal representation)
35//!
36//! All quantities are stored and computed in **SI base units**, with the frame
37//! and datum encoded in the type name (per the spec's frames-in-the-type-system
38//! rule), never hidden behind a bare `position_m`:
39//!
40//! - **Length / position:** meters (`_m`). SP3 positions are ITRF/IGS-frame
41//! ECEF meters; SPP receiver positions are WGS84/ITRF-compatible ECEF meters.
42//! (The [`astro`] state layer works in kilometers; conversions happen
43//! explicitly at the boundary, never implicitly.)
44//! - **Time / clock:** seconds (`_s`). Epochs are represented by the [`astro`]
45//! time family (`Instant`/`TimeScale`), always scale-tagged; there is no bare
46//! ambiguous epoch.
47//! - **Velocity:** meters per second (`_m_s`).
48//! - **Angles:** radians (`_rad`) internally. Degrees appear only at I/O edges
49//! and are named `_deg`.
50//! - **Frequency:** hertz (`_hz`).
51//!
52//! Field and parameter names carry the unit suffix so the unit is visible at
53//! every call site. Matrix/vector linear algebra uses `nalgebra`
54//! (`DMatrix`/`DVector`) per the spec.
55
56extern crate self as sidereon_core;
57
58// ---------------------------------------------------------------------------
59// Astro / propagation layer. Always present. The GNSS layer below depends on
60// it via `crate::astro::*`.
61// ---------------------------------------------------------------------------
62
63mod validate;
64
65#[cfg(all(test, sidereon_repo_tests))]
66mod test_parity;
67
68pub mod astro;
69pub(crate) mod format;
70
71// ---------------------------------------------------------------------------
72// GNSS domain layer. Behind the default-on `gnss` feature so a propagation-only
73// consumer can opt out. Additional product modules are added as each lands.
74// ---------------------------------------------------------------------------
75
76mod ambiguity; // shared RTK/PPP cycle-slip policy + wide-lane/narrow-lane prep
77mod antenna; // shared ANTEX PCV/PCO zenith/azimuth interpolation kernels
78pub mod antex; // ANTEX receiver/satellite antenna parser + PCO/PCV lookup
79pub mod araim; // advanced RAIM multi-hypothesis protection levels
80pub mod bias; // Bias-SINEX and DCB bias products
81mod broadcast; // broadcast-ephemeris (GPS LNAV / Galileo I/NAV) orbit + clock
82pub mod broadcast_comparison; // broadcast-vs-precise (SISRE orbit/clock) accuracy
83pub mod carrier_phase; // carrier-phase combinations, cycle-slip detection, Hatch smoothing
84pub mod clock_stability; // Allan-family receiver clock stability estimators
85pub mod constants; // shared physical/time constants (used by astro + gnss)
86pub mod constellation; // GNSS constellation identity catalog (CelesTrak/NAVCEN)
87mod crinex; // Hatanaka (CRINEX) observation-file decoder
88pub mod data; // sans-IO GNSS product filename and archive URL catalog
89pub mod dop; // dilution-of-precision geometry (GDOP/PDOP/HDOP/VDOP/TDOP)
90pub mod frequencies; // canonical GNSS carrier-frequency table
91mod glonass; // GLONASS PZ-90.11 state-vector RK4 propagation
92mod ionex; // Klobuchar broadcast model + IONEX ionospheric maps
93pub mod navigation; // navigation-message bit-level codecs (GPS LNAV)
94pub mod nmea; // NMEA 0183 sentence parsing, stream grouping, and GGA writing
95pub mod ntrip; // NTRIP client sans-I/O request, response, and stream handling
96pub mod observables; // forward GNSS observable prediction
97pub mod ppp_corrections; // static-arc PPP correction tables
98pub mod precise_positioning; // static multi-epoch PPP float solve
99mod reduced_orbit; // compact mean-element orbit approximation (fitted)
100mod rinex_clock; // RINEX clock satellite-bias parsing and interpolation
101mod rinex_common; // shared RINEX header concepts (time-system label mapping)
102mod rinex_nav; // RINEX 3 navigation-message parsing (GPS/Galileo broadcast)
103mod rinex_obs; // RINEX 3 observation parsing + single-frequency pseudoranges
104mod rinex_qc; // RINEX observation/navigation lint and mechanical repair
105pub mod rtcm; // RTCM 3 differential-GNSS stream decode/encode (MSM, station, ephemeris)
106pub mod rtk; // RTK double-difference construction
107pub mod sbas;
108pub mod signal; // GPS C/A code, coherent correlation, and acquisition
109pub mod source_localization; // ToA/TDOA source localization from arrival times
110mod sp3; // SP3-c / SP3-d parser + arbitrary-epoch interpolation
111mod spp; // single-point positioning (least-squares PVT)
112pub mod ssr; // SSR correction store and corrected broadcast ephemeris source
113pub mod staleness; // product-staleness graceful degradation for time-varying products
114mod tropo; // Saastamoinen zenith + Niell (NMF) mapping troposphere
115pub mod velocity; // receiver velocity / clock-drift least-squares solve
116
117mod error;
118pub mod frame;
119mod id;
120
121pub mod atmosphere;
122pub mod combinations;
123pub mod dgnss;
124pub mod ephemeris;
125pub mod estimation; // Phase-2 estimation substrate: named operation-order recipes
126pub mod geoid; // geoid undulation grid + bilinear interpolation (orthometric heights)
127pub mod geometry;
128pub mod ils; // integer least squares ambiguity-resolution kernels
129pub mod observation_qc; // RINEX observation completeness and signal rollups
130pub mod qc_obs {
131 //! RINEX observation quality-control rollups.
132 pub use crate::observation_qc::*;
133}
134pub mod orbit;
135pub mod positioning;
136pub mod prelude;
137pub mod quality; // measurement weighting, RAIM, and FDE integrity checks
138pub mod rinex;
139pub mod rtk_filter; // sequential RTK baseline filter - serializable state ABI (kernel migration)
140pub mod terrain;
141pub mod terrain_store;
142pub mod tides;
143pub mod tolerances;
144
145pub use crate::estimation::{
146 alpha_beta_apply_measurement, alpha_beta_filter_step, alpha_beta_predict,
147 alpha_beta_steady_state_gains, cfar_ca_false_alarm_probability, cfar_ca_multiplier_from_pfa,
148 cfar_ca_pfa_from_multiplier, cfar_ca_threshold, ewma_update, ewma_update_power_of_two,
149 kalman_cv_steady_state_gains, mad_spread, nis_expected_value, nis_gate_test,
150 nis_gate_threshold, nis_statistic, normalized_innovation, AlphaBetaGains, AlphaBetaState,
151 AlphaBetaStep, PrimitiveError, ScalarKalmanGains, MAD_GAUSSIAN_CONSISTENCY,
152};
153pub use error::{Error, Result};
154pub use frame::{
155 geodetic_to_itrf, itrf_to_geodetic, FrameValueError, ItrfPositionM, ItrfVelocityMS,
156 Wgs84Geodetic,
157};
158pub use geoid::{
159 egm96_undulations_deg, egm96_undulations_rad, ellipsoidal_height_m, geoid_undulation,
160 geoid_undulations_deg, geoid_undulations_rad, orthometric_height_m, GeoidError, GeoidGrid,
161};
162pub use id::{GnssSatelliteId, GnssSystem, SatelliteIdError};