FieldGalileoNavigationMessage.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 Galileo navigation message.
  23.  * @param <T> type of the field elements
  24.  * @author Luc Maisonobe
  25.  * @since 13.0
  26.  */
  27. public class FieldGalileoNavigationMessage<T extends CalculusFieldElement<T>>
  28.     extends FieldAbstractNavigationMessage<T, GalileoNavigationMessage> {

  29.     /** Issue of Data of the navigation batch. */
  30.     private int iodNav;

  31.     /** Data source. */
  32.     private int dataSource;

  33.     /** E1/E5a broadcast group delay (s). */
  34.     private T bgbE1E5a;

  35.     /** E5b/E1 broadcast group delay (s). */
  36.     private T bgdE5bE1;

  37.     /** Signal in space accuracy. */
  38.     private T sisa;

  39.     /** Satellite health status. */
  40.     private T svHealth;

  41.     /** Constructor from non-field instance.
  42.      * @param field    field to which elements belong
  43.      * @param original regular non-field instance
  44.      */
  45.     public FieldGalileoNavigationMessage(final Field<T> field, final GalileoNavigationMessage original) {
  46.         super(field, original);
  47.         setIODNav(original.getIODNav());
  48.         setDataSource(original.getDataSource());
  49.         setBGDE1E5a(field.getZero().newInstance(original.getBGDE1E5a()));
  50.         setBGDE5bE1(field.getZero().newInstance(original.getBGDE5bE1()));
  51.         setSisa(field.getZero().newInstance(original.getSisa()));
  52.         setSvHealth(field.getZero().newInstance(original.getSvHealth()));
  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.     public <V extends CalculusFieldElement<V>> FieldGalileoNavigationMessage(final Function<V, T> converter,
  60.                                                                              final FieldGalileoNavigationMessage<V> original) {
  61.         super(converter, original);
  62.         setIODNav(original.getIODNav());
  63.         setDataSource(original.getDataSource());
  64.         setBGDE1E5a(converter.apply(original.getBGDE1E5a()));
  65.         setBGDE5bE1(converter.apply(original.getBGDE5bE1()));
  66.         setSisa(converter.apply(original.getSisa()));
  67.         setSvHealth(converter.apply(original.getSvHealth()));
  68.     }

  69.     /** {@inheritDoc} */
  70.     @Override
  71.     public GalileoNavigationMessage toNonField() {
  72.         return new GalileoNavigationMessage(this);
  73.     }

  74.     /** {@inheritDoc} */
  75.     @SuppressWarnings("unchecked")
  76.     @Override
  77.     public <U extends CalculusFieldElement<U>, G extends FieldGnssOrbitalElements<U, GalileoNavigationMessage>>
  78.         G changeField(final Function<T, U> converter) {
  79.         return (G) new FieldGalileoNavigationMessage<>(converter, this);
  80.     }

  81.     /**
  82.      * Getter for the the Issue Of Data (IOD).
  83.      * @return the Issue Of Data (IOD)
  84.      */
  85.     public int getIODNav() {
  86.         return iodNav;
  87.     }

  88.     /**
  89.      * Setter for the Issue of Data of the navigation batch.
  90.      * @param iod the IOD to set
  91.      */
  92.     public void setIODNav(final int iod) {
  93.         this.iodNav = iod;
  94.     }

  95.     /**
  96.      * Getter for the the data source.
  97.      * @return the data source
  98.      */
  99.     public int getDataSource() {
  100.         return dataSource;
  101.     }

  102.     /**
  103.      * Setter for the data source.
  104.      * @param dataSource data source
  105.      */
  106.     public void setDataSource(final int dataSource) {
  107.         this.dataSource = dataSource;
  108.     }

  109.     /**
  110.      * Getter for the E1/E5a broadcast group delay.
  111.      * @return the E1/E5a broadcast group delay (s)
  112.      */
  113.     public T getBGDE1E5a() {
  114.         return bgbE1E5a;
  115.     }

  116.     /**
  117.      * Setter for the E1/E5a broadcast group delay (s).
  118.      * @param bgd the E1/E5a broadcast group delay to set
  119.      */
  120.     public void setBGDE1E5a(final T bgd) {
  121.         this.bgbE1E5a = bgd;
  122.     }

  123.     /**
  124.      * Setter for the E5b/E1 broadcast group delay (s).
  125.      * @param bgd the E5b/E1 broadcast group delay to set
  126.      */
  127.     public void setBGDE5bE1(final T bgd) {
  128.         this.bgdE5bE1 = bgd;
  129.     }

  130.     /**
  131.      * Getter for the the Broadcast Group Delay E5b/E1.
  132.      * @return the Broadcast Group Delay E5b/E1 (s)
  133.      */
  134.     public T getBGDE5bE1() {
  135.         return bgdE5bE1;
  136.     }

  137.     /**
  138.      * Getter for the signal in space accuracy (m).
  139.      * @return the signal in space accuracy
  140.      */
  141.     public T getSisa() {
  142.         return sisa;
  143.     }

  144.     /**
  145.      * Setter for the signal in space accuracy.
  146.      * @param sisa the sisa to set
  147.      */
  148.     public void setSisa(final T sisa) {
  149.         this.sisa = sisa;
  150.     }

  151.     /**
  152.      * Getter for the SV health status.
  153.      * @return the SV health status
  154.      */
  155.     public T getSvHealth() {
  156.         return svHealth;
  157.     }

  158.     /**
  159.      * Setter for the SV health status.
  160.      * @param svHealth the SV health status to set
  161.      */
  162.     public void setSvHealth(final T svHealth) {
  163.         this.svHealth = svHealth;
  164.     }

  165. }