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
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.GalileoNavigationMessage;
24 import org.orekit.time.GNSSDate;
25 import org.orekit.time.TimeScales;
26
27 /**
28 * Container for RTCM 1045 data.
29 * @author Bryan Cazabonne
30 * @since 11.0
31 */
32 public class Rtcm1045Data extends RtcmEphemerisData {
33
34 /** Galileo navigation message. */
35 private GalileoNavigationMessage galileoNavigationMessage;
36
37 /** Galileo Time of clock. */
38 private double galileoToc;
39
40 /** Galileo NAV Data Validity Status. */
41 private int galileoDataValidityStatus;
42
43 /** Constructor. */
44 public Rtcm1045Data() {
45 // Nothing to do ...
46 }
47
48 /**
49 * Get the Galileo 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 Galileo navigation message
58 */
59 @DefaultDataContext
60 public GalileoNavigationMessage getGalileoNavigationMessage() {
61 return getGalileoNavigationMessage(DataContext.getDefault().getTimeScales());
62 }
63
64 /**
65 * Get the Galileo 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 Galileo navigation message
74 */
75 public GalileoNavigationMessage getGalileoNavigationMessage(final TimeScales timeScales) {
76
77 // Satellite system
78 final SatelliteSystem system = SatelliteSystem.GALILEO;
79
80 // Week number and time of ephemeris
81 final int week = galileoNavigationMessage.getWeek();
82 final double toe = galileoNavigationMessage.getTime();
83
84 // Set the ephemeris reference data
85 galileoNavigationMessage.setDate(new GNSSDate(week, toe, system, timeScales).getDate());
86 galileoNavigationMessage.setEpochToc(new GNSSDate(week, galileoToc, system, timeScales).getDate());
87
88 // Return the navigation message
89 return galileoNavigationMessage;
90
91 }
92
93 /**
94 * Set the Galileo navigation message.
95 * @param galileoNavigationMessage the Galileo navigation message to set
96 */
97 public void setGalileoNavigationMessage(final GalileoNavigationMessage galileoNavigationMessage) {
98 this.galileoNavigationMessage = galileoNavigationMessage;
99 }
100
101 /**
102 * Get the Galileo time of clock.
103 * <p>
104 * The Galileo time of clock is given in seconds since
105 * the beginning of the Galileo week.
106 * </p>
107 * @return the Galileo time of clock
108 */
109 public double getGalileoToc() {
110 return galileoToc;
111 }
112
113 /**
114 * Set the Galileo time of clock.
115 * @param toc the time of clock to set
116 */
117 public void setGalileoToc(final double toc) {
118 this.galileoToc = toc;
119 }
120
121 /**
122 * Get the Galileo data validity status.
123 * @return the Galileo data validity status
124 */
125 public int getGalileoDataValidityStatus() {
126 return galileoDataValidityStatus;
127 }
128
129 /**
130 * Set the Galileo data validity status.
131 * @param galileoDataValidityStatus the validity status to set
132 */
133 public void setGalileoDataValidityStatus(final int galileoDataValidityStatus) {
134 this.galileoDataValidityStatus = galileoDataValidityStatus;
135 }
136
137 }