Changeset 6329 in ntrip for trunk/rtcm3torinex/lib
- Timestamp:
- Nov 20, 2014, 2:07:01 PM (10 years ago)
- Location:
- trunk/rtcm3torinex/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/rtcm3torinex/lib/rtcm3torinex.c
r5660 r6329 446 446 ge->TOW = 0.9999E9; 447 447 ret = 1019; 448 } 449 break; 450 case 1043: 451 if(handle->GPSWeek) 452 { 453 struct sbasephemeris *gs; 454 int sv, i, time, tod, day; 455 gs = &handle->ephemerisSBAS; 456 memset(gs, 0, sizeof(*gs)); 457 458 GETBITS(sv, 6) 459 gs->satellite = PRN_SBAS_START+sv; 460 GETBITS(gs->IODN, 8) 461 GETBITS(time, 13) 462 time <<= 4; 463 gs->GPSweek_TOE = handle->GPSWeek; 464 GETBITS(gs->URA, 4) 465 GETFLOATSIGN(gs->x_pos, 30, 0.08) 466 GETFLOATSIGN(gs->y_pos, 30, 0.08) 467 GETFLOATSIGN(gs->z_pos, 25, 0.4) 468 GETFLOATSIGN(gs->x_velocity, 17, 0.000625) 469 GETFLOATSIGN(gs->y_velocity, 17, 0.000625) 470 GETFLOATSIGN(gs->z_velocity, 18, 0.004) 471 GETFLOATSIGN(gs->x_acceleration, 10, 0.0000125) 472 GETFLOATSIGN(gs->y_acceleration, 10, 0.0000125) 473 GETFLOATSIGN(gs->z_acceleration, 10, 0.0000625) 474 GETFLOATSIGN(gs->agf0, 12, 1.0/(1<<30)/(1<<1)) 475 GETFLOATSIGN(gs->agf1, 8, 1.0/(1<<30)/(1<<10)) 476 477 /* calculate time */ 478 tod = handle->GPSTOW%(24*60*60); 479 day = handle->GPSTOW/(24*60*60); 480 if(time > 19*60*60 && tod < 5*60*60) 481 --day; 482 else if(time < 5*60*60 && tod > 19*60*60) 483 ++day; 484 time += day*24*60*60; 485 if(time > 7*24*60*60) 486 ++gs->GPSweek_TOE; 487 else if(time < 0) 488 --gs->GPSweek_TOE; 489 gs->TOE = time; 490 491 i = (gs->GPSweek_TOE - handle->GPSWeek)*7*24*60*60 492 + (gs->TOE - handle->GPSTOW) - 2*60*60; 493 if(i > 5*60*60 && i < 8*60*60) 494 { 495 handle->GPSTOW = gs->TOE; 496 handle->GPSWeek = gs->GPSweek_TOE; 497 } 498 gs->TOW = 0.9999E9; 499 ret = 1043; 448 500 } 449 501 break; … … 2489 2541 while((r = RTCM3Parser(Parser))) 2490 2542 { 2491 if(r == 1020 || r == 1019 || r == 1044 )2543 if(r == 1020 || r == 1019 || r == 1044 || r == 1043) 2492 2544 { 2493 2545 FILE *file = 0; … … 2514 2566 Parser->gpsephemeris = 0; 2515 2567 Parser->glonassephemeris = 0; 2568 Parser->sbasephemeris = 0; 2516 2569 file = Parser->gpsfile; 2517 2570 } … … 2559 2612 file = Parser->gpsfile; 2560 2613 } 2614 else if(r == 1043) 2615 { 2616 if(Parser->sbasephemeris) 2617 { 2618 if(!(Parser->sbasfile = fopen(Parser->sbasephemeris, "w"))) 2619 { 2620 RTCM3Error("Could not open SBAS ephemeris output file.\n"); 2621 } 2622 else 2623 { 2624 char buffer[100]; 2625 fprintf(Parser->sbasfile, 2626 "%9.2f%11sN: SBAS NAV DATA%24sRINEX VERSION / TYPE\n", 2.1, "", ""); 2627 HandleRunBy(buffer, sizeof(buffer), 0, Parser->rinex3); 2628 fprintf(Parser->sbasfile, "%s\n%60sEND OF HEADER\n", buffer, ""); 2629 } 2630 Parser->sbasephemeris = 0; 2631 } 2632 file = Parser->sbasfile; 2633 } 2561 2634 else if(r == 1044) 2562 2635 { … … 2582 2655 if(file) 2583 2656 { 2657 const char *sep = " "; 2584 2658 if(r == 1020) 2585 2659 { … … 2594 2668 2595 2669 if(Parser->rinex3) 2670 { 2596 2671 ConvLine(file, "R%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e\n", 2597 2672 e->almanac_number, cti.year, cti.month, cti.day, cti.hour, cti.minute, 2598 2673 cti.second, -e->tau, e->gamma, (double) i); 2674 sep = " "; 2675 } 2599 2676 else 2677 { 2600 2678 ConvLine(file, "%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e\n", 2601 2679 e->almanac_number, cti.year%100, cti.month, cti.day, cti.hour, cti.minute, 2602 2680 (double) cti.second, -e->tau, e->gamma, (double) i); 2603 ConvLine(file, " %19.12e%19.12e%19.12e%19.12e\n", e->x_pos, 2681 } 2682 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, e->x_pos, 2604 2683 e->x_velocity, e->x_acceleration, (e->flags & GLOEPHF_UNHEALTHY) ? 1.0 : 0.0); 2605 ConvLine(file, " %19.12e%19.12e%19.12e%19.12e\n", e->y_pos,2684 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, e->y_pos, 2606 2685 e->y_velocity, e->y_acceleration, (double) e->frequency_number); 2607 ConvLine(file, " %19.12e%19.12e%19.12e%19.12e\n", e->z_pos,2686 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, e->z_pos, 2608 2687 e->z_velocity, e->z_acceleration, (double) e->E); 2688 } 2689 else if(r == 1043) 2690 { 2691 struct sbasephemeris *e = &Parser->ephemerisSBAS; 2692 struct converttimeinfo cti; 2693 converttime(&cti, e->GPSweek_TOE, e->TOE); 2694 if(Parser->rinex3) 2695 { 2696 ConvLine(file, "S%02d %04d %2d %2d %2d %2d %2d%19.12e%19.12e%19.12e\n", 2697 e->satellite-100, cti.year, cti.month, cti.day, cti.hour, cti.minute, 2698 cti.second, e->agf0, e->agf1, (double)e->TOW); 2699 sep = " "; 2700 } 2701 else 2702 { 2703 ConvLine(file, "%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e\n", 2704 e->satellite-100, cti.year%100, cti.month, cti.day, cti.hour, cti.minute, 2705 (double)cti.second, e->agf0, e->agf1, (double)e->TOW); 2706 } 2707 /* X, health */ 2708 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, e->x_pos, 2709 e->x_velocity, e->x_acceleration, e->URA == 15 ? 1.0 : 0.0); 2710 /* Y, accuracy */ 2711 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, e->y_pos, 2712 e->y_velocity, e->y_acceleration, (double)e->URA); 2713 /* Z */ 2714 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, e->z_pos, 2715 e->z_velocity, e->z_acceleration, (double)e->IODN); 2609 2716 } 2610 2717 else /* if(r == 1019 || r == 1044) */ … … 2615 2722 struct converttimeinfo cti; 2616 2723 converttime(&cti, e->GPSweek, e->TOC); 2617 const char *sep = " ";2618 2724 int qzss = 0; 2619 2725 int num = e->satellite; … … 3259 3365 const char *data; 3260 3366 const char *headerfile; 3367 const char *sbasephemeris; 3261 3368 const char *gpsephemeris; 3262 3369 const char *qzssephemeris; … … 3280 3387 { "qzssephemeris", required_argument, 0, 'Q'}, 3281 3388 { "glonassephemeris", required_argument, 0, 'G'}, 3389 { "sbasephemeris", required_argument, 0, 'B'}, 3282 3390 { "rinex3", no_argument, 0, '3'}, 3283 3391 { "changeobs", no_argument, 0, 'O'}, … … 3289 3397 {0,0,0,0}}; 3290 3398 #endif 3291 #define ARGOPT "-d:s:p:r:t:f:u:E:G: Q:M:S:R:n:h3O"3399 #define ARGOPT "-d:s:p:r:t:f:u:E:G:B:Q:M:S:R:n:h3O" 3292 3400 3293 3401 enum MODE { HTTP = 1, RTSP = 2, NTRIP1 = 3, AUTO = 4, END }; … … 3420 3528 args->gpsephemeris = 0; 3421 3529 args->qzssephemeris = 0; 3530 args->sbasephemeris = 0; 3422 3531 args->glonassephemeris = 0; 3423 3532 args->rinex3 = 0; … … 3444 3553 case 'f': args->headerfile = optarg; break; 3445 3554 case 'E': args->gpsephemeris = optarg; break; 3555 case 'B': args->sbasephemeris = optarg; break; 3446 3556 case 'G': args->glonassephemeris = optarg; break; 3447 3557 case 'Q': args->qzssephemeris = optarg; break; … … 3521 3631 " -G " LONG_OPT("--glonassephemeris ") "output file for GLONASS ephemeris data\n" 3522 3632 " -Q " LONG_OPT("--qzssephemeris ") "output file for QZSS ephemeris data\n" 3633 " -B " LONG_OPT("--sbasephemeris ") "output file for SBAS ephemeris data\n" 3523 3634 " -3 " LONG_OPT("--rinex3 ") "output RINEX type 3 data\n" 3524 3635 " -S " LONG_OPT("--proxyhost ") "proxy name or address\n" … … 3626 3737 Parser.gpsephemeris = args.gpsephemeris; 3627 3738 Parser.qzssephemeris = args.qzssephemeris; 3739 Parser.sbasephemeris = args.sbasephemeris; 3628 3740 Parser.rinex3 = args.rinex3; 3629 3741 Parser.changeobs = args.changeobs; -
trunk/rtcm3torinex/lib/rtcm3torinex.h
r5674 r6329 401 401 }; 402 402 403 struct sbasephemeris { 404 int satellite; 405 int IODN; /* [bits 14- 21] */ 406 int GPSweek_TOE; 407 int TOW; 408 int TOE; /* [s] [bits 22- 34] */ 409 double agf0; /* [s] [bits 206-217] */ 410 double agf1; /* [s/s] [bits 218-225] */ 411 double x_pos; /* [km] [bits 39- 68] */ 412 double x_velocity; /* [km/s] [bits 124-140] */ 413 double x_acceleration; /* [km/s^2][bits 176-185] */ 414 double y_pos; /* [km] [bits 69- 98] */ 415 double y_velocity; /* [km/s] [bits 141-157] */ 416 double y_acceleration; /* [km/s^2][bits 186-195] */ 417 double z_pos; /* [km] [bits 99-123] */ 418 double z_velocity; /* [km/s] [bits 158-175] */ 419 double z_acceleration; /* [km/s^2][bits 196-205] */ 420 int URA; /* [bits 35- 38] */ 421 }; 422 403 423 struct galileoephemeris { 404 424 int flags; /* GALEPHF_xxx */ … … 451 471 struct galileoephemeris ephemerisGALILEO; 452 472 struct glonassephemeris ephemerisGLONASS; 473 struct sbasephemeris ephemerisSBAS; 453 474 struct gnssdata DataNew; 454 475 int GLOFreq[PRN_GLONASS_NUM]; /* frequency numbers of GLONASS + 100 */ … … 493 514 const char * gpsephemeris; 494 515 const char * qzssephemeris; 516 const char * sbasephemeris; 495 517 FILE * glonassfile; 496 518 FILE * gpsfile; 497 519 FILE * qzssfile; 520 FILE * sbasfile; 498 521 }; 499 522
Note:
See TracChangeset
for help on using the changeset viewer.