82 const double deg2rad =
pi / 180.0;
83 const double xpdotp = 1440.0 / (2.0 *
pi);
85 double sec, mu, radiusearthkm, tumin, xke, j2, j3, j4, j3oj2;
86 double startsec, stopsec, startdayofyr, stopdayofyr, jdstart, jdstop;
87 int startyear, stopyear, startmon, stopmon, startday, stopday, starthr, stophr, startmin,
89 int cardnumb, numb, j;
90 long revnum = 0, elnum = 0;
91 char classification, intldesg[11];
93 int mon, day, hr, minute, nexp, ibexp;
96 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
102 for (j = 10; j <= 15; j++)
103 if (longstr1[j] ==
' ')
106 if (longstr1[44] !=
' ')
107 longstr1[43] = longstr1[44];
109 if (longstr1[7] ==
' ')
111 if (longstr1[9] ==
' ')
113 for (j = 45; j <= 49; j++)
114 if (longstr1[j] ==
' ')
116 if (longstr1[51] ==
' ')
118 if (longstr1[53] !=
' ')
119 longstr1[52] = longstr1[53];
122 for (j = 26; j <= 32; j++)
123 if (longstr2[j] ==
' ')
125 if (longstr1[62] ==
' ')
127 if (longstr1[68] ==
' ')
131 "%2d %5ld %1c %10s %2d %12lf %11lf %7lf %2d %7lf %2d %2d %6ld ",
148 if (longstr2[52] ==
' ')
150 "%2d %5ld %9lf %9lf %8lf %9lf %9lf %10lf %6ld %lf %lf %lf \n",
165 "%2d %5ld %9lf %9lf %8lf %9lf %9lf %11lf %6ld %lf %lf %lf \n",
181 if (longstr2[52] ==
' ')
183 "%2d %5ld %9lf %9lf %8lf %9lf %9lf %10lf %6ld \n",
195 "%2d %5ld %9lf %9lf %8lf %9lf %9lf %11lf %6ld \n",
208 satrec.
no = satrec.
no / xpdotp;
209 satrec.
nddot = satrec.
nddot * pow(10.0, nexp);
210 satrec.
bstar = satrec.
bstar * pow(10.0, ibexp);
213 satrec.
a = pow(satrec.
no * tumin, (-2.0 / 3.0));
214 satrec.
ndot = satrec.
ndot / (xpdotp * 1440.0);
215 satrec.
nddot = satrec.
nddot / (xpdotp * 1440.0 * 1440);
221 satrec.
mo = satrec.
mo * deg2rad;
223 satrec.
alta = satrec.
a * (1.0 + satrec.
ecco) - 1.0;
224 satrec.
altp = satrec.
a * (1.0 - satrec.
ecco) - 1.0;
243 if ((typerun !=
'v') && (typerun !=
'c'))
246 if (typeinput ==
'e')
248 printf(
"input start prop year mon day hr min sec \n");
250 silence = scanf(
"%i %i %i %i %i %lf",
258 jday(startyear, startmon, startday, starthr, startmin, startsec, jdstart);
260 printf(
"input stop prop year mon day hr min sec \n");
261 silence = scanf(
"%i %i %i %i %i %lf",
269 jday(stopyear, stopmon, stopday, stophr, stopmin, stopsec, jdstop);
271 startmfe = (jdstart - satrec.
jdsatepoch) * 1440.0;
272 stopmfe = (jdstop - satrec.
jdsatepoch) * 1440.0;
274 printf(
"input time step in minutes \n");
275 silence = scanf(
"%lf", &deltamin);
278 if (typeinput ==
'd')
280 printf(
"input start year dayofyr \n");
281 silence = scanf(
"%i %lf", &startyear, &startdayofyr);
282 printf(
"input stop year dayofyr \n");
283 silence = scanf(
"%i %lf", &stopyear, &stopdayofyr);
285 days2mdhms(startyear, startdayofyr, mon, day, hr, minute, sec);
286 jday(startyear, mon, day, hr, minute, sec, jdstart);
287 days2mdhms(stopyear, stopdayofyr, mon, day, hr, minute, sec);
288 jday(stopyear, mon, day, hr, minute, sec, jdstop);
290 startmfe = (jdstart - satrec.
jdsatepoch) * 1440.0;
291 stopmfe = (jdstop - satrec.
jdsatepoch) * 1440.0;
293 printf(
"input time step in minutes \n");
294 silence = scanf(
"%lf", &deltamin);
297 if (typeinput ==
'm')
299 printf(
"input start min from epoch \n");
300 silence = scanf(
"%lf", &startmfe);
301 printf(
"input stop min from epoch \n");
302 silence = scanf(
"%lf", &stopmfe);
303 printf(
"input time step in minutes \n");
304 silence = scanf(
"%lf", &deltamin);
void days2mdhms(int year, double days, int &mon, int &day, int &hr, int &minute, double &sec)
void jday(int year, int mon, int day, int hr, int minute, double sec, double &jd)
void twoline2rv(char longstr1[130], char longstr2[130], char typerun, char typeinput, char opsmode, gravconsttype whichconst, double &startmfe, double &stopmfe, double &deltamin, elsetrec &satrec)
void getgravconst(gravconsttype whichconst, double &tumin, double &mu, double &radiusearthkm, double &xke, double &j2, double &j3, double &j4, double &j3oj2)
bool sgp4init(gravconsttype whichconst, char opsmode, const long int satn, const double epoch, const double xbstar, const double xecco, const double xargpo, const double xinclo, const double xmo, const double xno, const double xnodeo, elsetrec &satrec)