IonosphereFreeCombination.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.estimation.measurements.gnss;

  18. import org.hipparchus.util.ArithmeticUtils;
  19. import org.hipparchus.util.MathArrays;
  20. import org.orekit.gnss.GnssSignal;
  21. import org.orekit.gnss.MeasurementType;
  22. import org.orekit.gnss.SatelliteSystem;

  23. /**
  24.  * Ionosphere-free combination.
  25.  * <p>
  26.  * This combination removes the first order (up to 99.9%)
  27.  * ionospheric effect.
  28.  * </p>
  29.  * <pre>
  30.  *             f1² * m1 - f2² * m2
  31.  *    mIF =  -----------------------
  32.  *                  f1² - f2²
  33.  * </pre>
  34.  * With:
  35.  * <ul>
  36.  * <li>mIF: Ionosphere-free measurement.</li>
  37.  * <li>f1 : Frequency of the first measurement.</li>
  38.  * <li>m1 : First measurement.</li>
  39.  * <li>f2 : Frequency of the second measurement.</li>
  40.  * <li>m1 : Second measurement.</li>
  41.  * </ul>
  42.  * <p>
  43.  * Ionosphere-free combination is a dual frequency combination.
  44.  * The two measurements shall have different frequencies but they must have the same {@link MeasurementType}.
  45.  * </p>
  46.  * @author Bryan Cazabonne
  47.  * @since 10.1
  48.  */
  49. public class IonosphereFreeCombination extends AbstractDualFrequencyCombination {

  50.     /**
  51.      * Package private constructor for the factory.
  52.      * @param system satellite system for which the combination is applied
  53.      */
  54.     IonosphereFreeCombination(final SatelliteSystem system) {
  55.         super(CombinationType.IONO_FREE, system);
  56.     }

  57.     /** {@inheritDoc} */
  58.     @Override
  59.     protected double getCombinedValue(final double obs1, final GnssSignal s1,
  60.                                       final double obs2, final GnssSignal s2) {
  61.         // Get the ration f/f0
  62.         final double ratioF1   = s1.getRatio();
  63.         final double ratioF2   = s2.getRatio();
  64.         final double ratioF1Sq = ratioF1 * ratioF1;
  65.         final double ratioF2Sq = ratioF2 * ratioF2;
  66.         // Perform combination
  67.         return MathArrays.linearCombination(ratioF1Sq, obs1, -ratioF2Sq, obs2) / (ratioF1Sq - ratioF2Sq);
  68.     }

  69.     /** {@inheritDoc} */
  70.     @Override
  71.     protected double getCombinedFrequency(final GnssSignal s1, final GnssSignal s2) {
  72.         // Get the ratios f/f0
  73.         final double ratioF1   = s1.getRatio();
  74.         final double ratioF2   = s2.getRatio();
  75.         // Get the integer part of the ratios
  76.         final int ratioF1Int = (int) ratioF1;
  77.         final int ratioF2Int = (int) ratioF2;
  78.         // Multiplication factor used to compute the combined frequency
  79.         final int k = (ratioF1 - ratioF1Int > 0.0 || ratioF2 - ratioF2Int > 0.0) ? 1 : ArithmeticUtils.gcd(ratioF1Int, ratioF2Int);
  80.         // Combined frequency
  81.         return MathArrays.linearCombination(ratioF1, ratioF1, -ratioF2, ratioF2) * (GnssSignal.F0 / k);
  82.     }

  83. }