SDP4.java

  1. /* Copyright 2002-2020 CS Group
  2.  * Licensed to CS Group (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.frames.Frame;
  22. import org.orekit.time.AbsoluteDate;
  23. import org.orekit.time.DateTimeComponents;
  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="https://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 VisibilityModifier check

  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 VisibilityModifier check

  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.      * @param teme the TEME frame to use for propagation.
  55.      */
  56.     protected SDP4(final TLE initialTLE,
  57.                    final AttitudeProvider attitudeProvider,
  58.                    final double mass,
  59.                    final Frame teme) {
  60.         super(initialTLE, attitudeProvider, mass, teme);
  61.     }

  62.     /** Initialization proper to each propagator (SGP or SDP).
  63.      */
  64.     protected void sxpInitialize() {
  65.         luniSolarTermsComputation();
  66.     }  // End of initialization

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

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

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

  79.         deepSecularEffects(tSince);

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

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

  85.         deepPeriodicEffects(tSince);

  86.         xl = xll + omgadf + xnode;

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

  95.     /** Computes SPACETRACK#3 compliant earth rotation angle.
  96.      * @param date the current date
  97.      * @return the ERA (rad)
  98.      */
  99.     protected double thetaG(final AbsoluteDate date) {

  100.         // Reference:  The 1992 Astronomical Almanac, page B6.
  101.         final double omega_E = 1.00273790934;
  102.         final double jd = date
  103.                 .getComponents(utc)
  104.                 .offsetFrom(DateTimeComponents.JULIAN_EPOCH) /
  105.                 Constants.JULIAN_DAY;

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

  117.         return MathUtils.TWO_PI * GMST / seconds_per_day;

  118.     }

  119.     /** Computes luni - solar terms from initial coordinates and epoch.
  120.      */
  121.     protected abstract void luniSolarTermsComputation();

  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. }