CommonGnssData.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.propagation.analytical.gnss.data;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.orekit.gnss.SatelliteSystem;
  20. import org.orekit.time.TimeScales;
  21. import org.orekit.utils.ParameterDriver;

  22. /** Container for common GNSS data contained in almanac and navigation messages.
  23.  * @param <O> type of the orbital elements
  24.  * @author Bryan Cazabonne
  25.  * @since 11.0
  26.  */
  27. public abstract class CommonGnssData<O extends CommonGnssData<O>>
  28.     extends GNSSOrbitalElements<O>
  29.     implements GNSSClockElements {

  30.     /** Name for zero-th order clock correction parameter.
  31.      * @since 13.0
  32.      */
  33.     public static final String AF0 = "GnssClock0";

  34.     /** Name for first order clock correction parameter.
  35.      * @since 13.0
  36.      */
  37.     public static final String AF1 = "GnssClock1";

  38.     /** Name for second order clock correction parameter.
  39.      * @since 13.0
  40.      */
  41.     public static final String AF2 = "GnssClock2";

  42.     /** SV zero-th order clock correction (s). */
  43.     private final ParameterDriver af0Driver;

  44.     /** SV first order clock correction (s/s). */
  45.     private final ParameterDriver af1Driver;

  46.     /** SV second order clock correction (s/s²). */
  47.     private final ParameterDriver af2Driver;

  48.     /** Group delay differential TGD for L1-L2 correction. */
  49.     private double tgd;

  50.     /** Time Of Clock. */
  51.     private double toc;

  52.     /**
  53.      * Constructor.
  54.      * @param mu Earth's universal gravitational parameter
  55.      * @param angularVelocity mean angular velocity of the Earth for the GNSS model
  56.      * @param weeksInCycle number of weeks in the GNSS cycle
  57.      * @param timeScales      known time scales
  58.      * @param system          satellite system to consider for interpreting week number
  59.      *                        (may be different from real system, for example in Rinex nav, weeks
  60.      *                        are always according to GPS)
  61.      */
  62.     protected CommonGnssData(final double mu, final double angularVelocity, final int weeksInCycle,
  63.                              final TimeScales timeScales, final SatelliteSystem system) {
  64.         super(mu, angularVelocity, weeksInCycle, timeScales, system);
  65.         this.af0Driver = createDriver(AF0);
  66.         this.af1Driver = createDriver(AF1);
  67.         this.af2Driver = createDriver(AF2);
  68.     }

  69.     /** Constructor from field instance.
  70.      * @param <T> type of the field elements
  71.      * @param <A> type of the orbital elements (non-field version)
  72.      * @param original regular field instance
  73.      */
  74.     protected <T extends CalculusFieldElement<T>,
  75.                A extends CommonGnssData<A>> CommonGnssData(final FieldCommonGnssData<T, A> original) {
  76.         super(original);
  77.         this.af0Driver = createDriver(AF0);
  78.         this.af1Driver = createDriver(AF1);
  79.         this.af2Driver = createDriver(AF2);
  80.         setAf0(original.getAf0().getReal());
  81.         setAf1(original.getAf1().getReal());
  82.         setAf2(original.getAf2().getReal());
  83.         setTGD(original.getTGD().getReal());
  84.         setToc(original.getToc().getReal());
  85.     }

  86.     /** {@inheritDoc} */
  87.     @Override
  88.     public double getAf0() {
  89.         return af0Driver.getValue();
  90.     }

  91.     /**
  92.      * Setter for the SV Clock Bias Correction Coefficient (s).
  93.      * @param af0 the SV Clock Bias Correction Coefficient to set
  94.      */
  95.     public void setAf0(final double af0) {
  96.         af0Driver.setValue(af0);
  97.     }

  98.     /** {@inheritDoc} */
  99.     @Override
  100.     public double getAf1() {
  101.         return af1Driver.getValue();
  102.     }

  103.     /**
  104.      * Setter for the SV Clock Drift Correction Coefficient (s/s).
  105.      * @param af1 the SV Clock Drift Correction Coefficient to set
  106.      */
  107.     public void setAf1(final double af1) {
  108.         af1Driver.setValue(af1);
  109.     }

  110.     /** {@inheritDoc} */
  111.     @Override
  112.     public double getAf2() {
  113.         return af2Driver.getValue();
  114.     }

  115.     /**
  116.      * Setter for the Drift Rate Correction Coefficient (s/s²).
  117.      * @param af2 the Drift Rate Correction Coefficient to set
  118.      */
  119.     public void setAf2(final double af2) {
  120.         af2Driver.setValue(af2);
  121.     }

  122.     /**
  123.      * Set the estimated group delay differential TGD for L1-L2 correction.
  124.      * @param groupDelayDifferential the estimated group delay differential TGD for L1-L2 correction (s)
  125.      */
  126.     public void setTGD(final double groupDelayDifferential) {
  127.         this.tgd = groupDelayDifferential;
  128.     }

  129.     /** {@inheritDoc} */
  130.     @Override
  131.     public double getTGD() {
  132.         return tgd;
  133.     }

  134.     /**
  135.      * Set the time of clock.
  136.      * @param toc the time of clock (s)
  137.      * @see #getAf0()
  138.      * @see #getAf1()
  139.      * @see #getAf2()
  140.      */
  141.     public void setToc(final double toc) {
  142.         this.toc = toc;
  143.     }

  144.     /** {@inheritDoc} */
  145.     @Override
  146.     public double getToc() {
  147.         return toc;
  148.     }

  149. }