- Timestamp:
- Jul 22, 2020, 10:29:10 AM (4 years ago)
- Location:
- trunk/BNC/src/RTCM3/clock_and_orbit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_igs.c
r8976 r8996 17 17 #endif 18 18 #include <clock_orbit_igs.h> 19 20 19 21 20 static uint32_t CRC24(long size, const unsigned char *buf) { … … 95 94 #define T_IGS_MESSAGE_NUMBER(a) ADDBITS( 8, a) /* IDF002 */ 96 95 #define T_SSR_EPOCH_TIME(a) ADDBITS(20, a) /* IDF003 */ 96 97 97 #define T_SSR_UPDATE_INTERVAL(a) ADDBITS( 4, a) /* DF391, IDF004 */ 98 98 #define T_MULTIPLE_MESSAGE_INDICATOR(a) ADDBITS( 1, a) /* DF388, IDF005 */ … … 132 132 #define T_MW_CONSISTENCY_INDICATOR(a) ADDBITS( 1, a) /* DF487, IDF033 */ 133 133 134 /* URA */ 134 135 #define T_SSR_URA(a) ADDBITS( 6, a) /* DF389, IDF034 */ 135 136 … … 547 548 #define G_PHASE_BIAS(a) GETFLOATSIGN(a, 20, 1/10000.) /* DF482, IDF028 */ 548 549 550 /* Phase specific part of GNSS phase bias message */ 549 551 #define G_INTEGER_INDICATOR(a) GETBITS(a, 1) /* DF483, IDF029 */ 550 552 #define G_WIDE_LANE_INDICATOR(a) GETBITS(a, 2) /* DF484, IDF030 */ … … 553 555 #define G_MW_CONSISTENCY_INDICATOR(a) GETBITS(a, 1) /* DF487, IDF033 */ 554 556 557 /* URA */ 555 558 #define G_SSR_URA(a) {int temp; GETBITS(temp, 6) \ 556 559 (a) = URAToValue(temp);} /* DF389, IDF034 */ -
trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.c
r8979 r8996 89 89 #define MPI 3.141592653589793 90 90 91 /* G PS macros also used for other systems when matching!*/91 /* GNSS macros - Header part */ 92 92 #define T_RTCM_MESSAGE_NUMBER(a) ADDBITS(12, a) /* DF002 */ 93 #define T_GPS_EPOCH_TIME(a) ADDBITS(20, a) 94 #define T_GLONASS_EPOCH_TIME(a) ADDBITS(17, a) 95 #define T_SSR_UPDATE_INTERVAL(a) ADDBITS( 4, a) 96 #define T_MULTIPLE_MESSAGE_INDICATOR(a) ADDBITS( 1, a) 97 #define T_SATELLITE_REFERENCE_DATUM(a) ADDBITS( 1, a) 98 #define T_SSR_IOD(a) ADDBITS( 4, a) 99 #define T_SSR_PROVIDER_ID(a) ADDBITS(16, a) 100 #define T_SSR_SOLUTION_ID(a) ADDBITS( 4, a) 101 #define T_NO_OF_SATELLITES(a) ADDBITS( 6, a) 102 103 /* GNSS macros - Satellite specific part */ 93 104 #define T_GPS_SATELLITE_ID(a) ADDBITS( 6, a) /* DF068 */ 94 105 #define T_QZSS_SATELLITE_ID(a) ADDBITS( 4, a) /* DF249 */ 95 106 #define T_GLONASS_SATELLITE_ID(a) ADDBITS( 5, a) 96 97 107 #define T_GPS_IODE(a) ADDBITS( 8, a) /* DF071 */ 98 108 #define T_GLONASS_IOD(a) ADDBITS( 8, a) /* DF239 */ … … 102 112 #define T_BDS_TOEMOD(a) ADDBITS(10, (a/8)) /* DF470 */ 103 113 #define T_BDS_IOD(a) ADDBITS( 8, a) /* DF471 */ 104 105 114 #define T_DELTA_RADIAL(a) SCALEADDBITS(22, 10000.0, a) 106 115 #define T_DELTA_ALONG_TRACK(a) SCALEADDBITS(20, 2500.0, a) … … 110 119 #define T_DELTA_DOT_CROSS_TRACK(a) SCALEADDBITS(19, 250000.0, a) 111 120 112 #define T_SATELLITE_REFERENCE_DATUM(a) ADDBITS(1, a)113 121 #define T_DELTA_CLOCK_C0(a) SCALEADDBITS(22, 10000.0, a) 114 122 #define T_DELTA_CLOCK_C1(a) SCALEADDBITS(21, 1000000.0, a) 115 123 #define T_DELTA_CLOCK_C2(a) SCALEADDBITS(27, 50000000.0, a) 124 #define T_HR_CLOCK_CORRECTION(a) SCALEADDBITS(22, 10000.0, a) 125 116 126 #define T_NO_OF_CODE_BIASES(a) ADDBITS( 5, a) 117 127 #define T_NO_OF_PHASE_BIASES(a) ADDBITS( 5, a) … … 122 132 #define T_PHASE_BIAS(a) SCALEADDBITS(20, 10000.0, a) 123 133 124 #define T_GPS_EPOCH_TIME(a) ADDBITS(20, a) 125 #define T_GLONASS_EPOCH_TIME(a) ADDBITS(17, a) 126 #define T_NO_OF_SATELLITES(a) ADDBITS( 6, a) 127 #define T_MULTIPLE_MESSAGE_INDICATOR(a) ADDBITS( 1, a) 128 #define T_DISPERSIVE_BIAS_INDICATOR(a) ADDBITS( 1, a) 129 #define T_MW_CONSISTENCY_INDICATOR(a) ADDBITS( 1, a) 134 /* Phase specific part of GNSS phase bias message */ 130 135 #define T_INTEGER_INDICATOR(a) ADDBITS( 1, a) 131 136 #define T_WIDE_LANE_INDICATOR(a) ADDBITS( 2, a) 132 137 #define T_DISCONTINUITY_COUNTER(a) ADDBITS( 4, a) 138 #define T_DISPERSIVE_BIAS_INDICATOR(a) ADDBITS( 1, a) 139 #define T_MW_CONSISTENCY_INDICATOR(a) ADDBITS( 1, a) 140 141 /* URA */ 133 142 #define T_SSR_URA(a) ADDBITS( 6, a) 134 #define T_HR_CLOCK_CORRECTION(a) SCALEADDBITS(22, 10000.0, a) 135 #define T_SSR_UPDATE_INTERVAL(a) ADDBITS( 4, a) 136 137 #define T_SSR_IOD(a) ADDBITS( 4, a) 138 #define T_SSR_PROVIDER_ID(a) ADDBITS(16, a) 139 #define T_SSR_SOLUTION_ID(a) ADDBITS( 4, a) 140 143 144 /* Ionosphere */ 141 145 #define T_NO_IONO_LAYERS(a) ADDBITS( 2, a-1) 142 #define T_VTEC_QUALITY_INDICATOR(a) SCALEADDBITS( 9, 20.0, a) 143 #define T_IONO_COEFF(a) SCALEADDBITS(16, 200.0, a) 146 #define T_IONO_HEIGHT(a) SCALEADDBITS( 8, 1/10000.0, a) 144 147 #define T_IONO_DEGREE(a) ADDBITS( 4, a-1) 145 148 #define T_IONO_ORDER(a) ADDBITS( 4, a-1) 146 #define T_IONO_HEIGHT(a) SCALEADDBITS( 8, 1/10000.0, a) 149 #define T_IONO_COEFF(a) SCALEADDBITS(16, 200.0, a) 150 #define T_VTEC_QUALITY_INDICATOR(a) SCALEADDBITS( 9, 20.0, a) 147 151 148 152 static double URAToValue(int ura) { … … 612 616 INITBLOCK 613 617 T_RTCM_MESSAGE_NUMBER(VTEC_BASE) 614 615 618 T_GPS_EPOCH_TIME(v->EpochTime) 616 619 T_SSR_UPDATE_INTERVAL(v->UpdateInterval) … … 648 651 649 652 #define LOADBITS(a) { \ 650 while((a) > numbits) \ 651 { \ 653 while((a) > numbits) { \ 652 654 if(!size--) return GCOBR_SHORTMESSAGE; \ 653 655 bitbuffer = (bitbuffer<<8)|((unsigned char)*(buffer++)); \ … … 690 692 #define SKIPBITS(b) { LOADBITS(b) numbits -= (b); } 691 693 692 /* GPS macros also used for other systems when matching! */ 693 #define G_HEADER(a) GETBITS(a,8) 694 #define G_RESERVEDH(a) GETBITS(a,6) 694 #define G_HEADER(a) GETBITS(a, 8) 695 #define G_RESERVEDH(a) GETBITS(a, 6) 695 696 #define G_SIZE(a) GETBITS(a, 10) 696 #define G_RTCM_MESSAGE_NUMBER(a) GETBITS(a, 12) /* DF002 */ 697 #define G_GPS_SATELLITE_ID(a) GETBITS(a, 6) /* DF068 */ 698 #define G_QZSS_SATELLITE_ID(a) GETBITS(a, 4) /* DF249 */ 699 #define G_GLONASS_SATELLITE_ID(a) GETBITS(a, 5) 700 701 #define G_GPS_IODE(a) GETBITS(a, 8) /* DF071 */ 702 #define G_GLONASS_IOD(a) GETBITS(a, 8) /* DF237 */ 697 698 /* GNSS macros - Header part */ 699 #define G_RTCM_MESSAGE_NUMBER(a) GETBITS(a, 12) /* DF002 */ 700 #define G_GPS_EPOCH_TIME(a, b) {unsigned int temp; GETBITS(temp, 20) \ 701 if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;} 702 #define G_GLONASS_EPOCH_TIME(a, b) {unsigned int temp; GETBITS(temp, 17) \ 703 if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;} 704 #define G_EPOCH_TIME(a) GETBITS(a, 20) 705 #define G_SSR_UPDATE_INTERVAL(a) GETBITS(a, 4) 706 #define G_MULTIPLE_MESSAGE_INDICATOR(a) GETBITS(a, 1) 707 #define G_SATELLITE_REFERENCE_DATUM(a) GETBITS(a, 1) 708 #define G_SSR_IOD(a) GETBITS(a, 4) 709 #define G_SSR_PROVIDER_ID(a) GETBITS(a, 16) 710 #define G_SSR_SOLUTION_ID(a) GETBITS(a, 4) 711 #define G_NO_OF_SATELLITES(a) GETBITS(a, 6) 712 713 /* GNSS macros - Satellite specific part */ 714 #define G_GPS_SATELLITE_ID(a) GETBITS(a, 6) /* DF068 */ 715 #define G_QZSS_SATELLITE_ID(a) GETBITS(a, 4) /* DF249 */ 716 #define G_GLONASS_SATELLITE_ID(a) GETBITS(a, 5) 717 #define G_GPS_IODE(a) GETBITS(a, 8) /* DF071 */ 718 #define G_GLONASS_IOD(a) GETBITS(a, 8) /* DF237 */ 703 719 #define G_GALILEO_IOD(a) GETBITS(a, 10) /* DF459 */ 704 720 #define G_SBAS_T0MOD(a) GETBITSFACTOR(a, 9, 16) /* DF468 */ 705 721 #define G_SBAS_IODCRC(a) GETBITS(a, 24) /* DF469 */ 706 722 #define G_BDS_TOEMOD(a) GETBITSFACTOR(a, 10, 8) /* DF470 */ 707 #define G_BDS_IOD(a) GETBITS(a, 8) /* DF471 */ 708 709 /* defined values */ 723 #define G_BDS_IOD(a) GETBITS(a, 8) /* DF471 */ 724 710 725 #define G_DELTA_RADIAL(a) GETFLOATSIGN(a, 22, 1/10000.0) 711 726 #define G_DELTA_ALONG_TRACK(a) GETFLOATSIGN(a, 20, 1/2500.0) … … 715 730 #define G_DELTA_DOT_CROSS_TRACK(a) GETFLOATSIGN(a, 19, 1/250000.0) 716 731 717 #define G_SATELLITE_REFERENCE_DATUM(a) GETBITS(a, 1)718 732 #define G_DELTA_CLOCK_C0(a) GETFLOATSIGN(a, 22, 1/10000.0) 719 733 #define G_DELTA_CLOCK_C1(a) GETFLOATSIGN(a, 21, 1/1000000.0) 720 734 #define G_DELTA_CLOCK_C2(a) GETFLOATSIGN(a, 27, 1/50000000.0) 735 #define G_HR_CLOCK_CORRECTION(a) GETFLOATSIGN(a, 22, 1/10000.0) 736 721 737 #define G_NO_OF_CODE_BIASES(a) GETBITS(a, 5) 722 738 #define G_NO_OF_PHASE_BIASES(a) GETBITS(a, 5) … … 724 740 #define G_CODE_BIAS(a) GETFLOATSIGN(a, 14, 1/100.0) 725 741 #define G_YAW_ANGLE(a) GETFLOAT(a, 9, MPI/256.0) 726 #define G_YAW_RATE(a) GETFLOATSIGN(a, 8, MPI/8192.0)742 #define G_YAW_RATE(a) GETFLOATSIGN(a, 8, MPI/8192.0) 727 743 #define G_PHASE_BIAS(a) GETFLOATSIGN(a, 20, 1/10000.0) 728 744 729 #define G_GPS_EPOCH_TIME(a, b) {unsigned int temp; GETBITS(temp, 20) \ 730 if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;} 731 #define G_GLONASS_EPOCH_TIME(a, b) {unsigned int temp; GETBITS(temp, 17) \ 732 if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;} 733 #define G_EPOCH_TIME(a) GETBITS(a, 20) 734 #define G_NO_OF_SATELLITES(a) GETBITS(a, 6) 735 #define G_MULTIPLE_MESSAGE_INDICATOR(a) GETBITS(a, 1) 745 /* Phase specific part of GNSS phase bias message */ 736 746 #define G_DISPERSIVE_BIAS_INDICATOR(a) GETBITS(a, 1) 737 747 #define G_MW_CONSISTENCY_INDICATOR(a) GETBITS(a, 1) … … 739 749 #define G_WIDE_LANE_INDICATOR(a) GETBITS(a, 2) 740 750 #define G_DISCONTINUITY_COUNTER(a) GETBITS(a, 4) 751 752 /* URA */ 741 753 #define G_SSR_URA(a) {int temp; GETBITS(temp, 6) \ 742 754 (a) = URAToValue(temp);} 743 #define G_HR_CLOCK_CORRECTION(a) GETFLOATSIGN(a, 22, 1/10000.0) 744 #define G_SSR_UPDATE_INTERVAL(a) GETBITS(a, 4) 745 746 #define G_SSR_IOD(a) GETBITS(a, 4) 747 #define G_SSR_PROVIDER_ID(a) GETBITS(a, 16) 748 #define G_SSR_SOLUTION_ID(a) GETBITS(a, 4) 749 750 #define G_NO_IONO_LAYERS(a) {unsigned int temp; GETBITS(temp, 2) a = temp+1; } 751 #define G_VTEC_QUALITY_INDICATOR(a) GETFLOAT(a, 9, 1/20.0) 755 756 /* Ionosphere */ 757 #define G_NO_IONO_LAYERS(a) {unsigned int temp; GETBITS(temp, 2) a = temp+1; } 758 #define G_IONO_HEIGHT(a) GETFLOAT(a, 8 , 10000.0) 759 #define G_IONO_DEGREE(a) {unsigned int temp; GETBITS(temp, 4) a = temp+1; } 760 #define G_IONO_ORDER(a) {unsigned int temp; GETBITS(temp, 4) a = temp+1; } 752 761 #define G_IONO_COEFF(a) GETFLOATSIGN(a, 16,1/200.0) 753 #define G_IONO_DEGREE(a) {unsigned int temp; GETBITS(temp, 4) a = temp+1; } 754 #define G_IONO_ORDER(a) {unsigned int temp; GETBITS(temp, 4) a = temp+1; } 755 #define G_IONO_HEIGHT(a) GETFLOAT(a, 8 , 10000.0) 762 #define G_VTEC_QUALITY_INDICATOR(a) GETFLOAT (a, 9, 1/20.0) 756 763 757 764 enum GCOB_RETURN GetSSR(struct ClockOrbit *co, struct CodeBias *b,struct VTEC *v,
Note:
See TracChangeset
for help on using the changeset viewer.