FieldSDP4.java

  1. /* Copyright 2002-2024 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.CalculusFieldElement;
  19. import org.hipparchus.util.FastMath;
  20. import org.hipparchus.util.FieldSinCos;
  21. import org.hipparchus.util.MathUtils;
  22. import org.orekit.attitudes.AttitudeProvider;
  23. import org.orekit.frames.Frame;
  24. import org.orekit.time.DateTimeComponents;
  25. import org.orekit.time.FieldAbsoluteDate;
  26. import org.orekit.utils.Constants;

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

  43.     // CHECKSTYLE: stop VisibilityModifier check

  44.     /** New perigee argument. */
  45.     protected T omgadf;

  46.     /** New mean motion. */
  47.     protected T xn;

  48.     /** Parameter for xl computation. */
  49.     protected T xll;

  50.     /** New eccentricity. */
  51.     protected T em;

  52.     /** New inclination. */
  53.     protected T xinc;

  54.     // CHECKSTYLE: resume VisibilityModifier check

  55.     /** Constructor for a unique initial TLE.
  56.      * @param initialTLE the TLE to propagate.
  57.      * @param attitudeProvider provider for attitude computation
  58.      * @param mass spacecraft mass (kg)
  59.      * @param teme the TEME frame to use for propagation.
  60.      * @param parameters SGP4 and SDP4 model parameters
  61.      */
  62.     protected FieldSDP4(final FieldTLE<T> initialTLE,
  63.                    final AttitudeProvider attitudeProvider,
  64.                    final T mass,
  65.                    final Frame teme,
  66.                    final T[] parameters) {
  67.         super(initialTLE, attitudeProvider, mass, teme, parameters);
  68.     }

  69.     /** Initialization proper to each propagator (SGP or SDP).
  70.      * @param parameters model parameters
  71.      */
  72.     protected void sxpInitialize(final T[] parameters) {
  73.         luniSolarTermsComputation();
  74.     }  // End of initialization

  75.     /** Propagation proper to each propagator (SGP or SDP).
  76.      * @param tSince the offset from initial epoch (minutes)
  77.      * @param parameters model parameters
  78.      */
  79.     protected void sxpPropagate(final T tSince, final T[] parameters) {

  80.         // Update for secular gravity and atmospheric drag
  81.         final T bStar = parameters[0];
  82.         omgadf = tle.getPerigeeArgument().add(omgdot.multiply(tSince));
  83.         final T xnoddf = tle.getRaan().add(xnodot.multiply(tSince));
  84.         final T tSinceSq = tSince.square();
  85.         xnode = xnoddf.add(xnodcf.multiply(tSinceSq));
  86.         xn = xn0dp;

  87.         // Update for deep-space secular effects
  88.         xll = tle.getMeanAnomaly().add(xmdot.multiply(tSince));

  89.         deepSecularEffects(tSince);

  90.         final T tempa = c1.multiply(tSince).negate().add(1.0);
  91.         a  = xn.reciprocal().multiply(TLEConstants.XKE).pow(TLEConstants.TWO_THIRD).multiply(tempa).multiply(tempa);
  92.         em = em.subtract(bStar.multiply(c4).multiply(tSince));

  93.         // Update for deep-space periodic effects
  94.         xll = xll.add(xn0dp.multiply(t2cof).multiply(tSinceSq));

  95.         deepPeriodicEffects(tSince);

  96.         xl = xll.add(omgadf).add(xnode);

  97.         // Dundee change:  Reset cosio,  sinio for new xinc:
  98.         final FieldSinCos<T> scI0 = FastMath.sinCos(xinc);
  99.         cosi0 = scI0.cos();
  100.         sini0 = scI0.sin();
  101.         e = em;
  102.         i = xinc;
  103.         omega = omgadf;
  104.         // end of calculus, go for PV computation
  105.     }

  106.     /** Computes SPACETRACK#3 compliant earth rotation angle.
  107.      * @param date the current date
  108.      * @return the ERA (rad)
  109.      */
  110.     protected double thetaG(final FieldAbsoluteDate<T> date) {

  111.         // Reference:  The 1992 Astronomical Almanac, page B6.
  112.         final double omega_E = 1.00273790934;
  113.         final double jd = date
  114.                 .getComponents(utc)
  115.                 .offsetFrom(DateTimeComponents.JULIAN_EPOCH) /
  116.                 Constants.JULIAN_DAY;

  117.         // Earth rotations per sidereal day (non-constant)
  118.         final double UT = (jd + 0.5) % 1;
  119.         final double seconds_per_day = Constants.JULIAN_DAY;
  120.         final double jd_2000 = 2451545.0;   /* 1.5 Jan 2000 = JD 2451545. */
  121.         final double t_cen = (jd - UT - jd_2000) / 36525.;
  122.         double GMST = 24110.54841 +
  123.                       t_cen * (8640184.812866 + t_cen * (0.093104 - t_cen * 6.2E-6));
  124.         GMST = (GMST + seconds_per_day * omega_E * UT) % seconds_per_day;
  125.         if (GMST < 0.) {
  126.             GMST += seconds_per_day;
  127.         }

  128.         return MathUtils.TWO_PI * GMST / seconds_per_day;

  129.     }

  130.     /** Computes luni - solar terms from initial coordinates and epoch.
  131.      */
  132.     protected abstract void luniSolarTermsComputation();

  133.     /** Computes secular terms from current coordinates and epoch.
  134.      * @param t offset from initial epoch (min)
  135.      */
  136.     protected abstract void deepSecularEffects(T t);

  137.     /** Computes periodic terms from current coordinates and epoch.
  138.      * @param t offset from initial epoch (min)
  139.      */
  140.     protected abstract void deepPeriodicEffects(T t);

  141. }