Rtcm1019Data.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.gnss.SatelliteSystem;
  21. import org.orekit.propagation.analytical.gnss.GNSSPropagator;
  22. import org.orekit.propagation.analytical.gnss.data.GPSNavigationMessage;
  23. import org.orekit.time.GNSSDate;
  24. import org.orekit.time.TimeScales;

  25. /**
  26.  * Container for RTCM 1019 data.
  27.  * @author Bryan Cazabonne
  28.  * @since 11.0
  29.  */
  30. public class Rtcm1019Data extends RtcmEphemerisData {

  31.     /** GPS navigation message. */
  32.     private GPSNavigationMessage gpsNavigationMessage;

  33.     /** GPS Time of clock. */
  34.     private double gpsToc;

  35.     /** GPS code on L2. */
  36.     private int gpsCodeOnL2;

  37.     /** GPS L2 P data flag. */
  38.     private boolean gpsL2PDataFlag;

  39.     /** GPS fit interval. */
  40.     private int gpsFitInterval;

  41.     /** Constructor. */
  42.     public Rtcm1019Data() {
  43.         // Nothing to do ...
  44.     }

  45.     /**
  46.      * Get the GPS navigation message corresponding to the current RTCM data.
  47.      * <p>
  48.      * This object can be used to initialize a {@link GNSSPropagator}
  49.      * <p>
  50.      * This method uses the {@link DataContext#getDefault()} to initialize
  51.      * the time scales used to configure the reference epochs of the navigation
  52.      * message.
  53.      *
  54.      * @return the GPS navigation message
  55.      */
  56.     @DefaultDataContext
  57.     public GPSNavigationMessage getGpsNavigationMessage() {
  58.         return getGpsNavigationMessage(DataContext.getDefault().getTimeScales());
  59.     }

  60.     /**
  61.      * Get the GPS navigation message corresponding to the current RTCM data.
  62.      * <p>
  63.      * This object can be used to initialize a {@link GNSSPropagator}
  64.      * <p>
  65.      * When calling this method, the reference epochs of the navigation message
  66.      * (i.e. ephemeris and clock epochs) are initialized using the provided time scales.
  67.      *
  68.      * @param timeScales time scales to use for initializing epochs
  69.      * @return the GPS navigation message
  70.      */
  71.     public GPSNavigationMessage getGpsNavigationMessage(final TimeScales timeScales) {

  72.         // Satellite system
  73.         final SatelliteSystem system = SatelliteSystem.GPS;

  74.         // Week number and time of ephemeris
  75.         final int    week = gpsNavigationMessage.getWeek();
  76.         final double toe  = gpsNavigationMessage.getTime();

  77.         // Set the ephemeris reference data
  78.         gpsNavigationMessage.setDate(new GNSSDate(week, SEC_TO_MILLI * toe, system, timeScales).getDate());
  79.         gpsNavigationMessage.setEpochToc(new GNSSDate(week, SEC_TO_MILLI * gpsToc, system, timeScales).getDate());

  80.         // Return the navigation message
  81.         return gpsNavigationMessage;

  82.     }

  83.     /**
  84.      * Set the GPS navigation message.
  85.      * @param gpsNavigationMessage the GPS navigation message to set
  86.      */
  87.     public void setGpsNavigationMessage(final GPSNavigationMessage gpsNavigationMessage) {
  88.         this.gpsNavigationMessage = gpsNavigationMessage;
  89.     }

  90.     /**
  91.      * Get the GPS time of clock.
  92.      * <p>
  93.      * The GPS time of clock is given in seconds since
  94.      * the beginning of the GPS week.
  95.      * </p>
  96.      * @return the GPS time of clock
  97.      */
  98.     public double getGpsToc() {
  99.         return gpsToc;
  100.     }

  101.     /**
  102.      * Set the GPS time of clock.
  103.      * @param toc the time of clock to set
  104.      */
  105.     public void setGpsToc(final double toc) {
  106.         this.gpsToc = toc;
  107.     }

  108.     /**
  109.      * Get the GPS code on L2.
  110.      * <ul>
  111.      *   <li>0: Reserved</li>
  112.      *   <li>1: P code on</li>
  113.      *   <li>2: C/A code on</li>
  114.      *   <li>3: L2C on</li>
  115.      * </ul>
  116.      * @return the GPS code on L2
  117.      */
  118.     public int getGpsCodeOnL2() {
  119.         return gpsCodeOnL2;
  120.     }

  121.     /**
  122.      * Set the GPS code on L2.
  123.      * @param gpsCodeOnL2 the code to set
  124.      */
  125.     public void setGpsCodeOnL2(final int gpsCodeOnL2) {
  126.         this.gpsCodeOnL2 = gpsCodeOnL2;
  127.     }

  128.     /**
  129.      * Get the GPS L2 P-Code data flag.
  130.      * @return true L2 P-Code NAV data ON
  131.      */
  132.     public boolean getGpsL2PDataFlag() {
  133.         return gpsL2PDataFlag;
  134.     }

  135.     /**
  136.      * Set the GPS L2 P-code data flag.
  137.      * @param gpsL2PDataFlag the flag to set
  138.      */
  139.     public void setGpsL2PDataFlag(final boolean gpsL2PDataFlag) {
  140.         this.gpsL2PDataFlag = gpsL2PDataFlag;
  141.     }

  142.     /**
  143.      * Get the GPS fit interval.
  144.      * @return the GPS fit interval
  145.      */
  146.     public int getGpsFitInterval() {
  147.         return gpsFitInterval;
  148.     }

  149.     /**
  150.      * Set the GPS fit interval.
  151.      * @param gpsFitInterval the GPS fit interval to set
  152.      */
  153.     public void setGpsFitInterval(final int gpsFitInterval) {
  154.         this.gpsFitInterval = gpsFitInterval;
  155.     }

  156. }