AbstractRelativisticClockModifier.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.geometry.euclidean.threed.Vector3D;
  19. import org.orekit.estimation.measurements.EstimatedMeasurementBase;
  20. import org.orekit.utils.Constants;
  21. import org.orekit.utils.TimeStampedPVCoordinates;

  22. /** Class modifying theoretical measurements with relativistic clock correction.
  23.  * <p>
  24.  * Relativistic clock correction is caused by the motion of the satellite as well as
  25.  * the change in the gravitational potential
  26.  * </p>
  27.  * @author Bryan Cazabonne
  28.  * @since 10.3
  29.  *
  30.  * @see "Teunissen, Peter, and Oliver Montenbruck, eds. Springer handbook of global navigation
  31.  * satellite systems. Chapter 19.2. Springer, 2017."
  32.  */
  33. public class AbstractRelativisticClockModifier {

  34.     /** Relativistic effect scale factor. */
  35.     private final double s;

  36.     /** Simple constructor. */
  37.     public AbstractRelativisticClockModifier() {
  38.         this.s = -2.0 / (Constants.SPEED_OF_LIGHT * Constants.SPEED_OF_LIGHT);
  39.     }

  40.     /** Get the name of the effect modifying the measurement.
  41.      * @return name of the effect modifying the measurement
  42.      * @since 13.0
  43.      */
  44.     public String getEffectName() {
  45.         return "clock relativity";
  46.     }

  47.     /** Computes the relativistic clock correction.
  48.      * @param estimated estimated measurement
  49.      * @return the relativistic clock correction in seconds
  50.      */
  51.     protected double relativisticCorrection(final EstimatedMeasurementBase<?> estimated) {
  52.         // Participants
  53.         final TimeStampedPVCoordinates[] pv = estimated.getParticipants();
  54.         // Relativistic clock correction taking into account two-ways measurements
  55.         return pv.length < 3 ?
  56.                s * (dotProduct(pv[0]) - dotProduct(pv[1])) :
  57.                s * (dotProduct(pv[1]) - dotProduct(pv[2]));
  58.     }

  59.     /** Get the scale factor used to compute relativistic effect.
  60.      * @return the scale factor
  61.      */
  62.     protected double getScaleFactor() {
  63.         return s;
  64.     }

  65.     /** Compute the dot-product of position and velocity vectors.
  66.      * @param pv satellite coordinates
  67.      * @return the dot-product of position and velocity vectors
  68.      */
  69.     private static double dotProduct(final TimeStampedPVCoordinates pv) {
  70.         return Vector3D.dotProduct(pv.getPosition(), pv.getVelocity());
  71.     }

  72. }