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,
449 zf = zm + 2.0 * zes * sin(zm);
451 f2 = 0.5 * sinzf * sinzf - 0.25;
452 f3 = -0.5 * sinzf * cos(zf);
453 ses = se2 * f2 + se3 * f3;
454 sis = si2 * f2 + si3 * f3;
455 sls = sl2 * f2 + sl3 * f3 + sl4 * sinzf;
456 sghs = sgh2 * f2 + sgh3 * f3 + sgh4 * sinzf;
457 shs = sh2 * f2 + sh3 * f3;
463 zf = zm + 2.0 * zel * sin(zm);
465 f2 = 0.5 * sinzf * sinzf - 0.25;
466 f3 = -0.5 * sinzf * cos(zf);
467 sel = ee2 * f2 + e3 * f3;
468 sil = xi2 * f2 + xi3 * f3;
469 sll = xl2 * f2 + xl3 * f3 + xl4 * sinzf;
470 sghl = xgh2 * f2 + xgh3 * f3 + xgh4 * sinzf;
471 shll = xh2 * f2 + xh3 * f3;
485 inclp = inclp + pinc;
502 pgh = pgh - cosip * ph;
512 alfdp = sinip * sinop;
513 betdp = sinip * cosop;
514 dalf = ph * cosop + pinc * cosip * sinop;
515 dbet = -ph * sinop + pinc * cosip * cosop;
516 alfdp = alfdp + dalf;
517 betdp = betdp + dbet;
518 nodep = fmod(nodep, twopi);
521 if ((nodep < 0.0) && (opsmode ==
'a'))
523 nodep = nodep + twopi;
525 xls = mp + argpp + cosip * nodep;
526 dls = pl + pgh - pinc * nodep * sinip;
529 nodep = atan2(alfdp, betdp);
532 if ((nodep < 0.0) && (opsmode ==
'a'))
534 nodep = nodep + twopi;
536 if (fabs(xnoh - nodep) >
pi)
540 nodep = nodep + twopi;
544 nodep = nodep - twopi;
548 argpp = xls - mp - cosip * nodep;
712 const double zes = 0.01675;
713 const double zel = 0.05490;
714 const double c1ss = 2.9864797e-6;
715 const double c1l = 4.7968065e-7;
716 const double zsinis = 0.39785416;
717 const double zcosis = 0.91744867;
718 const double zcosgs = 0.1945905;
719 const double zsings = -0.98088458;
720 const double twopi = 2.0 *
pi;
724 double a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, betasq, cc, ctem, stem, x1, x2, x3, x4, x5, x6,
725 x7, x8, xnodce, xnoi, zcosg, zcosgl, zcosh, zcoshl, zcosi, zcosil, zsing, zsingl, zsinh,
726 zsinhl, zsini, zsinil, zx, zy;
738 rtemsq = sqrt(betasq);
746 day = epoch + 18261.5 + tc / 1440.0;
747 xnodce = fmod(4.5236020 - 9.2422029e-4 * day, twopi);
750 zcosil = 0.91375164 - 0.03568096 * ctem;
751 zsinil = sqrt(1.0 - zcosil * zcosil);
752 zsinhl = 0.089683511 * stem / zsinil;
753 zcoshl = sqrt(1.0 - zsinhl * zsinhl);
754 gam = 5.8351514 + 0.0019443680 * day;
755 zx = 0.39785416 * stem / zsinil;
756 zy = zcoshl * ctem + 0.91744867 * zsinhl * stem;
758 zx = gam + zx - xnodce;
772 for (lsflg = 1; lsflg <= 2; lsflg++)
774 a1 = zcosg * zcosh + zsing * zcosi * zsinh;
775 a3 = -zsing * zcosh + zcosg * zcosi * zsinh;
776 a7 = -zcosg * zsinh + zsing * zcosi * zcosh;
778 a9 = zsing * zsinh + zcosg * zcosi * zcosh;
780 a2 = cosim * a7 + sinim * a8;
781 a4 = cosim * a9 + sinim * a10;
782 a5 = -sinim * a7 + cosim * a8;
783 a6 = -sinim * a9 + cosim * a10;
785 x1 = a1 * cosomm + a2 * sinomm;
786 x2 = a3 * cosomm + a4 * sinomm;
787 x3 = -a1 * sinomm + a2 * cosomm;
788 x4 = -a3 * sinomm + a4 * cosomm;
794 z31 = 12.0 * x1 * x1 - 3.0 * x3 * x3;
795 z32 = 24.0 * x1 * x2 - 6.0 * x3 * x4;
796 z33 = 12.0 * x2 * x2 - 3.0 * x4 * x4;
797 z1 = 3.0 * (a1 * a1 + a2 * a2) + z31 * emsq;
798 z2 = 6.0 * (a1 * a3 + a2 * a4) + z32 * emsq;
799 z3 = 3.0 * (a3 * a3 + a4 * a4) + z33 * emsq;
800 z11 = -6.0 * a1 * a5 + emsq * (-24.0 * x1 * x7 - 6.0 * x3 * x5);
801 z12 = -6.0 * (a1 * a6 + a3 * a5) +
802 emsq * (-24.0 * (x2 * x7 + x1 * x8) - 6.0 * (x3 * x6 + x4 * x5));
803 z13 = -6.0 * a3 * a6 + emsq * (-24.0 * x2 * x8 - 6.0 * x4 * x6);
804 z21 = 6.0 * a2 * a5 + emsq * (24.0 * x1 * x5 - 6.0 * x3 * x7);
805 z22 = 6.0 * (a4 * a5 + a2 * a6) +
806 emsq * (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
807 z23 = 6.0 * a4 * a6 + emsq * (24.0 * x2 * x6 - 6.0 * x4 * x8);
808 z1 = z1 + z1 + betasq * z31;
809 z2 = z2 + z2 + betasq * z32;
810 z3 = z3 + z3 + betasq * z33;
812 s2 = -0.5 * s3 / rtemsq;
814 s1 = -15.0 * em * s4;
815 s5 = x1 * x3 + x2 * x4;
816 s6 = x2 * x3 + x1 * x4;
817 s7 = x2 * x4 - x1 * x3;
845 zcosh = zcoshl * cnodm + zsinhl * snodm;
846 zsinh = snodm * zcoshl - cnodm * zsinhl;
851 zmol = fmod(4.7199672 + 0.22997150 * day - gam, twopi);
852 zmos = fmod(6.2565837 + 0.017201977 * day, twopi);
855 se2 = 2.0 * ss1 * ss6;
856 se3 = 2.0 * ss1 * ss7;
857 si2 = 2.0 * ss2 * sz12;
858 si3 = 2.0 * ss2 * (sz13 - sz11);
859 sl2 = -2.0 * ss3 * sz2;
860 sl3 = -2.0 * ss3 * (sz3 - sz1);
861 sl4 = -2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes;
862 sgh2 = 2.0 * ss4 * sz32;
863 sgh3 = 2.0 * ss4 * (sz33 - sz31);
864 sgh4 = -18.0 * ss4 * zes;
865 sh2 = -2.0 * ss2 * sz22;
866 sh3 = -2.0 * ss2 * (sz23 - sz21);
871 xi2 = 2.0 * s2 * z12;
872 xi3 = 2.0 * s2 * (z13 - z11);
873 xl2 = -2.0 * s3 * z2;
874 xl3 = -2.0 * s3 * (z3 - z1);
875 xl4 = -2.0 * s3 * (-21.0 - 9.0 * emsq) * zel;
876 xgh2 = 2.0 * s4 * z32;
877 xgh3 = 2.0 * s4 * (z33 - z31);
878 xgh4 = -18.0 * s4 * zel;
879 xh2 = -2.0 * s2 * z22;
880 xh3 = -2.0 * s2 * (z23 - z21);
1039 const double twopi = 2.0 *
pi;
1041 double ainv2, aonv = 0.0, cosisq, eoc, f220, f221, f311, f321, f322, f330, f441, f442, f522,
1042 f523, f542, f543, g200, g201, g211, g300, g310, g322, g410, g422, g520, g521,
1043 g532, g533, ses, sgs, sghl, sghs, shs, shll, sis, sini2, sls, temp, temp1, theta,
1044 xno2, q22, q31, q33, root22, root44, root54, rptim, root32, root52, x2o3, xke,
1045 znl, emo, zns, emsqo, tumin, mu, radiusearthkm, j2, j3, j4, j3oj2;
1048 ainv2 = cosisq = eoc = f220 = f221 = f311 = f321 = f322 = f330 = f441 = f442 = f522 = f523 =
1049 f542 = f543 = g200 = g201 = g211 = g300 = g310 = g322 = g410 = g422 = g520 = g521 = g532 =
1050 g533 = ses = sgs = sghl = sghs = shs = shll = sis = sini2 = sls = temp = temp1 = theta =
1051 xno2 = q22 = q31 = q33 = root22 = root44 = root54 = rptim = root32 = root52 = x2o3 =
1052 xke = znl = emo = zns = emsqo = tumin = mu = radiusearthkm = j2 = j3 = j4 =
1058 root22 = 1.7891679e-6;
1059 root44 = 7.3636953e-9;
1060 root54 = 2.1765803e-9;
1061 rptim = 4.37526908801129966e-3;
1062 root32 = 3.7393792e-7;
1063 root52 = 1.1428639e-7;
1069 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
1073 if ((nm < 0.0052359877) && (nm > 0.0034906585))
1077 if ((nm >= 8.26e-3) && (nm <= 9.24e-3) && (em >= 0.5))
1083 ses = ss1 * zns * ss5;
1084 sis = ss2 * zns * (sz11 + sz13);
1085 sls = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
1086 sghs = ss4 * zns * (sz31 + sz33 - 6.0);
1087 shs = -zns * ss2 * (sz21 + sz23);
1089 if ((inclm < 5.2359877e-2) || (inclm >
pi - 5.2359877e-2))
1097 sgs = sghs - cosim * shs;
1100 dedt = ses + s1 * znl * s5;
1101 didt = sis + s2 * znl * (z11 + z13);
1102 dmdt = sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq);
1103 sghl = s4 * znl * (z31 + z33 - 6.0);
1104 shll = -znl * s2 * (z21 + z23);
1106 if ((inclm < 5.2359877e-2) || (inclm >
pi - 5.2359877e-2))
1114 domdt = domdt - cosim / sinim * shll;
1115 dnodt = dnodt + shll / sinim;
1120 theta = fmod(gsto + tc * rptim, twopi);
1122 inclm = inclm + didt * t;
1123 argpm = argpm + domdt * t;
1124 nodem = nodem + dnodt * t;
1138 aonv = pow(nm / xke, x2o3);
1143 cosisq = cosim * cosim;
1149 g201 = -0.306 - (em - 0.64) * 0.440;
1153 g211 = 3.616 - 13.2470 * em + 16.2900 * emsq;
1154 g310 = -19.302 + 117.3900 * em - 228.4190 * emsq + 156.5910 * eoc;
1155 g322 = -18.9068 + 109.7927 * em - 214.6334 * emsq + 146.5816 * eoc;
1156 g410 = -41.122 + 242.6940 * em - 471.0940 * emsq + 313.9530 * eoc;
1157 g422 = -146.407 + 841.8800 * em - 1629.014 * emsq + 1083.4350 * eoc;
1158 g520 = -532.114 + 3017.977 * em - 5740.032 * emsq + 3708.2760 * eoc;
1162 g211 = -72.099 + 331.819 * em - 508.738 * emsq + 266.724 * eoc;
1163 g310 = -346.844 + 1582.851 * em - 2415.925 * emsq + 1246.113 * eoc;
1164 g322 = -342.585 + 1554.908 * em - 2366.899 * emsq + 1215.972 * eoc;
1165 g410 = -1052.797 + 4758.686 * em - 7193.992 * emsq + 3651.957 * eoc;
1166 g422 = -3581.690 + 16178.110 * em - 24462.770 * emsq + 12422.520 * eoc;
1169 g520 = -5149.66 + 29936.92 * em - 54087.36 * emsq + 31324.56 * eoc;
1173 g520 = 1464.74 - 4664.75 * em + 3763.64 * emsq;
1178 g533 = -919.22770 + 4988.6100 * em - 9064.7700 * emsq + 5542.21 * eoc;
1179 g521 = -822.71072 + 4568.6173 * em - 8491.4146 * emsq + 5337.524 * eoc;
1180 g532 = -853.66600 + 4690.2500 * em - 8624.7700 * emsq + 5341.4 * eoc;
1184 g533 = -37995.780 + 161616.52 * em - 229838.20 * emsq + 109377.94 * eoc;
1185 g521 = -51752.104 + 218913.95 * em - 309468.16 * emsq + 146349.42 * eoc;
1186 g532 = -40023.880 + 170470.89 * em - 242699.48 * emsq + 115605.82 * eoc;
1189 sini2 = sinim * sinim;
1190 f220 = 0.75 * (1.0 + 2.0 * cosim + cosisq);
1192 f321 = 1.875 * sinim * (1.0 - 2.0 * cosim - 3.0 * cosisq);
1193 f322 = -1.875 * sinim * (1.0 + 2.0 * cosim - 3.0 * cosisq);
1194 f441 = 35.0 * sini2 * f220;
1195 f442 = 39.3750 * sini2 * sini2;
1196 f522 = 9.84375 * sinim *
1197 (sini2 * (1.0 - 2.0 * cosim - 5.0 * cosisq) +
1198 0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq));
1199 f523 = sinim * (4.92187512 * sini2 * (-2.0 - 4.0 * cosim + 10.0 * cosisq) +
1200 6.56250012 * (1.0 + 2.0 * cosim - 3.0 * cosisq));
1201 f542 = 29.53125 * sinim *
1202 (2.0 - 8.0 * cosim + cosisq * (-12.0 + 8.0 * cosim + 10.0 * cosisq));
1203 f543 = 29.53125 * sinim *
1204 (-2.0 - 8.0 * cosim + cosisq * (12.0 + 8.0 * cosim - 10.0 * cosisq));
1206 ainv2 = aonv * aonv;
1207 temp1 = 3.0 * xno2 * ainv2;
1208 temp = temp1 * root22;
1209 d2201 = temp * f220 * g201;
1210 d2211 = temp * f221 * g211;
1211 temp1 = temp1 * aonv;
1212 temp = temp1 * root32;
1213 d3210 = temp * f321 * g310;
1214 d3222 = temp * f322 * g322;
1215 temp1 = temp1 * aonv;
1216 temp = 2.0 * temp1 * root44;
1217 d4410 = temp * f441 * g410;
1218 d4422 = temp * f442 * g422;
1219 temp1 = temp1 * aonv;
1220 temp = temp1 * root52;
1221 d5220 = temp * f522 * g520;
1222 d5232 = temp * f523 * g532;
1223 temp = 2.0 * temp1 * root54;
1224 d5421 = temp * f542 * g521;
1225 d5433 = temp * f543 * g533;
1226 xlamo = fmod(mo + nodeo + nodeo - theta - theta, twopi);
1227 xfact = mdot + dmdt + 2.0 * (nodedot + dnodt - rptim) - no;
1235 g200 = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
1236 g310 = 1.0 + 2.0 * emsq;
1237 g300 = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
1238 f220 = 0.75 * (1.0 + cosim) * (1.0 + cosim);
1239 f311 = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
1241 f330 = 1.875 * f330 * f330 * f330;
1242 del1 = 3.0 * nm * nm * aonv * aonv;
1243 del2 = 2.0 * del1 * f220 * g200 * q22;
1244 del3 = 3.0 * del1 * f330 * g300 * q33 * aonv;
1245 del1 = del1 * f311 * g310 * q31 * aonv;
1246 xlamo = fmod(mo + nodeo + argpo - theta, twopi);
1247 xfact = mdot + xpidot - rptim + dmdt + domdt + dnodt - no;
1370 const double twopi = 2.0 *
pi;
1372 double delt, ft, theta, x2li, x2omi, xl, xldot, xnddt, xndt, xomi, g22, g32, g44, g52, g54,
1373 fasx2, fasx4, fasx6, rptim, step2, stepn, stepp;
1383 rptim = 4.37526908801129966e-3;
1390 theta = fmod(gsto + tc * rptim, twopi);
1393 inclm = inclm + didt * t;
1394 argpm = argpm + domdt * t;
1395 nodem = nodem + dnodt * t;
1418 if ((atime == 0.0) || (t * atime <= 0.0) || (fabs(t) < fabs(atime)))
1435 while (iretn == 381)
1441 xndt = del1 * sin(xli - fasx2) + del2 * sin(2.0 * (xli - fasx4)) +
1442 del3 * sin(3.0 * (xli - fasx6));
1443 xldot = xni + xfact;
1444 xnddt = del1 * cos(xli - fasx2) + 2.0 * del2 * cos(2.0 * (xli - fasx4)) +
1445 3.0 * del3 * cos(3.0 * (xli - fasx6));
1446 xnddt = xnddt * xldot;
1451 xomi = argpo + argpdot * atime;
1452 x2omi = xomi + xomi;
1454 xndt = d2201 * sin(x2omi + xli - g22) + d2211 * sin(xli - g22) +
1455 d3210 * sin(xomi + xli - g32) + d3222 * sin(-xomi + xli - g32) +
1456 d4410 * sin(x2omi + x2li - g44) + d4422 * sin(x2li - g44) +
1457 d5220 * sin(xomi + xli - g52) + d5232 * sin(-xomi + xli - g52) +
1458 d5421 * sin(xomi + x2li - g54) + d5433 * sin(-xomi + x2li - g54);
1459 xldot = xni + xfact;
1460 xnddt = d2201 * cos(x2omi + xli - g22) + d2211 * cos(xli - g22) +
1461 d3210 * cos(xomi + xli - g32) + d3222 * cos(-xomi + xli - g32) +
1462 d5220 * cos(xomi + xli - g52) + d5232 * cos(-xomi + xli - g52) +
1463 2.0 * (d4410 * cos(x2omi + x2li - g44) + d4422 * cos(x2li - g44) +
1464 d5421 * cos(xomi + x2li - g54) + d5433 * cos(-xomi + x2li - g54));
1465 xnddt = xnddt * xldot;
1470 if (fabs(t - atime) >= stepp)
1482 xli = xli + xldot * delt + xndt * step2;
1483 xni = xni + xndt * delt + xnddt * step2;
1484 atime = atime + delt;
1488 nm = xni + xndt * ft + xnddt * ft * ft * 0.5;
1489 xl = xli + xldot * ft + xndt * ft * ft * 0.5;
1492 mm = xl - 2.0 * nodem + 2.0 * theta;
1497 mm = xl - nodem - argpm + theta;
1579 double ak, d1, del, adel, po, x2o3, j2, xke, tumin, mu, radiusearthkm, j3, j4, j3oj2;
1582 ak = d1 = del = adel = po = x2o3 = j2 = xke = tumin = mu = radiusearthkm = j3 = j4 = j3oj2 =
1587 double ts70, tfrac, c1, thgr70, fk5r, c1p2p;
1588 const double twopi = 2.0 *
pi;
1592 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
1596 eccsq = ecco * ecco;
1597 omeosq = 1.0 - eccsq;
1598 rteosq = sqrt(omeosq);
1600 cosio2 = cosio * cosio;
1603 ak = pow(xke / no, x2o3);
1604 d1 = 0.75 * j2 * (3.0 * cosio2 - 1.0) / (rteosq * omeosq);
1605 del = d1 / (ak * ak);
1606 adel = ak * (1.0 - del * del - del * (1.0 / 3.0 + 134.0 * del * del / 81.0));
1607 del = d1 / (adel * adel);
1608 no = no / (1.0 + del);
1610 ao = pow(xke / no, x2o3);
1613 con42 = 1.0 - 5.0 * cosio2;
1614 con41 = -con42 - cosio2 - cosio2;
1617 rp = ao * (1.0 - ecco);
1625 ts70 = epoch - 7305.0;
1626 ds70 = floor(ts70 + 1.0e-8);
1627 tfrac = ts70 - ds70;
1629 c1 = 1.72027916940703639e-2;
1630 thgr70 = 1.7321343856509374;
1631 fk5r = 5.07551419432269442e-15;
1633 gsto = fmod(thgr70 + c1 * ds70 + c1p2p * tfrac + ts70 * ts70 * fk5r, twopi);
1636 gsto = gsto + twopi;
1641 gsto =
gstime(epoch + 2433281.5);
1731 const long int satn,
1733 const double xbstar,
1735 const double xargpo,
1736 const double xinclo,
1739 const double xnodeo,
1743 double ao, ainv, con42, cosio, sinio, cosio2, eccsq, omeosq, posq, rp, rteosq, cnodm, snodm,
1744 cosim, sinim, cosomm, sinomm, cc1sq, cc2, cc3, coef, coef1, cosio4, day, dndt, em, emsq,
1745 eeta, etasq, gam, argpm, nodem, inclm, mm, nm, perige, pinvsq, psisq, qzms24, rtemsq, s1,
1746 s2, s3, s4, s5, s6, s7, sfour, ss1, ss2, ss3, ss4, ss5, ss6, ss7, sz1, sz2, sz3, sz11, sz12,
1747 sz13, sz21, sz22, sz23, sz31, sz32, sz33, tc, temp, temp1, temp2, temp3, tsi, xpidot,
1748 xhdot1, z1, z2, z3, z11, z12, z13, z21, z22, z23, z31, z32, z33, qzms2t, ss, j2, j3oj2, j4,
1749 x2o3, r[3], v[3], tumin, mu, radiusearthkm, xke, j3, delmotemp, qzms2ttemp, qzms24temp;
1752 ao = ainv = con42 = cosio = sinio = cosio2 = eccsq = omeosq = posq = rp = rteosq = cnodm =
1753 snodm = cosim = sinim = cosomm = sinomm = cc1sq = cc2 = cc3 = coef = coef1 = cosio4 = day =
1754 dndt = em = emsq = eeta = etasq = gam = argpm = nodem = inclm = mm = nm = perige =
1755 pinvsq = psisq = qzms24 = rtemsq = s1 = s2 = s3 = s4 = s5 = s6 = s7 = sfour = ss1 =
1756 ss2 = ss3 = ss4 = ss5 = ss6 = ss7 = sz1 = sz2 = sz3 = sz11 = sz12 = sz13 =
1757 sz21 = sz22 = sz23 = sz31 = sz32 = sz33 = tc = temp = temp1 = temp2 =
1758 temp3 = tsi = xpidot = xhdot1 = z1 = z2 = z3 = z11 = z12 = z13 = z21 =
1759 z22 = z23 = z31 = z32 = z33 = qzms2t = ss = j2 = j3oj2 = j4 = x2o3 =
1760 tumin = mu = radiusearthkm = xke = j3 = delmotemp = qzms2ttemp =
1767 const double temp4 = 1.5e-12;
1860 satrec.
bstar = xbstar;
1861 satrec.
ecco = xecco;
1862 satrec.
argpo = xargpo;
1863 satrec.
inclo = xinclo;
1866 satrec.
nodeo = xnodeo;
1873 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
1874 ss = 78.0 / radiusearthkm + 1.0;
1876 qzms2ttemp = (120.0 - 78.0) / radiusearthkm;
1877 qzms2t = qzms2ttemp * qzms2ttemp * qzms2ttemp * qzms2ttemp;
1915 if ((omeosq >= 0.0) || (satrec.
no >= 0.0))
1918 if (rp < (220.0 / radiusearthkm + 1.0))
1924 perige = (rp - 1.0) * radiusearthkm;
1929 sfour = perige - 78.0;
1935 qzms24temp = (120.0 - sfour) / radiusearthkm;
1936 qzms24 = qzms24temp * qzms24temp * qzms24temp * qzms24temp;
1937 sfour = sfour / radiusearthkm + 1.0;
1939 pinvsq = 1.0 / posq;
1941 tsi = 1.0 / (ao - sfour);
1942 satrec.
eta = ao * satrec.
ecco * tsi;
1943 etasq = satrec.
eta * satrec.
eta;
1944 eeta = satrec.
ecco * satrec.
eta;
1945 psisq = fabs(1.0 - etasq);
1946 coef = qzms24 * pow(tsi, 4.0);
1947 coef1 = coef / pow(psisq, 3.5);
1948 cc2 = coef1 * satrec.
no *
1949 (ao * (1.0 + 1.5 * etasq + eeta * (4.0 + etasq)) +
1950 0.375 * j2 * tsi / psisq * satrec.
con41 * (8.0 + 3.0 * etasq * (8.0 + etasq)));
1953 if (satrec.
ecco > 1.0e-4)
1955 cc3 = -2.0 * coef * tsi * j3oj2 * satrec.
no * sinio / satrec.
ecco;
1957 satrec.
x1mth2 = 1.0 - cosio2;
1958 satrec.
cc4 = 2.0 * satrec.
no * coef1 * ao * omeosq *
1959 (satrec.
eta * (2.0 + 0.5 * etasq) + satrec.
ecco * (0.5 + 2.0 * etasq) -
1960 j2 * tsi / (ao * psisq) *
1961 (-3.0 * satrec.
con41 * (1.0 - 2.0 * eeta + etasq * (1.5 - 0.5 * eeta)) +
1962 0.75 * satrec.
x1mth2 * (2.0 * etasq - eeta * (1.0 + etasq)) *
1963 cos(2.0 * satrec.
argpo)));
1964 satrec.
cc5 = 2.0 * coef1 * ao * omeosq * (1.0 + 2.75 * (etasq + eeta) + eeta * etasq);
1965 cosio4 = cosio2 * cosio2;
1966 temp1 = 1.5 * j2 * pinvsq * satrec.
no;
1967 temp2 = 0.5 * temp1 * j2 * pinvsq;
1968 temp3 = -0.46875 * j4 * pinvsq * pinvsq * satrec.
no;
1969 satrec.
mdot = satrec.
no + 0.5 * temp1 * rteosq * satrec.
con41 +
1970 0.0625 * temp2 * rteosq * (13.0 - 78.0 * cosio2 + 137.0 * cosio4);
1971 satrec.
argpdot = -0.5 * temp1 * con42 +
1972 0.0625 * temp2 * (7.0 - 114.0 * cosio2 + 395.0 * cosio4) +
1973 temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4);
1974 xhdot1 = -temp1 * cosio;
1977 (0.5 * temp2 * (4.0 - 19.0 * cosio2) + 2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio;
1981 if (satrec.
ecco > 1.0e-4)
1983 satrec.
xmcof = -x2o3 * coef * satrec.
bstar / eeta;
1985 satrec.
nodecf = 3.5 * omeosq * xhdot1 * satrec.
cc1;
1988 if (fabs(cosio + 1.0) > 1.5e-12)
1990 satrec.
xlcof = -0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / (1.0 + cosio);
1994 satrec.
xlcof = -0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / temp4;
1996 satrec.
aycof = -0.5 * j3oj2 * sinio;
1998 delmotemp = 1.0 + satrec.
eta * cos(satrec.
mo);
1999 satrec.
delmo = delmotemp * delmotemp * delmotemp;
2001 satrec.
x7thm1 = 7.0 * cosio2 - 1.0;
2004 if ((2 *
pi / satrec.
no) >= 225.0)
2009 inclm = satrec.
inclo;
2220 if (satrec.
isimp != 1)
2222 cc1sq = satrec.
cc1 * satrec.
cc1;
2223 satrec.
d2 = 4.0 * ao * tsi * cc1sq;
2224 temp = satrec.
d2 * tsi * satrec.
cc1 / 3.0;
2225 satrec.
d3 = (17.0 * ao + sfour) * temp;
2226 satrec.
d4 = 0.5 * temp * ao * tsi * (221.0 * ao + 31.0 * sfour) * satrec.
cc1;
2227 satrec.
t3cof = satrec.
d2 + 2.0 * cc1sq;
2229 0.25 * (3.0 * satrec.
d3 + satrec.
cc1 * (12.0 * satrec.
d2 + 10.0 * cc1sq));
2231 0.2 * (3.0 * satrec.
d4 + 12.0 * satrec.
cc1 * satrec.
d3 +
2232 6.0 * satrec.
d2 * satrec.
d2 + 15.0 * cc1sq * (2.0 * satrec.
d2 + cc1sq));
2239 sgp4(whichconst, satrec, 0.0, r, v);
2336 double am, axnl, aynl, betal, cosim, cnod, cos2u, coseo1, cosi, cosip, cosisq, cossu, cosu,
2337 delm, delomg, em, emsq, ecose, el2, eo1, ep, esine, argpm, argpp, argpdf, pl,
2338 mrt = 0.0, mvt, rdotl, rl, rvdot, rvdotl, sinim, sin2u, sineo1, sini, sinip, sinsu, sinu,
2339 snod, su, t2, t3, t4, tem5, temp, temp1, temp2, tempa, tempe, templ, u, ux, uy, uz, vx, vy,
2340 vz, inclm, mm, nm, nodem, xinc, xincp, xl, xlm, mp, xmdf, xmx, xmy, nodedf, xnode, nodep,
2341 tc, dndt, twopi, x2o3, j2, j3, tumin, j4, xke, j3oj2, radiusearthkm, mu, vkmpersec,
2346 am = axnl = aynl = betal = cosim = cnod = cos2u = coseo1 = cosi = cosip = cosisq = cossu =
2347 cosu = delm = delomg = em = emsq = ecose = el2 = eo1 = ep = esine = argpm = argpp = argpdf =
2348 pl = mvt = rdotl = rl = rvdot = rvdotl = sinim = sin2u = sineo1 = sini = sinip = sinsu =
2349 sinu = snod = su = t2 = t3 = t4 = tem5 = temp = temp1 = temp2 = tempa = tempe =
2350 templ = u = ux = uy = uz = vx = vy = vz = inclm = mm = nm = nodem = xinc =
2351 xincp = xl = xlm = mp = xmdf = xmx = xmy = nodedf = xnode = nodep = tc =
2352 dndt = twopi = x2o3 = j2 = j3 = tumin = j4 = xke = j3oj2 =
2353 radiusearthkm = mu = vkmpersec = delmtemp = 0.0;
2359 const double temp4 = 1.5e-12;
2363 getgravconst(whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2);
2364 vkmpersec = radiusearthkm * xke / 60.0;
2371 xmdf = satrec.
mo + satrec.
mdot * satrec.
t;
2376 t2 = satrec.
t * satrec.
t;
2377 nodem = nodedf + satrec.
nodecf * t2;
2378 tempa = 1.0 - satrec.
cc1 * satrec.
t;
2379 tempe = satrec.
bstar * satrec.
cc4 * satrec.
t;
2380 templ = satrec.
t2cof * t2;
2382 if (satrec.
isimp != 1)
2384 delomg = satrec.
omgcof * satrec.
t;
2386 delmtemp = 1.0 + satrec.
eta * cos(xmdf);
2387 delm = satrec.
xmcof * (delmtemp * delmtemp * delmtemp - satrec.
delmo);
2388 temp = delomg + delm;
2390 argpm = argpdf - temp;
2393 tempa = tempa - satrec.
d2 * t2 - satrec.
d3 * t3 - satrec.
d4 * t4;
2394 tempe = tempe + satrec.
bstar * satrec.
cc5 * (sin(mm) - satrec.
sinmao);
2395 templ = templ + satrec.
t3cof * t3 + t4 * (satrec.
t4cof + satrec.
t * satrec.
t5cof);
2400 inclm = satrec.
inclo;
2401 if (satrec.
method ==
'd')
2449 am = pow((xke / nm), x2o3) * tempa * tempa;
2450 nm = xke / pow(am, 1.5);
2455 if ((em >= 1.0) || (em < -0.001) )
2466 mm = mm + satrec.
no * templ;
2467 xlm = mm + argpm + nodem;
2471 nodem = fmod(nodem, twopi);
2472 argpm = fmod(argpm, twopi);
2473 xlm = fmod(xlm, twopi);
2474 mm = fmod(xlm - argpm - nodem, twopi);
2488 if (satrec.
method ==
'd')
2536 if ((ep < 0.0) || (ep > 1.0))
2545 if (satrec.
method ==
'd')
2549 satrec.
aycof = -0.5 * j3oj2 * sinip;
2551 if (fabs(cosip + 1.0) > 1.5e-12)
2553 satrec.
xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / (1.0 + cosip);
2557 satrec.
xlcof = -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / temp4;
2560 axnl = ep * cos(argpp);
2561 temp = 1.0 / (am * (1.0 - ep * ep));
2562 aynl = ep * sin(argpp) + temp * satrec.
aycof;
2563 xl = mp + argpp + nodep + temp * satrec.
xlcof * axnl;
2566 u = fmod(xl - nodep, twopi);
2572 while ((fabs(tem5) >= 1.0e-12) && (ktr <= 10))
2576 tem5 = 1.0 - coseo1 * axnl - sineo1 * aynl;
2577 tem5 = (u - aynl * coseo1 + axnl * sineo1 - eo1) / tem5;
2578 if (fabs(tem5) >= 0.95)
2580 tem5 = tem5 > 0.0 ? 0.95 : -0.95;
2587 ecose = axnl * coseo1 + aynl * sineo1;
2588 esine = axnl * sineo1 - aynl * coseo1;
2589 el2 = axnl * axnl + aynl * aynl;
2590 pl = am * (1.0 - el2);
2599 rl = am * (1.0 - ecose);
2600 rdotl = sqrt(am) * esine / rl;
2601 rvdotl = sqrt(pl) / rl;
2602 betal = sqrt(1.0 - el2);
2603 temp = esine / (1.0 + betal);
2604 sinu = am / rl * (sineo1 - aynl - axnl * temp);
2605 cosu = am / rl * (coseo1 - axnl + aynl * temp);
2606 su = atan2(sinu, cosu);
2607 sin2u = (cosu + cosu) * sinu;
2608 cos2u = 1.0 - 2.0 * sinu * sinu;
2610 temp1 = 0.5 * j2 * temp;
2611 temp2 = temp1 * temp;
2614 if (satrec.
method ==
'd')
2616 cosisq = cosip * cosip;
2617 satrec.
con41 = 3.0 * cosisq - 1.0;
2618 satrec.
x1mth2 = 1.0 - cosisq;
2619 satrec.
x7thm1 = 7.0 * cosisq - 1.0;
2621 mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.
con41) + 0.5 * temp1 * satrec.
x1mth2 * cos2u;
2622 su = su - 0.25 * temp2 * satrec.
x7thm1 * sin2u;
2623 xnode = nodep + 1.5 * temp2 * cosip * sin2u;
2624 xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
2625 mvt = rdotl - nm * temp1 * satrec.
x1mth2 * sin2u / xke;
2626 rvdot = rvdotl + nm * temp1 * (satrec.
x1mth2 * cos2u + 1.5 * satrec.
con41) / xke;
2637 ux = xmx * sinsu + cnod * cossu;
2638 uy = xmy * sinsu + snod * cossu;
2640 vx = xmx * cossu - cnod * sinsu;
2641 vy = xmy * cossu - snod * sinsu;
2645 r[0] = (mrt * ux) * radiusearthkm;
2646 r[1] = (mrt * uy) * radiusearthkm;
2647 r[2] = (mrt * uz) * radiusearthkm;
2648 v[0] = (mvt * ux + rvdot * vx) * vkmpersec;
2649 v[1] = (mvt * uy + rvdot * vy) * vkmpersec;
2650 v[2] = (mvt * uz + rvdot * vz) * vkmpersec;
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 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)
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)