1 #ifndef _sgp4unit_ 2 #define _sgp4unit_ 3 /* ---------------------------------------------------------------- 4 * 5 * sgp4unit.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 * companion code for 14 * fundamentals of astrodynamics and applications 15 * 2007 16 * by david vallado 17 * 18 * (w) 719-573-2600, email dvallado@agi.com 19 * 20 * current : 21 * 3 Nov 08 david vallado 22 * put returns in for error codes 23 * changes : 24 * 29 sep 08 david vallado 25 * fix atime for faster operation in dspace 26 * add operationmode for afspc (a) or improved (i) 27 * performance mode 28 * 20 apr 07 david vallado 29 * misc fixes for constants 30 * 11 aug 06 david vallado 31 * chg lyddane choice back to strn3, constants, misc doc 32 * 15 dec 05 david vallado 33 * misc fixes 34 * 26 jul 05 david vallado 35 * fixes for paper 36 * note that each fix is preceded by a 37 * comment with "sgp4fix" and an explanation of 38 * what was changed 39 * 10 aug 04 david vallado 40 * 2nd printing baseline working 41 * 14 may 01 david vallado 42 * 2nd edition baseline 43 * 80 norad 44 * original baseline 45 * ---------------------------------------------------------------- */ 46 47 #include <cmath> 48 #include <cstdio> 49 #define SGP4Version "SGP4 Version 2008-11-03" 50 51 #ifndef M_PI 52 #define M_PI 3.14159265358979323846 53 #endif 54 55 // -------------------------- structure declarations ---------------------------- 56 typedef enum 57 { 58 wgs72old, 59 wgs72, 60 wgs84 61 } gravconsttype; 62 63 typedef struct elsetrec 64 { 65 long int satnum; 66 int epochyr, epochtynumrev; 67 int error; 68 char operationmode; 69 char init, method; 70 71 /* Near Earth */ 72 int isimp; 73 double aycof , con41 , cc1 , cc4 , cc5 , d2 , d3 , d4 , 74 delmo , eta , argpdot, omgcof , sinmao , t , t2cof, t3cof , 75 t4cof , t5cof , x1mth2 , x7thm1 , mdot , nodedot, xlcof , xmcof , 76 nodecf; 77 78 /* Deep Space */ 79 int irez; 80 double d2201 , d2211 , d3210 , d3222 , d4410 , d4422 , d5220 , d5232 , 81 d5421 , d5433 , dedt , del1 , del2 , del3 , didt , dmdt , 82 dnodt , domdt , e3 , ee2 , peo , pgho , pho , pinco , 83 plo , se2 , se3 , sgh2 , sgh3 , sgh4 , sh2 , sh3 , 84 si2 , si3 , sl2 , sl3 , sl4 , gsto , xfact , xgh2 , 85 xgh3 , xgh4 , xh2 , xh3 , xi2 , xi3 , xl2 , xl3 , 86 xl4 , xlamo , zmol , zmos , atime , xli , xni; 87 88 double a , altp , alta , epochdays, jdsatepoch , nddot , ndot , 89 bstar , rcse , inclo , nodeo , ecco , argpo , mo , 90 no; 91 } elsetrec; 92 93 94 // --------------------------- function declarations ---------------------------- 95 bool sgp4init 96 ( 97 gravconsttype whichconst, char opsmode, const int satn, const double epoch, 98 const double xbstar, const double xecco, const double xargpo, 99 const double xinclo, const double xmo, const double xno, 100 const double xnodeo, elsetrec& satrec 101 ); 102 103 bool sgp4 104 ( 105 gravconsttype whichconst, elsetrec& satrec, double tsince, 106 double r[3], double v[3] 107 ); 108 109 double gstime 110 ( 111 double jdut1 112 ); 113 114 void getgravconst 115 ( 116 gravconsttype whichconst, 117 double& tumin, 118 double& mu, 119 double& radiusearthkm, 120 double& xke, 121 double& j2, 122 double& j3, 123 double& j4, 124 double& j3oj2 125 ); 126 127 #endif 128 129