AbstractShapiroBaseModifier.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.hipparchus.util.FastMath;
  20. import org.orekit.estimation.measurements.EstimatedMeasurementBase;
  21. import org.orekit.estimation.measurements.EstimationModifier;
  22. import org.orekit.estimation.measurements.ObservedMeasurement;
  23. import org.orekit.utils.Constants;
  24. import org.orekit.utils.TimeStampedPVCoordinates;

  25. /** Class modifying theoretical range measurement with Shapiro time delay.
  26.  * <p>
  27.  * Shapiro time delay is a relativistic effect due to gravity.
  28.  * </p>
  29.  * @author Luc Maisonobe
  30.  * @since 10.0
  31.  */
  32. public class AbstractShapiroBaseModifier {

  33.     /** Shapiro effect scale factor. */
  34.     private final double s;

  35.     /** Simple constructor.
  36.      * @param gm gravitational constant for main body in signal path vicinity.
  37.      */
  38.     public AbstractShapiroBaseModifier(final double gm) {
  39.         this.s = 2 * gm / (Constants.SPEED_OF_LIGHT * Constants.SPEED_OF_LIGHT);
  40.     }

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

  48.     /** Modify measurement.
  49.      * @param <T> type of the measurements
  50.      * @param modifier applied modifier
  51.      * @param estimated measurement to modify
  52.      * @since 12.1
  53.      */
  54.     protected <T extends ObservedMeasurement<T>> void doModify(final EstimationModifier<T> modifier,
  55.                                                                final EstimatedMeasurementBase<T> estimated) {

  56.         // compute correction, for one way or two way measurements
  57.         final TimeStampedPVCoordinates[] pv = estimated.getParticipants();
  58.         final double correction = pv.length < 3 ?
  59.                                   shapiroCorrection(pv[0], pv[1]) :
  60.                                   0.5 * (shapiroCorrection(pv[0], pv[1]) + shapiroCorrection(pv[1], pv[2]));

  61.         // update estimated value taking into account the Shapiro time delay.
  62.         final double[] newValue = estimated.getEstimatedValue().clone();
  63.         newValue[0] = newValue[0] + correction;
  64.         estimated.modifyEstimatedValue(modifier, newValue);

  65.     }

  66.     /** Compute Shapiro path dilation between two points in a gravity field.
  67.      * @param pvEmitter coordinates of emitter in body-centered frame
  68.      * @param pvReceiver coordinates of receiver in body-centered frame
  69.      * @return path dilation to add to raw measurement
  70.      */
  71.     protected double shapiroCorrection(final TimeStampedPVCoordinates pvEmitter, final TimeStampedPVCoordinates pvReceiver) {
  72.         final Vector3D pEmitter  = pvEmitter.getPosition();
  73.         final Vector3D pReceiver = pvReceiver.getPosition();
  74.         final double   rEpR      = pEmitter.getNorm() + pReceiver.getNorm();
  75.         final double   d         = Vector3D.distance(pEmitter, pReceiver);
  76.         return s * FastMath.log((rEpR + d) / (rEpR - d));
  77.     }

  78. }