57 static void dpper(
double e3,
98 static void dscom(
double epoch,
261 static void dspace(
int irez,
299 static void initl(
long int satn,
431 const double twopi = 2.0 *
pi;
432 double alfdp, betdp, cosip, cosop, dalf, dbet, dls, f2, f3, pe, pgh, ph, pinc, pl, sel, ses,
433 sghl, sghs, shll, shs, sil, sinip, sinop, sinzf, sis, sll, sls, xls, xnoh, zf, zm, zel, zes,
447 zf = zm + 2.0 * zes * sin(zm);
449 f2 = 0.5 * sinzf * sinzf - 0.25;
450 f3 = -0.5 * sinzf * cos(zf);
451 ses = se2 * f2 + se3 * f3;
452 sis = si2 * f2 + si3 * f3;
453 sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
454 sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
455 shs = sh2 * f2 + sh3 * f3;
459 zf = zm + 2.0 * zel * sin(zm);
461 f2 = 0.5 * sinzf * sinzf - 0.25;
462 f3 = -0.5 * sinzf * cos(zf);
463 sel = ee2 * f2 + e3 * f3;
464 sil = xi2 * f2 + xi3 * f3;
465 sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
466 sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
467 shll = xh2 * f2 + xh3 * f3;
481 inclp = inclp + pinc;
498 pgh = pgh - cosip * ph;
508 alfdp = sinip * sinop;
509 betdp = sinip * cosop;
510 dalf = ph * cosop + pinc * cosip * sinop;
511 dbet = -ph * sinop + pinc * cosip * cosop;
512 alfdp = alfdp + dalf;
513 betdp = betdp + dbet;
514 nodep = fmod(nodep, twopi);
517 if ((nodep < 0.0) && (opsmode ==
'a'))
518 nodep = nodep + twopi;
519 xls = mp + argpp + cosip * nodep;
520 dls = pl + pgh - pinc * nodep * sinip;
523 nodep = atan2(alfdp, betdp);
526 if ((nodep < 0.0) && (opsmode ==
'a'))
527 nodep = nodep + twopi;
528 if (fabs(xnoh - nodep) >
pi)
531 nodep = nodep + twopi;
533 nodep = nodep - twopi;
536 argpp = xls - mp - cosip * nodep;
700 const double zes = 0.01675;
701 const double zel = 0.05490;
702 const double c1ss = 2.9864797e-6;
703 const double c1l = 4.7968065e-7;
704 const double zsinis = 0.39785416;
705 const double zcosis = 0.91744867;
706 const double zcosgs = 0.1945905;
707 const double zsings = -0.98088458;
708 const double twopi = 2.0 *
pi;
712 double a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, betasq, cc, ctem, stem, x1, x2, x3, x4, x5, x6,
713 x7, x8, xnodce, xnoi, zcosg, zcosgl, zcosh, zcoshl, zcosi, zcosil, zsing, zsingl, zsinh,
714 zsinhl, zsini, zsinil, zx, zy;
726 rtemsq = sqrt(betasq);
734 day = epoch + 18261.5 + tc / 1440.0;
735 xnodce = fmod(4.5236020 - 9.2422029e-4 * day, twopi);
738 zcosil = 0.91375164 - 0.03568096 * ctem;
739 zsinil = sqrt(1.0 - zcosil * zcosil);
740 zsinhl = 0.089683511 * stem / zsinil;
741 zcoshl = sqrt(1.0 - zsinhl * zsinhl);
742 gam = 5.8351514 + 0.0019443680 * day;
743 zx = 0.39785416 * stem / zsinil;
744 zy = zcoshl * ctem + 0.91744867 * zsinhl * stem;
746 zx = gam + zx - xnodce;
760 for (lsflg = 1; lsflg <= 2; lsflg++)
762 a1 = zcosg * zcosh + zsing * zcosi * zsinh;
763 a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
764 a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
766 a9 = zsing * zsinh + zcosg * zcosi * zcosh;
768 a2 = cosim * a7 + sinim * a8;
769 a4 = cosim * a9 + sinim * a10;
770 a5 = -sinim * a7 + cosim * a8;
771 a6 = -sinim * a9 + cosim * a10;
773 x1 = a1 * cosomm + a2 * sinomm;
774 x2 = a3 * cosomm + a4 * sinomm;
775 x3 = -a1 * sinomm + a2 * cosomm;
776 x4 = -a3 * sinomm + a4 * cosomm;
782 z31 = 12.0 * x1 * x1 - 3.0 * x3 * x3;
783 z32 = 24.0 * x1 * x2 - 6.0 * x3 * x4;
784 z33 = 12.0 * x2 * x2 - 3.0 * x4 * x4;
785 z1 = 3.0 * (a1 * a1 + a2 * a2) + z31 * emsq;
786 z2 = 6.0 * (a1 * a3 + a2 * a4) + z32 * emsq;
787 z3 = 3.0 * (a3 * a3 + a4 * a4) + z33 * emsq;
788 z11 = -6.0 * a1 * a5 + emsq * (-24.0 * x1 * x7 - 6.0 * x3 * x5);
789 z12 = -6.0 * (a1 * a6 + a3 * a5) +
790 emsq * (-24.0 * (x2 * x7 + x1 * x8) - 6.0 * (x3 * x6 + x4 * x5));
791 z13 = -6.0 * a3 * a6 + emsq * (-24.0 * x2 * x8 - 6.0 * x4 * x6);
792 z21 = 6.0 * a2 * a5 + emsq * (24.0 * x1 * x5 - 6.0 * x3 * x7);
793 z22 = 6.0 * (a4 * a5 + a2 * a6) +
794 emsq * (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
795 z23 = 6.0 * a4 * a6 + emsq * (24.0 * x2 * x6 - 6.0 * x4 * x8);
796 z1 = z1 + z1 + betasq * z31;
797 z2 = z2 + z2 + betasq * z32;
798 z3 = z3 + z3 + betasq * z33;
800 s2 = -0.5 * s3 / rtemsq;
802 s1 = -15.0 * em * s4;
803 s5 = x1 * x3 + x2 * x4;
804 s6 = x2 * x3 + x1 * x4;
805 s7 = x2 * x4 - x1 * x3;
833 zcosh = zcoshl * cnodm + zsinhl * snodm;
834 zsinh = snodm * zcoshl - cnodm * zsinhl;
839 zmol = fmod(4.7199672 + 0.22997150 * day - gam, twopi);
840 zmos = fmod(6.2565837 + 0.017201977 * day, twopi);
843 se2 = 2.0 * ss1 * ss6;
844 se3 = 2.0 * ss1 * ss7;
845 si2 = 2.0 * ss2 * sz12;
846 si3 = 2.0 * ss2 * (sz13 - sz11);
847 sl2 = -2.0 * ss3 * sz2;
848 sl3 = -2.0 * ss3 * (sz3 - sz1);
849 sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
850 sgh2 = 2.0 * ss4 * sz32;
851 sgh3 = 2.0 * ss4 * (sz33 - sz31);
852 sgh4 = -18.0 * ss4 * zes;
853 sh2 = -2.0 * ss2 * sz22;
854 sh3 = -2.0 * ss2 * (sz23 - sz21);
859 xi2 = 2.0 * s2 * z12;
860 xi3 = 2.0 * s2 * (z13 - z11);
861 xl2 = -2.0 * s3 * z2;
862 xl3 = -2.0 * s3 * (z3 - z1);
863 xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
864 xgh2 = 2.0 * s4 * z32;
865 xgh3 = 2.0 * s4 * (z33 - z31);
866 xgh4 = -18.0 * s4 * zel;
867 xh2 = -2.0 * s2 * z22;
868 xh3 = -2.0 * s2 * (z23 - z21);
1027 const double twopi = 2.0 *
pi;
1029 double ainv2, aonv = 0.0, cosisq, eoc, f220, f221, f311, f321, f322, f330, f441, f442, f522,
1030 f523, f542, f543, g200, g201, g211, g300, g310, g322, g410, g422, g520, g521,
1031 g532, g533, ses, sgs, sghl, sghs, shs, shll, sis, sini2, sls, temp, temp1, theta,
1032 xno2, q22, q31, q33, root22, root44, root54, rptim, root32, root52, x2o3, xke,
1033 znl, emo, zns, emsqo, tumin, mu, radiusearthkm, j2, j3, j4, j3oj2;
1036 ainv2 = cosisq = eoc = f220 = f221 = f311 = f321 = f322 = f330 = f441 = f442 = f522 = f523 =
1037 f542 = f543 = g200 = g201 = g211 = g300 = g310 = g322 = g410 = g422 = g520 = g521 = g532 =
1038 g533 = ses = sgs = sghl = sghs = shs = shll = sis = sini2 = sls = temp = temp1 = theta =
1039 xno2 = q22 = q31 = q33 = root22 = root44 = root54 = rptim = root32 = root52 = x2o3 =
1040 xke = znl = emo = zns = emsqo = tumin = mu = radiusearthkm = j2 = j3 = j4 =
1046 root22 = 1.7891679e-6;
1047 root44 = 7.3636953e-9;
1048 root54 = 2.1765803e-9;
1049 rptim = 4.37526908801129966e-3;
1050 root32 = 3.7393792e-7;
1051 root52 = 1.1428639e-7;
1057 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
1061 if ((nm < 0.0052359877) && (nm > 0.0034906585))
1063 if ((nm >= 8.26e-3) && (nm <= 9.24e-3) && (em >= 0.5))
1067 ses = ss1 * zns * ss5;
1068 sis = ss2 * zns * (sz11 + sz13);
1069 sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
1070 sghs = ss4 * zns * (sz31 + sz33 - 6.0);
1071 shs = -zns * ss2 * (sz21 + sz23);
1073 if ((inclm < 5.2359877e-2) || (inclm >
pi - 5.2359877e-2))
1077 sgs = sghs - cosim * shs;
1080 dedt = ses + s1 * znl * s5;
1081 didt = sis + s2 * znl * (z11 + z13);
1082 dmdt = sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq);
1083 sghl = s4 * znl * (z31 + z33 - 6.0);
1084 shll = -znl * s2 * (z21 + z23);
1086 if ((inclm < 5.2359877e-2) || (inclm >
pi - 5.2359877e-2))
1092 domdt = domdt - cosim / sinim * shll;
1093 dnodt = dnodt + shll / sinim;
1098 theta = fmod(gsto + tc * rptim, twopi);
1100 inclm = inclm + didt * t;
1101 argpm = argpm + domdt * t;
1102 nodem = nodem + dnodt * t;
1116 aonv = pow(nm / xke, x2o3);
1121 cosisq = cosim * cosim;
1127 g201 = -0.306 - (em - 0.64) * 0.440;
1131 g211 = 3.616 - 13.2470 * em + 16.2900 * emsq;
1132 g310 = -19.302 + 117.3900 * em - 228.4190 * emsq + 156.5910 * eoc;
1133 g322 = -18.9068 + 109.7927 * em - 214.6334 * emsq + 146.5816 * eoc;
1134 g410 = -41.122 + 242.6940 * em - 471.0940 * emsq + 313.9530 * eoc;
1135 g422 = -146.407 + 841.8800 * em - 1629.014 * emsq + 1083.4350 * eoc;
1136 g520 = -532.114 + 3017.977 * em - 5740.032 * emsq + 3708.2760 * eoc;
1140 g211 = -72.099 + 331.819 * em - 508.738 * emsq + 266.724 * eoc;
1141 g310 = -346.844 + 1582.851 * em - 2415.925 * emsq + 1246.113 * eoc;
1142 g322 = -342.585 + 1554.908 * em - 2366.899 * emsq + 1215.972 * eoc;
1143 g410 = -1052.797 + 4758.686 * em - 7193.992 * emsq + 3651.957 * eoc;
1144 g422 = -3581.690 + 16178.110 * em - 24462.770 * emsq + 12422.520 * eoc;
1146 g520 = -5149.66 + 29936.92 * em - 54087.36 * emsq + 31324.56 * eoc;
1148 g520 = 1464.74 - 4664.75 * em + 3763.64 * emsq;
1152 g533 = -919.22770 + 4988.6100 * em - 9064.7700 * emsq + 5542.21 * eoc;
1153 g521 = -822.71072 + 4568.6173 * em - 8491.4146 * emsq + 5337.524 * eoc;
1154 g532 = -853.66600 + 4690.2500 * em - 8624.7700 * emsq + 5341.4 * eoc;
1158 g533 = -37995.780 + 161616.52 * em - 229838.20 * emsq + 109377.94 * eoc;
1159 g521 = -51752.104 + 218913.95 * em - 309468.16 * emsq + 146349.42 * eoc;
1160 g532 = -40023.880 + 170470.89 * em - 242699.48 * emsq + 115605.82 * eoc;
1163 sini2 = sinim * sinim;
1164 f220 = 0.75 * (1.0 + 2.0 * cosim + cosisq);
1166 f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
1167 f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
1168 f441 = 35.0 * sini2 * f220;
1169 f442 = 39.3750 * sini2 * sini2;
1170 f522 = 9.84375 * sinim *
1171 (sini2 * (1.0 - 2.0 * cosim - 5.0 * cosisq) +
1172 0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq));
1173 f523 = sinim * (4.92187512 * sini2 * (-2.0 - 4.0 * cosim + 10.0 * cosisq) +
1174 6.56250012 * (1.0 + 2.0 * cosim - 3.0 * cosisq));
1175 f542 = 29.53125 * sinim *
1176 (2.0 - 8.0 * cosim + cosisq * (-12.0 + 8.0 * cosim + 10.0 * cosisq));
1177 f543 = 29.53125 * sinim *
1178 (-2.0 - 8.0 * cosim + cosisq * (12.0 + 8.0 * cosim - 10.0 * cosisq));
1180 ainv2 = aonv * aonv;
1181 temp1 = 3.0 * xno2 * ainv2;
1182 temp = temp1 * root22;
1183 d2201 = temp * f220 * g201;
1184 d2211 = temp * f221 * g211;
1185 temp1 = temp1 * aonv;
1186 temp = temp1 * root32;
1187 d3210 = temp * f321 * g310;
1188 d3222 = temp * f322 * g322;
1189 temp1 = temp1 * aonv;
1190 temp = 2.0 * temp1 * root44;
1191 d4410 = temp * f441 * g410;
1192 d4422 = temp * f442 * g422;
1193 temp1 = temp1 * aonv;
1194 temp = temp1 * root52;
1195 d5220 = temp * f522 * g520;
1196 d5232 = temp * f523 * g532;
1197 temp = 2.0 * temp1 * root54;
1198 d5421 = temp * f542 * g521;
1199 d5433 = temp * f543 * g533;
1200 xlamo = fmod(mo + nodeo + nodeo - theta - theta, twopi);
1201 xfact = mdot + dmdt + 2.0 * (nodedot + dnodt - rptim) - no;
1209 g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
1210 g310 = 1.0 + 2.0 * emsq;
1211 g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
1212 f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
1213 f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
1215 f330 = 1.875 * f330 * f330 * f330;
1216 del1 = 3.0 * nm * nm * aonv * aonv;
1217 del2 = 2.0 * del1 * f220 * g200 * q22;
1218 del3 = 3.0 * del1 * f330 * g300 * q33 * aonv;
1219 del1 = del1 * f311 * g310 * q31 * aonv;
1220 xlamo = fmod(mo + nodeo + argpo - theta, twopi);
1221 xfact = mdot + xpidot - rptim + dmdt + domdt + dnodt - no;
1344 const double twopi = 2.0 *
pi;
1346 double delt, ft, theta, x2li, x2omi, xl, xldot, xnddt, xndt, xomi, g22, g32, g44, g52, g54,
1347 fasx2, fasx4, fasx6, rptim, step2, stepn, stepp;
1357 rptim = 4.37526908801129966e-3;
1364 theta = fmod(gsto + tc * rptim, twopi);
1367 inclm = inclm + didt * t;
1368 argpm = argpm + domdt * t;
1369 nodem = nodem + dnodt * t;
1392 if ((atime == 0.0) || (t * atime <= 0.0) || (fabs(t) < fabs(atime)))
1405 while (iretn == 381)
1411 xndt = del1 * sin(xli - fasx2) + del2 * sin(2.0 * (xli - fasx4)) +
1412 del3 * sin(3.0 * (xli - fasx6));
1413 xldot = xni + xfact;
1414 xnddt = del1 * cos(xli - fasx2) + 2.0 * del2 * cos(2.0 * (xli - fasx4)) +
1415 3.0 * del3 * cos(3.0 * (xli - fasx6));
1416 xnddt = xnddt * xldot;
1421 xomi = argpo + argpdot * atime;
1422 x2omi = xomi + xomi;
1424 xndt = d2201 * sin(x2omi + xli - g22) + d2211 * sin(xli - g22) +
1425 d3210 * sin(xomi + xli - g32) + d3222 * sin(-xomi + xli - g32) +
1426 d4410 * sin(x2omi + x2li - g44) + d4422 * sin(x2li - g44) +
1427 d5220 * sin(xomi + xli - g52) + d5232 * sin(-xomi + xli - g52) +
1428 d5421 * sin(xomi + x2li - g54) + d5433 * sin(-xomi + x2li - g54);
1429 xldot = xni + xfact;
1430 xnddt = d2201 * cos(x2omi + xli - g22) + d2211 * cos(xli - g22) +
1431 d3210 * cos(xomi + xli - g32) + d3222 * cos(-xomi + xli - g32) +
1432 d5220 * cos(xomi + xli - g52) + d5232 * cos(-xomi + xli - g52) +
1433 2.0 * (d4410 * cos(x2omi + x2li - g44) + d4422 * cos(x2li - g44) +
1434 d5421 * cos(xomi + x2li - g54) + d5433 * cos(-xomi + x2li - g54));
1435 xnddt = xnddt * xldot;
1440 if (fabs(t - atime) >= stepp)
1452 xli = xli + xldot * delt + xndt * step2;
1453 xni = xni + xndt * delt + xnddt * step2;
1454 atime = atime + delt;
1458 nm = xni + xndt * ft + xnddt * ft * ft * 0.5;
1459 xl = xli + xldot * ft + xndt * ft * ft * 0.5;
1462 mm = xl - 2.0 * nodem + 2.0 * theta;
1467 mm = xl - nodem - argpm + theta;
1549 double ak, d1, del, adel, po, x2o3, j2, xke, tumin, mu, radiusearthkm, j3, j4, j3oj2;
1552 ak = d1 = del = adel = po = x2o3 = j2 = xke = tumin = mu = radiusearthkm = j3 = j4 = j3oj2 =
1557 double ts70, tfrac, c1, thgr70, fk5r, c1p2p;
1558 const double twopi = 2.0 *
pi;
1562 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
1566 eccsq = ecco * ecco;
1567 omeosq = 1.0 - eccsq;
1568 rteosq = sqrt(omeosq);
1570 cosio2 = cosio * cosio;
1573 ak = pow(xke / no, x2o3);
1574 d1 = 0.75 * j2 * (3.0 * cosio2 - 1.0) / (rteosq * omeosq);
1575 del = d1 / (ak * ak);
1576 adel = ak * (1.0 - del * del - del * (1.0 / 3.0 + 134.0 * del * del / 81.0));
1577 del = d1 / (adel * adel);
1578 no = no / (1.0 + del);
1580 ao = pow(xke / no, x2o3);
1583 con42 = 1.0 - 5.0 * cosio2;
1584 con41 = -con42 - cosio2 - cosio2;
1587 rp = ao * (1.0 - ecco);
1595 ts70 = epoch - 7305.0;
1596 ds70 = floor(ts70 + 1.0e-8);
1597 tfrac = ts70 - ds70;
1599 c1 = 1.72027916940703639e-2;
1600 thgr70 = 1.7321343856509374;
1601 fk5r = 5.07551419432269442e-15;
1603 gsto = fmod(thgr70 + c1 * ds70 + c1p2p * tfrac + ts70 * ts70 * fk5r, twopi);
1605 gsto = gsto + twopi;
1608 gsto =
gstime(epoch + 2433281.5);
1697 const long int satn,
1699 const double xbstar,
1701 const double xargpo,
1702 const double xinclo,
1705 const double xnodeo,
1709 double ao, ainv, con42, cosio, sinio, cosio2, eccsq, omeosq, posq, rp, rteosq, cnodm, snodm,
1710 cosim, sinim, cosomm, sinomm, cc1sq, cc2, cc3, coef, coef1, cosio4, day, dndt, em, emsq,
1711 eeta, etasq, gam, argpm, nodem, inclm, mm, nm, perige, pinvsq, psisq, qzms24, rtemsq, s1,
1712 s2, s3, s4, s5, s6, s7, sfour, ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3, sz11, sz12,
1713 sz13, sz21, sz22, sz23, sz31, sz32, sz33, tc, temp, temp1, temp2, temp3, tsi, xpidot,
1714 xhdot1, z1, z2, z3, z11, z12, z13, z21, z22, z23, z31, z32, z33, qzms2t, ss, j2, j3oj2, j4,
1715 x2o3, r[3], v[3], tumin, mu, radiusearthkm, xke, j3, delmotemp, qzms2ttemp, qzms24temp;
1718 ao = ainv = con42 = cosio = sinio = cosio2 = eccsq = omeosq = posq = rp = rteosq = cnodm =
1719 snodm = cosim = sinim = cosomm = sinomm = cc1sq = cc2 = cc3 = coef = coef1 = cosio4 = day =
1720 dndt = em = emsq = eeta = etasq = gam = argpm = nodem = inclm = mm = nm = perige =
1721 pinvsq = psisq = qzms24 = rtemsq = s1 = s2 = s3 = s4 = s5 = s6 = s7 = sfour = ss1 =
1722 ss2 = ss3 = ss4 = ss5 = ss6 = ss7 = sz1 = sz2 = sz3 = sz11 = sz12 = sz13 =
1723 sz21 = sz22 = sz23 = sz31 = sz32 = sz33 = tc = temp = temp1 = temp2 =
1724 temp3 = tsi = xpidot = xhdot1 = z1 = z2 = z3 = z11 = z12 = z13 = z21 =
1725 z22 = z23 = z31 = z32 = z33 = qzms2t = ss = j2 = j3oj2 = j4 = x2o3 =
1726 tumin = mu = radiusearthkm = xke = j3 = delmotemp = qzms2ttemp =
1733 const double temp4 = 1.5e-12;
1826 satrec.
bstar = xbstar;
1827 satrec.
ecco = xecco;
1828 satrec.
argpo = xargpo;
1829 satrec.
inclo = xinclo;
1832 satrec.
nodeo = xnodeo;
1839 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
1840 ss = 78.0 / radiusearthkm + 1.0;
1842 qzms2ttemp = (120.0 - 78.0) / radiusearthkm;
1843 qzms2t = qzms2ttemp * qzms2ttemp * qzms2ttemp * qzms2ttemp;
1881 if ((omeosq >= 0.0) || (satrec.
no >= 0.0))
1884 if (rp < (220.0 / radiusearthkm + 1.0))
1888 perige = (rp - 1.0) * radiusearthkm;
1893 sfour = perige - 78.0;
1897 qzms24temp = (120.0 - sfour) / radiusearthkm;
1898 qzms24 = qzms24temp * qzms24temp * qzms24temp * qzms24temp;
1899 sfour = sfour / radiusearthkm + 1.0;
1901 pinvsq = 1.0 / posq;
1903 tsi = 1.0 / (ao - sfour);
1904 satrec.
eta = ao * satrec.
ecco * tsi;
1905 etasq = satrec.
eta * satrec.
eta;
1906 eeta = satrec.
ecco * satrec.
eta;
1907 psisq = fabs(1.0 - etasq);
1908 coef = qzms24 * pow(tsi, 4.0);
1909 coef1 = coef / pow(psisq, 3.5);
1910 cc2 = coef1 * satrec.
no *
1911 (ao * (1.0 + 1.5 * etasq + eeta * (4.0 + etasq)) +
1912 0.375 * j2 * tsi / psisq * satrec.
con41 * (8.0 + 3.0 * etasq * (8.0 + etasq)));
1915 if (satrec.
ecco > 1.0e-4)
1916 cc3 = -2.0 * coef * tsi * j3oj2 * satrec.
no * sinio / satrec.
ecco;
1917 satrec.
x1mth2 = 1.0 - cosio2;
1918 satrec.
cc4 = 2.0 * satrec.
no * coef1 * ao * omeosq *
1919 (satrec.
eta * (2.0 + 0.5 * etasq) + satrec.
ecco * (0.5 + 2.0 * etasq) -
1920 j2 * tsi / (ao * psisq) *
1921 (-3.0 * satrec.
con41 * (1.0 - 2.0 * eeta + etasq * (1.5 - 0.5 * eeta)) +
1922 0.75 * satrec.
x1mth2 * (2.0 * etasq - eeta * (1.0 + etasq)) *
1923 cos(2.0 * satrec.
argpo)));
1924 satrec.
cc5 = 2.0 * coef1 * ao * omeosq * (1.0 + 2.75 * (etasq + eeta) + eeta * etasq);
1925 cosio4 = cosio2 * cosio2;
1926 temp1 = 1.5 * j2 * pinvsq * satrec.
no;
1927 temp2 = 0.5 * temp1 * j2 * pinvsq;
1928 temp3 = -0.46875 * j4 * pinvsq * pinvsq * satrec.
no;
1929 satrec.
mdot = satrec.
no + 0.5 * temp1 * rteosq * satrec.
con41 +
1930 0.0625 * temp2 * rteosq * (13.0 - 78.0 * cosio2 + 137.0 * cosio4);
1931 satrec.
argpdot = -0.5 * temp1 * con42 +
1932 0.0625 * temp2 * (7.0 - 114.0 * cosio2 + 395.0 * cosio4) +
1933 temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4);
1934 xhdot1 = -temp1 * cosio;
1937 (0.5 * temp2 * (4.0 - 19.0 * cosio2) + 2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio;
1941 if (satrec.
ecco > 1.0e-4)
1942 satrec.
xmcof = -x2o3 * coef * satrec.
bstar / eeta;
1943 satrec.
nodecf = 3.5 * omeosq * xhdot1 * satrec.
cc1;
1946 if (fabs(cosio + 1.0) > 1.5e-12)
1947 satrec.
xlcof = -0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / (1.0 + cosio);
1949 satrec.
xlcof = -0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / temp4;
1950 satrec.
aycof = -0.5 * j3oj2 * sinio;
1952 delmotemp = 1.0 + satrec.
eta * cos(satrec.
mo);
1953 satrec.
delmo = delmotemp * delmotemp * delmotemp;
1955 satrec.
x7thm1 = 7.0 * cosio2 - 1.0;
1958 if ((2 *
pi / satrec.
no) >= 225.0)
1963 inclm = satrec.
inclo;
2174 if (satrec.
isimp != 1)
2176 cc1sq = satrec.
cc1 * satrec.
cc1;
2177 satrec.
d2 = 4.0 * ao * tsi * cc1sq;
2178 temp = satrec.
d2 * tsi * satrec.
cc1 / 3.0;
2179 satrec.
d3 = (17.0 * ao + sfour) * temp;
2180 satrec.
d4 = 0.5 * temp * ao * tsi * (221.0 * ao + 31.0 * sfour) * satrec.
cc1;
2181 satrec.
t3cof = satrec.
d2 + 2.0 * cc1sq;
2183 0.25 * (3.0 * satrec.
d3 + satrec.
cc1 * (12.0 * satrec.
d2 + 10.0 * cc1sq));
2185 0.2 * (3.0 * satrec.
d4 + 12.0 * satrec.
cc1 * satrec.
d3 +
2186 6.0 * satrec.
d2 * satrec.
d2 + 15.0 * cc1sq * (2.0 * satrec.
d2 + cc1sq));
2193 sgp4(whichconst, satrec, 0.0, r, v);
2290 double am, axnl, aynl, betal, cosim, cnod, cos2u, coseo1, cosi, cosip, cosisq, cossu, cosu,
2291 delm, delomg, em, emsq, ecose, el2, eo1, ep, esine, argpm, argpp, argpdf, pl,
2292 mrt = 0.0, mvt, rdotl, rl, rvdot, rvdotl, sinim, sin2u, sineo1, sini, sinip, sinsu, sinu,
2293 snod, su, t2, t3, t4, tem5, temp, temp1, temp2, tempa, tempe, templ, u, ux, uy, uz, vx, vy,
2294 vz, inclm, mm, nm, nodem, xinc, xincp, xl, xlm, mp, xmdf, xmx, xmy, nodedf, xnode, nodep,
2295 tc, dndt, twopi, x2o3, j2, j3, tumin, j4, xke, j3oj2, radiusearthkm, mu, vkmpersec,
2300 am = axnl = aynl = betal = cosim = cnod = cos2u = coseo1 = cosi = cosip = cosisq = cossu =
2301 cosu = delm = delomg = em = emsq = ecose = el2 = eo1 = ep = esine = argpm = argpp = argpdf =
2302 pl = mvt = rdotl = rl = rvdot = rvdotl = sinim = sin2u = sineo1 = sini = sinip = sinsu =
2303 sinu = snod = su = t2 = t3 = t4 = tem5 = temp = temp1 = temp2 = tempa = tempe =
2304 templ = u = ux = uy = uz = vx = vy = vz = inclm = mm = nm = nodem = xinc =
2305 xincp = xl = xlm = mp = xmdf = xmx = xmy = nodedf = xnode = nodep = tc =
2306 dndt = twopi = x2o3 = j2 = j3 = tumin = j4 = xke = j3oj2 =
2307 radiusearthkm = mu = vkmpersec = delmtemp = 0.0;
2313 const double temp4 = 1.5e-12;
2317 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
2318 vkmpersec = radiusearthkm * xke / 60.0;
2325 xmdf = satrec.
mo + satrec.
mdot * satrec.
t;
2330 t2 = satrec.
t * satrec.
t;
2331 nodem = nodedf + satrec.
nodecf * t2;
2332 tempa = 1.0 - satrec.
cc1 * satrec.
t;
2333 tempe = satrec.
bstar * satrec.
cc4 * satrec.
t;
2334 templ = satrec.
t2cof * t2;
2336 if (satrec.
isimp != 1)
2338 delomg = satrec.
omgcof * satrec.
t;
2340 delmtemp = 1.0 + satrec.
eta * cos(xmdf);
2341 delm = satrec.
xmcof * (delmtemp * delmtemp * delmtemp - satrec.
delmo);
2342 temp = delomg + delm;
2344 argpm = argpdf - temp;
2347 tempa = tempa - satrec.
d2 * t2 - satrec.
d3 * t3 - satrec.
d4 * t4;
2348 tempe = tempe + satrec.
bstar * satrec.
cc5 * (sin(mm) - satrec.
sinmao);
2349 templ = templ + satrec.
t3cof * t3 + t4 * (satrec.
t4cof + satrec.
t * satrec.
t5cof);
2354 inclm = satrec.
inclo;
2355 if (satrec.
method ==
'd')
2403 am = pow((xke / nm), x2o3) * tempa * tempa;
2404 nm = xke / pow(am, 1.5);
2409 if ((em >= 1.0) || (em < -0.001) )
2418 mm = mm + satrec.
no * templ;
2419 xlm = mm + argpm + nodem;
2423 nodem = fmod(nodem, twopi);
2424 argpm = fmod(argpm, twopi);
2425 xlm = fmod(xlm, twopi);
2426 mm = fmod(xlm - argpm - nodem, twopi);
2440 if (satrec.
method ==
'd')
2488 if ((ep < 0.0) || (ep > 1.0))
2497 if (satrec.
method ==
'd')
2501 satrec.
aycof = -0.5 * j3oj2 * sinip;
2503 if (fabs(cosip + 1.0) > 1.5e-12)
2504 satrec.
xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / (1.0 + cosip);
2506 satrec.
xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / temp4;
2508 axnl = ep * cos(argpp);
2509 temp = 1.0 / (am * (1.0 - ep * ep));
2510 aynl = ep * sin(argpp) + temp * satrec.
aycof;
2511 xl = mp + argpp + nodep + temp * satrec.
xlcof * axnl;
2514 u = fmod(xl - nodep, twopi);
2520 while ((fabs(tem5) >= 1.0e-12) && (ktr <= 10))
2524 tem5 = 1.0 - coseo1 * axnl - sineo1 * aynl;
2525 tem5 = (u - aynl * coseo1 + axnl * sineo1 - eo1) / tem5;
2526 if (fabs(tem5) >= 0.95)
2527 tem5 = tem5 > 0.0 ? 0.95 : -0.95;
2533 ecose = axnl * coseo1 + aynl * sineo1;
2534 esine = axnl * sineo1 - aynl * coseo1;
2535 el2 = axnl * axnl + aynl * aynl;
2536 pl = am * (1.0 - el2);
2545 rl = am * (1.0 - ecose);
2546 rdotl = sqrt(am) * esine / rl;
2547 rvdotl = sqrt(pl) / rl;
2548 betal = sqrt(1.0 - el2);
2549 temp = esine / (1.0 + betal);
2550 sinu = am / rl * (sineo1 - aynl - axnl * temp);
2551 cosu = am / rl * (coseo1 - axnl + aynl * temp);
2552 su = atan2(sinu, cosu);
2553 sin2u = (cosu + cosu) * sinu;
2554 cos2u = 1.0 - 2.0 * sinu * sinu;
2556 temp1 = 0.5 * j2 * temp;
2557 temp2 = temp1 * temp;
2560 if (satrec.
method ==
'd')
2562 cosisq = cosip * cosip;
2563 satrec.
con41 = 3.0 * cosisq - 1.0;
2564 satrec.
x1mth2 = 1.0 - cosisq;
2565 satrec.
x7thm1 = 7.0 * cosisq - 1.0;
2567 mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.
con41) + 0.5 * temp1 * satrec.
x1mth2 * cos2u;
2568 su = su - 0.25 * temp2 * satrec.
x7thm1 * sin2u;
2569 xnode = nodep + 1.5 * temp2 * cosip * sin2u;
2570 xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
2571 mvt = rdotl - nm * temp1 * satrec.
x1mth2 * sin2u / xke;
2572 rvdot = rvdotl + nm * temp1 * (satrec.
x1mth2 * cos2u + 1.5 * satrec.
con41) / xke;
2583 ux = xmx * sinsu + cnod * cossu;
2584 uy = xmy * sinsu + snod * cossu;
2586 vx = xmx * cossu - cnod * sinsu;
2587 vy = xmy * cossu - snod * sinsu;
2591 r[0] = (mrt * ux) * radiusearthkm;
2592 r[1] = (mrt * uy) * radiusearthkm;
2593 r[2] = (mrt * uz) * radiusearthkm;
2594 v[0] = (mvt * ux + rvdot * vx) * vkmpersec;
2595 v[1] = (mvt * uy + rvdot * vy) * vkmpersec;
2596 v[2] = (mvt * uz + rvdot * vz) * vkmpersec;
2638 const double twopi = 2.0 *
pi;
2639 const double deg2rad =
pi / 180.0;
2642 tut1 = (jdut1 - 2451545.0) / 36525.0;
2643 temp = -6.2e-6 * tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 +
2644 (876600.0 * 3600 + 8640184.812866) * tut1 + 67310.54841;
2645 temp = fmod(temp * deg2rad / 240.0, twopi);
2688 double& radiusearthkm,
2700 radiusearthkm = 6378.135;
2704 j3 = -0.00000253881;
2705 j4 = -0.00000165597;
2711 radiusearthkm = 6378.135;
2712 xke = 60.0 / sqrt(radiusearthkm * radiusearthkm * radiusearthkm / mu);
2715 j3 = -0.00000253881;
2716 j4 = -0.00000165597;
2722 radiusearthkm = 6378.137;
2723 xke = 60.0 / sqrt(radiusearthkm * radiusearthkm * radiusearthkm / mu);
2725 j2 = 0.00108262998905;
2726 j3 = -0.00000253215306;
2727 j4 = -0.00000161098761;
2731 fprintf(stderr,
"unknown gravity option (%d)\n", whichconst);
static void dspace(int irez, double d2201, double d2211, double d3210, double d3222, double d4410, double d4422, double d5220, double d5232, double d5421, double d5433, double dedt, double del1, double del2, double del3, double didt, double dmdt, double dnodt, double domdt, double argpo, double argpdot, double t, double tc, double gsto, double xfact, double xlamo, double no, double &atime, double &em, double &argpm, double &inclm, double &xli, double &mm, double &xni, double &nodem, double &dndt, double &nm)
static void initl(long int satn, gravconsttype whichconst, double ecco, double epoch, double inclo, double &no, char &method, double &ainv, double &ao, double &con41, double &con42, double &cosio, double &cosio2, double &eccsq, double &omeosq, double &posq, double &rp, double &rteosq, double &sinio, double &gsto, char opsmode)
bool sgp4(gravconsttype whichconst, elsetrec &satrec, double tsince, double r[3], double v[3])
static void dsinit(gravconsttype whichconst, double cosim, double emsq, double argpo, double s1, double s2, double s3, double s4, double s5, double sinim, double ss1, double ss2, double ss3, double ss4, double ss5, double sz1, double sz3, double sz11, double sz13, double sz21, double sz23, double sz31, double sz33, double t, double tc, double gsto, double mo, double mdot, double no, double nodeo, double nodedot, double xpidot, double z1, double z3, double z11, double z13, double z21, double z23, double z31, double z33, double ecco, double eccsq, double &em, double &argpm, double &inclm, double &mm, double &nm, double &nodem, int &irez, double &atime, double &d2201, double &d2211, double &d3210, double &d3222, double &d4410, double &d4422, double &d5220, double &d5232, double &d5421, double &d5433, double &dedt, double &didt, double &dmdt, double &dndt, double &dnodt, double &domdt, double &del1, double &del2, double &del3, double &xfact, double &xlamo, double &xli, double &xni)
void getgravconst(gravconsttype whichconst, double &tumin, double &mu, double &radiusearthkm, double &xke, double &j2, double &j3, double &j4, double &j3oj2)
static void dpper(double e3, double ee2, double peo, double pgho, double pho, double pinco, double plo, double se2, double se3, double sgh2, double sgh3, double sgh4, double sh2, double sh3, double si2, double si3, double sl2, double sl3, double sl4, double t, double xgh2, double xgh3, double xgh4, double xh2, double xh3, double xi2, double xi3, double xl2, double xl3, double xl4, double zmol, double zmos, double inclo, char init, double &ep, double &inclp, double &nodep, double &argpp, double &mp, char opsmode)
static void dscom(double epoch, double ep, double argpp, double tc, double inclp, double nodep, double np, double &snodm, double &cnodm, double &sinim, double &cosim, double &sinomm, double &cosomm, double &day, double &e3, double &ee2, double &em, double &emsq, double &gam, double &peo, double &pgho, double &pho, double &pinco, double &plo, double &rtemsq, double &se2, double &se3, double &sgh2, double &sgh3, double &sgh4, double &sh2, double &sh3, double &si2, double &si3, double &sl2, double &sl3, double &sl4, double &s1, double &s2, double &s3, double &s4, double &s5, double &s6, double &s7, double &ss1, double &ss2, double &ss3, double &ss4, double &ss5, double &ss6, double &ss7, double &sz1, double &sz2, double &sz3, double &sz11, double &sz12, double &sz13, double &sz21, double &sz22, double &sz23, double &sz31, double &sz32, double &sz33, double &xgh2, double &xgh3, double &xgh4, double &xh2, double &xh3, double &xi2, double &xi3, double &xl2, double &xl3, double &xl4, double &nm, double &z1, double &z2, double &z3, double &z11, double &z12, double &z13, double &z21, double &z22, double &z23, double &z31, double &z32, double &z33, double &zmol, double &zmos)
double gstime(double jdut1)
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)