Changeset 11058 in ntrip for trunk/BNC/src/upload/bncrtnetuploadcaster.cpp
- Timestamp:
- Sep 30, 2026, 10:52:22 PM (3 days ago)
- File:
-
- 1 edited
-
trunk/BNC/src/upload/bncrtnetuploadcaster.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/upload/bncrtnetuploadcaster.cpp
r11057 r11058 548 548 // Make sure the clock messages refer to same IOD as orbit messages 549 549 // ---------------------------------------------------------------- 550 // The ephemeris is selected at the first correction epoch of each 551 // sampling interval: the grid epoch itself for corrections on the 552 // sampling grid, otherwise (e.g. Galileo HAS at ...:02, ...:12) 553 // the first epoch after it, which previously never selected one 550 554 if (_usedEph) { 551 if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) { 555 bool select = (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0); 556 if (!select && _samplRtcmEphCorr > 0.0) { 557 select = !_usedEphEpoch.valid() || epoTime == _usedEphEpoch || 558 epoTime.gpsw() != _usedEphEpoch.gpsw() || 559 floor(epoTime.gpssec() / _samplRtcmEphCorr) != 560 floor(_usedEphEpoch.gpssec() / _samplRtcmEphCorr); 561 } 562 if (select) { 552 563 (*_usedEph)[prnInternalStr] = eph; 564 _usedEphEpoch = epoTime; 553 565 } 554 566 else { … … 1170 1182 double clkRnxAcc = rtnClk[2] / t_CST::c; // [s/s² = -/s] 1171 1183 1172 if (_rnx) { 1184 // Corrections on epochs off the output sampling grid (e.g. Galileo HAS 1185 // at ...:02, ...:12) are written at the nearest grid epoch, see gridEpoch; 1186 // the clock is propagated with its rate, the orbit via the broadcast 1187 // orbit at the grid epoch plus the (slowly varying) difference 1188 // precise - broadcast at the correction epoch 1189 // ----------------------------------------------------------------------- 1190 bncTime tt(GPSweek, GPSweeks); 1191 bncTime tg; 1192 double clkRate = (clkRnxRate != 0.0) ? clkRnxRate : xB(5); 1193 1194 if (_rnx && gridEpoch(_rnx->sampl(), tt, tg, _rnxGridEpo, _rnxGridSrc)) { 1173 1195 double clkRnxSig, clkRnxRateSig, clkRnxAccSig; 1174 1196 int s = rtnClkSig.size(); … … 1190 1212 break; 1191 1213 } 1192 _rnx->write(GPSweek, GPSweeks, prn, clkRnx, clkRnxRate, clkRnxAcc, 1193 clkRnxSig, clkRnxRateSig, clkRnxAccSig); 1194 } 1195 if (_sp3) { 1196 _sp3->write(GPSweek, GPSweeks, prn, rtnCoM, clkRnx, rtnVel, clkRnxRate); 1214 _rnx->write(tg.gpsw(), tg.gpssec(), prn, clkRnx + clkRate * (tg - tt), 1215 clkRnxRate, clkRnxAcc, clkRnxSig, clkRnxRateSig, clkRnxAccSig); 1216 } 1217 if (_sp3 && gridEpoch(_sp3->sampl(), tt, tg, _sp3GridEpo, _sp3GridSrc)) { 1218 ColumnVector xyz = rtnCoM; 1219 ColumnVector vel = rtnVel; 1220 if (!(tg == tt)) { 1221 ColumnVector xBg(6); 1222 ColumnVector vBg(3); 1223 if (eph->getCrd(tg, xBg, vBg, false) != success) { 1224 return success; 1225 } 1226 xyz = xBg.Rows(1, 3) + (rtnCoM - xB.Rows(1, 3)); 1227 vel = vBg + (rtnVel - vB); 1228 } 1229 _sp3->write(tg.gpsw(), tg.gpssec(), prn, xyz, clkRnx + clkRate * (tg - tt), 1230 vel, clkRnxRate); 1197 1231 } 1198 1232 return success; 1233 } 1234 1235 // Output epoch for SP3/CLK files with sampling interval sampl [s]: the 1236 // correction epoch itself if it is on the sampling grid, otherwise the 1237 // preceding grid epoch if at most 5 s (and less than half the sampling 1238 // interval) earlier. Only preceding grid epochs are used, so a correction 1239 // epoch on the grid always arrives first and takes precedence. Each grid 1240 // epoch is derived from one correction epoch only. 1241 //////////////////////////////////////////////////////////////////////////// 1242 bool bncRtnetUploadCaster::gridEpoch(int sampl, const bncTime& tt, bncTime& tg, 1243 bncTime& lastGrid, bncTime& lastSrc) const { 1244 if (sampl <= 0) { 1245 tg = tt; 1246 return true; 1247 } 1248 double sec = tt.gpssec(); 1249 double back = sec - floor(sec / sampl) * sampl; // [0, sampl) 1250 if (back > 1.e-6 && (back > 5.0 || back >= 0.5 * sampl)) { 1251 return false; 1252 } 1253 tg = (back <= 1.e-6) ? tt : tt - back; 1254 if (lastGrid.valid() && tg == lastGrid && !(tt == lastSrc)) { 1255 return false; 1256 } 1257 lastGrid = tg; 1258 lastSrc = tt; 1259 return true; 1199 1260 } 1200 1261
Note:
See TracChangeset
for help on using the changeset viewer.
