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.frames;
18
19 import org.hipparchus.geometry.euclidean.threed.Vector3D;
20 import org.junit.jupiter.api.Assertions;
21 import org.junit.jupiter.api.BeforeEach;
22 import org.junit.jupiter.api.Test;
23 import org.orekit.Utils;
24 import org.orekit.time.AbsoluteDate;
25 import org.orekit.time.DateComponents;
26 import org.orekit.time.TimeComponents;
27 import org.orekit.time.TimeScalesFactory;
28 import org.orekit.utils.Constants;
29 import org.orekit.utils.PVCoordinates;
30
31
32 public class TEMEProviderTest {
33
34 @Test
35 public void testValladoTEMEofDate() {
36
37 // this reference test has been extracted from Vallado's book:
38 // Fundamentals of Astrodynamics and Applications
39 // David A. Vallado, Space Technology Library, 2007
40 AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2000, 182),
41 new TimeComponents(0.78495062 * Constants.JULIAN_DAY),
42 TimeScalesFactory.getUTC());
43
44 // TEME
45 PVCoordinates pvTEME =
46 new PVCoordinates(new Vector3D(-9060473.73569, 4658709.52502, 813686.73153),
47 new Vector3D(-2232.832783, -4110.453490, -3157.345433));
48
49 // reference position in EME2000
50 // note that Valado's book gives
51 // PVCoordinates pvEME2000Ref =
52 // new PVCoordinates(new Vector3D(-9059941.3786, 4659697.2000, 813958.8875),
53 // new Vector3D(-2233.348094, -4110.136162, -3157.394074));
54 // the values we use here are slightly different, they were computed using
55 // Vallado's C++ companion code to the book, using the teme_j2k function with
56 // all 106 nutation terms and the 2 corrections elements of the equation of the equinoxes
57 PVCoordinates pvEME2000Ref =
58 new PVCoordinates(new Vector3D(-9059941.5224999374914, 4659697.1225837596648, 813957.72947647583351),
59 new Vector3D(-2233.3476939179299769, -4110.1362849403413335, -3157.3941963060194738));
60
61 Transform t = FramesFactory.getTEME().getTransformTo(FramesFactory.getEME2000(), t0);
62
63 PVCoordinates pvEME2000Computed = t.transformPVCoordinates(pvTEME);
64 PVCoordinates delta = new PVCoordinates(pvEME2000Computed, pvEME2000Ref);
65 Assertions.assertEquals(0.0, delta.getPosition().getNorm(), 0.025);
66 Assertions.assertEquals(0.0, delta.getVelocity().getNorm(), 1.0e-4);
67
68 }
69
70 @BeforeEach
71 public void setUp() {
72 Utils.setDataRoot("compressed-data");
73 }
74
75 }