1 /* Copyright 2002-2021 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
19 import org.hipparchus.geometry.euclidean.threed.Vector3D;
20 import org.hipparchus.util.FastMath;
21 import org.orekit.estimation.measurements.EstimatedMeasurement;
22 import org.orekit.utils.Constants;
23 import org.orekit.utils.TimeStampedPVCoordinates;
24
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 *
30 * @author Luc Maisonobe
31 * @since 10.0
32 */
33 public class AbstractShapiroBaseModifier {
34
35 /** Shapiro effect scale factor. */
36 private final double s;
37
38 /** Simple constructor.
39 * @param gm gravitational constant for main body in signal path vicinity.
40 */
41 public AbstractShapiroBaseModifier(final double gm) {
42 this.s = 2 * gm / (Constants.SPEED_OF_LIGHT * Constants.SPEED_OF_LIGHT);
43 }
44
45 /** Modify measurement.
46 * @param estimated measurement to modify
47 */
48 protected void doModify(final EstimatedMeasurement<?> estimated) {
49
50 // compute correction, for one way or two way measurements
51 final TimeStampedPVCoordinates[] pv = estimated.getParticipants();
52 final double correction = pv.length < 3 ?
53 shapiroCorrection(pv[0], pv[1]) :
54 0.5 * (shapiroCorrection(pv[0], pv[1]) + shapiroCorrection(pv[1], pv[2]));
55
56 // update estimated value taking into account the Shapiro time delay.
57 final double[] newValue = estimated.getEstimatedValue().clone();
58 newValue[0] = newValue[0] + correction;
59 estimated.setEstimatedValue(newValue);
60
61 }
62
63 /** Compute Shapiro path dilation between two points in a gravity field.
64 * @param pvEmitter coordinates of emitter in body-centered frame
65 * @param pvReceiver coordinates of receiver in body-centered frame
66 * @return path dilation to add to raw measurement
67 */
68 protected double shapiroCorrection(final TimeStampedPVCoordinates pvEmitter, final TimeStampedPVCoordinates pvReceiver) {
69 final Vector3D pEmitter = pvEmitter.getPosition();
70 final Vector3D pReceiver = pvReceiver.getPosition();
71 final double rEpR = pEmitter.getNorm() + pReceiver.getNorm();
72 final double d = Vector3D.distance(pEmitter, pReceiver);
73 return s * FastMath.log((rEpR + d) / (rEpR - d));
74 }
75
76 }