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 org.hipparchus.CalculusFieldElement;
20 import org.hipparchus.Field;
21 import org.hipparchus.util.FastMath;
22 import org.hipparchus.util.MathArrays;
23 import org.hipparchus.util.MathUtils;
24 import org.orekit.bodies.FieldGeodeticPoint;
25 import org.orekit.bodies.GeodeticPoint;
26 import org.orekit.time.AbsoluteDate;
27 import org.orekit.time.FieldAbsoluteDate;
28 import org.orekit.time.TimeScale;
29 import org.orekit.utils.FieldTrackingCoordinates;
30 import org.orekit.utils.TrackingCoordinates;
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 public class ViennaOne extends AbstractVienna {
48
49
50
51
52
53
54
55 public ViennaOne(final ViennaAProvider aProvider,
56 final AzimuthalGradientProvider gProvider,
57 final TroposphericModel zenithDelayProvider,
58 final TimeScale utc) {
59 super(aProvider, gProvider, zenithDelayProvider, utc);
60 }
61
62
63 @Override
64 public double[] mappingFactors(final TrackingCoordinates trackingCoordinates,
65 final GeodeticPoint point,
66 final AbsoluteDate date) {
67
68
69 final ViennaACoefficients a = getAProvider().getA(point, date);
70
71
72 final double dofyear = getDayOfYear(date);
73
74
75 final double bh = 0.0029;
76 final double c0h = 0.062;
77 final double c10h;
78 final double c11h;
79 final double psi;
80
81
82 final double latitude = point.getLatitude();
83
84
85 if (FastMath.sin(latitude) > 0) {
86 c10h = 0.001;
87 c11h = 0.005;
88 psi = 0;
89 } else {
90 c10h = 0.002;
91 c11h = 0.007;
92 psi = FastMath.PI;
93 }
94
95
96 double t0 = 28;
97 if (latitude < 0) {
98
99 t0 += 183;
100 }
101
102 final double coef = psi + ((dofyear - t0) / 365) * MathUtils.TWO_PI;
103 final double ch = c0h + ((FastMath.cos(coef) + 1) * (c11h / 2) + c10h) * (1 - FastMath.cos(latitude));
104
105
106 final double bw = 0.00146;
107 final double cw = 0.04391;
108
109 final double[] function = new double[2];
110 function[0] = TroposphericModelUtils.mappingFunction(a.getAh(), bh, ch,
111 trackingCoordinates.getElevation());
112 function[1] = TroposphericModelUtils.mappingFunction(a.getAw(), bw, cw,
113 trackingCoordinates.getElevation());
114
115
116 final double correction = TroposphericModelUtils.computeHeightCorrection(trackingCoordinates.getElevation(),
117 point.getAltitude());
118 function[0] = function[0] + correction;
119
120 return function;
121 }
122
123
124 @Override
125 public <T extends CalculusFieldElement<T>> T[] mappingFactors(final FieldTrackingCoordinates<T> trackingCoordinates,
126 final FieldGeodeticPoint<T> point,
127 final FieldAbsoluteDate<T> date) {
128
129 final Field<T> field = date.getField();
130 final T zero = field.getZero();
131
132
133 final FieldViennaACoefficients<T> a = getAProvider().getA(point, date);
134
135
136 final T dofyear = getDayOfYear(date);
137
138
139 final T bh = zero.newInstance(0.0029);
140 final T c0h = zero.newInstance(0.062);
141 final T c10h;
142 final T c11h;
143 final T psi;
144
145
146 final T latitude = point.getLatitude();
147
148
149 if (FastMath.sin(latitude.getReal()) > 0) {
150 c10h = zero.newInstance(0.001);
151 c11h = zero.newInstance(0.005);
152 psi = zero;
153 } else {
154 c10h = zero.newInstance(0.002);
155 c11h = zero.newInstance(0.007);
156 psi = zero.getPi();
157 }
158
159
160
161 double t0 = 28;
162 if (latitude.getReal() < 0) {
163
164 t0 += 183;
165 }
166 final T coef = psi.add(dofyear.subtract(t0).divide(365).multiply(MathUtils.TWO_PI));
167 final T ch = c11h.divide(2.0).multiply(FastMath.cos(coef).add(1.0)).add(c10h).multiply(FastMath.cos(latitude).negate().add(1.)).add(c0h);
168
169
170 final T bw = zero.newInstance(0.00146);
171 final T cw = zero.newInstance(0.04391);
172
173 final T[] function = MathArrays.buildArray(field, 2);
174 function[0] = TroposphericModelUtils.mappingFunction(a.getAh(), bh, ch,
175 trackingCoordinates.getElevation());
176 function[1] = TroposphericModelUtils.mappingFunction(a.getAw(), bw, cw,
177 trackingCoordinates.getElevation());
178
179
180 final T correction = TroposphericModelUtils.computeHeightCorrection(trackingCoordinates.getElevation(),
181 point.getAltitude(),
182 field);
183 function[0] = function[0].add(correction);
184
185 return function;
186 }
187
188 }