GPSAlmanac.java

  1. /* Copyright 2002-2018 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (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.gnss;

  18. import org.hipparchus.util.FastMath;
  19. import org.orekit.propagation.analytical.gnss.GPSOrbitalElements;
  20. import org.orekit.time.AbsoluteDate;


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

  33.     // Fields
  34.     /** Source of the almanac. */
  35.     private final String src;
  36.     /** PRN number. */
  37.     private final int prn;
  38.     /** SVN number. */
  39.     private final int svn;
  40.     /** Health status. */
  41.     private final int health;
  42.     /** Average URA. */
  43.     private final int ura;
  44.     /** Satellite configuration. */
  45.     private final int config;
  46.     /** GPS week. */
  47.     private final int week;
  48.     /** Time of applicability. */
  49.     private final double toa;
  50.     /** Semi-major axis. */
  51.     private final double sma;
  52.     /** Eccentricity. */
  53.     private final double ecc;
  54.     /** Inclination. */
  55.     private final double inc;
  56.     /** Longitude of Orbital Plane. */
  57.     private final double om0;
  58.     /** Rate of Right Ascension. */
  59.     private final double dom;
  60.     /** Argument of perigee. */
  61.     private final double aop;
  62.     /** Mean anomaly. */
  63.     private final double anom;
  64.     /** Zeroth order clock correction. */
  65.     private final double af0;
  66.     /** First order clock correction. */
  67.     private final double af1;

  68.     /**
  69.      * Constructor.
  70.      *
  71.      * @param source the source of the almanac (SEM, YUMA, user defined)
  72.      * @param prn the PRN number
  73.      * @param svn the SVN number
  74.      * @param week the GPS week
  75.      * @param toa the Time of Applicability
  76.      * @param sqa the Square Root of Semi-Major Axis (m^1/2)
  77.      * @param ecc the eccentricity
  78.      * @param inc the inclination (rad)
  79.      * @param om0 the geographic longitude of the orbital plane at the weekly epoch (rad)
  80.      * @param dom the Rate of Right Ascension (rad/s)
  81.      * @param aop the Argument of Perigee (rad)
  82.      * @param anom the Mean Anomaly (rad)
  83.      * @param af0 the Zeroth Order Clock Correction (s)
  84.      * @param af1 the First Order Clock Correction (s/s)
  85.      * @param health the Health status
  86.      * @param ura the average URA
  87.      * @param config the satellite configuration
  88.      */
  89.     public GPSAlmanac(final String source, final int prn, final int svn,
  90.                       final int week, final double toa,
  91.                       final double sqa, final double ecc, final double inc,
  92.                       final double om0, final double dom, final double aop,
  93.                       final double anom, final double af0, final double af1,
  94.                       final int health, final int ura, final int config) {
  95.         this.src = source;
  96.         this.prn = prn;
  97.         this.svn = svn;
  98.         this.week = week;
  99.         this.toa = toa;
  100.         this.sma = sqa * sqa;
  101.         this.ecc = ecc;
  102.         this.inc = inc;
  103.         this.om0 = om0;
  104.         this.dom = dom;
  105.         this.aop = aop;
  106.         this.anom = anom;
  107.         this.af0 = af0;
  108.         this.af1 = af1;
  109.         this.health = health;
  110.         this.ura = ura;
  111.         this.config = config;
  112.     }

  113.     @Override
  114.     public AbsoluteDate getDate() {
  115.         return AbsoluteDate.createGPSDate(week, toa * 1000.);
  116.     }

  117.     /**
  118.      * Gets the source of this GPS almanac.
  119.      * <p>Sources can be SEM or YUMA, when the almanac is read from a file.</p>
  120.      *
  121.      * @return the source of this GPS almanac
  122.      */
  123.     public String getSource() {
  124.         return src;
  125.     }

  126.     @Override
  127.     public int getPRN() {
  128.         return prn;
  129.     }

  130.     /**
  131.      * Gets the satellite "SVN" reference number.
  132.      *
  133.      * @return the satellite "SVN" reference number
  134.      */
  135.     public int getSVN() {
  136.         return svn;
  137.     }

  138.     @Override
  139.     public int getWeek() {
  140.         return week;
  141.     }

  142.     @Override
  143.     public double getTime() {
  144.         return toa;
  145.     }

  146.     @Override
  147.     public double getSma() {
  148.         return sma;
  149.     }

  150.     @Override
  151.     public double getMeanMotion() {
  152.         final double absA = FastMath.abs(sma);
  153.         return FastMath.sqrt(GPS_MU / absA) / absA;
  154.     }

  155.     @Override
  156.     public double getE() {
  157.         return ecc;
  158.     }

  159.     @Override
  160.     public double getI0() {
  161.         return inc;
  162.     }

  163.     @Override
  164.     public double getIDot() {
  165.         return 0;
  166.     }

  167.     @Override
  168.     public double getOmega0() {
  169.         return om0;
  170.     }

  171.     @Override
  172.     public double getOmegaDot() {
  173.         return dom;
  174.     }

  175.     @Override
  176.     public double getPa() {
  177.         return aop;
  178.     }

  179.     @Override
  180.     public double getM0() {
  181.         return anom;
  182.     }

  183.     @Override
  184.     public double getCuc() {
  185.         return 0;
  186.     }

  187.     @Override
  188.     public double getCus() {
  189.         return 0;
  190.     }

  191.     @Override
  192.     public double getCrc() {
  193.         return 0;
  194.     }

  195.     @Override
  196.     public double getCrs() {
  197.         return 0;
  198.     }

  199.     @Override
  200.     public double getCic() {
  201.         return 0;
  202.     }

  203.     @Override
  204.     public double getCis() {
  205.         return 0;
  206.     }

  207.     /**
  208.      * Gets the Zeroth Order Clock Correction.
  209.      *
  210.      * @return the Zeroth Order Clock Correction (s)
  211.      */
  212.     public double getAf0() {
  213.         return af0;
  214.     }

  215.     /**
  216.      * Gets the First Order Clock Correction.
  217.      *
  218.      * @return the First Order Clock Correction (s/s)
  219.      */
  220.     public double getAf1() {
  221.         return af1;
  222.     }

  223.     /**
  224.      * Gets the Health status.
  225.      *
  226.      * @return the Health status
  227.      */
  228.     public int getHealth() {
  229.         return health;
  230.     }

  231.     /**
  232.      * Gets the average URA number.
  233.      *
  234.      * @return the average URA number
  235.      */
  236.     public int getURA() {
  237.         return ura;
  238.     }

  239.     /**
  240.      * Gets the satellite configuration.
  241.      *
  242.      * @return the satellite configuration
  243.      */
  244.     public int getSatConfiguration() {
  245.         return config;
  246.     }

  247. }