AbstractChaoMappingFunction.java

  1. /* Copyright 2022-2025 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.time.AbsoluteDate;
  24. import org.orekit.time.FieldAbsoluteDate;
  25. import org.orekit.utils.FieldTrackingCoordinates;
  26. import org.orekit.utils.TrackingCoordinates;

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

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

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

  39.     /** First coefficient for wet component. */
  40.     private final double aw;

  41.     /** Second coefficient for wet component. */
  42.     private final double bw;

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

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

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

  78. }