EstimatedIonosphericModel.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.ionosphere;

  18. import java.util.Collections;
  19. import java.util.List;

  20. import org.hipparchus.CalculusFieldElement;
  21. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  22. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  23. import org.hipparchus.util.FastMath;
  24. import org.orekit.frames.TopocentricFrame;
  25. import org.orekit.propagation.FieldSpacecraftState;
  26. import org.orekit.propagation.SpacecraftState;
  27. import org.orekit.utils.ParameterDriver;

  28. /**
  29.  * An estimated ionospheric model. The ionospheric delay is computed according to the formula:
  30.  * <p>
  31.  *           40.3
  32.  *    δ =  --------  *  STEC      with, STEC = VTEC * F(elevation)
  33.  *            f²
  34.  * </p>
  35.  * With:
  36.  * <ul>
  37.  * <li>f: The frequency of the signal in Hz.</li>
  38.  * <li>STEC: The Slant Total Electron Content in TECUnits.</li>
  39.  * <li>VTEC: The Vertical Total Electron Content in TECUnits.</li>
  40.  * <li>F(elevation): A mapping function which depends on satellite elevation.</li>
  41.  * </ul>
  42.  * The VTEC is estimated as a {@link ParameterDriver}
  43.  *
  44.  * @author Bryan Cazabonne
  45.  * @since 10.2
  46.  */
  47. public class EstimatedIonosphericModel implements IonosphericModel {

  48.     /** Name of the parameter of this model: the Vertical Total Electron Content. */
  49.     public static final String VERTICAL_TOTAL_ELECTRON_CONTENT = "vertical total electron content";

  50.     /** Ionospheric delay factor. */
  51.     private static final double FACTOR = 40.3e16;

  52.     /** Ionospheric mapping Function model. */
  53.     private final transient IonosphericMappingFunction model;

  54.     /** Driver for the Vertical Total Electron Content.*/
  55.     private final transient ParameterDriver vtec;


  56.     /**
  57.      * Build a new instance.
  58.      * @param model ionospheric mapping function
  59.      * @param vtecValue value of the Vertical Total Electron Content in TECUnits
  60.      */
  61.     public EstimatedIonosphericModel(final IonosphericMappingFunction model, final double vtecValue) {
  62.         this.model = model;
  63.         this.vtec  = new ParameterDriver(EstimatedIonosphericModel.VERTICAL_TOTAL_ELECTRON_CONTENT,
  64.                                          vtecValue, FastMath.scalb(1.0, 3), 0.0, 1000.0);
  65.     }

  66.     /** {@inheritDoc} */
  67.     @Override
  68.     public double pathDelay(final SpacecraftState state, final TopocentricFrame baseFrame,
  69.                             final double frequency, final double[] parameters) {
  70.         // Elevation in radians
  71.         final Vector3D position  = state.getPosition(baseFrame);
  72.         final double   elevation = position.getDelta();

  73.         // Only consider measures above the horizon
  74.         if (elevation > 0.0) {
  75.             // Delay
  76.             return pathDelay(elevation, frequency, parameters);
  77.         }

  78.         return 0.0;
  79.     }

  80.     /**
  81.      * Calculates the ionospheric path delay for the signal path from a ground
  82.      * station to a satellite.
  83.      * <p>
  84.      * The path delay is computed for any elevation angle.
  85.      * </p>
  86.      * @param elevation elevation of the satellite in radians
  87.      * @param frequency frequency of the signal in Hz
  88.      * @param parameters ionospheric model parameters
  89.      * @return the path delay due to the ionosphere in m
  90.      */
  91.     public double pathDelay(final double elevation, final double frequency, final double[] parameters) {
  92.         // Square of the frequency
  93.         final double freq2 = frequency * frequency;
  94.         // Mapping factor
  95.         final double fz = model.mappingFactor(elevation);
  96.         // "Slant" Total Electron Content
  97.         final double stec = parameters[0] * fz;
  98.         // Delay computation
  99.         final double alpha  = FACTOR / freq2;
  100.         return alpha * stec;
  101.     }

  102.     /** {@inheritDoc} */
  103.     @Override
  104.     public <T extends CalculusFieldElement<T>> T pathDelay(final FieldSpacecraftState<T> state, final TopocentricFrame baseFrame,
  105.                                                        final double frequency, final T[] parameters) {
  106.         // Elevation and azimuth in radians
  107.         final FieldVector3D<T> position = state.getPosition(baseFrame);
  108.         final T elevation = position.getDelta();

  109.         if (elevation.getReal() > 0.0) {
  110.             // Delay
  111.             return pathDelay(elevation, frequency, parameters);
  112.         }

  113.         return elevation.getField().getZero();
  114.     }

  115.     /**
  116.      * Calculates the ionospheric path delay for the signal path from a ground
  117.      * station to a satellite.
  118.      * <p>
  119.      * The path delay is computed for any elevation angle.
  120.      * </p>
  121.      * @param <T> type of the elements
  122.      * @param elevation elevation of the satellite in radians
  123.      * @param frequency frequency of the signal in Hz
  124.      * @param parameters ionospheric model parameters at state date
  125.      * @return the path delay due to the ionosphere in m
  126.      */
  127.     public <T extends CalculusFieldElement<T>> T pathDelay(final T elevation, final double frequency, final T[] parameters) {
  128.         // Square of the frequency
  129.         final double freq2 = frequency * frequency;
  130.         // Mapping factor
  131.         final T fz = model.mappingFactor(elevation);
  132.         // "Slant" Total Electron Content
  133.         final T stec = parameters[0].multiply(fz);
  134.         // Delay computation
  135.         final double alpha  = FACTOR / freq2;
  136.         return stec.multiply(alpha);
  137.     }

  138.     @Override
  139.     public List<ParameterDriver> getParametersDrivers() {
  140.         return Collections.singletonList(vtec);
  141.     }

  142. }