AuxiliaryElements.java

  1. /* Copyright 2002-2018 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.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.     /** Central body attraction coefficient. */
  36.     private final double mu;

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

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

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

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

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

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

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

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

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

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

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

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

  73.     /** A = sqrt(μ * a). */
  74.     private final double A;

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

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

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

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

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

  85.     /** Direction cosine α. */
  86.     private final double alpha;

  87.     /** Direction cosine β. */
  88.     private final double beta;

  89.     /** Direction cosine γ. */
  90.     private final double gamma;

  91.     /** Simple constructor.
  92.      * @param orbit related mean orbit for auxiliary elements
  93.      * @param retrogradeFactor retrograde factor I [Eq. 2.1.2-(2)]
  94.      */
  95.     public AuxiliaryElements(final Orbit orbit, final int retrogradeFactor) {
  96.         // Date of the orbit
  97.         date = orbit.getDate();

  98.         // Orbit definition frame
  99.         frame = orbit.getFrame();

  100.         // Central body attraction coefficient
  101.         mu = orbit.getMu();

  102.         // Eccentricity
  103.         ecc = orbit.getE();

  104.         // Keplerian mean motion
  105.         n = orbit.getKeplerianMeanMotion();

  106.         // Keplerian period
  107.         period = orbit.getKeplerianPeriod();

  108.         // Equinoctial elements [Eq. 2.1.2-(1)]
  109.         sma = orbit.getA();
  110.         k   = orbit.getEquinoctialEx();
  111.         h   = orbit.getEquinoctialEy();
  112.         q   = orbit.getHx();
  113.         p   = orbit.getHy();
  114.         lm  = MathUtils.normalizeAngle(orbit.getLM(), FastMath.PI);
  115.         lv  = MathUtils.normalizeAngle(orbit.getLv(), FastMath.PI);
  116.         le  = MathUtils.normalizeAngle(orbit.getLE(), FastMath.PI);

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

  119.         final double k2 = k * k;
  120.         final double h2 = h * h;
  121.         final double q2 = q * q;
  122.         final double p2 = p * p;

  123.         // A, B, C parameters [Eq. 2.1.6-(1)]
  124.         A = FastMath.sqrt(mu * sma);
  125.         B = FastMath.sqrt(1 - k2 - h2);
  126.         C = 1 + q2 + p2;

  127.         // Equinoctial reference frame [Eq. 2.1.4-(1)]
  128.         final double ooC = 1. / C;
  129.         final double px2 = 2. * p;
  130.         final double qx2 = 2. * q;
  131.         final double pq2 = px2 * q;
  132.         f = new Vector3D(ooC, new Vector3D(1. - p2 + q2, pq2, -px2 * I));
  133.         g = new Vector3D(ooC, new Vector3D(pq2 * I, (1. + p2 - q2) * I, qx2));
  134.         w = new Vector3D(ooC, new Vector3D(px2, -qx2, (1. - p2 - q2) * I));

  135.         // Direction cosines for central body [Eq. 2.1.9-(1)]
  136.         alpha = f.getZ();
  137.         beta  = g.getZ();
  138.         gamma = w.getZ();
  139.     }

  140.     /** Get the date of the orbit.
  141.      * @return the date
  142.      */
  143.     public AbsoluteDate getDate() {
  144.         return date;
  145.     }

  146.     /** Get the definition frame of the orbit.
  147.      * @return the definition frame
  148.      */
  149.     public Frame getFrame() {
  150.         return frame;
  151.     }

  152.     /** Get the central body attraction coefficient.
  153.      * @return μ
  154.      */
  155.     public double getMu() {
  156.         return mu;
  157.     }

  158.     /** Get the eccentricity.
  159.      * @return ecc
  160.      */
  161.     public double getEcc() {
  162.         return ecc;
  163.     }

  164.     /** Get the Keplerian mean motion.
  165.      * @return n
  166.      */
  167.     public double getMeanMotion() {
  168.         return n;
  169.     }

  170.     /** Get the Keplerian period.
  171.      * @return period
  172.      */
  173.     public double getKeplerianPeriod() {
  174.         return period;
  175.     }

  176.     /** Get the semi-major axis.
  177.      * @return the semi-major axis a
  178.      */
  179.     public double getSma() {
  180.         return sma;
  181.     }

  182.     /** Get the x component of eccentricity vector.
  183.      * <p>
  184.      * This element called k in DSST corresponds to ex
  185.      * for the {@link org.orekit.orbits.EquinoctialOrbit}
  186.      * </p>
  187.      * @return k
  188.      */
  189.     public double getK() {
  190.         return k;
  191.     }

  192.     /** Get the y component of eccentricity vector.
  193.      * <p>
  194.      * This element called h in DSST corresponds to ey
  195.      * for the {@link org.orekit.orbits.EquinoctialOrbit}
  196.      * </p>
  197.      * @return h
  198.      */
  199.     public double getH() {
  200.         return h;
  201.     }

  202.     /** Get the x component of inclination vector.
  203.      * <p>
  204.      * This element called q in DSST corresponds to hx
  205.      * for the {@link org.orekit.orbits.EquinoctialOrbit}
  206.      * </p>
  207.      * @return q
  208.      */
  209.     public double getQ() {
  210.         return q;
  211.     }

  212.     /** Get the y component of inclination vector.
  213.      * <p>
  214.      * This element called p in DSST corresponds to hy
  215.      * for the {@link org.orekit.orbits.EquinoctialOrbit}
  216.      * </p>
  217.      * @return p
  218.      */
  219.     public double getP() {
  220.         return p;
  221.     }

  222.     /** Get the mean longitude.
  223.      * @return lm
  224.      */
  225.     public double getLM() {
  226.         return lm;
  227.     }

  228.     /** Get the true longitude.
  229.      * @return lv
  230.      */
  231.     public double getLv() {
  232.         return lv;
  233.     }

  234.     /** Get the eccentric longitude.
  235.      * @return lf
  236.      */
  237.     public double getLf() {
  238.         return le;
  239.     }

  240.     /** Get the retrograde factor.
  241.      * @return the retrograde factor I
  242.      */
  243.     public int getRetrogradeFactor() {
  244.         return I;
  245.     }

  246.     /** Get A = sqrt(μ * a).
  247.      * @return A
  248.      */
  249.     public double getA() {
  250.         return A;
  251.     }

  252.     /** Get B = sqrt(1 - e²).
  253.      * @return B
  254.      */
  255.     public double getB() {
  256.         return B;
  257.     }

  258.     /** Get C = 1 + p² + q².
  259.      * @return C
  260.      */
  261.     public double getC() {
  262.         return C;
  263.     }

  264.     /** Get equinoctial frame vector f.
  265.      * @return f vector
  266.      */
  267.     public Vector3D getVectorF() {
  268.         return f;
  269.     }

  270.     /** Get equinoctial frame vector g.
  271.      * @return g vector
  272.      */
  273.     public Vector3D getVectorG() {
  274.         return g;
  275.     }

  276.     /** Get equinoctial frame vector w.
  277.      * @return w vector
  278.      */
  279.     public Vector3D getVectorW() {
  280.         return w;
  281.     }

  282.     /** Get direction cosine α for central body.
  283.      * @return α
  284.      */
  285.     public double getAlpha() {
  286.         return alpha;
  287.     }

  288.     /** Get direction cosine β for central body.
  289.      * @return β
  290.      */
  291.     public double getBeta() {
  292.         return beta;
  293.     }

  294.     /** Get direction cosine γ for central body.
  295.      * @return γ
  296.      */
  297.     public double getGamma() {
  298.         return gamma;
  299.     }

  300. }