AbstractRelativisticJ2ClockModifier.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.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.     /** Get the name of the effect modifying the measurement.
  63.      * @return name of the effect modifying the measurement
  64.      * @since 13.0
  65.      */
  66.     public String getEffectName() {
  67.         return "J₂ clock relativity";
  68.     }

  69.     /**
  70.      * Computes the relativistic J2 clock time delay correction.
  71.      *
  72.      * @param estimated EstimatedMeasurements on which to calculate the correction
  73.      * @return dt_relJ2clk Time delay due to the relativistic J2 clock effect in seconds
  74.      */
  75.     protected double relativisticJ2Correction(final EstimatedMeasurementBase<?> estimated) {

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

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

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

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

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

  95.         // u = perigee argument + true anomaly
  96.         final double orbitU = remoteOrbit.getTrueAnomaly() + remoteOrbit.getPerigeeArgument();
  97.         final double n = remoteOrbit.getKeplerianMeanMotion();

  98.         // Returning the value of the time delay
  99.         return cJ2 * n * FastMath.sin(2 * orbitU) * FastMath.sin(orbitInclination) * FastMath.sin(orbitInclination);
  100.     }

  101. }