1 #ifndef _PREDICT_DEFS_H_
2 #define _PREDICT_DEFS_H_
3 
4 #include <float.h>
5 
6 /** \name Geosynchronous orbit definitions
7  *  Requirements for an orbit to be called geosynchronous.
8  */
9 ///@{
10 ///lower mean motion for geosynchronous satellites
11 #define GEOSYNCHRONOUS_LOWER_MEAN_MOTION 0.9
12 ///upper mean motion for geosynchronous satellites
13 #define GEOSYNCHRONOUS_UPPER_MEAN_MOTION 1.1
14 ///upper eccentricity for geosynchronous satellites
15 #define GEOSYNCHRONOUS_ECCENTRICITY_THRESHOLD 0.2
16 ///upper inclination for geosynchronous satellites
17 #define GEOSYNCHRONOUS_INCLINATION_THRESHOLD_DEGREES 70
18 ///@}
19 
20 /** \name Mathematical constants
21  *  Mathematical convenience constants used by sgp4/sdp4 and related routines.
22  */
23 ///@{
24 /// pi
25 #define PI		3.14159265358979323846
26 /// pi/2
27 #define PI_HALF 	1.57079632679489656
28 /// 2*pi
29 #define TWO_PI          6.28318530717958623
30 /// 3*pi/2
31 #define THREE_PI_HALF	4.71238898038468967
32 /// 2/3
33 #define TWO_THIRD	6.6666666666666666E-1
34 ///@}
35 
36 /** \name Time constants
37  *  Constants used for time conversions.
38  */
39 ///@{
40 ///Number of minutes per day, XMNPDA in spacetrack report #3
41 #define MINUTES_PER_DAY	1.44E3
42 ///Number of seconds per day
43 #define SECONDS_PER_DAY	8.6400E4
44 ///Difference between libpredict's predict_julian_date_t and the julian time format used in some of the internal functions
45 #define JULIAN_TIME_DIFF 2444238.5
46 ///@}
47 
48 /** \name Physical properties
49  *  General physical properties and definitions.
50  */
51 ///@{
52 ///J3 Harmonic (WGS '72), XJ3 in spacetrack report #3
53 #define J3_HARMONIC_WGS72 			-2.53881E-6
54 ///WGS 84 Earth radius km, XKMPER in spacetrack report #3
55 #define EARTH_RADIUS_KM_WGS84			6.378137E3
56 ///Flattening factor
57 #define FLATTENING_FACTOR 			3.35281066474748E-3
58 ///Earth rotations per siderial day
59 #define EARTH_ROTATIONS_PER_SIDERIAL_DAY	1.00273790934
60 ///Solar radius in kilometers (IAU 76)
61 #define SOLAR_RADIUS_KM 			6.96000E5
62 ///Astronomical unit in kilometers (IAU 76)
63 #define ASTRONOMICAL_UNIT_KM 			1.49597870691E8
64 ///Upper elevation threshold for nautical twilight
65 #define NAUTICAL_TWILIGHT_SUN_ELEVATION 	-12.0
66 ///Speed of light in vacuum
67 #define SPEED_OF_LIGHT				299792458.0
68 ///Angular velocity of Earth in radians per seconds
69 #define EARTH_ANGULAR_VELOCITY			7.292115E-5
70 ///@}
71 
72 /** \name Iteration constants
73  *  Constants used in iteration functions like predict_max_elevation(),
74  *  predict_next_aos() and predict_next_los().
75  */
76 ///@{
77 ///Threshold used for fine-tuning of AOS/LOS
78 #define AOSLOS_HORIZON_THRESHOLD 	0.3
79 ///Threshold used for comparing lower and upper brackets in find_max_elevation
80 #define MAXELE_TIME_EQUALITY_THRESHOLD 	FLT_EPSILON
81 ///Maximum number of iterations in find_max_elevation
82 #define MAXELE_MAX_NUM_ITERATIONS 	10000
83 ///@}
84 
85 /** \name General spacetrack report #3 constants
86  *  These constants are also used outside of SGP4/SDP4 code.  The
87  *  constants/symbols are defined on page 76 to page 78 in the report.
88  */
89 ///@{
90 ///k_e = sqrt(Newton's universal gravitational * mass of the Earth), in units (earth radii per minutes)^3/2
91 #define XKE		7.43669161E-2
92 ///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.
93 #define CK2		5.413079E-4
94 ///@}
95 
96 /** \name Specific spacetrack report #3 constants
97  *  These constants are only used by SGP4/SDP4 code.  The constants/symbols are
98  *  defined on page 76 to page 78 in the report.
99  */
100 ///@{
101 ///Shorthand for 10^-6.
102 #define E6A		1.0E-6
103 ///Distance units / Earth radii.
104 #define AE		1.0
105 ///Corresponds to -3/8 * J_4 * a_E^4, where J_4 is the fourth gravitational zonal harmonic of Earth.
106 #define CK4		6.209887E-7
107 ///Parameter for SGP4/SGP8 density function.
108 #define S_DENSITY_PARAM	1.012229
109 ///Corresponds to (q_0 - s)^4 in units (earth radii)^4, where q_0 and s are parameters for the SGP4/SGP8 density function.
110 #define QOMS2T		1.880279E-09
111 ///@}
112 
113 /** \name Constants in deep space subroutines
114  *  Not defined in spacetrack report #3.
115  *
116  *  The constants might originally be defined in Hujsak (1979) and/or Hujsak
117  *  and Hoots (1977), but this is unavailable on the Internet. Reiterated in F.
118  *  R.  Hoots, P. W. Schumacher and R. A. Glober, "A HISTORY OF ANALYTICAL
119  *  ORBIT MODELING IN THE UNITED STATES SPACE SURVEILLANCE SYSTEM", 2004. Page
120  *  numbers below refer to this article.
121  */
122 ///@{
123 ///Solar mean motion (n_s in units radians/minute, p. 29)
124 #define ZNS		1.19459E-5
125 ///Solar perturbation coefficient (C_s in units radians/minute, p. 29)
126 #define C1SS		2.9864797E-6
127 ///Solar eccentricity (e_s, p. 29)
128 #define ZES		1.675E-2
129 ///Lunar mean motion (n_m in units radians/minute, p. 29)
130 #define ZNL		1.5835218E-4
131 ///Lunar perturbation coefficient (C_m in units radians/minute, p. 29)
132 #define C1L		4.7968065E-7
133 ///Lunar eccentricity (e_m, p. 29)
134 #define ZEL		5.490E-2
135 ///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)
136 #define ZCOSIS		9.1744867E-1
137 ///Sine of the solar inclination (sin(I_s), I_s on p. 29. See comment above)
138 #define ZSINIS		3.9785416E-1
139 ///Corresponds to sin(\omega_s) (\omega_s defined on p. 29, no description. See comment above)
140 #define ZSINGS		-9.8088458E-1
141 ///Corresponds to cos(\omega_s) (\omega_s defined on p. 29, no description. See comment above)
142 #define ZCOSGS		1.945905E-1
143 ///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)
144 #define Q22		1.7891679E-6
145 ///See above
146 #define Q31		2.1460748E-6
147 ///See above
148 #define Q33		2.2123015E-7
149 ///Constants for secular update for resonance effects of Earth gravity (G_22, G_32, G_44, G_52 and G_54, p. 36)
150 #define G22		5.7686396
151 ///See above
152 #define G32		9.5240898E-1
153 ///See above
154 #define G44		1.8014998
155 ///See above
156 #define G52		1.0508330
157 ///See above
158 #define G54		4.4108898
159 ///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)
160 #define ROOT22		1.7891679E-6
161 ///See above
162 #define ROOT32		3.7393792E-7
163 ///See above
164 #define ROOT44		7.3636953E-9
165 ///See above
166 #define ROOT52		1.1428639E-7
167 ///See above
168 #define ROOT54		2.1765803E-9
169 ///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)
170 #define THDT           4.3752691E-3
171 ///@}
172 
173 #endif
174