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.PVCoordinates;
29  
30  
31  public class VEISFrameTest {
32  
33      @Test
34      public void testRefLEO() {
35  
36          AbsoluteDate date0 = new AbsoluteDate(new DateComponents(2004, 04, 06),
37                                                new TimeComponents(07, 51, 28.386009),
38                                                TimeScalesFactory.getUTC());
39  
40          Transform t0 = FramesFactory.getEME2000().getTransformTo(FramesFactory.getVeis1950(), date0);
41  
42          // J2000
43          PVCoordinates pvJ2000 =
44              new PVCoordinates(new Vector3D(5102509.6000, 6123011.5200, 6378136.3000),
45                                new Vector3D(-4743.219600, 790.536600, 5533.756190));
46  
47          // the following result were obtained using this code in mslib Fortran library
48          // model         =  pm_lieske_wahr
49          // jul1950%jour  =  19819                ! 2004-04-06
50          // jul1950%sec   =  28288.386009_pm_reel ! 07:51:28.386009
51          // delta_tu1     =  0.0_pm_reel          ! 0.0 dtu1 as here we don't use EOP corrections
52          // delta_tai     =  32.0_pm_reel         ! TAI - UTC
53          // pos_J2000(1)  = 5102509.6000_pm_reel
54          // pos_J2000(2)  = 6123011.5200_pm_reel
55          // pos_J2000(3)  = 6378136.3000_pm_reel
56          // vit_J2000(1)  = -4743.219600_pm_reel
57          // vit_J2000(2)  =   790.536600_pm_reel
58          // vit_J2000(3)  =  5533.756190_pm_reel
59          // call mr_J2000_veis (model, jul1950, delta_tu1, delta_tai, pos_J2000, pos_veis, code_retour, &
60          //                     vit_J2000, vit_veis, jacob )
61          PVCoordinates pvVEIS =
62              new PVCoordinates(new Vector3D(5168161.5980523797, 6065377.6711138152, 6380344.5327578690),
63                                new Vector3D(-4736.2464648667, 843.3525998501, 5531.9312750395));
64          PVCoordinates delta0 = new PVCoordinates(t0.transformPVCoordinates(pvJ2000), pvVEIS);
65          Assertions.assertEquals(0.0, delta0.getPosition().getNorm(), 7.0e-4);
66          Assertions.assertEquals(0.0, delta0.getVelocity().getNorm(), 8.0e-5);
67  
68      }
69  
70      @Test
71      public void testRefGEO() {
72  
73          AbsoluteDate date0 = new AbsoluteDate(new DateComponents(2004, 06, 01),
74                                                TimeComponents.H00,
75                                                TimeScalesFactory.getUTC());
76  
77          Transform t0 = FramesFactory.getEME2000().getTransformTo(FramesFactory.getVeis1950(), date0);
78  
79          //J2000
80          PVCoordinates pvJ2000 =
81              new PVCoordinates(new Vector3D(-40588150.3620, -11462167.0280, 27147.6490),
82                                new Vector3D(834.787457, -2958.305691, -1.173016));
83  
84          // the following result were obtained using this code in mslib Fortran library
85          // model         =  pm_lieske_wahr
86          // jul1950%jour  =  19875                ! 2004-06-01
87          // jul1950%sec   =  0.0_pm_reel          ! 00:00:00.000
88          // delta_tu1     =  0.0_pm_reel          ! 0.0 dtu1 as here we don't use EOP corrections
89          // delta_tai     =  32.0_pm_reel
90          // pos_J2000(1)  = -40588150.3620_pm_reel
91          // pos_J2000(2)  = -11462167.0280_pm_reel
92          // pos_J2000(3)  =     27147.6490_pm_reel
93          // vit_J2000(1)  =       834.787457_pm_reel
94          // vit_J2000(2)  =     -2958.305691_pm_reel
95          // vit_J2000(3)  =        -1.173016_pm_reel
96          PVCoordinates pvVEIS =
97              new PVCoordinates(new Vector3D(-40713785.1340916604, -11007613.4509160239, 10293.2583441036),
98                                new Vector3D(801.6573208750, -2967.4549256851, -0.9288811067));
99  
100         PVCoordinates delta0 = new PVCoordinates(t0.transformPVCoordinates(pvJ2000), pvVEIS);
101         Assertions.assertEquals(0.0, delta0.getPosition().getNorm(), 4.0e-4);
102         Assertions.assertEquals(0.0, delta0.getVelocity().getNorm(), 4.0e-4);
103 
104     }
105 
106     @BeforeEach
107     public void setUp() {
108         Utils.setDataRoot("compressed-data");
109     }
110 
111 }