AuxiliaryElements.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.semianalytical.dsst.utilities;

  18. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  19. import org.hipparchus.util.FastMath;
  20. import org.hipparchus.util.MathUtils;
  21. import org.orekit.frames.Frame;
  22. import org.orekit.orbits.Orbit;
  23. import org.orekit.propagation.semianalytical.dsst.forces.DSSTGravityContext;
  24. import org.orekit.time.AbsoluteDate;


  25. /** Container class for common parameters used by all DSST forces.
  26.  *  <p>
  27.  *  Most of them are defined in Danielson paper at § 2.1.
  28.  *  </p>
  29.  *  @author Pascal Parraud
  30.  */
  31. public class AuxiliaryElements {

  32.     /** Orbit date. */
  33.     private final AbsoluteDate date;

  34.     /** Orbit frame. */
  35.     private final Frame frame;

  36.     /** Eccentricity. */
  37.     private final double ecc;

  38.     /** Keplerian mean motion. */
  39.     private final double n;

  40.     /** Keplerian period. */
  41.     private final double period;

  42.     /** Semi-major axis. */
  43.     private final double sma;

  44.     /** x component of eccentricity vector. */
  45.     private final double k;

  46.     /** y component of eccentricity vector. */
  47.     private final double h;

  48.     /** x component of inclination vector. */
  49.     private final double q;

  50.     /** y component of inclination vector. */
  51.     private final double p;

  52.     /** Mean longitude. */
  53.     private final double lm;

  54.     /** True longitude. */
  55.     private final double lv;

  56.     /** Eccentric longitude. */
  57.     private final double le;

  58.     /** Retrograde factor I.
  59.      *  <p>
  60.      *  DSST model needs equinoctial orbit as internal representation.
  61.      *  Classical equinoctial elements have discontinuities when inclination
  62.      *  is close to zero. In this representation, I = +1. <br>
  63.      *  To avoid this discontinuity, another representation exists and equinoctial
  64.      *  elements can be expressed in a different way, called "retrograde" orbit.
  65.      *  This implies I = -1. <br>
  66.      *  As Orekit doesn't implement the retrograde orbit, I is always set to +1.
  67.      *  But for the sake of consistency with the theory, the retrograde factor
  68.      *  has been kept in the formulas.
  69.      *  </p>
  70.      */
  71.     private final int    I;

  72.     /** Orbit. */
  73.     private Orbit orbit;

  74.     /** B = sqrt(1 - h² - k²). */
  75.     private final double B;

  76.     /** C = 1 + p² + q². */
  77.     private final double C;

  78.     /** Equinoctial frame f vector. */
  79.     private final Vector3D f;

  80.     /** Equinoctial frame g vector. */
  81.     private final Vector3D g;

  82.     /** Equinoctial frame w vector. */
  83.     private final Vector3D w;

  84.     /** Simple constructor.
  85.      * @param orbit related mean orbit for auxiliary elements
  86.      * @param retrogradeFactor retrograde factor I [Eq. 2.1.2-(2)]
  87.      */
  88.     public AuxiliaryElements(final Orbit orbit, final int retrogradeFactor) {

  89.         // Orbit
  90.         this.orbit = orbit;

  91.         // Date of the orbit
  92.         date = orbit.getDate();

  93.         // Orbit definition frame
  94.         frame = orbit.getFrame();

  95.         // Eccentricity
  96.         ecc = orbit.getE();

  97.         // Keplerian mean motion
  98.         n = orbit.getKeplerianMeanMotion();

  99.         // Keplerian period
  100.         period = orbit.getKeplerianPeriod();

  101.         // Equinoctial elements [Eq. 2.1.2-(1)]
  102.         sma = orbit.getA();
  103.         k   = orbit.getEquinoctialEx();
  104.         h   = orbit.getEquinoctialEy();
  105.         q   = orbit.getHx();
  106.         p   = orbit.getHy();
  107.         lm  = MathUtils.normalizeAngle(orbit.getLM(), FastMath.PI);
  108.         lv  = MathUtils.normalizeAngle(orbit.getLv(), FastMath.PI);
  109.         le  = MathUtils.normalizeAngle(orbit.getLE(), FastMath.PI);

  110.         // Retrograde factor [Eq. 2.1.2-(2)]
  111.         I = retrogradeFactor;

  112.         final double k2 = k * k;
  113.         final double h2 = h * h;
  114.         final double q2 = q * q;
  115.         final double p2 = p * p;

  116.         // A, B, C parameters [Eq. 2.1.6-(1)]
  117.         B = FastMath.sqrt(1 - k2 - h2);
  118.         C = 1 + q2 + p2;

  119.         // Equinoctial reference frame [Eq. 2.1.4-(1)]
  120.         final double ooC = 1. / C;
  121.         final double px2 = 2. * p;
  122.         final double qx2 = 2. * q;
  123.         final double pq2 = px2 * q;
  124.         f = new Vector3D(ooC, new Vector3D(1. - p2 + q2, pq2, -px2 * I));
  125.         g = new Vector3D(ooC, new Vector3D(pq2 * I, (1. + p2 - q2) * I, qx2));
  126.         w = new Vector3D(ooC, new Vector3D(px2, -qx2, (1. - p2 - q2) * I));
  127.     }

  128.     /** Get the orbit.
  129.      * @return the orbit
  130.      */
  131.     public Orbit getOrbit() {
  132.         return orbit;
  133.     }

  134.     /** Get the date of the orbit.
  135.      * @return the date
  136.      */
  137.     public AbsoluteDate getDate() {
  138.         return date;
  139.     }

  140.     /** Get the definition frame of the orbit.
  141.      * @return the definition frame
  142.      */
  143.     public Frame getFrame() {
  144.         return frame;
  145.     }

  146.     /** Get the eccentricity.
  147.      * @return ecc
  148.      */
  149.     public double getEcc() {
  150.         return ecc;
  151.     }

  152.     /** Get the Keplerian mean motion.
  153.      * @return n
  154.      */
  155.     public double getMeanMotion() {
  156.         return n;
  157.     }

  158.     /** Get the Keplerian period.
  159.      * @return period
  160.      */
  161.     public double getKeplerianPeriod() {
  162.         return period;
  163.     }

  164.     /** Get the semi-major axis.
  165.      * @return the semi-major axis a
  166.      */
  167.     public double getSma() {
  168.         return sma;
  169.     }

  170.     /** Get the x component of eccentricity vector.
  171.      * <p>
  172.      * This element called k in DSST corresponds to ex
  173.      * for the {@link org.orekit.orbits.EquinoctialOrbit}
  174.      * </p>
  175.      * @return k
  176.      */
  177.     public double getK() {
  178.         return k;
  179.     }

  180.     /** Get the y component of eccentricity vector.
  181.      * <p>
  182.      * This element called h in DSST corresponds to ey
  183.      * for the {@link org.orekit.orbits.EquinoctialOrbit}
  184.      * </p>
  185.      * @return h
  186.      */
  187.     public double getH() {
  188.         return h;
  189.     }

  190.     /** Get the x component of inclination vector.
  191.      * <p>
  192.      * This element called q in DSST corresponds to hx
  193.      * for the {@link org.orekit.orbits.EquinoctialOrbit}
  194.      * </p>
  195.      * @return q
  196.      */
  197.     public double getQ() {
  198.         return q;
  199.     }

  200.     /** Get the y component of inclination vector.
  201.      * <p>
  202.      * This element called p in DSST corresponds to hy
  203.      * for the {@link org.orekit.orbits.EquinoctialOrbit}
  204.      * </p>
  205.      * @return p
  206.      */
  207.     public double getP() {
  208.         return p;
  209.     }

  210.     /** Get the mean longitude.
  211.      * @return lm
  212.      */
  213.     public double getLM() {
  214.         return lm;
  215.     }

  216.     /** Get the true longitude.
  217.      * @return lv
  218.      */
  219.     public double getLv() {
  220.         return lv;
  221.     }

  222.     /** Get the eccentric longitude.
  223.      * @return lf
  224.      */
  225.     public double getLf() {
  226.         return le;
  227.     }

  228.     /** Get the retrograde factor.
  229.      * @return the retrograde factor I
  230.      */
  231.     public int getRetrogradeFactor() {
  232.         return I;
  233.     }

  234.     /** Get B = sqrt(1 - e²).
  235.      * @return B
  236.      */
  237.     public double getB() {
  238.         return B;
  239.     }

  240.     /** Get C = 1 + p² + q².
  241.      * @return C
  242.      */
  243.     public double getC() {
  244.         return C;
  245.     }

  246.     /** Get equinoctial frame vector f.
  247.      * @return f vector
  248.      */
  249.     public Vector3D getVectorF() {
  250.         return f;
  251.     }

  252.     /** Get equinoctial frame vector g.
  253.      * @return g vector
  254.      */
  255.     public Vector3D getVectorG() {
  256.         return g;
  257.     }

  258.     /** Get equinoctial frame vector w.
  259.      * @return w vector
  260.      */
  261.     public Vector3D getVectorW() {
  262.         return w;
  263.     }

  264.     /** Get direction cosine α for central body.
  265.      * @return α
  266.      * @deprecated since 12.2, use {@link DSSTGravityContext#getAlpha()} instead
  267.      */
  268.     @Deprecated
  269.     public double getAlpha() {
  270.         return f.getZ();
  271.     }

  272.     /** Get direction cosine β for central body.
  273.      * @return β
  274.      * @deprecated since 12.2, use {@link DSSTGravityContext#getBeta()} instead
  275.      */
  276.     @Deprecated
  277.     public double getBeta() {
  278.         return g.getZ();
  279.     }

  280.     /** Get direction cosine γ for central body.
  281.      * @return γ
  282.      * @deprecated since 12.2, use {@link DSSTGravityContext#getGamma()} instead
  283.      */
  284.     @Deprecated
  285.     public double getGamma() {
  286.         return w.getZ();
  287.     }
  288. }