source: ntrip/trunk/clock_and_orbit/readRTCM3.cpp@ 6948

Last change on this file since 6948 was 6208, checked in by stuerze, 10 years ago

initial import of readRTCM3() that is able to read, decode and print mixed RTCM/SSR data sets

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Rev URL
  • Property svn:mime-type set to text/plain
File size: 22.1 KB
Line 
1/* Programheader
2 *
3 Name: readRTCM.cpp
4 Project: SSR test
5 Version: $Id: readRTCM3.cpp 6208 2014-09-25 14:39:00Z stuerze $
6 Description: reads, decodes and writes mixed RTCM SSR data sets
7 supported messages:
8 - System: part of 1013,
9 - Ephemeris Data: 1019, 1020,
10 - Orbit and Clock: 1057, 1058, 1061,1063, 1064, 1067
11 - Code Biases: 1059, 1065,
12 - Phase Biases: 1265, 1266,
13 - VTEC: 1264
14*/
15
16extern "C" {
17#include "clock_orbit_rtcm.h"
18#include "rtcm3torinex.h"
19}
20
21#include <math.h>
22#include <stdio.h>
23#include <string.h>
24#include <iostream>
25#include <iomanip>
26#include <fstream>
27#include <stdlib.h>
28#include <unistd.h>
29#include <vector>
30using namespace std;
31
32typedef enum {
33 GPS, GLO, GAL, QZSS, SBAS, BDS
34} SATSYS;
35int GPSUTCdiff = 16;
36/* prototype, don't use any of this code in a final application */
37void printClock(const char* filename, struct ClockOrbit* clockOrb, SATSYS sys,
38 char satSys, int offsetGnss);
39
40void printOrbit(const char* filename, struct ClockOrbit* clockOrb, SATSYS sys,
41 char satSys, int offsetGnss);
42
43void printUra(const char* filename, struct ClockOrbit* clockOrb, SATSYS sys,
44 char satSys, int offsetGnss);
45
46void printVtec(const char* filename, struct VTEC* vtec);
47
48void printCodeBias(const char* filename, struct CodeBias* codeBias, SATSYS sys,
49 char satSys, int offsetGnss);
50
51void printPhaseBias(const char* filename, struct PhaseBias* phaseBias, SATSYS sys,
52 char satSys, int offsetGnss);
53
54void printSystemParameters(const char* filename,
55 struct RTCM3ParserData* parser);
56
57void printTextMessageType(const char* filename, int messageType);
58
59void printGpsEph(const char* filename, struct gpsephemeris* ephemerisGPS);
60
61void printGlonassEph(const char* filename,
62 struct glonassephemeris* ephemerisGLO);
63
64void decodeFileContent(char* inputFile, char* outputFile);
65
66int main(void) {
67 char inFilename[124] = "ssr2_svpb_data/svpb224m.rtc";
68 char outFilename[124] = "ssr2_svpb_data/svpb224m_bkg.txt";
69 unlink(outFilename);
70 // Decode and save rtcm & ssr messages
71 decodeFileContent(inFilename, outFilename);
72 return 0;
73}
74
75void decodeFileContent(char* inputFile, char* outputFile) {
76 char obuffer[CLOCKORBIT_BUFFERSIZE];
77 long int offset = 0;
78 FILE * pFile = fopen(inputFile, "rb");
79 if (pFile == NULL) {
80 fputs("File error", stderr);
81 return;
82 }
83 while (1) {
84 RTCM3ParserData rtcm3Out; memset(&rtcm3Out, 0, sizeof(rtcm3Out));
85 ClockOrbit coOut; memset(&coOut, 0, sizeof(coOut));
86 CodeBias cbOut; memset(&cbOut, 0, sizeof(cbOut));
87 PhaseBias pbOut; memset(&pbOut, 0, sizeof(pbOut));
88 VTEC vtecOut; memset(&vtecOut, 0, sizeof(vtecOut));
89 fseek(pFile, offset, SEEK_SET);
90 int l = fread(obuffer, 1, CLOCKORBIT_BUFFERSIZE, pFile);
91 int bytesUsed = 0;
92 GCOB_RETURN nl = GetSSR(&coOut, &cbOut, &vtecOut, &pbOut, obuffer, l, &bytesUsed);
93 offset += bytesUsed;
94 if (nl <= -30) {
95 fprintf(stderr, "Not enough data. Error code: %d .\n", nl);
96 break;
97 } else if (nl < 0) {
98 fprintf(stderr, "GCOB_RETURN %d\nTry now RTCM3TORINEX\n", nl);
99 int z;
100 for (z = 0; z < bytesUsed; ++z) {
101 HandleByte(&rtcm3Out, (unsigned int) obuffer[z]);
102 }
103 fprintf(stderr, "RTCM message type: %d\n",rtcm3Out.blocktype);
104 switch (rtcm3Out.blocktype) {
105 case 1013:
106 printSystemParameters(outputFile, &rtcm3Out);
107 break;
108 case 1019:
109 printGpsEph(outputFile, &rtcm3Out.ephemerisGPS);
110 break;
111 case 1020:
112 printGlonassEph(outputFile, &rtcm3Out.ephemerisGLONASS);
113 break;
114 case 1029:// rtcm3torinex is unable to decode this type of RTCM message
115 printTextMessageType(outputFile, rtcm3Out.blocktype);
116 break;
117 case 1230:// rtcm3torinex is unable to decode this type of RTCM message
118 printTextMessageType(outputFile, rtcm3Out.blocktype);
119 }
120 } else if (nl == GCOBR_OK) {//fprintf(stderr, "GCOBR_OK\n");
121 switch (coOut.messageType) {
122 case 1057:
123 printOrbit(outputFile, &coOut, GPS, 'G',
124 CLOCKORBIT_OFFSETGPS);
125 break;
126 case 1058:
127 printClock(outputFile, &coOut, GPS, 'G',
128 CLOCKORBIT_OFFSETGPS);
129 break;
130 case 1061:
131 printUra(outputFile, &coOut, GPS, 'G',
132 CLOCKORBIT_OFFSETGPS);
133 break;
134 case 1063:
135 printOrbit(outputFile, &coOut, GLO, 'R',
136 CLOCKORBIT_OFFSETGLONASS);
137 break;
138 case 1064:
139 printClock(outputFile, &coOut, GLO, 'R',
140 CLOCKORBIT_OFFSETGLONASS);
141 break;
142 case 1067:
143 printUra(outputFile, &coOut, GLO, 'R',
144 CLOCKORBIT_OFFSETGLONASS);
145 break;
146 }
147 switch (cbOut.messageType) {
148 case 1059:
149 printCodeBias(outputFile, &cbOut, GPS, 'G',
150 CLOCKORBIT_OFFSETGPS);
151 break;
152 case 1065:
153 printCodeBias(outputFile, &cbOut, GLO, 'R',
154 CLOCKORBIT_OFFSETGLONASS);
155 break;
156 }
157 switch (pbOut.messageType) {
158 case 1265:
159 printPhaseBias(outputFile, &pbOut, GPS, 'G',
160 CLOCKORBIT_OFFSETGPS);
161 break;
162 case 1266:
163 printPhaseBias(outputFile, &pbOut, GLO, 'R',
164 CLOCKORBIT_OFFSETGLONASS);
165 break;
166 }
167 if (vtecOut.EpochTime) {
168 printVtec(outputFile, &vtecOut);
169 }
170 } else if (nl == GCOBR_MESSAGEFOLLOWS) {
171 fprintf(stderr, "GCOBR_MESSAGEFOLLOWS\n");
172 }
173 }
174}
175
176void printClock(const char* filename, struct ClockOrbit* clockOrb, SATSYS sys,
177 char satSys, int offsetGnss) {
178 int timeOffset = 0;
179 string datum[2] = { "ITRF", "LOCAL" };
180 FILE *filestream = fopen(filename, "ab+");
181 if (filestream == NULL) {
182 fprintf(stderr, "ERROR: open file %s\n", filename);
183 return;
184 }
185 switch (sys) {
186 case GPS:
187 fprintf(filestream,
188 "**RTCM 3 - SSR GPS Clock Message <%d>\nSystem:\t\t%10d (GPS)\nTime of week [s]:",
189 clockOrb->messageType, sys);
190 timeOffset = 0;
191 break;
192 case GLO:
193 fprintf(filestream,
194 "**RTCM 3 - SSR GLONASS Clock Message <%d>\nSystem:\t\t%10d (GLONASS)\nTime of day [s]:",
195 clockOrb->messageType, sys);
196 timeOffset = (GPSUTCdiff - 3 * 3600);
197 break;
198 }
199 fprintf(filestream,
200 "\t%10d\nUpdate Interval:\t%10d\nIOD SSR:\t\t%10d\n"
201 "ProviderId:\t\t%10d\nSolutionId:\t\t%10d\nNumber of Satellites:\t%10d\n"
202 "PRN A0[m] A1[mm/s] A2[mm/s^2]\n",
203 clockOrb->EpochTime[sys] + timeOffset, clockOrb->UpdateInterval,
204 clockOrb->SSRIOD, clockOrb->SSRProviderID, clockOrb->SSRSolutionID,
205 clockOrb->NumberOfSat[sys]);
206 unsigned int i = 0;
207 for (i = offsetGnss; i < offsetGnss + clockOrb->NumberOfSat[sys]; ++i) {
208 fprintf(filestream, "%c%02d %10.4f%10.3f%10.5f\n", satSys,
209 clockOrb->Sat[i].ID, clockOrb->Sat[i].Clock.DeltaA0,
210 clockOrb->Sat[i].Clock.DeltaA1 * 1.0E3,
211 clockOrb->Sat[i].Clock.DeltaA2 * 1.0E3);
212 }
213 fclose(filestream);
214 return;
215}
216
217void printOrbit(const char* filename, struct ClockOrbit* clockOrb, SATSYS sys,
218 char satSys, int offsetGnss) {
219 int timeOffset = 0;
220 string datum[2] = { "ITRF", "LOCAL" };
221 FILE *filestream = fopen(filename, "ab+");
222 if (filestream == NULL) {
223 fprintf(stderr, "ERROR: open file %s\n", filename);
224 return;
225 }
226 switch (sys) {
227 case GPS:
228 fprintf(filestream,
229 "**RTCM 3 - SSR GPS Orbit Message <%d>\nSystem:\t\t%10d (GPS)\nTime of week [s]:",
230 clockOrb->messageType, sys);
231 timeOffset = 0;
232 break;
233 case GLO:
234 fprintf(filestream,
235 "**RTCM 3 - SSR GLONASS Orbit Message <%d>\nSystem:\t\t%10d (GLONASS)\nTime of day [s]:",
236 clockOrb->messageType, sys);
237 timeOffset = (GPSUTCdiff - 3 * 3600);
238 break;
239 }
240 fprintf(filestream,
241 "\t%10d\nUpdate Interval:\t%10d\nIOD SSR:\t\t%10d\n"
242 "ProviderId:\t\t%10d\nSolutionId:\t\t%10d\nReference Datum:\t\t%s\nNumber of Satellites:\t%10d\n"
243 "PRN IOD Radial AlongTrk CrossTrk[m] DotDelta[mm/s]\n",
244 clockOrb->EpochTime[sys] + timeOffset, clockOrb->UpdateInterval,
245 clockOrb->SSRIOD, clockOrb->SSRProviderID, clockOrb->SSRSolutionID,
246 (datum[clockOrb->SatRefDatum]).c_str(), clockOrb->NumberOfSat[sys]);
247 unsigned int i = 0;
248 for (i = offsetGnss; i < offsetGnss + clockOrb->NumberOfSat[sys]; ++i) {
249 fprintf(filestream, "%c%02d %5d %10.4f%10.4f%10.4f%10.3f%10.3f%10.3f\n",
250 satSys, clockOrb->Sat[i].ID, clockOrb->Sat[i].IOD,
251 clockOrb->Sat[i].Orbit.DeltaRadial,
252 clockOrb->Sat[i].Orbit.DeltaAlongTrack,
253 clockOrb->Sat[i].Orbit.DeltaCrossTrack,
254 clockOrb->Sat[i].Orbit.DotDeltaRadial * 1.0E3,
255 clockOrb->Sat[i].Orbit.DotDeltaAlongTrack * 1.0E3,
256 clockOrb->Sat[i].Orbit.DotDeltaAlongTrack * 1.0E3);
257 }
258 fclose(filestream);
259 return;
260}
261
262void printUra(const char* filename, struct ClockOrbit* clockOrb, SATSYS sys,
263 char satSys, int offsetGnss) {
264 int timeOffset = 0;
265 FILE *filestream = fopen(filename, "ab+");
266 if (filestream == NULL) {
267 fprintf(stderr, "ERROR: open file %s\n", filename);
268 return;
269 }
270 switch (sys) {
271 case GPS:
272 fprintf(filestream,
273 "**RTCM 3 - SSR GPS URA Message <%d>\nSystem:\t\t%10d (GPS)\nTime of week [s]:",
274 clockOrb->messageType, sys);
275 timeOffset = 0;
276 break;
277 case GLO:
278 fprintf(filestream,
279 "**RTCM 3 - SSR GLONASS URA Message <%d>\nSystem:\t\t%10d (GLONASS)\nTime of day [s]:",
280 clockOrb->messageType, sys);
281 timeOffset = (GPSUTCdiff - 3 * 3600);
282 break;
283 }
284 fprintf(filestream,
285 "\t%10d\nUpdate Interval:\t%10d\nIOD SSR:\t\t%10d\n"
286 "ProviderId:\t\t%10d\nSolutionId:\t\t%10d\nNumber of Satellites:\t%10d\n"
287 "PRN URA[m]\n", clockOrb->EpochTime[sys] + timeOffset,
288 clockOrb->UpdateInterval, clockOrb->SSRIOD, clockOrb->SSRProviderID,
289 clockOrb->SSRSolutionID, clockOrb->NumberOfSat[sys]);
290 unsigned int i = 0;
291 for (i = offsetGnss; i < offsetGnss + clockOrb->NumberOfSat[sys]; ++i) {
292 fprintf(filestream, "%c%02d %10.4f\n", satSys, clockOrb->Sat[i].ID,
293 clockOrb->Sat[i].UserRangeAccuracy);
294 }
295 fclose(filestream);
296 return;
297}
298
299void printCodeBias(const char* filename, struct CodeBias* codeBias, SATSYS sys,
300 char satSys, int offsetGnss) {
301 int timeOffset = 0;
302 FILE *filestream = fopen(filename, "ab+");
303 if (filestream == NULL) {
304 fprintf(stderr, "ERROR: open file %s\n", filename);
305 return;
306 }
307 switch (sys) {
308 case GPS:
309 fprintf(filestream,
310 "**RTCM 3 - SSR GPS Code Bias Message <%d>\nSystem:\t\t%10d (GPS)\nTime of week [s]:",
311 codeBias->messageType, sys);
312 timeOffset = 0;
313 break;
314 case GLO:
315 fprintf(filestream,
316 "**RTCM 3 - SSR GLONASS Code Bias Message <%d>\nSystem:\t\t%10d (GLONASS)\nTime of day [s]:",
317 codeBias->messageType, sys);
318 timeOffset = (GPSUTCdiff - 3 * 3600);
319 break;
320 }
321 fprintf(filestream,
322 "\t%10d\nUpdate Interval:\t%10d\nIOD SSR:\t\t%10d\n"
323 "ProviderId:\t\t%10d\nSolutionId:\t\t%10d\nNumber of Satellites:\t%10d\n"
324 "PRN Number Type Bias[m] Type Bias[m]\n",
325 codeBias->EpochTime[sys] + timeOffset, codeBias->UpdateInterval,
326 codeBias->SSRIOD, codeBias->SSRProviderID, codeBias->SSRSolutionID,
327 codeBias->NumberOfSat[sys]);
328 unsigned int i = 0;
329 for (i = offsetGnss; i < offsetGnss + codeBias->NumberOfSat[sys]; ++i) {
330 fprintf(filestream, "%c%02d %5d ", satSys, codeBias->Sat[i].ID,
331 codeBias->Sat[i].NumberOfCodeBiases);
332 int j;
333 for (j = 0; j < codeBias->Sat[i].NumberOfCodeBiases; j++) {
334 fprintf(filestream, "%10d %12.2f", codeBias->Sat[i].Biases[j].Type,
335 codeBias->Sat[i].Biases[j].Bias);
336 }
337 fprintf(filestream, "\n");
338 }
339 fclose(filestream);
340 return;
341}
342
343void printPhaseBias(const char* filename, struct PhaseBias* phaseBias, SATSYS sys,
344 char satSys, int offsetGnss) {
345 int timeOffset = 0;
346 FILE *filestream = fopen(filename, "ab+");
347 if (filestream == NULL) {
348 fprintf(stderr, "ERROR: open file %s\n", filename);
349 return;
350 }
351 switch (sys) {
352 case GPS:
353 fprintf(filestream,
354 "**RTCM 3 - SSR GPS Phase Bias Message <%d>\nSystem:\t\t%10d (GPS)\nTime of week [s]:",
355 phaseBias->messageType, sys);
356 timeOffset = 0;
357 break;
358 case GLO:
359 fprintf(filestream,
360 "**RTCM 3 - SSR GLONASS Phase Bias Message <%d>\nSystem:\t\t%10d (GLONASS)\nTime of day [s]:",
361 phaseBias->messageType, sys);
362 timeOffset = (GPSUTCdiff - 3 * 3600);
363 break;
364 }
365 fprintf(filestream,
366 "\t%10d\nUpdate Interval:\t\t%10d\nIOD SSR:\t\t\t%10d\n"
367 "ProviderId:\t\t\t%10d\nSolutionId:\t\t\t%10d\n"
368 "DispersiveBiasConsistencyIndicator\t%2d\nMWConsistencyIndicator\t\t%10d\nNumber of Satellites:\t\t%10d\n"
369 "PRN Yaw[deg] YawRate[deg/sec] Number Type INT-ind WL-ind DISC-count Bias[m] Type INT-ind WL-ind DISC-count Bias[m]\n",
370 phaseBias->EpochTime[sys] + timeOffset,
371 phaseBias->UpdateInterval,
372 phaseBias->SSRIOD, phaseBias->SSRProviderID, phaseBias->SSRSolutionID,
373 phaseBias->DispersiveBiasConsistencyIndicator ,
374 phaseBias->MWConsistencyIndicator,
375 phaseBias->NumberOfSat[sys]);
376 unsigned int i = 0;
377 for (i = offsetGnss; i < offsetGnss + phaseBias->NumberOfSat[sys]; ++i) {
378 fprintf(filestream, "%c%02d %8.3f %8.4f %12d",
379 satSys,phaseBias->Sat[i].ID,
380 phaseBias->Sat[i].YawAngle,
381 phaseBias->Sat[i].YawRate,
382 phaseBias->Sat[i].NumberOfPhaseBiases);
383 int j;
384 for (j = 0; j < phaseBias->Sat[i].NumberOfPhaseBiases; j++) {
385 fprintf(filestream, "%6d %6d %6d %10d %10.2f",
386 phaseBias->Sat[i].Biases[j].Type,
387 phaseBias->Sat[i].Biases[j].SignalIntegerIndicator,
388 phaseBias->Sat[i].Biases[j].SignalsWideLaneIntegerIndicator,
389 phaseBias->Sat[i].Biases[j].SignalDiscontinuityCounter,
390 phaseBias->Sat[i].Biases[j].Bias);
391 }
392 fprintf(filestream, "\n");
393 }
394 fclose(filestream);
395 return;
396}
397
398void printVtec(const char* filename, struct VTEC* vtec) {
399 FILE *filestream = fopen(filename, "ab+");
400 if (filestream == NULL) {
401 fprintf(stderr, "ERROR: open file %s\n", filename);
402 return;
403 }
404 fprintf(filestream,
405 "**RTCM 3 - SSR VTEC Message <1264>\n"
406 "Time of week [s]:\t%10d\nUpdate Interval:\t%10d\nIOD SSR:\t\t%10d\n"
407 "ProviderId:\t\t%10d\nSolutionId:\t\t%10d\nNumber of Layers:\t%10d\n"
408 "Quality:\t\t%13.3f\n", vtec->EpochTime,
409 vtec->UpdateInterval, vtec->SSRIOD, vtec->SSRProviderID,
410 vtec->SSRSolutionID, vtec->NumLayers, vtec->Quality);
411
412 unsigned int i, j, k;
413 for (i = 0; i < vtec->NumLayers; ++i) {
414 fprintf(filestream,
415 "Layer: %2d Height [m]: %f Degree n:%2d Order m:%2d\n", i,
416 vtec->Layers[i].Height, vtec->Layers[i].Degree,
417 vtec->Layers[i].Order);
418 for (j = 0; j <= vtec->Layers[i].Degree; ++j) {
419 fprintf(filestream, "Cn%d [TECU]: ", j);
420 for (k = 0; k <= vtec->Layers[i].Order; ++k) {
421 fprintf(filestream, " %7.3f", vtec->Layers[i].Cosinus[k][j]);
422 }
423 fprintf(filestream, "\n");
424 }
425 for (j = 1; j <= vtec->Layers[i].Degree; ++j) {
426 fprintf(filestream, "Sn%d [TECU]: ", j);
427 for (k = 0; k <= vtec->Layers[i].Order; ++k) {
428 fprintf(filestream, " %7.3f", vtec->Layers[i].Sinus[k][j]);
429 }
430 fprintf(filestream, "\n");
431 }
432 }
433 fclose(filestream);
434 return;
435}
436
437void printSystemParameters(const char* filename,
438 struct RTCM3ParserData* parser) {
439 FILE *filestream = fopen(filename, "ab+");
440 if (filestream == NULL) {
441 fprintf(stderr, "ERROR: open file %s\n", filename);
442 return;
443 }
444 fprintf(filestream,
445 "**RTCM 3 - System parameters <1013>\n"
446 "Modified Julian Day:\t %d\nSeconds of Day:\t\t%2d\nLeapSeconds:\t\t%2d\n",
447 parser->modjulday, parser->secofday, parser->leapsec);
448 fclose(filestream);
449 return;
450}
451
452void printTextMessageType(const char* filename, int messageType) {
453 FILE *filestream = fopen(filename, "ab+");
454 if (filestream == NULL) {
455 fprintf(stderr, "ERROR: open file %s\n", filename);
456 return;
457 }
458 fprintf(filestream,
459 "**RTCM 3 - Text Message <%d>\n", messageType);
460 fclose(filestream);
461 return;
462}
463void printGpsEph(const char* filename, struct gpsephemeris* ephemerisGPS) {
464 FILE *filestream = fopen(filename, "ab+");
465 if (filestream == NULL) {
466 fprintf(stderr, "ERROR: open file %s\n", filename);
467 return;
468 }
469 fprintf(filestream, "**RTCM 3 - GPS Ephemeris <1019>\n"
470 "PRN %13d\n"
471 "IODE %13d\n"
472 "URAindex [1..15] %13d\n"
473 "SVhealth %13d\n"
474 "GPSweek %13d\n"
475 "IODC %13d\n"
476 "TOW [s] %13d\n"
477 "TOC [s] %13d\n"
478 "TOE [s] %13d\n"
479 "clock_bias [s] %13e\n"
480 "clock_drift[s/s] %13e\n"
481 "clock_driftrate [s/s^2]%13e\n"
482 "Crs [m] %13e\n"
483 "Delta_n [rad/s] %13e\n"
484 "M0 [rad] %13e\n"
485 "Cuc [rad] %13e\n"
486 "e %13e\n"
487 "Cus [rad] %13e\n"
488 "sqrt_A [m^0.5] %13e\n"
489 "Cic [rad] %13e\n"
490 "OMEGA0 [rad] %13e\n"
491 "Cis [rad] %13e\n"
492 "i0 [rad] %13e\n"
493 "Crc [m] %13e\n"
494 "omega [rad] %13e\n"
495 "OMEGADOT [rad/s] %13e\n"
496 "IDOT [rad/s] %13e\n"
497 "TGD [s] %13e\n", ephemerisGPS->satellite,
498 ephemerisGPS->IODE, ephemerisGPS->URAindex, ephemerisGPS->SVhealth,
499 ephemerisGPS->GPSweek, ephemerisGPS->IODC, ephemerisGPS->TOW,
500 ephemerisGPS->TOC, ephemerisGPS->TOE, ephemerisGPS->clock_bias,
501 ephemerisGPS->clock_drift, ephemerisGPS->clock_driftrate,
502 ephemerisGPS->Crs, ephemerisGPS->Delta_n, ephemerisGPS->M0,
503 ephemerisGPS->Cuc, ephemerisGPS->e, ephemerisGPS->Cus,
504 ephemerisGPS->sqrt_A, ephemerisGPS->Cic, ephemerisGPS->OMEGA0,
505 ephemerisGPS->Cis, ephemerisGPS->i0, ephemerisGPS->Crc,
506 ephemerisGPS->omega, ephemerisGPS->OMEGADOT, ephemerisGPS->IDOT,
507 ephemerisGPS->TGD);
508 fclose(filestream);
509 return;
510 return;
511}
512
513void printGlonassEph(const char* filename,
514 struct glonassephemeris* ephemerisGLO) {
515 FILE *filestream = fopen(filename, "ab+");
516 if (filestream == NULL) {
517 fprintf(stderr, "ERROR: open file %s\n", filename);
518 return;
519 }
520 fprintf(filestream, "**RTCM 3 - GLONASS Ephemeris <1020>\n"
521 "SV %10d\n"
522 "frequency_number %10d\n"
523 "tb [s] %10d\n"
524 "tk [s] %10d\n"
525 "E [days] %10d\n"
526 "tau [s] %13e\n"
527 "gamma %13e\n"
528 "x_pos [km] %13e\n"
529 "x_velocity [km/s] %13e\n"
530 "x_acceleration [km/s^2] %13e\n"
531 "y_pos [km] %13e\n"
532 "y_velocity [km/s] %13e\n"
533 "y_acceleration [km/s^2] %13e\n"
534 "z_pos [km] %13e\n"
535 "z_velocity [km/s] %13e\n"
536 "z_acceleration [km/s^2] %13e\n", ephemerisGLO->almanac_number,
537 ephemerisGLO->frequency_number, ephemerisGLO->tb, ephemerisGLO->tk,
538 ephemerisGLO->E, ephemerisGLO->tau, ephemerisGLO->gamma,
539 ephemerisGLO->x_pos, ephemerisGLO->x_velocity,
540 ephemerisGLO->x_acceleration, ephemerisGLO->y_pos,
541 ephemerisGLO->y_velocity, ephemerisGLO->y_acceleration,
542 ephemerisGLO->z_pos, ephemerisGLO->z_velocity,
543 ephemerisGLO->z_acceleration);
544 fclose(filestream);
545 return;
546}
547
Note: See TracBrowser for help on using the repository browser.