84 const double deg2rad =
pi / 180.0;
85 const double xpdotp = 1440.0 / (2.0 *
pi);
87 double sec, mu, radiusearthkm, tumin, xke, j2, j3, j4, j3oj2;
88 double startsec, stopsec, startdayofyr, stopdayofyr, jdstart, jdstop;
89 int startyear, stopyear, startmon, stopmon, startday, stopday, starthr, stophr, startmin,
91 int cardnumb, numb, j;
92 long revnum = 0, elnum = 0;
93 char classification, intldesg[11];
95 int mon, day, hr, minute, nexp, ibexp;
98 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
104 for (j = 10; j <= 15; j++)
105 if (longstr1[j] ==
' ')
108 if (longstr1[44] !=
' ')
109 longstr1[43] = longstr1[44];
111 if (longstr1[7] ==
' ')
113 if (longstr1[9] ==
' ')
115 for (j = 45; j <= 49; j++)
116 if (longstr1[j] ==
' ')
118 if (longstr1[51] ==
' ')
120 if (longstr1[53] !=
' ')
121 longstr1[52] = longstr1[53];
124 for (j = 26; j <= 32; j++)
125 if (longstr2[j] ==
' ')
127 if (longstr1[62] ==
' ')
129 if (longstr1[68] ==
' ')
133 "%2d %5ld %1c %10s %2d %12lf %11lf %7lf %2d %7lf %2d %2d %6ld ",
150 if (longstr2[52] ==
' ')
152 "%2d %5ld %9lf %9lf %8lf %9lf %9lf %10lf %6ld %lf %lf %lf \n",
167 "%2d %5ld %9lf %9lf %8lf %9lf %9lf %11lf %6ld %lf %lf %lf \n",
183 if (longstr2[52] ==
' ')
185 "%2d %5ld %9lf %9lf %8lf %9lf %9lf %10lf %6ld \n",
197 "%2d %5ld %9lf %9lf %8lf %9lf %9lf %11lf %6ld \n",
210 satrec.
no = satrec.
no / xpdotp;
211 satrec.
nddot = satrec.
nddot * pow(10.0, nexp);
212 satrec.
bstar = satrec.
bstar * pow(10.0, ibexp);
215 satrec.
a = pow(satrec.
no * tumin, (-2.0 / 3.0));
216 satrec.
ndot = satrec.
ndot / (xpdotp * 1440.0);
217 satrec.
nddot = satrec.
nddot / (xpdotp * 1440.0 * 1440);
223 satrec.
mo = satrec.
mo * deg2rad;
225 satrec.
alta = satrec.
a * (1.0 + satrec.
ecco) - 1.0;
226 satrec.
altp = satrec.
a * (1.0 - satrec.
ecco) - 1.0;
245 if ((typerun !=
'v') && (typerun !=
'c'))
248 if (typeinput ==
'e')
250 printf(
"input start prop year mon day hr min sec \n");
252 silence = scanf(
"%i %i %i %i %i %lf",
260 jday(startyear, startmon, startday, starthr, startmin, startsec, jdstart);
262 printf(
"input stop prop year mon day hr min sec \n");
263 silence = scanf(
"%i %i %i %i %i %lf",
271 jday(stopyear, stopmon, stopday, stophr, stopmin, stopsec, jdstop);
273 startmfe = (jdstart - satrec.
jdsatepoch) * 1440.0;
274 stopmfe = (jdstop - satrec.
jdsatepoch) * 1440.0;
276 printf(
"input time step in minutes \n");
277 silence = scanf(
"%lf", &deltamin);
280 if (typeinput ==
'd')
282 printf(
"input start year dayofyr \n");
283 silence = scanf(
"%i %lf", &startyear, &startdayofyr);
284 printf(
"input stop year dayofyr \n");
285 silence = scanf(
"%i %lf", &stopyear, &stopdayofyr);
287 days2mdhms(startyear, startdayofyr, mon, day, hr, minute, sec);
288 jday(startyear, mon, day, hr, minute, sec, jdstart);
289 days2mdhms(stopyear, stopdayofyr, mon, day, hr, minute, sec);
290 jday(stopyear, mon, day, hr, minute, sec, jdstop);
292 startmfe = (jdstart - satrec.
jdsatepoch) * 1440.0;
293 stopmfe = (jdstop - satrec.
jdsatepoch) * 1440.0;
295 printf(
"input time step in minutes \n");
296 silence = scanf(
"%lf", &deltamin);
299 if (typeinput ==
'm')
301 printf(
"input start min from epoch \n");
302 silence = scanf(
"%lf", &startmfe);
303 printf(
"input stop min from epoch \n");
304 silence = scanf(
"%lf", &stopmfe);
305 printf(
"input time step in minutes \n");
306 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)