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 ViennaOneModelTest {
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 testMappingFactors() {
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 final AbsoluteDate date = AbsoluteDate.createMJDDate(55055, 0, TimeScalesFactory.getUTC());
72
73 final double latitude = FastMath.toRadians(38.0);
74 final double longitude = FastMath.toRadians(280.0);
75 final double height = 824.17;
76 final GeodeticPoint point = new GeodeticPoint(latitude, longitude, height);
77
78 final double elevation = 0.5 * FastMath.PI - 1.278564131;
79 final double expectedHydro = 3.425088;
80 final double expectedWet = 3.448300;
81
82 final double[] a = { 0.00127683, 0.00060955 };
83 final double[] z = {2.0966, 0.2140};
84
85 final ViennaOneModel model = new ViennaOneModel(a, z);
86
87 final double[] computedMapping = model.mappingFactors(elevation, point, date);
88
89 Assert.assertEquals(expectedHydro, computedMapping[0], 4.1e-6);
90 Assert.assertEquals(expectedWet, computedMapping[1], 1.0e-6);
91 }
92
93 @Test
94 public void testDelay() {
95 final double elevation = 10d;
96 final double height = 100d;
97 final AbsoluteDate date = new AbsoluteDate();
98 final double[] a = { 0.00127683, 0.00060955 };
99 final double[] z = {2.0966, 0.2140};
100 final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(45.0), FastMath.toRadians(45.0), height);
101 ViennaOneModel model = new ViennaOneModel(a, z);
102 final double path = model.pathDelay(FastMath.toRadians(elevation), point, model.getParameters(), date);
103 Assert.assertTrue(Precision.compareTo(path, 20d, epsilon) < 0);
104 Assert.assertTrue(Precision.compareTo(path, 0d, epsilon) > 0);
105 }
106
107 @Test
108 public void testFixedHeight() {
109 final AbsoluteDate date = new AbsoluteDate();
110 final double[] a = { 0.00127683, 0.00060955 };
111 final double[] z = {2.0966, 0.2140};
112 final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(45.0), FastMath.toRadians(45.0), 350.0);
113 ViennaOneModel model = new ViennaOneModel(a, z);
114 double lastDelay = Double.MAX_VALUE;
115
116 for (double elev = 10d; elev < 90d; elev += 8d) {
117 final double delay = model.pathDelay(FastMath.toRadians(elev), point, model.getParameters(), date);
118 Assert.assertTrue(Precision.compareTo(delay, lastDelay, epsilon) < 0);
119 lastDelay = delay;
120 }
121 }
122
123 }