AuxiliaryElements.java

  1. /* Copyright 2002-2025 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.time.AbsoluteDate;


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  263. }