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.propagation.analytical.gnss.data.GLONASSNavigationMessage;
22 import org.orekit.propagation.numerical.GLONASSNumericalPropagator;
23 import org.orekit.time.AbsoluteDate;
24 import org.orekit.time.GLONASSDate;
25 import org.orekit.time.TimeScales;
26
27 /**
28 * Container for RTCM 1020 data.
29 * <p>
30 * Spacecraft coordinates read from this RTCM message are given in PZ-90.02 frame.
31 * </p>
32 * @author Bryan Cazabonne
33 * @since 11.0
34 */
35 public class Rtcm1020Data extends RtcmEphemerisData {
36
37 /** Glonass navigation message. */
38 private GLONASSNavigationMessage glonassNavigationMessage;
39
40 /** Number of the current four year interval. */
41 private int n4;
42
43 /** Number of the current day in a four year interval. */
44 private int nt;
45
46 /** Almanac health availability indicator. */
47 private boolean healthAvailabilityIndicator;
48
49 /** Glonass P1 Word. */
50 private int p1;
51
52 /** Time referenced to the beginning of the frame within the current day [s]. */
53 private double tk;
54
55 /** Glonass B<sub>n</sub> Word. */
56 private int bN;
57
58 /** Glonass P2 Word. */
59 private int p2;
60
61 /** Glonass P3 Word. */
62 private int p3;
63
64 /** Glonass P Word. */
65 private int p;
66
67 /** Glonass l<sub>n</sub> (third string). */
68 private int lNThirdString;
69
70 /**
71 * Glonass time difference between navigation RF signal transmitted
72 * in L2 sub-band and navigation RF signal transmitted in L1 sub-band.
73 */
74 private double deltaTauN;
75
76 /** Glonass E<sub>n</sub> Word. */
77 private int eN;
78
79 /** Glonass P4 Word. */
80 private int p4;
81
82 /** Glonass F<sub>T</sub> Word. */
83 private int fT;
84
85 /** Glonass M word. */
86 private int m;
87
88 /** Flag indicating if additional parameters are in the message. */
89 private boolean areAdditionalDataAvailable;
90
91 /** Glonass N<sup>A</sup> Word. */
92 private int nA;
93
94 /** Glonass time scale correction to UTC time. */
95 private double tauC;
96
97 /** Correction to GPS time relative to GLONASS time. */
98 private double tauGps;
99
100 /** Glonass l<sub>n</sub> (fifth string). */
101 private int lNFifthString;
102
103 /** Constructor. */
104 public Rtcm1020Data() {
105 // Nothing to do ...
106 }
107
108 /**
109 * Get the Glonass navigation message corresponding to the current RTCM data.
110 * <p>
111 * This object can be used to initialize a {@link GLONASSNumericalPropagator}
112 * <p>
113 * This method uses the {@link DataContext#getDefault()} to initialize
114 * the time scales used to configure the reference epochs of the navigation
115 * message.
116 *
117 * @return the Glonass navigation message
118 */
119 @DefaultDataContext
120 public GLONASSNavigationMessage getGlonassNavigationMessage() {
121 return getGlonassNavigationMessage(DataContext.getDefault().getTimeScales());
122 }
123
124 /**
125 * Get the Glonass navigation message corresponding to the current RTCM data.
126 * <p>
127 * This object can be used to initialize a {@link GLONASSNumericalPropagator}
128 * <p>
129 * When calling this method, the reference epochs of the navigation message
130 * (i.e. ephemeris and clock epochs) are initialized using the provided time scales.
131 *
132 * @param timeScales time scales to use for initializing epochs
133 * @return the Glonass navigation message
134 */
135 public GLONASSNavigationMessage getGlonassNavigationMessage(final TimeScales timeScales) {
136
137 final double tb = glonassNavigationMessage.getTime();
138
139 // Set the ephemeris reference data
140 final AbsoluteDate refDate = new GLONASSDate(nt, n4, tb, timeScales.getGLONASS()).getDate();
141 glonassNavigationMessage.setDate(refDate);
142 glonassNavigationMessage.setEpochToc(refDate);
143
144 // Return the navigation message
145 return glonassNavigationMessage;
146
147 }
148
149 /**
150 * Set the Glonass navigation message.
151 * @param glonassNavigationMessage the Glonass navigation message to set
152 */
153 public void setGlonassNavigationMessage(final GLONASSNavigationMessage glonassNavigationMessage) {
154 this.glonassNavigationMessage = glonassNavigationMessage;
155 }
156
157 /**
158 * Get the four-year interval number starting from 1996.
159 * @return the four-year interval number starting from 1996
160 */
161 public int getN4() {
162 return n4;
163 }
164
165 /**
166 * Set the four-year interval number starting from 1996.
167 * @param n4 the number to set
168 */
169 public void setN4(final int n4) {
170 this.n4 = n4;
171 }
172
173 /**
174 * Get the current date.
175 * <p>
176 * Current date is a calendar number of day within four-year interval
177 * starting from the 1-st of January in a leap year
178 * </p>
179 * @return the current date
180 */
181 public int getNt() {
182 return nt;
183 }
184
185 /**
186 * Set the current date.
187 * @param nt the current date to set
188 */
189 public void setNt(final int nt) {
190 this.nt = nt;
191 }
192
193 /**
194 * Get the flag indicating if GLONASS almanac health is available.
195 * @return true if GLONASS almanac health is available
196 */
197 public boolean isHealthAvailable() {
198 return healthAvailabilityIndicator;
199 }
200
201 /**
202 * Set the flag indicating if GLONASS almanac health is available.
203 * @param healthAvailabilityIndicator true if GLONASS almanac health is available
204 */
205 public void setHealthAvailabilityIndicator(final boolean healthAvailabilityIndicator) {
206 this.healthAvailabilityIndicator = healthAvailabilityIndicator;
207 }
208
209 /**
210 * Get the GLONASS P1 Word.
211 * <p>
212 * Word P1 is a flag of the immediate data updating. It indicates a time interval
213 * between two adjacent values of {@link GLONASSNavigationMessage#getTime() tb}
214 * parameter (in seconds).
215 * </p>
216 * @return the GLONASS P1 Word
217 */
218 public int getP1() {
219 return p1;
220 }
221
222 /**
223 * Set the GLONASS P1 Word.
224 * @param p1 the GLONASS P1 Word to set
225 */
226 public void setP1(final int p1) {
227 this.p1 = p1;
228 }
229
230 /**
231 * Get the time referenced to the beginning of the frame within the current day.
232 * @return the time in seconds
233 */
234 public double getTk() {
235 return tk;
236 }
237
238 /**
239 * Set the time referenced to the beginning of the frame within the current day.
240 * @param tk the time to set in seconds
241 */
242 public void setTk(final double tk) {
243 this.tk = tk;
244 }
245
246 /**
247 * Get the GLONASS B<sub>n</sub> Word.
248 * <p>
249 * Word B<sub>n</sub> is the health flag
250 * </p>
251 * @return the GLONASS B<sub>n</sub> Word
252 */
253 public int getBN() {
254 return bN;
255 }
256
257 /**
258 * Set the GLONASS B<sub>n</sub> Word.
259 * @param word the word to set
260 */
261 public void setBN(final int word) {
262 this.bN = word;
263 }
264
265 /**
266 * Get the GLONASS P2 Word.
267 * <p>
268 * Word P2 is flag of oddness ("1") or evenness ("0") of the value of
269 * {@link GLONASSNavigationMessage#getTime() tb}.
270 * </p>
271 * @return the GLONASS P2 Word
272 */
273 public int getP2() {
274 return p2;
275 }
276
277 /**
278 * Set the GLONASS P2 Word.
279 * @param p2 the GLONASS P2 Word to set
280 */
281 public void setP2(final int p2) {
282 this.p2 = p2;
283 }
284
285 /**
286 * Get the GLONASS P3 Word.
287 * <p>
288 * Word P3 is flag indicating a number of satellites for which almanac is
289 * transmitted within given frame
290 * </p>
291 * @return the GLONASS P3 Word
292 */
293 public int getP3() {
294 return p3;
295 }
296
297 /**
298 * Set the the GLONASS P3 Word.
299 * @param p3 the GLONASS P3 Word to set
300 */
301 public void setP3(final int p3) {
302 this.p3 = p3;
303 }
304
305 /**
306 * Get the GLONASS P Word.
307 * <p>
308 * Word P is a technological parameter of control segment,
309 * indication the satellite operation mode in respect of
310 * time parameters.
311 * </p>
312 * @return the GLONASS P Word
313 */
314 public int getP() {
315 return p;
316 }
317
318 /**
319 * Set the GLONASS P Word.
320 * @param p the GLONASS P Word to set
321 */
322 public void setP(final int p) {
323 this.p = p;
324 }
325
326 /**
327 * Get the GLONASS l<sub>n</sub> Word extracted from third string of the subframe.
328 * @return the GLONASS l<sub>n</sub> (third string)
329 */
330 public int getLNThirdString() {
331 return lNThirdString;
332 }
333
334 /**
335 * Set the GLONASS l<sub>n</sub> Word extracted from third string of the subframe.
336 * @param word the word to set
337 */
338 public void setLNThirdString(final int word) {
339 this.lNThirdString = word;
340 }
341
342 /**
343 * Get the deltaTauN value.
344 * <p>
345 * It represents the GLONASS time difference between navigation RF signal
346 * transmitted in L2 sub-band and navigation RF signal transmitted in L1 sub-band.
347 * </p>
348 * @return deltaTauN
349 */
350 public double getDeltaTN() {
351 return deltaTauN;
352 }
353
354 /**
355 * Set the deltaTauN value.
356 * @param deltaTN the value to set
357 */
358 public void setDeltaTN(final double deltaTN) {
359 this.deltaTauN = deltaTN;
360 }
361
362 /**
363 * Get the GLONASS E<sub>n</sub> Word.
364 * <p>
365 * It characterises the "age" of a current information.
366 * </p>
367 * @return the GLONASS E<sub>n</sub> Word in days
368 */
369 public int getEn() {
370 return eN;
371 }
372
373 /**
374 * Get the GLONASS E<sub>n</sub> Word.
375 * @param word the word to set
376 */
377 public void setEn(final int word) {
378 this.eN = word;
379 }
380
381 /**
382 * Get the GLONASS P4 Word.
383 * <p>
384 * GLONASS P4 Word is a flag to show that ephemeris parameters are present.
385 * "1" indicates that updated ephemeris or frequency/time parameters have been
386 * uploaded by the control segment
387 * </p>
388 * @return the GLONASS P4 Word
389 */
390 public int getP4() {
391 return p4;
392 }
393
394 /**
395 * Set the GLONASS P4 Word.
396 * @param p4 the GLONASS P4 Word to set
397 */
398 public void setP4(final int p4) {
399 this.p4 = p4;
400 }
401
402 /**
403 * Get the GLONASS F<sub>T</sub> Word.
404 * <p>
405 * It is a parameter that provides the predicted satellite user range accuracy
406 * at time {@link GLONASSNavigationMessage#getTime() tb}.
407 * </p>
408 * @return the GLONASS F<sub>T</sub> Word
409 */
410 public int getFT() {
411 return fT;
412 }
413
414 /**
415 * Set the GLONASS F<sub>T</sub> Word.
416 * @param word the word to set
417 */
418 public void setFT(final int word) {
419 this.fT = word;
420 }
421
422 /**
423 * Get the GLONASS M Word.
424 * <p>
425 * Word M represents the type of satellite transmitting navigation signal.
426 * "0" refers to GLONASS satellite, "1" refers to a GLONASS-M satellite.
427 * </p>
428 * @return the GLONASS M Word
429 */
430 public int getM() {
431 return m;
432 }
433
434 /**
435 * Set the GLONASS M Word.
436 * @param m the GLONASS M Word to set
437 */
438 public void setM(final int m) {
439 this.m = m;
440 }
441
442 /**
443 * Get the flag indicating if additional parameters are in the message.
444 * @return true if additional parameters are in the message
445 */
446 public boolean areAdditionalDataAvailable() {
447 return areAdditionalDataAvailable;
448 }
449
450 /**
451 * Set the flag indicating if additional parameters are in the message.
452 * @param areAdditionalDataAvailable true if additional parameters are in the message
453 */
454 public void setAreAdditionalDataAvailable(final boolean areAdditionalDataAvailable) {
455 this.areAdditionalDataAvailable = areAdditionalDataAvailable;
456 }
457
458 /**
459 * Get the GLONASS N<sup>A</sup> Word.
460 * <p>
461 * It is the calendar day number within the four-year period beginning since
462 * the leap year. It is used for almanac data.
463 * </p>
464 * @return the GLONASS N<sup>A</sup> Word
465 */
466 public int getNA() {
467 return nA;
468 }
469
470 /**
471 * Set the GLONASS N<sup>A</sup> Word.
472 * @param word the word to set
473 */
474 public void setNA(final int word) {
475 this.nA = word;
476 }
477
478 /**
479 * Get the GLONASS time scale correction to UTC time.
480 * @return the GLONASS time scale correction to UTC time in seconds
481 */
482 public double getTauC() {
483 return tauC;
484 }
485
486 /**
487 * Set the GLONASS time scale correction to UTC time.
488 * @param tauC the value to set in seconds.
489 */
490 public void setTauC(final double tauC) {
491 this.tauC = tauC;
492 }
493
494 /**
495 * Get the correction to GPS time relative to GLONASS time.
496 * @return the correction to GPS time relative to GLONASS time in seconds
497 */
498 public double getTauGps() {
499 return tauGps;
500 }
501
502 /**
503 * Set the correction to GPS time relative to GLONASS time.
504 * @param tauGps the value to set in seconds
505 */
506 public void setTauGps(final double tauGps) {
507 this.tauGps = tauGps;
508 }
509
510 /**
511 * Get the GLONASS l<sub>n</sub> Word extracted from fifth string of the subframe.
512 * @return the GLONASS l<sub>n</sub> (fifth string)
513 */
514 public int getLNFifthString() {
515 return lNFifthString;
516 }
517
518 /**
519 * Set the GLONASS l<sub>n</sub> Word extracted from fifth string of the subframe.
520 * @param word the word to set
521 */
522 public void setLNFifthString(final int word) {
523 this.lNFifthString = word;
524 }
525
526 }