AbstractNavigationMessage.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.hipparchus.util.FastMath;
  20. import org.orekit.gnss.SatelliteSystem;
  21. import org.orekit.time.AbsoluteDate;
  22. import org.orekit.time.TimeScales;

  23. /**
  24.  * Base class for GNSS navigation messages.
  25.  * @param <O> type of the orbital elements
  26.  * @author Bryan Cazabonne
  27.  * @since 11.0
  28.  *
  29.  * @see GPSLegacyNavigationMessage
  30.  * @see GalileoNavigationMessage
  31.  * @see BeidouLegacyNavigationMessage
  32.  * @see QZSSLegacyNavigationMessage
  33.  * @see NavICLegacyNavigationMessage
  34.  */
  35. public abstract class AbstractNavigationMessage<O extends AbstractNavigationMessage<O>> extends AbstractAlmanac<O> {

  36.     /** Mean Motion Difference from Computed Value. */
  37.     private double deltaN0;

  38.     /** Time of clock epoch. */
  39.     private AbsoluteDate epochToc;

  40.     /** Transmission time.
  41.      * @since 12.0
  42.      */
  43.     private double transmissionTime;

  44.     /**
  45.      * Constructor.
  46.      * @param mu Earth's universal gravitational parameter
  47.      * @param angularVelocity mean angular velocity of the Earth for the GNSS model
  48.      * @param weeksInCycle number of weeks in the GNSS cycle
  49.      * @param timeScales      known time scales
  50.      * @param system          satellite system to consider for interpreting week number
  51.      *                        (may be different from real system, for example in Rinex nav, weeks
  52.      *                        are always according to GPS)
  53.      */
  54.     protected AbstractNavigationMessage(final double mu, final double angularVelocity, final int weeksInCycle,
  55.                                         final TimeScales timeScales, final SatelliteSystem system) {
  56.         super(mu, angularVelocity, weeksInCycle, timeScales, system);
  57.     }

  58.     /** Constructor from field instance.
  59.      * @param <T> type of the field elements
  60.      * @param <A> type of the orbital elements (non-field version)
  61.      * @param original regular field instance
  62.      */
  63.     protected <T extends CalculusFieldElement<T>,
  64.                A extends AbstractNavigationMessage<A>> AbstractNavigationMessage(final FieldAbstractNavigationMessage<T, A> original) {
  65.         super(original);
  66.         setDeltaN0(original.getDeltaN0().getReal());
  67.         setEpochToc(original.getEpochToc().toAbsoluteDate());
  68.         setTransmissionTime(original.getTransmissionTime().getReal());
  69.     }

  70.     /**
  71.      * Getter for Square Root of Semi-Major Axis (√m).
  72.      * @return Square Root of Semi-Major Axis (√m)
  73.      */
  74.     public double getSqrtA() {
  75.         return FastMath.sqrt(getSma());
  76.     }

  77.     /**
  78.      * Setter for the Square Root of Semi-Major Axis (√m).
  79.      * <p>
  80.      * In addition, this method set the value of the Semi-Major Axis.
  81.      * </p>
  82.      * @param sqrtA the Square Root of Semi-Major Axis (√m)
  83.      */
  84.     public void setSqrtA(final double sqrtA) {
  85.         getSmaDriver().setValue(sqrtA * sqrtA);
  86.     }

  87.     /** {@inheritDoc} */
  88.     @Override
  89.     public double getDeltaN0() {
  90.         return deltaN0;
  91.     }

  92.     /**
  93.      * Setter for the delta of satellite mean motion.
  94.      * @param deltaN0 the value to set
  95.      */
  96.     public void setDeltaN0(final double deltaN0) {
  97.         this.deltaN0 = deltaN0;
  98.     }

  99.     /**
  100.      * Getter for the time of clock epoch.
  101.      * @return the time of clock epoch
  102.      */
  103.     public AbsoluteDate getEpochToc() {
  104.         return epochToc;
  105.     }

  106.     /**
  107.      * Setter for the time of clock epoch.
  108.      * @param epochToc the epoch to set
  109.      */
  110.     public void setEpochToc(final AbsoluteDate epochToc) {
  111.         this.epochToc = epochToc;
  112.     }

  113.     /**
  114.      * Getter for transmission time.
  115.      * @return transmission time
  116.      * @since 12.0
  117.      */
  118.     public double getTransmissionTime() {
  119.         return transmissionTime;
  120.     }

  121.     /**
  122.      * Setter for transmission time.
  123.      * @param transmissionTime transmission time
  124.      * @since 12.0
  125.      */
  126.     public void setTransmissionTime(final double transmissionTime) {
  127.         this.transmissionTime = transmissionTime;
  128.     }

  129. }