1   /* Copyright 2002-2024 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.CalculusFieldElement;
20  import org.orekit.annotation.DefaultDataContext;
21  import org.orekit.bodies.FieldGeodeticPoint;
22  import org.orekit.bodies.GeodeticPoint;
23  import org.orekit.models.earth.weather.FieldPressureTemperatureHumidity;
24  import org.orekit.time.AbsoluteDate;
25  import org.orekit.time.FieldAbsoluteDate;
26  import org.orekit.utils.FieldTrackingCoordinates;
27  import org.orekit.utils.ParameterDriver;
28  import org.orekit.utils.TrackingCoordinates;
29  
30  /** An estimated tropospheric model. The tropospheric delay is computed according to the formula:
31   * <p>
32   * δ = δ<sub>h</sub> * m<sub>h</sub> + (δ<sub>t</sub> - δ<sub>h</sub>) * m<sub>w</sub>
33   * <p>
34   * With:
35   * <ul>
36   * <li>δ<sub>h</sub>: Tropospheric zenith hydro-static delay.</li>
37   * <li>δ<sub>t</sub>: Tropospheric total zenith delay.</li>
38   * <li>m<sub>h</sub>: Hydro-static mapping function.</li>
39   * <li>m<sub>w</sub>: Wet mapping function.</li>
40   * </ul>
41   * <p>
42   * The mapping functions m<sub>h</sub>(e) and m<sub>w</sub>(e) are
43   * computed thanks to a {@link #model} initialized by the user.
44   * The user has the possibility to use several mapping function models for the computations:
45   * the {@link GlobalMappingFunctionModel Global Mapping Function}, or
46   * the {@link NiellMappingFunctionModel Niell Mapping Function}
47   * </p> <p>
48   * The tropospheric zenith delay δ<sub>h</sub> is computed empirically with a
49   * {@link DiscreteTroposphericModel tropospheric model}
50   * while the tropospheric total zenith delay δ<sub>t</sub> is estimated as a {@link ParameterDriver},
51   * hence the wet part is the difference between the two.
52   * @deprecated as of 12.1, replaced by {@link EstimatedModel}
53   */
54  @Deprecated
55  public class EstimatedTroposphericModel extends EstimatedModel implements DiscreteTroposphericModel {
56  
57      /** Name of the parameter of this model: the total zenith delay. */
58      public static final String TOTAL_ZENITH_DELAY = "total zenith delay";
59  
60      /** Build a new instance using the given environmental conditions.
61       * <p>
62       * This constructor uses a {@link ModifiedSaastamoinenModel} for the hydrostatic contribution.
63       * </p>
64       * @param t0 the temperature at the station [K]
65       * @param p0 the atmospheric pressure at the station [mbar]
66       * @param model mapping function model (NMF or GMF).
67       * @param totalDelay initial value for the tropospheric zenith total delay [m]
68       */
69      @DefaultDataContext
70      public EstimatedTroposphericModel(final double t0, final double p0,
71                                        final MappingFunction model, final double totalDelay) {
72          super(0.0, t0, p0, new TroposphereMappingFunctionAdapter(model), totalDelay);
73      }
74  
75      /** Build a new instance using the given environmental conditions.
76       * @param hydrostatic model for hydrostatic component
77       * @param model mapping function model (NMF or GMF).
78       * @param totalDelay initial value for the tropospheric zenith total delay [m]
79       * @since 12.1
80       */
81      public EstimatedTroposphericModel(final DiscreteTroposphericModel hydrostatic,
82                                        final MappingFunction model,
83                                        final double totalDelay) {
84          super(new TroposphericModelAdapter(hydrostatic),
85                new TroposphereMappingFunctionAdapter(model),
86                totalDelay);
87      }
88  
89      /** Build a new instance using a standard atmosphere model.
90       * <ul>
91       * <li>temperature: 18 degree Celsius
92       * <li>pressure: 1013.25 mbar
93       * </ul>
94       * @param model mapping function model (NMF or GMF).
95       * @param totalDelay initial value for the tropospheric zenith total delay [m]
96       */
97      @DefaultDataContext
98      public EstimatedTroposphericModel(final MappingFunction model, final double totalDelay) {
99          this(273.15 + 18.0, 1013.25, model, totalDelay);
100     }
101 
102     /** {@inheritDoc} */
103     @Override
104     @Deprecated
105     public double pathDelay(final double elevation, final GeodeticPoint point,
106                             final double[] parameters, final AbsoluteDate date) {
107         return pathDelay(new TrackingCoordinates(0.0, elevation, 0.0), point,
108                          TroposphericModelUtils.STANDARD_ATMOSPHERE, parameters, date).getDelay();
109     }
110 
111     /** {@inheritDoc} */
112     @Override
113     @Deprecated
114     public <T extends CalculusFieldElement<T>> T pathDelay(final T elevation,
115                                                            final FieldGeodeticPoint<T> point,
116                                                            final T[] parameters,
117                                                            final FieldAbsoluteDate<T> date) {
118         return pathDelay(new FieldTrackingCoordinates<>(date.getField().getZero(), elevation, date.getField().getZero()),
119                          point,
120                          new FieldPressureTemperatureHumidity<>(date.getField(), TroposphericModelUtils.STANDARD_ATMOSPHERE),
121                          parameters, date).getDelay();
122     }
123 
124 }