AbstractRelativisticJ2ClockModifier.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.estimation.measurements.modifiers;

  18. import org.hipparchus.util.FastMath;
  19. import org.orekit.estimation.measurements.EstimatedMeasurementBase;
  20. import org.orekit.frames.Frame;
  21. import org.orekit.orbits.KeplerianOrbit;
  22. import org.orekit.propagation.SpacecraftState;
  23. import org.orekit.utils.Constants;
  24. import org.orekit.utils.TimeStampedPVCoordinates;

  25. /**
  26.  * Class modifying theoretical measurements with relativistic J2 clock correction.
  27.  * <p>
  28.  * Relativistic clock correction of the effects caused by the oblateness of Earth on
  29.  * the gravity potential.
  30.  * </p>
  31.  * <p>
  32.  * The time delay caused by this effect is computed based on the orbital parameters of the
  33.  * emitter's orbit.
  34.  * </p>
  35.  *
  36.  * @author Louis Aucouturier
  37.  * @since 11.2
  38.  *
  39.  * @see "Teunissen, Peter, and Oliver Montenbruck, eds. Springer handbook of global navigation
  40.  * satellite systems. Chapter 19.2. Equation 19.18 Springer, 2017."
  41.  */
  42. public class AbstractRelativisticJ2ClockModifier {

  43.     /**
  44.      * Relativistic J2 effect constant.
  45.      */
  46.     private final double cJ2;

  47.     /** Central attraction coefficient. */
  48.     private final double gm;

  49.     /**
  50.      * Constructor for the Relativistic J2 Clock modifier.
  51.      * @param gm Earth gravitational constant (mu) in m³/s².
  52.      * @param c20 Earth un-normalized second zonal coefficient (Signed J2 constant, is negative) (Typical value -1.0826e-3).
  53.      * @param equatorialRadius Earth equatorial radius in m.
  54.      */
  55.     public AbstractRelativisticJ2ClockModifier(final double gm,
  56.                                                final double c20,
  57.                                                final double equatorialRadius) {
  58.         this.cJ2 = 1.5 * c20 * equatorialRadius * equatorialRadius /
  59.                 (Constants.SPEED_OF_LIGHT * Constants.SPEED_OF_LIGHT);
  60.         this.gm = gm;
  61.     }

  62.     /**
  63.      * Computes the relativistic J2 clock time delay correction.
  64.      *
  65.      * @param estimated EstimatedMeasurements on which to calculate the correction
  66.      * @return dt_relJ2clk Time delay due to the relativistic J2 clock effect in seconds
  67.      */
  68.     protected double relativisticJ2Correction(final EstimatedMeasurementBase<?> estimated) {

  69.         // Extracting the state of the receiver to determine the frame and mu
  70.         /**
  71.          * The satellite states are stored at the creation of the estimated measurements
  72.          * and can contain up to 2 elements. In most cases, only the receiver's state and
  73.          * therefore frame is stored, with the emitter's frame corresponding to the receiver's.
  74.          * Still, in the InterSatellites case, the states of the 2 spacecrafts are stored,
  75.          * and can contain different frames. This case is treated by looking at the length
  76.          * of SpacecraftState stored in the Estimated Measurements, with the only length 2
  77.          * case is the InterSatellites case.
  78.          */
  79.         final SpacecraftState[] states = estimated.getStates();
  80.         final SpacecraftState state =  (states.length < 2) ? states[0] : states[1];

  81.         final Frame remoteFrame = state.getFrame();

  82.         // Getting Participants to extract the remote PV
  83.         final TimeStampedPVCoordinates[] pvs = estimated.getParticipants();

  84.         // Checking if the correction is applied on a two-way GNSS problem
  85.         // In that case the emitter is at index 1, else index 0
  86.         final TimeStampedPVCoordinates pvRemote = (pvs.length < 3) ? pvs[0] : pvs[1];

  87.         // Define a Keplerian orbit to extract the orbital parameters needed to compute the correction
  88.         final KeplerianOrbit remoteOrbit = new KeplerianOrbit(pvRemote, remoteFrame, gm);
  89.         final double orbitInclination = remoteOrbit.getI();

  90.         // u = perigee argument + true anomaly
  91.         final double orbitU = remoteOrbit.getTrueAnomaly() + remoteOrbit.getPerigeeArgument();
  92.         final double n = remoteOrbit.getKeplerianMeanMotion();

  93.         // Returning the value of the time delay
  94.         return cJ2 * n * FastMath.sin(2 * orbitU) * FastMath.sin(orbitInclination) * FastMath.sin(orbitInclination);
  95.     }

  96. }