Changeset 8970 in ntrip for trunk/BNC/src
- Timestamp:
- Jul 15, 2020, 9:24:30 AM (5 years ago)
- Location:
- trunk/BNC/src/RTCM3/clock_and_orbit
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.c
r8969 r8970 90 90 91 91 /* GPS macros also used for other systems when matching! */ 92 #define T_ MESSAGE_NUMBER(a) ADDBITS(12, a)/* DF002 */93 #define T_GPS_SATELLITE_ID(a) ADDBITS( 6, a) /* DF068 */94 #define T_QZSS_SATELLITE_ID(a) ADDBITS( 4, a) /* DF249 */95 #define T_GLONASS_SATELLITE_ID(a) ADDBITS( 5, a)96 97 #define T_GPS_IODE(a) ADDBITS( 8, a) /* DF071 */98 #define T_GLONASS_IOD(a) ADDBITS( 8, a) /* DF239 */99 #define T_GALILEO_IOD(a) ADDBITS(10, a) /* DF459 */100 #define T_SBAS_T0MOD(a) ADDBITS( 9, (a/16)) /* DF468 */101 #define T_SBAS_IODCRC(a) ADDBITS(24, a) /* DF469 */102 #define T_BDS_TOEMOD(a) ADDBITS(10, (a/8)) /* DF470 */103 #define T_BDS_IOD(a) ADDBITS( 8, a) /* DF471 */92 #define T_RTCM_MESSAGE_NUMBER(a) ADDBITS(12, a) /* DF002 */ 93 #define T_GPS_SATELLITE_ID(a) ADDBITS( 6, a) /* DF068 */ 94 #define T_QZSS_SATELLITE_ID(a) ADDBITS( 4, a) /* DF249 */ 95 #define T_GLONASS_SATELLITE_ID(a) ADDBITS( 5, a) 96 97 #define T_GPS_IODE(a) ADDBITS( 8, a) /* DF071 */ 98 #define T_GLONASS_IOD(a) ADDBITS( 8, a) /* DF239 */ 99 #define T_GALILEO_IOD(a) ADDBITS(10, a) /* DF459 */ 100 #define T_SBAS_T0MOD(a) ADDBITS( 9, (a/16)) /* DF468 */ 101 #define T_SBAS_IODCRC(a) ADDBITS(24, a) /* DF469 */ 102 #define T_BDS_TOEMOD(a) ADDBITS(10, (a/8)) /* DF470 */ 103 #define T_BDS_IOD(a) ADDBITS( 8, a) /* DF471 */ 104 104 105 105 #define T_DELTA_RADIAL(a) SCALEADDBITS(22, 10000.0, a) … … 114 114 #define T_DELTA_CLOCK_C1(a) SCALEADDBITS(21, 1000000.0, a) 115 115 #define T_DELTA_CLOCK_C2(a) SCALEADDBITS(27, 50000000.0, a) 116 #define T_NO_OF_CODE_BIASES(a) ADDBITS( 5, a)117 #define T_NO_OF_PHASE_BIASES(a) ADDBITS( 5, a)118 #define T_SIGNAL_IDENTIFIER(a) ADDBITS( 5, a)116 #define T_NO_OF_CODE_BIASES(a) ADDBITS( 5, a) 117 #define T_NO_OF_PHASE_BIASES(a) ADDBITS( 5, a) 118 #define T_SIGNAL_IDENTIFIER(a) ADDBITS( 5, a) 119 119 #define T_CODE_BIAS(a) SCALEADDBITS(14, 100.0, a) 120 #define T_YAW_ANGLE(a) SCALEADDBITS( 9,256.0/MPI, a)121 #define T_YAW_RATE(a) SCALEADDBITS( 8,8192.0/MPI, a)120 #define T_YAW_ANGLE(a) SCALEADDBITS( 9, 256.0/MPI, a) 121 #define T_YAW_RATE(a) SCALEADDBITS( 8, 8192.0/MPI, a) 122 122 #define T_PHASE_BIAS(a) SCALEADDBITS(20, 10000.0, a) 123 123 124 124 #define T_GPS_EPOCH_TIME(a) ADDBITS(20, a) 125 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)130 #define T_INTEGER_INDICATOR(a) ADDBITS( 1, a)131 #define T_WIDE_LANE_INDICATOR(a) ADDBITS( 2, a)132 #define T_DISCONTINUITY_COUNTER(a) ADDBITS( 4, a)133 #define T_SSR_URA(a) ADDBITS( 6, 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) 130 #define T_INTEGER_INDICATOR(a) ADDBITS( 1, a) 131 #define T_WIDE_LANE_INDICATOR(a) ADDBITS( 2, a) 132 #define T_DISCONTINUITY_COUNTER(a) ADDBITS( 4, a) 133 #define T_SSR_URA(a) ADDBITS( 6, a) 134 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)135 #define T_SSR_UPDATE_INTERVAL(a) ADDBITS( 4, a) 136 137 #define T_SSR_IOD(a) ADDBITS( 4, a) 138 138 #define T_SSR_PROVIDER_ID(a) ADDBITS(16, a) 139 #define T_SSR_SOLUTION_ID(a) ADDBITS( 4, a)140 141 #define T_NO_IONO_LAYERS(a) ADDBITS( 2, a-1)142 #define T_VTEC_QUALITY_INDICATOR(a) SCALEADDBITS( 9,20.0, a)139 #define T_SSR_SOLUTION_ID(a) ADDBITS( 4, a) 140 141 #define T_NO_IONO_LAYERS(a) ADDBITS( 2, a-1) 142 #define T_VTEC_QUALITY_INDICATOR(a) SCALEADDBITS( 9, 20.0, a) 143 143 #define T_IONO_COEFF(a) SCALEADDBITS(16, 200.0, a) 144 #define T_IONO_DEGREE(a) ADDBITS( 4, a-1)145 #define T_IONO_ORDER(a) ADDBITS( 4, a-1)146 #define T_IONO_HEIGHT(a) SCALEADDBITS( 8, 1/10000.0, a)144 #define T_IONO_DEGREE(a) ADDBITS( 4, a-1) 145 #define T_IONO_ORDER(a) ADDBITS( 4, a-1) 146 #define T_IONO_HEIGHT(a) SCALEADDBITS( 8, 1/10000.0, a) 147 147 148 148 static double URAToValue(int ura) { … … 186 186 CLOCKORBIT_COUNTSAT 187 187 }; 188 /*189 //CNES PATCH MEDIAN190 static double Median(int n, double x[50]) {191 double temp;192 int i, j;193 // the following two loops sort the array x in ascending order194 if (n <= 2)195 return 0.0;196 197 for (i = 0; i < n - 1; i++)198 for (j = i + 1; j < n; j++)199 if (x[j] < x[i]) {200 // swap elements201 temp = x[i];202 x[i] = x[j];203 x[j] = temp;204 }205 206 if (n % 2 == 0)207 return ((x[n / 2] + x[n / 2 - 1]) / 2.0);208 else209 return x[n / 2];210 }211 //PATCH MEDIAN212 //PATCH CLKOFFSET213 size_t MakeClockOrbit(struct ClockOrbit *co, enum ClockOrbitType type,*/214 188 215 189 size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type, … … 218 192 219 193 memset(status, 0, sizeof(status)); 220 /* PATCH CLKOFFSET ///////////////////////////////////////////////////// 221 //double tSum 222 double tOffset, tClock[50]; 223 int j, tNb; 224 for (s = 0; s < CLOCKORBIT_SATNUM; ++s) 225 { 226 //tSum = 0.0; 227 tOffset = 0.0; 228 tNb = 0; 229 for (j = 0; j < 50; j++) 230 tClock[j] = 0.0; 231 232 for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) { 233 if (co->Sat[i].Clock.DeltaA0) { 234 //tSum += co->Sat[i].Clock.DeltaA0; //Average 235 tClock[tNb] = co->Sat[i].Clock.DeltaA0; //Median 236 tNb++; 237 } 238 } 239 //tOffset = tSum/(double)tNb; //Average 240 tOffset = Median(tNb, tClock); //Median 241 for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) 242 if (co->Sat[i].Clock.DeltaA0) { 243 //clkoffset_test 244 // FILE *ficOffsetClk = fopen("ClkOffset.txt","a"); 245 // fprintf(ficOffsetClk,"%d %d %d %lf %lf %lf\n",co->EpochTime[s], s, i, co->Sat[i].Clock.DeltaA0, tOffset, co->Sat[i].Clock.DeltaA0-tOffset); 246 // fclose(ficOffsetClk); 247 248 co->Sat[i].Clock.DeltaA0 -= tOffset; 249 } 250 } 251 //PATCH CLKOFFSET ///////////////////////////////////////////////////// */ 252 253 STARTDATA 194 195 STARTDATA 254 196 255 197 for (s = 0; s < CLOCKORBIT_SATNUM; ++s) { … … 269 211 if (status[s][COBOFS_ORBIT]) { 270 212 INITBLOCK 271 T_ MESSAGE_NUMBER(corbase[s] + COBOFS_ORBIT)213 T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_ORBIT) 272 214 switch (s) { 273 215 case CLOCKORBIT_SATGPS: … … 329 271 if (status[s][COBOFS_CLOCK]) { 330 272 INITBLOCK 331 T_ MESSAGE_NUMBER(corbase[s] + COBOFS_CLOCK)273 T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_CLOCK) 332 274 switch (s) { 333 275 case CLOCKORBIT_SATGPS: … … 383 325 #endif 384 326 INITBLOCK 385 T_ MESSAGE_NUMBER(corbase[s] + COBOFS_COMBINED)327 T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_COMBINED) 386 328 switch (s) { 387 329 case CLOCKORBIT_SATGPS: … … 462 404 if (status[s][COBOFS_HR]) { 463 405 INITBLOCK 464 T_ MESSAGE_NUMBER(corbase[s] + COBOFS_HR)406 T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_HR) 465 407 switch (s) { 466 408 case CLOCKORBIT_SATGPS: … … 502 444 if (status[s][COBOFS_URA]) { 503 445 INITBLOCK 504 T_ MESSAGE_NUMBER(corbase[s] + COBOFS_URA)446 T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_URA) 505 447 switch (s) { 506 448 case CLOCKORBIT_SATGPS: … … 553 495 if (b->NumberOfSat[s] && (type == CBTYPE_AUTO || type == corbase[s] + COBOFS_CBIAS)) { 554 496 INITBLOCK 555 T_ MESSAGE_NUMBER(corbase[s] + COBOFS_CBIAS)497 T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_CBIAS) 556 498 switch (s) { 557 499 case CLOCKORBIT_SATGPS: … … 608 550 if (b->NumberOfSat[s] && (type == PBTYPE_AUTO || type == s + PBTYPE_BASE)) { 609 551 INITBLOCK 610 T_ MESSAGE_NUMBER(s + PBTYPE_BASE)552 T_RTCM_MESSAGE_NUMBER(s + PBTYPE_BASE) 611 553 switch (s) { 612 554 case CLOCKORBIT_SATGPS: … … 669 611 STARTDATA 670 612 INITBLOCK 671 T_ MESSAGE_NUMBER(VTEC_BASE)613 T_RTCM_MESSAGE_NUMBER(VTEC_BASE) 672 614 673 615 T_GPS_EPOCH_TIME(v->EpochTime) … … 1346 1288 continue; 1347 1289 } 1348 #ifdef COR_LATENCY1349 if(s == CLOCKORBIT_SATGPS && type-corbase[s] != COBOFS_BIAS) {1350 co->epochGPS[co->epochSize] = co->EpochTime[s];1351 if(co->epochSize < COR_LATENCYCOUNT)1352 ++co->epochSize;1353 }1354 #endif1355 1290 #ifdef DEBUG 1356 1291 for(type = 0; type < (int)size && (unsigned char)buffer[type] != 0xD3; ++type) -
trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.h
r8969 r8970 38 38 39 39 enum ClockOrbitType { 40 COTYPE_GPSORBIT = COBBASE_GPS + COBOFS_ORBIT,40 COTYPE_GPSORBIT = COBBASE_GPS + COBOFS_ORBIT, 41 41 COTYPE_GPSCLOCK, 42 COTYPE_GPSCOMBINED = COBBASE_GPS + COBOFS_COMBINED,42 COTYPE_GPSCOMBINED = COBBASE_GPS + COBOFS_COMBINED, 43 43 COTYPE_GPSURA, 44 44 COTYPE_GPSHR, … … 56 56 COTYPE_GALILEOHR, 57 57 58 COTYPE_QZSSORBIT = COBBASE_QZSS + COBOFS_ORBIT,58 COTYPE_QZSSORBIT = COBBASE_QZSS + COBOFS_ORBIT, 59 59 COTYPE_QZSSCLOCK, 60 COTYPE_QZSSCOMBINED = COBBASE_QZSS + COBOFS_COMBINED,60 COTYPE_QZSSCOMBINED = COBBASE_QZSS + COBOFS_COMBINED, 61 61 COTYPE_QZSSURA, 62 62 COTYPE_QZSSHR, 63 63 64 COTYPE_SBASORBIT = COBBASE_SBAS + COBOFS_ORBIT,64 COTYPE_SBASORBIT = COBBASE_SBAS + COBOFS_ORBIT, 65 65 COTYPE_SBASCLOCK, 66 COTYPE_SBASCOMBINED = COBBASE_SBAS + COBOFS_COMBINED,66 COTYPE_SBASCOMBINED = COBBASE_SBAS + COBOFS_COMBINED, 67 67 COTYPE_SBASURA, 68 68 COTYPE_SBASHR, 69 69 70 COTYPE_BDSORBIT = COBBASE_BDS + COBOFS_ORBIT,70 COTYPE_BDSORBIT = COBBASE_BDS + COBOFS_ORBIT, 71 71 COTYPE_BDSCLOCK, 72 72 COTYPE_BDSCOMBINED = COBBASE_BDS + COBOFS_COMBINED, … … 248 248 xxx->Sat[CLOCKORBIT_OFFSETGPS]. */ 249 249 250 #ifdef COR_LEGACY251 /* old names */252 #define NumberOfGPSSat NumberOfSat[CLOCKORBIT_SATGPS]253 #define NumberOfGLONASSSat NumberOfSat[CLOCKORBIT_SATGLONASS]254 #define GPSEpochTime EpochTime[CLOCKORBIT_SATGPS] /* 0 .. 604799 s */255 #define GLONASSEpochTime EpochTime[CLOCKORBIT_SATGLONASS] /* 0 .. 86399 s (86400 for leap second) */256 #define ClockDataSupplied Supplied[COBOFS_CLOCK]257 #define HRDataSupplied Supplied[COBOFS_HR]258 #define OrbitDataSupplied Supplied[COBOFS_ORBIT]259 #define URADataSupplied Supplied[COBOFS_URA]260 #define GetClockOrbitBias(a,b,c,d,e) GetSSR(a,b,0,0,c,d,e)261 #endif /* COR_LEGACY */262 263 /* latency check code, disabled by default */264 #ifdef COR_LATENCY265 #define COR_LATENCYCOUNT 100266 #endif267 268 250 struct ClockOrbit { 269 251 enum ClockOrbitType messageType; … … 271 253 unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */ 272 254 unsigned int Supplied[COBOFS_NUM]; /* boolean */ 273 #ifdef COR_LATENCY274 unsigned int epochGPS[COR_LATENCYCOUNT+1]; /* Weber, for latency */275 unsigned int epochSize; /* Weber, for latency */276 #endif277 255 unsigned int SSRIOD; 278 256 unsigned int SSRProviderID;
Note:
See TracChangeset
for help on using the changeset viewer.