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 org.hipparchus.CalculusFieldElement;
20  import org.orekit.attitudes.FrameAlignedProvider;
21  import org.orekit.estimation.measurements.EstimatedMeasurement;
22  import org.orekit.estimation.measurements.EstimatedMeasurementBase;
23  import org.orekit.estimation.measurements.EstimationModifier;
24  import org.orekit.estimation.measurements.GroundStation;
25  import org.orekit.estimation.measurements.RangeRate;
26  import org.orekit.models.earth.troposphere.TroposphericModel;
27  import org.orekit.propagation.FieldSpacecraftState;
28  import org.orekit.propagation.SpacecraftState;
29  
30  /** Class modifying theoretical range-rate measurements with tropospheric delay.
31   * <p>
32   * The effect of tropospheric correction on the range-rate is directly computed
33   * through the computation of the tropospheric delay difference with respect to
34   * time.
35   * </p>
36   * <p>
37   * In general, for GNSS, VLBI, ... there is hardly any frequency dependence in the delay.
38   * For SLR techniques however, the frequency dependence is sensitive.
39   * </p>
40   *
41   * @author Joris Olympio
42   * @since 8.0
43   */
44  public class RangeRateTroposphericDelayModifier extends BaseRangeRateTroposphericDelayModifier implements EstimationModifier<RangeRate> {
45  
46      /** Two-way measurement factor. */
47      private final double fTwoWay;
48  
49      /** Constructor.
50       *
51       * @param model  Tropospheric delay model appropriate for the current range-rate measurement method.
52       * @param tw     Flag indicating whether the measurement is two-way.
53       * @since 12.1
54       */
55      public RangeRateTroposphericDelayModifier(final TroposphericModel model, final boolean tw) {
56          super(model);
57          if (tw) {
58              fTwoWay = 2.;
59          } else {
60              fTwoWay = 1.;
61          }
62      }
63  
64      /** Compute the measurement error due to Troposphere.
65       * @param station station
66       * @param state spacecraft state
67       * @return the measurement error due to Troposphere
68       */
69      @Override
70      public double rangeRateErrorTroposphericModel(final GroundStation station,
71                                                    final SpacecraftState state) {
72          return fTwoWay * super.rangeRateErrorTroposphericModel(station, state);
73      }
74  
75  
76      /** Compute the measurement error due to Troposphere.
77       * @param <T> type of the element
78       * @param station station
79       * @param state spacecraft state
80       * @param parameters tropospheric model parameters
81       * @return the measurement error due to Troposphere
82       */
83      @Override
84      public <T extends CalculusFieldElement<T>> T rangeRateErrorTroposphericModel(final GroundStation station,
85                                                                                   final FieldSpacecraftState<T> state,
86                                                                                   final T[] parameters) {
87          return super.rangeRateErrorTroposphericModel(station, state, parameters).multiply(fTwoWay);
88      }
89  
90      /** {@inheritDoc} */
91      @Override
92      public void modifyWithoutDerivatives(final EstimatedMeasurementBase<RangeRate> estimated) {
93  
94          final RangeRate       measurement = estimated.getObservedMeasurement();
95          final GroundStation   station     = measurement.getStation();
96  
97          RangeRateModifierUtil.modifyWithoutDerivatives(estimated,  station, this::rangeRateErrorTroposphericModel, this);
98  
99  
100     }
101 
102     /** {@inheritDoc} */
103     @Override
104     public void modify(final EstimatedMeasurement<RangeRate> estimated) {
105 
106         final RangeRate       measurement = estimated.getObservedMeasurement();
107         final GroundStation   station     = measurement.getStation();
108         final SpacecraftState state       = estimated.getStates()[0];
109 
110         RangeRateModifierUtil.modify(estimated, getTropoModel(),
111                                      new ModifierGradientConverter(state, 6, new FrameAlignedProvider(state.getFrame())),
112                                      station,
113                                      this::rangeRateErrorTroposphericModel,
114                                      this::rangeRateErrorTroposphericModel,
115                                      this);
116 
117 
118     }
119 
120 }