AbstractShapiroBaseModifier.java

  1. /* Copyright 2002-2020 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.EstimatedMeasurement;
  21. import org.orekit.utils.Constants;
  22. import org.orekit.utils.TimeStampedPVCoordinates;

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

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

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

  40.     /** Modify measurement.
  41.      * @param estimated measurement to modify
  42.      */
  43.     protected void doModify(final EstimatedMeasurement<?> estimated) {

  44.         // compute correction, for one way or two way measurements
  45.         final TimeStampedPVCoordinates[] pv = estimated.getParticipants();
  46.         final double correction = pv.length < 3 ?
  47.                                   shapiroCorrection(pv[0], pv[1]) :
  48.                                   0.5 * (shapiroCorrection(pv[0], pv[1]) + shapiroCorrection(pv[1], pv[2]));

  49.         // update estimated value taking into account the Shapiro time delay.
  50.         final double[] newValue = estimated.getEstimatedValue().clone();
  51.         newValue[0] = newValue[0] + correction;
  52.         estimated.setEstimatedValue(newValue);

  53.     }

  54.     /** Compute Shapiro path dilation between two points in a gravity field.
  55.      * @param pvEmitter coordinates of emitter in body-centered frame
  56.      * @param pvReceiver coordinates of receiver in body-centered frame
  57.      * @return path dilation to add to raw measurement
  58.      */
  59.     protected double shapiroCorrection(final TimeStampedPVCoordinates pvEmitter, final TimeStampedPVCoordinates pvReceiver) {
  60.         final Vector3D pEmitter  = pvEmitter.getPosition();
  61.         final Vector3D pReceiver = pvReceiver.getPosition();
  62.         final double   rEpR      = pEmitter.getNorm() + pReceiver.getNorm();
  63.         final double   d         = Vector3D.distance(pEmitter, pReceiver);
  64.         return s * FastMath.log((rEpR + d) / (rEpR - d));
  65.     }

  66. }