1   /* Copyright 2011-2012 Space Applications Services
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;
18  
19  import java.util.Collections;
20  import java.util.List;
21  
22  import org.hipparchus.Field;
23  import org.hipparchus.RealFieldElement;
24  import org.hipparchus.util.FastMath;
25  import org.hipparchus.util.MathArrays;
26  import org.orekit.time.AbsoluteDate;
27  import org.orekit.time.FieldAbsoluteDate;
28  import org.orekit.utils.ParameterDriver;
29  
30  /** Defines a tropospheric model, used to calculate the path delay imposed to
31   * electro-magnetic signals between an orbital satellite and a ground station.
32   * <p>
33   * Models that implement this interface don't split the delay into hydrostatic
34   * and non-hydrostatic part.
35   * </p>
36   * @author Thomas Neidhart
37   * @since 7.1
38   */
39  public interface TroposphericModel extends DiscreteTroposphericModel {
40  
41      /** Calculates the tropospheric path delay for the signal path from a ground
42       * station to a satellite.
43       *
44       * @param elevation the elevation of the satellite, in radians
45       * @param height the height of the station in m above sea level
46       * @return the path delay due to the troposphere in m
47       */
48      double pathDelay(double elevation, double height);
49  
50      /** Calculates the tropospheric path delay for the signal path from a ground
51       * station to a satellite.
52       * <p>
53       * It is discourage to use this method. It has been developed to respect the
54       * current architecture of the tropospheric models.
55       * </p>
56       * @param <T> type of the elements
57       * @param elevation the elevation of the satellite, in radians
58       * @param height the height of the station in m above sea level
59       * @return the path delay due to the troposphere in m
60       */
61      default <T extends RealFieldElement<T>> T pathDelay(T elevation, T height) {
62          final T zero = height.getField().getZero();
63          return zero.add(pathDelay(elevation.getReal(), height.getReal()));
64      }
65  
66      /** Calculates the tropospheric path delay for the signal path from a ground
67       * station to a satellite.
68       *
69       * @param elevation the elevation of the satellite, in radians
70       * @param height the height of the station in m above sea level
71       * @param parameters tropospheric model parameters.
72       * @param date current date
73       * @return the path delay due to the troposphere in m
74       */
75      default double pathDelay(double elevation, double height, double[] parameters, AbsoluteDate date) {
76          return pathDelay(elevation, height);
77      }
78  
79      /** Calculates the tropospheric path delay for the signal path from a ground
80       * station to a satellite.
81       *
82       * @param <T> type of the elements
83       * @param elevation the elevation of the satellite, in radians
84       * @param height the height of the station in m above sea level
85       * @param parameters tropospheric model parameters.
86       * @param date current date
87       * @return the path delay due to the troposphere in m
88       */
89      default <T extends RealFieldElement<T>> T pathDelay(T elevation, T height, T[] parameters, FieldAbsoluteDate<T> date) {
90          return pathDelay(elevation, height);
91      }
92  
93      /** This method allows the  computation of the zenith hydrostatic and
94       * zenith wet delay. The resulting element is an array having the following form:
95       * <ul>
96       * <li>double[0] = D<sub>hz</sub> → zenith hydrostatic delay
97       * <li>double[1] = D<sub>wz</sub> → zenith wet delay
98       * </ul>
99       * @param height the height of the station in m above sea level.
100      * @param parameters tropospheric model parameters.
101      * @param date current date
102      * @return a two components array containing the zenith hydrostatic and wet delays.
103      */
104     default double[] computeZenithDelay(double height, double[] parameters, AbsoluteDate date) {
105         return new double[] {
106             pathDelay(0.5 * FastMath.PI, height),
107             0
108         };
109     }
110 
111     /** This method allows the  computation of the zenith hydrostatic and
112      * zenith wet delay. The resulting element is an array having the following form:
113      * <ul>
114      * <li>double[0] = D<sub>hz</sub> → zenith hydrostatic delay
115      * <li>double[1] = D<sub>wz</sub> → zenith wet delay
116      * </ul>
117      * @param <T> type of the elements
118      * @param height the height of the station in m above sea level.
119      * @param parameters tropospheric model parameters.
120      * @param date current date
121      * @return a two components array containing the zenith hydrostatic and wet delays.
122      */
123     default <T extends RealFieldElement<T>> T[] computeZenithDelay(T height, T[] parameters, FieldAbsoluteDate<T> date) {
124         final Field<T> field = height.getField();
125         final T zero = field.getZero();
126         final T[] delay = MathArrays.buildArray(field, 2);
127         delay[0] = pathDelay(zero.add(0.5 * FastMath.PI), height);
128         delay[1] = zero;
129         return delay;
130     }
131 
132     /** This method allows the computation of the hydrostatic and
133      * wet mapping functions. The resulting element is an array having the following form:
134      * <ul>
135      * <li>double[0] = m<sub>h</sub>(e) → hydrostatic mapping function
136      * <li>double[1] = m<sub>w</sub>(e) → wet mapping function
137      * </ul>
138      * @param elevation the elevation of the satellite, in radians.
139      * @param height the height of the station in m above sea level.
140      * @param parameters tropospheric model parameters.
141      * @param date current date
142      * @return a two components array containing the hydrostatic and wet mapping functions.
143      */
144     default double[] mappingFactors(double elevation, double height, double[] parameters, AbsoluteDate date) {
145         return new double[] {
146             1.0,
147             1.0
148         };
149     }
150 
151     /** This method allows the computation of the hydrostatic and
152      * wet mapping functions. The resulting element is an array having the following form:
153      * <ul>
154      * <li>double[0] = m<sub>h</sub>(e) → hydrostatic mapping function
155      * <li>double[1] = m<sub>w</sub>(e) → wet mapping function
156      * </ul>
157      * @param elevation the elevation of the satellite, in radians.
158      * @param height the height of the station in m above sea level.
159      * @param parameters tropospheric model parameters.
160      * @param date current date
161      * @param <T> type of the elements
162      * @return a two components array containing the hydrostatic and wet mapping functions.
163      */
164     default <T extends RealFieldElement<T>> T[] mappingFactors(T elevation, T height,
165                                                                T[] parameters, FieldAbsoluteDate<T> date) {
166         final Field<T> field = date.getField();
167         final T one = field.getOne();
168         final T[] factors = MathArrays.buildArray(field, 2);
169         factors[0] = one;
170         factors[1] = one;
171         return factors;
172     }
173 
174     /** Get the drivers for tropospheric model parameters.
175      * @return drivers for tropospheric model parameters
176      */
177     default List<ParameterDriver> getParametersDrivers() {
178         return Collections.emptyList();
179     }
180 }