TroposphericModelUtils.java

  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. import org.hipparchus.Field;
  19. import org.hipparchus.CalculusFieldElement;
  20. import org.hipparchus.util.FastMath;
  21. import org.orekit.models.earth.weather.ConstantPressureTemperatureHumidityProvider;
  22. import org.orekit.models.earth.weather.PressureTemperatureHumidity;
  23. import org.orekit.models.earth.weather.PressureTemperatureHumidityProvider;
  24. import org.orekit.models.earth.weather.water.CIPM2007;
  25. import org.orekit.utils.units.Unit;

  26. /**
  27.  * Utility class for tropospheric models.
  28.  * @author Bryan Cazabonne
  29.  * @since 11.0
  30.  */
  31. public class TroposphericModelUtils {

  32.     /** Nanometers unit.
  33.      * @since 12.1
  34.      */
  35.     public static final Unit NANO_M = Unit.parse("nm");

  36.     /** Micrometers unit.
  37.      * @since 12.1
  38.      */
  39.     public static final Unit MICRO_M = Unit.parse("µm");

  40.     /** HectoPascal unit.
  41.      * @since 12.1
  42.      */
  43.     public static final Unit HECTO_PASCAL = Unit.parse("hPa");

  44.     /** Standard atmosphere.
  45.      * <ul>
  46.      * <li>altitude: 0m</li>
  47.      * <li>temperature: 20 degree Celsius</li>
  48.      * <li>pressure: 1013.25 mbar</li>
  49.      * <li>humidity: 50%</li>
  50.      * </ul>
  51.      * @see #STANDARD_ATMOSPHERE_PROVIDER
  52.      * @since 12.1
  53.      */
  54.     public static final PressureTemperatureHumidity STANDARD_ATMOSPHERE;

  55.     /** Provider for {@link #STANDARD_ATMOSPHERE standard atmosphere}.
  56.      * @since 12.1
  57.      */
  58.     public static final PressureTemperatureHumidityProvider STANDARD_ATMOSPHERE_PROVIDER;

  59.     static {
  60.         final double h  = 0.0;
  61.         final double p  = HECTO_PASCAL.toSI(1013.25);
  62.         final double t  = 273.15 + 20;
  63.         final double rh = 0.5;
  64.         STANDARD_ATMOSPHERE = new PressureTemperatureHumidity(h, p, t,
  65.                                                               new CIPM2007().waterVaporPressure(p, t, rh),
  66.                                                               Double.NaN, Double.NaN);
  67.         STANDARD_ATMOSPHERE_PROVIDER =
  68.                         new ConstantPressureTemperatureHumidityProvider(STANDARD_ATMOSPHERE);
  69.     }

  70.     /**
  71.      * Private constructor as class is a utility.
  72.      */
  73.     private TroposphericModelUtils() {
  74.         // Nothing to do
  75.     }

  76.     /** Compute the mapping function related to the coefficient values and the elevation.
  77.      * @param a a coefficient
  78.      * @param b b coefficient
  79.      * @param c c coefficient
  80.      * @param elevation the elevation of the satellite, in radians.
  81.      * @return the value of the function at a given elevation
  82.      */
  83.     public static double mappingFunction(final double a, final double b, final double c, final double elevation) {
  84.         final double sinE = FastMath.sin(elevation);
  85.         // Numerator
  86.         final double numMP = 1 + a / (1 + b / (1 + c));
  87.         // Denominator
  88.         final double denMP = sinE + a / (sinE + b / (sinE + c));

  89.         final double fElevation = numMP / denMP;

  90.         return fElevation;
  91.     }

  92.     /** Compute the mapping function related to the coefficient values and the elevation.
  93.      * @param <T> type of the elements
  94.      * @param a a coefficient
  95.      * @param b b coefficient
  96.      * @param c c coefficient
  97.      * @param elevation the elevation of the satellite, in radians.
  98.      * @return the value of the function at a given elevation
  99.      */
  100.     public static <T extends CalculusFieldElement<T>> T mappingFunction(final T a, final T b, final T c, final T elevation) {
  101.         final T sinE = FastMath.sin(elevation);
  102.         // Numerator
  103.         final T numMP = a.divide(b.divide(c.add(1.0)).add(1.0)).add(1.0);
  104.         // Denominator
  105.         final T denMP = a.divide(b.divide(c.add(sinE)).add(sinE)).add(sinE);

  106.         final T fElevation = numMP.divide(denMP);

  107.         return fElevation;
  108.     }

  109.     /** This method computes the height correction for the hydrostatic
  110.      *  component of the mapping function.
  111.      *  The formulas are given by Neill's paper, 1996:
  112.      *<p>
  113.      *      Niell A. E. (1996)
  114.      *      "Global mapping functions for the atmosphere delay of radio wavelengths,”
  115.      *      J. Geophys. Res., 101(B2), pp.  3227–3246, doi:  10.1029/95JB03048.
  116.      *</p>
  117.      * @param elevation the elevation of the satellite, in radians.
  118.      * @param height the height of the station in m above sea level.
  119.      * @return the height correction, in m
  120.      */
  121.     public static double computeHeightCorrection(final double elevation, final double height) {
  122.         final double fixedHeight = FastMath.max(0.0, height);
  123.         final double sinE = FastMath.sin(elevation);
  124.         // Ref: Eq. 4
  125.         final double function = TroposphericModelUtils.mappingFunction(2.53e-5, 5.49e-3, 1.14e-3, elevation);
  126.         // Ref: Eq. 6
  127.         final double dmdh = (1 / sinE) - function;
  128.         // Ref: Eq. 7
  129.         final double correction = dmdh * (fixedHeight / 1000.0);
  130.         return correction;
  131.     }

  132.     /** This method computes the height correction for the hydrostatic
  133.      *  component of the mapping function.
  134.      *  The formulas are given by Neill's paper, 1996:
  135.      *<p>
  136.      *      Niell A. E. (1996)
  137.      *      "Global mapping functions for the atmosphere delay of radio wavelengths,”
  138.      *      J. Geophys. Res., 101(B2), pp.  3227–3246, doi:  10.1029/95JB03048.
  139.      *</p>
  140.      * @param <T> type of the elements
  141.      * @param elevation the elevation of the satellite, in radians.
  142.      * @param height the height of the station in m above sea level.
  143.      * @param field field to which the elements belong
  144.      * @return the height correction, in m
  145.      */
  146.     public static <T extends CalculusFieldElement<T>> T computeHeightCorrection(final T elevation, final T height, final Field<T> field) {
  147.         final T zero = field.getZero();
  148.         final T fixedHeight = FastMath.max(zero, height);
  149.         final T sinE = FastMath.sin(elevation);
  150.         // Ref: Eq. 4
  151.         final T function = TroposphericModelUtils.mappingFunction(zero.newInstance(2.53e-5), zero.newInstance(5.49e-3), zero.newInstance(1.14e-3), elevation);
  152.         // Ref: Eq. 6
  153.         final T dmdh = sinE.reciprocal().subtract(function);
  154.         // Ref: Eq. 7
  155.         final T correction = dmdh.multiply(fixedHeight.divide(1000.0));
  156.         return correction;
  157.     }

  158. }