| @@ -541,499 +541,499 @@ | ||
| 541 | 541 | public function Deep($ientry, Predict_Sat $sat) | 
| 542 | 542 |      { | 
| 543 | 543 |          switch ($ientry) { | 
| 544 | - case self::dpinit : /* Entrance for deep space initialization */ | |
| 545 | - $sat->dps->thgr = Predict_Time::ThetaG($sat->tle->epoch, $sat->deep_arg); | |
| 546 | - $eq = $sat->tle->eo; | |
| 547 | - $sat->dps->xnq = $sat->deep_arg->xnodp; | |
| 548 | - $aqnv = 1.0 / $sat->deep_arg->aodp; | |
| 549 | - $sat->dps->xqncl = $sat->tle->xincl; | |
| 550 | - $xmao = $sat->tle->xmo; | |
| 551 | - $xpidot = $sat->deep_arg->omgdot + $sat->deep_arg->xnodot; | |
| 552 | - $sinq = sin($sat->tle->xnodeo); | |
| 553 | - $cosq = cos($sat->tle->xnodeo); | |
| 554 | - $sat->dps->omegaq = $sat->tle->omegao; | |
| 555 | - $sat->dps->preep = 0; | |
| 556 | - | |
| 557 | - /* Initialize lunar solar terms */ | |
| 558 | - $day = $sat->deep_arg->ds50 + 18261.5; /* Days since 1900 Jan 0.5 */ | |
| 559 | -            if ($day != $sat->dps->preep) { | |
| 560 | - $sat->dps->preep = $day; | |
| 561 | - $xnodce = 4.5236020 - 9.2422029E-4 * $day; | |
| 562 | - $stem = sin($xnodce); | |
| 563 | - $ctem = cos($xnodce); | |
| 564 | - $sat->dps->zcosil = 0.91375164 - 0.03568096 * $ctem; | |
| 565 | - $sat->dps->zsinil = sqrt(1.0 - $sat->dps->zcosil * $sat->dps->zcosil); | |
| 566 | - $sat->dps->zsinhl = 0.089683511 * $stem / $sat->dps->zsinil; | |
| 567 | - $sat->dps->zcoshl = sqrt(1.0 - $sat->dps->zsinhl * $sat->dps->zsinhl); | |
| 568 | - $c = 4.7199672 + 0.22997150 * $day; | |
| 569 | - $gam = 5.8351514 + 0.0019443680 * $day; | |
| 570 | - $sat->dps->zmol = Predict_Math::FMod2p($c - $gam); | |
| 571 | - $zx = 0.39785416 * $stem / $sat->dps->zsinil; | |
| 572 | - $zy = $sat->dps->zcoshl * $ctem + 0.91744867 * $sat->dps->zsinhl * $stem; | |
| 573 | - $zx = Predict_Math::AcTan($zx, $zy); | |
| 574 | - $zx = $gam + $zx - $xnodce; | |
| 575 | - $sat->dps->zcosgl = cos($zx); | |
| 576 | - $sat->dps->zsingl = sin($zx); | |
| 577 | - $sat->dps->zmos = 6.2565837 + 0.017201977 * $day; | |
| 578 | - $sat->dps->zmos = Predict_Math::FMod2p($sat->dps->zmos); | |
| 579 | - } /* End if(day != preep) */ | |
| 580 | - | |
| 581 | - /* Do solar terms */ | |
| 582 | - $sat->dps->savtsn = 1E20; | |
| 583 | - $zcosg = Predict::zcosgs; | |
| 584 | - $zsing = Predict::zsings; | |
| 585 | - $zcosi = Predict::zcosis; | |
| 586 | - $zsini = Predict::zsinis; | |
| 587 | - $zcosh = $cosq; | |
| 588 | - $zsinh = $sinq; | |
| 589 | - $cc = Predict::c1ss; | |
| 590 | - $zn = Predict::zns; | |
| 591 | - $ze = Predict::zes; | |
| 592 | - $zmo = $sat->dps->zmos; | |
| 593 | - $xnoi = 1.0 / $sat->dps->xnq; | |
| 594 | - | |
| 595 | - /* Loop breaks when Solar terms are done a second */ | |
| 596 | - /* time, after Lunar terms are initialized */ | |
| 597 | -            for(;;) { | |
| 598 | - /* Solar terms done again after Lunar terms are done */ | |
| 599 | - $a1 = $zcosg * $zcosh + $zsing * $zcosi * $zsinh; | |
| 600 | - $a3 = -$zsing * $zcosh + $zcosg * $zcosi * $zsinh; | |
| 601 | - $a7 = -$zcosg * $zsinh + $zsing * $zcosi * $zcosh; | |
| 602 | - $a8 = $zsing * $zsini; | |
| 603 | - $a9 = $zsing * $zsinh + $zcosg * $zcosi * $zcosh; | |
| 604 | - $a10 = $zcosg * $zsini; | |
| 605 | - $a2 = $sat->deep_arg->cosio * $a7 + $sat->deep_arg->sinio * $a8; | |
| 606 | - $a4 = $sat->deep_arg->cosio * $a9 + $sat->deep_arg->sinio * $a10; | |
| 607 | - $a5 = -$sat->deep_arg->sinio * $a7 + $sat->deep_arg->cosio * $a8; | |
| 608 | - $a6 = -$sat->deep_arg->sinio * $a9 + $sat->deep_arg->cosio * $a10; | |
| 609 | - $x1 = $a1 * $sat->deep_arg->cosg + $a2 * $sat->deep_arg->sing; | |
| 610 | - $x2 = $a3 * $sat->deep_arg->cosg + $a4 * $sat->deep_arg->sing; | |
| 611 | - $x3 = -$a1 * $sat->deep_arg->sing + $a2 * $sat->deep_arg->cosg; | |
| 612 | - $x4 = -$a3 * $sat->deep_arg->sing + $a4 * $sat->deep_arg->cosg; | |
| 613 | - $x5 = $a5 * $sat->deep_arg->sing; | |
| 614 | - $x6 = $a6 * $sat->deep_arg->sing; | |
| 615 | - $x7 = $a5 * $sat->deep_arg->cosg; | |
| 616 | - $x8 = $a6 * $sat->deep_arg->cosg; | |
| 617 | - $z31 = 12 * $x1 * $x1 - 3 * $x3 * $x3; | |
| 618 | - $z32 = 24 * $x1 * $x2 - 6 * $x3 * $x4; | |
| 619 | - $z33 = 12 * $x2 * $x2 - 3 * $x4 * $x4; | |
| 620 | - $z1 = 3 * ($a1 * $a1 + $a2 * $a2) + $z31 * $sat->deep_arg->eosq; | |
| 621 | - $z2 = 6 * ($a1 * $a3 + $a2 * $a4) + $z32 * $sat->deep_arg->eosq; | |
| 622 | - $z3 = 3 * ($a3 * $a3 + $a4 * $a4) + $z33 * $sat->deep_arg->eosq; | |
| 623 | - $z11 = -6 * $a1 * $a5 + $sat->deep_arg->eosq * (-24 * $x1 * $x7 - 6 * $x3 * $x5); | |
| 624 | - $z12 = -6 * ($a1 * $a6 + $a3 * $a5) + $sat->deep_arg->eosq * | |
| 625 | - (-24 * ($x2 * $x7 + $x1 * $x8) - 6 * ($x3 * $x6 + $x4 * $x5)); | |
| 626 | - $z13 = -6 * $a3 * $a6 + $sat->deep_arg->eosq * (-24 * $x2 * $x8 - 6 * $x4 * $x6); | |
| 627 | - $z21 = 6 * $a2 * $a5 + $sat->deep_arg->eosq * (24 * $x1 * $x5 - 6 * $x3 * $x7); | |
| 628 | - $z22 = 6 * ($a4 * $a5 + $a2 * $a6) + $sat->deep_arg->eosq * | |
| 629 | - (24 * ($x2 * $x5 + $x1 * $x6) - 6 * ($x4 * $x7 + $x3 * $x8)); | |
| 630 | - $z23 = 6 * $a4 * $a6 + $sat->deep_arg->eosq * (24 * $x2 * $x6 - 6 * $x4 * $x8); | |
| 631 | - $z1 = $z1 + $z1 + $sat->deep_arg->betao2 * $z31; | |
| 632 | - $z2 = $z2 + $z2 + $sat->deep_arg->betao2 * $z32; | |
| 633 | - $z3 = $z3 + $z3 + $sat->deep_arg->betao2 * $z33; | |
| 634 | - $s3 = $cc * $xnoi; | |
| 635 | - $s2 = -0.5 * $s3 / $sat->deep_arg->betao; | |
| 636 | - $s4 = $s3 * $sat->deep_arg->betao; | |
| 637 | - $s1 = -15 * $eq * $s4; | |
| 638 | - $s5 = $x1 * $x3 + $x2 * $x4; | |
| 639 | - $s6 = $x2 * $x3 + $x1 * $x4; | |
| 640 | - $s7 = $x2 * $x4 - $x1 * $x3; | |
| 641 | - $se = $s1 * $zn * $s5; | |
| 642 | - $si = $s2 * $zn * ($z11 + $z13); | |
| 643 | - $sl = -$zn * $s3 * ($z1 + $z3 - 14 - 6 * $sat->deep_arg->eosq); | |
| 644 | - $sgh = $s4 * $zn * ($z31 + $z33 - 6); | |
| 645 | - $sh = -$zn * $s2 * ($z21 + $z23); | |
| 646 | -                if ($sat->dps->xqncl < 5.2359877E-2) { | |
| 647 | - $sh = 0; | |
| 648 | - } | |
| 649 | - $sat->dps->ee2 = 2 * $s1 * $s6; | |
| 650 | - $sat->dps->e3 = 2 * $s1 * $s7; | |
| 651 | - $sat->dps->xi2 = 2 * $s2 * $z12; | |
| 652 | - $sat->dps->xi3 = 2 * $s2 * ($z13 - $z11); | |
| 653 | - $sat->dps->xl2 = -2 * $s3 * $z2; | |
| 654 | - $sat->dps->xl3 = -2 * $s3 * ($z3 - $z1); | |
| 655 | - $sat->dps->xl4 = -2 * $s3 * (-21 - 9 * $sat->deep_arg->eosq) * $ze; | |
| 656 | - $sat->dps->xgh2 = 2 * $s4 * $z32; | |
| 657 | - $sat->dps->xgh3 = 2 * $s4 * ($z33 - $z31); | |
| 658 | - $sat->dps->xgh4 = -18 * $s4 * $ze; | |
| 659 | - $sat->dps->xh2 = -2 * $s2 * $z22; | |
| 660 | - $sat->dps->xh3 = -2 * $s2 * ($z23 - $z21); | |
| 661 | - | |
| 662 | -                if ($sat->flags & self::LUNAR_TERMS_DONE_FLAG) { | |
| 663 | - break; | |
| 664 | - } | |
| 665 | - | |
| 666 | - /* Do lunar terms */ | |
| 667 | - $sat->dps->sse = $se; | |
| 668 | - $sat->dps->ssi = $si; | |
| 669 | - $sat->dps->ssl = $sl; | |
| 670 | - $sat->dps->ssh = $sh / $sat->deep_arg->sinio; | |
| 671 | - $sat->dps->ssg = $sgh - $sat->deep_arg->cosio * $sat->dps->ssh; | |
| 672 | - $sat->dps->se2 = $sat->dps->ee2; | |
| 673 | - $sat->dps->si2 = $sat->dps->xi2; | |
| 674 | - $sat->dps->sl2 = $sat->dps->xl2; | |
| 675 | - $sat->dps->sgh2 = $sat->dps->xgh2; | |
| 676 | - $sat->dps->sh2 = $sat->dps->xh2; | |
| 677 | - $sat->dps->se3 = $sat->dps->e3; | |
| 678 | - $sat->dps->si3 = $sat->dps->xi3; | |
| 679 | - $sat->dps->sl3 = $sat->dps->xl3; | |
| 680 | - $sat->dps->sgh3 = $sat->dps->xgh3; | |
| 681 | - $sat->dps->sh3 = $sat->dps->xh3; | |
| 682 | - $sat->dps->sl4 = $sat->dps->xl4; | |
| 683 | - $sat->dps->sgh4 = $sat->dps->xgh4; | |
| 684 | - $zcosg = $sat->dps->zcosgl; | |
| 685 | - $zsing = $sat->dps->zsingl; | |
| 686 | - $zcosi = $sat->dps->zcosil; | |
| 687 | - $zsini = $sat->dps->zsinil; | |
| 688 | - $zcosh = $sat->dps->zcoshl * $cosq + $sat->dps->zsinhl * $sinq; | |
| 689 | - $zsinh = $sinq * $sat->dps->zcoshl - $cosq * $sat->dps->zsinhl; | |
| 690 | - $zn = Predict::znl; | |
| 691 | - $cc = Predict::c1l; | |
| 692 | - $ze = Predict::zel; | |
| 693 | - $zmo = $sat->dps->zmol; | |
| 694 | - $sat->flags |= self::LUNAR_TERMS_DONE_FLAG; | |
| 695 | - } /* End of for(;;) */ | |
| 696 | - | |
| 697 | - $sat->dps->sse = $sat->dps->sse + $se; | |
| 698 | - $sat->dps->ssi = $sat->dps->ssi + $si; | |
| 699 | - $sat->dps->ssl = $sat->dps->ssl + $sl; | |
| 700 | - $sat->dps->ssg = $sat->dps->ssg + $sgh - $sat->deep_arg->cosio / $sat->deep_arg->sinio * $sh; | |
| 701 | - $sat->dps->ssh = $sat->dps->ssh + $sh / $sat->deep_arg->sinio; | |
| 702 | - | |
| 703 | - /* Geopotential resonance initialization for 12 hour orbits */ | |
| 704 | - $sat->flags &= ~self::RESONANCE_FLAG; | |
| 705 | - $sat->flags &= ~self::SYNCHRONOUS_FLAG; | |
| 706 | - | |
| 707 | -            if (!(($sat->dps->xnq < 0.0052359877) && ($sat->dps->xnq > 0.0034906585))) { | |
| 708 | -                if( ($sat->dps->xnq < 0.00826) || ($sat->dps->xnq > 0.00924) ) { | |
| 709 | - return; | |
| 710 | - } | |
| 711 | -                if ($eq < 0.5) { | |
| 712 | - return; | |
| 713 | - } | |
| 714 | - $sat->flags |= self::RESONANCE_FLAG; | |
| 715 | - $eoc = $eq * $sat->deep_arg->eosq; | |
| 716 | - $g201 = -0.306 - ($eq - 0.64) * 0.440; | |
| 717 | -                if ($eq <= 0.65) { | |
| 718 | - $g211 = 3.616 - 13.247 * $eq + 16.290 * $sat->deep_arg->eosq; | |
| 719 | - $g310 = -19.302 + 117.390 * $eq - 228.419 * | |
| 720 | - $sat->deep_arg->eosq + 156.591 * $eoc; | |
| 721 | - $g322 = -18.9068 + 109.7927 * $eq - 214.6334 * | |
| 722 | - $sat->deep_arg->eosq + 146.5816 * $eoc; | |
| 723 | - $g410 = -41.122 + 242.694 * $eq - 471.094 * | |
| 724 | - $sat->deep_arg->eosq + 313.953 * $eoc; | |
| 725 | - $g422 = -146.407 + 841.880 * $eq - 1629.014 * | |
| 726 | - $sat->deep_arg->eosq + 1083.435 * $eoc; | |
| 727 | - $g520 = -532.114 + 3017.977 * $eq - 5740 * | |
| 728 | - $sat->deep_arg->eosq + 3708.276 * $eoc; | |
| 729 | -                } else { | |
| 730 | - $g211 = -72.099 + 331.819 * $eq - 508.738 * | |
| 731 | - $sat->deep_arg->eosq + 266.724 * $eoc; | |
| 732 | - $g310 = -346.844 + 1582.851 * $eq - 2415.925 * | |
| 733 | - $sat->deep_arg->eosq + 1246.113 * $eoc; | |
| 734 | - $g322 = -342.585 + 1554.908 * $eq - 2366.899 * | |
| 735 | - $sat->deep_arg->eosq + 1215.972 * $eoc; | |
| 736 | - $g410 = -1052.797 + 4758.686 * $eq - 7193.992 * | |
| 737 | - $sat->deep_arg->eosq + 3651.957 * $eoc; | |
| 738 | - $g422 = -3581.69 + 16178.11 * $eq - 24462.77 * | |
| 739 | - $sat->deep_arg->eosq+ 12422.52 * $eoc; | |
| 740 | -                    if ($eq <= 0.715) { | |
| 741 | - $g520 = 1464.74 - 4664.75 * $eq + 3763.64 * $sat->deep_arg->eosq; | |
| 742 | -                    } else { | |
| 743 | - $g520 = -5149.66 + 29936.92 * $eq - 54087.36 * | |
| 744 | - $sat->deep_arg->eosq + 31324.56 * $eoc; | |
| 745 | - } | |
| 746 | - } /* End if (eq <= 0.65) */ | |
| 747 | - | |
| 748 | -                if ($eq < 0.7) { | |
| 749 | - $g533 = -919.2277 + 4988.61 * $eq - 9064.77 * | |
| 750 | - $sat->deep_arg->eosq + 5542.21 * $eoc; | |
| 751 | - $g521 = -822.71072 + 4568.6173 * $eq - 8491.4146 * | |
| 752 | - $sat->deep_arg->eosq + 5337.524 * $eoc; | |
| 753 | - $g532 = -853.666 + 4690.25 * $eq - 8624.77 * | |
| 754 | - $sat->deep_arg->eosq + 5341.4 * $eoc; | |
| 755 | - } | |
| 756 | -                else { | |
| 757 | - $g533 = -37995.78 + 161616.52 * $eq - 229838.2* | |
| 758 | - $sat->deep_arg->eosq + 109377.94 * $eoc; | |
| 759 | - $g521 = -51752.104 + 218913.95 * $eq - 309468.16* | |
| 760 | - $sat->deep_arg->eosq + 146349.42 * $eoc; | |
| 761 | - $g532 = -40023.88 + 170470.89 * $eq - 242699.48* | |
| 762 | - $sat->deep_arg->eosq + 115605.82 * $eoc; | |
| 763 | - } /* End if (eq <= 0.7) */ | |
| 764 | - | |
| 765 | - $sini2 = $sat->deep_arg->sinio * $sat->deep_arg->sinio; | |
| 766 | - $f220 = 0.75 * (1 + 2 * $sat->deep_arg->cosio + $sat->deep_arg->theta2); | |
| 767 | - $f221 = 1.5 * $sini2; | |
| 768 | - $f321 = 1.875 * $sat->deep_arg->sinio * (1 - 2 * | |
| 769 | - $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); | |
| 770 | - $f322 = -1.875 * $sat->deep_arg->sinio * (1 + 2* | |
| 771 | - $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); | |
| 772 | - $f441 = 35 * $sini2 * $f220; | |
| 773 | - $f442 = 39.3750 * $sini2 * $sini2; | |
| 774 | - $f522 = 9.84375 * $sat->deep_arg->sinio * ($sini2 * (1 - 2 * $sat->deep_arg->cosio - 5 * | |
| 775 | - $sat->deep_arg->theta2) + 0.33333333 * (-2 + 4 * $sat->deep_arg->cosio + | |
| 776 | - 6 * $sat->deep_arg->theta2)); | |
| 777 | - $f523 = $sat->deep_arg->sinio * (4.92187512 * $sini2 * (-2 - 4 * | |
| 778 | - $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2) + 6.56250012 | |
| 779 | - * (1 + 2 * $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2)); | |
| 780 | - $f542 = 29.53125 * $sat->deep_arg->sinio * (2 - 8 * | |
| 781 | - $sat->deep_arg->cosio + $sat->deep_arg->theta2 * | |
| 782 | - (-12 + 8 * $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2)); | |
| 783 | - $f543 = 29.53125 * $sat->deep_arg->sinio * (-2 - 8 * $sat->deep_arg->cosio + | |
| 784 | - $sat->deep_arg->theta2 * (12 + 8 * $sat->deep_arg->cosio - 10 * | |
| 785 | - $sat->deep_arg->theta2)); | |
| 786 | - $xno2 = $sat->dps->xnq * $sat->dps->xnq; | |
| 787 | - $ainv2 = $aqnv * $aqnv; | |
| 788 | - $temp1 = 3 * $xno2 * $ainv2; | |
| 789 | - $temp = $temp1 * Predict::root22; | |
| 790 | - $sat->dps->d2201 = $temp * $f220 * $g201; | |
| 791 | - $sat->dps->d2211 = $temp * $f221 * $g211; | |
| 792 | - $temp1 = $temp1 * $aqnv; | |
| 793 | - $temp = $temp1 * Predict::root32; | |
| 794 | - $sat->dps->d3210 = $temp * $f321 * $g310; | |
| 795 | - $sat->dps->d3222 = $temp * $f322 * $g322; | |
| 796 | - $temp1 = $temp1 * $aqnv; | |
| 797 | - $temp = 2 * $temp1 * Predict::root44; | |
| 798 | - $sat->dps->d4410 = $temp * $f441 * $g410; | |
| 799 | - $sat->dps->d4422 = $temp * $f442 * $g422; | |
| 800 | - $temp1 = $temp1 * $aqnv; | |
| 801 | - $temp = $temp1 * Predict::root52; | |
| 802 | - $sat->dps->d5220 = $temp * $f522 * $g520; | |
| 803 | - $sat->dps->d5232 = $temp * $f523 * $g532; | |
| 804 | - $temp = 2 * $temp1 * Predict::root54; | |
| 805 | - $sat->dps->d5421 = $temp * $f542 * $g521; | |
| 806 | - $sat->dps->d5433 = $temp * $f543 * $g533; | |
| 807 | - $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->xnodeo - $sat->dps->thgr - $sat->dps->thgr; | |
| 808 | - $bfact = $sat->deep_arg->xmdot + $sat->deep_arg->xnodot + | |
| 809 | - $sat->deep_arg->xnodot - Predict::thdt - Predict::thdt; | |
| 810 | - $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssh + $sat->dps->ssh; | |
| 811 | -            } else { | |
| 812 | - $sat->flags |= self::RESONANCE_FLAG; | |
| 813 | - $sat->flags |= self::SYNCHRONOUS_FLAG; | |
| 814 | - /* Synchronous resonance terms initialization */ | |
| 815 | - $g200 = 1 + $sat->deep_arg->eosq * (-2.5 + 0.8125 * $sat->deep_arg->eosq); | |
| 816 | - $g310 = 1 + 2 * $sat->deep_arg->eosq; | |
| 817 | - $g300 = 1 + $sat->deep_arg->eosq * (-6 + 6.60937 * $sat->deep_arg->eosq); | |
| 818 | - $f220 = 0.75 * (1 + $sat->deep_arg->cosio) * (1 + $sat->deep_arg->cosio); | |
| 819 | - $f311 = 0.9375 * $sat->deep_arg->sinio * $sat->deep_arg->sinio * | |
| 820 | - (1 + 3 * $sat->deep_arg->cosio) - 0.75 * (1 + $sat->deep_arg->cosio); | |
| 821 | - $f330 = 1 + $sat->deep_arg->cosio; | |
| 822 | - $f330 = 1.875 * $f330 * $f330 * $f330; | |
| 823 | - $sat->dps->del1 = 3 * $sat->dps->xnq * $sat->dps->xnq * $aqnv * $aqnv; | |
| 824 | - $sat->dps->del2 = 2 * $sat->dps->del1 * $f220 * $g200 * Predict::q22; | |
| 825 | - $sat->dps->del3 = 3 * $sat->dps->del1 * $f330 * $g300 * Predict::q33 * $aqnv; | |
| 826 | - $sat->dps->del1 = $sat->dps->del1 * $f311 * $g310 * Predict::q31 * $aqnv; | |
| 827 | - $sat->dps->fasx2 = 0.13130908; | |
| 828 | - $sat->dps->fasx4 = 2.8843198; | |
| 829 | - $sat->dps->fasx6 = 0.37448087; | |
| 830 | - $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->omegao - $sat->dps->thgr; | |
| 831 | - $bfact = $sat->deep_arg->xmdot + $xpidot - Predict::thdt; | |
| 832 | - $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssg + $sat->dps->ssh; | |
| 833 | - } /* End if( !(xnq < 0.0052359877) && (xnq > 0.0034906585) ) */ | |
| 834 | - | |
| 835 | - $sat->dps->xfact = $bfact - $sat->dps->xnq; | |
| 836 | - | |
| 837 | - /* Initialize integrator */ | |
| 838 | - $sat->dps->xli = $sat->dps->xlamo; | |
| 839 | - $sat->dps->xni = $sat->dps->xnq; | |
| 840 | - $sat->dps->atime = 0; | |
| 841 | - $sat->dps->stepp = 720; | |
| 842 | - $sat->dps->stepn = -720; | |
| 843 | - $sat->dps->step2 = 259200; | |
| 844 | - /* End case self::dpinit: */ | |
| 845 | - return; | |
| 846 | - | |
| 847 | - case self::dpsec: /* Entrance for deep space secular effects */ | |
| 848 | - $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->ssl * $sat->deep_arg->t; | |
| 849 | - $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $sat->dps->ssg * $sat->deep_arg->t; | |
| 850 | - $sat->deep_arg->xnode = $sat->deep_arg->xnode + $sat->dps->ssh * $sat->deep_arg->t; | |
| 851 | - $sat->deep_arg->em = $sat->tle->eo + $sat->dps->sse * $sat->deep_arg->t; | |
| 852 | - $sat->deep_arg->xinc = $sat->tle->xincl + $sat->dps->ssi * $sat->deep_arg->t; | |
| 853 | -            if ($sat->deep_arg->xinc < 0) { | |
| 854 | - $sat->deep_arg->xinc = -$sat->deep_arg->xinc; | |
| 855 | - $sat->deep_arg->xnode = $sat->deep_arg->xnode + Predict::pi; | |
| 856 | - $sat->deep_arg->omgadf = $sat->deep_arg->omgadf - Predict::pi; | |
| 857 | - } | |
| 858 | -            if(~$sat->flags & self::RESONANCE_FLAG ) { | |
| 859 | - return; | |
| 860 | - } | |
| 861 | - | |
| 862 | -            do { | |
| 863 | - if ( ($sat->dps->atime == 0) || | |
| 864 | - (($sat->deep_arg->t >= 0) && ($sat->dps->atime < 0)) || | |
| 865 | -                    (($sat->deep_arg->t < 0) && ($sat->dps->atime >= 0)) ) { | |
| 866 | - /* Epoch restart */ | |
| 867 | -                    if ($sat->deep_arg->t >= 0) { | |
| 868 | - $delt = $sat->dps->stepp; | |
| 869 | -                    } else { | |
| 870 | - $delt = $sat->dps->stepn; | |
| 871 | - } | |
| 872 | - | |
| 873 | - $sat->dps->atime = 0; | |
| 874 | - $sat->dps->xni = $sat->dps->xnq; | |
| 875 | - $sat->dps->xli = $sat->dps->xlamo; | |
| 876 | -                } else { | |
| 877 | -                    if (abs($sat->deep_arg->t) >= abs($sat->dps->atime)) { | |
| 878 | -                        if ($sat->deep_arg->t > 0) { | |
| 879 | - $delt = $sat->dps->stepp; | |
| 880 | -                        } else { | |
| 881 | - $delt = $sat->dps->stepn; | |
| 882 | - } | |
| 883 | - } | |
| 884 | - } | |
| 885 | - | |
| 886 | -                do { | |
| 887 | -                    if (abs($sat->deep_arg->t - $sat->dps->atime) >= $sat->dps->stepp) { | |
| 888 | - $sat->flags |= self::DO_LOOP_FLAG; | |
| 889 | - $sat->flags &= ~self::EPOCH_RESTART_FLAG; | |
| 890 | - } | |
| 891 | -                    else { | |
| 892 | - $ft = $sat->deep_arg->t - $sat->dps->atime; | |
| 893 | - $sat->flags &= ~self::DO_LOOP_FLAG; | |
| 894 | - } | |
| 895 | - | |
| 896 | -                    if (abs($sat->deep_arg->t) < abs($sat->dps->atime)) { | |
| 897 | -                        if ($sat->deep_arg->t >= 0) { | |
| 898 | - $delt = $sat->dps->stepn; | |
| 899 | -                        } else { | |
| 900 | - $delt = $sat->dps->stepp; | |
| 901 | - } | |
| 902 | - $sat->flags |= (self::DO_LOOP_FLAG | self::EPOCH_RESTART_FLAG); | |
| 903 | - } | |
| 904 | - | |
| 905 | - /* Dot terms calculated */ | |
| 906 | -                    if ($sat->flags & self::SYNCHRONOUS_FLAG) { | |
| 907 | - $xndot = $sat->dps->del1 * sin($sat->dps->xli - $sat->dps->fasx2) + $sat->dps->del2 * sin(2 * ($sat->dps->xli - $sat->dps->fasx4)) | |
| 908 | - + $sat->dps->del3 * sin(3 * ($sat->dps->xli - $sat->dps->fasx6)); | |
| 909 | - $xnddt = $sat->dps->del1 * cos($sat->dps->xli - $sat->dps->fasx2) + 2 * $sat->dps->del2 * cos(2 * ($sat->dps->xli - $sat->dps->fasx4)) | |
| 910 | - + 3 * $sat->dps->del3 * cos(3 * ($sat->dps->xli - $sat->dps->fasx6)); | |
| 911 | -                    } else { | |
| 912 | - $xomi = $sat->dps->omegaq + $sat->deep_arg->omgdot * $sat->dps->atime; | |
| 913 | - $x2omi = $xomi + $xomi; | |
| 914 | - $x2li = $sat->dps->xli + $sat->dps->xli; | |
| 915 | - $xndot = $sat->dps->d2201 * sin($x2omi + $sat->dps->xli - Predict::g22) | |
| 916 | - + $sat->dps->d2211 * sin($sat->dps->xli - Predict::g22) | |
| 917 | - + $sat->dps->d3210 * sin($xomi + $sat->dps->xli - Predict::g32) | |
| 918 | - + $sat->dps->d3222 * sin(-$xomi + $sat->dps->xli - Predict::g32) | |
| 919 | - + $sat->dps->d4410 * sin($x2omi + $x2li- Predict::g44) | |
| 920 | - + $sat->dps->d4422 * sin($x2li- Predict::g44) | |
| 921 | - + $sat->dps->d5220 * sin($xomi + $sat->dps->xli- Predict::g52) | |
| 922 | - + $sat->dps->d5232 * sin(-$xomi + $sat->dps->xli- Predict::g52) | |
| 923 | - + $sat->dps->d5421 * sin($xomi + $x2li - Predict::g54) | |
| 924 | - + $sat->dps->d5433 * sin(-$xomi + $x2li - Predict::g54); | |
| 925 | - $xnddt = $sat->dps->d2201 * cos($x2omi + $sat->dps->xli- Predict::g22) | |
| 926 | - + $sat->dps->d2211 * cos($sat->dps->xli - Predict::g22) | |
| 927 | - + $sat->dps->d3210 * cos($xomi + $sat->dps->xli - Predict::g32) | |
| 928 | - + $sat->dps->d3222 * cos(-$xomi + $sat->dps->xli - Predict::g32) | |
| 929 | - + $sat->dps->d5220 * cos($xomi + $sat->dps->xli - Predict::g52) | |
| 930 | - + $sat->dps->d5232 * cos(-$xomi + $sat->dps->xli - Predict::g52) | |
| 931 | - + 2 * ($sat->dps->d4410 * cos($x2omi + $x2li - Predict::g44) | |
| 932 | - + $sat->dps->d4422 * cos($x2li - Predict::g44) | |
| 933 | - + $sat->dps->d5421 * cos($xomi + $x2li - Predict::g54) | |
| 934 | - + $sat->dps->d5433 * cos(-$xomi + $x2li - Predict::g54)); | |
| 935 | - } /* End of if (isFlagSet(SYNCHRONOUS_FLAG)) */ | |
| 936 | - | |
| 937 | - $xldot = $sat->dps->xni + $sat->dps->xfact; | |
| 938 | - $xnddt = $xnddt * $xldot; | |
| 939 | - | |
| 940 | -                    if ($sat->flags & self::DO_LOOP_FLAG) { | |
| 941 | - $sat->dps->xli = $sat->dps->xli + $xldot * $delt + $xndot * $sat->dps->step2; | |
| 942 | - $sat->dps->xni = $sat->dps->xni + $xndot * $delt + $xnddt * $sat->dps->step2; | |
| 943 | - $sat->dps->atime = $sat->dps->atime + $delt; | |
| 944 | - } | |
| 945 | - } while (($sat->flags & self::DO_LOOP_FLAG) && | |
| 946 | - (~$sat->flags & self::EPOCH_RESTART_FLAG)); | |
| 947 | - } | |
| 948 | - while (($sat->flags & self::DO_LOOP_FLAG) && ($sat->flags & self::EPOCH_RESTART_FLAG)); | |
| 949 | - | |
| 950 | - $sat->deep_arg->xn = $sat->dps->xni + $xndot * $ft + $xnddt * $ft * $ft * 0.5; | |
| 951 | - $xl = $sat->dps->xli + $xldot * $ft + $xndot * $ft * $ft * 0.5; | |
| 952 | - $temp = -$sat->deep_arg->xnode + $sat->dps->thgr + $sat->deep_arg->t * Predict::thdt; | |
| 953 | - | |
| 954 | -            if (~$sat->flags & self::SYNCHRONOUS_FLAG) { | |
| 955 | - $sat->deep_arg->xll = $xl + $temp + $temp; | |
| 956 | -            } else { | |
| 957 | - $sat->deep_arg->xll = $xl - $sat->deep_arg->omgadf + $temp; | |
| 958 | - } | |
| 959 | - | |
| 960 | - return; | |
| 961 | - /* End case dpsec: */ | |
| 962 | - | |
| 963 | - case self::dpper: /* Entrance for lunar-solar periodics */ | |
| 964 | - $sinis = sin($sat->deep_arg->xinc); | |
| 965 | - $cosis = cos($sat->deep_arg->xinc); | |
| 966 | -            if (abs($sat->dps->savtsn - $sat->deep_arg->t) >= 30) { | |
| 967 | - $sat->dps->savtsn = $sat->deep_arg->t; | |
| 968 | - $zm = $sat->dps->zmos + Predict::zns * $sat->deep_arg->t; | |
| 969 | - $zf = $zm + 2 * Predict::zes * sin($zm); | |
| 970 | - $sinzf = sin($zf); | |
| 971 | - $f2 = 0.5 * $sinzf * $sinzf - 0.25; | |
| 972 | - $f3 = -0.5 * $sinzf * cos($zf); | |
| 973 | - $ses = $sat->dps->se2 * $f2 + $sat->dps->se3 * $f3; | |
| 974 | - $sis = $sat->dps->si2 * $f2 + $sat->dps->si3 * $f3; | |
| 975 | - $sls = $sat->dps->sl2 * $f2 + $sat->dps->sl3 * $f3 + $sat->dps->sl4 * $sinzf; | |
| 976 | - $sat->dps->sghs = $sat->dps->sgh2 * $f2 + $sat->dps->sgh3 * $f3 + $sat->dps->sgh4 * $sinzf; | |
| 977 | - $sat->dps->shs = $sat->dps->sh2 * $f2 + $sat->dps->sh3 * $f3; | |
| 978 | - $zm = $sat->dps->zmol + Predict::znl * $sat->deep_arg->t; | |
| 979 | - $zf = $zm + 2 * Predict::zel * sin($zm); | |
| 980 | - $sinzf = sin($zf); | |
| 981 | - $f2 = 0.5 * $sinzf * $sinzf - 0.25; | |
| 982 | - $f3 = -0.5 * $sinzf * cos($zf); | |
| 983 | - $sel = $sat->dps->ee2 * $f2 + $sat->dps->e3 * $f3; | |
| 984 | - $sil = $sat->dps->xi2 * $f2 + $sat->dps->xi3 * $f3; | |
| 985 | - $sll = $sat->dps->xl2 * $f2 + $sat->dps->xl3 * $f3 + $sat->dps->xl4 * $sinzf; | |
| 986 | - $sat->dps->sghl = $sat->dps->xgh2 * $f2 + $sat->dps->xgh3 * $f3 + $sat->dps->xgh4 * $sinzf; | |
| 987 | - $sat->dps->sh1 = $sat->dps->xh2 * $f2 + $sat->dps->xh3 * $f3; | |
| 988 | - $sat->dps->pe = $ses + $sel; | |
| 989 | - $sat->dps->pinc = $sis + $sil; | |
| 990 | - $sat->dps->pl = $sls + $sll; | |
| 991 | - } | |
| 992 | - | |
| 993 | - $pgh = $sat->dps->sghs + $sat->dps->sghl; | |
| 994 | - $ph = $sat->dps->shs + $sat->dps->sh1; | |
| 995 | - $sat->deep_arg->xinc = $sat->deep_arg->xinc + $sat->dps->pinc; | |
| 996 | - $sat->deep_arg->em = $sat->deep_arg->em + $sat->dps->pe; | |
| 997 | - | |
| 998 | -            if ($sat->dps->xqncl >= 0.2) { | |
| 999 | - /* Apply periodics directly */ | |
| 1000 | - $ph = $ph / $sat->deep_arg->sinio; | |
| 1001 | - $pgh = $pgh - $sat->deep_arg->cosio * $ph; | |
| 1002 | - $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $pgh; | |
| 1003 | - $sat->deep_arg->xnode = $sat->deep_arg->xnode + $ph; | |
| 1004 | - $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; | |
| 1005 | -            } else { | |
| 1006 | - /* Apply periodics with Lyddane modification */ | |
| 1007 | - $sinok = sin($sat->deep_arg->xnode); | |
| 1008 | - $cosok = cos($sat->deep_arg->xnode); | |
| 1009 | - $alfdp = $sinis * $sinok; | |
| 1010 | - $betdp = $sinis * $cosok; | |
| 1011 | - $dalf = $ph * $cosok + $sat->dps->pinc * $cosis * $sinok; | |
| 1012 | - $dbet = -$ph * $sinok + $sat->dps->pinc * $cosis * $cosok; | |
| 1013 | - $alfdp = $alfdp + $dalf; | |
| 1014 | - $betdp = $betdp + $dbet; | |
| 1015 | - $sat->deep_arg->xnode = Predict_Math::FMod2p($sat->deep_arg->xnode); | |
| 1016 | - $xls = $sat->deep_arg->xll + $sat->deep_arg->omgadf + $cosis * $sat->deep_arg->xnode; | |
| 1017 | - $dls = $sat->dps->pl + $pgh - $sat->dps->pinc * $sat->deep_arg->xnode * $sinis; | |
| 1018 | - $xls = $xls + $dls; | |
| 1019 | - $xnoh = $sat->deep_arg->xnode; | |
| 1020 | - $sat->deep_arg->xnode = Predict_Math::AcTan($alfdp, $betdp); | |
| 1021 | - | |
| 1022 | - /* This is a patch to Lyddane modification */ | |
| 1023 | - /* suggested by Rob Matson. */ | |
| 1024 | -                if(abs($xnoh - $sat->deep_arg->xnode) > Predict::pi) { | |
| 1025 | -                    if ($sat->deep_arg->xnode < $xnoh) { | |
| 1026 | - $sat->deep_arg->xnode += Predict::twopi; | |
| 1027 | -                    } else { | |
| 1028 | - $sat->deep_arg->xnode -= Predict::twopi; | |
| 1029 | - } | |
| 1030 | - } | |
| 1031 | - | |
| 1032 | - $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; | |
| 1033 | - $sat->deep_arg->omgadf = $xls - $sat->deep_arg->xll - cos($sat->deep_arg->xinc) * | |
| 1034 | - $sat->deep_arg->xnode; | |
| 1035 | - } /* End case dpper: */ | |
| 1036 | - return; | |
| 544 | + case self::dpinit : /* Entrance for deep space initialization */ | |
| 545 | + $sat->dps->thgr = Predict_Time::ThetaG($sat->tle->epoch, $sat->deep_arg); | |
| 546 | + $eq = $sat->tle->eo; | |
| 547 | + $sat->dps->xnq = $sat->deep_arg->xnodp; | |
| 548 | + $aqnv = 1.0 / $sat->deep_arg->aodp; | |
| 549 | + $sat->dps->xqncl = $sat->tle->xincl; | |
| 550 | + $xmao = $sat->tle->xmo; | |
| 551 | + $xpidot = $sat->deep_arg->omgdot + $sat->deep_arg->xnodot; | |
| 552 | + $sinq = sin($sat->tle->xnodeo); | |
| 553 | + $cosq = cos($sat->tle->xnodeo); | |
| 554 | + $sat->dps->omegaq = $sat->tle->omegao; | |
| 555 | + $sat->dps->preep = 0; | |
| 556 | + | |
| 557 | + /* Initialize lunar solar terms */ | |
| 558 | + $day = $sat->deep_arg->ds50 + 18261.5; /* Days since 1900 Jan 0.5 */ | |
| 559 | +            	if ($day != $sat->dps->preep) { | |
| 560 | + $sat->dps->preep = $day; | |
| 561 | + $xnodce = 4.5236020 - 9.2422029E-4 * $day; | |
| 562 | + $stem = sin($xnodce); | |
| 563 | + $ctem = cos($xnodce); | |
| 564 | + $sat->dps->zcosil = 0.91375164 - 0.03568096 * $ctem; | |
| 565 | + $sat->dps->zsinil = sqrt(1.0 - $sat->dps->zcosil * $sat->dps->zcosil); | |
| 566 | + $sat->dps->zsinhl = 0.089683511 * $stem / $sat->dps->zsinil; | |
| 567 | + $sat->dps->zcoshl = sqrt(1.0 - $sat->dps->zsinhl * $sat->dps->zsinhl); | |
| 568 | + $c = 4.7199672 + 0.22997150 * $day; | |
| 569 | + $gam = 5.8351514 + 0.0019443680 * $day; | |
| 570 | + $sat->dps->zmol = Predict_Math::FMod2p($c - $gam); | |
| 571 | + $zx = 0.39785416 * $stem / $sat->dps->zsinil; | |
| 572 | + $zy = $sat->dps->zcoshl * $ctem + 0.91744867 * $sat->dps->zsinhl * $stem; | |
| 573 | + $zx = Predict_Math::AcTan($zx, $zy); | |
| 574 | + $zx = $gam + $zx - $xnodce; | |
| 575 | + $sat->dps->zcosgl = cos($zx); | |
| 576 | + $sat->dps->zsingl = sin($zx); | |
| 577 | + $sat->dps->zmos = 6.2565837 + 0.017201977 * $day; | |
| 578 | + $sat->dps->zmos = Predict_Math::FMod2p($sat->dps->zmos); | |
| 579 | + } /* End if(day != preep) */ | |
| 580 | + | |
| 581 | + /* Do solar terms */ | |
| 582 | + $sat->dps->savtsn = 1E20; | |
| 583 | + $zcosg = Predict::zcosgs; | |
| 584 | + $zsing = Predict::zsings; | |
| 585 | + $zcosi = Predict::zcosis; | |
| 586 | + $zsini = Predict::zsinis; | |
| 587 | + $zcosh = $cosq; | |
| 588 | + $zsinh = $sinq; | |
| 589 | + $cc = Predict::c1ss; | |
| 590 | + $zn = Predict::zns; | |
| 591 | + $ze = Predict::zes; | |
| 592 | + $zmo = $sat->dps->zmos; | |
| 593 | + $xnoi = 1.0 / $sat->dps->xnq; | |
| 594 | + | |
| 595 | + /* Loop breaks when Solar terms are done a second */ | |
| 596 | + /* time, after Lunar terms are initialized */ | |
| 597 | +            	for(;;) { | |
| 598 | + /* Solar terms done again after Lunar terms are done */ | |
| 599 | + $a1 = $zcosg * $zcosh + $zsing * $zcosi * $zsinh; | |
| 600 | + $a3 = -$zsing * $zcosh + $zcosg * $zcosi * $zsinh; | |
| 601 | + $a7 = -$zcosg * $zsinh + $zsing * $zcosi * $zcosh; | |
| 602 | + $a8 = $zsing * $zsini; | |
| 603 | + $a9 = $zsing * $zsinh + $zcosg * $zcosi * $zcosh; | |
| 604 | + $a10 = $zcosg * $zsini; | |
| 605 | + $a2 = $sat->deep_arg->cosio * $a7 + $sat->deep_arg->sinio * $a8; | |
| 606 | + $a4 = $sat->deep_arg->cosio * $a9 + $sat->deep_arg->sinio * $a10; | |
| 607 | + $a5 = -$sat->deep_arg->sinio * $a7 + $sat->deep_arg->cosio * $a8; | |
| 608 | + $a6 = -$sat->deep_arg->sinio * $a9 + $sat->deep_arg->cosio * $a10; | |
| 609 | + $x1 = $a1 * $sat->deep_arg->cosg + $a2 * $sat->deep_arg->sing; | |
| 610 | + $x2 = $a3 * $sat->deep_arg->cosg + $a4 * $sat->deep_arg->sing; | |
| 611 | + $x3 = -$a1 * $sat->deep_arg->sing + $a2 * $sat->deep_arg->cosg; | |
| 612 | + $x4 = -$a3 * $sat->deep_arg->sing + $a4 * $sat->deep_arg->cosg; | |
| 613 | + $x5 = $a5 * $sat->deep_arg->sing; | |
| 614 | + $x6 = $a6 * $sat->deep_arg->sing; | |
| 615 | + $x7 = $a5 * $sat->deep_arg->cosg; | |
| 616 | + $x8 = $a6 * $sat->deep_arg->cosg; | |
| 617 | + $z31 = 12 * $x1 * $x1 - 3 * $x3 * $x3; | |
| 618 | + $z32 = 24 * $x1 * $x2 - 6 * $x3 * $x4; | |
| 619 | + $z33 = 12 * $x2 * $x2 - 3 * $x4 * $x4; | |
| 620 | + $z1 = 3 * ($a1 * $a1 + $a2 * $a2) + $z31 * $sat->deep_arg->eosq; | |
| 621 | + $z2 = 6 * ($a1 * $a3 + $a2 * $a4) + $z32 * $sat->deep_arg->eosq; | |
| 622 | + $z3 = 3 * ($a3 * $a3 + $a4 * $a4) + $z33 * $sat->deep_arg->eosq; | |
| 623 | + $z11 = -6 * $a1 * $a5 + $sat->deep_arg->eosq * (-24 * $x1 * $x7 - 6 * $x3 * $x5); | |
| 624 | + $z12 = -6 * ($a1 * $a6 + $a3 * $a5) + $sat->deep_arg->eosq * | |
| 625 | + (-24 * ($x2 * $x7 + $x1 * $x8) - 6 * ($x3 * $x6 + $x4 * $x5)); | |
| 626 | + $z13 = -6 * $a3 * $a6 + $sat->deep_arg->eosq * (-24 * $x2 * $x8 - 6 * $x4 * $x6); | |
| 627 | + $z21 = 6 * $a2 * $a5 + $sat->deep_arg->eosq * (24 * $x1 * $x5 - 6 * $x3 * $x7); | |
| 628 | + $z22 = 6 * ($a4 * $a5 + $a2 * $a6) + $sat->deep_arg->eosq * | |
| 629 | + (24 * ($x2 * $x5 + $x1 * $x6) - 6 * ($x4 * $x7 + $x3 * $x8)); | |
| 630 | + $z23 = 6 * $a4 * $a6 + $sat->deep_arg->eosq * (24 * $x2 * $x6 - 6 * $x4 * $x8); | |
| 631 | + $z1 = $z1 + $z1 + $sat->deep_arg->betao2 * $z31; | |
| 632 | + $z2 = $z2 + $z2 + $sat->deep_arg->betao2 * $z32; | |
| 633 | + $z3 = $z3 + $z3 + $sat->deep_arg->betao2 * $z33; | |
| 634 | + $s3 = $cc * $xnoi; | |
| 635 | + $s2 = -0.5 * $s3 / $sat->deep_arg->betao; | |
| 636 | + $s4 = $s3 * $sat->deep_arg->betao; | |
| 637 | + $s1 = -15 * $eq * $s4; | |
| 638 | + $s5 = $x1 * $x3 + $x2 * $x4; | |
| 639 | + $s6 = $x2 * $x3 + $x1 * $x4; | |
| 640 | + $s7 = $x2 * $x4 - $x1 * $x3; | |
| 641 | + $se = $s1 * $zn * $s5; | |
| 642 | + $si = $s2 * $zn * ($z11 + $z13); | |
| 643 | + $sl = -$zn * $s3 * ($z1 + $z3 - 14 - 6 * $sat->deep_arg->eosq); | |
| 644 | + $sgh = $s4 * $zn * ($z31 + $z33 - 6); | |
| 645 | + $sh = -$zn * $s2 * ($z21 + $z23); | |
| 646 | +                	if ($sat->dps->xqncl < 5.2359877E-2) { | |
| 647 | + $sh = 0; | |
| 648 | + } | |
| 649 | + $sat->dps->ee2 = 2 * $s1 * $s6; | |
| 650 | + $sat->dps->e3 = 2 * $s1 * $s7; | |
| 651 | + $sat->dps->xi2 = 2 * $s2 * $z12; | |
| 652 | + $sat->dps->xi3 = 2 * $s2 * ($z13 - $z11); | |
| 653 | + $sat->dps->xl2 = -2 * $s3 * $z2; | |
| 654 | + $sat->dps->xl3 = -2 * $s3 * ($z3 - $z1); | |
| 655 | + $sat->dps->xl4 = -2 * $s3 * (-21 - 9 * $sat->deep_arg->eosq) * $ze; | |
| 656 | + $sat->dps->xgh2 = 2 * $s4 * $z32; | |
| 657 | + $sat->dps->xgh3 = 2 * $s4 * ($z33 - $z31); | |
| 658 | + $sat->dps->xgh4 = -18 * $s4 * $ze; | |
| 659 | + $sat->dps->xh2 = -2 * $s2 * $z22; | |
| 660 | + $sat->dps->xh3 = -2 * $s2 * ($z23 - $z21); | |
| 661 | + | |
| 662 | +                	if ($sat->flags & self::LUNAR_TERMS_DONE_FLAG) { | |
| 663 | + break; | |
| 664 | + } | |
| 665 | + | |
| 666 | + /* Do lunar terms */ | |
| 667 | + $sat->dps->sse = $se; | |
| 668 | + $sat->dps->ssi = $si; | |
| 669 | + $sat->dps->ssl = $sl; | |
| 670 | + $sat->dps->ssh = $sh / $sat->deep_arg->sinio; | |
| 671 | + $sat->dps->ssg = $sgh - $sat->deep_arg->cosio * $sat->dps->ssh; | |
| 672 | + $sat->dps->se2 = $sat->dps->ee2; | |
| 673 | + $sat->dps->si2 = $sat->dps->xi2; | |
| 674 | + $sat->dps->sl2 = $sat->dps->xl2; | |
| 675 | + $sat->dps->sgh2 = $sat->dps->xgh2; | |
| 676 | + $sat->dps->sh2 = $sat->dps->xh2; | |
| 677 | + $sat->dps->se3 = $sat->dps->e3; | |
| 678 | + $sat->dps->si3 = $sat->dps->xi3; | |
| 679 | + $sat->dps->sl3 = $sat->dps->xl3; | |
| 680 | + $sat->dps->sgh3 = $sat->dps->xgh3; | |
| 681 | + $sat->dps->sh3 = $sat->dps->xh3; | |
| 682 | + $sat->dps->sl4 = $sat->dps->xl4; | |
| 683 | + $sat->dps->sgh4 = $sat->dps->xgh4; | |
| 684 | + $zcosg = $sat->dps->zcosgl; | |
| 685 | + $zsing = $sat->dps->zsingl; | |
| 686 | + $zcosi = $sat->dps->zcosil; | |
| 687 | + $zsini = $sat->dps->zsinil; | |
| 688 | + $zcosh = $sat->dps->zcoshl * $cosq + $sat->dps->zsinhl * $sinq; | |
| 689 | + $zsinh = $sinq * $sat->dps->zcoshl - $cosq * $sat->dps->zsinhl; | |
| 690 | + $zn = Predict::znl; | |
| 691 | + $cc = Predict::c1l; | |
| 692 | + $ze = Predict::zel; | |
| 693 | + $zmo = $sat->dps->zmol; | |
| 694 | + $sat->flags |= self::LUNAR_TERMS_DONE_FLAG; | |
| 695 | + } /* End of for(;;) */ | |
| 696 | + | |
| 697 | + $sat->dps->sse = $sat->dps->sse + $se; | |
| 698 | + $sat->dps->ssi = $sat->dps->ssi + $si; | |
| 699 | + $sat->dps->ssl = $sat->dps->ssl + $sl; | |
| 700 | + $sat->dps->ssg = $sat->dps->ssg + $sgh - $sat->deep_arg->cosio / $sat->deep_arg->sinio * $sh; | |
| 701 | + $sat->dps->ssh = $sat->dps->ssh + $sh / $sat->deep_arg->sinio; | |
| 702 | + | |
| 703 | + /* Geopotential resonance initialization for 12 hour orbits */ | |
| 704 | + $sat->flags &= ~self::RESONANCE_FLAG; | |
| 705 | + $sat->flags &= ~self::SYNCHRONOUS_FLAG; | |
| 706 | + | |
| 707 | +            	if (!(($sat->dps->xnq < 0.0052359877) && ($sat->dps->xnq > 0.0034906585))) { | |
| 708 | +                	if( ($sat->dps->xnq < 0.00826) || ($sat->dps->xnq > 0.00924) ) { | |
| 709 | + return; | |
| 710 | + } | |
| 711 | +                	if ($eq < 0.5) { | |
| 712 | + return; | |
| 713 | + } | |
| 714 | + $sat->flags |= self::RESONANCE_FLAG; | |
| 715 | + $eoc = $eq * $sat->deep_arg->eosq; | |
| 716 | + $g201 = -0.306 - ($eq - 0.64) * 0.440; | |
| 717 | +                	if ($eq <= 0.65) { | |
| 718 | + $g211 = 3.616 - 13.247 * $eq + 16.290 * $sat->deep_arg->eosq; | |
| 719 | + $g310 = -19.302 + 117.390 * $eq - 228.419 * | |
| 720 | + $sat->deep_arg->eosq + 156.591 * $eoc; | |
| 721 | + $g322 = -18.9068 + 109.7927 * $eq - 214.6334 * | |
| 722 | + $sat->deep_arg->eosq + 146.5816 * $eoc; | |
| 723 | + $g410 = -41.122 + 242.694 * $eq - 471.094 * | |
| 724 | + $sat->deep_arg->eosq + 313.953 * $eoc; | |
| 725 | + $g422 = -146.407 + 841.880 * $eq - 1629.014 * | |
| 726 | + $sat->deep_arg->eosq + 1083.435 * $eoc; | |
| 727 | + $g520 = -532.114 + 3017.977 * $eq - 5740 * | |
| 728 | + $sat->deep_arg->eosq + 3708.276 * $eoc; | |
| 729 | +                	} else { | |
| 730 | + $g211 = -72.099 + 331.819 * $eq - 508.738 * | |
| 731 | + $sat->deep_arg->eosq + 266.724 * $eoc; | |
| 732 | + $g310 = -346.844 + 1582.851 * $eq - 2415.925 * | |
| 733 | + $sat->deep_arg->eosq + 1246.113 * $eoc; | |
| 734 | + $g322 = -342.585 + 1554.908 * $eq - 2366.899 * | |
| 735 | + $sat->deep_arg->eosq + 1215.972 * $eoc; | |
| 736 | + $g410 = -1052.797 + 4758.686 * $eq - 7193.992 * | |
| 737 | + $sat->deep_arg->eosq + 3651.957 * $eoc; | |
| 738 | + $g422 = -3581.69 + 16178.11 * $eq - 24462.77 * | |
| 739 | + $sat->deep_arg->eosq+ 12422.52 * $eoc; | |
| 740 | +                    	if ($eq <= 0.715) { | |
| 741 | + $g520 = 1464.74 - 4664.75 * $eq + 3763.64 * $sat->deep_arg->eosq; | |
| 742 | +                    	} else { | |
| 743 | + $g520 = -5149.66 + 29936.92 * $eq - 54087.36 * | |
| 744 | + $sat->deep_arg->eosq + 31324.56 * $eoc; | |
| 745 | + } | |
| 746 | + } /* End if (eq <= 0.65) */ | |
| 747 | + | |
| 748 | +                	if ($eq < 0.7) { | |
| 749 | + $g533 = -919.2277 + 4988.61 * $eq - 9064.77 * | |
| 750 | + $sat->deep_arg->eosq + 5542.21 * $eoc; | |
| 751 | + $g521 = -822.71072 + 4568.6173 * $eq - 8491.4146 * | |
| 752 | + $sat->deep_arg->eosq + 5337.524 * $eoc; | |
| 753 | + $g532 = -853.666 + 4690.25 * $eq - 8624.77 * | |
| 754 | + $sat->deep_arg->eosq + 5341.4 * $eoc; | |
| 755 | + } | |
| 756 | +                	else { | |
| 757 | + $g533 = -37995.78 + 161616.52 * $eq - 229838.2* | |
| 758 | + $sat->deep_arg->eosq + 109377.94 * $eoc; | |
| 759 | + $g521 = -51752.104 + 218913.95 * $eq - 309468.16* | |
| 760 | + $sat->deep_arg->eosq + 146349.42 * $eoc; | |
| 761 | + $g532 = -40023.88 + 170470.89 * $eq - 242699.48* | |
| 762 | + $sat->deep_arg->eosq + 115605.82 * $eoc; | |
| 763 | + } /* End if (eq <= 0.7) */ | |
| 764 | + | |
| 765 | + $sini2 = $sat->deep_arg->sinio * $sat->deep_arg->sinio; | |
| 766 | + $f220 = 0.75 * (1 + 2 * $sat->deep_arg->cosio + $sat->deep_arg->theta2); | |
| 767 | + $f221 = 1.5 * $sini2; | |
| 768 | + $f321 = 1.875 * $sat->deep_arg->sinio * (1 - 2 * | |
| 769 | + $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); | |
| 770 | + $f322 = -1.875 * $sat->deep_arg->sinio * (1 + 2* | |
| 771 | + $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); | |
| 772 | + $f441 = 35 * $sini2 * $f220; | |
| 773 | + $f442 = 39.3750 * $sini2 * $sini2; | |
| 774 | + $f522 = 9.84375 * $sat->deep_arg->sinio * ($sini2 * (1 - 2 * $sat->deep_arg->cosio - 5 * | |
| 775 | + $sat->deep_arg->theta2) + 0.33333333 * (-2 + 4 * $sat->deep_arg->cosio + | |
| 776 | + 6 * $sat->deep_arg->theta2)); | |
| 777 | + $f523 = $sat->deep_arg->sinio * (4.92187512 * $sini2 * (-2 - 4 * | |
| 778 | + $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2) + 6.56250012 | |
| 779 | + * (1 + 2 * $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2)); | |
| 780 | + $f542 = 29.53125 * $sat->deep_arg->sinio * (2 - 8 * | |
| 781 | + $sat->deep_arg->cosio + $sat->deep_arg->theta2 * | |
| 782 | + (-12 + 8 * $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2)); | |
| 783 | + $f543 = 29.53125 * $sat->deep_arg->sinio * (-2 - 8 * $sat->deep_arg->cosio + | |
| 784 | + $sat->deep_arg->theta2 * (12 + 8 * $sat->deep_arg->cosio - 10 * | |
| 785 | + $sat->deep_arg->theta2)); | |
| 786 | + $xno2 = $sat->dps->xnq * $sat->dps->xnq; | |
| 787 | + $ainv2 = $aqnv * $aqnv; | |
| 788 | + $temp1 = 3 * $xno2 * $ainv2; | |
| 789 | + $temp = $temp1 * Predict::root22; | |
| 790 | + $sat->dps->d2201 = $temp * $f220 * $g201; | |
| 791 | + $sat->dps->d2211 = $temp * $f221 * $g211; | |
| 792 | + $temp1 = $temp1 * $aqnv; | |
| 793 | + $temp = $temp1 * Predict::root32; | |
| 794 | + $sat->dps->d3210 = $temp * $f321 * $g310; | |
| 795 | + $sat->dps->d3222 = $temp * $f322 * $g322; | |
| 796 | + $temp1 = $temp1 * $aqnv; | |
| 797 | + $temp = 2 * $temp1 * Predict::root44; | |
| 798 | + $sat->dps->d4410 = $temp * $f441 * $g410; | |
| 799 | + $sat->dps->d4422 = $temp * $f442 * $g422; | |
| 800 | + $temp1 = $temp1 * $aqnv; | |
| 801 | + $temp = $temp1 * Predict::root52; | |
| 802 | + $sat->dps->d5220 = $temp * $f522 * $g520; | |
| 803 | + $sat->dps->d5232 = $temp * $f523 * $g532; | |
| 804 | + $temp = 2 * $temp1 * Predict::root54; | |
| 805 | + $sat->dps->d5421 = $temp * $f542 * $g521; | |
| 806 | + $sat->dps->d5433 = $temp * $f543 * $g533; | |
| 807 | + $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->xnodeo - $sat->dps->thgr - $sat->dps->thgr; | |
| 808 | + $bfact = $sat->deep_arg->xmdot + $sat->deep_arg->xnodot + | |
| 809 | + $sat->deep_arg->xnodot - Predict::thdt - Predict::thdt; | |
| 810 | + $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssh + $sat->dps->ssh; | |
| 811 | +            	} else { | |
| 812 | + $sat->flags |= self::RESONANCE_FLAG; | |
| 813 | + $sat->flags |= self::SYNCHRONOUS_FLAG; | |
| 814 | + /* Synchronous resonance terms initialization */ | |
| 815 | + $g200 = 1 + $sat->deep_arg->eosq * (-2.5 + 0.8125 * $sat->deep_arg->eosq); | |
| 816 | + $g310 = 1 + 2 * $sat->deep_arg->eosq; | |
| 817 | + $g300 = 1 + $sat->deep_arg->eosq * (-6 + 6.60937 * $sat->deep_arg->eosq); | |
| 818 | + $f220 = 0.75 * (1 + $sat->deep_arg->cosio) * (1 + $sat->deep_arg->cosio); | |
| 819 | + $f311 = 0.9375 * $sat->deep_arg->sinio * $sat->deep_arg->sinio * | |
| 820 | + (1 + 3 * $sat->deep_arg->cosio) - 0.75 * (1 + $sat->deep_arg->cosio); | |
| 821 | + $f330 = 1 + $sat->deep_arg->cosio; | |
| 822 | + $f330 = 1.875 * $f330 * $f330 * $f330; | |
| 823 | + $sat->dps->del1 = 3 * $sat->dps->xnq * $sat->dps->xnq * $aqnv * $aqnv; | |
| 824 | + $sat->dps->del2 = 2 * $sat->dps->del1 * $f220 * $g200 * Predict::q22; | |
| 825 | + $sat->dps->del3 = 3 * $sat->dps->del1 * $f330 * $g300 * Predict::q33 * $aqnv; | |
| 826 | + $sat->dps->del1 = $sat->dps->del1 * $f311 * $g310 * Predict::q31 * $aqnv; | |
| 827 | + $sat->dps->fasx2 = 0.13130908; | |
| 828 | + $sat->dps->fasx4 = 2.8843198; | |
| 829 | + $sat->dps->fasx6 = 0.37448087; | |
| 830 | + $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->omegao - $sat->dps->thgr; | |
| 831 | + $bfact = $sat->deep_arg->xmdot + $xpidot - Predict::thdt; | |
| 832 | + $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssg + $sat->dps->ssh; | |
| 833 | + } /* End if( !(xnq < 0.0052359877) && (xnq > 0.0034906585) ) */ | |
| 834 | + | |
| 835 | + $sat->dps->xfact = $bfact - $sat->dps->xnq; | |
| 836 | + | |
| 837 | + /* Initialize integrator */ | |
| 838 | + $sat->dps->xli = $sat->dps->xlamo; | |
| 839 | + $sat->dps->xni = $sat->dps->xnq; | |
| 840 | + $sat->dps->atime = 0; | |
| 841 | + $sat->dps->stepp = 720; | |
| 842 | + $sat->dps->stepn = -720; | |
| 843 | + $sat->dps->step2 = 259200; | |
| 844 | + /* End case self::dpinit: */ | |
| 845 | + return; | |
| 846 | + | |
| 847 | + case self::dpsec: /* Entrance for deep space secular effects */ | |
| 848 | + $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->ssl * $sat->deep_arg->t; | |
| 849 | + $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $sat->dps->ssg * $sat->deep_arg->t; | |
| 850 | + $sat->deep_arg->xnode = $sat->deep_arg->xnode + $sat->dps->ssh * $sat->deep_arg->t; | |
| 851 | + $sat->deep_arg->em = $sat->tle->eo + $sat->dps->sse * $sat->deep_arg->t; | |
| 852 | + $sat->deep_arg->xinc = $sat->tle->xincl + $sat->dps->ssi * $sat->deep_arg->t; | |
| 853 | +            	if ($sat->deep_arg->xinc < 0) { | |
| 854 | + $sat->deep_arg->xinc = -$sat->deep_arg->xinc; | |
| 855 | + $sat->deep_arg->xnode = $sat->deep_arg->xnode + Predict::pi; | |
| 856 | + $sat->deep_arg->omgadf = $sat->deep_arg->omgadf - Predict::pi; | |
| 857 | + } | |
| 858 | +            	if(~$sat->flags & self::RESONANCE_FLAG ) { | |
| 859 | + return; | |
| 860 | + } | |
| 861 | + | |
| 862 | +            	do { | |
| 863 | + if ( ($sat->dps->atime == 0) || | |
| 864 | + (($sat->deep_arg->t >= 0) && ($sat->dps->atime < 0)) || | |
| 865 | +                    	(($sat->deep_arg->t < 0) && ($sat->dps->atime >= 0)) ) { | |
| 866 | + /* Epoch restart */ | |
| 867 | +                    	if ($sat->deep_arg->t >= 0) { | |
| 868 | + $delt = $sat->dps->stepp; | |
| 869 | +                    	} else { | |
| 870 | + $delt = $sat->dps->stepn; | |
| 871 | + } | |
| 872 | + | |
| 873 | + $sat->dps->atime = 0; | |
| 874 | + $sat->dps->xni = $sat->dps->xnq; | |
| 875 | + $sat->dps->xli = $sat->dps->xlamo; | |
| 876 | +                	} else { | |
| 877 | +                    	if (abs($sat->deep_arg->t) >= abs($sat->dps->atime)) { | |
| 878 | +                        	if ($sat->deep_arg->t > 0) { | |
| 879 | + $delt = $sat->dps->stepp; | |
| 880 | +                        	} else { | |
| 881 | + $delt = $sat->dps->stepn; | |
| 882 | + } | |
| 883 | + } | |
| 884 | + } | |
| 885 | + | |
| 886 | +                	do { | |
| 887 | +                    	if (abs($sat->deep_arg->t - $sat->dps->atime) >= $sat->dps->stepp) { | |
| 888 | + $sat->flags |= self::DO_LOOP_FLAG; | |
| 889 | + $sat->flags &= ~self::EPOCH_RESTART_FLAG; | |
| 890 | + } | |
| 891 | +                    	else { | |
| 892 | + $ft = $sat->deep_arg->t - $sat->dps->atime; | |
| 893 | + $sat->flags &= ~self::DO_LOOP_FLAG; | |
| 894 | + } | |
| 895 | + | |
| 896 | +                    	if (abs($sat->deep_arg->t) < abs($sat->dps->atime)) { | |
| 897 | +                        	if ($sat->deep_arg->t >= 0) { | |
| 898 | + $delt = $sat->dps->stepn; | |
| 899 | +                        	} else { | |
| 900 | + $delt = $sat->dps->stepp; | |
| 901 | + } | |
| 902 | + $sat->flags |= (self::DO_LOOP_FLAG | self::EPOCH_RESTART_FLAG); | |
| 903 | + } | |
| 904 | + | |
| 905 | + /* Dot terms calculated */ | |
| 906 | +                    	if ($sat->flags & self::SYNCHRONOUS_FLAG) { | |
| 907 | + $xndot = $sat->dps->del1 * sin($sat->dps->xli - $sat->dps->fasx2) + $sat->dps->del2 * sin(2 * ($sat->dps->xli - $sat->dps->fasx4)) | |
| 908 | + + $sat->dps->del3 * sin(3 * ($sat->dps->xli - $sat->dps->fasx6)); | |
| 909 | + $xnddt = $sat->dps->del1 * cos($sat->dps->xli - $sat->dps->fasx2) + 2 * $sat->dps->del2 * cos(2 * ($sat->dps->xli - $sat->dps->fasx4)) | |
| 910 | + + 3 * $sat->dps->del3 * cos(3 * ($sat->dps->xli - $sat->dps->fasx6)); | |
| 911 | +                    	} else { | |
| 912 | + $xomi = $sat->dps->omegaq + $sat->deep_arg->omgdot * $sat->dps->atime; | |
| 913 | + $x2omi = $xomi + $xomi; | |
| 914 | + $x2li = $sat->dps->xli + $sat->dps->xli; | |
| 915 | + $xndot = $sat->dps->d2201 * sin($x2omi + $sat->dps->xli - Predict::g22) | |
| 916 | + + $sat->dps->d2211 * sin($sat->dps->xli - Predict::g22) | |
| 917 | + + $sat->dps->d3210 * sin($xomi + $sat->dps->xli - Predict::g32) | |
| 918 | + + $sat->dps->d3222 * sin(-$xomi + $sat->dps->xli - Predict::g32) | |
| 919 | + + $sat->dps->d4410 * sin($x2omi + $x2li- Predict::g44) | |
| 920 | + + $sat->dps->d4422 * sin($x2li- Predict::g44) | |
| 921 | + + $sat->dps->d5220 * sin($xomi + $sat->dps->xli- Predict::g52) | |
| 922 | + + $sat->dps->d5232 * sin(-$xomi + $sat->dps->xli- Predict::g52) | |
| 923 | + + $sat->dps->d5421 * sin($xomi + $x2li - Predict::g54) | |
| 924 | + + $sat->dps->d5433 * sin(-$xomi + $x2li - Predict::g54); | |
| 925 | + $xnddt = $sat->dps->d2201 * cos($x2omi + $sat->dps->xli- Predict::g22) | |
| 926 | + + $sat->dps->d2211 * cos($sat->dps->xli - Predict::g22) | |
| 927 | + + $sat->dps->d3210 * cos($xomi + $sat->dps->xli - Predict::g32) | |
| 928 | + + $sat->dps->d3222 * cos(-$xomi + $sat->dps->xli - Predict::g32) | |
| 929 | + + $sat->dps->d5220 * cos($xomi + $sat->dps->xli - Predict::g52) | |
| 930 | + + $sat->dps->d5232 * cos(-$xomi + $sat->dps->xli - Predict::g52) | |
| 931 | + + 2 * ($sat->dps->d4410 * cos($x2omi + $x2li - Predict::g44) | |
| 932 | + + $sat->dps->d4422 * cos($x2li - Predict::g44) | |
| 933 | + + $sat->dps->d5421 * cos($xomi + $x2li - Predict::g54) | |
| 934 | + + $sat->dps->d5433 * cos(-$xomi + $x2li - Predict::g54)); | |
| 935 | + } /* End of if (isFlagSet(SYNCHRONOUS_FLAG)) */ | |
| 936 | + | |
| 937 | + $xldot = $sat->dps->xni + $sat->dps->xfact; | |
| 938 | + $xnddt = $xnddt * $xldot; | |
| 939 | + | |
| 940 | +                    	if ($sat->flags & self::DO_LOOP_FLAG) { | |
| 941 | + $sat->dps->xli = $sat->dps->xli + $xldot * $delt + $xndot * $sat->dps->step2; | |
| 942 | + $sat->dps->xni = $sat->dps->xni + $xndot * $delt + $xnddt * $sat->dps->step2; | |
| 943 | + $sat->dps->atime = $sat->dps->atime + $delt; | |
| 944 | + } | |
| 945 | + } while (($sat->flags & self::DO_LOOP_FLAG) && | |
| 946 | + (~$sat->flags & self::EPOCH_RESTART_FLAG)); | |
| 947 | + } | |
| 948 | + while (($sat->flags & self::DO_LOOP_FLAG) && ($sat->flags & self::EPOCH_RESTART_FLAG)); | |
| 949 | + | |
| 950 | + $sat->deep_arg->xn = $sat->dps->xni + $xndot * $ft + $xnddt * $ft * $ft * 0.5; | |
| 951 | + $xl = $sat->dps->xli + $xldot * $ft + $xndot * $ft * $ft * 0.5; | |
| 952 | + $temp = -$sat->deep_arg->xnode + $sat->dps->thgr + $sat->deep_arg->t * Predict::thdt; | |
| 953 | + | |
| 954 | +            	if (~$sat->flags & self::SYNCHRONOUS_FLAG) { | |
| 955 | + $sat->deep_arg->xll = $xl + $temp + $temp; | |
| 956 | +            	} else { | |
| 957 | + $sat->deep_arg->xll = $xl - $sat->deep_arg->omgadf + $temp; | |
| 958 | + } | |
| 959 | + | |
| 960 | + return; | |
| 961 | + /* End case dpsec: */ | |
| 962 | + | |
| 963 | + case self::dpper: /* Entrance for lunar-solar periodics */ | |
| 964 | + $sinis = sin($sat->deep_arg->xinc); | |
| 965 | + $cosis = cos($sat->deep_arg->xinc); | |
| 966 | +            	if (abs($sat->dps->savtsn - $sat->deep_arg->t) >= 30) { | |
| 967 | + $sat->dps->savtsn = $sat->deep_arg->t; | |
| 968 | + $zm = $sat->dps->zmos + Predict::zns * $sat->deep_arg->t; | |
| 969 | + $zf = $zm + 2 * Predict::zes * sin($zm); | |
| 970 | + $sinzf = sin($zf); | |
| 971 | + $f2 = 0.5 * $sinzf * $sinzf - 0.25; | |
| 972 | + $f3 = -0.5 * $sinzf * cos($zf); | |
| 973 | + $ses = $sat->dps->se2 * $f2 + $sat->dps->se3 * $f3; | |
| 974 | + $sis = $sat->dps->si2 * $f2 + $sat->dps->si3 * $f3; | |
| 975 | + $sls = $sat->dps->sl2 * $f2 + $sat->dps->sl3 * $f3 + $sat->dps->sl4 * $sinzf; | |
| 976 | + $sat->dps->sghs = $sat->dps->sgh2 * $f2 + $sat->dps->sgh3 * $f3 + $sat->dps->sgh4 * $sinzf; | |
| 977 | + $sat->dps->shs = $sat->dps->sh2 * $f2 + $sat->dps->sh3 * $f3; | |
| 978 | + $zm = $sat->dps->zmol + Predict::znl * $sat->deep_arg->t; | |
| 979 | + $zf = $zm + 2 * Predict::zel * sin($zm); | |
| 980 | + $sinzf = sin($zf); | |
| 981 | + $f2 = 0.5 * $sinzf * $sinzf - 0.25; | |
| 982 | + $f3 = -0.5 * $sinzf * cos($zf); | |
| 983 | + $sel = $sat->dps->ee2 * $f2 + $sat->dps->e3 * $f3; | |
| 984 | + $sil = $sat->dps->xi2 * $f2 + $sat->dps->xi3 * $f3; | |
| 985 | + $sll = $sat->dps->xl2 * $f2 + $sat->dps->xl3 * $f3 + $sat->dps->xl4 * $sinzf; | |
| 986 | + $sat->dps->sghl = $sat->dps->xgh2 * $f2 + $sat->dps->xgh3 * $f3 + $sat->dps->xgh4 * $sinzf; | |
| 987 | + $sat->dps->sh1 = $sat->dps->xh2 * $f2 + $sat->dps->xh3 * $f3; | |
| 988 | + $sat->dps->pe = $ses + $sel; | |
| 989 | + $sat->dps->pinc = $sis + $sil; | |
| 990 | + $sat->dps->pl = $sls + $sll; | |
| 991 | + } | |
| 992 | + | |
| 993 | + $pgh = $sat->dps->sghs + $sat->dps->sghl; | |
| 994 | + $ph = $sat->dps->shs + $sat->dps->sh1; | |
| 995 | + $sat->deep_arg->xinc = $sat->deep_arg->xinc + $sat->dps->pinc; | |
| 996 | + $sat->deep_arg->em = $sat->deep_arg->em + $sat->dps->pe; | |
| 997 | + | |
| 998 | +            	if ($sat->dps->xqncl >= 0.2) { | |
| 999 | + /* Apply periodics directly */ | |
| 1000 | + $ph = $ph / $sat->deep_arg->sinio; | |
| 1001 | + $pgh = $pgh - $sat->deep_arg->cosio * $ph; | |
| 1002 | + $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $pgh; | |
| 1003 | + $sat->deep_arg->xnode = $sat->deep_arg->xnode + $ph; | |
| 1004 | + $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; | |
| 1005 | +            	} else { | |
| 1006 | + /* Apply periodics with Lyddane modification */ | |
| 1007 | + $sinok = sin($sat->deep_arg->xnode); | |
| 1008 | + $cosok = cos($sat->deep_arg->xnode); | |
| 1009 | + $alfdp = $sinis * $sinok; | |
| 1010 | + $betdp = $sinis * $cosok; | |
| 1011 | + $dalf = $ph * $cosok + $sat->dps->pinc * $cosis * $sinok; | |
| 1012 | + $dbet = -$ph * $sinok + $sat->dps->pinc * $cosis * $cosok; | |
| 1013 | + $alfdp = $alfdp + $dalf; | |
| 1014 | + $betdp = $betdp + $dbet; | |
| 1015 | + $sat->deep_arg->xnode = Predict_Math::FMod2p($sat->deep_arg->xnode); | |
| 1016 | + $xls = $sat->deep_arg->xll + $sat->deep_arg->omgadf + $cosis * $sat->deep_arg->xnode; | |
| 1017 | + $dls = $sat->dps->pl + $pgh - $sat->dps->pinc * $sat->deep_arg->xnode * $sinis; | |
| 1018 | + $xls = $xls + $dls; | |
| 1019 | + $xnoh = $sat->deep_arg->xnode; | |
| 1020 | + $sat->deep_arg->xnode = Predict_Math::AcTan($alfdp, $betdp); | |
| 1021 | + | |
| 1022 | + /* This is a patch to Lyddane modification */ | |
| 1023 | + /* suggested by Rob Matson. */ | |
| 1024 | +                	if(abs($xnoh - $sat->deep_arg->xnode) > Predict::pi) { | |
| 1025 | +                    	if ($sat->deep_arg->xnode < $xnoh) { | |
| 1026 | + $sat->deep_arg->xnode += Predict::twopi; | |
| 1027 | +                    	} else { | |
| 1028 | + $sat->deep_arg->xnode -= Predict::twopi; | |
| 1029 | + } | |
| 1030 | + } | |
| 1031 | + | |
| 1032 | + $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; | |
| 1033 | + $sat->deep_arg->omgadf = $xls - $sat->deep_arg->xll - cos($sat->deep_arg->xinc) * | |
| 1034 | + $sat->deep_arg->xnode; | |
| 1035 | + } /* End case dpper: */ | |
| 1036 | + return; | |
| 1037 | 1037 | |
| 1038 | 1038 | } /* End switch(ientry) */ | 
| 1039 | 1039 | |