FieldGalileoAlmanac.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 org.hipparchus.util.FastMath;

  21. import java.util.function.Function;

  22. /**
  23.  * Class for Galileo almanac.
  24.  *
  25.  * @see "European GNSS (Galileo) Open Service, Signal In Space,
  26.  *      Interface Control Document, Table 75"
  27.  *
  28.  * @param <T> type of the field elements
  29.  * @author Luc Maisonobe
  30.  * @since 13.0
  31.  *
  32.  */
  33. public class FieldGalileoAlmanac<T extends CalculusFieldElement<T>>
  34.     extends FieldAbstractAlmanac<T, GalileoAlmanac> {

  35.     /** Nominal inclination (Ref: Galileo ICD - Table 75). */
  36.     private static final double I0 = FastMath.toRadians(56.0);

  37.     /** Nominal semi-major axis in meters (Ref: Galileo ICD - Table 75). */
  38.     private static final double A0 = 29600000;

  39.     /** Satellite E5a signal health status. */
  40.     private int healthE5a;

  41.     /** Satellite E5b signal health status. */
  42.     private int healthE5b;

  43.     /** Satellite E1-B/C signal health status. */
  44.     private int healthE1;

  45.     /** Almanac Issue Of Data. */
  46.     private int iod;

  47.     /** Constructor from non-field instance.
  48.      * @param field    field to which elements belong
  49.      * @param original regular non-field instance
  50.      */
  51.     public FieldGalileoAlmanac(final Field<T> field, final GalileoAlmanac original) {
  52.         super(field, original);
  53.         setHealthE5a(original.getHealthE5a());
  54.         setHealthE5b(original.getHealthE5b());
  55.         setHealthE1(original.getHealthE1());
  56.         setIOD(original.getIOD());
  57.     }

  58.     /** Constructor from different field instance.
  59.      * @param <V> type of the old field elements
  60.      * @param original regular non-field instance
  61.      * @param converter for field elements
  62.      */
  63.     public <V extends CalculusFieldElement<V>> FieldGalileoAlmanac(final Function<V, T> converter,
  64.                                                                    final FieldGalileoAlmanac<V> original) {
  65.         super(converter, original);
  66.         setHealthE5a(original.getHealthE5a());
  67.         setHealthE5b(original.getHealthE5b());
  68.         setHealthE1(original.getHealthE1());
  69.         setIOD(original.getIOD());
  70.     }

  71.     /** {@inheritDoc} */
  72.     @Override
  73.     public GalileoAlmanac toNonField() {
  74.         return new GalileoAlmanac(this);
  75.     }

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

  83.     /**
  84.      * Sets the difference between the square root of the semi-major axis
  85.      * and the square root of the nominal semi-major axis.
  86.      * <p>
  87.      * In addition, this method set the value of the Semi-Major Axis.
  88.      * </p>
  89.      * @param dsqa the value to set
  90.      */
  91.     public void setDeltaSqrtA(final T dsqa) {
  92.         final T sqrtA = dsqa.add(FastMath.sqrt(A0));
  93.         setSma(sqrtA.square());
  94.     }

  95.     /**
  96.      * Sets the the correction of orbit reference inclination at reference time.
  97.      * <p>
  98.      * In addition, this method set the value of the reference inclination.
  99.      * </p>
  100.      * @param dinc correction of orbit reference inclination at reference time in radians
  101.      */
  102.     public void setDeltaInc(final T dinc) {
  103.         setI0(dinc.add(I0));
  104.     }

  105.     /**
  106.      * Gets the Issue of Data (IOD).
  107.      *
  108.      * @return the Issue Of Data
  109.      */
  110.     public int getIOD() {
  111.         return iod;
  112.     }

  113.     /**
  114.      * Sets the Issue of Data (IOD).
  115.      *
  116.      * @param iodValue the value to set
  117.      */
  118.     public void setIOD(final int iodValue) {
  119.         this.iod = iodValue;
  120.     }

  121.     /**
  122.      * Gets the E1-B/C signal health status.
  123.      *
  124.      * @return the E1-B/C signal health status
  125.      */
  126.     public int getHealthE1() {
  127.         return healthE1;
  128.     }

  129.     /**
  130.      * Sets the E1-B/C signal health status.
  131.      *
  132.      * @param healthE1 health status to set
  133.      */
  134.     public void setHealthE1(final int healthE1) {
  135.         this.healthE1 = healthE1;
  136.     }

  137.     /**
  138.      * Gets the E5a signal health status.
  139.      *
  140.      * @return the E5a signal health status
  141.      */
  142.     public int getHealthE5a() {
  143.         return healthE5a;
  144.     }

  145.     /**
  146.      * Sets the E5a signal health status.
  147.      *
  148.      * @param healthE5a health status to set
  149.      */
  150.     public void setHealthE5a(final int healthE5a) {
  151.         this.healthE5a = healthE5a;
  152.     }

  153.     /**
  154.      * Gets the E5b signal health status.
  155.      *
  156.      * @return the E5b signal health status
  157.      */
  158.     public int getHealthE5b() {
  159.         return healthE5b;
  160.     }

  161.     /**
  162.      * Sets the E5b signal health status.
  163.      *
  164.      * @param healthE5b health status to set
  165.      */
  166.     public void setHealthE5b(final int healthE5b) {
  167.         this.healthE5b = healthE5b;
  168.     }

  169. }