Rtcm1044Data.java

  1. /* Copyright 2002-2024 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.QZSSLegacyNavigationMessage;
  23. import org.orekit.time.GNSSDate;
  24. import org.orekit.time.TimeScales;

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

  31.     /** QZSS navigation message. */
  32.     private QZSSLegacyNavigationMessage qzssNavigationMessage;

  33.     /** QZSS Time of clock. */
  34.     private double qzssToc;

  35.     /** QZSS code on L2 Channel. */
  36.     private int qzssCodeOnL2;

  37.     /** QZSS fit interval. */
  38.     private int qzssFitInterval;

  39.     /** Constructor. */
  40.     public Rtcm1044Data() {
  41.         // Nothing to do ...
  42.     }

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

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

  70.         // Satellite system
  71.         final SatelliteSystem system = SatelliteSystem.QZSS;

  72.         // Week number and time of ephemeris
  73.         final int    week = qzssNavigationMessage.getWeek();
  74.         final double toe  = qzssNavigationMessage.getTime();

  75.         // Set the ephemeris reference data
  76.         qzssNavigationMessage.setDate(new GNSSDate(week, toe, system, timeScales).getDate());
  77.         qzssNavigationMessage.setEpochToc(new GNSSDate(week, qzssToc, system, timeScales).getDate());

  78.         // Return the navigation message
  79.         return qzssNavigationMessage;

  80.     }

  81.     /**
  82.      * Set the QZSS navigation message.
  83.      * @param qzssNavigationMessage the QZSS navigation message to set
  84.      */
  85.     public void setQzssNavigationMessage(final QZSSLegacyNavigationMessage qzssNavigationMessage) {
  86.         this.qzssNavigationMessage = qzssNavigationMessage;
  87.     }

  88.     /**
  89.      * Get the QZSS time of clock.
  90.      * <p>
  91.      * The QZSS time of clock is given in seconds since
  92.      * the beginning of the QZSS week.
  93.      * </p>
  94.      * @return the QZSS time of clock
  95.      */
  96.     public double getQzssToc() {
  97.         return qzssToc;
  98.     }

  99.     /**
  100.      * Set the QZSS time of clock.
  101.      * @param toc the time of clock to set
  102.      */
  103.     public void setQzssToc(final double toc) {
  104.         this.qzssToc = toc;
  105.     }

  106.     /**
  107.      * Get the QZSS code on L2 Channel.
  108.      * @return the QZSS code on L2
  109.      */
  110.     public int getQzssCodeOnL2() {
  111.         return qzssCodeOnL2;
  112.     }

  113.     /**
  114.      * Set the QZSS code on L2.
  115.      * @param qzssCodeOnL2 the code to set
  116.      */
  117.     public void setQzssCodeOnL2(final int qzssCodeOnL2) {
  118.         this.qzssCodeOnL2 = qzssCodeOnL2;
  119.     }

  120.     /**
  121.      * Get the QZSS fit interval.
  122.      * @return the QZSS fit interval
  123.      */
  124.     public int getQzssFitInterval() {
  125.         return qzssFitInterval;
  126.     }

  127.     /**
  128.      * Set the QZSS fit interval.
  129.      * @param qzssFitInterval the QZSS fit interval to set
  130.      */
  131.     public void setQzssFitInterval(final int qzssFitInterval) {
  132.         this.qzssFitInterval = qzssFitInterval;
  133.     }

  134. }