72 char longstr1[130],
char longstr2[130],
73 char typerun,
char typeinput,
char opsmode,
75 double& startmfe,
double& stopmfe,
double& deltamin,
80 const double xpdotp = 1440.0 / (2.0 *
M_PI);
82 double sec, mu, radiusearthkm, tumin, xke, j2, j3, j4, j3oj2;
83 double startsec, stopsec, startdayofyr, stopdayofyr, jdstart, jdstop;
84 int startyear, stopyear, startmon, stopmon, startday, stopday,
85 starthr, stophr, startmin, stopmin;
86 int cardnumb, numb, j;
87 long revnum = 0, elnum = 0;
88 char classification, intldesg[11];
90 int mon, day, hr, minute, nexp, ibexp;
92 getgravconst( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
98 for (j = 10; j <= 15; j++)
99 if (longstr1[j] ==
' ')
102 if (longstr1[44] !=
' ')
103 longstr1[43] = longstr1[44];
105 if (longstr1[7] ==
' ')
107 if (longstr1[9] ==
' ')
109 for (j = 45; j <= 49; j++)
110 if (longstr1[j] ==
' ')
112 if (longstr1[51] ==
' ')
114 if (longstr1[53] !=
' ')
115 longstr1[52] = longstr1[53];
118 for (j = 26; j <= 32; j++)
119 if (longstr2[j] ==
' ')
121 if (longstr1[62] ==
' ')
123 if (longstr1[68] ==
' ')
126 sscanf(longstr1,
"%2d %5ld %1c %10s %2d %12lf %11lf %7lf %2d %7lf %2d %2d %6ld ",
127 &cardnumb,&satrec.
satnum,&classification, intldesg, &satrec.
epochyr,
129 &ibexp, &numb, &elnum );
133 if (longstr2[52] ==
' ')
134 sscanf(longstr2,
"%2d %5ld %9lf %9lf %8lf %9lf %9lf %10lf %6ld %lf %lf %lf \n",
137 &revnum, &startmfe, &stopmfe, &deltamin );
139 sscanf(longstr2,
"%2d %5ld %9lf %9lf %8lf %9lf %9lf %11lf %6ld %lf %lf %lf \n",
142 &revnum, &startmfe, &stopmfe, &deltamin );
146 if (longstr2[52] ==
' ')
147 sscanf(longstr2,
"%2d %5ld %9lf %9lf %8lf %9lf %9lf %10lf %6ld \n",
152 sscanf(longstr2,
"%2d %5ld %9lf %9lf %8lf %9lf %9lf %11lf %6ld \n",
159 satrec.
no = satrec.
no / xpdotp;
161 satrec.
bstar= satrec.
bstar * pow(10.0, ibexp);
164 satrec.
a = pow( satrec.
no*tumin , (-2.0/3.0) );
165 satrec.
ndot = satrec.
ndot / (xpdotp*1440.0);
166 satrec.
nddot= satrec.
nddot / (xpdotp*1440.0*1440);
174 satrec.
alta = satrec.
a*(1.0 + satrec.
ecco) - 1.0;
175 satrec.
altp = satrec.
a*(1.0 - satrec.
ecco) - 1.0;
194 if ((typerun !=
'v') && (typerun !=
'c'))
197 if (typeinput ==
'e')
199 printf(
"input start prop year mon day hr min sec \n");
201 scanf(
"%i %i %i %i %i %lf",&startyear, &startmon, &startday, &starthr, &startmin, &startsec);
203 jday( startyear,startmon,startday,starthr,startmin,startsec, jdstart );
205 printf(
"input stop prop year mon day hr min sec \n");
206 scanf(
"%i %i %i %i %i %lf",&stopyear, &stopmon, &stopday, &stophr, &stopmin, &stopsec);
208 jday( stopyear,stopmon,stopday,stophr,stopmin,stopsec, jdstop );
210 startmfe = (jdstart - satrec.
jdsatepoch) * 1440.0;
211 stopmfe = (jdstop - satrec.
jdsatepoch) * 1440.0;
213 printf(
"input time step in minutes \n");
214 scanf(
"%lf",&deltamin );
217 if (typeinput ==
'd')
219 printf(
"input start year dayofyr \n");
220 scanf(
"%i %lf",&startyear, &startdayofyr );
221 printf(
"input stop year dayofyr \n");
222 scanf(
"%i %lf",&stopyear, &stopdayofyr );
224 days2mdhms ( startyear,startdayofyr, mon,day,hr,minute,sec );
225 jday( startyear,mon,day,hr,minute,sec, jdstart );
226 days2mdhms ( stopyear,stopdayofyr, mon,day,hr,minute,sec );
227 jday( stopyear,mon,day,hr,minute,sec, jdstop );
229 startmfe = (jdstart - satrec.
jdsatepoch) * 1440.0;
230 stopmfe = (jdstop - satrec.
jdsatepoch) * 1440.0;
232 printf(
"input time step in minutes \n");
233 scanf(
"%lf",&deltamin );
236 if (typeinput ==
'm')
238 printf(
"input start min from epoch \n");
239 scanf(
"%lf",&startmfe );
240 printf(
"input stop min from epoch \n");
241 scanf(
"%lf",&stopmfe );
242 printf(
"input time step in minutes \n");
243 scanf(
"%lf",&deltamin );
258 satrec.
nodeo, satrec);
void jday(int year, int mon, int day, int hr, int minute, double sec, double &jd)
bool sgp4init(gravconsttype whichconst, char opsmode, const 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)
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 days2mdhms(int year, double days, int &mon, int &day, int &hr, int &minute, double &sec)
void getgravconst(gravconsttype whichconst, double &tumin, double &mu, double &radiusearthkm, double &xke, double &j2, double &j3, double &j4, double &j3oj2)