1   /* Copyright 2002-2024 Thales Alenia Space
2    * Licensed to CS Communication & Systèmes (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.CalculusFieldElement;
20  import org.orekit.annotation.DefaultDataContext;
21  import org.orekit.bodies.FieldGeodeticPoint;
22  import org.orekit.bodies.GeodeticPoint;
23  import org.orekit.data.DataContext;
24  import org.orekit.data.DataProvidersManager;
25  import org.orekit.models.earth.weather.ConstantPressureTemperatureHumidityProvider;
26  import org.orekit.models.earth.weather.PressureTemperatureHumidity;
27  import org.orekit.models.earth.weather.PressureTemperatureHumidityProvider;
28  import org.orekit.models.earth.weather.water.Wang1988;
29  import org.orekit.time.AbsoluteDate;
30  import org.orekit.time.FieldAbsoluteDate;
31  import org.orekit.utils.FieldTrackingCoordinates;
32  import org.orekit.utils.TrackingCoordinates;
33  
34  /** The modified Saastamoinen model.
35   * @author Luc Maisonobe
36   * @deprecated as of 12.1, replaced by {@link ModifiedSaastamoinenModel}
37   */
38  @Deprecated
39  public class SaastamoinenModel extends ModifiedSaastamoinenModel implements DiscreteTroposphericModel {
40  
41      /** Default file name for δR correction term table. */
42      public static final String DELTA_R_FILE_NAME = ModifiedSaastamoinenModel.DELTA_R_FILE_NAME;
43  
44      /** Default lowest acceptable elevation angle [rad]. */
45      public static final double DEFAULT_LOW_ELEVATION_THRESHOLD = ModifiedSaastamoinenModel.DEFAULT_LOW_ELEVATION_THRESHOLD;
46  
47      /**
48       * Create a new Saastamoinen model for the troposphere using the given environmental
49       * conditions and table from the reference book.
50       *
51       * @param t0 the temperature at the station [K]
52       * @param p0 the atmospheric pressure at the station [mbar]
53       * @param r0 the humidity at the station [fraction] (50% → 0.5)
54       * @see ModifiedSaastamoinenModel#ModifiedSaastamoinenModel(PressureTemperatureHumidityProvider, String, DataProvidersManager)
55       * @since 10.1
56       */
57      @DefaultDataContext
58      public SaastamoinenModel(final double t0, final double p0, final double r0) {
59          this(t0, p0, r0, DELTA_R_FILE_NAME);
60      }
61  
62      /** Create a new Saastamoinen model for the troposphere using the given
63       * environmental conditions. This constructor uses the {@link DataContext#getDefault()
64       * default data context} if {@code deltaRFileName != null}.
65       *
66       * @param t0 the temperature at the station [K]
67       * @param p0 the atmospheric pressure at the station [mbar]
68       * @param r0 the humidity at the station [fraction] (50% → 0.5)
69       * @param deltaRFileName regular expression for filename containing δR
70       * correction term table (typically {@link #DELTA_R_FILE_NAME}), if null
71       * default values from the reference book are used
72       * @since 7.1
73       * @see ModifiedSaastamoinenModel#ModifiedSaastamoinenModel(PressureTemperatureHumidityProvider, String, DataProvidersManager)
74       */
75      @DefaultDataContext
76      public SaastamoinenModel(final double t0, final double p0, final double r0,
77                               final String deltaRFileName) {
78          this(t0, p0, r0, deltaRFileName, DataContext.getDefault().getDataProvidersManager());
79      }
80  
81      /** Create a new Saastamoinen model for the troposphere using the given
82       * environmental conditions. This constructor allows the user to specify the source of
83       * of the δR file.
84       *
85       * @param t0 the temperature at the station [K]
86       * @param p0 the atmospheric pressure at the station [mbar]
87       * @param r0 the humidity at the station [fraction] (50% → 0.5)
88       * @param deltaRFileName regular expression for filename containing δR
89       * correction term table (typically {@link #DELTA_R_FILE_NAME}), if null
90       * default values from the reference book are used
91       * @param dataProvidersManager provides access to auxiliary data.
92       * @since 10.1
93       */
94      public SaastamoinenModel(final double t0,
95                               final double p0,
96                               final double r0,
97                               final String deltaRFileName,
98                               final DataProvidersManager dataProvidersManager) {
99          super(new ConstantPressureTemperatureHumidityProvider(new PressureTemperatureHumidity(0.0,
100                                                                                               TroposphericModelUtils.HECTO_PASCAL.toSI(p0),
101                                                                                               t0,
102                                                                                               new Wang1988().
103                                                                                               waterVaporPressure(TroposphericModelUtils.HECTO_PASCAL.toSI(p0),
104                                                                                                                  t0,
105                                                                                                                  r0),
106                                                                                               Double.NaN,
107                                                                                               Double.NaN)),
108               deltaRFileName, dataProvidersManager);
109     }
110 
111     /** Create a new Saastamoinen model using a standard atmosphere model.
112     *
113     * <ul>
114     * <li>altitude: 0m</li>
115     * <li>temperature: 18 degree Celsius
116     * <li>pressure: 1013.25 mbar
117     * <li>humidity: 50%
118     * </ul>
119     *
120     * @return a Saastamoinen model with standard environmental values
121     */
122     @DefaultDataContext
123     public static SaastamoinenModel getStandardModel() {
124         return new SaastamoinenModel(273.16 + 18, 1013.25, 0.5);
125     }
126 
127     /** {@inheritDoc} */
128     @Override
129     @Deprecated
130     public double pathDelay(final double elevation, final GeodeticPoint point,
131                             final double[] parameters, final AbsoluteDate date) {
132         return pathDelay(new TrackingCoordinates(0.0, elevation, 0.0), point,
133                          getPth0Provider().getWeatherParamerers(point, date), parameters, date).getDelay();
134     }
135 
136     /** {@inheritDoc} */
137     @Override
138     @Deprecated
139     public <T extends CalculusFieldElement<T>> T pathDelay(final T elevation,
140                                                            final FieldGeodeticPoint<T> point,
141                                                            final T[] parameters,
142                                                            final FieldAbsoluteDate<T> date) {
143         return pathDelay(new FieldTrackingCoordinates<>(date.getField().getZero(), elevation, date.getField().getZero()),
144                          point,
145                          getPth0Provider().getWeatherParamerers(point, date),
146                          parameters, date).getDelay();
147     }
148 
149 }