-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRinexData.cpp
More file actions
4173 lines (4065 loc) · 184 KB
/
RinexData.cpp
File metadata and controls
4173 lines (4065 loc) · 184 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/** @file RinexData.cpp
* Contains the implementation of the RinexData class.
*/
#include "RinexData.h"
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <cstdio>
//from CommonClasses
#include "Utilities.h"
/**RinexData constructor providing only the minimum data required: the RINEX file version to be generated.
*
* Version parameter is needed in the header record RINEX VERSION / TYPE: which is mandatory in any RINEX file. Note that version
* affects the header records that must / can be printed in the RINEX header, and the format of epoch observation data.
* <p>A VTBD in version means that it will be defined in a further step of the process.
* <p>Logging data are sent to the stderr.
*
* @param ver the RINEX version to be generated
*/
RinexData::RinexData(RINEXversion ver) {
plog = new Logger();
dynamicLog = true;
setDefValues(ver, plog);
}
/**RinexData constructor providing the RINEX file version to be generated and the Logger for logging messages.
*
* Version parameter is needed in the header record RINEX VERSION / TYPE, which is mandatory in any RINEX file. Note that version
* affects the header records that must / can be printed in the RINEX header, and the format of epoch observation data.
* <p>A VTBD in version means that it will be defined in a further step of the process.
*
* @param ver the RINEX version to be generated
* @param plogger a pointer to a Logger to be used to record logging messages
*/
RinexData::RinexData(RINEXversion ver, Logger* plogger) {
dynamicLog = false;
setDefValues(ver, plogger);
}
/**RinexData constructor providing data on RINEX version to be generated, the program being used, and who is running the program.
*
* Version parameter is needed in the header record RINEX VERSION / TYPE, which is mandatory in any RINEX file. Note that version
* affects the header records that must / can be printed in the RINEX header, and the format of epoch observation data.
* <p>A VTBD in version means that it will be defined in a further step of the process.
* <p>Also data is passed for the recod PGM / RUN BY / DATE.
* <p>Logging data are sent to the stderr.
*
* @param ver the RINEX version to be generated. (V210, V304, TBD)
* @param prg the program used to create the RINEX file
* @param rby who executed the program (run by)
*/
RinexData::RinexData(RINEXversion ver, string prg, string rby) {
plog = new Logger();
dynamicLog = true;
setDefValues(ver, plog);
//assign values to class data members from arguments passed
pgm = prg;
runby = rby;
setLabelFlag(RUNBY);
}
/**RinexData constructor providing data on RINEX version to be generated, the program being used, who is running the program, and the Logger for logging messages.
*
* Version parameter is needed in the header record RINEX VERSION / TYPE, which is mandatory in any RINEX file. Note that version
* affects the header records that must / can be printed in the RINEX header, and the format of epoch observation data.
* <p>A VTBD in version means that it will be defined in a further step of the process.
* <p>Also data is passed for the recod PGM / RUN BY / DATE.
*
* @param ver the RINEX version to be generated. (V210, V304, TBD)
* @param prg the program used to create the RINEX file
* @param rby who executed the program (run by)
* @param plogger a pointer to a Logger to be used to record logging messages
*/
RinexData::RinexData(RINEXversion ver, string prg, string rby, Logger* plogger) {
dynamicLog = false;
setDefValues(ver, plogger);
//assign values to class data members from arguments passed
pgm = prg;
runby = rby;
setLabelFlag(RUNBY);
}
/**Destructor.
*/
RinexData::~RinexData(void) {
if (dynamicLog) delete plog;
}
//PUBLIC METHODS
///a macro to assign in setHdLnData the value of the method parameter a to the given member
#define SET_1PARAM(LABEL_rl, FROM_PARAM_a) \
FROM_PARAM_a = a; \
setLabelFlag(LABEL_rl); \
return true;
///a macro to assign in setHdLnData the value of the method parameters a and b to the given members
#define SET_2PARAM(LABEL_rl, FROM_PARAM_a, FROM_PARAM_b) \
FROM_PARAM_a = a; \
FROM_PARAM_b = b; \
setLabelFlag(LABEL_rl); \
return true;
///a macro to assign in setHdLnData the value of the method parameters a, b and c to the given members
#define SET_3PARAM(LABEL_rl, FROM_PARAM_a, FROM_PARAM_b, FROM_PARAM_c) \
FROM_PARAM_a = a; \
FROM_PARAM_b = b; \
FROM_PARAM_c = c; \
setLabelFlag(LABEL_rl); \
return true;
///a macro to assign in setHdLnData the value of the method not-null string parameters a and b to the given members
#define SET_2STRPARAM(LABEL_rl, FROM_PARAM_a, FROM_PARAM_b) \
if (a.length() != 0) FROM_PARAM_a = a; \
if (b.length() != 0) FROM_PARAM_b = b; \
setLabelFlag(LABEL_rl); \
return true;
///a macro to assign in setHdLnData the value of the method not-null string parameters a, b and c to the given members
#define SET_3STRPARAM(LABEL_rl, FROM_PARAM_a, FROM_PARAM_b, FROM_PARAM_c) \
if (a.length() != 0) FROM_PARAM_a = a; \
if (b.length() != 0) FROM_PARAM_b = b; \
if (c.length() != 0) FROM_PARAM_c = c; \
setLabelFlag(LABEL_rl); \
return true;
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier values in this overload can be:
* - COMM: to set a comment record content to be inserted in the RINEX header just before a given record.
* The comment will be inserted before the first match of the the given record identifier in param a.
* If no match occurs, comment is inserted just before the "END OF HEADER" record.
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a is the label identifier stating the position for comment insertion
* @param b the comment to be inserted
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, RINEXlabel a, const string &b) {
switch(rl) {
case COMM:
for (vector<LABELdata>::iterator it = labelDef.begin() ; it != labelDef.end(); ++it)
if((it->labelID == a) || (it->labelID == EOH)) {
lastRecordSet = labelDef.insert(it, LABELdata(b));
return true;
}
return false;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier value can be:
* - IONA: to set in RINEX GPS navigation header ionosphere parameters for the ION ALPHA (V2) record.
* For this record, the meaning of the parameters will be:
* - a: ignored. It is set to IONC_GPSA
* - b: Ionosphere parameters [0-3] A0-A3
* - c: TOW for time mark
* - d: satellite identifier
* - IONB: to set in RINEX GPS navigation header ionosphere parameters for the ION BETA (V2) record.
* For this record, the meaning of the parameters will be:
* - a: ignored. It is set to IONC_GPSB
* - b: Ionosphere parameters [0-3] B0-B3
* - c: TOW for time mark
* - d: satellite identifier
* - IONC: to set in RINEX GNSS navigation header ionosphere parameters for the IONOSPHERIC CORR (V3) record.
* For this record, the meaning of the parameters will be:
* - a: the label identifier of the correction type (IONC_GAL, IONC_GPSA, IONC_GPSB, ... IONC_IRNB)
* - b: Ionosphere parameters [0-3] as per the correction type
* - c: TOW for time mark
* - d: satellite identifier
* - DUTC: to set in RINEX GPS navigation header time correction parameters for the DELTA-UTC: A0,A1,T,W (V2 record)
* For this record, the meaning of the parameters will be:
* - a: Ignored. It is equivalent to set it to TIMC_GPUT
* - b: Delta UTC parameters [0-1] A0,A1, [2] TOW for time mark, [3] week number for the time mark
* - c: id UTC source
* - d: id satellite number
* - CORRT: to set in RINEX GLONASS navigation header time correction parameters for the CORR TO SYSTEM TIME (V2 record)
* For this record, the meaning of the parameters will be:
* - a: Ignored. It is equivalent to set it to TIMC_GLUT
* - b: correction values [0] -TauC, [1] 0, [2] TOW for time mark, [3] week number for the time mark
* - c: id UTC source
* - d: id satellite number
* - GDUTC: to set in RINEX GEO navigation header time correction parameters for the D-UTC A0,A1,T,W,S,U (V2 record)
* For this record, the meaning of the parameters will be:
* - a: Ignored. It is equivalent to set it to TIMC_SBUT
* - b: D-UTC parameters [0-1] A0,A1, [2] TOW for time mark, [3] week number for the time mark
* - c: id UTC source
* - d: id satellite number
* - TIMC: to set in RINEX GNSS navigation header time correction parameters for the TIME SYSTEM CORR (V3 record.
* For this record, the meaning of the parameters will be:
* - a: the label identifier of the correction type (TIMC_GPUT, TIMC_GLUT, ... TIMC_IRGP)
* - b: Corrections: [0-1] coefficients a0-a1 as per the correction type, [2] TOW for time mark, [3] week number for the time mark
* - c: id UTC source
* - d: id satellite number
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a meaning depends on the label identifier
* @param b meaning depends on the label identifier
* @param c meaning depends on the label identifier
* @param d identification satellite number
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, RINEXlabel a, const double (&b)[4], int c, int d) {
//ignore corrections with values zero
bool empty = true;
for (int i = 0; empty && i < 4; ++i) empty = b[i] == 0.0;
if (empty) return false;
//convert V2 labels to equivalent V3 ones
switch (rl) {
case IONA: //GPS iono alpha
rl = IONC;
a = IONC_GPSA;
setLabelFlag(IONA);
break;
case IONB: //GPS iono beta
rl = IONC;
a = IONC_GPSB;
setLabelFlag(IONB);
break;
case DUTC: //GPS UTC correction
rl = TIMC;
a = TIMC_GPUT;
setLabelFlag(DUTC);
break;
case CORRT: //GLONASS UTC correction
rl = TIMC;
a = TIMC_GLUT;
setLabelFlag(CORRT);
break;
case GEOT: //GEO UTC correction
rl = TIMC;
a = TIMC_SBUT;
setLabelFlag(GEOT);
break;
default:
break;
}
switch(rl) {
case IONC:
case TIMC:
//check if these data have been already stored
for (vector<CORRECTION>::iterator it = corrections.begin(); it != corrections.end(); it++) {
if ((it->corrType == a)
&& (it->corrValues[0] == b[0])
&& (it->corrValues[1] == b[1])
&& (it->corrValues[2] == b[2])
&& (it->corrValues[3] == b[3])) return false;
}
corrections.push_back(CORRECTION(a, b, c, d));
setLabelFlag(rl);
return true;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier values in this overload can be:
* - TOFO: to set the current epoch time (week and TOW) as the fist observation time. Data to be included in record TIME OF FIRST OBS
* - TOLO: to set the current epoch time (week and TOW) as the last observation time. Data to be included in record TIME OF LAST OBS
*
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a is the system identifier (ignored if rl is TOLO)
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, char a) {
switch(rl) {
case TOFO:
firstObsWeek = epochWeek;
firstObsTOW = epochTOW;
obsTimeSys = a;
setLabelFlag(TOFO);
return true;
case TOLO:
lastObsWeek = epochWeek;
lastObsTOW = epochTOW;
setLabelFlag(TOLO);
return true;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier value in this overload can be:
* - PRNOBS: to set in RINEX header data for record PRN / # OF OBS. Note that number of observables for each
* observation type (param c vector) shall be in the same order as per observable types for this system in the
* "# / TYPES OF OBSERV" or "SYS / # / OBS TYPES".
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a the system the prn satellite belongs
* @param b the prn number of the satellite
* @param c a vector with the number of observables for each observable type
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, char a, int b, const vector<int> &c) {
switch(rl) {
case PRNOBS:
prnObsNum.push_back(PRNobsnum(a, b, c));
setLabelFlag(PRNOBS);
return true;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier value in this overload can be:
* - SCALE: to set in RINEX header data for the scale factors used in the observable data. Data to be included in record SYS / SCALE FACTOR.
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a the system identifier
* @param b a factor to divide stored observables before use (1,10,100,1000)
* @param c the list of observable types involved. If vector is empty, all observable types are involved
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, char a, int b, const vector<string> &c) {
int n;
switch(rl) {
case SCALE:
if ((n = systemIndex(a)) < 0) return false;
obsScaleFact.push_back(OSCALEfact(n, b, c));
setLabelFlag(SCALE);
return true;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier value in this overload can be:
* - ANTPHC: to set in RINEX header the average phase center position w/r to antenna reference point (m). Data to be included in record ANTENNA: PHASECENTER.
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a the system identifier
* @param b the observable code
* @param c the North (fixed station) or X coordinate in body-fixed coordinate system (vehicle)
* @param d the East (fixed station) or Y coordinate in body-fixed coordinate system (vehicle)
* @param e the Up (fixed station) or Z coordinate in body-fixed coordinate system (vehicle)
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, char a, const string &b, double c, double d, double e) {
switch(rl) {
case ANTPHC:
antPhEoY = d;
antPhUoZ = e;
SET_3PARAM(ANTPHC, antPhSys, antPhCode, antPhNoX)
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier value in this overload can be:
* - PHPS: to set in RINEX header the phase shift correction used to generate phases consistent w/r to cycle shifts.
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a the system identifier
* @param b the observable code
* @param c the correction applied in cycles
* @param d the list of satellites (Snn)
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, char a, const string &b, double c, const vector<string> &d) {
int sysInx;
switch(rl) {
case PHSH:
if ((sysInx = systemIndex(a)) >= 0) {
phshCorrection.push_back(PHSHcorr(sysInx, b, c, d));
setLabelFlag(PHSH);
} else return false;
break;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
return true;
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier value in this overload can be:
* - DCBS: to set in RINEX header data for corrections of differential code biases (DCBS). Data to be included in record SYS / DCBS APPLIED.
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a the system (G/R/E/S) observable belongs
* @param b the program name used to apply corrections
* @param c the source of corrections
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, char a, const string &b, const string &c) {
int n;
switch(rl) {
case DCBS:
if ((n = systemIndex(a)) < 0) return false;
dcbsApp.push_back(DCBSPCVSapp(n, b, c));
setLabelFlag(DCBS);
return true;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier values in this overload can be:
* - SYS: to set data for the given system as required in "SYS / # / OBS TYPES" records
* - TOBS: to set data for the given system as required in "# / TYPES OF OBSERV" record
* <p> Note that arguments use notation according to RINEX V304 for system identification and observable types.
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a the system identification: G (GPS), R (GLONASS), S (SBAS), E (Galileo), ...
* @param b a vector with identifiers for each observable type (C1C, L1C, D1C, S1C...) contained in epoch data for this system
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, char a, vector<string> &b) {
int sysIndex;
bool isNew;
switch(rl) {
case SYS:
case TOBS:
sysIndex = systemIndex(a);
if (sysIndex < 0) {
//a new system and its observables is inserted
systems.push_back(GNSSsystem(a, b));
setLabelFlag(SYS);
setLabelFlag(TOBS);
} else {
//the system already exists, insert the new observables
for (vector<string>::iterator itNewObs = b.begin(); itNewObs != b.end(); itNewObs++) {
isNew = true;
for (vector<OBSmeta>::iterator itObs = systems[sysIndex].obsTypes.begin(); itObs != systems[sysIndex].obsTypes.end(); itObs++) {
if ((*itNewObs).compare(itObs->id) == 0) {
isNew = false;
break;
}
}
if (isNew) {
systems[sysIndex].obsTypes.push_back(OBSmeta(*itNewObs, true, false));
}
}
}
return true;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier values in this overload can be:
* - ANTZDAZI: to set the azimuth of the zero-direction of a fixed antenna (degrees in param a, from north). Data to be included in record ANTENNA: ZERODIR AZI.
* - INT: to set in RINEX header the time interval of measurements (in param a), that is, the time interval in seconds between two consecutive epochs
* - ANTHEN: to set antenna data for record "ANTENNA: DELTA H/E/N". Param a is the height of the antenna reference point (ARP) above the marker. Param b is
* the antenna horizontal eccentricity of ARP relative to the marker east. Param c is the antenna horizontal eccentricity of ARP relative to the marker north.
* - APPXYZ: to set APROX POSITION record data for this RINEX file header. Params a, b an c are respectively the X, Y and Z oordinates of the position.
* - ANTXYZ: to set in RINEX header the position of antenna reference point for antenna on vehicle (m). Data to be included in record ANTENNA: DELTA X/Y/Z.
* Params a, b an c are respectively the X, Y and Z oordinates of the position in body-fixed coordinate system.
* - ANTBS: to set in RINEX header the direction of the �vertical� antenna axis towards the GNSS satellites. Data to be included in record ANTENNA: B.SIGHT XYZ.
* Params a, b an c are respectively the X, Y and Z oordinates in body-fixed coordinate system.
* - ANTZDXYZ: to set in RINEX header the zero-direction of antenna antenna on vehicle. Data to be included in record ANTENNA: ZERODIR XYZ.
* Params a, b an c are respectively the X, Y and Z oordinates in body-fixed coordinate system.
* - COFM: to set in RINEX header the current center of mass (X,Y,Z, meters) of vehicle in body-fixed coordinate system. Data to be included in record CENTER OF MASS: XYZ.
* Params a, b an c are respectively the X, Y and Z oordinates in body-fixed coordinate system.
* - VERSION : to set the RINEX version to be generated. Param a is the version to be generated: V210 if 2.0 < a, V304 if 3.0 < a, VTBD otherwise.
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a meaning depends on the label identifier
* @param b meaning depends on the label identifier
* @param c meaning depends on the label identifier
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, double a, double b, double c) {
switch(rl) {
case ANTZDAZI:
SET_1PARAM(ANTZDAZI, antZdAzi)
case INT:
SET_1PARAM(INT, obsInterval)
case ANTHEN:
SET_3PARAM(ANTHEN, antHigh, eccEast, eccNorth)
case APPXYZ:
SET_3PARAM(APPXYZ, aproxX, aproxY, aproxZ)
case ANTXYZ:
SET_3PARAM(ANTXYZ, antX, antY, antZ)
case ANTBS:
SET_3PARAM(ANTBS, antBoreX, antBoreY, antBoreZ)
case ANTZDXYZ:
SET_3PARAM(ANTZDXYZ, antZdX, antZdY, antZdZ)
case COFM:
SET_3PARAM(COFM, centerX, centerY, centerZ)
case VERSION:
version = VTBD;
if (a > 2.0) version = V210;
if (a > 3.0) version = V304;
return true;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier values in this overload can be:
* - CLKOFFS to set in RINEX header if the realtime-derived receiver clock offset is applied or not (value in param a).
* Data to be included in record RCV CLOCK OFFS APPL.
* Params b to e are ignored.
* - LEAP to set in RINEX header the number of leap seconds, being:
* a: value of leap seconds
* b: Future or past leap seconds ΔtLSF
* c: Respective week number WN_LSF
* d: Respective day number DN
* e: Time system identifier
* - SATS to set in RINEX header the number of satellites for which observables are stored in the file.
* a: the number of satellites, to be included in record # OF SATELLITES.
* Params b to e are ignored.
* - WVLEN to set WAVELENGTH FACT L1/2 default record data for GPS Observation RINEX file header.
* a: the wave length factor for L1
* b: the wave length factor for L2
* Params c to e are ignored.
* - GLSLT to set Glonas slot data for record "GLONASS SLOT / FRQ #" (in version V304):
* a: the slot number
* b: the corresponding frequency numbers (-7...+6)
* Params c to e are ignored.
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a meaning depends on the label identifier
* @param b meaning depends on the label identifier
* @param c meaning depends on the label identifier
* @param d meaning depends on the label identifier
* @param e meaning depends on the label identifier
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, int a, int b, int c, int d, char e) {
switch(rl) {
case CLKOFFS:
SET_1PARAM(CLKOFFS, rcvClkOffs)
case LEAP:
if (e == ' ') e = 'G'; //by default GPS
for (vector<LEAPsecs>::iterator it = leapSecs.begin(); it != leapSecs.end(); it++) {
//check if values already set
if ((it->sysId == e)
&& (it->secs == a)
&& (it->deltaLSF == b)
&& (it->weekLSF == c)
&& (it->dayLSF == d)) return false;
}
leapSecs.push_back(LEAPsecs(a, b, c, d, e));
setLabelFlag(LEAP);
return true;
case SATS:
SET_1PARAM(SATS, numOfSat)
case WVLEN:
if (wvlenFactor.empty()) wvlenFactor.push_back(WVLNfactor(a, b)); //insert default record
else if (wvlenFactor[0].satNums.empty()) { //replace current values of factors
wvlenFactor[0].wvlenFactorL1 = a;
wvlenFactor[0].wvlenFactorL2 = b;
} else { //insert the default values in the first position
wvlenFactor.insert(wvlenFactor.begin(), WVLNfactor(a, b));
}
setLabelFlag(WVLEN);
return true;
case GLSLT:
gloSltFrq.push_back(GLSLTfrq(a,b));
setLabelFlag(GLSLT);
return true;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier value in this overload can be:
* - WVLEN to set optional WAVELENGTH FACT L1/2 records data for the RINEX file header.
* Note that those optional records are for RINEX V2.1 files only.
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a the wave length factor for L1
* @param b the wave length factor for L2
* @param c vector with the identification (system + PRNs) of a satellite in each element the factor will apply
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, int a, int b, const vector<string> &c) {
switch(rl) {
case WVLEN:
wvlenFactor.push_back(WVLNfactor(a, b, c));
setLabelFlag(WVLEN);
return true;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
*
* The label identifier values in this overload can be:
* - RECEIVER: to set GNSS receiver data for the "REC # / TYPE / VERS" obligatory records in the RINEX file header.
* Param a is the receiver number, param b is the receiver type, and param c the receiver version.
* - AGENCY: to set OBSERVER / AGENCY record data of the RINEX file header.
* Param a is the observer name, and param b the agency name. Param c is ignored.
* - ANTTYPE: to set antenna data for "ANT # / TYPE" record in the RINEX file header.
* Param a is the antenna number, and param b the antenna type. Param c is ignored.
* - RUNBY: to set data on program and who executed it for record "PGM / RUN BY / DATE" in the RINEX file header.
* Param a is program used to create current file, and param b who executed the program. Param c is ignored.
* - SIGU: to set in RINEX header the unit of the signal strength observables Snn (if present). Data to be included in record SIGNAL STRENGTH UNIT.
* Param a is the unit of the signal strength. Params b and c are ignored.
* - MRKNAME: to set MARKER data for the RINEX file header. Data to be included in MARKER NAME
* Param a is the marker name. Params b and c are ignored.
* - MRKNUMBER: to set marker data for the RINEX file header. Data to be included in MARKER NUMBER
* Param a is the marker number. Params b and c are ignored.
* - MRKTYPE: to set marker data for the RINEX file header. Data to be included in MARKER TYPE records.
* Param a is the marker type. Params b and c are ignored.
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a meaning depends on the label identifier
* @param b meaning depends on the label identifier
* @param c meaning depends on the label identifier
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, const string &a, const string &b, const string &c) {
switch(rl) {
case RECEIVER:
SET_3STRPARAM(RECEIVER, rxNumber, rxType, rxVersion);
case AGENCY:
SET_2STRPARAM(AGENCY, observer, agency)
case ANTTYPE:
SET_2PARAM(ANTTYPE, antNumber, antType)
case RUNBY:
SET_3STRPARAM(RUNBY, pgm, runby, date)
case SIGU:
SET_1PARAM(SIGU, signalUnit)
case MRKNAME:
SET_1PARAM(MRKNAME, markerName)
case MRKNUMBER:
SET_1PARAM(MRKNUMBER, markerNumber)
case MRKTYPE:
SET_1PARAM(MRKTYPE, markerType)
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**setHdLnData sets data values for RINEX file header records
* The label identifier value in this overload can be:
* - GLPHS to set GLONASS phase bias correction used to align code and phase observations
* The meaning of parameters for this case hare:
* a the GLONASS signal identifier (C1C, C1P, C2C, C2P)
* b the code phase bias correction
*
* @param rl the label identifier of the RINEX header record/line data values are for
* @param a meaning depends on the label identifier
* @param b meaning depends on the label identifier
* @return true if header values have been set, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::setHdLnData(RINEXlabel rl, const string &a, double b) {
switch(rl) {
case GLPHS:
gloPhsBias.push_back(GLPHSbias(a, b));
setLabelFlag(GLPHS);
return true;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
#undef SET_1PARAM
#undef SET_2PARAM
#undef SET_3PARAM
///a macro to assign in getHdLnData the value of the given member to the method parameter a
#define GET_1PARAM(LABEL_rl, TO_PARAM_a) \
a = TO_PARAM_a; \
return getLabelFlag(LABEL_rl);
///a macro to assing the values of the given members to the method parameters a and b
#define GET_2PARAM(LABEL_rl, TO_PARAM_a, TO_PARAM_b) \
a = TO_PARAM_a; \
b = TO_PARAM_b; \
return getLabelFlag(LABEL_rl);
///a macro to assing the values of the given members to the method parameters a, b and c
#define GET_3PARAM(LABEL_rl, TO_PARAM_a, TO_PARAM_b, TO_PARAM_c) \
a = TO_PARAM_a; \
b = TO_PARAM_b; \
c = TO_PARAM_c; \
return getLabelFlag(LABEL_rl);
///a macro to assing the values of the given members to the method parameters a, b, c and d
#define GET_4PARAM(LABEL_rl, TO_PARAM_a, TO_PARAM_b, TO_PARAM_c, TO_PARAM_d) \
a = TO_PARAM_a; \
b = TO_PARAM_b; \
c = TO_PARAM_c; \
d = TO_PARAM_d; \
return getLabelFlag(LABEL_rl);
/**getHdLnData gets data values related to line header records previously stored in the class object
*
* The label identifier values in this overload can be:
* - TOFO: to get the epoch week and TOW of the fist observation time.
* - TOLO: to get the epoch week and TOW of the last observation time.
* <p> Values returned in parameters are undefined when method returns false.
*
* @param rl the label identifier of the RINEX header record/line data to be extracted
* @param a is the GNSS week number
* @param b is the GNSS time of week (TOW)
* @param c is the system identifier of the time system
* @return true if header values have been got, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::getHdLnData(RINEXlabel rl, int &a, double &b, char &c) {
switch(rl) {
case TOFO:
GET_3PARAM(TOFO, firstObsWeek, firstObsTOW, obsTimeSys)
case TOLO:
GET_3PARAM(TOLO, lastObsWeek, lastObsTOW, obsTimeSys)
default:
throw errorLabelMis + idTOlbl(rl) + msgGetHdLn;
}
}
/**getHdLnData gets data values related to line header records previously stored in the class object
*
* The label identifier values in this overload can be:
* - IONC (V3) to get from RINEX nav header ionospheric corrections of the type indicated
* - IONA, (V2) a synonim for IONC correction of type IONC_GPSA (V3)
* - IONB, (V2) a synonim for IONC correction of type IONC_GPSB (V3) corrections
* - TIMC (V3) to get from RINEX nav header time corrections of the type indicated
* - DUTC, (V2) a synonim for TIMC correction of type TIMC_GPUT (V3)
* - CORRT, (V2) a synonim for TIMC correction of type TIMC_GLUT (V3) corrections
* - GEOT, (V2) a synonim for TIMC correction of type TIMC_SBUT (V3) corrections
* This method extracts from the vector containing all correction the one of the type indicated placed in
* position "index" (index values are from 0, 1, 2, ... for the first, second, third, ...) of the sequence
* of corrections of the given type.
* <p> Values returned in parameters are undefined when method returns false.
*
* @param rl the label identifier of the RINEX header record/line data to be extracted
* @param a the correction type: IONC_GAL, IONC_GPSA, IONC_GPSB, IONC_QZSA, IONC_QZSB, IONC_BDSA, IONC_BDSB, IONC_IRNA, IONC_IRNB or NOLABEL
* @param b the iono parameters or the time coeficients and reference
* @param c the time mark for iono or UTC source id for time corrections
* @param d the satellite number being source of data
* @param index the position in the sequence of iono corrections records to get
* @return true if header values have been got, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::getHdLnData(RINEXlabel rl, RINEXlabel &a, double (&b)[4], int &c, int &d, unsigned int index) {
int order = -1;
if (!getLabelFlag(rl)) return false;
//convert V2 labels to equivalent V3 ones
switch (rl) {
case IONA: //GPS iono alpha
rl = IONC;
a = IONC_GPSA;
break;
case IONB: //GPS iono beta
rl = IONC;
a = IONC_GPSB;
break;
case DUTC: //GPS UTC correction
rl = TIMC;
a = TIMC_GPUT;
break;
case CORRT: //GLONASS UTC correction
rl = TIMC;
a = TIMC_GLUT;
break;
case GEOT: //GEO UTC correction
rl = TIMC;
a = TIMC_SBUT;
break;
default:
break;
}
switch(rl) {
case IONC:
//check if data requested exists; index is here the position in the list of a given type position
for (vector<CORRECTION>::iterator it = corrections.begin(); it != corrections.end(); it++) {
if ((it->corrType == a) || (a == NOLABEL)) order++;
if (order == index) {
a = it->corrType;
for (int i = 0; i < 4; ++i) b[i] = it->corrValues[i];
c = (int) it->corrValues[4];
d = (int) it->corrValues[5];
return true;
}
}
return false;
default:
throw errorLabelMis + idTOlbl(rl) + msgSetHdLn;
}
}
/**getHdLnData gets data values related to line header records previously stored in the class object
*
* The label identifier values in this overload can be:
* - COMM to get from RINEX header the index-nd COMMENT data.
*<p>Values returned in parameters are undefined when method returns false.
*
* @param rl the label identifier of the RINEX header record/line data to be extracted
* @param a is the label identifier in the position following the comment
* @param b the comment contents
* @param index the position of the comment in the sequence of COMMENT records in the header.
* @return true if header values have been got, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::getHdLnData(RINEXlabel rl, RINEXlabel &a, string &b, unsigned int index) {
switch(rl) {
case COMM:
for (vector<LABELdata>::iterator it = labelDef.begin() ; it != labelDef.end(); ++it) {
if(it->labelID == EOH) return false;
if(it->hasData && (it->labelID == COMM)) {
if (index == 0) {
b = it->comment;
it++;
a = it->labelID;
return true;
} else index--;
}
}
return false;
default:
throw errorLabelMis + idTOlbl(rl) + msgGetHdLn;
}
}
/**getHdLnData gets data values related to line header records previously stored in the class object
*
* The label identifier values in this overload can be:
* - PRNOBS to get from RINEX header the record data in index position of PRN / # OF OBS records.
* <p> Values returned in parameters are undefined when method returns false.
*
* @param rl the label identifier of the RINEX header record/line data to be extracted
* @param a the system the satellite prn belongs
* @param b the prn number of the satellite
* @param c the number of observables for each observable type
* @param index the position in the sequence of PRN / # OF OBS records to get.
* @return true if header values have been got, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::getHdLnData(RINEXlabel rl, char &a, int &b, vector <int> &c, unsigned int index) {
switch(rl) {
case PRNOBS:
if (index < prnObsNum.size()) {
GET_3PARAM(PRNOBS, prnObsNum[index].sysPrn, prnObsNum[index].satPrn, prnObsNum[index].obsNum)
}
return false;
default:
throw errorLabelMis + idTOlbl(rl) + msgGetHdLn;
}
}
/**getHdLnData gets data values related to line header records previously stored in the class object
*
* The label identifier values in this overload can be:
* - SCALE to get from RINEX header data the scale factor in index position of SYS / SCALE FACTOR records. Meaning of parametes is:
* a: is the system this scale factor has been applied,
* b: is a factor to divide stored observables with (1,10,100,1000),
* c: is the list of observable types involved. If vector is empty, all observable types are involved.
* index: is the position in the sequence of SYS / SCALE FACTOR records to get.
* <p> Values returned in parameters are undefined when method returns false.
*
* @param rl the label identifier of the RINEX header record/line data to be extracted
* @param a meaning depends on the label identifier
* @param b meaning depends on the label identifier
* @param c meaning depends on the label identifier
* @param index the position in the sequence of records the one to be extracted
* @return true if header values have been got, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::getHdLnData(RINEXlabel rl, char &a, int &b, vector <string> &c, unsigned int index) {
switch(rl) {
case SCALE:
if (index < obsScaleFact.size()) {
GET_3PARAM(SCALE, systems[obsScaleFact[index].sysIndex].system, obsScaleFact[index].factor, obsScaleFact[index].obsType)
}
return false;
default:
throw errorLabelMis + idTOlbl(rl) + msgGetHdLn;
}
}
/**getHdLnData gets data values related to line header records previously stored in the class object
*
* The label identifier values in this overload can be:
* - ANTPHC to get from RINEX header the average phase center position w/r to antenna reference point, which are included in ANTENNA: PHASECENTER. record.
* <p> Values returned in parameters are undefined when method returns false.
*
* @param rl the label identifier of the RINEX header record/line data to be extracted
* @param a the system the satellite prn belongs
* @param b the observable code
* @param c the North (fixed station) or X coordinate in body-fixed coordinate system (vehicle)
* @param d the East (fixed station) or Y coordinate in body-fixed coordinate system (vehicle)
* @param e the Up (fixed station) or Z coordinate in body-fixed coordinate system (vehicle)
* @return true if header values have been got, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::getHdLnData(RINEXlabel rl, char &a, string &b, double &c, double &d, double &e) {
switch(rl) {
case ANTPHC:
e = antPhUoZ;
GET_4PARAM(ANTPHC, antPhSys, antPhCode, antPhNoX, antPhEoY)
default:
throw errorLabelMis + idTOlbl(rl) + msgGetHdLn;
}
}
/**getHdLnData gets data values related to line header records previously stored in the class object
*
* The label identifier values in this overload can be:
* - DCBS to get from RINEX header the record data in index position of SYS / DCBS APPLIED records.
* <p> Values returned in parameters are undefined when method returns false.
*
* @param rl the label identifier of the RINEX header record/line data to be extracted
* @param a the system the satellite prn belongs
* @param b the program name used to apply corrections
* @param c the source of corrections
* @param index the position in the sequence of SYS / DCBS APPLIED records to get.
* @return true if header values have been got, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::getHdLnData(RINEXlabel rl, char &a, string &b, string &c, unsigned int index) {
switch(rl) {
case DCBS:
if (index < prnObsNum.size()) {
GET_3PARAM(PRNOBS, systems[dcbsApp[index].sysIndex].system, dcbsApp[index].corrProg, dcbsApp[index].corrSource)
}
return false;
default:
throw errorLabelMis + idTOlbl(rl) + msgGetHdLn;
}
}
/**getHdLnData gets data values related to line header records previously stored in the class object
*
* The label identifier values in this overload can be:
* - PHSH (PHASE SHIFTS) to get data from the given phshCorrection from "SYS / # / OBS TYPES" records
* <p> Values returned in parameters are undefined when method returns false.
*
* @param rl the label identifier of the RINEX header record/line data to be extracted
* @param a the system identification: G (GPS), R (GLONASS), S (SBAS), E (Galileo)
* @param b a vector with identifiers for each observable type (C1C, L1C, D1C, S1C...) contained in epoch data for this system
* @param c when PHSH, the Correction applied (cycles)
* @param d when PHSH, a vector with the list of satellites involved in the correction
* @param index the position in the sequence of "# / TYPES OF OBSERV" or "SYS / # / OBS TYPES" records to get
* @return true if header values have been got, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::getHdLnData(RINEXlabel rl, char &a, string &b, double &c, vector<string> &d, unsigned int index) {
vector<PHSHcorr>::iterator aPHSHit;
switch(rl) {
case PHSH:
if (index < phshCorrection.size()) {
aPHSHit = phshCorrection.begin() + index;
GET_4PARAM(SYS, systems[aPHSHit->sysIndex].system, aPHSHit->obsCode, aPHSHit->correction, aPHSHit->obsSats)
}
return false;
default:
throw errorLabelMis + idTOlbl(rl) + msgGetHdLn;
}
}
/**getHdLnData gets data values related to line header records previously stored in the class object
*
* The label identifier values in this overload can be:
* - SYS to get data from the given system index from "SYS / # / OBS TYPES" records
* - TOBS to get data from the given system index from "# / TYPES OF OBSERV" records
* <p> Values returned in parameters are undefined when method returns false.
*
* @param rl the label identifier of the RINEX header record/line data to be extracted
* @param a the system identification: G (GPS), R (GLONASS), S (SBAS), E (Galileo), ...
* @param b a vector with identifiers for each observable type (C1C, L1C, D1C, S1C...) contained in epoch data for this system
* @param index the position in the sequence of "# / TYPES OF OBSERV" or "SYS / # / OBS TYPES" records to get
* @return true if header values have been got, false otherwise
* @throws error message when the label identifier value does not match the allowed params for this overload
*/
bool RinexData::getHdLnData(RINEXlabel rl, char &a, vector <string> &b, unsigned int index) {
vector <string> aVectorStr;
switch(rl) {
case SYS:
case TOBS:
if (index < systems.size()) {
//fill the vector string with obsTypes identifiers selected
for(vector<OBSmeta>::iterator it = systems[index].obsTypes.begin(); it < systems[index].obsTypes.end(); it++)
if (it->sel) aVectorStr.push_back(it->id);
GET_2PARAM(SYS, systems[index].system, aVectorStr)
}