Changeset 11068 in ntrip for trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
- Timestamp:
- Oct 5, 2026, 12:35:01 PM (34 hours ago)
- File:
-
- 1 edited
-
trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
r11058 r11068 1139 1139 } 1140 1140 1141 char epoSys = 0; // system the epoch of this message is taken from 1141 1142 if (epoSecGPS != -1) { 1143 epoSys = 'G'; 1142 1144 _lastTime.set(currentWeek, epoSecGPS); 1143 1145 } 1144 1146 else if (epoSecGlo != -1) { 1147 epoSys = 'R'; 1145 1148 QDate date = dateAndTimeFromGPSweek(currentTime.gpsw(), currentTime.gpssec()).date(); 1146 1149 double leap = gnumleap(date.year(), date.month(), date.day()); 1147 1150 // IGS-SSR: the SSR Epoch Time (IDF003, 20 bit) is given in one continuous 1148 1151 // time scale for all GNSS, i.e. GPS seconds of week also for GLONASS 1149 // (IGS SSR v1.00) - no conversion. Old encoders (e.g. BNC before 1150 // 2026-09-30) wrote UTC seconds of day instead: recognised by comparison 1151 // with the GPS/Galileo epoch of the same stream and converted, with a 1152 // warning, during a transition period. 1152 // (IGS SSR v1.00) - no conversion. Old encoders wrote UTC instead, as 1153 // seconds of day (e.g. BNC before 2026-09-30) or as seconds of week: 1154 // recognised by comparison with the GPS/Galileo epoch of the same stream 1155 // and converted, with a warning, during a transition period. The value 1156 // in GPS time is taken modulo one day around the stream's GPS epoch, 1157 // which covers both variants. 1153 1158 if (_type == IGSssr && _igsRefEpoSec >= 0.0 && 1154 1159 igsLegacyEpoch(epoSecGlo, fmod(_igsRefEpoSec - leap + 7 * 86400.0, 86400.0), 86400.0)) { 1155 double sow = floor(_igsRefEpoSec / 86400.0) * 86400.0 + epoSecGlo + leap; 1156 if (sow - _igsRefEpoSec > 43200.0) sow -= 86400.0; 1157 else if (_igsRefEpoSec - sow > 43200.0) sow += 86400.0; 1158 epoSecGlo = sow; 1160 // seconds of day: outdated convention; seconds of week: erroneous 1161 bool secOfWeek = (epoSecGlo >= 86400.0); 1162 double dd = fmod(epoSecGlo + leap - _igsRefEpoSec, 86400.0); 1163 if (dd > 43200.0) dd -= 86400.0; 1164 else if (dd < -43200.0) dd += 86400.0; 1165 epoSecGlo = _igsRefEpoSec + dd; 1159 1166 bncTime& warned = _legacyEpochWarned['R']; 1160 1167 if (!warned.valid() || currentTime - warned >= 3600.0) { 1161 1168 warned = currentTime; 1162 emit newMessage(_staID.toLatin1() + ": IGS-SSR GLONASS epoch time in outdated convention " 1163 "(UTC seconds of day instead of GPS seconds of week, IGS SSR v1.00 IDF003) " 1164 "detected and converted - the SSR encoder should be updated", true); 1169 if (secOfWeek) { 1170 emit newMessage(_staID.toLatin1() + ": IGS-SSR GLONASS epoch time erroneously encoded " 1171 "(UTC seconds of week instead of GPS seconds of week, IGS SSR v1.00 IDF003) " 1172 "detected and converted - the SSR encoder should be corrected", true); 1173 } 1174 else { 1175 emit newMessage(_staID.toLatin1() + ": IGS-SSR GLONASS epoch time in outdated convention " 1176 "(UTC seconds of day instead of GPS seconds of week, IGS SSR v1.00 IDF003) " 1177 "detected and converted - the SSR encoder should be updated", true); 1178 } 1165 1179 } 1166 1180 } … … 1172 1186 } 1173 1187 else if (epoSecGal != -1) { 1188 epoSys = 'E'; 1174 1189 _lastTime.set(currentWeek, epoSecGal); 1175 1190 } 1176 1191 else if (epoSecQzss != -1) { 1192 epoSys = 'J'; 1177 1193 _lastTime.set(currentWeek, epoSecQzss); 1178 1194 } 1179 1195 else if (epoSecSbas != -1) { 1196 epoSys = 'S'; 1180 1197 _lastTime.set(currentWeek, epoSecSbas); 1181 1198 } 1182 1199 else if (epoSecBds != -1) { 1200 epoSys = 'C'; 1183 1201 // RTCM-SSR: BDT; IGS-SSR: GPS time scale for all GNSS (IDF003). Old 1184 1202 // IGS-SSR encoders wrote BDT: recognised and converted as for GLONASS. … … 1218 1236 while (_lastTime > currentTime + maxDiff) { 1219 1237 _lastTime = _lastTime - maxDiff; 1238 } 1239 } 1240 1241 // Plausibility: the orbit/clock epochs of all systems of a stream, 1242 // converted to GPS time, refer to the same update cycles as its GPS epochs. A difference 1243 // of more than MAX_DIFF to the latest GPS epoch (itself not older than 1244 // MAX_DIFF) indicates an erroneous encoding not covered above; the epoch 1245 // is used as it is and reported at most once per hour and system. 1246 // Only orbit/clock messages are checked: code and phase biases may be 1247 // sent with the (older) epoch of their last update (e.g. Galileo HAS). 1248 const double MAX_DIFF = 120.0; 1249 bool clkOrbMsg = false; 1250 for (unsigned s = 0; s < CLOCKORBIT_SATNUM; s++) { 1251 if (_clkOrb.NumberOfSat[s] > 0) { 1252 clkOrbMsg = true; 1253 } 1254 } 1255 if (!clkOrbMsg) { 1256 return; 1257 } 1258 if (_lastTime.valid() && epoSys == 'G') { 1259 _lastGpsEpoch = _lastTime; 1260 } 1261 else if (_lastTime.valid() && epoSys != 0 && _lastGpsEpoch.valid() && 1262 fabs(currentTime - _lastGpsEpoch) <= MAX_DIFF && 1263 fabs(_lastTime - _lastGpsEpoch) > MAX_DIFF) { 1264 bncTime& warned = _epochDiffWarned[QChar(epoSys)]; 1265 if (!warned.valid() || currentTime - warned >= 3600.0) { 1266 warned = currentTime; 1267 emit newMessage(QString("%1: %2 SSR epoch time %3 %4 differs by %5 s from the GPS SSR epoch time " 1268 "of the stream - erroneously encoded?") 1269 .arg(_staID).arg(epoSys) 1270 .arg(QString::fromStdString(_lastTime.datestr())) 1271 .arg(QString::fromStdString(_lastTime.timestr(0))) 1272 .arg(_lastTime - _lastGpsEpoch, 0, 'f', 0).toLatin1(), true); 1220 1273 } 1221 1274 }
Note:
See TracChangeset
for help on using the changeset viewer.
