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
19 import java.util.List;
20
21 import org.hipparchus.CalculusFieldElement;
22 import org.orekit.estimation.measurements.GroundStation;
23 import org.orekit.frames.TopocentricFrame;
24 import org.orekit.models.earth.ionosphere.IonosphericModel;
25 import org.orekit.propagation.FieldSpacecraftState;
26 import org.orekit.propagation.SpacecraftState;
27 import org.orekit.utils.ParameterDriver;
28
29 /** Base class modifying theoretical range-rate measurement with ionospheric delay.
30 * The effect of ionospheric correction on the range-rate is directly computed
31 * through the computation of the ionospheric delay difference with respect to
32 * time.
33 *
34 * The ionospheric delay depends on the frequency of the signal (GNSS, VLBI, ...).
35 * For optical measurements (e.g. SLR), the ray is not affected by ionosphere charged particles.
36 * <p>
37 * Since 10.0, state derivatives and ionospheric parameters derivates are computed
38 * using automatic differentiation.
39 * </p>
40 * @author Joris Olympio
41 * @since 11.2
42 */
43 public abstract class BaseRangeRateIonosphericDelayModifier {
44
45 /** Ionospheric delay model. */
46 private final IonosphericModel ionoModel;
47
48 /** Frequency [Hz]. */
49 private final double frequency;
50
51 /** Constructor.
52 *
53 * @param model Ionospheric delay model appropriate for the current range-rate measurement method.
54 * @param freq frequency of the signal in Hz
55 */
56 protected BaseRangeRateIonosphericDelayModifier(final IonosphericModel model, final double freq) {
57 this.ionoModel = model;
58 this.frequency = freq;
59 }
60
61 /** Get the name of the effect modifying the measurement.
62 * @return name of the effect modifying the measurement
63 * @since 13.0
64 */
65 public String getEffectName() {
66 return "ionosphere";
67 }
68
69 /** Get the ionospheric delay model.
70 * @return ionospheric delay model
71 */
72 protected IonosphericModel getIonoModel() {
73 return ionoModel;
74 }
75
76 /** Compute the measurement error due to Ionosphere.
77 * @param station station
78 * @param state spacecraft state
79 * @return the measurement error due to Ionosphere
80 */
81 protected double rangeRateErrorIonosphericModel(final GroundStation station, final SpacecraftState state) {
82 final double dt = 10; // s
83 // Base frame associated with the station
84 final TopocentricFrame baseFrame = station.getBaseFrame();
85 // delay in meters
86 final double delay1 = ionoModel.pathDelay(state, baseFrame, frequency, ionoModel.getParameters(state.getDate()));
87 // propagate spacecraft state forward by dt
88 final SpacecraftState state2 = state.shiftedBy(dt);
89 // ionospheric delay dt after in meters
90 final double delay2 = ionoModel.pathDelay(state2, baseFrame, frequency, ionoModel.getParameters(state.getDate()));
91 // delay in meters
92 return (delay2 - delay1) / dt;
93 }
94
95 /** Compute the measurement error due to Ionosphere.
96 * @param <T> type of the elements
97 * @param station station
98 * @param state spacecraft state
99 * @param parameters ionospheric model parameters
100 * @return the measurement error due to Ionosphere
101 */
102 protected <T extends CalculusFieldElement<T>> T rangeRateErrorIonosphericModel(final GroundStation station,
103 final FieldSpacecraftState<T> state,
104 final T[] parameters) {
105 final double dt = 10; // s
106 // Base frame associated with the station
107 final TopocentricFrame baseFrame = station.getBaseFrame();
108 // delay in meters
109 final T delay1 = ionoModel.pathDelay(state, baseFrame, frequency, parameters);
110 // propagate spacecraft state forward by dt
111 final FieldSpacecraftState<T> state2 = state.shiftedBy(dt);
112 // ionospheric delay dt after in meters
113 final T delay2 = ionoModel.pathDelay(state2, baseFrame, frequency, parameters);
114 // delay in meters
115 return delay2.subtract(delay1).divide(dt);
116 }
117
118 /** Get the drivers for this modifier parameters.
119 * @return drivers for this modifier parameters
120 */
121 public List<ParameterDriver> getParametersDrivers() {
122 return ionoModel.getParametersDrivers();
123 }
124
125 }