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.hipparchus.Field;
23 import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
24 import org.hipparchus.geometry.euclidean.threed.Vector3D;
25 import org.orekit.estimation.measurements.GroundStation;
26 import org.orekit.models.earth.troposphere.TroposphericModel;
27 import org.orekit.propagation.FieldSpacecraftState;
28 import org.orekit.propagation.SpacecraftState;
29 import org.orekit.utils.FieldTrackingCoordinates;
30 import org.orekit.utils.ParameterDriver;
31 import org.orekit.utils.TrackingCoordinates;
32
33 /** Base class modifying theoretical range measurements with tropospheric delay.
34 * The effect of tropospheric correction on the range is directly computed
35 * through the computation of the tropospheric delay.
36 *
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 *
40 * @author Joris Olympio
41 * @since 11.2
42 */
43 public abstract class BaseRangeTroposphericDelayModifier {
44
45 /** Tropospheric delay model. */
46 private final TroposphericModel tropoModel;
47
48 /** Constructor.
49 *
50 * @param model Tropospheric delay model appropriate for the current range measurement method.
51 * @deprecated as of 12.1, replaced by {@link #BaseRangeTroposphericDelayModifier(TroposphericModel)}
52 */
53 @Deprecated
54 protected BaseRangeTroposphericDelayModifier(final org.orekit.models.earth.troposphere.DiscreteTroposphericModel model) {
55 this(new org.orekit.models.earth.troposphere.TroposphericModelAdapter(model));
56 }
57
58 /** Constructor.
59 *
60 * @param model Tropospheric delay model appropriate for the current range measurement method.
61 * @since 12.1
62 */
63 protected BaseRangeTroposphericDelayModifier(final TroposphericModel model) {
64 tropoModel = model;
65 }
66
67 /** Get the tropospheric delay model.
68 * @return tropospheric delay model
69 */
70 protected TroposphericModel getTropoModel() {
71 return tropoModel;
72 }
73
74 /** Compute the measurement error due to Troposphere.
75 * @param station station
76 * @param state spacecraft state
77 * @return the measurement error due to Troposphere
78 */
79 public double rangeErrorTroposphericModel(final GroundStation station,
80 final SpacecraftState state) {
81
82 // spacecraft position and elevation as seen from the ground station
83 final Vector3D position = state.getPosition();
84 final TrackingCoordinates trackingCoordinates =
85 station.getBaseFrame().getTrackingCoordinates(position, state.getFrame(), state.getDate());
86
87 // only consider measures above the horizon
88 if (trackingCoordinates.getElevation() > 0) {
89 // tropospheric delay in meters
90 final double delay = tropoModel.pathDelay(trackingCoordinates,
91 station.getOffsetGeodeticPoint(state.getDate()),
92 station.getPressureTemperatureHumidity(state.getDate()),
93 tropoModel.getParameters(), state.getDate()).
94 getDelay();
95
96 return delay;
97 }
98
99 return 0;
100 }
101
102
103 /** Compute the measurement error due to Troposphere.
104 * @param <T> type of the element
105 * @param station station
106 * @param state spacecraft state
107 * @param parameters tropospheric model parameters
108 * @return the measurement error due to Troposphere
109 */
110 public <T extends CalculusFieldElement<T>> T rangeErrorTroposphericModel(final GroundStation station,
111 final FieldSpacecraftState<T> state,
112 final T[] parameters) {
113 // Field
114 final Field<T> field = state.getDate().getField();
115 final T zero = field.getZero();
116
117 // spacecraft position and elevation as seen from the ground station
118 final FieldVector3D<T> position = state.getPosition();
119 final FieldTrackingCoordinates<T> trackingCoordinates =
120 station.getBaseFrame().getTrackingCoordinates(position, state.getFrame(), state.getDate());
121
122 // only consider measures above the horizon
123 if (trackingCoordinates.getElevation() .getReal() > 0) {
124 // tropospheric delay in meters
125 final T delay = tropoModel.pathDelay(trackingCoordinates,
126 station.getOffsetGeodeticPoint(state.getDate()),
127 station.getPressureTemperatureHumidity(state.getDate()),
128 parameters, state.getDate()).
129 getDelay();
130
131 return delay;
132 }
133
134 return zero;
135 }
136
137 /** Get the drivers for this modifier parameters.
138 * @return drivers for this modifier parameters
139 */
140 public List<ParameterDriver> getParametersDrivers() {
141 return tropoModel.getParametersDrivers();
142 }
143
144 }