predict_rs/
consts.rs

1use core::f64::consts::PI;
2
3// Geosynchronous orbit definitions
4// Requirements for an orbit to be called geosynchronous.
5
6/// lower mean motion for geosynchronous satellites
7pub const GEOSYNCHRONOUS_LOWER_MEAN_MOTION: f64 = 0.9;
8/// upper mean motion for geosynchronous satellites
9pub const GEOSYNCHRONOUS_UPPER_MEAN_MOTION: f64 = 1.1;
10/// upper eccentricity for geosynchronous satellites
11pub const GEOSYNCHRONOUS_ECCENTRICITY_THRESHOLD: f64 = 0.2;
12/// upper inclination for geosynchronous satellites
13pub const GEOSYNCHRONOUS_INCLINATION_THRESHOLD_DEGREES: f64 = 70.0;
14
15// Mathematical pub constants
16// Mathematical convenience pub constants used by sgp4/sdp4 and related routines.
17
18/// Half of three times PI
19pub const THREE_PI_HALF: f64 = (3.0 * PI) / 2.0;
20/// two thirds
21pub const TWO_THIRD: f64 = 6.666_666_666_666_666E-1;
22/// Degrees to Radians conversion factor
23pub const DEG_TO_RAD: f64 = PI / 180.0;
24/// Radians to Degrees conversion factor
25pub const RAD_TO_DEG: f64 = 180.0 / PI;
26
27// Time pub constants
28// Constants used for time conversions.
29
30/// Number of minutes per day, XMNPDA in spacetrack report #3
31pub const MINUTES_PER_DAY: f64 = 1.44E3;
32/// Number of seconds per day
33pub const SECONDS_PER_DAY: f64 = 8.6400E4;
34/// Difference between libpredict's `predict_julian_date_t` and the julian time format used in some of the internal functions
35pub const JULIAN_TIME_DIFF: f64 = 2_444_238.5;
36
37// Physical properties
38// General physical properties and definitions.
39
40/// J3 Harmonic (WGS '72), XJ3 in spacetrack report #3
41pub const J3_HARMONIC_WGS72: f64 = -2.53881E-6;
42/// WGS 84 Earth radius km, XKMPER in spacetrack report #3
43pub const EARTH_RADIUS_KM_WGS84: f64 = 6.378_137E3;
44/// Flattening factor
45pub const FLATTENING_FACTOR: f64 = 3.352_810_664_747_48E-3;
46/// Earth rotations per siderial day
47pub const EARTH_ROTATIONS_PER_SIDERIAL_DAY: f64 = 1.002_737_909_34;
48/// Solar radius in kilometers (IAU 76)
49pub const SOLAR_RADIUS_KM: f64 = 6.960_00E5;
50/// Astronomical unit in kilometers (IAU 76)
51pub const ASTRONOMICAL_UNIT_KM: f64 = 1.495_978_706_91E8;
52/// Upper elevation threshold for nautical twilight
53pub const NAUTICAL_TWILIGHT_SUN_ELEVATION: f64 = -12.0;
54/// Speed of light in vacuum
55pub const SPEED_OF_LIGHT: f64 = 299_792_458.0;
56/// Angular velocity of Earth in radians per seconds
57pub const EARTH_ANGULAR_VELOCITY: f64 = 7.292_115E-5;
58
59// \name Iteration pub constants
60//  Constants used in iteration functions like predict_max_elevation(),
61//  predict_next_aos() and predict_next_los().
62
63pub const FLT_EPSILON: f64 = 1.192_092_90E-07; // decimal constant
64
65/// Threshold used for comparing lower and upper brackets in `find_max_elevation`
66pub const MAXELE_TIME_EQUALITY_THRESHOLD: f64 = FLT_EPSILON;
67/// Maximum number of iterations in `find_max_elevation`
68pub const MAXELE_MAX_NUM_ITERATIONS: f64 = 10_000.0;
69
70// \name General spacetrack report #3 pub constants
71//  These pub constants are also used outside of SGP4/SDP4 code.  The
72//  pub constants/symbols are defined on page 76 to page 78 in the report.
73
74/// `k_e = sqrt(Newton's universal gravitational * mass of the Earth)`, in units (earth radii per minutes)^3/2
75pub const XKE: f64 = 7.436_691_61E-2;
76/// Corresponds to `1/2 * J_2 * a_E^2`. `J_2` is the second gravitational zonal harmonic of Earth, `a_E` is the equatorial radius of Earth.
77pub const CK2: f64 = 5.413_079E-4;
78
79// \name Specific spacetrack report #3 pub constants
80//  These pub constants are only used by SGP4/SDP4 code.  The constants/symbols are
81//  defined on page 76 to page 78 in the report.
82
83/// Shorthand for 10^-6.
84pub const E6A: f64 = 1.0E-6;
85/// Distance units / Earth radii.
86pub const AE: f64 = 1.0;
87/// Corresponds to `-3/8 * J_4 * a_E^4`, where `J_4` is the fourth gravitational zonal harmonic of Earth.
88pub const CK4: f64 = 6.209_887E-7;
89/// Parameter for SGP4/SGP8 density function.
90pub const S_DENSITY_PARAM: f64 = 1.012_229;
91/// Corresponds to `(q_0 - s)^4` in units (earth radii)^4, where `q_0` and s are parameters for the SGP4/SGP8 density function.
92pub const QOMS2T: f64 = 1.880_279E-09;
93
94// Constants in deep space subroutines
95// Not defined in spacetrack report #3.
96//
97// The pub constants might originally be defined in Hujsak (1979) and/or Hujsak
98// and Hoots (1977), but this is unavailable on the Internet. Reiterated in F.
99// R.  Hoots, P. W. Schumacher and R. A. Glober, "A HISTORY OF ANALYTICAL
100// ORBIT MODELING IN THE UNITED STATES SPACE SURVEILLANCE SYSTEM", 2004. Page
101// numbers below refer to this article.
102
103/// Solar mean motion `(n_s in units radians/minute, p. 29)`
104pub const ZNS: f64 = 1.194_59E-5;
105/// Solar perturbation coefficient `(C_s in units radians/minute, p. 29)`
106pub const C1SS: f64 = 2.986_479_7E-6;
107/// Solar eccentricity `(e_s, p. 29)`
108pub const ZES: f64 = 1.675E-2;
109/// Lunar mean motion `(n_m in units radians/minute, p. 29)`
110pub const ZNL: f64 = 1.583_521_8E-4;
111/// Lunar perturbation coefficient `(C_m in units radians/minute, p. 29)`
112pub const C1L: f64 = 4.796_806_5E-7;
113/// Lunar eccentricity `(e_m, p. 29)`
114pub const ZEL: f64 = 5.490E-2;
115/// Cosine of the solar inclination `(not defined directly in the paper, but corresponds with cos(I_s) with I_s as the solar inclination on p. 29)`
116pub const ZCOSIS: f64 = 9.174_486_7E-1;
117/// Sine of the solar inclination `(sin(I_s)`, `I_s on p. 29. See comment above)`
118pub const ZSINIS: f64 = 3.978_541_6E-1;
119/// Corresponds to `sin(omega_s)` `(omega_s defined on p. 29, no description. See comment above)`
120pub const ZSINGS: f64 = -9.808_845_8E-1;
121/// Corresponds to `cos(omega_s)` `(omega_s defined on p. 29, no description. See comment above)`
122pub const ZCOSGS: f64 = 1.945_905E-1;
123/// Constants for one-day resonance conditions, satellite-independent for 1-day period satellites `(Initialization of resonance effects of Earth gravity, Q_22, Q_31 and Q_33, p. 31)`
124pub const Q22: f64 = 1.789_167_9E-6;
125/// See above
126pub const Q31: f64 = 2.146_074_8E-6;
127/// See above
128pub const Q33: f64 = 2.212_301_5E-7;
129/// Constants for secular update for resonance effects of Earth gravity `(G_22, G_32, G_44, G_52 and G_54, p. 36)`
130pub const G22: f64 = 5.768_639_6;
131/// See above
132pub const G32: f64 = 9.524_089_8E-1;
133/// See above
134pub const G44: f64 = 1.801_499_8;
135/// See above
136pub const G52: f64 = 1.050_833_0;
137/// See above
138pub const G54: f64 = 4.410_889_8;
139/// Constants for 1/2-day resonance conditions, satellite-independent for 1/2-day period satellites (Initialization for resonance effects of Earth gravity, `sqrt(C_ij^2 + S_ij^2)` where ij = 22, 32, 44, 52 and 54, p. 32)
140pub const ROOT22: f64 = 1.789_167_9E-6;
141/// See above
142pub const ROOT32: f64 = 3.739_379_2E-7;
143/// See above
144pub const ROOT44: f64 = 7.363_695_3E-9;
145/// See above
146pub const ROOT52: f64 = 1.142_863_9E-7;
147/// See above
148pub const ROOT54: f64 = 2.176_580_3E-9;
149/// The time-derivative of the Greenwich hour angle in radians per minute (\dot{\theta}, used on p. 36. Not directly defined in report, but values and naming are consistent with this)
150pub const THDT: f64 = 4.375_269_1E-3;