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.util.FastMath;
20 import org.hipparchus.util.Precision;
21 import org.junit.Assert;
22 import org.junit.Before;
23 import org.junit.BeforeClass;
24 import org.junit.Test;
25 import org.orekit.Utils;
26 import org.orekit.bodies.GeodeticPoint;
27 import org.orekit.errors.OrekitException;
28 import org.orekit.time.AbsoluteDate;
29 import org.orekit.time.TimeScalesFactory;;
30
31 public class MendesPavlisModelTest {
32
33 private static double epsilon = 1e-6;
34
35 @BeforeClass
36 public static void setUpGlobal() {
37 Utils.setDataRoot("atmosphere");
38 }
39
40 @Before
41 public void setUp() throws OrekitException {
42 Utils.setDataRoot("regular-data:potential/shm-format");
43 }
44
45 @Test
46 public void testZenithDelay() {
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 final double latitude = FastMath.toRadians(30.67166667);
62 final double longitude = FastMath.toRadians(-104.0250);
63 final double height = 2010.344;
64 final double pressure = 798.4188;
65 final double temperature = 300.15;
66 final double humidity = 0.4;
67 final double lambda = 0.532;
68 final GeodeticPoint point = new GeodeticPoint(latitude, longitude, height);
69
70
71 final double expectedHydroDelay = 1.932992;
72
73 final double expectedWetDelay = 0.223375e-2;
74
75 final double expectedDelay = 1.935226;
76
77 final double precision = 4.0e-6;
78
79 final AbsoluteDate date = new AbsoluteDate(2009, 8, 12, TimeScalesFactory.getUTC());
80
81 final MendesPavlisModel model = new MendesPavlisModel(temperature, pressure,
82 humidity, lambda);
83
84 final double[] computedDelay = model.computeZenithDelay(point, model.getParameters(), date);
85
86 Assert.assertEquals(expectedHydroDelay, computedDelay[0], precision);
87 Assert.assertEquals(expectedWetDelay, computedDelay[1], precision);
88 Assert.assertEquals(expectedDelay, computedDelay[0] + computedDelay[1], precision);
89
90 }
91
92 @Test
93 public void testMappingFactors() {
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108 final AbsoluteDate date = new AbsoluteDate(2009, 8, 12, TimeScalesFactory.getUTC());
109
110 final double latitude = FastMath.toRadians(30.67166667);
111 final double longitude = FastMath.toRadians(-104.0250);
112 final double height = 2075;
113 final double pressure = 798.4188;
114 final double temperature = 300.15;
115 final double humidity = 0.4;
116 final double lambda = 0.532;
117 final GeodeticPoint point = new GeodeticPoint(latitude, longitude, height);
118
119 final double elevation = FastMath.toRadians(15.0);
120
121 final double expectedMapping = 3.80024367;
122
123
124 final MendesPavlisModel model = new MendesPavlisModel(temperature, pressure,
125 humidity, lambda);
126
127 final double[] computedMapping = model.mappingFactors(elevation, point, date);
128
129 Assert.assertEquals(expectedMapping, computedMapping[0], 5.0e-8);
130 Assert.assertEquals(expectedMapping, computedMapping[1], 5.0e-8);
131 }
132
133 @Test
134 public void testDelay() {
135 final double elevation = 10d;
136 final double height = 100d;
137 final AbsoluteDate date = new AbsoluteDate();
138 final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(45.0), FastMath.toRadians(45.0), height);
139 MendesPavlisModel model = MendesPavlisModel.getStandardModel( 0.6943);
140 final double path = model.pathDelay(FastMath.toRadians(elevation), point, model.getParameters(), date);
141 Assert.assertTrue(Precision.compareTo(path, 20d, epsilon) < 0);
142 Assert.assertTrue(Precision.compareTo(path, 0d, epsilon) > 0);
143 }
144
145 @Test
146 public void testFixedHeight() {
147 final AbsoluteDate date = new AbsoluteDate();
148 final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(45.0), FastMath.toRadians(45.0), 350.0);
149 MendesPavlisModel model = MendesPavlisModel.getStandardModel(0.6943);
150 double lastDelay = Double.MAX_VALUE;
151
152 for (double elev = 10d; elev < 90d; elev += 8d) {
153 final double delay = model.pathDelay(FastMath.toRadians(elev), point, model.getParameters(), date);
154 Assert.assertTrue(Precision.compareTo(delay, lastDelay, epsilon) < 0);
155 lastDelay = delay;
156 }
157 }
158
159 }