SingleLayerModelMappingFunction.java

  1. /* Copyright 2002-2024 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.ionosphere;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.util.FastMath;

  20. /**
  21.  * Single Layer Model (SLM) ionospheric mapping function.
  22.  * <p>
  23.  * The SLM mapping function assumes a single ionospheric layer with a constant height
  24.  * for the computation of the mapping factor.
  25.  * </p>
  26.  * @see "N. Ya’acob, M. Abdullah and M. Ismail, Determination of the GPS
  27.  *       total electron content using single layer model (SLM) ionospheric
  28.  *       mapping function, in International Journal of Computer Science and
  29.  *       Network Security, vol. 8, no. 9, pp. 154-160, 2008."
  30.  *
  31.  * @author Bryan Cazabonne
  32.  * @since 10.2
  33.  */
  34. public class SingleLayerModelMappingFunction implements IonosphericMappingFunction {

  35.     /** Default value for the height of the ionospheric single layer in meters. */
  36.     private static final double DEFAULT_HEIGHT = 450e3;

  37.     /** Mean Earth radius in meters. */
  38.     private static final double RE = 6371e3;

  39.     /** Height of the ionospheric single layer in meters.*/
  40.     private final double hIon;

  41.     /**
  42.      * Constructor with default value.
  43.      * <p>
  44.      * Using this constructor, the height of the ionospheric single
  45.      * layer is equal to 450 kilometers as recommended by the IERS
  46.      * Convention 2010.
  47.      * </p>
  48.      */
  49.     public SingleLayerModelMappingFunction() {
  50.         this(DEFAULT_HEIGHT);
  51.     }

  52.     /**
  53.      * Constructor.
  54.      * @param hIon height of the ionospheric single layer in meters
  55.      */
  56.     public SingleLayerModelMappingFunction(final double hIon) {
  57.         this.hIon = hIon;
  58.     }

  59.     /** {@inheritDoc} */
  60.     @Override
  61.     public double mappingFactor(final double elevation) {
  62.         // Calculate the zenith angle from the elevation
  63.         final double z = FastMath.abs(0.5 * FastMath.PI - elevation);
  64.         // Distance ratio
  65.         final double ratio = RE / (RE + hIon);
  66.         // Mapping function
  67.         final double coef = FastMath.sin(z) * ratio;
  68.         return 1.0 / FastMath.sqrt(1.0 - coef * coef);
  69.     }

  70.     /** {@inheritDoc} */
  71.     @Override
  72.     public <T extends CalculusFieldElement<T>> T mappingFactor(final T elevation) {
  73.         // Calculate the zenith angle from the elevation
  74.         final T z = FastMath.abs(elevation.negate().add(elevation.getPi().multiply(0.5)));
  75.         // Distance ratio
  76.         final double ratio = RE / (RE + hIon);
  77.         // Mapping function
  78.         final T coef = FastMath.sin(z).multiply(ratio);
  79.         return FastMath.sqrt(coef.multiply(coef).negate().add(1.0)).reciprocal();
  80.     }

  81. }