EstimatedIonosphericModel.java

  1. /* Copyright 2002-2020 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.RealFieldElement;
  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.     /** Serializable UID. */
  51.     private static final long serialVersionUID = 20200304L;

  52.     /** Ionospheric delay factor. */
  53.     private static final double FACTOR = 40.3e16;

  54.     /** Ionospheric mapping Function model. */
  55.     private final transient IonosphericMappingFunction model;

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


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

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

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

  80.         return 0.0;
  81.     }

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

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

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

  115.         return elevation.getField().getZero();
  116.     }

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

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

  144. }