IntelsatElevenElementsPropagator.java

  1. /* Copyright 2002-2025 Airbus Defence and Space
  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.  * Airbus Defence and Space 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.intelsat;

  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.hipparchus.util.FastMath;
  22. import org.hipparchus.util.FieldSinCos;
  23. import org.orekit.annotation.DefaultDataContext;
  24. import org.orekit.attitudes.Attitude;
  25. import org.orekit.attitudes.AttitudeProvider;
  26. import org.orekit.attitudes.FrameAlignedProvider;
  27. import org.orekit.data.DataContext;
  28. import org.orekit.errors.OrekitException;
  29. import org.orekit.errors.OrekitMessages;
  30. import org.orekit.frames.Frame;
  31. import org.orekit.frames.FramesFactory;
  32. import org.orekit.orbits.CartesianOrbit;
  33. import org.orekit.orbits.Orbit;
  34. import org.orekit.propagation.Propagator;
  35. import org.orekit.propagation.SpacecraftState;
  36. import org.orekit.propagation.analytical.AbstractAnalyticalPropagator;
  37. import org.orekit.time.AbsoluteDate;
  38. import org.orekit.utils.Constants;
  39. import org.orekit.utils.IERSConventions;
  40. import org.orekit.utils.PVCoordinates;
  41. import org.orekit.utils.units.Unit;

  42. /**
  43.  * This class provides elements to propagate Intelsat's 11 elements.
  44.  * <p>
  45.  * Intelsat's 11 elements propagation is defined in ITU-R S.1525 standard.
  46.  * </p>
  47.  *
  48.  * @author Bryan Cazabonne
  49.  * @since 12.1
  50.  */
  51. public class IntelsatElevenElementsPropagator extends AbstractAnalyticalPropagator {

  52.     /**
  53.      * Intelsat's 11 elements.
  54.      */
  55.     private final IntelsatElevenElements elements;

  56.     /**
  57.      * Inertial frame for the output orbit.
  58.      */
  59.     private final Frame inertialFrame;

  60.     /**
  61.      * ECEF frame related to the Intelsat's 11 elements.
  62.      */
  63.     private final Frame ecefFrame;

  64.     /**
  65.      * Spacecraft mass in kilograms.
  66.      */
  67.     private final double mass;

  68.     /**
  69.      * Compute spacecraft's east longitude.
  70.      */
  71.     private UnivariateDerivative2 eastLongitudeDegrees;

  72.     /**
  73.      * Compute spacecraft's geocentric latitude.
  74.      */
  75.     private UnivariateDerivative2 geocentricLatitudeDegrees;

  76.     /**
  77.      * Compute spacecraft's orbit radius.
  78.      */
  79.     private UnivariateDerivative2 orbitRadius;

  80.     /**
  81.      * Default constructor.
  82.      * <p>
  83.      * This constructor uses the {@link DataContext#getDefault() default data context}.
  84.      * </p>
  85.      * <p> The attitude provider is set by default to be aligned with the inertial frame.<br>
  86.      * The mass is set by default to the
  87.      * {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  88.      * The inertial frame is set by default to the
  89.      * {@link org.orekit.frames.Predefined#TOD_CONVENTIONS_2010_SIMPLE_EOP TOD frame} in the default data
  90.      * context.<br>
  91.      * The ECEF frame is set by default to the
  92.      * {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP
  93.      * CIO/2010-based ITRF simple EOP} in the default data context.
  94.      * </p>
  95.      *
  96.      * @param elements Intelsat's 11 elements
  97.      */
  98.     @DefaultDataContext
  99.     public IntelsatElevenElementsPropagator(final IntelsatElevenElements elements) {
  100.         this(elements, FramesFactory.getTOD(IERSConventions.IERS_2010, true), FramesFactory.getITRF(IERSConventions.IERS_2010, true));
  101.     }

  102.     /**
  103.      * Constructor.
  104.      *
  105.      * <p> The attitude provider is set by default to be aligned with the inertial frame.<br>
  106.      * The mass is set by default to the
  107.      * {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  108.      * </p>
  109.      *
  110.      * @param elements      Intelsat's 11 elements
  111.      * @param inertialFrame inertial frame for the output orbit
  112.      * @param ecefFrame     ECEF frame related to the Intelsat's 11 elements
  113.      */
  114.     public IntelsatElevenElementsPropagator(final IntelsatElevenElements elements, final Frame inertialFrame, final Frame ecefFrame) {
  115.         this(elements, inertialFrame, ecefFrame, FrameAlignedProvider.of(inertialFrame), Propagator.DEFAULT_MASS);
  116.     }

  117.     /**
  118.      * Constructor.
  119.      *
  120.      * @param elements         Intelsat's 11 elements
  121.      * @param inertialFrame    inertial frame for the output orbit
  122.      * @param ecefFrame        ECEF frame related to the Intelsat's 11 elements
  123.      * @param attitudeProvider attitude provider
  124.      * @param mass             spacecraft mass
  125.      */
  126.     public IntelsatElevenElementsPropagator(final IntelsatElevenElements elements, final Frame inertialFrame, final Frame ecefFrame, final AttitudeProvider attitudeProvider,
  127.                                             final double mass) {
  128.         super(attitudeProvider);
  129.         this.elements = elements;
  130.         this.inertialFrame = inertialFrame;
  131.         this.ecefFrame = ecefFrame;
  132.         this.mass = mass;
  133.         setStartDate(elements.getEpoch());
  134.         final Orbit orbitAtElementsDate = propagateOrbit(elements.getEpoch());
  135.         final Attitude attitude = attitudeProvider.getAttitude(orbitAtElementsDate, elements.getEpoch(), inertialFrame);
  136.         super.resetInitialState(new SpacecraftState(orbitAtElementsDate, attitude).withMass(mass));
  137.     }

  138.     /**
  139.      * Converts the Intelsat's 11 elements into Position/Velocity coordinates in ECEF.
  140.      *
  141.      * @param date computation epoch
  142.      * @return Position/Velocity coordinates in ECEF
  143.      */
  144.     public PVCoordinates propagateInEcef(final AbsoluteDate date) {
  145.         final UnivariateDerivative2 tDays = new UnivariateDerivative2(date.durationFrom(elements.getEpoch()), 1.0, 0.0).divide(Constants.JULIAN_DAY);
  146.         final double wDegreesPerDay = elements.getLm1() + IntelsatElevenElements.DRIFT_RATE_SHIFT_DEG_PER_DAY;
  147.         final UnivariateDerivative2 wt = FastMath.toRadians(tDays.multiply(wDegreesPerDay));
  148.         final FieldSinCos<UnivariateDerivative2> scWt = FastMath.sinCos(wt);
  149.         final FieldSinCos<UnivariateDerivative2> sc2Wt = FastMath.sinCos(wt.multiply(2.0));
  150.         final UnivariateDerivative2 satelliteEastLongitudeDegrees = computeSatelliteEastLongitudeDegrees(tDays, scWt, sc2Wt);
  151.         final UnivariateDerivative2 satelliteGeocentricLatitudeDegrees = computeSatelliteGeocentricLatitudeDegrees(tDays, scWt);
  152.         final UnivariateDerivative2 satelliteRadius = computeSatelliteRadiusKilometers(wDegreesPerDay, scWt).multiply(Unit.KILOMETRE.getScale());
  153.         this.eastLongitudeDegrees = satelliteEastLongitudeDegrees;
  154.         this.geocentricLatitudeDegrees = satelliteGeocentricLatitudeDegrees;
  155.         this.orbitRadius = satelliteRadius;
  156.         final FieldSinCos<UnivariateDerivative2> scLongitude = FastMath.sinCos(FastMath.toRadians(satelliteEastLongitudeDegrees));
  157.         final FieldSinCos<UnivariateDerivative2> scLatitude = FastMath.sinCos(FastMath.toRadians(satelliteGeocentricLatitudeDegrees));
  158.         final FieldVector3D<UnivariateDerivative2> positionWithDerivatives = new FieldVector3D<>(satelliteRadius.multiply(scLatitude.cos()).multiply(scLongitude.cos()),
  159.                                                                                                  satelliteRadius.multiply(scLatitude.cos()).multiply(scLongitude.sin()),
  160.                                                                                                  satelliteRadius.multiply(scLatitude.sin()));
  161.         return new PVCoordinates(new Vector3D(positionWithDerivatives.getX().getValue(), //
  162.                                               positionWithDerivatives.getY().getValue(), //
  163.                                               positionWithDerivatives.getZ().getValue()), //
  164.                                  new Vector3D(positionWithDerivatives.getX().getFirstDerivative(), //
  165.                                               positionWithDerivatives.getY().getFirstDerivative(), //
  166.                                               positionWithDerivatives.getZ().getFirstDerivative()), //
  167.                                  new Vector3D(positionWithDerivatives.getX().getSecondDerivative(), //
  168.                                               positionWithDerivatives.getY().getSecondDerivative(), //
  169.                                               positionWithDerivatives.getZ().getSecondDerivative()));
  170.     }

  171.     /**
  172.      * {@inheritDoc}.
  173.      */
  174.     @Override
  175.     public void resetInitialState(final SpacecraftState state) {
  176.         throw new OrekitException(OrekitMessages.NON_RESETABLE_STATE);
  177.     }

  178.     /**
  179.      * {@inheritDoc}.
  180.      */
  181.     @Override
  182.     protected double getMass(final AbsoluteDate date) {
  183.         return mass;
  184.     }

  185.     /**
  186.      * {@inheritDoc}.
  187.      */
  188.     @Override
  189.     protected void resetIntermediateState(final SpacecraftState state, final boolean forward) {
  190.         throw new OrekitException(OrekitMessages.NON_RESETABLE_STATE);
  191.     }

  192.     /**
  193.      * {@inheritDoc}.
  194.      */
  195.     @Override
  196.     public Orbit propagateOrbit(final AbsoluteDate date) {
  197.         return new CartesianOrbit(ecefFrame.getTransformTo(inertialFrame, date).transformPVCoordinates(propagateInEcef(date)), inertialFrame, date, Constants.WGS84_EARTH_MU);
  198.     }

  199.     /**
  200.      * Computes the satellite's east longitude.
  201.      *
  202.      * @param tDays delta time in days
  203.      * @param scW   sin/cos of the W angle
  204.      * @param sc2W  sin/cos of the 2xW angle
  205.      * @return the satellite's east longitude in degrees
  206.      */
  207.     private UnivariateDerivative2 computeSatelliteEastLongitudeDegrees(final UnivariateDerivative2 tDays, final FieldSinCos<UnivariateDerivative2> scW,
  208.                                                                        final FieldSinCos<UnivariateDerivative2> sc2W) {
  209.         final UnivariateDerivative2 longitude = tDays.multiply(tDays).multiply(elements.getLm2()) //
  210.                                                      .add(tDays.multiply(elements.getLm1())) //
  211.                                                      .add(elements.getLm0());
  212.         final UnivariateDerivative2 cosineLongitudeTerm = scW.cos().multiply(tDays.multiply(elements.getLonC1()).add(elements.getLonC()));
  213.         final UnivariateDerivative2 sineLongitudeTerm = scW.sin().multiply(tDays.multiply(elements.getLonS1()).add(elements.getLonS()));
  214.         final UnivariateDerivative2 latitudeTerm = sc2W.sin().multiply(0.5 * (elements.getLatC() * elements.getLatC() - elements.getLatS() * elements.getLatS())) //
  215.                                                        .subtract(sc2W.cos().multiply(elements.getLatC() * elements.getLatS())) //
  216.                                                        .multiply(IntelsatElevenElements.K);
  217.         return longitude.add(cosineLongitudeTerm).add(sineLongitudeTerm).add(latitudeTerm);
  218.     }

  219.     /**
  220.      * Computes the satellite's geocentric latitude.
  221.      *
  222.      * @param tDays delta time in days
  223.      * @param scW   sin/cos of the W angle
  224.      * @return he satellite geocentric latitude in degrees
  225.      */
  226.     private UnivariateDerivative2 computeSatelliteGeocentricLatitudeDegrees(final UnivariateDerivative2 tDays, final FieldSinCos<UnivariateDerivative2> scW) {
  227.         final UnivariateDerivative2 cosineTerm = scW.cos().multiply(tDays.multiply(elements.getLatC1()).add(elements.getLatC()));
  228.         final UnivariateDerivative2 sineTerm = scW.sin().multiply(tDays.multiply(elements.getLatS1()).add(elements.getLatS()));
  229.         return cosineTerm.add(sineTerm);
  230.     }

  231.     /**
  232.      * Computes the satellite's orbit radius.
  233.      *
  234.      * @param wDegreesPerDay W angle in degrees/day
  235.      * @param scW            sin/cos of the W angle
  236.      * @return the satellite's orbit radius in kilometers
  237.      */
  238.     private UnivariateDerivative2 computeSatelliteRadiusKilometers(final double wDegreesPerDay, final FieldSinCos<UnivariateDerivative2> scW) {
  239.         final double coefficient = IntelsatElevenElements.SYNCHRONOUS_RADIUS_KM * (1.0 - (2.0 * elements.getLm1()) / (3.0 * (wDegreesPerDay - elements.getLm1())));
  240.         return scW.sin()
  241.                   .multiply(IntelsatElevenElements.K * elements.getLonC())
  242.                   .add(1.0)
  243.                   .subtract(scW.cos().multiply(IntelsatElevenElements.K * elements.getLonS()))
  244.                   .multiply(coefficient);
  245.     }

  246.     /**
  247.      * Get the computed satellite's east longitude.
  248.      *
  249.      * @return the satellite's east longitude in degrees
  250.      */
  251.     public UnivariateDerivative2 getEastLongitudeDegrees() {
  252.         return eastLongitudeDegrees;
  253.     }

  254.     /**
  255.      * Get the computed satellite's geocentric latitude.
  256.      *
  257.      * @return the satellite's geocentric latitude in degrees
  258.      */
  259.     public UnivariateDerivative2 getGeocentricLatitudeDegrees() {
  260.         return geocentricLatitudeDegrees;
  261.     }

  262.     /**
  263.      * Get the computed satellite's orbit.
  264.      *
  265.      * @return satellite's orbit radius in meters
  266.      */
  267.     public UnivariateDerivative2 getOrbitRadius() {
  268.         return orbitRadius;
  269.     }

  270.     /**
  271.      * {@inheritDoc}.
  272.      */
  273.     @Override
  274.     public Frame getFrame() {
  275.         return inertialFrame;
  276.     }

  277.     /**
  278.      * Get the Intelsat's 11 elements used by the propagator.
  279.      *
  280.      * @return the Intelsat's 11 elements used by the propagator
  281.      */
  282.     public IntelsatElevenElements getIntelsatElevenElements() {
  283.         return elements;
  284.     }

  285. }