SDP4.java

  1. /* Copyright 2002-2017 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.errors.OrekitException;
  22. import org.orekit.time.AbsoluteDate;
  23. import org.orekit.time.TimeScalesFactory;
  24. import org.orekit.utils.Constants;

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

  38.     // CHECKSTYLE: stop VisibilityModifierCheck

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

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

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

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

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

  49.     // CHECKSTYLE: resume VisibilityModifierCheck

  50.     /** Constructor for a unique initial TLE.
  51.      * @param initialTLE the TLE to propagate.
  52.      * @param attitudeProvider provider for attitude computation
  53.      * @param mass spacecraft mass (kg)
  54.      * @exception OrekitException if some specific error occurs
  55.      */
  56.     protected SDP4(final TLE initialTLE, final AttitudeProvider attitudeProvider,
  57.                    final double mass) throws OrekitException {
  58.         super(initialTLE, attitudeProvider, mass);
  59.     }

  60.     /** Initialization proper to each propagator (SGP or SDP).
  61.      * @exception OrekitException when UTC time steps can't be read
  62.      */
  63.     protected void sxpInitialize() throws OrekitException {
  64.         luniSolarTermsComputation();
  65.     }  // End of initialization

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

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

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

  78.         deepSecularEffects(tSince);

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

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

  84.         deepPeriodicEffects(tSince);

  85.         xl = xll + omgadf + xnode;

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

  94.     /** Computes SPACETRACK#3 compliant earth rotation angle.
  95.      * @param date the current date
  96.      * @return the ERA (rad)
  97.      * @exception OrekitException when UTC time steps can't be read
  98.      */
  99.     protected static double thetaG(final AbsoluteDate date) throws OrekitException {

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

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

  116.         return MathUtils.TWO_PI * GMST / seconds_per_day;

  117.     }

  118.     /** Computes luni - solar terms from initial coordinates and epoch.
  119.      * @exception OrekitException when UTC time steps can't be read
  120.      */
  121.     protected abstract void luniSolarTermsComputation() throws OrekitException;

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

  126.     /** Computes periodic terms from current coordinates and epoch.
  127.      * @param t offset from initial epoch (min)
  128.      */
  129.     protected abstract void deepPeriodicEffects(double t);

  130. }