GLONASSAlmanac.java

  1. /* Copyright 2002-2019 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.orekit.propagation.analytical.gnss.GLONASSOrbitalElements;
  19. import org.orekit.time.AbsoluteDate;
  20. import org.orekit.time.DateComponents;
  21. import org.orekit.time.GLONASSDate;
  22. import org.orekit.time.TimeComponents;
  23. import org.orekit.time.TimeScalesFactory;

  24. /**
  25.  * This class holds a GLONASS almanac as read from .agl files.
  26.  *
  27.  * @author Bryan Cazabonne
  28.  * @since 10.0
  29.  *
  30.  */
  31. public class GLONASSAlmanac implements GLONASSOrbitalElements {

  32.     /** Frequency channel (-7...6). */
  33.     private final int channel;

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

  36.     /** Day of Almanac. */
  37.     private final int day;

  38.     /** Month of Almanac. */
  39.     private final int month;

  40.     /** Year of Almanac. */
  41.     private final int year;

  42.     /** Reference time of the almanac. */
  43.     private final double ta;

  44.     /** Greenwich longitude of ascending node of orbit. */
  45.     private final double lambda;

  46.     /** Correction to the mean value of inclination. */
  47.     private final double deltaI;

  48.     /** Argument of perigee. */
  49.     private final double pa;

  50.     /** Eccentricity. */
  51.     private final double ecc;

  52.     /** Correction to the mean value of Draconian period. */
  53.     private final double deltaT;

  54.     /** Rate of change of orbital period. */
  55.     private final double deltaTDot;

  56.     /** Correction from GLONASS to UTC. */
  57.     private final double tGlo2UTC;

  58.     /** Correction to GPS time relative GLONASS. */
  59.     private final double tGPS2Glo;

  60.     /**  Correction of time relative to GLONASS system time. */
  61.     private final double tGlo;

  62.     /**
  63.      * Constructor.
  64.      *
  65.      * @param channel the frequency channel from -7 to 6)
  66.      * @param health the Health status
  67.      * @param day the day of Almanac
  68.      * @param month the month of Almanac
  69.      * @param year the year of Almanac
  70.      * @param ta the reference time of the almanac (s)
  71.      * @param lambda the Greenwich longitude of ascending node of orbit (rad)
  72.      * @param deltaI the correction to the mean value of inclination (rad)
  73.      * @param pa the argument of perigee (rad)
  74.      * @param ecc the eccentricity
  75.      * @param deltaT the correction to the mean value of Draconian period (s)
  76.      * @param deltaTDot the rate of change of orbital period
  77.      * @param tGlo2UTC the correction from GLONASS to UTC (s)
  78.      * @param tGPS2Glo the correction to GPS time relative GLONASS (s)
  79.      * @param tGlo the correction of time relative to GLONASS system time (s)
  80.      */
  81.     public GLONASSAlmanac(final int channel, final int health,
  82.                           final int day, final int month, final int year,
  83.                           final double ta, final double lambda,
  84.                           final double deltaI, final double pa,
  85.                           final double ecc, final double deltaT, final double deltaTDot,
  86.                           final double tGlo2UTC, final double tGPS2Glo, final double tGlo) {
  87.         this.channel = channel;
  88.         this.health = health;
  89.         this.day = day;
  90.         this.month = month;
  91.         this.year = year;
  92.         this.ta = ta;
  93.         this.lambda = lambda;
  94.         this.deltaI = deltaI;
  95.         this.pa = pa;
  96.         this.ecc = ecc;
  97.         this.deltaT = deltaT;
  98.         this.deltaTDot = deltaTDot;
  99.         this.tGlo2UTC = tGlo2UTC;
  100.         this.tGPS2Glo = tGPS2Glo;
  101.         this.tGlo = tGlo;
  102.     }

  103.     @Override
  104.     public AbsoluteDate getDate() {
  105.         final DateComponents date = new DateComponents(year, month, day);
  106.         final TimeComponents time = new TimeComponents(ta);
  107.         return new AbsoluteDate(date, time, TimeScalesFactory.getGLONASS());
  108.     }

  109.     @Override
  110.     public double getTime() {
  111.         return ta;
  112.     }

  113.     @Override
  114.     public double getLambda() {
  115.         return lambda;
  116.     }

  117.     @Override
  118.     public double getE() {
  119.         return ecc;
  120.     }

  121.     @Override
  122.     public double getPa() {
  123.         return pa;
  124.     }

  125.     @Override
  126.     public double getDeltaI() {
  127.         return deltaI;
  128.     }

  129.     @Override
  130.     public double getDeltaT() {
  131.         return deltaT;
  132.     }

  133.     @Override
  134.     public double getDeltaTDot() {
  135.         return deltaTDot;
  136.     }

  137.     /**
  138.      * Get the Health status.
  139.      *
  140.      * @return the Health status
  141.      */
  142.     public int getHealth() {
  143.         return health;
  144.     }

  145.     /**
  146.      * Get the frequency channel.
  147.      *
  148.      * @return the frequency channel
  149.      */
  150.     public int getFrequencyChannel() {
  151.         return channel;
  152.     }

  153.     /**
  154.      * Get the correction from GLONASS to UTC.
  155.      *
  156.      * @return the correction from GLONASS to UTC (s)
  157.      */
  158.     public double getGlo2UTC() {
  159.         return tGlo2UTC;
  160.     }

  161.     /**
  162.      * Get the correction to GPS time relative GLONASS.
  163.      *
  164.      * @return the to GPS time relative GLONASS (s)
  165.      */
  166.     public double getGPS2Glo() {
  167.         return tGPS2Glo;
  168.     }

  169.     /**
  170.      * Get the correction of time relative to GLONASS system time.
  171.      *
  172.      * @return the correction of time relative to GLONASS system time (s)
  173.      */
  174.     public double getGloOffset() {
  175.         return tGlo;
  176.     }

  177.     @Override
  178.     public int getNa() {
  179.         final GLONASSDate gloDate = new GLONASSDate(getDate());
  180.         return gloDate.getDayNumber();
  181.     }

  182.     @Override
  183.     public int getN4() {
  184.         final GLONASSDate gloDate = new GLONASSDate(getDate());
  185.         return gloDate.getIntervalNumber();
  186.     }
  187. }