AbstractChaoMappingFunction.java

  1. /* Copyright 2002-2024 Thales Alenia Space
  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.CalculusFieldElement;
  19. import org.hipparchus.util.FastMath;
  20. import org.hipparchus.util.MathArrays;
  21. import org.orekit.bodies.FieldGeodeticPoint;
  22. import org.orekit.bodies.GeodeticPoint;
  23. import org.orekit.models.earth.weather.FieldPressureTemperatureHumidity;
  24. import org.orekit.models.earth.weather.PressureTemperatureHumidity;
  25. import org.orekit.time.AbsoluteDate;
  26. import org.orekit.time.FieldAbsoluteDate;
  27. import org.orekit.utils.FieldTrackingCoordinates;
  28. import org.orekit.utils.TrackingCoordinates;

  29. /** Chao mapping function for radio wavelengths.
  30.  *
  31.  * @see "C. C. Chao, A model for tropospheric calibration from delay surface and radiosonde ballon measurements, 1972"
  32.  *
  33.  * @author Luc Maisonobe
  34.  * @since 12.1
  35.  */
  36. public class AbstractChaoMappingFunction implements TroposphereMappingFunction {

  37.     /** First coefficient for hydrostatic (dry) component. */
  38.     private final double ad;

  39.     /** Second coefficient for hydrostatic (dry) component. */
  40.     private final double bd;

  41.     /** First coefficient for wet component. */
  42.     private final double aw;

  43.     /** Second coefficient for wet component. */
  44.     private final double bw;

  45.     /** Builds a new instance.
  46.      * @param ad first coefficient for hydrostatic (dry) component
  47.      * @param bd second coefficient for hydrostatic (dry) component
  48.      * @param aw first coefficient for wet component
  49.      * @param bw second coefficient for wet component
  50.      */
  51.     protected AbstractChaoMappingFunction(final double ad, final double bd, final double aw, final double bw) {
  52.         this.ad = ad;
  53.         this.bd = bd;
  54.         this.aw = aw;
  55.         this.bw = bw;
  56.     }

  57.     /** {@inheritDoc} */
  58.     @Override
  59.     public double[] mappingFactors(final TrackingCoordinates trackingCoordinates, final GeodeticPoint point,
  60.                                    final PressureTemperatureHumidity weather,
  61.                                    final AbsoluteDate date) {
  62.         final double sinE = FastMath.sin(trackingCoordinates.getElevation());
  63.         final double tanE = FastMath.tan(trackingCoordinates.getElevation());
  64.         return new double[] {
  65.             1 / (sinE + ad / (tanE + bd)),
  66.             1 / (sinE + aw / (tanE + bw))
  67.         };
  68.     }

  69.     /** {@inheritDoc} */
  70.     @Override
  71.     public <T extends CalculusFieldElement<T>> T[] mappingFactors(final FieldTrackingCoordinates<T> trackingCoordinates,
  72.                                                                   final FieldGeodeticPoint<T> point,
  73.                                                                   final FieldPressureTemperatureHumidity<T> weather,
  74.                                                                   final FieldAbsoluteDate<T> date) {
  75.         final T sinE = FastMath.sin(trackingCoordinates.getElevation());
  76.         final T tanE = FastMath.tan(trackingCoordinates.getElevation());
  77.         final T[] mapping = MathArrays.buildArray(date.getField(), 2);
  78.         mapping[0] = sinE.add(tanE.add(bd).reciprocal().multiply(ad)).reciprocal();
  79.         mapping[1] = sinE.add(tanE.add(bw).reciprocal().multiply(aw)).reciprocal();
  80.         return mapping;
  81.     }

  82. }