SBASPropagator.java

  1. /* Copyright 2002-2022 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.gnss;

  18. import org.hipparchus.analysis.differentiation.UnivariateDerivative2;
  19. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  20. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  21. import org.orekit.attitudes.AttitudeProvider;
  22. import org.orekit.errors.OrekitException;
  23. import org.orekit.errors.OrekitMessages;
  24. import org.orekit.frames.Frame;
  25. import org.orekit.orbits.CartesianOrbit;
  26. import org.orekit.orbits.Orbit;
  27. import org.orekit.propagation.SpacecraftState;
  28. import org.orekit.propagation.analytical.AbstractAnalyticalPropagator;
  29. import org.orekit.propagation.analytical.gnss.data.SBASOrbitalElements;
  30. import org.orekit.time.AbsoluteDate;
  31. import org.orekit.utils.PVCoordinates;

  32. /**
  33.  * This class aims at propagating a SBAS orbit from {@link SBASOrbitalElements}.
  34.  *
  35.  * @see "Tyler Reid, Todd Walker, Per Enge, L1/L5 SBAS MOPS Ephemeris Message to
  36.  *       Support Multiple Orbit Classes, ION ITM, 2013"
  37.  *
  38.  * @author Bryan Cazabonne
  39.  * @since 10.1
  40.  *
  41.  */
  42. public class SBASPropagator extends AbstractAnalyticalPropagator {

  43.     /** The SBAS orbital elements used. */
  44.     private final SBASOrbitalElements sbasOrbit;

  45.     /** The spacecraft mass (kg). */
  46.     private final double mass;

  47.     /** The Earth gravity coefficient used for SBAS propagation. */
  48.     private final double mu;

  49.     /** The ECI frame used for SBAS propagation. */
  50.     private final Frame eci;

  51.     /** The ECEF frame used for SBAS propagation. */
  52.     private final Frame ecef;

  53.     /**
  54.      * Private constructor.
  55.      * @param sbasOrbit Glonass orbital elements
  56.      * @param eci Earth Centered Inertial frame
  57.      * @param ecef Earth Centered Earth Fixed frame
  58.      * @param provider Attitude provider
  59.      * @param mass Satellite mass (kg)
  60.      * @param mu Earth's gravity coefficient used for SBAS propagation
  61.      */
  62.     SBASPropagator(final SBASOrbitalElements sbasOrbit, final Frame eci,
  63.                    final Frame ecef, final AttitudeProvider provider,
  64.                    final double mass, final double mu) {
  65.         super(provider);
  66.         // Stores the SBAS orbital elements
  67.         this.sbasOrbit = sbasOrbit;
  68.         // Sets the start date as the date of the orbital elements
  69.         setStartDate(sbasOrbit.getDate());
  70.         // Sets the mu
  71.         this.mu = mu;
  72.         // Sets the mass
  73.         this.mass = mass;
  74.         // Sets the Earth Centered Inertial frame
  75.         this.eci  = eci;
  76.         // Sets the Earth Centered Earth Fixed frame
  77.         this.ecef = ecef;
  78.     }

  79.     /**
  80.      * Gets the PVCoordinates of the GNSS SV in {@link #getECEF() ECEF frame}.
  81.      *
  82.      * <p>The algorithm uses automatic differentiation to compute velocity and
  83.      * acceleration.</p>
  84.      *
  85.      * @param date the computation date
  86.      * @return the GNSS SV PVCoordinates in {@link #getECEF() ECEF frame}
  87.      */
  88.     public PVCoordinates propagateInEcef(final AbsoluteDate date) {
  89.         // Duration from SBAS ephemeris Reference date
  90.         final UnivariateDerivative2 dt = new UnivariateDerivative2(getDT(date), 1.0, 0.0);
  91.         // Satellite coordinates
  92.         final UnivariateDerivative2 x = dt.multiply(dt.multiply(0.5 * sbasOrbit.getXDotDot()).add(sbasOrbit.getXDot())).add(sbasOrbit.getX());
  93.         final UnivariateDerivative2 y = dt.multiply(dt.multiply(0.5 * sbasOrbit.getYDotDot()).add(sbasOrbit.getYDot())).add(sbasOrbit.getY());
  94.         final UnivariateDerivative2 z = dt.multiply(dt.multiply(0.5 * sbasOrbit.getZDotDot()).add(sbasOrbit.getZDot())).add(sbasOrbit.getZ());
  95.         // Returns the Earth-fixed coordinates
  96.         final FieldVector3D<UnivariateDerivative2> positionwithDerivatives =
  97.                         new FieldVector3D<>(x, y, z);
  98.         return new PVCoordinates(new Vector3D(positionwithDerivatives.getX().getValue(),
  99.                                               positionwithDerivatives.getY().getValue(),
  100.                                               positionwithDerivatives.getZ().getValue()),
  101.                                  new Vector3D(positionwithDerivatives.getX().getFirstDerivative(),
  102.                                               positionwithDerivatives.getY().getFirstDerivative(),
  103.                                               positionwithDerivatives.getZ().getFirstDerivative()),
  104.                                  new Vector3D(positionwithDerivatives.getX().getSecondDerivative(),
  105.                                               positionwithDerivatives.getY().getSecondDerivative(),
  106.                                               positionwithDerivatives.getZ().getSecondDerivative()));
  107.     }

  108.     /** {@inheritDoc} */
  109.     protected Orbit propagateOrbit(final AbsoluteDate date) {
  110.         // Gets the PVCoordinates in ECEF frame
  111.         final PVCoordinates pvaInECEF = propagateInEcef(date);
  112.         // Transforms the PVCoordinates to ECI frame
  113.         final PVCoordinates pvaInECI = ecef.getTransformTo(eci, date).transformPVCoordinates(pvaInECEF);
  114.         // Returns the Cartesian orbit
  115.         return new CartesianOrbit(pvaInECI, eci, date, mu);
  116.     }

  117.     /**
  118.      * Get the Earth gravity coefficient used for SBAS propagation.
  119.      * @return the Earth gravity coefficient.
  120.      */
  121.     public double getMU() {
  122.         return mu;
  123.     }

  124.     /**
  125.      * Gets the Earth Centered Inertial frame used to propagate the orbit.
  126.      *
  127.      * @return the ECI frame
  128.      */
  129.     public Frame getECI() {
  130.         return eci;
  131.     }

  132.     /**
  133.      * Gets the Earth Centered Earth Fixed frame used to propagate GNSS orbits.
  134.      *
  135.      * @return the ECEF frame
  136.      */
  137.     public Frame getECEF() {
  138.         return ecef;
  139.     }

  140.     /**
  141.      * Get the underlying SBAS orbital elements.
  142.      *
  143.      * @return the underlying SBAS orbital elements
  144.      */
  145.     public SBASOrbitalElements getSBASOrbitalElements() {
  146.         return sbasOrbit;
  147.     }

  148.     /** {@inheritDoc} */
  149.     public Frame getFrame() {
  150.         return eci;
  151.     }

  152.     /** {@inheritDoc} */
  153.     public void resetInitialState(final SpacecraftState state) {
  154.         throw new OrekitException(OrekitMessages.NON_RESETABLE_STATE);
  155.     }

  156.     /** {@inheritDoc} */
  157.     protected double getMass(final AbsoluteDate date) {
  158.         return mass;
  159.     }

  160.     /** {@inheritDoc} */
  161.     protected void resetIntermediateState(final SpacecraftState state, final boolean forward) {
  162.         throw new OrekitException(OrekitMessages.NON_RESETABLE_STATE);
  163.     }

  164.     /** Get the duration from SBAS Reference epoch.
  165.      * @param date the considered date
  166.      * @return the duration from SBAS orbit Reference epoch (s)
  167.      */
  168.     private double getDT(final AbsoluteDate date) {
  169.         // Time from ephemeris reference epoch
  170.         return date.durationFrom(sbasOrbit.getDate());
  171.     }

  172. }