FieldBeidouAlmanac.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.  * Class for BeiDou almanac.
  23.  *
  24.  * @see "BeiDou Navigation Satellite System, Signal In Space, Interface Control Document,
  25.  *      Version 2.1, Table 5-12"
  26.  *
  27.  * @param <T> type of the field elements
  28.  * @author Luc Maisonobe
  29.  * @since 13.0
  30.  *
  31.  */
  32. public class FieldBeidouAlmanac<T extends CalculusFieldElement<T>>
  33.     extends FieldAbstractAlmanac<T, BeidouAlmanac> {

  34.     /** Health status. */
  35.     private int health;

  36.     /** Constructor from non-field instance.
  37.      * @param field    field to which elements belong
  38.      * @param original regular non-field instance
  39.      */
  40.     public FieldBeidouAlmanac(final Field<T> field, final BeidouAlmanac original) {
  41.         super(field, original);
  42.         setHealth(original.getHealth());
  43.     }

  44.     /** Constructor from different field instance.
  45.      * @param <V> type of the old field elements
  46.      * @param original regular non-field instance
  47.      * @param converter for field elements
  48.      */
  49.     public <V extends CalculusFieldElement<V>> FieldBeidouAlmanac(final Function<V, T> converter,
  50.                                                                   final FieldBeidouAlmanac<V> original) {
  51.         super(converter, original);
  52.         setHealth(original.getHealth());
  53.     }

  54.     /** {@inheritDoc} */
  55.     @Override
  56.     public BeidouAlmanac toNonField() {
  57.         return new BeidouAlmanac(this);
  58.     }

  59.     /** {@inheritDoc} */
  60.     @SuppressWarnings("unchecked")
  61.     @Override
  62.     public <U extends CalculusFieldElement<U>, G extends FieldGnssOrbitalElements<U, BeidouAlmanac>>
  63.         G changeField(final Function<T, U> converter) {
  64.         return (G) new FieldBeidouAlmanac<>(converter, this);
  65.     }

  66.     /**
  67.      * Sets the Square Root of Semi-Major Axis (m^1/2).
  68.      * <p>
  69.      * In addition, this method set the value of the Semi-Major Axis.
  70.      * </p>
  71.      * @param sqrtA the Square Root of Semi-Major Axis (m^1/2)
  72.      */
  73.     public void setSqrtA(final T sqrtA) {
  74.         setSma(sqrtA.square());
  75.     }

  76.     /**
  77.      * Sets the Inclination Angle at Reference Time (rad).
  78.      *
  79.      * @param inc the orbit reference inclination
  80.      * @param dinc the correction of orbit reference inclination at reference time
  81.      */
  82.     public void setI0(final T inc, final T dinc) {
  83.         setI0(inc.add(dinc));
  84.     }

  85.     /**
  86.      * Gets the Health status.
  87.      *
  88.      * @return the Health status
  89.      */
  90.     public int getHealth() {
  91.         return health;
  92.     }

  93.     /**
  94.      * Sets the health status.
  95.      *
  96.      * @param health the health status to set
  97.      */
  98.     public void setHealth(final int health) {
  99.         this.health = health;
  100.     }

  101. }