1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.models.earth.troposphere;
18
19 import java.util.Collections;
20 import java.util.List;
21
22 import org.hipparchus.CalculusFieldElement;
23 import org.hipparchus.util.FastMath;
24 import org.hipparchus.util.FieldSinCos;
25 import org.hipparchus.util.SinCos;
26 import org.orekit.bodies.FieldGeodeticPoint;
27 import org.orekit.bodies.GeodeticPoint;
28 import org.orekit.models.earth.weather.FieldPressureTemperatureHumidity;
29 import org.orekit.models.earth.weather.PressureTemperatureHumidity;
30 import org.orekit.time.AbsoluteDate;
31 import org.orekit.time.FieldAbsoluteDate;
32 import org.orekit.time.TimeScale;
33 import org.orekit.utils.FieldTrackingCoordinates;
34 import org.orekit.utils.ParameterDriver;
35 import org.orekit.utils.TrackingCoordinates;
36
37
38
39
40
41
42 public abstract class AbstractVienna implements TroposphericModel, TroposphereMappingFunction {
43
44
45
46
47 private static final double C = 0.0032;
48
49
50 private final ViennaAProvider aProvider;
51
52
53 private final AzimuthalGradientProvider gProvider;
54
55
56 private final TroposphericModel zenithDelayProvider;
57
58
59 private final TimeScale utc;
60
61
62
63
64
65
66
67 protected AbstractVienna(final ViennaAProvider aProvider,
68 final AzimuthalGradientProvider gProvider,
69 final TroposphericModel zenithDelayProvider,
70 final TimeScale utc) {
71 this.aProvider = aProvider;
72 this.gProvider = gProvider;
73 this.zenithDelayProvider = zenithDelayProvider;
74 this.utc = utc;
75 }
76
77
78 @Override
79 public TroposphericDelay pathDelay(final TrackingCoordinates trackingCoordinates,
80 final GeodeticPoint point,
81 final PressureTemperatureHumidity weather,
82 final double[] parameters, final AbsoluteDate date) {
83
84 final TroposphericDelay delays =
85 zenithDelayProvider.pathDelay(trackingCoordinates, point, weather, parameters, date);
86
87
88 final double[] mappingFunction =
89 mappingFactors(trackingCoordinates, point, weather, date);
90
91
92 final AzimuthalGradientCoefficients agc = gProvider.getGradientCoefficients(point, date);
93 final double gh;
94 final double gw;
95 if (agc != null) {
96
97
98 final double sinE = FastMath.sin(trackingCoordinates.getElevation());
99 final double tanE = FastMath.tan(trackingCoordinates.getElevation());
100 final double mfh = 1.0 / (sinE * tanE + C);
101
102 final SinCos sc = FastMath.sinCos(trackingCoordinates.getAzimuth());
103 gh = mfh * (agc.getGnh() * sc.cos() + agc.getGeh() * sc.sin());
104 gw = mfh * (agc.getGnw() * sc.cos() + agc.getGew() * sc.sin());
105
106 } else {
107 gh = 0;
108 gw = 0;
109 }
110
111
112 return new TroposphericDelay(delays.getZh(),
113 delays.getZw(),
114 delays.getZh() * mappingFunction[0] + gh,
115 delays.getZw() * mappingFunction[1] + gw);
116
117 }
118
119
120 @Override
121 public <T extends CalculusFieldElement<T>> FieldTroposphericDelay<T> pathDelay(final FieldTrackingCoordinates<T> trackingCoordinates,
122 final FieldGeodeticPoint<T> point,
123 final FieldPressureTemperatureHumidity<T> weather,
124 final T[] parameters, final FieldAbsoluteDate<T> date) {
125
126 final FieldTroposphericDelay<T> delays =
127 zenithDelayProvider.pathDelay(trackingCoordinates, point, weather, parameters, date);
128
129
130 final T[] mappingFunction =
131 mappingFactors(trackingCoordinates, point, weather, date);
132
133
134 final FieldAzimuthalGradientCoefficients<T> agc = gProvider.getGradientCoefficients(point, date);
135 final T gh;
136 final T gw;
137 if (agc != null) {
138
139
140 final T sinE = FastMath.sin(trackingCoordinates.getElevation());
141 final T tanE = FastMath.tan(trackingCoordinates.getElevation());
142 final T mfh = sinE.multiply(tanE).add(C).reciprocal();
143
144 final FieldSinCos<T> sc = FastMath.sinCos(trackingCoordinates.getAzimuth());
145 gh = mfh.multiply(agc.getGnh().multiply(sc.cos()).add(agc.getGeh().multiply(sc.sin())));
146 gw = mfh.multiply(agc.getGnw().multiply(sc.cos()).add(agc.getGew().multiply(sc.sin())));
147
148 } else {
149 gh = date.getField().getZero();
150 gw = date.getField().getZero();
151 }
152
153
154 return new FieldTroposphericDelay<>(delays.getZh(),
155 delays.getZw(),
156 delays.getZh().multiply(mappingFunction[0]).add(gh),
157 delays.getZw().multiply(mappingFunction[1]).add(gw));
158
159 }
160
161
162 @Override
163 public List<ParameterDriver> getParametersDrivers() {
164 return Collections.emptyList();
165 }
166
167
168
169
170 protected ViennaAProvider getAProvider() {
171 return aProvider;
172 }
173
174
175
176
177
178 protected int getDayOfYear(final AbsoluteDate date) {
179 return date.getComponents(utc).getDate().getDayOfYear();
180 }
181
182 }