Debian Codegraph @

extension/SGP4.h

raw symbols SCIP
1 #ifndef _SGP4h_
2 #define _SGP4h_
3 /* ----------------------------------------------------------------
4 *
5 * SGP4.h
6 *
7 * this file contains the sgp4 procedures for analytical propagation
8 * of a satellite. the code was originally released in the 1980 and 1986
9 * spacetrack papers. a detailed discussion of the theory and history
10 * may be found in the 2006 aiaa paper by vallado, crawford, hujsak,
11 * and kelso.
12 *
13 * current :
14 * 12 mar 20 david vallado
15 * chg satnum to string for alpha 5 or 9-digit
16 * changes :
17 * 7 dec 15 david vallado
18 * fix jd, jdfrac
19 * 3 nov 14 david vallado
20 * update to msvs2013 c++
21 * 30 Dec 11 david vallado
22 * consolidate updated code version
23 * 30 Aug 10 david vallado
24 * delete unused variables in initl
25 * replace pow inetger 2, 3 with multiplies for speed
26 * 3 Nov 08 david vallado
27 * put returns in for error codes
28 * 29 sep 08 david vallado
29 * fix atime for faster operation in dspace
30 * add operationmode for afspc (a) or improved (i)
31 * performance mode
32 * 20 apr 07 david vallado
33 * misc fixes for constants
34 * 11 aug 06 david vallado
35 * chg lyddane choice back to strn3, constants, misc doc
36 * 15 dec 05 david vallado
37 * misc fixes
38 * 26 jul 05 david vallado
39 * fixes for paper
40 * note that each fix is preceded by a
41 * comment with "sgp4fix" and an explanation of
42 * what was changed
43 * 10 aug 04 david vallado
44 * 2nd printing baseline working
45 * 14 may 01 david vallado
46 * 2nd edition baseline
47 * 80 norad
48 * original baseline
49 * ---------------------------------------------------------------- */
50
51 #pragma once
52
53 #include <math.h>
54 #include <stdio.h>
55 #include <string.h>
56 #include <iostream>
57
58 #define SGP4Version "SGP4 Version 2020-07-13"
59
60 // -------------------------- structure declarations ----------------------------
61 typedef enum
62 {
63 wgs72old,
64 wgs72,
65 wgs84
66 } gravconsttype;
67
68 typedef struct elsetrec
69 {
70 char satnum[6];
71 int epochyr, epochtynumrev;
72 int error;
73 char operationmode;
74 char init, method;
75
76 /* Near Earth */
77 int isimp;
78 double aycof , con41 , cc1 , cc4 , cc5 , d2 , d3 , d4 ,
79 delmo , eta , argpdot, omgcof , sinmao , t , t2cof, t3cof ,
80 t4cof , t5cof , x1mth2 , x7thm1 , mdot , nodedot, xlcof , xmcof ,
81 nodecf;
82
83 /* Deep Space */
84 int irez;
85 double d2201 , d2211 , d3210 , d3222 , d4410 , d4422 , d5220 , d5232 ,
86 d5421 , d5433 , dedt , del1 , del2 , del3 , didt , dmdt ,
87 dnodt , domdt , e3 , ee2 , peo , pgho , pho , pinco ,
88 plo , se2 , se3 , sgh2 , sgh3 , sgh4 , sh2 , sh3 ,
89 si2 , si3 , sl2 , sl3 , sl4 , gsto , xfact , xgh2 ,
90 xgh3 , xgh4 , xh2 , xh3 , xi2 , xi3 , xl2 , xl3 ,
91 xl4 , xlamo , zmol , zmos , atime , xli , xni;
92
93 double a, altp, alta, epochdays, jdsatepoch, jdsatepochF, nddot, ndot,
94 bstar, rcse, inclo, nodeo, ecco, argpo, mo, no_kozai;
95 // sgp4fix add new variables from tle
96 char classification, intldesg[11];
97 int ephtype;
98 long elnum , revnum;
99 // sgp4fix add unkozai'd variable
100 double no_unkozai;
101 // sgp4fix add singly averaged variables
102 double am , em , im , Om , om , mm , nm;
103 // sgp4fix add constant parameters to eliminate mutliple calls during execution
104 double tumin, mus, radiusearthkm, xke, j2, j3, j4, j3oj2;
105
106 // Additional elements to capture relevant TLE and object information:
107 long dia_mm; // RSO dia in mm
108 double period_sec; // Period in seconds
109 unsigned char active; // "Active S/C" flag (0=n, 1=y)
110 unsigned char not_orbital; // "Orbiting S/C" flag (0=n, 1=y)
111 double rcs_m2; // "RCS (m^2)" storage
112
113 } elsetrec;
114
115
116 namespace SGP4Funcs
117 {
118
119 // public class SGP4Class
120 // {
121
122 bool sgp4init
123 (
124 gravconsttype whichconst, char opsmode, const char satn[9], const double epoch,
125 const double xbstar, const double xndot, const double xnddot, const double xecco, const double xargpo,
126 const double xinclo, const double xmo, const double xno,
127 const double xnodeo, elsetrec& satrec
128 );
129
130 bool sgp4
131 (
132 // no longer need gravconsttype whichconst, all data contained in satrec
133 elsetrec& satrec, double tsince,
134 double r[3], double v[3]
135 );
136
137 void getgravconst
138 (
139 gravconsttype whichconst,
140 double& tumin,
141 double& mus,
142 double& radiusearthkm,
143 double& xke,
144 double& j2,
145 double& j3,
146 double& j4,
147 double& j3oj2
148 );
149
150 // older sgp4io methods
151 void twoline2rv
152 (
153 char longstr1[130], char longstr2[130],
154 char typerun, char typeinput, char opsmode,
155 gravconsttype whichconst,
156 double& startmfe, double& stopmfe, double& deltamin,
157 elsetrec& satrec
158 );
159
160 // older sgp4ext methods
161 double gstime_SGP4
162 (
163 double jdut1
164 );
165
166 double sgn_SGP4
167 (
168 double x
169 );
170
171 double mag_SGP4
172 (
173 double x[3]
174 );
175
176 void cross_SGP4
177 (
178 double vec1[3], double vec2[3], double outvec[3]
179 );
180
181 double dot_SGP4
182 (
183 double x[3], double y[3]
184 );
185
186 double angle_SGP4
187 (
188 double vec1[3],
189 double vec2[3]
190 );
191
192 void newtonnu_SGP4
193 (
194 double ecc, double nu,
195 double& e0, double& m
196 );
197
198 double asinh_SGP4
199 (
200 double xval
201 );
202
203 void rv2coe_SGP4
204 (
205 double r[3], double v[3], double mus,
206 double& p, double& a, double& ecc, double& incl, double& omega, double& argp,
207 double& nu, double& m, double& arglat, double& truelon, double& lonper
208 );
209
210 void jday_SGP4
211 (
212 int year, int mon, int day, int hr, int minute, double sec,
213 double& jd, double& jdFrac
214 );
215
216 void days2mdhms_SGP4
217 (
218 int year, double days,
219 int& mon, int& day, int& hr, int& minute, double& sec
220 );
221
222 void invjday_SGP4
223 (
224 double jd, double jdFrac,
225 int& year, int& mon, int& day,
226 int& hr, int& minute, double& sec
227 );
228
229
230 } // namespace
231
232 #endif