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.models.earth.troposphere;
18  
19  import org.hipparchus.util.Binary64Field;
20  import org.hipparchus.util.FastMath;
21  import org.junit.jupiter.api.Assertions;
22  import org.junit.jupiter.api.Test;
23  import org.orekit.bodies.GeodeticPoint;
24  import org.orekit.models.earth.weather.PressureTemperatureHumidityProvider;
25  import org.orekit.time.AbsoluteDate;
26  import org.orekit.time.TimeScalesFactory;
27  import org.orekit.utils.TrackingCoordinates;
28  
29  public class ViennaThreePathDelayTest extends AbstractPathDelayTest<ViennaThree> {
30  
31      protected ViennaThree buildTroposphericModel(final PressureTemperatureHumidityProvider provider) {
32          return new ViennaThree(new ConstantViennaAProvider(new ViennaACoefficients(0.00123462, 0.00047101)),
33                                                    new ConstantAzimuthalGradientProvider(null),
34                                                    new ConstantTroposphericModel(new TroposphericDelay(2.1993, 0.0690, 0, 0)),
35                                                    TimeScalesFactory.getUTC());
36      }
37  
38      @Test
39      @Override
40      public void testFixedHeight() {
41          doTestFixedHeight(null);
42      }
43  
44      @Test
45      @Override
46      public void testFieldFixedHeight() {
47          doTestFieldFixedHeight(Binary64Field.getInstance(), null);
48      }
49  
50      @Test
51      @Override
52      public void testFixedElevation() {
53          doTestFixedElevation(null);
54      }
55  
56      @Test
57      @Override
58      public void testFieldFixedElevation() {
59          doTestFieldFixedElevation(Binary64Field.getInstance(), null);
60      }
61  
62      @Test
63      @Override
64      public void testDelay() {
65          doTestDelay(new AbsoluteDate(),
66                      new GeodeticPoint(FastMath.toRadians(37.5), FastMath.toRadians(277.5), 100.0), new TrackingCoordinates(FastMath.toRadians(30.0), FastMath.toRadians(10.0), 0.0),
67                      null,
68                      2.1993, 0.069, 12.2124, 0.3916, 12.6041);
69      }
70  
71      @Test
72      @Override
73      public void testFieldDelay() {
74          doTestDelay(Binary64Field.getInstance(),
75                      new AbsoluteDate(),
76                      new GeodeticPoint(FastMath.toRadians(37.5), FastMath.toRadians(277.5), 100.0), new TrackingCoordinates(FastMath.toRadians(30.0), FastMath.toRadians(10.0), 0.0),
77                      null,
78                      2.1993, 0.069, 12.2124, 0.3916, 12.6041);
79      }
80  
81      @Test
82      public void testDelayWithAzimuthalAsymmetry() {
83          final AbsoluteDate  date      = new AbsoluteDate();
84          final GeodeticPoint point     = new GeodeticPoint(FastMath.toRadians(37.5), FastMath.toRadians(277.5), 100.0);
85          final ViennaThree   model     = new ViennaThree(new ConstantViennaAProvider(new ViennaACoefficients(0.00123462, 0.00047101)),
86                                                          new ConstantAzimuthalGradientProvider(new AzimuthalGradientCoefficients(12.0, 4.5,
87                                                                                                                                  0.8, 1.25)),
88                                                          new ConstantTroposphericModel(new TroposphericDelay(2.1993, 0.0690, 0, 0)),
89                                                          TimeScalesFactory.getUTC());
90          final TroposphericDelay delay = model.pathDelay(new TrackingCoordinates(FastMath.toRadians(30.0), FastMath.toRadians(10.0), 0.0),
91                                                          point,
92                                                          model.getParameters(date), date);
93          Assertions.assertEquals( 2.1993,                      delay.getZh(),    1.0e-4);
94          Assertions.assertEquals( 0.069,                       delay.getZw(),    1.0e-4);
95          Assertions.assertEquals(12.2124 + 373.8241,           delay.getSh(),    1.0e-4); // second term is due to azimuthal gradient
96          Assertions.assertEquals( 0.3916 +  38.9670,           delay.getSw(),    1.0e-4); // second term is due to azimuthal gradient
97          Assertions.assertEquals(12.6041 + 373.8241 + 38.9670, delay.getDelay(), 1.0e-4);
98      }
99  
100 }