55 static void dpper(
double e3,
96 static void dscom(
double epoch,
259 static void dspace(
int irez,
297 static void initl(
long int satn,
429 const double twopi = 2.0 *
pi;
430 double alfdp, betdp, cosip, cosop, dalf, dbet, dls, f2, f3, pe, pgh, ph, pinc, pl, sel, ses,
431 sghl, sghs, shll, shs, sil, sinip, sinop, sinzf, sis, sll, sls, xls, xnoh, zf, zm, zel, zes,
445 zf = zm + 2.0 * zes * sin(zm);
447 f2 = 0.5 * sinzf * sinzf - 0.25;
448 f3 = -0.5 * sinzf * cos(zf);
449 ses = se2 * f2 + se3 * f3;
450 sis = si2 * f2 + si3 * f3;
451 sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
452 sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
453 shs = sh2 * f2 + sh3 * f3;
457 zf = zm + 2.0 * zel * sin(zm);
459 f2 = 0.5 * sinzf * sinzf - 0.25;
460 f3 = -0.5 * sinzf * cos(zf);
461 sel = ee2 * f2 + e3 * f3;
462 sil = xi2 * f2 + xi3 * f3;
463 sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
464 sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
465 shll = xh2 * f2 + xh3 * f3;
479 inclp = inclp + pinc;
496 pgh = pgh - cosip * ph;
506 alfdp = sinip * sinop;
507 betdp = sinip * cosop;
508 dalf = ph * cosop + pinc * cosip * sinop;
509 dbet = -ph * sinop + pinc * cosip * cosop;
510 alfdp = alfdp + dalf;
511 betdp = betdp + dbet;
512 nodep = fmod(nodep, twopi);
515 if ((nodep < 0.0) && (opsmode ==
'a'))
516 nodep = nodep + twopi;
517 xls = mp + argpp + cosip * nodep;
518 dls = pl + pgh - pinc * nodep * sinip;
521 nodep = atan2(alfdp, betdp);
524 if ((nodep < 0.0) && (opsmode ==
'a'))
525 nodep = nodep + twopi;
526 if (fabs(xnoh - nodep) >
pi)
529 nodep = nodep + twopi;
531 nodep = nodep - twopi;
534 argpp = xls - mp - cosip * nodep;
698 const double zes = 0.01675;
699 const double zel = 0.05490;
700 const double c1ss = 2.9864797e-6;
701 const double c1l = 4.7968065e-7;
702 const double zsinis = 0.39785416;
703 const double zcosis = 0.91744867;
704 const double zcosgs = 0.1945905;
705 const double zsings = -0.98088458;
706 const double twopi = 2.0 *
pi;
710 double a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, betasq, cc, ctem, stem, x1, x2, x3, x4, x5, x6,
711 x7, x8, xnodce, xnoi, zcosg, zcosgl, zcosh, zcoshl, zcosi, zcosil, zsing, zsingl, zsinh,
712 zsinhl, zsini, zsinil, zx, zy;
724 rtemsq = sqrt(betasq);
732 day = epoch + 18261.5 + tc / 1440.0;
733 xnodce = fmod(4.5236020 - 9.2422029e-4 * day, twopi);
736 zcosil = 0.91375164 - 0.03568096 * ctem;
737 zsinil = sqrt(1.0 - zcosil * zcosil);
738 zsinhl = 0.089683511 * stem / zsinil;
739 zcoshl = sqrt(1.0 - zsinhl * zsinhl);
740 gam = 5.8351514 + 0.0019443680 * day;
741 zx = 0.39785416 * stem / zsinil;
742 zy = zcoshl * ctem + 0.91744867 * zsinhl * stem;
744 zx = gam + zx - xnodce;
758 for (lsflg = 1; lsflg <= 2; lsflg++)
760 a1 = zcosg * zcosh + zsing * zcosi * zsinh;
761 a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
762 a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
764 a9 = zsing * zsinh + zcosg * zcosi * zcosh;
766 a2 = cosim * a7 + sinim * a8;
767 a4 = cosim * a9 + sinim * a10;
768 a5 = -sinim * a7 + cosim * a8;
769 a6 = -sinim * a9 + cosim * a10;
771 x1 = a1 * cosomm + a2 * sinomm;
772 x2 = a3 * cosomm + a4 * sinomm;
773 x3 = -a1 * sinomm + a2 * cosomm;
774 x4 = -a3 * sinomm + a4 * cosomm;
780 z31 = 12.0 * x1 * x1 - 3.0 * x3 * x3;
781 z32 = 24.0 * x1 * x2 - 6.0 * x3 * x4;
782 z33 = 12.0 * x2 * x2 - 3.0 * x4 * x4;
783 z1 = 3.0 * (a1 * a1 + a2 * a2) + z31 * emsq;
784 z2 = 6.0 * (a1 * a3 + a2 * a4) + z32 * emsq;
785 z3 = 3.0 * (a3 * a3 + a4 * a4) + z33 * emsq;
786 z11 = -6.0 * a1 * a5 + emsq * (-24.0 * x1 * x7 - 6.0 * x3 * x5);
787 z12 = -6.0 * (a1 * a6 + a3 * a5) +
788 emsq * (-24.0 * (x2 * x7 + x1 * x8) - 6.0 * (x3 * x6 + x4 * x5));
789 z13 = -6.0 * a3 * a6 + emsq * (-24.0 * x2 * x8 - 6.0 * x4 * x6);
790 z21 = 6.0 * a2 * a5 + emsq * (24.0 * x1 * x5 - 6.0 * x3 * x7);
791 z22 = 6.0 * (a4 * a5 + a2 * a6) +
792 emsq * (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
793 z23 = 6.0 * a4 * a6 + emsq * (24.0 * x2 * x6 - 6.0 * x4 * x8);
794 z1 = z1 + z1 + betasq * z31;
795 z2 = z2 + z2 + betasq * z32;
796 z3 = z3 + z3 + betasq * z33;
798 s2 = -0.5 * s3 / rtemsq;
800 s1 = -15.0 * em * s4;
801 s5 = x1 * x3 + x2 * x4;
802 s6 = x2 * x3 + x1 * x4;
803 s7 = x2 * x4 - x1 * x3;
831 zcosh = zcoshl * cnodm + zsinhl * snodm;
832 zsinh = snodm * zcoshl - cnodm * zsinhl;
837 zmol = fmod(4.7199672 + 0.22997150 * day - gam, twopi);
838 zmos = fmod(6.2565837 + 0.017201977 * day, twopi);
841 se2 = 2.0 * ss1 * ss6;
842 se3 = 2.0 * ss1 * ss7;
843 si2 = 2.0 * ss2 * sz12;
844 si3 = 2.0 * ss2 * (sz13 - sz11);
845 sl2 = -2.0 * ss3 * sz2;
846 sl3 = -2.0 * ss3 * (sz3 - sz1);
847 sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
848 sgh2 = 2.0 * ss4 * sz32;
849 sgh3 = 2.0 * ss4 * (sz33 - sz31);
850 sgh4 = -18.0 * ss4 * zes;
851 sh2 = -2.0 * ss2 * sz22;
852 sh3 = -2.0 * ss2 * (sz23 - sz21);
857 xi2 = 2.0 * s2 * z12;
858 xi3 = 2.0 * s2 * (z13 - z11);
859 xl2 = -2.0 * s3 * z2;
860 xl3 = -2.0 * s3 * (z3 - z1);
861 xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
862 xgh2 = 2.0 * s4 * z32;
863 xgh3 = 2.0 * s4 * (z33 - z31);
864 xgh4 = -18.0 * s4 * zel;
865 xh2 = -2.0 * s2 * z22;
866 xh3 = -2.0 * s2 * (z23 - z21);
1025 const double twopi = 2.0 *
pi;
1027 double ainv2, aonv = 0.0, cosisq, eoc, f220, f221, f311, f321, f322, f330, f441, f442, f522,
1028 f523, f542, f543, g200, g201, g211, g300, g310, g322, g410, g422, g520, g521,
1029 g532, g533, ses, sgs, sghl, sghs, shs, shll, sis, sini2, sls, temp, temp1, theta,
1030 xno2, q22, q31, q33, root22, root44, root54, rptim, root32, root52, x2o3, xke,
1031 znl, emo, zns, emsqo, tumin, mu, radiusearthkm, j2, j3, j4, j3oj2;
1034 ainv2 = cosisq = eoc = f220 = f221 = f311 = f321 = f322 = f330 = f441 = f442 = f522 = f523 =
1035 f542 = f543 = g200 = g201 = g211 = g300 = g310 = g322 = g410 = g422 = g520 = g521 = g532 =
1036 g533 = ses = sgs = sghl = sghs = shs = shll = sis = sini2 = sls = temp = temp1 = theta =
1037 xno2 = q22 = q31 = q33 = root22 = root44 = root54 = rptim = root32 = root52 = x2o3 =
1038 xke = znl = emo = zns = emsqo = tumin = mu = radiusearthkm = j2 = j3 = j4 =
1044 root22 = 1.7891679e-6;
1045 root44 = 7.3636953e-9;
1046 root54 = 2.1765803e-9;
1047 rptim = 4.37526908801129966e-3;
1048 root32 = 3.7393792e-7;
1049 root52 = 1.1428639e-7;
1055 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
1059 if ((nm < 0.0052359877) && (nm > 0.0034906585))
1061 if ((nm >= 8.26e-3) && (nm <= 9.24e-3) && (em >= 0.5))
1065 ses = ss1 * zns * ss5;
1066 sis = ss2 * zns * (sz11 + sz13);
1067 sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
1068 sghs = ss4 * zns * (sz31 + sz33 - 6.0);
1069 shs = -zns * ss2 * (sz21 + sz23);
1071 if ((inclm < 5.2359877e-2) || (inclm >
pi - 5.2359877e-2))
1075 sgs = sghs - cosim * shs;
1078 dedt = ses + s1 * znl * s5;
1079 didt = sis + s2 * znl * (z11 + z13);
1080 dmdt = sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq);
1081 sghl = s4 * znl * (z31 + z33 - 6.0);
1082 shll = -znl * s2 * (z21 + z23);
1084 if ((inclm < 5.2359877e-2) || (inclm >
pi - 5.2359877e-2))
1090 domdt = domdt - cosim / sinim * shll;
1091 dnodt = dnodt + shll / sinim;
1096 theta = fmod(gsto + tc * rptim, twopi);
1098 inclm = inclm + didt * t;
1099 argpm = argpm + domdt * t;
1100 nodem = nodem + dnodt * t;
1114 aonv = pow(nm / xke, x2o3);
1119 cosisq = cosim * cosim;
1125 g201 = -0.306 - (em - 0.64) * 0.440;
1129 g211 = 3.616 - 13.2470 * em + 16.2900 * emsq;
1130 g310 = -19.302 + 117.3900 * em - 228.4190 * emsq + 156.5910 * eoc;
1131 g322 = -18.9068 + 109.7927 * em - 214.6334 * emsq + 146.5816 * eoc;
1132 g410 = -41.122 + 242.6940 * em - 471.0940 * emsq + 313.9530 * eoc;
1133 g422 = -146.407 + 841.8800 * em - 1629.014 * emsq + 1083.4350 * eoc;
1134 g520 = -532.114 + 3017.977 * em - 5740.032 * emsq + 3708.2760 * eoc;
1138 g211 = -72.099 + 331.819 * em - 508.738 * emsq + 266.724 * eoc;
1139 g310 = -346.844 + 1582.851 * em - 2415.925 * emsq + 1246.113 * eoc;
1140 g322 = -342.585 + 1554.908 * em - 2366.899 * emsq + 1215.972 * eoc;
1141 g410 = -1052.797 + 4758.686 * em - 7193.992 * emsq + 3651.957 * eoc;
1142 g422 = -3581.690 + 16178.110 * em - 24462.770 * emsq + 12422.520 * eoc;
1144 g520 = -5149.66 + 29936.92 * em - 54087.36 * emsq + 31324.56 * eoc;
1146 g520 = 1464.74 - 4664.75 * em + 3763.64 * emsq;
1150 g533 = -919.22770 + 4988.6100 * em - 9064.7700 * emsq + 5542.21 * eoc;
1151 g521 = -822.71072 + 4568.6173 * em - 8491.4146 * emsq + 5337.524 * eoc;
1152 g532 = -853.66600 + 4690.2500 * em - 8624.7700 * emsq + 5341.4 * eoc;
1156 g533 = -37995.780 + 161616.52 * em - 229838.20 * emsq + 109377.94 * eoc;
1157 g521 = -51752.104 + 218913.95 * em - 309468.16 * emsq + 146349.42 * eoc;
1158 g532 = -40023.880 + 170470.89 * em - 242699.48 * emsq + 115605.82 * eoc;
1161 sini2 = sinim * sinim;
1162 f220 = 0.75 * (1.0 + 2.0 * cosim + cosisq);
1164 f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
1165 f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
1166 f441 = 35.0 * sini2 * f220;
1167 f442 = 39.3750 * sini2 * sini2;
1168 f522 = 9.84375 * sinim *
1169 (sini2 * (1.0 - 2.0 * cosim - 5.0 * cosisq) +
1170 0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq));
1171 f523 = sinim * (4.92187512 * sini2 * (-2.0 - 4.0 * cosim + 10.0 * cosisq) +
1172 6.56250012 * (1.0 + 2.0 * cosim - 3.0 * cosisq));
1173 f542 = 29.53125 * sinim *
1174 (2.0 - 8.0 * cosim + cosisq * (-12.0 + 8.0 * cosim + 10.0 * cosisq));
1175 f543 = 29.53125 * sinim *
1176 (-2.0 - 8.0 * cosim + cosisq * (12.0 + 8.0 * cosim - 10.0 * cosisq));
1178 ainv2 = aonv * aonv;
1179 temp1 = 3.0 * xno2 * ainv2;
1180 temp = temp1 * root22;
1181 d2201 = temp * f220 * g201;
1182 d2211 = temp * f221 * g211;
1183 temp1 = temp1 * aonv;
1184 temp = temp1 * root32;
1185 d3210 = temp * f321 * g310;
1186 d3222 = temp * f322 * g322;
1187 temp1 = temp1 * aonv;
1188 temp = 2.0 * temp1 * root44;
1189 d4410 = temp * f441 * g410;
1190 d4422 = temp * f442 * g422;
1191 temp1 = temp1 * aonv;
1192 temp = temp1 * root52;
1193 d5220 = temp * f522 * g520;
1194 d5232 = temp * f523 * g532;
1195 temp = 2.0 * temp1 * root54;
1196 d5421 = temp * f542 * g521;
1197 d5433 = temp * f543 * g533;
1198 xlamo = fmod(mo + nodeo + nodeo - theta - theta, twopi);
1199 xfact = mdot + dmdt + 2.0 * (nodedot + dnodt - rptim) - no;
1207 g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
1208 g310 = 1.0 + 2.0 * emsq;
1209 g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
1210 f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
1211 f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
1213 f330 = 1.875 * f330 * f330 * f330;
1214 del1 = 3.0 * nm * nm * aonv * aonv;
1215 del2 = 2.0 * del1 * f220 * g200 * q22;
1216 del3 = 3.0 * del1 * f330 * g300 * q33 * aonv;
1217 del1 = del1 * f311 * g310 * q31 * aonv;
1218 xlamo = fmod(mo + nodeo + argpo - theta, twopi);
1219 xfact = mdot + xpidot - rptim + dmdt + domdt + dnodt - no;
1342 const double twopi = 2.0 *
pi;
1344 double delt, ft, theta, x2li, x2omi, xl, xldot, xnddt, xndt, xomi, g22, g32, g44, g52, g54,
1345 fasx2, fasx4, fasx6, rptim, step2, stepn, stepp;
1355 rptim = 4.37526908801129966e-3;
1362 theta = fmod(gsto + tc * rptim, twopi);
1365 inclm = inclm + didt * t;
1366 argpm = argpm + domdt * t;
1367 nodem = nodem + dnodt * t;
1390 if ((atime == 0.0) || (t * atime <= 0.0) || (fabs(t) < fabs(atime)))
1403 while (iretn == 381)
1409 xndt = del1 * sin(xli - fasx2) + del2 * sin(2.0 * (xli - fasx4)) +
1410 del3 * sin(3.0 * (xli - fasx6));
1411 xldot = xni + xfact;
1412 xnddt = del1 * cos(xli - fasx2) + 2.0 * del2 * cos(2.0 * (xli - fasx4)) +
1413 3.0 * del3 * cos(3.0 * (xli - fasx6));
1414 xnddt = xnddt * xldot;
1419 xomi = argpo + argpdot * atime;
1420 x2omi = xomi + xomi;
1422 xndt = d2201 * sin(x2omi + xli - g22) + d2211 * sin(xli - g22) +
1423 d3210 * sin(xomi + xli - g32) + d3222 * sin(-xomi + xli - g32) +
1424 d4410 * sin(x2omi + x2li - g44) + d4422 * sin(x2li - g44) +
1425 d5220 * sin(xomi + xli - g52) + d5232 * sin(-xomi + xli - g52) +
1426 d5421 * sin(xomi + x2li - g54) + d5433 * sin(-xomi + x2li - g54);
1427 xldot = xni + xfact;
1428 xnddt = d2201 * cos(x2omi + xli - g22) + d2211 * cos(xli - g22) +
1429 d3210 * cos(xomi + xli - g32) + d3222 * cos(-xomi + xli - g32) +
1430 d5220 * cos(xomi + xli - g52) + d5232 * cos(-xomi + xli - g52) +
1431 2.0 * (d4410 * cos(x2omi + x2li - g44) + d4422 * cos(x2li - g44) +
1432 d5421 * cos(xomi + x2li - g54) + d5433 * cos(-xomi + x2li - g54));
1433 xnddt = xnddt * xldot;
1438 if (fabs(t - atime) >= stepp)
1450 xli = xli + xldot * delt + xndt * step2;
1451 xni = xni + xndt * delt + xnddt * step2;
1452 atime = atime + delt;
1456 nm = xni + xndt * ft + xnddt * ft * ft * 0.5;
1457 xl = xli + xldot * ft + xndt * ft * ft * 0.5;
1460 mm = xl - 2.0 * nodem + 2.0 * theta;
1465 mm = xl - nodem - argpm + theta;
1547 double ak, d1, del, adel, po, x2o3, j2, xke, tumin, mu, radiusearthkm, j3, j4, j3oj2;
1550 ak = d1 = del = adel = po = x2o3 = j2 = xke = tumin = mu = radiusearthkm = j3 = j4 = j3oj2 =
1555 double ts70, tfrac, c1, thgr70, fk5r, c1p2p;
1556 const double twopi = 2.0 *
pi;
1560 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
1564 eccsq = ecco * ecco;
1565 omeosq = 1.0 - eccsq;
1566 rteosq = sqrt(omeosq);
1568 cosio2 = cosio * cosio;
1571 ak = pow(xke / no, x2o3);
1572 d1 = 0.75 * j2 * (3.0 * cosio2 - 1.0) / (rteosq * omeosq);
1573 del = d1 / (ak * ak);
1574 adel = ak * (1.0 - del * del - del * (1.0 / 3.0 + 134.0 * del * del / 81.0));
1575 del = d1 / (adel * adel);
1576 no = no / (1.0 + del);
1578 ao = pow(xke / no, x2o3);
1581 con42 = 1.0 - 5.0 * cosio2;
1582 con41 = -con42 - cosio2 - cosio2;
1585 rp = ao * (1.0 - ecco);
1593 ts70 = epoch - 7305.0;
1594 ds70 = floor(ts70 + 1.0e-8);
1595 tfrac = ts70 - ds70;
1597 c1 = 1.72027916940703639e-2;
1598 thgr70 = 1.7321343856509374;
1599 fk5r = 5.07551419432269442e-15;
1601 gsto = fmod(thgr70 + c1 * ds70 + c1p2p * tfrac + ts70 * ts70 * fk5r, twopi);
1603 gsto = gsto + twopi;
1606 gsto =
gstime(epoch + 2433281.5);
1695 const long int satn,
1697 const double xbstar,
1699 const double xargpo,
1700 const double xinclo,
1703 const double xnodeo,
1707 double ao, ainv, con42, cosio, sinio, cosio2, eccsq, omeosq, posq, rp, rteosq, cnodm, snodm,
1708 cosim, sinim, cosomm, sinomm, cc1sq, cc2, cc3, coef, coef1, cosio4, day, dndt, em, emsq,
1709 eeta, etasq, gam, argpm, nodem, inclm, mm, nm, perige, pinvsq, psisq, qzms24, rtemsq, s1,
1710 s2, s3, s4, s5, s6, s7, sfour, ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3, sz11, sz12,
1711 sz13, sz21, sz22, sz23, sz31, sz32, sz33, tc, temp, temp1, temp2, temp3, tsi, xpidot,
1712 xhdot1, z1, z2, z3, z11, z12, z13, z21, z22, z23, z31, z32, z33, qzms2t, ss, j2, j3oj2, j4,
1713 x2o3, r[3], v[3], tumin, mu, radiusearthkm, xke, j3, delmotemp, qzms2ttemp, qzms24temp;
1716 ao = ainv = con42 = cosio = sinio = cosio2 = eccsq = omeosq = posq = rp = rteosq = cnodm =
1717 snodm = cosim = sinim = cosomm = sinomm = cc1sq = cc2 = cc3 = coef = coef1 = cosio4 = day =
1718 dndt = em = emsq = eeta = etasq = gam = argpm = nodem = inclm = mm = nm = perige =
1719 pinvsq = psisq = qzms24 = rtemsq = s1 = s2 = s3 = s4 = s5 = s6 = s7 = sfour = ss1 =
1720 ss2 = ss3 = ss4 = ss5 = ss6 = ss7 = sz1 = sz2 = sz3 = sz11 = sz12 = sz13 =
1721 sz21 = sz22 = sz23 = sz31 = sz32 = sz33 = tc = temp = temp1 = temp2 =
1722 temp3 = tsi = xpidot = xhdot1 = z1 = z2 = z3 = z11 = z12 = z13 = z21 =
1723 z22 = z23 = z31 = z32 = z33 = qzms2t = ss = j2 = j3oj2 = j4 = x2o3 =
1724 tumin = mu = radiusearthkm = xke = j3 = delmotemp = qzms2ttemp =
1731 const double temp4 = 1.5e-12;
1824 satrec.
bstar = xbstar;
1825 satrec.
ecco = xecco;
1826 satrec.
argpo = xargpo;
1827 satrec.
inclo = xinclo;
1830 satrec.
nodeo = xnodeo;
1837 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
1838 ss = 78.0 / radiusearthkm + 1.0;
1840 qzms2ttemp = (120.0 - 78.0) / radiusearthkm;
1841 qzms2t = qzms2ttemp * qzms2ttemp * qzms2ttemp * qzms2ttemp;
1879 if ((omeosq >= 0.0) || (satrec.
no >= 0.0))
1882 if (rp < (220.0 / radiusearthkm + 1.0))
1886 perige = (rp - 1.0) * radiusearthkm;
1891 sfour = perige - 78.0;
1895 qzms24temp = (120.0 - sfour) / radiusearthkm;
1896 qzms24 = qzms24temp * qzms24temp * qzms24temp * qzms24temp;
1897 sfour = sfour / radiusearthkm + 1.0;
1899 pinvsq = 1.0 / posq;
1901 tsi = 1.0 / (ao - sfour);
1902 satrec.
eta = ao * satrec.
ecco * tsi;
1903 etasq = satrec.
eta * satrec.
eta;
1904 eeta = satrec.
ecco * satrec.
eta;
1905 psisq = fabs(1.0 - etasq);
1906 coef = qzms24 * pow(tsi, 4.0);
1907 coef1 = coef / pow(psisq, 3.5);
1908 cc2 = coef1 * satrec.
no *
1909 (ao * (1.0 + 1.5 * etasq + eeta * (4.0 + etasq)) +
1910 0.375 * j2 * tsi / psisq * satrec.
con41 * (8.0 + 3.0 * etasq * (8.0 + etasq)));
1913 if (satrec.
ecco > 1.0e-4)
1914 cc3 = -2.0 * coef * tsi * j3oj2 * satrec.
no * sinio / satrec.
ecco;
1915 satrec.
x1mth2 = 1.0 - cosio2;
1916 satrec.
cc4 = 2.0 * satrec.
no * coef1 * ao * omeosq *
1917 (satrec.
eta * (2.0 + 0.5 * etasq) + satrec.
ecco * (0.5 + 2.0 * etasq) -
1918 j2 * tsi / (ao * psisq) *
1919 (-3.0 * satrec.
con41 * (1.0 - 2.0 * eeta + etasq * (1.5 - 0.5 * eeta)) +
1920 0.75 * satrec.
x1mth2 * (2.0 * etasq - eeta * (1.0 + etasq)) *
1921 cos(2.0 * satrec.
argpo)));
1922 satrec.
cc5 = 2.0 * coef1 * ao * omeosq * (1.0 + 2.75 * (etasq + eeta) + eeta * etasq);
1923 cosio4 = cosio2 * cosio2;
1924 temp1 = 1.5 * j2 * pinvsq * satrec.
no;
1925 temp2 = 0.5 * temp1 * j2 * pinvsq;
1926 temp3 = -0.46875 * j4 * pinvsq * pinvsq * satrec.
no;
1927 satrec.
mdot = satrec.
no + 0.5 * temp1 * rteosq * satrec.
con41 +
1928 0.0625 * temp2 * rteosq * (13.0 - 78.0 * cosio2 + 137.0 * cosio4);
1929 satrec.
argpdot = -0.5 * temp1 * con42 +
1930 0.0625 * temp2 * (7.0 - 114.0 * cosio2 + 395.0 * cosio4) +
1931 temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4);
1932 xhdot1 = -temp1 * cosio;
1935 (0.5 * temp2 * (4.0 - 19.0 * cosio2) + 2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio;
1939 if (satrec.
ecco > 1.0e-4)
1940 satrec.
xmcof = -x2o3 * coef * satrec.
bstar / eeta;
1941 satrec.
nodecf = 3.5 * omeosq * xhdot1 * satrec.
cc1;
1944 if (fabs(cosio + 1.0) > 1.5e-12)
1945 satrec.
xlcof = -0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / (1.0 + cosio);
1947 satrec.
xlcof = -0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / temp4;
1948 satrec.
aycof = -0.5 * j3oj2 * sinio;
1950 delmotemp = 1.0 + satrec.
eta * cos(satrec.
mo);
1951 satrec.
delmo = delmotemp * delmotemp * delmotemp;
1953 satrec.
x7thm1 = 7.0 * cosio2 - 1.0;
1956 if ((2 *
pi / satrec.
no) >= 225.0)
1961 inclm = satrec.
inclo;
2172 if (satrec.
isimp != 1)
2174 cc1sq = satrec.
cc1 * satrec.
cc1;
2175 satrec.
d2 = 4.0 * ao * tsi * cc1sq;
2176 temp = satrec.
d2 * tsi * satrec.
cc1 / 3.0;
2177 satrec.
d3 = (17.0 * ao + sfour) * temp;
2178 satrec.
d4 = 0.5 * temp * ao * tsi * (221.0 * ao + 31.0 * sfour) * satrec.
cc1;
2179 satrec.
t3cof = satrec.
d2 + 2.0 * cc1sq;
2181 0.25 * (3.0 * satrec.
d3 + satrec.
cc1 * (12.0 * satrec.
d2 + 10.0 * cc1sq));
2183 0.2 * (3.0 * satrec.
d4 + 12.0 * satrec.
cc1 * satrec.
d3 +
2184 6.0 * satrec.
d2 * satrec.
d2 + 15.0 * cc1sq * (2.0 * satrec.
d2 + cc1sq));
2191 sgp4(whichconst, satrec, 0.0, r, v);
2288 double am, axnl, aynl, betal, cosim, cnod, cos2u, coseo1, cosi, cosip, cosisq, cossu, cosu,
2289 delm, delomg, em, emsq, ecose, el2, eo1, ep, esine, argpm, argpp, argpdf, pl,
2290 mrt = 0.0, mvt, rdotl, rl, rvdot, rvdotl, sinim, sin2u, sineo1, sini, sinip, sinsu, sinu,
2291 snod, su, t2, t3, t4, tem5, temp, temp1, temp2, tempa, tempe, templ, u, ux, uy, uz, vx, vy,
2292 vz, inclm, mm, nm, nodem, xinc, xincp, xl, xlm, mp, xmdf, xmx, xmy, nodedf, xnode, nodep,
2293 tc, dndt, twopi, x2o3, j2, j3, tumin, j4, xke, j3oj2, radiusearthkm, mu, vkmpersec,
2298 am = axnl = aynl = betal = cosim = cnod = cos2u = coseo1 = cosi = cosip = cosisq = cossu =
2299 cosu = delm = delomg = em = emsq = ecose = el2 = eo1 = ep = esine = argpm = argpp = argpdf =
2300 pl = mvt = rdotl = rl = rvdot = rvdotl = sinim = sin2u = sineo1 = sini = sinip = sinsu =
2301 sinu = snod = su = t2 = t3 = t4 = tem5 = temp = temp1 = temp2 = tempa = tempe =
2302 templ = u = ux = uy = uz = vx = vy = vz = inclm = mm = nm = nodem = xinc =
2303 xincp = xl = xlm = mp = xmdf = xmx = xmy = nodedf = xnode = nodep = tc =
2304 dndt = twopi = x2o3 = j2 = j3 = tumin = j4 = xke = j3oj2 =
2305 radiusearthkm = mu = vkmpersec = delmtemp = 0.0;
2311 const double temp4 = 1.5e-12;
2315 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
2316 vkmpersec = radiusearthkm * xke / 60.0;
2323 xmdf = satrec.
mo + satrec.
mdot * satrec.
t;
2328 t2 = satrec.
t * satrec.
t;
2329 nodem = nodedf + satrec.
nodecf * t2;
2330 tempa = 1.0 - satrec.
cc1 * satrec.
t;
2331 tempe = satrec.
bstar * satrec.
cc4 * satrec.
t;
2332 templ = satrec.
t2cof * t2;
2334 if (satrec.
isimp != 1)
2336 delomg = satrec.
omgcof * satrec.
t;
2338 delmtemp = 1.0 + satrec.
eta * cos(xmdf);
2339 delm = satrec.
xmcof * (delmtemp * delmtemp * delmtemp - satrec.
delmo);
2340 temp = delomg + delm;
2342 argpm = argpdf - temp;
2345 tempa = tempa - satrec.
d2 * t2 - satrec.
d3 * t3 - satrec.
d4 * t4;
2346 tempe = tempe + satrec.
bstar * satrec.
cc5 * (sin(mm) - satrec.
sinmao);
2347 templ = templ + satrec.
t3cof * t3 + t4 * (satrec.
t4cof + satrec.
t * satrec.
t5cof);
2352 inclm = satrec.
inclo;
2353 if (satrec.
method ==
'd')
2401 am = pow((xke / nm), x2o3) * tempa * tempa;
2402 nm = xke / pow(am, 1.5);
2407 if ((em >= 1.0) || (em < -0.001) )
2416 mm = mm + satrec.
no * templ;
2417 xlm = mm + argpm + nodem;
2421 nodem = fmod(nodem, twopi);
2422 argpm = fmod(argpm, twopi);
2423 xlm = fmod(xlm, twopi);
2424 mm = fmod(xlm - argpm - nodem, twopi);
2438 if (satrec.
method ==
'd')
2486 if ((ep < 0.0) || (ep > 1.0))
2495 if (satrec.
method ==
'd')
2499 satrec.
aycof = -0.5 * j3oj2 * sinip;
2501 if (fabs(cosip + 1.0) > 1.5e-12)
2502 satrec.
xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / (1.0 + cosip);
2504 satrec.
xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / temp4;
2506 axnl = ep * cos(argpp);
2507 temp = 1.0 / (am * (1.0 - ep * ep));
2508 aynl = ep * sin(argpp) + temp * satrec.
aycof;
2509 xl = mp + argpp + nodep + temp * satrec.
xlcof * axnl;
2512 u = fmod(xl - nodep, twopi);
2518 while ((fabs(tem5) >= 1.0e-12) && (ktr <= 10))
2522 tem5 = 1.0 - coseo1 * axnl - sineo1 * aynl;
2523 tem5 = (u - aynl * coseo1 + axnl * sineo1 - eo1) / tem5;
2524 if (fabs(tem5) >= 0.95)
2525 tem5 = tem5 > 0.0 ? 0.95 : -0.95;
2531 ecose = axnl * coseo1 + aynl * sineo1;
2532 esine = axnl * sineo1 - aynl * coseo1;
2533 el2 = axnl * axnl + aynl * aynl;
2534 pl = am * (1.0 - el2);
2543 rl = am * (1.0 - ecose);
2544 rdotl = sqrt(am) * esine / rl;
2545 rvdotl = sqrt(pl) / rl;
2546 betal = sqrt(1.0 - el2);
2547 temp = esine / (1.0 + betal);
2548 sinu = am / rl * (sineo1 - aynl - axnl * temp);
2549 cosu = am / rl * (coseo1 - axnl + aynl * temp);
2550 su = atan2(sinu, cosu);
2551 sin2u = (cosu + cosu) * sinu;
2552 cos2u = 1.0 - 2.0 * sinu * sinu;
2554 temp1 = 0.5 * j2 * temp;
2555 temp2 = temp1 * temp;
2558 if (satrec.
method ==
'd')
2560 cosisq = cosip * cosip;
2561 satrec.
con41 = 3.0 * cosisq - 1.0;
2562 satrec.
x1mth2 = 1.0 - cosisq;
2563 satrec.
x7thm1 = 7.0 * cosisq - 1.0;
2565 mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.
con41) + 0.5 * temp1 * satrec.
x1mth2 * cos2u;
2566 su = su - 0.25 * temp2 * satrec.
x7thm1 * sin2u;
2567 xnode = nodep + 1.5 * temp2 * cosip * sin2u;
2568 xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
2569 mvt = rdotl - nm * temp1 * satrec.
x1mth2 * sin2u / xke;
2570 rvdot = rvdotl + nm * temp1 * (satrec.
x1mth2 * cos2u + 1.5 * satrec.
con41) / xke;
2581 ux = xmx * sinsu + cnod * cossu;
2582 uy = xmy * sinsu + snod * cossu;
2584 vx = xmx * cossu - cnod * sinsu;
2585 vy = xmy * cossu - snod * sinsu;
2589 r[0] = (mrt * ux) * radiusearthkm;
2590 r[1] = (mrt * uy) * radiusearthkm;
2591 r[2] = (mrt * uz) * radiusearthkm;
2592 v[0] = (mvt * ux + rvdot * vx) * vkmpersec;
2593 v[1] = (mvt * uy + rvdot * vy) * vkmpersec;
2594 v[2] = (mvt * uz + rvdot * vz) * vkmpersec;
2636 const double twopi = 2.0 *
pi;
2637 const double deg2rad =
pi / 180.0;
2640 tut1 = (jdut1 - 2451545.0) / 36525.0;
2641 temp = -6.2e-6 * tut1 * tut1 * tut1 + 0.093104 * tut1 * tut1 +
2642 (876600.0 * 3600 + 8640184.812866) * tut1 + 67310.54841;
2643 temp = fmod(temp * deg2rad / 240.0, twopi);
2686 double& radiusearthkm,
2698 radiusearthkm = 6378.135;
2702 j3 = -0.00000253881;
2703 j4 = -0.00000165597;
2709 radiusearthkm = 6378.135;
2710 xke = 60.0 / sqrt(radiusearthkm * radiusearthkm * radiusearthkm / mu);
2713 j3 = -0.00000253881;
2714 j4 = -0.00000165597;
2720 radiusearthkm = 6378.137;
2721 xke = 60.0 / sqrt(radiusearthkm * radiusearthkm * radiusearthkm / mu);
2723 j2 = 0.00108262998905;
2724 j3 = -0.00000253215306;
2725 j4 = -0.00000161098761;
2729 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)