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

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

  31.     /** Beidou navigation message. */
  32.     private BeidouLegacyNavigationMessage beidouNavigationMessage;

  33.     /** Beidou Time of clock. */
  34.     private double beidouToc;

  35.     /** Satellite health status. */
  36.     private double svHealth;

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

  41.     /**
  42.      * Get the Beidou 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 Beidou navigation message
  51.      */
  52.     @DefaultDataContext
  53.     public BeidouLegacyNavigationMessage getBeidouNavigationMessage() {
  54.         return getBeidouNavigationMessage(DataContext.getDefault().getTimeScales());
  55.     }

  56.     /**
  57.      * Get the Beidou 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 Beidou navigation message
  66.      */
  67.     public BeidouLegacyNavigationMessage getBeidouNavigationMessage(final TimeScales timeScales) {

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

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

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

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

  78.     }

  79.     /**
  80.      * Set the Beidou navigation message.
  81.      * @param beidouNavigationMessage the Beidou navigation message to set
  82.      */
  83.     public void setBeidouNavigationMessage(final BeidouLegacyNavigationMessage beidouNavigationMessage) {
  84.         this.beidouNavigationMessage = beidouNavigationMessage;
  85.     }

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

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

  104.     /**
  105.      * Get the satellite health status.
  106.      * @return the satellite health status
  107.      */
  108.     public double getSvHealth() {
  109.         return svHealth;
  110.     }

  111.     /**
  112.      * Set the satellite health status.
  113.      * @param svHealth the health status to set
  114.      */
  115.     public void setSvHealth(final double svHealth) {
  116.         this.svHealth = svHealth;
  117.     }

  118. }