sgp4/
propagator.rs

1use crate::model;
2use crate::third_body;
3
4/// Predicted satellite position and velocity after SGP4 propagation
5///
6/// The position and velocity are given in the True Equator, Mean Equinox (TEME) of epoch reference frame.
7#[derive(Debug, Clone)]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9pub struct Prediction {
10    /// The three position components (x, y, z) in km
11    pub position: [f64; 3],
12
13    /// The three velocity components (x, y, z) in km.s⁻¹
14    pub velocity: [f64; 3],
15}
16
17/// The Brouwer orbital elements
18#[derive(Debug, Clone)]
19#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
20pub struct Orbit {
21    /// Angle between the equator and the orbit plane in rad
22    pub inclination: f64,
23
24    /// Angle between vernal equinox and the point where the orbit crosses the equatorial plane in rad
25    pub right_ascension: f64,
26
27    /// Shape of the orbit
28    pub eccentricity: f64,
29
30    /// Angle between the ascending node and the orbit's point of closest approach to the earth in rad
31    pub argument_of_perigee: f64,
32
33    /// Angle of the satellite location measured from perigee in rad
34    pub mean_anomaly: f64,
35
36    /// Mean number of orbits per day in rad.min⁻¹
37    pub mean_motion: f64,
38}
39
40#[derive(Debug, Clone)]
41#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
42pub(crate) enum Elliptic {
43    No {},
44    Yes { k11: f64, k12: f64, k13: f64 },
45}
46
47#[derive(Debug, Clone)]
48#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
49pub(crate) enum HighAltitude {
50    No {},
51    Yes {
52        c5: f64,
53        d2: f64,
54        d3: f64,
55        d4: f64,
56        eta: f64,
57        k7: f64,
58        k8: f64,
59        k9: f64,
60        k10: f64,
61        elliptic: Elliptic,
62    },
63}
64
65#[derive(Debug, Clone)]
66#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
67pub(crate) enum Resonance {
68    OneDay {
69        dr1: f64,
70        dr2: f64,
71        dr3: f64,
72    },
73    HalfDay {
74        d2201: f64,
75        d2211: f64,
76        d3210: f64,
77        d3222: f64,
78        d4410: f64,
79        d4422: f64,
80        d5220: f64,
81        d5232: f64,
82        d5421: f64,
83        d5433: f64,
84        k14: f64,
85    },
86}
87
88#[derive(Debug, Clone)]
89#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
90pub(crate) enum Resonant {
91    No {
92        a0: f64,
93    },
94    Yes {
95        lambda_0: f64,
96        lambda_dot_0: f64,
97        sidereal_time_0: f64,
98        resonance: Resonance,
99    },
100}
101
102#[derive(Debug, Clone)]
103#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
104pub(crate) enum Method {
105    NearEarth {
106        a0: f64,
107        k2: f64,
108        k3: f64,
109        k4: f64,
110        k5: f64,
111        k6: f64,
112        high_altitude: HighAltitude,
113    },
114    DeepSpace {
115        eccentricity_dot: f64,
116        inclination_dot: f64,
117        solar_perturbations: third_body::Perturbations,
118        lunar_perturbations: third_body::Perturbations,
119        resonant: Resonant,
120    },
121}
122
123/// Propagator variables calculated from epoch quantities and used during propagation
124///
125/// Constants can be initialized from general perturbation elements.
126/// They are not mutated during propagation, which means they can
127/// be used by different threads in parallel
128/// (for example to generate predictions at different times).
129#[derive(Debug, Clone)]
130#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
131pub struct Constants {
132    pub(crate) geopotential: model::Geopotential,
133    pub(crate) right_ascension_dot: f64,
134    pub(crate) argument_of_perigee_dot: f64,
135    pub(crate) mean_anomaly_dot: f64,
136    pub(crate) c1: f64,
137    pub(crate) c4: f64,
138    pub(crate) k0: f64,
139    pub(crate) k1: f64,
140    pub(crate) method: Method,
141    pub(crate) orbit_0: Orbit,
142}