FieldLegacyNavigationMessage.java

  1. /* Copyright 2022-2025 Luc Maisonobe
  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.Field;

  20. import java.util.function.Function;

  21. /**
  22.  * Container for data contained in a GPS/QZNSS legacy navigation message.
  23.  * @param <T> type of the field elements
  24.  * @param <O> type of the orbital elements (non-field version)
  25.  * @author Luc Maisonobe
  26.  * @since 13.0
  27.  */
  28. public abstract class FieldLegacyNavigationMessage<T extends CalculusFieldElement<T>,
  29.                                                    O extends LegacyNavigationMessage<O>>
  30.     extends FieldAbstractNavigationMessage<T, O>
  31.     implements FieldGNSSClockElements<T> {

  32.     /** Issue of Data, Ephemeris. */
  33.     private int iode;

  34.     /** Issue of Data, Clock. */
  35.     private int iodc;

  36.     /** The user SV accuracy (m). */
  37.     private T svAccuracy;

  38.     /** Satellite health status. */
  39.     private int svHealth;

  40.     /** Fit interval. */
  41.     private int fitInterval;

  42.     /** Constructor from non-field instance.
  43.      * @param field    field to which elements belong
  44.      * @param original regular non-field instance
  45.      */
  46.     protected FieldLegacyNavigationMessage(final Field<T> field, final O original) {
  47.         super(field, original);
  48.         setIODE(field.getZero().newInstance(original.getIODE()));
  49.         setIODC(original.getIODC());
  50.         setSvAccuracy(field.getZero().newInstance(original.getSvAccuracy()));
  51.         setSvHealth(original.getSvHealth());
  52.         setFitInterval(original.getFitInterval());
  53.     }

  54.     /** Constructor from different field instance.
  55.      * @param <V> type of the old field elements
  56.      * @param original regular non-field instance
  57.      * @param converter for field elements
  58.      */
  59.     protected <V extends CalculusFieldElement<V>> FieldLegacyNavigationMessage(final Function<V, T> converter,
  60.                                                                                final FieldLegacyNavigationMessage<V, O> original) {
  61.         super(converter, original);
  62.         setIODE(getMu().newInstance(original.getIODE()));
  63.         setIODC(original.getIODC());
  64.         setSvAccuracy(converter.apply(original.getSvAccuracy()));
  65.         setSvHealth(original.getSvHealth());
  66.         setFitInterval(original.getFitInterval());
  67.     }

  68.     /**
  69.      * Getter for the Issue Of Data Ephemeris (IODE).
  70.      * @return the Issue Of Data Ephemeris (IODE)
  71.      */
  72.     public int getIODE() {
  73.         return iode;
  74.     }

  75.     /**
  76.      * Setter for the Issue of Data Ephemeris.
  77.      * @param value the IODE to set
  78.      */
  79.     public void setIODE(final T value) {
  80.         // The value is given as a floating number in the navigation message
  81.         this.iode = (int) value.getReal();
  82.     }

  83.     /**
  84.      * Getter for the Issue Of Data Clock (IODC).
  85.      * @return the Issue Of Data Clock (IODC)
  86.      */
  87.     public int getIODC() {
  88.         return iodc;
  89.     }

  90.     /**
  91.      * Setter for the Issue of Data Clock.
  92.      * @param value the IODC to set
  93.      */
  94.     public void setIODC(final int value) {
  95.         this.iodc = value;
  96.     }

  97.     /**
  98.      * Getter for the user SV accuray (meters).
  99.      * @return the user SV accuracy
  100.      */
  101.     public T getSvAccuracy() {
  102.         return svAccuracy;
  103.     }

  104.     /**
  105.      * Setter for the user SV accuracy.
  106.      * @param svAccuracy the value to set
  107.      */
  108.     public void setSvAccuracy(final T svAccuracy) {
  109.         this.svAccuracy = svAccuracy;
  110.     }

  111.     /**
  112.      * Getter for the satellite health status.
  113.      * @return the satellite health status
  114.      */
  115.     public int getSvHealth() {
  116.         return svHealth;
  117.     }

  118.     /**
  119.      * Setter for the satellite health status.
  120.      * @param svHealth the value to set
  121.      */
  122.     public void setSvHealth(final int svHealth) {
  123.         this.svHealth = svHealth;
  124.     }

  125.     /**
  126.      * Getter for the fit interval.
  127.      * @return the fit interval
  128.      */
  129.     public int getFitInterval() {
  130.         return fitInterval;
  131.     }

  132.     /**
  133.      * Setter for the fit interval.
  134.      * @param fitInterval fit interval
  135.      */
  136.     public void setFitInterval(final int fitInterval) {
  137.         this.fitInterval = fitInterval;
  138.     }

  139. }