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 GPSBlockIIFTest extends AbstractGNSSAttitudeProviderTest {
23  
24      @Test
25      void testPatchedLargeNegativeBeta() {
26          doTestAxes("patched-eclips/beta-large-negative-BLOCK-IIF.txt",  6.8e-15, 7.6e-16, false);
27      }
28  
29      @Test
30      void testPatchedSmallNegativeBeta() {
31          doTestAxes("patched-eclips/beta-small-negative-BLOCK-IIF.txt", 1.8e-12, 9.2e-16, false);
32      }
33  
34      @Test
35      void testPatchedCrossingBeta() {
36          doTestAxes("patched-eclips/beta-crossing-BLOCK-IIF.txt", 5.7e-4, 7.8e-16, false);
37      }
38  
39      @Test
40      void testPatchedSmallPositiveBeta() {
41          doTestAxes("patched-eclips/beta-small-positive-BLOCK-IIF.txt", 2.9e-12, 6.0e-16, false);
42      }
43  
44      @Test
45      void testPatchedLargePositiveBeta() {
46          doTestAxes("patched-eclips/beta-large-positive-BLOCK-IIF.txt", 7.4e-15, 7.0e-16, false);
47      }
48  
49      @Test
50      void testOriginalLargeNegativeBeta() {
51          doTestAxes("original-eclips/beta-large-negative-BLOCK-IIF.txt", 6.8e-15, 7.6e-16, false);
52      }
53  
54      @Test
55      void testOriginalSmallNegativeBeta() {
56          doTestAxes("original-eclips/beta-small-negative-BLOCK-IIF.txt", 2.8e-3, 9.2e-16, false);
57      }
58  
59      @Test
60      void testOriginalCrossingBeta() {
61          // the very high threshold (0.24 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 normalised at all.
64          // looking in the reference data file original-eclips/beta-crossing-BLOCK-IIF.txt,
65          // one can see that the axis at line 8 is about (0.4380, 0.9578, 1.3430). The yaw
66          // angle extracted from these wrong vector and written as the last field in the same
67          // line reads -107.3651°, whereas Orekit value is -120.6269°. However, looking at the
68          // log from the original routine, we get:
69          // R           6   348427.10900000000       -179.97172706071467       -120.62317675422287 ...
70          // so we see that the yaw value is -120.6232°, 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 behaviour 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-BLOCK-IIF.txt", 0.24, 7.8e-16, false);
79      }
80  
81      @Test
82      void testOriginalSmallPositiveBeta() {
83          doTestAxes("original-eclips/beta-small-positive-BLOCK-IIF.txt", 2.8e-4, 6.0e-16, false);
84      }
85  
86      @Test
87      void testOriginalLargePositiveBeta() {
88          doTestAxes("original-eclips/beta-large-positive-BLOCK-IIF.txt", 7.4e-15, 7.0e-16, false);
89      }
90  
91  }