1 /* Copyright 2002-2024 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 ionospheric delay model.
62 * @return ionospheric delay model
63 */
64 protected IonosphericModel getIonoModel() {
65 return ionoModel;
66 }
67
68 /** Compute the measurement error due to Ionosphere.
69 * @param station station
70 * @param state spacecraft state
71 * @return the measurement error due to Ionosphere
72 */
73 protected double rangeRateErrorIonosphericModel(final GroundStation station, final SpacecraftState state) {
74 final double dt = 10; // s
75 // Base frame associated with the station
76 final TopocentricFrame baseFrame = station.getBaseFrame();
77 // delay in meters
78 final double delay1 = ionoModel.pathDelay(state, baseFrame, frequency, ionoModel.getParameters(state.getDate()));
79 // propagate spacecraft state forward by dt
80 final SpacecraftState state2 = state.shiftedBy(dt);
81 // ionospheric delay dt after in meters
82 final double delay2 = ionoModel.pathDelay(state2, baseFrame, frequency, ionoModel.getParameters(state.getDate()));
83 // delay in meters
84 return (delay2 - delay1) / dt;
85 }
86
87 /** Compute the measurement error due to Ionosphere.
88 * @param <T> type of the elements
89 * @param station station
90 * @param state spacecraft state
91 * @param parameters ionospheric model parameters
92 * @return the measurement error due to Ionosphere
93 */
94 protected <T extends CalculusFieldElement<T>> T rangeRateErrorIonosphericModel(final GroundStation station,
95 final FieldSpacecraftState<T> state,
96 final T[] parameters) {
97 final double dt = 10; // s
98 // Base frame associated with the station
99 final TopocentricFrame baseFrame = station.getBaseFrame();
100 // delay in meters
101 final T delay1 = ionoModel.pathDelay(state, baseFrame, frequency, parameters);
102 // propagate spacecraft state forward by dt
103 final FieldSpacecraftState<T> state2 = state.shiftedBy(dt);
104 // ionospheric delay dt after in meters
105 final T delay2 = ionoModel.pathDelay(state2, baseFrame, frequency, parameters);
106 // delay in meters
107 return delay2.subtract(delay1).divide(dt);
108 }
109
110 /** Get the drivers for this modifier parameters.
111 * @return drivers for this modifier parameters
112 */
113 public List<ParameterDriver> getParametersDrivers() {
114 return ionoModel.getParametersDrivers();
115 }
116
117 }