1   /* Copyright 2002-2021 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 java.util.List;
20  
21  import org.hipparchus.Field;
22  import org.hipparchus.CalculusFieldElement;
23  import org.hipparchus.util.MathArrays;
24  import org.orekit.bodies.FieldGeodeticPoint;
25  import org.orekit.bodies.GeodeticPoint;
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 split the delay into hydrostatic
34   * and non-hydrostatic part:
35   * <p>
36   * δ = δ<sub>h</sub> + δ<sub>nh</sub>
37   * <p>
38   * With:
39   * <ul>
40   * <li> δ<sub>h</sub>  =  hydrostatic delay </li>
41   * <li> δ<sub>nh</sub> =  non-hydrostatic (or wet) delay </li>
42   * </ul>
43   * @author Bryan Cazabonne
44   */
45  public interface DiscreteTroposphericModel {
46  
47      /** Calculates the tropospheric path delay for the signal path from a ground
48       * station to a satellite.
49       *
50       * @param elevation the elevation of the satellite, in radians
51       * @param point station location
52       * @param parameters tropospheric model parameters
53       * @param date current date
54       * @return the path delay due to the troposphere in m
55       */
56      double pathDelay(double elevation, GeodeticPoint point, double[] parameters, AbsoluteDate date);
57  
58      /** Calculates the tropospheric path delay for the signal path from a ground
59       * station to a satellite.
60       *
61       * @param <T> type of the elements
62       * @param elevation the elevation of the satellite, in radians
63       * @param point station location
64       * @param parameters tropospheric model parameters
65       * @param date current date
66       * @return the path delay due to the troposphere in m
67       */
68      <T extends CalculusFieldElement<T>> T pathDelay(T elevation, FieldGeodeticPoint<T> point, T[] parameters, FieldAbsoluteDate<T> date);
69  
70      /** Get the drivers for tropospheric model parameters.
71       * @return drivers for tropospheric model parameters
72       */
73      List<ParameterDriver> getParametersDrivers();
74  
75      /** Get tropospheric model parameters.
76       * @return tropospheric model parameters
77       */
78      default double[] getParameters() {
79          final List<ParameterDriver> drivers = getParametersDrivers();
80          final double[] parameters = new double[drivers.size()];
81          for (int i = 0; i < drivers.size(); ++i) {
82              parameters[i] = drivers.get(i).getValue();
83          }
84          return parameters;
85      }
86  
87      /** Get tropospheric model parameters.
88       * @param field field to which the elements belong
89       * @param <T> type of the elements
90       * @return tropospheric model parameters
91       */
92      default <T extends CalculusFieldElement<T>> T[] getParameters(final Field<T> field) {
93          final List<ParameterDriver> drivers = getParametersDrivers();
94          final T[] parameters = MathArrays.buildArray(field, drivers.size());
95          for (int i = 0; i < drivers.size(); ++i) {
96              parameters[i] = field.getZero().add(drivers.get(i).getValue());
97          }
98          return parameters;
99      }
100 
101 }