1 /* Copyright 2002-2025 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
19 import org.orekit.annotation.DefaultDataContext;
20 import org.orekit.data.DataContext;
21 import org.orekit.gnss.SatelliteSystem;
22 import org.orekit.propagation.analytical.gnss.GNSSPropagator;
23 import org.orekit.propagation.analytical.gnss.data.BeidouLegacyNavigationMessage;
24 import org.orekit.time.GNSSDate;
25 import org.orekit.time.TimeScales;
26
27 /**
28 * Container for RTCM 1042 data.
29 * @author Bryan Cazabonne
30 * @since 11.0
31 */
32 public class Rtcm1042Data extends RtcmEphemerisData {
33
34 /** Beidou navigation message. */
35 private BeidouLegacyNavigationMessage beidouNavigationMessage;
36
37 /** Beidou Time of clock. */
38 private double beidouToc;
39
40 /** Satellite health status. */
41 private double svHealth;
42
43 /** Constructor. */
44 public Rtcm1042Data() {
45 // Nothing to do ...
46 }
47
48 /**
49 * Get the Beidou navigation message corresponding to the current RTCM data.
50 * <p>
51 * This object can be used to initialize a {@link GNSSPropagator}
52 * <p>
53 * This method uses the {@link DataContext#getDefault()} to initialize
54 * the time scales used to configure the reference epochs of the navigation
55 * message.
56 *
57 * @return the Beidou navigation message
58 */
59 @DefaultDataContext
60 public BeidouLegacyNavigationMessage getBeidouNavigationMessage() {
61 return getBeidouNavigationMessage(DataContext.getDefault().getTimeScales());
62 }
63
64 /**
65 * Get the Beidou navigation message corresponding to the current RTCM data.
66 * <p>
67 * This object can be used to initialize a {@link GNSSPropagator}
68 * <p>
69 * When calling this method, the reference epochs of the navigation message
70 * (i.e. ephemeris and clock epochs) are initialized using the provided time scales.
71 *
72 * @param timeScales time scales to use for initializing epochs
73 * @return the Beidou navigation message
74 */
75 public BeidouLegacyNavigationMessage getBeidouNavigationMessage(final TimeScales timeScales) {
76
77 // Satellite system
78 final SatelliteSystem system = SatelliteSystem.BEIDOU;
79
80 // Week number and time of ephemeris
81 final int week = beidouNavigationMessage.getWeek();
82
83 // Set the ephemeris reference data
84 beidouNavigationMessage.setEpochToc(new GNSSDate(week, beidouToc, system, timeScales).getDate());
85
86 // Return the navigation message
87 return beidouNavigationMessage;
88
89 }
90
91 /**
92 * Set the Beidou navigation message.
93 * @param beidouNavigationMessage the Beidou navigation message to set
94 */
95 public void setBeidouNavigationMessage(final BeidouLegacyNavigationMessage beidouNavigationMessage) {
96 this.beidouNavigationMessage = beidouNavigationMessage;
97 }
98
99 /**
100 * Get the Beidou time of clock.
101 * <p>
102 * The Beidou time of clock is given in seconds since
103 * the beginning of the Beidou week.
104 * </p>
105 * @return the Beidou time of clock
106 */
107 public double getBeidouToc() {
108 return beidouToc;
109 }
110
111 /**
112 * Set the Beidou time of clock.
113 * @param toc the time of clock to set
114 */
115 public void setBeidouToc(final double toc) {
116 this.beidouToc = toc;
117 }
118
119 /**
120 * Get the satellite health status.
121 * @return the satellite health status
122 */
123 public double getSvHealth() {
124 return svHealth;
125 }
126
127 /**
128 * Set the satellite health status.
129 * @param svHealth the health status to set
130 */
131 public void setSvHealth(final double svHealth) {
132 this.svHealth = svHealth;
133 }
134
135 }