Changeset 11058 in ntrip for trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
- Timestamp:
- Sep 30, 2026, 10:52:22 PM (28 hours ago)
- File:
-
- 1 edited
-
trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
r11057 r11058 1132 1132 // Set _lastTime close to currentTime 1133 1133 // ---------------------------------- 1134 if (_type == IGSssr) { 1135 if (epoSecGPS != -1) _igsRefEpoSec = epoSecGPS; 1136 else if (epoSecGal != -1) _igsRefEpoSec = epoSecGal; 1137 else if (epoSecQzss != -1) _igsRefEpoSec = epoSecQzss; 1138 else if (epoSecSbas != -1) _igsRefEpoSec = epoSecSbas; 1139 } 1140 1134 1141 if (epoSecGPS != -1) { 1135 1142 _lastTime.set(currentWeek, epoSecGPS); … … 1137 1144 else if (epoSecGlo != -1) { 1138 1145 QDate date = dateAndTimeFromGPSweek(currentTime.gpsw(), currentTime.gpssec()).date(); 1146 double leap = gnumleap(date.year(), date.month(), date.day()); 1139 1147 // IGS-SSR: the SSR Epoch Time (IDF003, 20 bit) is given in one continuous 1140 1148 // time scale for all GNSS, i.e. GPS seconds of week also for GLONASS 1141 // (IGS SSR v1.00) - no conversion 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. 1153 if (_type == IGSssr && _igsRefEpoSec >= 0.0 && 1154 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; 1159 bncTime& warned = _legacyEpochWarned['R']; 1160 if (!warned.valid() || currentTime - warned >= 3600.0) { 1161 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); 1165 } 1166 } 1142 1167 if (_type == RTCMssr || _type == RTCMnewssr) { 1143 1168 // Same GLONASS epoch wire convention (UTC+3h) as RTCMssr 1144 epoSecGlo = epoSecGlo - 3 * 3600 + gnumleap(date.year(), date.month(), date.day());1169 epoSecGlo = epoSecGlo - 3 * 3600 + leap; 1145 1170 } 1146 1171 _lastTime.set(currentWeek, epoSecGlo); … … 1156 1181 } 1157 1182 else if (epoSecBds != -1) { 1158 // RTCM-SSR: BDT; IGS-SSR: GPS time scale for all GNSS (IDF003) 1159 if (_type != IGSssr) { 1183 // RTCM-SSR: BDT; IGS-SSR: GPS time scale for all GNSS (IDF003). Old 1184 // IGS-SSR encoders wrote BDT: recognised and converted as for GLONASS. 1185 bool bdt = (_type != IGSssr); 1186 if (_type == IGSssr && _igsRefEpoSec >= 0.0 && 1187 igsLegacyEpoch(epoSecBds, fmod(_igsRefEpoSec - 14.0 + 604800.0, 604800.0), 604800.0)) { 1188 bdt = true; 1189 bncTime& warned = _legacyEpochWarned['C']; 1190 if (!warned.valid() || currentTime - warned >= 3600.0) { 1191 warned = currentTime; 1192 emit newMessage(_staID.toLatin1() + ": IGS-SSR BDS epoch time in outdated convention " 1193 "(BDT instead of GPS seconds of week, IGS SSR v1.00 IDF003) " 1194 "detected and converted - the SSR encoder should be updated", true); 1195 } 1196 } 1197 if (bdt) { 1160 1198 epoSecBds += 14.0; 1161 1199 if (epoSecBds > 604800.0) { … … 1182 1220 } 1183 1221 } 1222 } 1223 1224 // IGS-SSR: true if value (seconds, periodic with period) matches the epoch 1225 // expected in the outdated convention (legacyRef) better than the GPS time 1226 // reference of the stream, within the spread of epochs of one update cycle 1227 //////////////////////////////////////////////////////////////////////////// 1228 bool RTCM3coDecoder::igsLegacyEpoch(double value, double legacyRef, double period) const { 1229 auto dist = [period](double a, double b) { 1230 double d = fmod(fabs(a - b), period); 1231 return std::min(d, period - d); 1232 }; 1233 double dSpec = dist(value, fmod(_igsRefEpoSec, period)); 1234 double dLegacy = dist(value, legacyRef); 1235 return dLegacy < dSpec && dLegacy <= 30.0; 1184 1236 } 1185 1237
Note:
See TracChangeset
for help on using the changeset viewer.
