Changeset 5595 in ntrip for trunk/rtcm3torinex
- Timestamp:
- Dec 3, 2013, 2:33:25 PM (11 years ago)
- Location:
- trunk/rtcm3torinex/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/rtcm3torinex/lib/rtcm3torinex.c
r5553 r5595 446 446 ge->TOW = 0.9999E9; 447 447 ret = 1019; 448 } 449 break; 450 case 1044: 451 { 452 struct gpsephemeris *ge; 453 int sv, i; 454 455 ge = &handle->ephemerisGPS; 456 memset(ge, 0, sizeof(*ge)); 457 458 GETBITS(sv, 4) 459 ge->satellite = PRN_QZSS_START+sv-1; 460 GETBITS(ge->TOC, 16) 461 ge->TOC <<= 4; 462 GETFLOATSIGN(ge->clock_driftrate, 8, 1.0/(double)(1<<30)/(double)(1<<25)) 463 GETFLOATSIGN(ge->clock_drift, 16, 1.0/(double)(1<<30)/(double)(1<<13)) 464 GETFLOATSIGN(ge->clock_bias, 22, 1.0/(double)(1<<30)/(double)(1<<1)) 465 GETBITS(ge->IODE, 8) 466 GETFLOATSIGN(ge->Crs, 16, 1.0/(double)(1<<5)) 467 GETFLOATSIGN(ge->Delta_n, 16, R2R_PI/(double)(1<<30)/(double)(1<<13)) 468 GETFLOATSIGN(ge->M0, 32, R2R_PI/(double)(1<<30)/(double)(1<<1)) 469 GETFLOATSIGN(ge->Cuc, 16, 1.0/(double)(1<<29)) 470 GETFLOAT(ge->e, 32, 1.0/(double)(1<<30)/(double)(1<<3)) 471 GETFLOATSIGN(ge->Cus, 16, 1.0/(double)(1<<29)) 472 GETFLOAT(ge->sqrt_A, 32, 1.0/(double)(1<<19)) 473 GETBITS(ge->TOE, 16) 474 ge->TOE <<= 4; 475 GETFLOATSIGN(ge->Cic, 16, 1.0/(double)(1<<29)) 476 GETFLOATSIGN(ge->OMEGA0, 32, R2R_PI/(double)(1<<30)/(double)(1<<1)) 477 GETFLOATSIGN(ge->Cis, 16, 1.0/(double)(1<<29)) 478 GETFLOATSIGN(ge->i0, 32, R2R_PI/(double)(1<<30)/(double)(1<<1)) 479 GETFLOATSIGN(ge->Crc, 16, 1.0/(double)(1<<5)) 480 GETFLOATSIGN(ge->omega, 32, R2R_PI/(double)(1<<30)/(double)(1<<1)) 481 GETFLOATSIGN(ge->OMEGADOT, 24, R2R_PI/(double)(1<<30)/(double)(1<<13)) 482 GETFLOATSIGN(ge->IDOT, 14, R2R_PI/(double)(1<<30)/(double)(1<<13)) 483 GETBITS(sv, 2) 484 if(sv & 1) 485 ge->flags |= GPSEPHF_L2PCODE; 486 if(sv & 2) 487 ge->flags |= GPSEPHF_L2CACODE; 488 GETBITS(ge->GPSweek, 10) 489 ge->GPSweek += 1024; 490 GETBITS(ge->URAindex, 4) 491 GETBITS(ge->SVhealth, 6) 492 GETFLOATSIGN(ge->TGD, 8, 1.0/(double)(1<<30)/(double)(1<<1)) 493 GETBITS(ge->IODC, 10) 494 GETBITS(sv, 1) 495 if(sv) 496 ge->flags |= GPSEPHF_6HOURSFIT; 497 498 i = ((int)ge->GPSweek - (int)handle->GPSWeek)*7*24*60*60 499 + ((int)ge->TOE - (int)handle->GPSTOW) - 2*60*60; 500 if(i > 5*60*60 && i < 8*60*60) 501 { 502 handle->GPSTOW = ge->TOE; 503 handle->GPSWeek = ge->GPSweek; 504 } 505 ge->TOW = 0.9999E9; 506 ret = 1044; 448 507 } 449 508 break; … … 2440 2499 while((r = RTCM3Parser(Parser))) 2441 2500 { 2442 if(r == 1020 || r == 1019 )2501 if(r == 1020 || r == 1019 || r == 1044) 2443 2502 { 2444 2503 FILE *file = 0; … … 2446 2505 if(Parser->rinex3 && !(file = Parser->gpsfile)) 2447 2506 { 2448 const char *n = Parser->gpsephemeris ? Parser->gpsephemeris : Parser->glonassephemeris; 2507 const char *n = Parser->gpsephemeris ? Parser->gpsephemeris 2508 : Parser->qzssephemeris ? Parser->qzssephemeris : Parser->glonassephemeris; 2449 2509 if(n) 2450 2510 { … … 2461 2521 fprintf(Parser->gpsfile, "%s\n%60sEND OF HEADER\n", buffer, ""); 2462 2522 } 2523 Parser->qzssephemeris = 0; 2463 2524 Parser->gpsephemeris = 0; 2464 2525 Parser->glonassephemeris = 0; … … 2507 2568 } 2508 2569 file = Parser->gpsfile; 2570 } 2571 else if(r == 1044) 2572 { 2573 if(Parser->qzssephemeris) 2574 { 2575 if(!(Parser->qzssfile = fopen(Parser->qzssephemeris, "w"))) 2576 { 2577 RTCM3Error("Could not open QZSS ephemeris output file.\n"); 2578 } 2579 else 2580 { 2581 char buffer[100]; 2582 fprintf(Parser->qzssfile, 2583 "%9.2f%11sN: QZSS NAV DATA%24sRINEX VERSION / TYPE\n", 2.1, "", ""); 2584 HandleRunBy(buffer, sizeof(buffer), 0, Parser->rinex3); 2585 fprintf(Parser->qzssfile, "%s\n%60sEND OF HEADER\n", buffer, ""); 2586 } 2587 Parser->qzssephemeris = 0; 2588 } 2589 file = Parser->qzssfile; 2509 2590 } 2510 2591 } … … 2537 2618 e->z_velocity, e->z_acceleration, (double) e->E); 2538 2619 } 2539 else /* if(r == 1019 ) */2620 else /* if(r == 1019 || r == 1044) */ 2540 2621 { 2541 2622 struct gpsephemeris *e = &Parser->ephemerisGPS; … … 2544 2625 struct converttimeinfo cti; 2545 2626 converttime(&cti, e->GPSweek, e->TOC); 2546 2627 const char *sep = " "; 2628 int qzss = 0; 2629 int num = e->satellite; 2630 2631 if(num >= PRN_QZSS_START) 2632 { 2633 qzss = 1; 2634 num -= PRN_QZSS_START-1; 2635 } 2547 2636 if(Parser->rinex3) 2548 ConvLine(file, "G%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e\n", 2549 e->satellite, cti.year, cti.month, cti.day, cti.hour, 2637 { 2638 ConvLine(file, 2639 "%s%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e\n", 2640 qzss ? "J" : "G", num, cti.year, cti.month, cti.day, cti.hour, 2550 2641 cti.minute, cti.second, e->clock_bias, e->clock_drift, 2551 2642 e->clock_driftrate); 2643 sep = " "; 2644 } 2552 2645 else 2553 ConvLine(file, "%02d %02d %02d %02d %02d %02d%05.1f%19.12e%19.12e%19.12e\n", 2554 e->satellite, cti.year%100, cti.month, cti.day, cti.hour, 2646 { 2647 ConvLine(file, 2648 "%02d %02d %02d %02d %02d %02d%05.1f%19.12e%19.12e%19.12e\n", 2649 num, cti.year%100, cti.month, cti.day, cti.hour, 2555 2650 cti.minute, (double) cti.second, e->clock_bias, e->clock_drift, 2556 2651 e->clock_driftrate); 2557 ConvLine(file, " %19.12e%19.12e%19.12e%19.12e\n", (double)e->IODE, 2558 e->Crs, e->Delta_n, e->M0); 2559 ConvLine(file, " %19.12e%19.12e%19.12e%19.12e\n", e->Cuc, 2652 } 2653 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, 2654 (double)e->IODE, e->Crs, e->Delta_n, e->M0); 2655 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, e->Cuc, 2560 2656 e->e, e->Cus, e->sqrt_A); 2561 ConvLine(file, " %19.12e%19.12e%19.12e%19.12e\n",2657 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, 2562 2658 (double) e->TOE, e->Cic, e->OMEGA0, e->Cis); 2563 ConvLine(file, " %19.12e%19.12e%19.12e%19.12e\n", e->i0,2659 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, e->i0, 2564 2660 e->Crc, e->omega, e->OMEGADOT); 2565 2661 d = 0; … … 2569 2665 if(i & GPSEPHF_L2PCODE) 2570 2666 d += 1.0; 2571 ConvLine(file, " %19.12e%19.12e%19.12e%19.12e\n", e->IDOT, d,2667 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, e->IDOT, d, 2572 2668 (double) e->GPSweek, i & GPSEPHF_L2PCODEDATA ? 1.0 : 0.0); 2573 2669 if(e->URAindex <= 6) /* URA index */ … … 2577 2673 /* 15 indicates not to use satellite. We can't handle this special 2578 2674 case, so we create a high "non"-accuracy value. */ 2579 ConvLine(file, " %19.12e%19.12e%19.12e%19.12e\n", d,2675 ConvLine(file, "%s%19.12e%19.12e%19.12e%19.12e\n", sep, d, 2580 2676 ((double) e->SVhealth), e->TGD, ((double) e->IODC)); 2581 2677 2582 ConvLine(file, " %19.12e%19.12e\n", ((double)e->TOW), 2583 i & GPSEPHF_6HOURSFIT ? 6.0 : 4.0); 2678 ConvLine(file, "%s%19.12e%19.12e\n", sep, ((double)e->TOW), 2679 (i & GPSEPHF_6HOURSFIT) ? (Parser->rinex3 ? 1 : qzss ? 4.0 : 6.0) 2680 : (Parser->rinex3 ? 0 : qzss ? 2.0 : 4.0)); 2584 2681 /* TOW */ 2585 2682 } … … 3173 3270 const char *headerfile; 3174 3271 const char *gpsephemeris; 3272 const char *qzssephemeris; 3175 3273 const char *glonassephemeris; 3176 3274 }; … … 3190 3288 { "user", required_argument, 0, 'u'}, 3191 3289 { "gpsephemeris", required_argument, 0, 'E'}, 3290 { "qzssephemeris", required_argument, 0, 'Q'}, 3192 3291 { "glonassephemeris", required_argument, 0, 'G'}, 3193 3292 { "rinex3", no_argument, 0, '3'}, … … 3200 3299 {0,0,0,0}}; 3201 3300 #endif 3202 #define ARGOPT "-d:s:p:r:t:f:u:E:G: M:S:R:n:h3O"3301 #define ARGOPT "-d:s:p:r:t:f:u:E:G:Q:M:S:R:n:h3O" 3203 3302 3204 3303 enum MODE { HTTP = 1, RTSP = 2, NTRIP1 = 3, AUTO = 4, END }; … … 3330 3429 args->headerfile = 0; 3331 3430 args->gpsephemeris = 0; 3431 args->qzssephemeris = 0; 3332 3432 args->glonassephemeris = 0; 3333 3433 args->rinex3 = 0; … … 3355 3455 case 'E': args->gpsephemeris = optarg; break; 3356 3456 case 'G': args->glonassephemeris = optarg; break; 3457 case 'Q': args->qzssephemeris = optarg; break; 3357 3458 case 'r': args->port = optarg; break; 3358 3459 case '3': args->rinex3 = 1; break; … … 3429 3530 " -E " LONG_OPT("--gpsephemeris ") "output file for GPS ephemeris data\n" 3430 3531 " -G " LONG_OPT("--glonassephemeris ") "output file for GLONASS ephemeris data\n" 3532 " -Q " LONG_OPT("--qzssephemeris ") "output file for QZSS ephemeris data\n" 3431 3533 " -3 " LONG_OPT("--rinex3 ") "output RINEX type 3 data\n" 3432 3534 " -S " LONG_OPT("--proxyhost ") "proxy name or address\n" … … 3533 3635 Parser.glonassephemeris = args.glonassephemeris; 3534 3636 Parser.gpsephemeris = args.gpsephemeris; 3637 Parser.qzssephemeris = args.qzssephemeris; 3535 3638 Parser.rinex3 = args.rinex3; 3536 3639 Parser.changeobs = args.changeobs; -
trunk/rtcm3torinex/lib/rtcm3torinex.h
r5533 r5595 492 492 const char * glonassephemeris; 493 493 const char * gpsephemeris; 494 const char * qzssephemeris; 494 495 FILE * glonassfile; 495 496 FILE * gpsfile; 497 FILE * qzssfile; 496 498 }; 497 499
Note:
See TracChangeset
for help on using the changeset viewer.