SDP4.java

  1. /* Copyright 2002-2019 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.propagation.analytical.tle;

  18. import org.hipparchus.util.FastMath;
  19. import org.hipparchus.util.MathUtils;
  20. import org.orekit.attitudes.AttitudeProvider;
  21. import org.orekit.time.AbsoluteDate;
  22. import org.orekit.time.TimeScalesFactory;
  23. import org.orekit.utils.Constants;

  24. /** This class contains methods to compute propagated coordinates with the SDP4 model.
  25.  * <p>
  26.  * The user should not bother in this class since it is handled internally by the
  27.  * {@link TLEPropagator}.
  28.  * </p>
  29.  * <p>This implementation is largely inspired from the paper and source code <a
  30.  * href="http://www.celestrak.com/publications/AIAA/2006-6753/">Revisiting Spacetrack
  31.  * Report #3</a> and is fully compliant with its results and tests cases.</p>
  32.  * @author Felix R. Hoots, Ronald L. Roehrich, December 1980 (original fortran)
  33.  * @author David A. Vallado, Paul Crawford, Richard Hujsak, T.S. Kelso (C++ translation and improvements)
  34.  * @author Fabien Maussion (java translation)
  35.  */
  36. abstract class SDP4  extends TLEPropagator {

  37.     // CHECKSTYLE: stop VisibilityModifier check

  38.     /** New perigee argument. */
  39.     protected double omgadf;

  40.     /** New mean motion. */
  41.     protected double xn;

  42.     /** Parameter for xl computation. */
  43.     protected double xll;

  44.     /** New eccentricity. */
  45.     protected double em;

  46.     /** New inclination. */
  47.     protected double xinc;

  48.     // CHECKSTYLE: resume VisibilityModifier check

  49.     /** Constructor for a unique initial TLE.
  50.      * @param initialTLE the TLE to propagate.
  51.      * @param attitudeProvider provider for attitude computation
  52.      * @param mass spacecraft mass (kg)
  53.      */
  54.     protected SDP4(final TLE initialTLE, final AttitudeProvider attitudeProvider,
  55.                    final double mass) {
  56.         super(initialTLE, attitudeProvider, mass);
  57.     }

  58.     /** Initialization proper to each propagator (SGP or SDP).
  59.      */
  60.     protected void sxpInitialize() {
  61.         luniSolarTermsComputation();
  62.     }  // End of initialization

  63.     /** Propagation proper to each propagator (SGP or SDP).
  64.      * @param tSince the offset from initial epoch (minutes)
  65.      */
  66.     protected void sxpPropagate(final double tSince) {

  67.         // Update for secular gravity and atmospheric drag
  68.         omgadf = tle.getPerigeeArgument() + omgdot * tSince;
  69.         final double xnoddf = tle.getRaan() + xnodot * tSince;
  70.         final double tSinceSq = tSince * tSince;
  71.         xnode = xnoddf + xnodcf * tSinceSq;
  72.         xn = xn0dp;

  73.         // Update for deep-space secular effects
  74.         xll = tle.getMeanAnomaly() + xmdot * tSince;

  75.         deepSecularEffects(tSince);

  76.         final double tempa = 1 - c1 * tSince;
  77.         a   = FastMath.pow(TLEConstants.XKE / xn, TLEConstants.TWO_THIRD) * tempa * tempa;
  78.         em -= tle.getBStar() * c4 * tSince;

  79.         // Update for deep-space periodic effects
  80.         xll += xn0dp * t2cof * tSinceSq;

  81.         deepPeriodicEffects(tSince);

  82.         xl = xll + omgadf + xnode;

  83.         // Dundee change:  Reset cosio,  sinio for new xinc:
  84.         cosi0 = FastMath.cos(xinc);
  85.         sini0 = FastMath.sin(xinc);
  86.         e = em;
  87.         i = xinc;
  88.         omega = omgadf;
  89.         // end of calculus, go for PV computation
  90.     }

  91.     /** Computes SPACETRACK#3 compliant earth rotation angle.
  92.      * @param date the current date
  93.      * @return the ERA (rad)
  94.      */
  95.     protected static double thetaG(final AbsoluteDate date) {

  96.         // Reference:  The 1992 Astronomical Almanac, page B6.
  97.         final double omega_E = 1.00273790934;
  98.         final double jd = (date.durationFrom(AbsoluteDate.JULIAN_EPOCH) +
  99.                            date.timeScalesOffset(TimeScalesFactory.getUTC(), TimeScalesFactory.getTT())
  100.                           ) / Constants.JULIAN_DAY;

  101.         // Earth rotations per sidereal day (non-constant)
  102.         final double UT = (jd + 0.5) % 1;
  103.         final double seconds_per_day = Constants.JULIAN_DAY;
  104.         final double jd_2000 = 2451545.0;   /* 1.5 Jan 2000 = JD 2451545. */
  105.         final double t_cen = (jd - UT - jd_2000) / 36525.;
  106.         double GMST = 24110.54841 +
  107.                       t_cen * (8640184.812866 + t_cen * (0.093104 - t_cen * 6.2E-6));
  108.         GMST = (GMST + seconds_per_day * omega_E * UT) % seconds_per_day;
  109.         if (GMST < 0.) {
  110.             GMST += seconds_per_day;
  111.         }

  112.         return MathUtils.TWO_PI * GMST / seconds_per_day;

  113.     }

  114.     /** Computes luni - solar terms from initial coordinates and epoch.
  115.      */
  116.     protected abstract void luniSolarTermsComputation();

  117.     /** Computes secular terms from current coordinates and epoch.
  118.      * @param t offset from initial epoch (min)
  119.      */
  120.     protected abstract void deepSecularEffects(double t);

  121.     /** Computes periodic terms from current coordinates and epoch.
  122.      * @param t offset from initial epoch (min)
  123.      */
  124.     protected abstract void deepPeriodicEffects(double t);

  125. }