EstimatedModel.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 java.util.Collections;
  19. import java.util.List;

  20. import org.hipparchus.CalculusFieldElement;
  21. import org.hipparchus.util.FastMath;
  22. import org.orekit.annotation.DefaultDataContext;
  23. import org.orekit.bodies.FieldGeodeticPoint;
  24. import org.orekit.bodies.GeodeticPoint;
  25. import org.orekit.models.earth.weather.ConstantPressureTemperatureHumidityProvider;
  26. import org.orekit.models.earth.weather.PressureTemperatureHumidity;
  27. import org.orekit.time.AbsoluteDate;
  28. import org.orekit.time.FieldAbsoluteDate;
  29. import org.orekit.utils.FieldTrackingCoordinates;
  30. import org.orekit.utils.ParameterDriver;
  31. import org.orekit.utils.TrackingCoordinates;

  32. /** An estimated tropospheric model. The tropospheric delay is computed according to the formula:
  33.  * <p>
  34.  * δ = δ<sub>h</sub> * m<sub>h</sub> + (δ<sub>t</sub> - δ<sub>h</sub>) * m<sub>w</sub>
  35.  * <p>
  36.  * With:
  37.  * <ul>
  38.  * <li>δ<sub>h</sub>: Tropospheric zenith hydro-static delay.</li>
  39.  * <li>δ<sub>t</sub>: Tropospheric total zenith delay.</li>
  40.  * <li>m<sub>h</sub>: Hydro-static mapping function.</li>
  41.  * <li>m<sub>w</sub>: Wet mapping function.</li>
  42.  * </ul>
  43.  * <p>
  44.  * The mapping functions m<sub>h</sub>(e) and m<sub>w</sub>(e) are
  45.  * computed thanks to a {@link #model} initialized by the user.
  46.  * The user has the possibility to use several mapping function models for the computations:
  47.  * the {@link GlobalMappingFunctionModel Global Mapping Function}, or
  48.  * the {@link NiellMappingFunctionModel Niell Mapping Function}
  49.  * </p> <p>
  50.  * The tropospheric zenith delay δ<sub>h</sub> is computed empirically with a
  51.  * {@link TroposphericModel tropospheric model}
  52.  * while the tropospheric total zenith delay δ<sub>t</sub> is estimated as a {@link ParameterDriver},
  53.  * hence the wet part is the difference between the two.
  54.  * @since 12.1
  55.  */
  56. public class EstimatedModel implements TroposphericModel {

  57.     /** Name of the parameter of this model: the total zenith delay. */
  58.     public static final String TOTAL_ZENITH_DELAY = "total zenith delay";

  59.     /** Mapping Function model. */
  60.     private final TroposphereMappingFunction model;

  61.     /** Driver for the tropospheric zenith total delay.*/
  62.     private final ParameterDriver totalZenithDelay;

  63.     /** Model for hydrostatic component. */
  64.     private final TroposphericModel hydrostatic;

  65.     /** Build a new instance using the given environmental conditions.
  66.      * <p>
  67.      * This constructor uses a {@link ModifiedSaastamoinenModel} for the hydrostatic contribution.
  68.      * </p>
  69.      * @param h0 altitude of the station [m]
  70.      * @param t0 the temperature at the station [K]
  71.      * @param p0 the atmospheric pressure at the station [mbar]
  72.      * @param model mapping function model.
  73.      * @param totalDelay initial value for the tropospheric zenith total delay [m]
  74.      */
  75.     @DefaultDataContext
  76.     public EstimatedModel(final double h0, final double t0, final double p0,
  77.                           final TroposphereMappingFunction model, final double totalDelay) {
  78.         this(new ModifiedSaastamoinenModel(new ConstantPressureTemperatureHumidityProvider(new PressureTemperatureHumidity(h0,
  79.                                                                                                                            TroposphericModelUtils.HECTO_PASCAL.toSI(p0),
  80.                                                                                                                            t0,
  81.                                                                                                                            0.0,
  82.                                                                                                                            Double.NaN,
  83.                                                                                                                            Double.NaN))),
  84.              model, totalDelay);
  85.     }

  86.     /** Build a new instance using the given environmental conditions.
  87.      * @param hydrostatic model for hydrostatic component
  88.      * @param model mapping function model.
  89.      * @param totalDelay initial value for the tropospheric zenith total delay [m]
  90.      * @since 12.1
  91.      */
  92.     public EstimatedModel(final TroposphericModel hydrostatic,
  93.                           final TroposphereMappingFunction model,
  94.                           final double totalDelay) {

  95.         totalZenithDelay = new ParameterDriver(EstimatedModel.TOTAL_ZENITH_DELAY,
  96.                                                totalDelay, FastMath.scalb(1.0, 0), 0.0, Double.POSITIVE_INFINITY);

  97.         this.hydrostatic = hydrostatic;
  98.         this.model = model;
  99.     }

  100.     /** Build a new instance using a standard atmosphere model.
  101.      * <ul>
  102.      * <li>altitude: 0m
  103.      * <li>temperature: 18 degree Celsius
  104.      * <li>pressure: 1013.25 mbar
  105.      * </ul>
  106.      * @param model mapping function model.
  107.      * @param totalDelay initial value for the tropospheric zenith total delay [m]
  108.      */
  109.     @DefaultDataContext
  110.     public EstimatedModel(final TroposphereMappingFunction model, final double totalDelay) {
  111.         this(0.0, 273.15 + 18.0, 1013.25, model, totalDelay);
  112.     }

  113.     /** {@inheritDoc} */
  114.     @Override
  115.     public List<ParameterDriver> getParametersDrivers() {
  116.         return Collections.singletonList(totalZenithDelay);
  117.     }

  118.     /** {@inheritDoc} */
  119.     @Override
  120.     public TroposphericDelay pathDelay(final TrackingCoordinates trackingCoordinates,
  121.                                        final GeodeticPoint point,
  122.                                        final double[] parameters, final AbsoluteDate date) {

  123.         // zenith hydrostatic delay
  124.         final double zd = hydrostatic.pathDelay(trackingCoordinates, point, parameters, date).getZh();

  125.         // zenith wet delay
  126.         final double wd = parameters[0] - zd;

  127.         // mapping functions
  128.         final double[] mf = model.mappingFactors(trackingCoordinates, point, date);

  129.         // composite delay
  130.         return new TroposphericDelay(zd, wd, mf[0] * zd, mf[1] * wd);

  131.     }

  132.     /** {@inheritDoc} */
  133.     @Override
  134.     public <T extends CalculusFieldElement<T>> FieldTroposphericDelay<T> pathDelay(final FieldTrackingCoordinates<T> trackingCoordinates,
  135.                                                                                    final FieldGeodeticPoint<T> point,
  136.                                                                                    final T[] parameters, final FieldAbsoluteDate<T> date) {

  137.         // zenith hydrostatic delay
  138.         final T zd = hydrostatic.pathDelay(trackingCoordinates, point, parameters, date).getZh();

  139.         // zenith wet delay
  140.         final T wd = parameters[0].subtract(zd);

  141.         // mapping functions
  142.         final T[] mf = model.mappingFactors(trackingCoordinates, point, date);

  143.         // composite delay
  144.         return new FieldTroposphericDelay<>(zd, wd, mf[0].multiply(zd), mf[1].multiply(wd));

  145.     }

  146. }