Rtcm1020Data.java

  1. /* Copyright 2002-2022 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.gnss.metric.messages.rtcm.ephemeris;

  18. import org.orekit.annotation.DefaultDataContext;
  19. import org.orekit.data.DataContext;
  20. import org.orekit.propagation.analytical.gnss.data.GLONASSNavigationMessage;
  21. import org.orekit.propagation.numerical.GLONASSNumericalPropagator;
  22. import org.orekit.time.AbsoluteDate;
  23. import org.orekit.time.GLONASSDate;
  24. import org.orekit.time.TimeScales;

  25. /**
  26.  * Container for RTCM 1020 data.
  27.  * <p>
  28.  * Spacecraft coordinates read from this RTCM message are given in PZ-90.02 frame.
  29.  * </p>
  30.  * @author Bryan Cazabonne
  31.  * @since 11.0
  32.  */
  33. public class Rtcm1020Data extends RtcmEphemerisData {

  34.     /** Glonass navigation message. */
  35.     private GLONASSNavigationMessage glonassNavigationMessage;

  36.     /** Number of the current four year interval. */
  37.     private int n4;

  38.     /** Number of the current day in a four year interval. */
  39.     private int nt;

  40.     /** Almanac health availability indicator. */
  41.     private boolean healthAvailabilityIndicator;

  42.     /** Glonass P1 Word. */
  43.     private int p1;

  44.     /** Time referenced to the beginning of the frame within the current day [s]. */
  45.     private double tk;

  46.     /** Glonass B<sub>n</sub> Word. */
  47.     private int bN;

  48.     /** Glonass P2 Word. */
  49.     private int p2;

  50.     /** Glonass P3 Word. */
  51.     private int p3;

  52.     /** Glonass P Word. */
  53.     private int p;

  54.     /** Glonass l<sub>n</sub> (third string). */
  55.     private int lNThirdString;

  56.     /**
  57.      * Glonass time difference between navigation RF signal transmitted
  58.      * in L2 sub-band and navigation RF signal transmitted in L1 sub-band.
  59.      */
  60.     private double deltaTauN;

  61.     /** Glonass E<sub>n</sub> Word. */
  62.     private int eN;

  63.     /** Glonass P4 Word. */
  64.     private int p4;

  65.     /** Glonass F<sub>T</sub> Word. */
  66.     private int fT;

  67.     /** Glonass M word. */
  68.     private int m;

  69.     /** Flag indicating if additional parameters are in the message. */
  70.     private boolean areAdditionalDataAvailable;

  71.     /** Glonass N<sup>A</sup> Word. */
  72.     private int nA;

  73.     /** Glonass time scale correction to UTC time. */
  74.     private double tauC;

  75.     /** Correction to GPS time relative to GLONASS time. */
  76.     private double tauGps;

  77.     /** Glonass l<sub>n</sub> (fifth string). */
  78.     private int lNFifthString;

  79.     /** Constructor. */
  80.     public Rtcm1020Data() {
  81.         // Nothing to do ...
  82.     }

  83.     /**
  84.      * Get the Glonass navigation message corresponding to the current RTCM data.
  85.      * <p>
  86.      * This object can be used to initialize a {@link GLONASSNumericalPropagator}
  87.      * <p>
  88.      * This method uses the {@link DataContext#getDefault()} to initialize
  89.      * the time scales used to configure the reference epochs of the navigation
  90.      * message.
  91.      *
  92.      * @return the Glonass navigation message
  93.      */
  94.     @DefaultDataContext
  95.     public GLONASSNavigationMessage getGlonassNavigationMessage() {
  96.         return getGlonassNavigationMessage(DataContext.getDefault().getTimeScales());
  97.     }

  98.     /**
  99.      * Get the Glonass navigation message corresponding to the current RTCM data.
  100.      * <p>
  101.      * This object can be used to initialize a {@link GLONASSNumericalPropagator}
  102.      * <p>
  103.      * When calling this method, the reference epochs of the navigation message
  104.      * (i.e. ephemeris and clock epochs) are initialized using the provided time scales.
  105.      *
  106.      * @param timeScales time scales to use for initializing epochs
  107.      * @return the Glonass navigation message
  108.      */
  109.     public GLONASSNavigationMessage getGlonassNavigationMessage(final TimeScales timeScales) {

  110.         final double tb = glonassNavigationMessage.getTime();

  111.         // Set the ephemeris reference data
  112.         final AbsoluteDate refDate = new GLONASSDate(nt, n4, tb, timeScales.getGLONASS()).getDate();
  113.         glonassNavigationMessage.setDate(refDate);
  114.         glonassNavigationMessage.setEpochToc(refDate);

  115.         // Return the navigation message
  116.         return glonassNavigationMessage;

  117.     }

  118.     /**
  119.      * Set the Glonass navigation message.
  120.      * @param glonassNavigationMessage the Glonass navigation message to set
  121.      */
  122.     public void setGlonassNavigationMessage(final GLONASSNavigationMessage glonassNavigationMessage) {
  123.         this.glonassNavigationMessage = glonassNavigationMessage;
  124.     }

  125.     /**
  126.      * Get the four-year interval number starting from 1996.
  127.      * @return the four-year interval number starting from 1996
  128.      */
  129.     public int getN4() {
  130.         return n4;
  131.     }

  132.     /**
  133.      * Set the four-year interval number starting from 1996.
  134.      * @param n4 the number to set
  135.      */
  136.     public void setN4(final int n4) {
  137.         this.n4 = n4;
  138.     }

  139.     /**
  140.      * Get the current date.
  141.      * <p>
  142.      * Current date is a calendar number of day within four-year interval
  143.      * starting from the 1-st of January in a leap year
  144.      * </p>
  145.      * @return the current date
  146.      */
  147.     public int getNt() {
  148.         return nt;
  149.     }

  150.     /**
  151.      * Set the current date.
  152.      * @param nt the current date to set
  153.      */
  154.     public void setNt(final int nt) {
  155.         this.nt = nt;
  156.     }

  157.     /**
  158.      * Get the flag indicating if GLONASS almanac health is available.
  159.      * @return true if GLONASS almanac health is available
  160.      */
  161.     public boolean isHealthAvailable() {
  162.         return healthAvailabilityIndicator;
  163.     }

  164.     /**
  165.      * Set the flag indicating if GLONASS almanac health is available.
  166.      * @param healthAvailabilityIndicator true if GLONASS almanac health is available
  167.      */
  168.     public void setHealthAvailabilityIndicator(final boolean healthAvailabilityIndicator) {
  169.         this.healthAvailabilityIndicator = healthAvailabilityIndicator;
  170.     }

  171.     /**
  172.      * Get the GLONASS P1 Word.
  173.      * <p>
  174.      * Word P1 is a flag of the immediate data updating. It indicates a time interval
  175.      * between two adjacent values of {@link GLONASSNavigationMessage#getTime() tb}
  176.      * parameter (in seconds).
  177.      * </p>
  178.      * @return the GLONASS P1 Word
  179.      */
  180.     public int getP1() {
  181.         return p1;
  182.     }

  183.     /**
  184.      * Set the GLONASS P1 Word.
  185.      * @param p1 the GLONASS P1 Word to set
  186.      */
  187.     public void setP1(final int p1) {
  188.         this.p1 = p1;
  189.     }

  190.     /**
  191.      * Get the time referenced to the beginning of the frame within the current day.
  192.      * @return the time in seconds
  193.      */
  194.     public double getTk() {
  195.         return tk;
  196.     }

  197.     /**
  198.      * Set the time referenced to the beginning of the frame within the current day.
  199.      * @param tk the time to set in seconds
  200.      */
  201.     public void setTk(final double tk) {
  202.         this.tk = tk;
  203.     }

  204.     /**
  205.      * Get the GLONASS B<sub>n</sub> Word.
  206.      * <p>
  207.      * Word B<sub>n</sub> is the health flag
  208.      * </p>
  209.      * @return the GLONASS B<sub>n</sub> Word
  210.      */
  211.     public int getBN() {
  212.         return bN;
  213.     }

  214.     /**
  215.      * Set the GLONASS B<sub>n</sub> Word.
  216.      * @param word the word to set
  217.      */
  218.     public void setBN(final int word) {
  219.         this.bN = word;
  220.     }

  221.     /**
  222.      * Get the GLONASS P2 Word.
  223.      * <p>
  224.      * Word P2 is flag of oddness ("1") or evenness ("0") of the value of
  225.      * {@link GLONASSNavigationMessage#getTime() tb}.
  226.      * </p>
  227.      * @return the GLONASS P2 Word
  228.      */
  229.     public int getP2() {
  230.         return p2;
  231.     }

  232.     /**
  233.      * Set the GLONASS P2 Word.
  234.      * @param p2 the GLONASS P2 Word to set
  235.      */
  236.     public void setP2(final int p2) {
  237.         this.p2 = p2;
  238.     }

  239.     /**
  240.      * Get the GLONASS P3 Word.
  241.      * <p>
  242.      * Word P3 is flag indicating a number of satellites for which almanac is
  243.      * transmitted within given frame
  244.      * </p>
  245.      * @return the GLONASS P3 Word
  246.      */
  247.     public int getP3() {
  248.         return p3;
  249.     }

  250.     /**
  251.      * Set the the GLONASS P3 Word.
  252.      * @param p3 the GLONASS P3 Word to set
  253.      */
  254.     public void setP3(final int p3) {
  255.         this.p3 = p3;
  256.     }

  257.     /**
  258.      * Get the GLONASS P Word.
  259.      * <p>
  260.      * Word P is a technological parameter of control segment,
  261.      * indication the satellite operation mode in respect of
  262.      * time parameters.
  263.      * </p>
  264.      * @return the GLONASS P Word
  265.      */
  266.     public int getP() {
  267.         return p;
  268.     }

  269.     /**
  270.      * Set the GLONASS P Word.
  271.      * @param p the GLONASS P Word to set
  272.      */
  273.     public void setP(final int p) {
  274.         this.p = p;
  275.     }

  276.     /**
  277.      * Get the GLONASS l<sub>n</sub> Word extracted from third string of the subframe.
  278.      * @return the GLONASS l<sub>n</sub> (third string)
  279.      */
  280.     public int getLNThirdString() {
  281.         return lNThirdString;
  282.     }

  283.     /**
  284.      * Set the GLONASS l<sub>n</sub> Word extracted from third string of the subframe.
  285.      * @param word the word to set
  286.      */
  287.     public void setLNThirdString(final int word) {
  288.         this.lNThirdString = word;
  289.     }

  290.     /**
  291.      * Get the deltaTauN value.
  292.      * <p>
  293.      * It represents the GLONASS time difference between navigation RF signal
  294.      * transmitted in L2 sub-band and navigation RF signal transmitted in L1 sub-band.
  295.      * </p>
  296.      * @return deltaTauN
  297.      */
  298.     public double getDeltaTN() {
  299.         return deltaTauN;
  300.     }

  301.     /**
  302.      * Set the deltaTauN value.
  303.      * @param deltaTN the value to set
  304.      */
  305.     public void setDeltaTN(final double deltaTN) {
  306.         this.deltaTauN = deltaTN;
  307.     }

  308.     /**
  309.      * Get the GLONASS E<sub>n</sub> Word.
  310.      * <p>
  311.      * It characterises the "age" of a current information.
  312.      * </p>
  313.      * @return the GLONASS E<sub>n</sub> Word in days
  314.      */
  315.     public int getEn() {
  316.         return eN;
  317.     }

  318.     /**
  319.      * Get the GLONASS E<sub>n</sub> Word.
  320.      * @param word the word to set
  321.      */
  322.     public void setEn(final int word) {
  323.         this.eN = word;
  324.     }

  325.     /**
  326.      * Get the GLONASS P4 Word.
  327.      * <p>
  328.      * GLONASS P4 Word is a flag to show that ephemeris parameters are present.
  329.      * "1" indicates that updated ephemeris or frequency/time parameters have been
  330.      * uploaded by the control segment
  331.      * </p>
  332.      * @return the GLONASS P4 Word
  333.      */
  334.     public int getP4() {
  335.         return p4;
  336.     }

  337.     /**
  338.      * Set the GLONASS P4 Word.
  339.      * @param p4 the GLONASS P4 Word to set
  340.      */
  341.     public void setP4(final int p4) {
  342.         this.p4 = p4;
  343.     }

  344.     /**
  345.      * Get the GLONASS F<sub>T</sub> Word.
  346.      * <p>
  347.      * It is a parameter that provides the predicted satellite user range accuracy
  348.      * at time {@link GLONASSNavigationMessage#getTime() tb}.
  349.      * </p>
  350.      * @return the GLONASS F<sub>T</sub> Word
  351.      */
  352.     public int getFT() {
  353.         return fT;
  354.     }

  355.     /**
  356.      * Set the GLONASS F<sub>T</sub> Word.
  357.      * @param word the word to set
  358.      */
  359.     public void setFT(final int word) {
  360.         this.fT = word;
  361.     }

  362.     /**
  363.      * Get the GLONASS M Word.
  364.      * <p>
  365.      * Word M represents the type of satellite transmitting navigation signal.
  366.      * "0" refers to GLONASS satellite, "1" refers to a GLONASS-M satellite.
  367.      * </p>
  368.      * @return the GLONASS M Word
  369.      */
  370.     public int getM() {
  371.         return m;
  372.     }

  373.     /**
  374.      * Set the GLONASS M Word.
  375.      * @param m the GLONASS M Word to set
  376.      */
  377.     public void setM(final int m) {
  378.         this.m = m;
  379.     }

  380.     /**
  381.      * Get the flag indicating if additional parameters are in the message.
  382.      * @return true if additional parameters are in the message
  383.      */
  384.     public boolean areAdditionalDataAvailable() {
  385.         return areAdditionalDataAvailable;
  386.     }

  387.     /**
  388.      * Set the flag indicating if additional parameters are in the message.
  389.      * @param areAdditionalDataAvailable true if additional parameters are in the message
  390.      */
  391.     public void setAreAdditionalDataAvailable(final boolean areAdditionalDataAvailable) {
  392.         this.areAdditionalDataAvailable = areAdditionalDataAvailable;
  393.     }

  394.     /**
  395.      * Get the GLONASS N<sup>A</sup> Word.
  396.      * <p>
  397.      * It is the calendar day number within the four-year period beginning since
  398.      * the leap year. It is used for almanac data.
  399.      * </p>
  400.      * @return the GLONASS N<sup>A</sup> Word
  401.      */
  402.     public int getNA() {
  403.         return nA;
  404.     }

  405.     /**
  406.      * Set the GLONASS N<sup>A</sup> Word.
  407.      * @param word the word to set
  408.      */
  409.     public void setNA(final int word) {
  410.         this.nA = word;
  411.     }

  412.     /**
  413.      * Get the GLONASS time scale correction to UTC time.
  414.      * @return the GLONASS time scale correction to UTC time in seconds
  415.      */
  416.     public double getTauC() {
  417.         return tauC;
  418.     }

  419.     /**
  420.      * Set the GLONASS time scale correction to UTC time.
  421.      * @param tauC the value to set in seconds.
  422.      */
  423.     public void setTauC(final double tauC) {
  424.         this.tauC = tauC;
  425.     }

  426.     /**
  427.      * Get the correction to GPS time relative to GLONASS time.
  428.      * @return the correction to GPS time relative to GLONASS time in seconds
  429.      */
  430.     public double getTauGps() {
  431.         return tauGps;
  432.     }

  433.     /**
  434.      * Set the correction to GPS time relative to GLONASS time.
  435.      * @param tauGps the value to set in seconds
  436.      */
  437.     public void setTauGps(final double tauGps) {
  438.         this.tauGps = tauGps;
  439.     }

  440.     /**
  441.      * Get the GLONASS l<sub>n</sub> Word extracted from fifth string of the subframe.
  442.      * @return the GLONASS l<sub>n</sub> (fifth string)
  443.      */
  444.     public int getLNFifthString() {
  445.         return lNFifthString;
  446.     }

  447.     /**
  448.      * Set the GLONASS l<sub>n</sub> Word extracted from fifth string of the subframe.
  449.      * @param word the word to set
  450.      */
  451.     public void setLNFifthString(final int word) {
  452.         this.lNFifthString = word;
  453.     }

  454. }