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