Rtcm1045Data.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.GalileoNavigationMessage;
  23. import org.orekit.time.GNSSDate;
  24. import org.orekit.time.TimeScales;

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

  31.     /** Galileo navigation message. */
  32.     private GalileoNavigationMessage galileoNavigationMessage;

  33.     /** Galileo Time of clock. */
  34.     private double galileoToc;

  35.     /** Galileo NAV Data Validity Status. */
  36.     private int galileoDataValidityStatus;

  37.     /** Constructor. */
  38.     public Rtcm1045Data() {
  39.         // Nothing to do ...
  40.     }

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

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

  68.         // Satellite system
  69.         final SatelliteSystem system = SatelliteSystem.GALILEO;

  70.         // Week number and time of ephemeris
  71.         final int    week = galileoNavigationMessage.getWeek();
  72.         final double toe  = galileoNavigationMessage.getTime();

  73.         // Set the ephemeris reference data
  74.         galileoNavigationMessage.setDate(new GNSSDate(week, toe, system, timeScales).getDate());
  75.         galileoNavigationMessage.setEpochToc(new GNSSDate(week, galileoToc, system, timeScales).getDate());

  76.         // Return the navigation message
  77.         return galileoNavigationMessage;

  78.     }

  79.     /**
  80.      * Set the Galileo navigation message.
  81.      * @param galileoNavigationMessage the Galileo navigation message to set
  82.      */
  83.     public void setGalileoNavigationMessage(final GalileoNavigationMessage galileoNavigationMessage) {
  84.         this.galileoNavigationMessage = galileoNavigationMessage;
  85.     }

  86.     /**
  87.      * Get the Galileo time of clock.
  88.      * <p>
  89.      * The Galileo time of clock is given in seconds since
  90.      * the beginning of the Galileo week.
  91.      * </p>
  92.      * @return the Galileo time of clock
  93.      */
  94.     public double getGalileoToc() {
  95.         return galileoToc;
  96.     }

  97.     /**
  98.      * Set the Galileo time of clock.
  99.      * @param toc the time of clock to set
  100.      */
  101.     public void setGalileoToc(final double toc) {
  102.         this.galileoToc = toc;
  103.     }

  104.     /**
  105.      * Get the Galileo data validity status.
  106.      * @return the Galileo data validity status
  107.      */
  108.     public int getGalileoDataValidityStatus() {
  109.         return galileoDataValidityStatus;
  110.     }

  111.     /**
  112.      * Set the Galileo data validity status.
  113.      * @param galileoDataValidityStatus the validity status to set
  114.      */
  115.     public void setGalileoDataValidityStatus(final int galileoDataValidityStatus) {
  116.         this.galileoDataValidityStatus = galileoDataValidityStatus;
  117.     }

  118. }