GPSAlmanac.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.Field;
  20. import org.orekit.gnss.SatelliteSystem;
  21. import org.orekit.time.TimeScales;

  22. /**
  23.  * This class holds a GPS almanac as read from SEM or YUMA files.
  24.  *
  25.  * <p>Depending on the source (SEM or YUMA), some fields may be filled in or not.
  26.  * An almanac read from a YUMA file doesn't hold SVN number, average URA and satellite
  27.  * configuration.</p>
  28.  *
  29.  * @author Pascal Parraud
  30.  * @since 8.0
  31.  *
  32.  */
  33. public class GPSAlmanac extends AbstractAlmanac<GPSAlmanac> {

  34.     /** Source of the almanac. */
  35.     private String src;

  36.     /** SVN number. */
  37.     private int svn;

  38.     /** Health status. */
  39.     private int health;

  40.     /** Average URA. */
  41.     private int ura;

  42.     /** Satellite configuration. */
  43.     private int config;

  44.     /**
  45.      * Constructor.
  46.      * @param timeScales known time scales
  47.      * @param system     satellite system to consider for interpreting week number
  48.      *                   (may be different from real system, for example in Rinex nav, weeks
  49.      *                   are always according to GPS)
  50.      */
  51.     public GPSAlmanac(final TimeScales timeScales, final SatelliteSystem system) {
  52.         super(GNSSConstants.GPS_MU, GNSSConstants.GPS_AV, GNSSConstants.GPS_WEEK_NB, timeScales, system);
  53.     }

  54.     /** Constructor from field instance.
  55.      * @param <T> type of the field elements
  56.      * @param original regular field instance
  57.      */
  58.     public <T extends CalculusFieldElement<T>> GPSAlmanac(final FieldGPSAlmanac<T> original) {
  59.         super(original);
  60.         setSource(original.getSource());
  61.         setSVN(original.getSVN());
  62.         setHealth(original.getHealth());
  63.         setURA(original.getURA());
  64.         setSatConfiguration(original.getSatConfiguration());
  65.     }

  66.     /** {@inheritDoc} */
  67.     @SuppressWarnings("unchecked")
  68.     @Override
  69.     public <T extends CalculusFieldElement<T>, F extends FieldGnssOrbitalElements<T, GPSAlmanac>>
  70.         F toField(final Field<T> field) {
  71.         return (F) new FieldGPSAlmanac<>(field, this);
  72.     }

  73.     /**
  74.      * Setter for the Square Root of Semi-Major Axis (m^1/2).
  75.      * <p>
  76.      * In addition, this method set the value of the Semi-Major Axis.
  77.      * </p>
  78.      * @param sqrtA the Square Root of Semi-Major Axis (m^1/2)
  79.      */
  80.     public void setSqrtA(final double sqrtA) {
  81.         setSma(sqrtA * sqrtA);
  82.     }

  83.     /**
  84.      * Gets the source of this GPS almanac.
  85.      * <p>Sources can be SEM or YUMA, when the almanac is read from a file.</p>
  86.      *
  87.      * @return the source of this GPS almanac
  88.      */
  89.     public String getSource() {
  90.         return src;
  91.     }

  92.     /**
  93.      * Sets the source of this GPS almanac.
  94.      *
  95.      * @param source the source of this GPS almanac
  96.      */
  97.     public void setSource(final String source) {
  98.         this.src = source;
  99.     }

  100.     /**
  101.      * Gets the satellite "SVN" reference number.
  102.      *
  103.      * @return the satellite "SVN" reference number
  104.      */
  105.     public int getSVN() {
  106.         return svn;
  107.     }

  108.     /**
  109.      * Sets the "SVN" reference number.
  110.      *
  111.      * @param svnNumber the number to set
  112.      */
  113.     public void setSVN(final int svnNumber) {
  114.         this.svn = svnNumber;
  115.     }

  116.     /**
  117.      * Gets the Health status.
  118.      *
  119.      * @return the Health status
  120.      */
  121.     public int getHealth() {
  122.         return health;
  123.     }

  124.     /**
  125.      * Sets the health status.
  126.      *
  127.      * @param health the health status to set
  128.      */
  129.     public void setHealth(final int health) {
  130.         this.health = health;
  131.     }

  132.     /**
  133.      * Gets the average URA number.
  134.      *
  135.      * @return the average URA number
  136.      */
  137.     public int getURA() {
  138.         return ura;
  139.     }

  140.     /**
  141.      * Sets the average URA number.
  142.      *
  143.      * @param uraNumber the URA number to set
  144.      */
  145.     public void setURA(final int uraNumber) {
  146.         this.ura = uraNumber;
  147.     }

  148.     /**
  149.      * Gets the satellite configuration.
  150.      *
  151.      * @return the satellite configuration
  152.      */
  153.     public int getSatConfiguration() {
  154.         return config;
  155.     }

  156.     /**
  157.      * Sets the satellite configuration.
  158.      *
  159.      * @param satConfiguration the satellite configuration to set
  160.      */
  161.     public void setSatConfiguration(final int satConfiguration) {
  162.         this.config = satConfiguration;
  163.     }

  164. }