1 /* Copyright 2002-2025 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.gnss.attitude;
18
19 import org.junit.jupiter.api.Test;
20
21
22 class GlonassTest extends AbstractGNSSAttitudeProviderTest {
23
24 @Test
25 void testPatchedLargeNegativeBeta() {
26 doTestAxes("patched-eclips/beta-large-negative-GLONASS.txt", 7.2e-15, 1.1e-15, false);
27 }
28
29 @Test
30 void testPatchedSmallNegativeBeta() {
31 doTestAxes("patched-eclips/beta-small-negative-GLONASS.txt", 7.8e-11, 9.8e-16, false);
32 }
33
34 @Test
35 void testPatchedCrossingBeta() {
36 doTestAxes("patched-eclips/beta-crossing-GLONASS.txt", 5.2e-6, 1.1e-15, false);
37 }
38
39 @Test
40 void testPatchedSmallPositiveBeta() {
41 doTestAxes("patched-eclips/beta-small-positive-GLONASS.txt", 2.4e-12, 7.4e-16, false);
42 }
43
44 @Test
45 void testPatchedLargePositiveBeta() {
46 doTestAxes("patched-eclips/beta-large-positive-GLONASS.txt", 6.8e-15, 9.2e-16, false);
47 }
48
49 @Test
50 void testOriginalLargeNegativeBeta() {
51 doTestAxes("original-eclips/beta-large-negative-GLONASS.txt", 7.2e-15, 1.1e-15, false);
52 }
53
54 @Test
55 void testOriginalSmallNegativeBeta() {
56 doTestAxes("original-eclips/beta-small-negative-GLONASS.txt", 1.6e-4, 9.8e-16, false);
57 }
58
59 @Test
60 void testOriginalCrossingBeta() {
61 // the very high threshold (0.54 radians) is due to a probable bug in original eclips
62 // the output of the routine is limited to the x-sat vector, the yaw angle itself
63 // is not output. However, in some cases the x-sat vector is not normalized at all.
64 // looking in the reference data file original-eclips/beta-crossing-GLONASS.txt,
65 // one can see that the axis at line 6 is about (1.3069, 0.7310, -0.7609). The yaw
66 // angle extracted from this wrong vector and written as the last field in the same
67 // line reads 92.6599°, whereas Orekit value is 94.4594°. However, looking
68 // at the log from the original routine, we get:
69 // R 45 103443.31500000000 179.97115230838418 94.470693723018371 ...
70 // so we see that the yaw value is 94.4707°, very close to Orekit value.
71 // As the testOriginal...() series of tests explicitly do *not* patch the original routine
72 // at all, it was not possible to output the internal phi variable to write reference
73 // data properly. We also decided to not edit the file to set the correct angle value,
74 // as this would imply cheating on the reference
75 // As a conclusion, we consider here that the reference output is wrong and that
76 // Orekit behavior is correct, so we increased the threshold so the test pass,
77 // and wrote this big comment to explain the situation
78 doTestAxes("original-eclips/beta-crossing-GLONASS.txt", 0.54, 1.1e-15, false);
79 }
80
81 @Test
82 void testOriginalSmallPositiveBeta() {
83 doTestAxes("original-eclips/beta-small-positive-GLONASS.txt", 1.6e-4, 7.4e-16, false);
84 }
85
86 @Test
87 void testOriginalLargePositiveBeta() {
88 doTestAxes("original-eclips/beta-large-positive-GLONASS.txt", 6.8e-15, 9.2e-16, false);
89 }
90
91 }