[9025] | 1 | /* Programheader
|
---|
| 2 |
|
---|
| 3 | Name: clock_orbit_igs.c
|
---|
| 4 | Project: RTCM3
|
---|
| 5 | Version: $Id: clock_orbit_igs.c 8963 2020-06-29 12:46:25Z stuerze $
|
---|
| 6 | Authors: Dirk Stöcker, Andrea Stürze
|
---|
| 7 | Description: state space approach: IGS
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #include <math.h>
|
---|
| 11 | #include <stdio.h>
|
---|
| 12 | #include <string.h>
|
---|
| 13 | #ifndef sparc
|
---|
| 14 | #include <stdint.h>
|
---|
| 15 | #else
|
---|
| 16 | #include <sys/types.h>
|
---|
| 17 | #endif
|
---|
| 18 | #include <clock_orbit_igs.h>
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | size_t SsrCorrIgs::MakeClockOrbit(const struct ClockOrbit *co, ClockOrbitType type,
|
---|
| 22 | int moremessagesfollow, char *buffer, size_t size) {
|
---|
[9962] | 23 | std::vector< std::vector<unsigned int> > status(CLOCKORBIT_SATNUM, std::vector<unsigned int>(COBOFS_NUM));
|
---|
| 24 | unsigned int i, s;
|
---|
[9025] | 25 |
|
---|
| 26 | STARTDATA
|
---|
| 27 |
|
---|
| 28 | for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
|
---|
| 29 | for (i = 0; i < COBOFS_NUM; ++i) {
|
---|
| 30 | if (co->NumberOfSat[s] && (type == COTYPE_AUTO || type == corbase[s] + i) &&
|
---|
| 31 | (co->Supplied[i] || (i <= COBOFS_CLOCK && co->Supplied[COBOFS_COMBINED]) ||
|
---|
| 32 | (i == COBOFS_COMBINED && co->Supplied[COBOFS_ORBIT] && co->Supplied[COBOFS_CLOCK]))) {
|
---|
| 33 | status[s][i] = 1;
|
---|
| 34 | if (i == COBOFS_COMBINED) {
|
---|
| 35 | status[s][COBOFS_ORBIT] = status[s][COBOFS_CLOCK] = 0;
|
---|
| 36 | } /* disable single blocks for combined type */
|
---|
| 37 | } /* check for data */
|
---|
| 38 | } /* iterate over sub-types */
|
---|
| 39 | } /* iterate over satellite systems */
|
---|
| 40 |
|
---|
| 41 | for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
|
---|
| 42 | if (status[s][COBOFS_ORBIT]) {
|
---|
| 43 | INITBLOCK
|
---|
| 44 | T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
|
---|
| 45 | T_IGS_SSR_VERSION(IGS_SSR_VERSION)
|
---|
| 46 | T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_ORBIT)
|
---|
| 47 | T_SSR_EPOCH_TIME(co->EpochTime[s])
|
---|
| 48 | T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
|
---|
| 49 | T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
|
---|
| 50 | T_SSR_IOD(co->SSRIOD)
|
---|
| 51 | T_SSR_PROVIDER_ID(co->SSRProviderID)
|
---|
| 52 | T_SSR_SOLUTION_ID(co->SSRSolutionID)
|
---|
| 53 | T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
|
---|
| 54 | T_NO_OF_SATELLITES(co->NumberOfSat[s])
|
---|
| 55 | for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
|
---|
| 56 | T_GNSS_SATELLITE_ID(co->Sat[i].ID)
|
---|
| 57 | T_GNSS_IOD(co->Sat[i].IOD)
|
---|
| 58 | T_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
|
---|
| 59 | T_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
|
---|
| 60 | T_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
|
---|
| 61 | T_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
|
---|
| 62 | T_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
|
---|
| 63 | T_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
|
---|
| 64 | }
|
---|
| 65 | ENDBLOCK
|
---|
| 66 | }
|
---|
| 67 | if (status[s][COBOFS_CLOCK]) {
|
---|
| 68 | INITBLOCK
|
---|
| 69 | T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
|
---|
| 70 | T_IGS_SSR_VERSION(IGS_SSR_VERSION)
|
---|
| 71 | T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_CLOCK)
|
---|
| 72 | T_SSR_EPOCH_TIME(co->EpochTime[s])
|
---|
| 73 | T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
|
---|
| 74 | T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
|
---|
| 75 | T_SSR_IOD(co->SSRIOD)
|
---|
| 76 | T_SSR_PROVIDER_ID(co->SSRProviderID)
|
---|
| 77 | T_SSR_SOLUTION_ID(co->SSRSolutionID)
|
---|
| 78 | T_NO_OF_SATELLITES(co->NumberOfSat[s])
|
---|
| 79 | for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
|
---|
| 80 | T_GNSS_SATELLITE_ID(co->Sat[i].ID)
|
---|
| 81 | T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
|
---|
| 82 | T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
|
---|
| 83 | T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
|
---|
| 84 | }
|
---|
| 85 | ENDBLOCK
|
---|
| 86 | }
|
---|
| 87 | if (status[s][COBOFS_COMBINED]) {
|
---|
| 88 | #ifdef SPLITBLOCK
|
---|
[9962] | 89 | unsigned int nums = co->NumberOfSat[s];
|
---|
| 90 | unsigned int left, start = satoffset[s];
|
---|
[9025] | 91 | if(nums > 28) {/* split block when more than 28 sats */
|
---|
| 92 | left = nums - 28;
|
---|
| 93 | nums = 28;
|
---|
| 94 | }
|
---|
| 95 | else {
|
---|
| 96 | left = 0;
|
---|
| 97 | }
|
---|
| 98 | while(nums) {
|
---|
| 99 | #endif
|
---|
| 100 | INITBLOCK
|
---|
| 101 | T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
|
---|
| 102 | T_IGS_SSR_VERSION(IGS_SSR_VERSION)
|
---|
| 103 | T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_COMBINED)
|
---|
| 104 | T_SSR_EPOCH_TIME(co->EpochTime[s])
|
---|
| 105 | T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
|
---|
| 106 | #ifdef SPLITBLOCK
|
---|
| 107 | T_MULTIPLE_MESSAGE_INDICATOR((moremessagesfollow || left) ? 1 : 0)
|
---|
| 108 | #else
|
---|
| 109 | T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
|
---|
| 110 | #endif
|
---|
| 111 | T_SSR_IOD(co->SSRIOD)
|
---|
| 112 | T_SSR_PROVIDER_ID(co->SSRProviderID)
|
---|
| 113 | T_SSR_SOLUTION_ID(co->SSRSolutionID)
|
---|
| 114 | T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
|
---|
| 115 | #ifdef SPLITBLOCK
|
---|
| 116 | T_NO_OF_SATELLITES(nums)
|
---|
| 117 | for(i = start; i < start+nums; ++i) {
|
---|
| 118 | #else
|
---|
| 119 | T_NO_OF_SATELLITES(co->NumberOfSat[s])
|
---|
| 120 | for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
|
---|
| 121 | #endif
|
---|
| 122 | T_GNSS_SATELLITE_ID(co->Sat[i].ID)
|
---|
| 123 | T_GNSS_IOD(co->Sat[i].IOD)
|
---|
| 124 | T_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
|
---|
| 125 | T_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
|
---|
| 126 | T_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
|
---|
| 127 | T_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
|
---|
| 128 | T_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
|
---|
| 129 | T_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
|
---|
| 130 | T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
|
---|
| 131 | T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
|
---|
| 132 | T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
|
---|
| 133 | }
|
---|
| 134 | ENDBLOCK
|
---|
| 135 | #ifdef SPLITBLOCK
|
---|
| 136 | start += nums;
|
---|
| 137 | nums = left;
|
---|
| 138 | left = 0;
|
---|
| 139 | }
|
---|
| 140 | #endif
|
---|
| 141 | }
|
---|
| 142 | if (status[s][COBOFS_HR]) {
|
---|
| 143 | INITBLOCK
|
---|
| 144 | T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
|
---|
| 145 | T_IGS_SSR_VERSION(IGS_SSR_VERSION)
|
---|
| 146 | T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_HR)
|
---|
| 147 | T_SSR_EPOCH_TIME(co->EpochTime[s])
|
---|
| 148 | T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
|
---|
| 149 | T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
|
---|
| 150 | T_SSR_IOD(co->SSRIOD)
|
---|
| 151 | T_SSR_PROVIDER_ID(co->SSRProviderID)
|
---|
| 152 | T_SSR_SOLUTION_ID(co->SSRSolutionID)
|
---|
| 153 | T_NO_OF_SATELLITES(co->NumberOfSat[s])
|
---|
| 154 | for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
|
---|
| 155 | T_GNSS_SATELLITE_ID(co->Sat[i].ID)
|
---|
| 156 | T_HR_CLOCK_CORRECTION(co->Sat[i].hrclock)
|
---|
| 157 | }
|
---|
| 158 | ENDBLOCK
|
---|
| 159 | }
|
---|
| 160 | if (status[s][COBOFS_URA]) {
|
---|
| 161 | INITBLOCK
|
---|
| 162 | T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
|
---|
| 163 | T_IGS_SSR_VERSION(IGS_SSR_VERSION)
|
---|
| 164 | T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_URA)
|
---|
| 165 | T_SSR_EPOCH_TIME(co->EpochTime[s])
|
---|
| 166 | T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
|
---|
| 167 | T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
|
---|
| 168 | T_SSR_IOD(co->SSRIOD)
|
---|
| 169 | T_SSR_PROVIDER_ID(co->SSRProviderID)
|
---|
| 170 | T_SSR_SOLUTION_ID(co->SSRSolutionID)
|
---|
| 171 | T_NO_OF_SATELLITES(co->NumberOfSat[s])
|
---|
| 172 | for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
|
---|
| 173 | T_GNSS_SATELLITE_ID(co->Sat[i].ID)
|
---|
| 174 | T_SSR_URA(ValueToURA(co->Sat[i].UserRangeAccuracy))
|
---|
| 175 | }
|
---|
| 176 | ENDBLOCK
|
---|
| 177 | }
|
---|
| 178 | }
|
---|
| 179 | return ressize;
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | size_t SsrCorrIgs::MakeCodeBias(const struct CodeBias *b, CodeBiasType type,
|
---|
| 183 | int moremessagesfollow, char *buffer, size_t size) {
|
---|
| 184 | unsigned int s, i, j;
|
---|
| 185 |
|
---|
| 186 | STARTDATA
|
---|
| 187 |
|
---|
| 188 | for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
|
---|
| 189 | if (b->NumberOfSat[s] && (type == CBTYPE_AUTO || type == corbase[s] + COBOFS_CBIAS)) {
|
---|
| 190 | INITBLOCK
|
---|
| 191 | T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
|
---|
| 192 | T_IGS_SSR_VERSION(IGS_SSR_VERSION)
|
---|
| 193 | T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_CBIAS)
|
---|
| 194 | T_SSR_EPOCH_TIME(b->EpochTime[s])
|
---|
| 195 | T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
|
---|
| 196 | T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
|
---|
| 197 | T_SSR_IOD(b->SSRIOD)
|
---|
| 198 | T_SSR_PROVIDER_ID(b->SSRProviderID)
|
---|
| 199 | T_SSR_SOLUTION_ID(b->SSRSolutionID)
|
---|
| 200 | T_NO_OF_SATELLITES(b->NumberOfSat[s])
|
---|
| 201 | for (i = satoffset[s]; i < satoffset[s] + b->NumberOfSat[s]; ++i) {
|
---|
| 202 | T_GNSS_SATELLITE_ID(b->Sat[i].ID)
|
---|
| 203 | T_NO_OF_BIASES(b->Sat[i].NumberOfCodeBiases)
|
---|
| 204 | for (j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j) {
|
---|
| 205 | T_GNSS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
|
---|
| 206 | T_CODE_BIAS(b->Sat[i].Biases[j].Bias)
|
---|
| 207 | }
|
---|
| 208 | }
|
---|
| 209 | ENDBLOCK
|
---|
| 210 | }
|
---|
| 211 | }
|
---|
| 212 | return ressize;
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | size_t SsrCorrIgs::MakePhaseBias(const struct PhaseBias *b, PhaseBiasType type,
|
---|
| 216 | int moremessagesfollow, char *buffer, size_t size) {
|
---|
| 217 | unsigned int s, i, j;
|
---|
| 218 |
|
---|
| 219 | STARTDATA
|
---|
| 220 |
|
---|
| 221 | for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
|
---|
| 222 | if (b->NumberOfSat[s] && (type == PBTYPE_AUTO || type == corbase[s] + COBOFS_PBIAS)) {
|
---|
| 223 | INITBLOCK
|
---|
| 224 | T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
|
---|
| 225 | T_IGS_SSR_VERSION(IGS_SSR_VERSION)
|
---|
| 226 | T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_PBIAS)
|
---|
| 227 | T_SSR_EPOCH_TIME(b->EpochTime[s])
|
---|
| 228 | T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
|
---|
| 229 | T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
|
---|
| 230 | T_SSR_IOD(b->SSRIOD)
|
---|
| 231 | T_SSR_PROVIDER_ID(b->SSRProviderID)
|
---|
| 232 | T_SSR_SOLUTION_ID(b->SSRSolutionID)
|
---|
| 233 | T_DISPERSIVE_BIAS_INDICATOR(b->DispersiveBiasConsistencyIndicator ? 1 : 0)
|
---|
| 234 | T_MW_CONSISTENCY_INDICATOR(b->MWConsistencyIndicator ? 1 : 0)
|
---|
| 235 | T_NO_OF_SATELLITES(b->NumberOfSat[s])
|
---|
| 236 | for (i = satoffset[s]; i < satoffset[s] + b->NumberOfSat[s]; ++i) {
|
---|
| 237 | T_GNSS_SATELLITE_ID(b->Sat[i].ID)
|
---|
| 238 | T_NO_OF_BIASES(b->Sat[i].NumberOfPhaseBiases)
|
---|
| 239 | T_YAW_ANGLE(b->Sat[i].YawAngle)
|
---|
| 240 | T_YAW_RATE(b->Sat[i].YawRate)
|
---|
| 241 | for (j = 0; j < b->Sat[i].NumberOfPhaseBiases; ++j) {
|
---|
| 242 | T_GNSS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
|
---|
| 243 | T_INTEGER_INDICATOR(b->Sat[i].Biases[j].SignalIntegerIndicator ? 1 : 0)
|
---|
| 244 | T_WIDE_LANE_INDICATOR(b->Sat[i].Biases[j].SignalsWideLaneIntegerIndicator)
|
---|
| 245 | T_DISCONTINUITY_COUNTER(b->Sat[i].Biases[j].SignalDiscontinuityCounter)
|
---|
| 246 | T_PHASE_BIAS(b->Sat[i].Biases[j].Bias)
|
---|
| 247 | }
|
---|
| 248 | }
|
---|
| 249 | ENDBLOCK
|
---|
| 250 | }
|
---|
| 251 | }
|
---|
| 252 | return ressize;
|
---|
| 253 | }
|
---|
| 254 |
|
---|
| 255 | size_t SsrCorrIgs::MakeVTEC(const struct VTEC *v, int moremessagesfollow, char *buffer, size_t size) {
|
---|
| 256 | unsigned int l, o, d;
|
---|
| 257 |
|
---|
| 258 | STARTDATA
|
---|
| 259 | INITBLOCK
|
---|
| 260 |
|
---|
| 261 | T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
|
---|
| 262 | T_IGS_SSR_VERSION(IGS_SSR_VERSION)
|
---|
| 263 | T_IGS_MESSAGE_NUMBER(VTEC_BASE)
|
---|
| 264 | T_SSR_EPOCH_TIME(v->EpochTime)
|
---|
| 265 | T_SSR_UPDATE_INTERVAL(v->UpdateInterval)
|
---|
| 266 | T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
|
---|
| 267 | T_SSR_IOD(v->SSRIOD)
|
---|
| 268 | T_SSR_PROVIDER_ID(v->SSRProviderID)
|
---|
| 269 | T_SSR_SOLUTION_ID(v->SSRSolutionID)
|
---|
| 270 | T_VTEC_QUALITY_INDICATOR(v->Quality)
|
---|
| 271 | T_NO_IONO_LAYERS(v->NumLayers)
|
---|
| 272 | for (l = 0; l < v->NumLayers; ++l) {
|
---|
| 273 | T_IONO_HEIGHT(v->Layers[l].Height)
|
---|
| 274 | T_IONO_DEGREE(v->Layers[l].Degree)
|
---|
| 275 | T_IONO_ORDER(v->Layers[l].Order)
|
---|
| 276 | for (o = 0; o <= v->Layers[l].Order; ++o) {
|
---|
| 277 | for (d = o; d <= v->Layers[l].Degree; ++d) {
|
---|
| 278 | T_IONO_COEFF_C(v->Layers[l].Cosinus[d][o])
|
---|
| 279 | }
|
---|
| 280 | }
|
---|
| 281 | for (o = 1; o <= v->Layers[l].Order; ++o) {
|
---|
| 282 | for (d = o; d <= v->Layers[l].Degree; ++d) {
|
---|
| 283 | T_IONO_COEFF_S(v->Layers[l].Sinus[d][o])
|
---|
| 284 | }
|
---|
| 285 | }
|
---|
| 286 | }
|
---|
| 287 | ENDBLOCK
|
---|
| 288 | return ressize;
|
---|
| 289 | }
|
---|
| 290 |
|
---|
| 291 | enum GCOB_RETURN SsrCorrIgs::GetSSR(struct ClockOrbit *co, struct CodeBias *b,struct VTEC *v,
|
---|
| 292 | struct PhaseBias *pb, const char *buffer, size_t size, int *bytesused) {
|
---|
| 293 | int mmi = 0, h, rs;
|
---|
| 294 | unsigned int rtcmtype, igstype, pos, i, j, s, nums, id, version;
|
---|
| 295 | size_t sizeofrtcmblock;
|
---|
| 296 | const char *blockstart = buffer;
|
---|
| 297 | DECODESTART
|
---|
| 298 |
|
---|
| 299 | if (size < 7)
|
---|
| 300 | return GCOBR_SHORTBUFFER;
|
---|
| 301 |
|
---|
[9210] | 302 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 303 | fprintf(stderr, "GetSSR-IGS START: size %d, numbits %d\n",(int)size, numbits);
|
---|
| 304 | #endif
|
---|
| 305 |
|
---|
| 306 | G_HEADER(h)
|
---|
| 307 | G_RESERVEDH(rs)
|
---|
| 308 | G_SIZE(sizeofrtcmblock);
|
---|
| 309 |
|
---|
| 310 | if ((unsigned char) h != 0xD3 || rs)
|
---|
| 311 | return GCOBR_UNKNOWNDATA;
|
---|
| 312 | if (size < sizeofrtcmblock + 3) /* 3 header bytes already removed */
|
---|
| 313 | return GCOBR_MESSAGEEXCEEDSBUFFER;
|
---|
| 314 | if (CRC24(sizeofrtcmblock + 3, (const unsigned char *) blockstart) !=
|
---|
| 315 | (uint32_t) ((((unsigned char) buffer[sizeofrtcmblock]) << 16) |
|
---|
| 316 | (((unsigned char) buffer[sizeofrtcmblock + 1]) << 8) |
|
---|
| 317 | (((unsigned char) buffer[sizeofrtcmblock + 2]))))
|
---|
| 318 | return GCOBR_CRCMISMATCH;
|
---|
| 319 | size = sizeofrtcmblock; /* reduce size, so overflows are detected */
|
---|
| 320 |
|
---|
| 321 | G_RTCM_MESSAGE_NUMBER(rtcmtype)
|
---|
| 322 | G_IGS_SSR_VERSION(version)
|
---|
[9210] | 323 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 324 | fprintf(stderr, "rtcmType %d igsVersion %d ", rtcmtype, version);
|
---|
| 325 | #endif
|
---|
| 326 | G_IGS_MESSAGE_NUMBER(igstype)
|
---|
[9210] | 327 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 328 | fprintf(stderr, "igsType IM%d size %d\n", igstype,(int)sizeofrtcmblock);
|
---|
| 329 | #endif
|
---|
| 330 | if (bytesused)
|
---|
| 331 | *bytesused = sizeofrtcmblock + 6;
|
---|
| 332 |
|
---|
| 333 | if (igstype == VTEC_BASE) {
|
---|
| 334 | unsigned int l, o, d;
|
---|
| 335 | if (!v)
|
---|
| 336 | return GCOBR_NOVTECPARAMETER;
|
---|
| 337 | memset(v, 0, sizeof(*v));
|
---|
| 338 | G_SSR_EPOCH_TIME(v->EpochTime)
|
---|
| 339 | G_SSR_UPDATE_INTERVAL(v->UpdateInterval)
|
---|
| 340 | G_MULTIPLE_MESSAGE_INDICATOR(mmi)
|
---|
| 341 | G_SSR_IOD(v->SSRIOD)
|
---|
| 342 | G_SSR_PROVIDER_ID(v->SSRProviderID)
|
---|
| 343 | G_SSR_SOLUTION_ID(v->SSRSolutionID)
|
---|
| 344 | G_VTEC_QUALITY_INDICATOR(v->Quality)
|
---|
| 345 | G_NO_IONO_LAYERS(v->NumLayers)
|
---|
[9210] | 346 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 347 | fprintf(stderr, "epochTime %d ui %d mmi %d ssrIod %d providerId %d solId %d vtecQ %8.3f numLay %d \n",
|
---|
| 348 | v->EpochTime, v->UpdateInterval, mmi,
|
---|
| 349 | v->SSRIOD, v->SSRProviderID, v->SSRSolutionID, v->Quality, v->NumLayers);
|
---|
| 350 | #endif
|
---|
| 351 | for (l = 0; l < v->NumLayers; ++l) {
|
---|
| 352 | G_IONO_HEIGHT(v->Layers[l].Height)
|
---|
| 353 | G_IONO_DEGREE(v->Layers[l].Degree)
|
---|
| 354 | G_IONO_ORDER(v->Layers[l].Order)
|
---|
[9210] | 355 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 356 | fprintf(stderr, "h %8.3f deg %d ord %d \n",
|
---|
| 357 | v->Layers[l].Height, v->Layers[l].Degree, v->Layers[l].Order);
|
---|
| 358 | #endif
|
---|
| 359 | for (o = 0; o <= v->Layers[l].Order; ++o) {
|
---|
| 360 | for (d = o; d <= v->Layers[l].Degree; ++d) {
|
---|
| 361 | G_IONO_COEFF_C(v->Layers[l].Cosinus[d][o])
|
---|
[9210] | 362 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 363 | fprintf(stderr, "C[%02d][%02d] %8.3f \n",
|
---|
| 364 | d, o, v->Layers[l].Cosinus[d][o]);
|
---|
| 365 | #endif
|
---|
| 366 | }
|
---|
| 367 | }
|
---|
| 368 | for (o = 1; o <= v->Layers[l].Order; ++o) {
|
---|
| 369 | for (d = o; d <= v->Layers[l].Degree; ++d) {
|
---|
| 370 | G_IONO_COEFF_S(v->Layers[l].Sinus[d][o])
|
---|
[9210] | 371 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 372 | fprintf(stderr, "S[%02d][%02d] %8.3f \n",
|
---|
| 373 | d, o, v->Layers[l].Sinus[d][o]);
|
---|
| 374 | #endif
|
---|
| 375 | }
|
---|
| 376 | }
|
---|
| 377 | }
|
---|
[9210] | 378 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 379 | for(igstype = 0; igstype < (unsigned int)size && (unsigned char)buffer[igstype] != 0xD3; ++igstype)
|
---|
| 380 | numbits += 8;
|
---|
| 381 | fprintf(stderr, "numbits left %d\n",numbits);
|
---|
| 382 | #endif
|
---|
| 383 | return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
|
---|
| 384 | }
|
---|
| 385 | for (s = CLOCKORBIT_SATNUM; s-- > 0;) {
|
---|
| 386 | if (igstype >= corbase[s]) {
|
---|
[9031] | 387 | unsigned int corrOffset = igstype - corbase[s];
|
---|
[9025] | 388 | if (corrOffset == COBOFS_ORBIT) {
|
---|
| 389 | if (!co)
|
---|
| 390 | return GCOBR_NOCLOCKORBITPARAMETER;
|
---|
| 391 | co->messageType = igstype;
|
---|
| 392 | G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
|
---|
| 393 | G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
|
---|
| 394 | G_MULTIPLE_MESSAGE_INDICATOR(mmi)
|
---|
| 395 | G_SSR_IOD(co->SSRIOD)
|
---|
| 396 | G_SSR_PROVIDER_ID(co->SSRProviderID)
|
---|
| 397 | G_SSR_SOLUTION_ID(co->SSRSolutionID)
|
---|
| 398 | G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
|
---|
| 399 | G_NO_OF_SATELLITES(nums)
|
---|
| 400 | co->Supplied[COBOFS_ORBIT] |= 1;
|
---|
[9210] | 401 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 402 | fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d rd %d ssrIod %d providerId %d solId %d\n",
|
---|
| 403 | co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
|
---|
| 404 | co->SatRefDatum, co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
|
---|
| 405 | #endif
|
---|
| 406 | for (i = 0; i < nums; ++i) {
|
---|
| 407 | G_GNSS_SATELLITE_ID(id)
|
---|
| 408 | for (pos = satoffset[s];
|
---|
| 409 | pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
|
---|
| 410 | ++pos)
|
---|
| 411 | ;
|
---|
| 412 | if (pos >= satoffset[s + 1])
|
---|
| 413 | return GCOBR_DATAMISMATCH;
|
---|
| 414 | else if (pos == co->NumberOfSat[s] + satoffset[s])
|
---|
| 415 | ++co->NumberOfSat[s];
|
---|
| 416 | co->Sat[pos].ID = id;
|
---|
| 417 | G_GNSS_IOD(co->Sat[pos].IOD)
|
---|
| 418 | G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
|
---|
| 419 | G_DELTA_ALONG_TRACK(co->Sat[pos].Orbit.DeltaAlongTrack)
|
---|
| 420 | G_DELTA_CROSS_TRACK(co->Sat[pos].Orbit.DeltaCrossTrack)
|
---|
| 421 | G_DELTA_DOT_RADIAL(co->Sat[pos].Orbit.DotDeltaRadial)
|
---|
| 422 | G_DELTA_DOT_ALONG_TRACK(co->Sat[pos].Orbit.DotDeltaAlongTrack)
|
---|
| 423 | G_DELTA_DOT_CROSS_TRACK(co->Sat[pos].Orbit.DotDeltaCrossTrack)
|
---|
[9210] | 424 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 425 | fprintf(stderr, "id %2d iod %3d dr %8.4f da %8.4f dc %8.4f dr %8.3f da %8.3f dc %8.3f\n",
|
---|
| 426 | co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
|
---|
| 427 | co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
|
---|
| 428 | co->Sat[pos].Orbit.DotDeltaRadial,
|
---|
| 429 | co->Sat[pos].Orbit.DotDeltaAlongTrack,
|
---|
| 430 | co->Sat[pos].Orbit.DotDeltaCrossTrack);
|
---|
| 431 | #endif
|
---|
| 432 | }
|
---|
| 433 | }
|
---|
| 434 | else if (corrOffset == COBOFS_CLOCK) {
|
---|
| 435 | if (!co)
|
---|
| 436 | return GCOBR_NOCLOCKORBITPARAMETER;
|
---|
| 437 | co->messageType = igstype;
|
---|
| 438 | G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
|
---|
| 439 | G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
|
---|
| 440 | G_MULTIPLE_MESSAGE_INDICATOR(mmi)
|
---|
| 441 | G_SSR_IOD(co->SSRIOD)
|
---|
| 442 | G_SSR_PROVIDER_ID(co->SSRProviderID)
|
---|
| 443 | G_SSR_SOLUTION_ID(co->SSRSolutionID)
|
---|
| 444 | G_NO_OF_SATELLITES(nums)
|
---|
| 445 | co->Supplied[COBOFS_CLOCK] |= 1;
|
---|
[9210] | 446 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 447 | fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
|
---|
| 448 | co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
|
---|
| 449 | co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
|
---|
| 450 | #endif
|
---|
| 451 | for (i = 0; i < nums; ++i) {
|
---|
| 452 | G_GNSS_SATELLITE_ID(id)
|
---|
| 453 | for (pos = satoffset[s];
|
---|
| 454 | pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
|
---|
| 455 | ++pos)
|
---|
| 456 | ;
|
---|
| 457 | if (pos >= satoffset[s + 1])
|
---|
| 458 | return GCOBR_DATAMISMATCH;
|
---|
| 459 | else if (pos == co->NumberOfSat[s] + satoffset[s])
|
---|
| 460 | ++co->NumberOfSat[s];
|
---|
| 461 | co->Sat[pos].ID = id;
|
---|
| 462 | G_DELTA_CLOCK_C0(co->Sat[pos].Clock.DeltaA0)
|
---|
| 463 | G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
|
---|
| 464 | G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
|
---|
[9210] | 465 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 466 | fprintf(stderr, "id %2d c0 %8.3f c1 %8.3f c2 %8.3f\n",
|
---|
| 467 | co->Sat[pos].ID, co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1,
|
---|
| 468 | co->Sat[pos].Clock.DeltaA2);
|
---|
| 469 | #endif
|
---|
| 470 | }
|
---|
| 471 | }
|
---|
[9031] | 472 | else if (corrOffset == COBOFS_COMBINED) {
|
---|
[9025] | 473 | if (!co)
|
---|
| 474 | return GCOBR_NOCLOCKORBITPARAMETER;
|
---|
| 475 | co->messageType = igstype;
|
---|
| 476 | G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
|
---|
| 477 | G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
|
---|
| 478 | G_MULTIPLE_MESSAGE_INDICATOR(mmi)
|
---|
| 479 | G_SSR_IOD(co->SSRIOD)
|
---|
| 480 | G_SSR_PROVIDER_ID(co->SSRProviderID)
|
---|
| 481 | G_SSR_SOLUTION_ID(co->SSRSolutionID)
|
---|
| 482 | G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
|
---|
| 483 | G_NO_OF_SATELLITES(nums)
|
---|
| 484 | co->Supplied[COBOFS_ORBIT] |= 1;
|
---|
| 485 | co->Supplied[COBOFS_CLOCK] |= 1;
|
---|
[9210] | 486 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 487 | fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d rd %d ssrIod %d providerId %d solId %d\n",
|
---|
| 488 | co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
|
---|
| 489 | co->SatRefDatum, co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
|
---|
| 490 | #endif
|
---|
| 491 | for (i = 0; i < nums; ++i) {
|
---|
| 492 | G_GNSS_SATELLITE_ID(id)
|
---|
| 493 | for (pos = satoffset[s];
|
---|
| 494 | pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
|
---|
| 495 | ++pos)
|
---|
| 496 | ;
|
---|
| 497 | if (pos >= satoffset[s + 1])
|
---|
| 498 | return GCOBR_DATAMISMATCH;
|
---|
| 499 | else if (pos == co->NumberOfSat[s] + satoffset[s])
|
---|
| 500 | ++co->NumberOfSat[s];
|
---|
| 501 | co->Sat[pos].ID = id;
|
---|
| 502 | G_GNSS_IOD(co->Sat[pos].IOD)
|
---|
| 503 | G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
|
---|
| 504 | G_DELTA_ALONG_TRACK(co->Sat[pos].Orbit.DeltaAlongTrack)
|
---|
| 505 | G_DELTA_CROSS_TRACK(co->Sat[pos].Orbit.DeltaCrossTrack)
|
---|
| 506 | G_DELTA_DOT_RADIAL(co->Sat[pos].Orbit.DotDeltaRadial)
|
---|
| 507 | G_DELTA_DOT_ALONG_TRACK(co->Sat[pos].Orbit.DotDeltaAlongTrack)
|
---|
| 508 | G_DELTA_DOT_CROSS_TRACK(co->Sat[pos].Orbit.DotDeltaCrossTrack)
|
---|
| 509 | G_DELTA_CLOCK_C0(co->Sat[pos].Clock.DeltaA0)
|
---|
| 510 | G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
|
---|
| 511 | G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
|
---|
[9210] | 512 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 513 | fprintf(stderr, "id %2d iod %3d dr %10.6f da %10.6f dc %10.6f dr %10.6f da %10.6f dc %10.6f c0 %10.6f c1 %10.6f c2 %10.6f\n",
|
---|
| 514 | co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
|
---|
| 515 | co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
|
---|
| 516 | co->Sat[pos].Orbit.DotDeltaRadial, co->Sat[pos].Orbit.DotDeltaAlongTrack,
|
---|
| 517 | co->Sat[pos].Orbit.DotDeltaCrossTrack,
|
---|
| 518 | co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1, co->Sat[pos].Clock.DeltaA2);
|
---|
| 519 | #endif
|
---|
| 520 | }
|
---|
| 521 | }
|
---|
| 522 | else if (corrOffset == COBOFS_URA) {
|
---|
| 523 | if (!co)
|
---|
| 524 | return GCOBR_NOCLOCKORBITPARAMETER;
|
---|
| 525 | co->messageType = igstype;
|
---|
| 526 | G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
|
---|
| 527 | G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
|
---|
| 528 | G_MULTIPLE_MESSAGE_INDICATOR(mmi)
|
---|
| 529 | G_SSR_IOD(co->SSRIOD)
|
---|
| 530 | G_SSR_PROVIDER_ID(co->SSRProviderID)
|
---|
| 531 | G_SSR_SOLUTION_ID(co->SSRSolutionID)
|
---|
| 532 | G_NO_OF_SATELLITES(nums)
|
---|
| 533 | co->Supplied[COBOFS_URA] |= 1;
|
---|
[9210] | 534 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 535 | fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
|
---|
| 536 | co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
|
---|
| 537 | co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
|
---|
| 538 | #endif
|
---|
| 539 | for (i = 0; i < nums; ++i) {
|
---|
| 540 | G_GNSS_SATELLITE_ID(id)
|
---|
| 541 | for (pos = satoffset[s];
|
---|
| 542 | pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
|
---|
| 543 | ++pos)
|
---|
| 544 | ;
|
---|
| 545 | if (pos >= satoffset[s + 1])
|
---|
| 546 | return GCOBR_DATAMISMATCH;
|
---|
| 547 | else if (pos == co->NumberOfSat[s] + satoffset[s])
|
---|
| 548 | ++co->NumberOfSat[s];
|
---|
| 549 | co->Sat[pos].ID = id;
|
---|
| 550 | G_SSR_URA(co->Sat[pos].UserRangeAccuracy)
|
---|
[9210] | 551 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 552 | fprintf(stderr, "id %2d ura %8.3f \n",
|
---|
| 553 | co->Sat[pos].ID, co->Sat[pos].UserRangeAccuracy);
|
---|
| 554 | #endif
|
---|
| 555 | }
|
---|
| 556 | }
|
---|
| 557 | else if (corrOffset == COBOFS_HR) {
|
---|
| 558 | if (!co)
|
---|
| 559 | return GCOBR_NOCLOCKORBITPARAMETER;
|
---|
| 560 | co->messageType = igstype;
|
---|
| 561 | G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
|
---|
| 562 | G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
|
---|
| 563 | G_MULTIPLE_MESSAGE_INDICATOR(mmi)
|
---|
| 564 | G_SSR_IOD(co->SSRIOD)
|
---|
| 565 | G_SSR_PROVIDER_ID(co->SSRProviderID)
|
---|
| 566 | G_SSR_SOLUTION_ID(co->SSRSolutionID)
|
---|
| 567 | G_NO_OF_SATELLITES(nums)
|
---|
| 568 | co->Supplied[COBOFS_HR] |= 1;
|
---|
[9210] | 569 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 570 | fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
|
---|
| 571 | co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
|
---|
| 572 | co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
|
---|
| 573 | #endif
|
---|
| 574 | for (i = 0; i < nums; ++i) {
|
---|
| 575 | G_GNSS_SATELLITE_ID(id)
|
---|
| 576 | for (pos = satoffset[s];
|
---|
| 577 | pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
|
---|
| 578 | ++pos)
|
---|
| 579 | ;
|
---|
| 580 | if (pos >= satoffset[s + 1])
|
---|
| 581 | return GCOBR_DATAMISMATCH;
|
---|
| 582 | else if (pos == co->NumberOfSat[s] + satoffset[s])
|
---|
| 583 | ++co->NumberOfSat[s];
|
---|
| 584 | co->Sat[pos].ID = id;
|
---|
| 585 | G_HR_CLOCK_CORRECTION(co->Sat[pos].hrclock)
|
---|
[9210] | 586 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 587 | fprintf(stderr, "id %2d hrClock %8.3f \n",
|
---|
| 588 | co->Sat[pos].ID, co->Sat[pos].hrclock);
|
---|
| 589 | #endif
|
---|
| 590 | }
|
---|
| 591 | }
|
---|
[9031] | 592 | else if (corrOffset == COBOFS_CBIAS) {
|
---|
[9025] | 593 | if (!b)
|
---|
| 594 | return GCOBR_NOCODEBIASPARAMETER;
|
---|
| 595 | b->messageType = igstype;
|
---|
| 596 | G_SSR_EPOCH_TIME_CHECK(b->EpochTime[s], b->NumberOfSat[s])
|
---|
| 597 | G_SSR_UPDATE_INTERVAL(b->UpdateInterval)
|
---|
| 598 | G_MULTIPLE_MESSAGE_INDICATOR(mmi)
|
---|
| 599 | G_SSR_IOD(b->SSRIOD)
|
---|
| 600 | G_SSR_PROVIDER_ID(b->SSRProviderID)
|
---|
| 601 | G_SSR_SOLUTION_ID(b->SSRSolutionID)
|
---|
| 602 | G_NO_OF_SATELLITES(nums)
|
---|
[9210] | 603 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 604 | fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
|
---|
| 605 | b->EpochTime[s], b->UpdateInterval,mmi,b->NumberOfSat[s],nums,
|
---|
| 606 | b->SSRIOD, b->SSRProviderID, b->SSRSolutionID);
|
---|
| 607 | #endif
|
---|
| 608 | for (i = 0; i < nums; ++i) {
|
---|
| 609 | G_GNSS_SATELLITE_ID(id)
|
---|
| 610 | for (pos = satoffset[s];
|
---|
| 611 | pos < satoffset[s] + b->NumberOfSat[s] && b->Sat[pos].ID != id;
|
---|
| 612 | ++pos)
|
---|
| 613 | ;
|
---|
| 614 | if (pos >= satoffset[s + 1])
|
---|
| 615 | return GCOBR_DATAMISMATCH;
|
---|
| 616 | else if (pos == b->NumberOfSat[s] + satoffset[s])
|
---|
| 617 | ++b->NumberOfSat[s];
|
---|
| 618 | b->Sat[pos].ID = id;
|
---|
| 619 | G_NO_OF_BIASES(b->Sat[pos].NumberOfCodeBiases)
|
---|
[9210] | 620 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 621 | fprintf(stderr, "id %2d #%d ",
|
---|
| 622 | b->Sat[pos].ID, b->Sat[pos].NumberOfCodeBiases);
|
---|
| 623 | #endif
|
---|
| 624 | for (j = 0; j < b->Sat[pos].NumberOfCodeBiases; ++j) {
|
---|
| 625 | G_GNSS_SIGNAL_IDENTIFIER(b->Sat[pos].Biases[j].Type)
|
---|
| 626 | G_CODE_BIAS(b->Sat[pos].Biases[j].Bias)
|
---|
[9210] | 627 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 628 | fprintf(stderr, "t%02d b %8.2f ",
|
---|
| 629 | b->Sat[pos].Biases[j].Type, b->Sat[pos].Biases[j].Bias);
|
---|
| 630 | #endif
|
---|
| 631 | }
|
---|
[9210] | 632 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 633 | fprintf(stderr, "\n");
|
---|
| 634 | #endif
|
---|
| 635 | }
|
---|
| 636 | }
|
---|
[9031] | 637 | else if (corrOffset == COBOFS_PBIAS) {
|
---|
[9025] | 638 | if (!pb)
|
---|
| 639 | return GCOBR_NOPHASEBIASPARAMETER;
|
---|
| 640 | pb->messageType = igstype;
|
---|
| 641 | G_SSR_EPOCH_TIME_CHECK(pb->EpochTime[s], pb->NumberOfSat[s])
|
---|
| 642 | G_SSR_UPDATE_INTERVAL(pb->UpdateInterval)
|
---|
| 643 | G_MULTIPLE_MESSAGE_INDICATOR(mmi)
|
---|
| 644 | G_SSR_IOD(pb->SSRIOD)
|
---|
| 645 | G_SSR_PROVIDER_ID(pb->SSRProviderID)
|
---|
| 646 | G_SSR_SOLUTION_ID(pb->SSRSolutionID)
|
---|
| 647 | G_DISPERSIVE_BIAS_INDICATOR(pb->DispersiveBiasConsistencyIndicator)
|
---|
| 648 | G_MW_CONSISTENCY_INDICATOR(pb->MWConsistencyIndicator)
|
---|
| 649 | G_NO_OF_SATELLITES(nums)
|
---|
[9210] | 650 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 651 | fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d dispInd %d mwInd %d\n",
|
---|
| 652 | pb->EpochTime[s], pb->UpdateInterval,mmi,pb->NumberOfSat[s],nums,
|
---|
| 653 | pb->SSRIOD, pb->SSRProviderID, pb->SSRSolutionID,
|
---|
| 654 | pb->DispersiveBiasConsistencyIndicator, pb->MWConsistencyIndicator);
|
---|
| 655 | #endif
|
---|
| 656 | for (i = 0; i < nums; ++i) {
|
---|
| 657 | G_GNSS_SATELLITE_ID(id)
|
---|
| 658 | for (pos = satoffset[s];
|
---|
| 659 | pos < satoffset[s] + pb->NumberOfSat[s] && pb->Sat[pos].ID != id;
|
---|
| 660 | ++pos)
|
---|
| 661 | ;
|
---|
| 662 | if (pos >= satoffset[s + 1])
|
---|
| 663 | return GCOBR_DATAMISMATCH;
|
---|
| 664 | else if (pos == pb->NumberOfSat[s] + satoffset[s])
|
---|
| 665 | ++pb->NumberOfSat[s];
|
---|
| 666 | pb->Sat[pos].ID = id;
|
---|
| 667 | G_NO_OF_BIASES(pb->Sat[pos].NumberOfPhaseBiases)
|
---|
| 668 | G_YAW_ANGLE(pb->Sat[pos].YawAngle)
|
---|
| 669 | G_YAW_RATE(pb->Sat[pos].YawRate)
|
---|
[9210] | 670 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 671 | fprintf(stderr, "id %2d #%d y %10.6f yr %10.6f ",
|
---|
| 672 | pb->Sat[pos].ID, pb->Sat[pos].NumberOfPhaseBiases,
|
---|
| 673 | pb->Sat[pos].YawAngle/MPI, pb->Sat[pos].YawRate/MPI);
|
---|
| 674 | #endif
|
---|
| 675 | for (j = 0; j < pb->Sat[pos].NumberOfPhaseBiases; ++j) {
|
---|
| 676 | G_GNSS_SIGNAL_IDENTIFIER(pb->Sat[pos].Biases[j].Type)
|
---|
| 677 | G_INTEGER_INDICATOR(pb->Sat[pos].Biases[j].SignalIntegerIndicator)
|
---|
| 678 | G_WIDE_LANE_INDICATOR(pb->Sat[pos].Biases[j].SignalsWideLaneIntegerIndicator)
|
---|
| 679 | G_DISCONTINUITY_COUNTER(pb->Sat[pos].Biases[j].SignalDiscontinuityCounter)
|
---|
| 680 | G_PHASE_BIAS(pb->Sat[pos].Biases[j].Bias)
|
---|
[9210] | 681 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 682 | fprintf(stderr, "t%02d int %d wl %d disc %02d b %8.4f ",
|
---|
| 683 | pb->Sat[pos].Biases[j].Type,
|
---|
| 684 | pb->Sat[pos].Biases[j].SignalIntegerIndicator,
|
---|
| 685 | pb->Sat[pos].Biases[j].SignalsWideLaneIntegerIndicator,
|
---|
| 686 | pb->Sat[pos].Biases[j].SignalDiscontinuityCounter,
|
---|
| 687 | pb->Sat[pos].Biases[j].Bias);
|
---|
| 688 | #endif
|
---|
| 689 | }
|
---|
[9210] | 690 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 691 | fprintf(stderr, "\n");
|
---|
| 692 | #endif
|
---|
| 693 | }
|
---|
| 694 | }
|
---|
| 695 | else {
|
---|
| 696 | continue;
|
---|
| 697 | }
|
---|
[9210] | 698 | #ifdef BNC_DEBUG_SSR
|
---|
[9025] | 699 | for(igstype = 0; igstype < (unsigned int)size && (unsigned char)buffer[igstype] != 0xD3; ++igstype)
|
---|
| 700 | numbits += 8;
|
---|
| 701 | fprintf(stderr, "numbits left %d\n",numbits);
|
---|
| 702 | #endif
|
---|
| 703 | return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
|
---|
| 704 | }
|
---|
| 705 | }
|
---|
| 706 | return GCOBR_UNKNOWNTYPE;
|
---|
| 707 | }
|
---|
| 708 |
|
---|
| 709 | //
|
---|
| 710 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 711 | std::string SsrCorrIgs::codeTypeToRnxType(char system, CodeType type) {
|
---|
| 712 | if (system == 'G') {
|
---|
| 713 | if (type == CODETYPE_GPS_L1_CA) return "1C";
|
---|
| 714 | if (type == CODETYPE_GPS_L1_P) return "1P";
|
---|
| 715 | if (type == CODETYPE_GPS_L1_Z) return "1W";
|
---|
| 716 |
|
---|
| 717 | if (type == CODETYPE_GPS_SEMI_CODELESS) return "2D";
|
---|
| 718 | if (type == CODETYPE_GPS_L2_CA) return "2C";
|
---|
| 719 | if (type == CODETYPE_GPS_L2_P) return "2P";
|
---|
| 720 | if (type == CODETYPE_GPS_L2_Z) return "2W";
|
---|
| 721 | if (type == CODETYPE_GPS_L2C_M) return "2S";
|
---|
| 722 | if (type == CODETYPE_GPS_L2C_L) return "2L";
|
---|
| 723 |
|
---|
| 724 | if (type == CODETYPE_GPS_L5_I) return "5I";
|
---|
| 725 | if (type == CODETYPE_GPS_L5_Q) return "5Q";
|
---|
| 726 |
|
---|
| 727 | if (type == CODETYPE_GPS_L1C_D) return "1S";
|
---|
| 728 | if (type == CODETYPE_GPS_L1C_P) return "1L";
|
---|
| 729 | }
|
---|
| 730 | else if (system == 'R') {
|
---|
| 731 | if (type == CODETYPE_GLONASS_L1_CA) return "1C";
|
---|
| 732 | if (type == CODETYPE_GLONASS_L1_P) return "1P";
|
---|
| 733 |
|
---|
| 734 | if (type == CODETYPE_GLONASS_L2_CA) return "2C";
|
---|
| 735 | if (type == CODETYPE_GLONASS_L2_P) return "2P";
|
---|
| 736 |
|
---|
| 737 | if (type == CODETYPE_GLONASS_L1a_OCd) return "4A";
|
---|
| 738 | if (type == CODETYPE_GLONASS_L1a_OCp) return "4B";
|
---|
| 739 |
|
---|
| 740 | if (type == CODETYPE_GLONASS_L2a_CSI) return "6A";
|
---|
| 741 | if (type == CODETYPE_GLONASS_L2a_OCp) return "6B";
|
---|
| 742 |
|
---|
| 743 | if (type == CODETYPE_GLONASS_L3_I) return "3I";
|
---|
| 744 | if (type == CODETYPE_GLONASS_L3_Q) return "3Q";
|
---|
| 745 | }
|
---|
| 746 | else if (system == 'E') {
|
---|
| 747 | if (type == CODETYPE_GALILEO_E1_A) return "1A";
|
---|
| 748 | if (type == CODETYPE_GALILEO_E1_B) return "1B";
|
---|
| 749 | if (type == CODETYPE_GALILEO_E1_C) return "1C";
|
---|
| 750 |
|
---|
| 751 | if (type == CODETYPE_GALILEO_E5A_I) return "5I";
|
---|
| 752 | if (type == CODETYPE_GALILEO_E5A_Q) return "5Q";
|
---|
| 753 |
|
---|
| 754 | if (type == CODETYPE_GALILEO_E5B_I) return "7I";
|
---|
| 755 | if (type == CODETYPE_GALILEO_E5B_Q) return "7Q";
|
---|
| 756 |
|
---|
| 757 | if (type == CODETYPE_GALILEO_E6_A) return "6A";
|
---|
| 758 | if (type == CODETYPE_GALILEO_E6_B) return "6B";
|
---|
| 759 | if (type == CODETYPE_GALILEO_E6_C) return "6C";
|
---|
| 760 | }
|
---|
| 761 | else if (system == 'J') {
|
---|
| 762 | if (type == CODETYPE_QZSS_L1_CA) return "1C";
|
---|
| 763 | if (type == CODETYPE_QZSS_L1C_D) return "1S";
|
---|
| 764 | if (type == CODETYPE_QZSS_L1C_P) return "1L";
|
---|
| 765 |
|
---|
| 766 | if (type == CODETYPE_QZSS_L2C_M) return "2S";
|
---|
| 767 | if (type == CODETYPE_QZSS_L2C_L) return "2L";
|
---|
| 768 |
|
---|
| 769 | if (type == CODETYPE_QZSS_L5_I) return "5I";
|
---|
| 770 | if (type == CODETYPE_QZSS_L5_Q) return "5Q";
|
---|
| 771 |
|
---|
| 772 | if (type == CODETYPE_QZSS_L6_D) return "6S";
|
---|
| 773 | if (type == CODETYPE_QZSS_L6_P) return "6L";
|
---|
| 774 | if (type == CODETYPE_QZSS_L6_E) return "6E";
|
---|
| 775 | }
|
---|
| 776 | else if (system == 'C') {
|
---|
| 777 | if (type == CODETYPE_BDS_B1_I) return "2I";
|
---|
| 778 | if (type == CODETYPE_BDS_B1_Q) return "2Q";
|
---|
| 779 |
|
---|
| 780 | if (type == CODETYPE_BDS_B3_I) return "6I";
|
---|
| 781 | if (type == CODETYPE_BDS_B3_Q) return "6Q";
|
---|
| 782 | if (type == CODETYPE_BDS_B3_A) return "6A";
|
---|
| 783 |
|
---|
| 784 | if (type == CODETYPE_BDS_B2_I) return "7I";
|
---|
| 785 | if (type == CODETYPE_BDS_B2_Q) return "7Q";
|
---|
| 786 |
|
---|
| 787 | if (type == CODETYPE_BDS_B1a_D) return "1D";
|
---|
| 788 | if (type == CODETYPE_BDS_B1a_P) return "1P";
|
---|
| 789 |
|
---|
| 790 | if (type == CODETYPE_BDS_B2a_D) return "5D";
|
---|
| 791 | if (type == CODETYPE_BDS_B2a_P) return "5P";
|
---|
| 792 |
|
---|
| 793 | if (type == CODETYPE_BDS_B1_A) return "1A";
|
---|
| 794 | }
|
---|
| 795 | else if (system == 'S') {
|
---|
| 796 | if (type == CODETYPE_SBAS_L1_CA) return "1C";
|
---|
| 797 |
|
---|
| 798 | if (type == CODETYPE_SBAS_L5_I) return "5I";
|
---|
| 799 | if (type == CODETYPE_SBAS_L5_Q) return "5Q";
|
---|
| 800 | }
|
---|
| 801 | return "";
|
---|
| 802 | }
|
---|
| 803 |
|
---|
| 804 | SsrCorr::CodeType SsrCorrIgs::rnxTypeToCodeType(char system, std::string type) {
|
---|
| 805 | if (system == 'G') {
|
---|
| 806 | if (type.compare("1C") == 0) {return CODETYPE_GPS_L1_CA;}
|
---|
| 807 | if (type.compare("1P") == 0) {return CODETYPE_GPS_L1_P;}
|
---|
| 808 | if (type.compare("1W") == 0) {return CODETYPE_GPS_L1_Z;}
|
---|
| 809 |
|
---|
| 810 | if (type.compare("2D") == 0) {return CODETYPE_GPS_SEMI_CODELESS;}
|
---|
| 811 | if (type.compare("2C") == 0) {return CODETYPE_GPS_L2_CA;}
|
---|
| 812 | if (type.compare("2P") == 0) {return CODETYPE_GPS_L2_P;}
|
---|
| 813 | if (type.compare("2W") == 0) {return CODETYPE_GPS_L2_Z;}
|
---|
| 814 | if (type.compare("2S") == 0) {return CODETYPE_GPS_L2C_M;}
|
---|
| 815 | if (type.compare("2L") == 0) {return CODETYPE_GPS_L2C_L;}
|
---|
| 816 |
|
---|
| 817 | if (type.compare("5I") == 0) {return CODETYPE_GPS_L5_I;}
|
---|
| 818 | if (type.compare("5Q") == 0) {return CODETYPE_GPS_L5_Q;}
|
---|
| 819 |
|
---|
| 820 | if (type.compare("1S") == 0) {return CODETYPE_GPS_L1C_D;}
|
---|
| 821 | if (type.compare("1L") == 0) {return CODETYPE_GPS_L1C_P;}
|
---|
| 822 | }
|
---|
| 823 | else if (system == 'R') {
|
---|
| 824 | if (type.compare("1C") == 0) {return CODETYPE_GLONASS_L1_CA;}
|
---|
| 825 | if (type.compare("1P") == 0) {return CODETYPE_GLONASS_L1_P;}
|
---|
| 826 |
|
---|
| 827 | if (type.compare("2C") == 0) {return CODETYPE_GLONASS_L2_CA;}
|
---|
| 828 | if (type.compare("2P") == 0) {return CODETYPE_GLONASS_L2_P;}
|
---|
| 829 |
|
---|
| 830 | if (type.compare("4A") == 0) {return CODETYPE_GLONASS_L1a_OCd;}
|
---|
| 831 | if (type.compare("4B") == 0) {return CODETYPE_GLONASS_L1a_OCp;}
|
---|
| 832 |
|
---|
| 833 | if (type.compare("6A") == 0) {return CODETYPE_GLONASS_L2a_CSI;}
|
---|
| 834 | if (type.compare("6B") == 0) {return CODETYPE_GLONASS_L2a_OCp;}
|
---|
| 835 |
|
---|
| 836 | if (type.compare("3I") == 0) {return CODETYPE_GLONASS_L3_I;}
|
---|
| 837 | if (type.compare("3Q") == 0) {return CODETYPE_GLONASS_L3_Q;}
|
---|
| 838 | }
|
---|
| 839 | else if (system == 'E') {
|
---|
| 840 | if (type.compare("1A") == 0) {return CODETYPE_GALILEO_E1_A;}
|
---|
| 841 | if (type.compare("1B") == 0) {return CODETYPE_GALILEO_E1_B;}
|
---|
| 842 | if (type.compare("1C") == 0) {return CODETYPE_GALILEO_E1_C;}
|
---|
| 843 |
|
---|
| 844 | if (type.compare("5I") == 0) {return CODETYPE_GALILEO_E5A_I;}
|
---|
| 845 | if (type.compare("5Q") == 0) {return CODETYPE_GALILEO_E5A_Q;}
|
---|
| 846 |
|
---|
| 847 | if (type.compare("7I") == 0) {return CODETYPE_GALILEO_E5B_I;}
|
---|
| 848 | if (type.compare("7Q") == 0) {return CODETYPE_GALILEO_E5B_Q;}
|
---|
| 849 |
|
---|
| 850 | if (type.compare("6A") == 0) {return CODETYPE_GALILEO_E6_A;}
|
---|
| 851 | if (type.compare("6B") == 0) {return CODETYPE_GALILEO_E6_B;}
|
---|
| 852 | if (type.compare("6C") == 0) {return CODETYPE_GALILEO_E6_C;}
|
---|
| 853 | }
|
---|
| 854 | else if (system == 'J') {
|
---|
| 855 | if (type.compare("1C") == 0) {return CODETYPE_QZSS_L1_CA;}
|
---|
| 856 | if (type.compare("1S") == 0) {return CODETYPE_QZSS_L1C_D;}
|
---|
| 857 | if (type.compare("1L") == 0) {return CODETYPE_QZSS_L1C_P;}
|
---|
| 858 |
|
---|
| 859 | if (type.compare("2S") == 0) {return CODETYPE_QZSS_L2C_M;}
|
---|
| 860 | if (type.compare("2L") == 0) {return CODETYPE_QZSS_L2C_L;}
|
---|
| 861 |
|
---|
| 862 | if (type.compare("5I") == 0) {return CODETYPE_QZSS_L5_I;}
|
---|
| 863 | if (type.compare("5Q") == 0) {return CODETYPE_QZSS_L5_Q;}
|
---|
| 864 |
|
---|
| 865 | if (type.compare("6S") == 0) {return CODETYPE_QZSS_L6_D;}
|
---|
| 866 | if (type.compare("6L") == 0) {return CODETYPE_QZSS_L6_P;}
|
---|
| 867 | if (type.compare("6E") == 0) {return CODETYPE_QZSS_L6_E;}
|
---|
| 868 | }
|
---|
| 869 | else if (system == 'C') {
|
---|
| 870 | if (type.compare("2I") == 0) {return CODETYPE_BDS_B1_I;}
|
---|
| 871 | if (type.compare("2Q") == 0) {return CODETYPE_BDS_B1_Q;}
|
---|
| 872 |
|
---|
| 873 | if (type.compare("6I") == 0) {return CODETYPE_BDS_B3_I;}
|
---|
| 874 | if (type.compare("6Q") == 0) {return CODETYPE_BDS_B3_Q;}
|
---|
| 875 | if (type.compare("6A") == 0) {return CODETYPE_BDS_B3_A;}
|
---|
| 876 |
|
---|
| 877 | if (type.compare("7I") == 0) {return CODETYPE_BDS_B2_I;}
|
---|
| 878 | if (type.compare("7Q") == 0) {return CODETYPE_BDS_B2_Q;}
|
---|
| 879 |
|
---|
| 880 | if (type.compare("1D") == 0) {return CODETYPE_BDS_B1a_D;}
|
---|
| 881 | if (type.compare("1P") == 0) {return CODETYPE_BDS_B1a_P;}
|
---|
| 882 |
|
---|
| 883 | if (type.compare("5D") == 0) {return CODETYPE_BDS_B2a_D;}
|
---|
| 884 | if (type.compare("5P") == 0) {return CODETYPE_BDS_B2a_P;}
|
---|
| 885 |
|
---|
| 886 | if (type.compare("1A") == 0) {return CODETYPE_BDS_B1_A;}
|
---|
| 887 | }
|
---|
| 888 | else if (system == 'S') {
|
---|
| 889 | if (type.compare("1C") == 0) {return CODETYPE_SBAS_L1_CA;}
|
---|
| 890 |
|
---|
| 891 | if (type.compare("5I") == 0) {return CODETYPE_SBAS_L5_I;}
|
---|
| 892 | if (type.compare("5Q") == 0) {return CODETYPE_SBAS_L5_Q;}
|
---|
| 893 | }
|
---|
| 894 | return RESERVED;
|
---|
| 895 | }
|
---|
| 896 |
|
---|