Changeset 11212 in ntrip for trunk/BNC/src/ssrQc.cpp
- Timestamp:
- Nov 18, 2026, 12:25:58 PM (93 minutes ago)
- File:
-
- 1 edited
-
trunk/BNC/src/ssrQc.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/ssrQc.cpp
r11195 r11212 77 77 const double VTEC_GRID_LAT = 10.0; // [deg] grid of the VTEC evaluation, latitudes -80 ... 80 78 78 const double VTEC_GRID_LON = 15.0; // [deg] 79 const double MW_SAMPL = 300.0; // [s] sampling of the Melbourne-Wuebbena check 80 const double MW_MAX_AGE = 900.0; // [s] phase biases older than this are not used 81 const int MW_MIN_SAT = 4; // satellites needed for the common offset 82 const double MW_OK = 0.10; // [cycles] RMS of the fractional parts: consistent below, 83 const double MW_BAD = 0.15; // not consistent above (uniform: 0.29) 79 84 80 85 double tKey(const bncTime& tt) { … … 253 258 << "Checks: epochs and update intervals, gaps (interval > 2 x max(declared, median)), latency," 254 259 << " completeness w.r.t. healthy broadcast ephemerides," << endl 255 << "IOD matching, code and phase bias signals, yaw angle, code biases of the reference signals, clock jumps > " 260 << "IOD matching, code and phase bias signals, phase bias indicators, Melbourne-Wuebbena consistency" 261 << " with the other ACs, yaw angle, code biases of the reference signals, clock jumps > " 256 262 << MAX_CLK_JUMP << " m, largest orbit corrections, VTEC models (system V)" << endl 257 263 << "Reference signals of the clocks: " << t_ssrRefSig::currentString().toStdString() << endl; … … 311 317 compareEpoch(_nextCmpEpoch); 312 318 _nextCmpEpoch = _nextCmpEpoch + CMP_SAMPL; 319 } 320 // Melbourne-Wuebbena check of the phase biases 321 if (!_pbLast.isEmpty()) { 322 if (!_nextMwCmp.valid()) { 323 double sec = ceil(time.gpssec() / MW_SAMPL) * MW_SAMPL; 324 _nextMwCmp = bncTime(time.gpsw(), sec); 325 } 326 while (time - _nextMwCmp >= CMP_DELAY) { 327 compareMw(_nextMwCmp); 328 _nextMwCmp = _nextMwCmp + MW_SAMPL; 329 } 313 330 } 314 331 // VTEC comparison … … 545 562 QMutexLocker locker(&_mutex); 546 563 for (const t_satPhaseBias& bias : phaseBiases) { 564 QString staID = QString::fromStdString(bias._staID); 565 QString prn = QString::fromStdString(bias._prn.toString()); 566 // latest biases for the Melbourne-Wuebbena check (also as other AC) 567 if (!_excluded.contains(staID) || staID == _reference) { 568 t_pbLast& pl = _pbLast[staID][prn]; 569 pl.time = bias._time; 570 pl.values.clear(); 571 for (const t_frqPhaseBias& frqBias : bias._bias) { 572 pl.values[QString::fromStdString(frqBias._rnxType2ch)] = frqBias._value; 573 } 574 } 547 575 if (!selected(bias._staID)) continue; 548 576 checkInterval(bias._time); 549 newEpoch(bias._staID, bias._prn.system(), PBIAS, bias._time, bias._updateInt, 550 QString::fromStdString(bias._prn.toString())); 551 QString staSys = QString("%1 %2").arg(bias._staID.c_str()).arg(bias._prn.system()); 577 newEpoch(bias._staID, bias._prn.system(), PBIAS, bias._time, bias._updateInt, prn); 578 QString staSys = QString("%1 %2").arg(staID).arg(bias._prn.system()); 579 t_satStat& stat = _satStat[staID + ' ' + prn]; 580 t_pbIndStat& ind = _pbIndStat[staSys]; 581 ind.numRec++; 582 ind.format[(bias._ssrFormat == ssrRtcmNew) ? "new RTCM-SSR" : 583 (bias._ssrFormat == ssrRtcmOld) ? "old RTCM-SSR" : "IGS-SSR"]++; 584 if (bias._ssrFormat != ssrRtcmNew) { // new RTCM-SSR: no consistency indicators 585 ind.dispInd[bias._dispBiasConsistInd]++; 586 ind.mwInd[bias._MelbWuebConsistInd]++; 587 } 588 bool jumped = false; // counted once per record, not per signal 552 589 for (const t_frqPhaseBias& frqBias : bias._bias) { 553 _phaseSignals[staSys].insert(QString::fromStdString(frqBias._rnxType2ch)); 590 QString sig = QString::fromStdString(frqBias._rnxType2ch); 591 _phaseSignals[staSys].insert(sig); 592 ind.intInd[sig][frqBias._fixIndicator]++; 593 ind.wlInd[sig][frqBias._fixWideLaneIndicator]++; 594 QString jumpKey = staID + ' ' + prn + ' ' + sig; 595 if (_pbJumpLast.contains(jumpKey) && _pbJumpLast[jumpKey] != frqBias._jumpCounter) { 596 jumped = true; 597 } 598 _pbJumpLast[jumpKey] = frqBias._jumpCounter; 599 } 600 if (jumped) { 601 stat.pbJumps++; 554 602 } 555 603 // Yaw angle: new RTCM-SSR has an indicator, old RTCM-SSR and IGS-SSR always 556 604 // carry the field, providers without attitude information send zeros 557 t_satStat& stat = _satStat[QString::fromStdString(bias._staID) + ' ' +558 QString::fromStdString(bias._prn.toString())];559 605 stat.numPB++; 560 606 bool yawProvided = (bias._ssrFormat == ssrRtcmNew) ? (bias._satYawInfoInd != 0) … … 570 616 yl.yaw = bias._yaw; 571 617 yl.rate = bias._yawRate; 618 } 619 } 620 } 621 622 // Melbourne-Wuebbena combination of the phase and code biases of the 623 // reference signals of a stream and satellite in wide-lane cycles: 624 // (f1 b_L1 - f2 b_L2) / (f1 - f2) - (f1 b_C1 + f2 b_C2) / (f1 + f2) 625 // The phase bias of a frequency is that of the reference signal or, if not 626 // provided, of another signal of the frequency; the code biases are those 627 // of the reference signals (as used for the clocks and a combination; with 628 // the code bias of the phase signal instead, e.g. C1C for CNES' L1C, CNES and 629 // NRCan agreed less on 2026-10-02) 630 //////////////////////////////////////////////////////////////////////////// 631 bool t_ssrQc::mwBias(const QString& staID, const QString& prn, char sys, const bncTime& tt, double& mwCyc) { 632 QString sig1, sig2; 633 t_frequency::type frq1, frq2; 634 if (sys == 'R' || !refSignals(sys, sig1, sig2, frq1, frq2)) { 635 return false; // GLONASS FDMA: no integer wide-lane ambiguities between satellites 636 } 637 if (!_pbLast.value(staID).contains(prn) || !_cbLast.value(staID).contains(prn)) { 638 return false; 639 } 640 const t_pbLast& pl = _pbLast[staID][prn]; 641 if (fabs(tt - pl.time) > MW_MAX_AGE) { 642 return false; 643 } 644 const QMap<QString, double>& cb = _cbLast[staID][prn]; 645 auto biases = [&pl, &cb](const QString& sig, double& phase, double& code) { 646 QString used; 647 if (pl.values.contains(sig)) { 648 used = sig; 649 } 650 else { 651 QMapIterator<QString, double> it(pl.values); 652 while (it.hasNext()) { 653 it.next(); 654 if (it.key()[0] == sig[0]) { 655 used = it.key(); 656 break; 657 } 658 } 659 } 660 if (used.isEmpty()) { 661 return false; 662 } 663 if (!cb.contains(sig)) { 664 return false; 665 } 666 phase = pl.values[used]; 667 code = cb[sig]; 668 return true; 669 }; 670 double pb1, pb2, cb1, cb2; 671 if (!biases(sig1, pb1, cb1) || !biases(sig2, pb2, cb2)) { 672 return false; 673 } 674 double f1 = t_CST::freq(frq1, 0); 675 double f2 = t_CST::freq(frq2, 0); 676 double mw = (f1 * pb1 - f2 * pb2) / (f1 - f2) - (f1 * cb1 + f2 * cb2) / (f1 + f2); 677 mwCyc = mw / (t_CST::c / (f1 - f2)); 678 return true; 679 } 680 681 // Melbourne-Wuebbena check of one epoch: per pair of streams of different 682 // ACs and system, the fractional parts of the MW differences of the 683 // satellites about their common (circular mean) offset 684 //////////////////////////////////////////////////////////////////////////// 685 void t_ssrQc::compareMw(const bncTime& tt) { 686 QStringList streams = _pbLast.keys(); 687 for (const QString& staA : streams) { 688 if (!selected(staA.toStdString())) continue; 689 for (const QString& staB : streams) { 690 if (staB == staA || !votes(staB) || acOf(staB) == acOf(staA)) continue; 691 QMap<char, QMap<QString, double> > diff; // system, PRN: MW difference [cycles] 692 for (const QString& prn : _pbLast[staA].keys()) { 693 char sys = prn[0].toLatin1(); 694 double mwA, mwB; 695 if (mwBias(staA, prn, sys, tt, mwA) && mwBias(staB, prn, sys, tt, mwB)) { 696 diff[sys][prn] = mwA - mwB; 697 } 698 } 699 QMapIterator<char, QMap<QString, double> > itSys(diff); 700 while (itSys.hasNext()) { 701 itSys.next(); 702 const QMap<QString, double>& dd = itSys.value(); 703 if (dd.size() < MW_MIN_SAT) continue; 704 double sSin = 0.0, sCos = 0.0; 705 for (double val : dd) { 706 sSin += sin(2.0 * M_PI * val); 707 sCos += cos(2.0 * M_PI * val); 708 } 709 double offset = atan2(sSin, sCos) / (2.0 * M_PI); 710 t_mwStat& ms = _mwStat[staA][staB][itSys.key()]; 711 ms.numEpo++; 712 ms.offset = offset; 713 QMapIterator<QString, double> itD(dd); 714 while (itD.hasNext()) { 715 itD.next(); 716 double res = itD.value() - offset; 717 res -= floor(res + 0.5); // fractional part in [-0.5, 0.5) 718 ms.numRes++; 719 ms.sRes2 += res * res; 720 QPair<unsigned, double>& sr = ms.satRes[itD.key()]; 721 sr.first++; 722 sr.second += res * res; 723 } 724 } 572 725 } 573 726 } … … 1537 1690 double maxEarly = 0.0; 1538 1691 QMap<QString, unsigned> missOrb, missClk, missCB, missPB, iodUnknown, unhealthy, noEph, 1539 jumps, missRef, noYaw, yawPartly; 1692 jumps, missRef, noYaw, yawPartly, pbJumps; 1540 1693 unsigned numPB = 0, numYaw = 0, yawSats = 0; 1541 1694 double maxRadial = 0.0, maxAlongCross = 0.0; … … 1576 1729 if (stat.noEph) noEph[prn] = stat.noEph; 1577 1730 if (stat.clkJumps) jumps[prn] = stat.clkJumps; 1731 if (stat.pbJumps) pbJumps[prn] = stat.pbJumps; 1578 1732 if (stat.maxRadial > maxRadial) { 1579 1733 maxRadial = stat.maxRadial; … … 1670 1824 lines << "phase bias signals: " + sigs.join(" "); 1671 1825 } 1826 if (_pbIndStat.contains(staSys)) { 1827 const t_pbIndStat& ind = _pbIndStat[staSys]; 1828 // value list "1" or "0 (12 %), 1 (88 %)" 1829 auto values = [](const QMap<int, unsigned>& counts) { 1830 unsigned total = 0; 1831 for (unsigned nn : counts) total += nn; 1832 QStringList parts; 1833 QMapIterator<int, unsigned> it(counts); 1834 while (it.hasNext()) { 1835 it.next(); 1836 parts << ((counts.size() == 1) ? QString::number(it.key()) 1837 : QString("%1 (%2 %)").arg(it.key()) 1838 .arg(100.0 * it.value() / total, 0, 'f', 0)); 1839 } 1840 return parts.join(", "); 1841 }; 1842 QStringList formats = ind.format.keys(); 1843 QString line = "phase bias format and indicators: " + formats.join("/"); 1844 if (!ind.mwInd.isEmpty()) { 1845 line += QString(", dispersive bias consistency indicator %1, MW consistency indicator %2") 1846 .arg(values(ind.dispInd)).arg(values(ind.mwInd)); 1847 } 1848 else { 1849 line += " (no consistency indicators)"; 1850 } 1851 lines << line; 1852 QStringList sigParts; 1853 QMapIterator<QString, QMap<int, unsigned> > itSig(ind.intInd); 1854 while (itSig.hasNext()) { 1855 itSig.next(); 1856 sigParts << QString("%1 integer %2 / wide-lane %3").arg(itSig.key()) 1857 .arg(values(itSig.value())).arg(values(ind.wlInd.value(itSig.key()))); 1858 } 1859 if (!sigParts.isEmpty()) { 1860 lines << "phase bias integer / wide-lane integer indicators: " + sigParts.join("; "); 1861 } 1862 addSats("phase bias discontinuity counter changes", pbJumps); 1863 } 1864 bool mwAny = false; 1865 for (const QMap<char, t_mwStat>& mm : _mwStat.value(staID)) { 1866 mwAny = mwAny || mm.contains(sys); 1867 } 1868 QString mwSig1, mwSig2; 1869 t_frequency::type mwFrq1, mwFrq2; 1870 if (mwAny && refSignals(sys, mwSig1, mwSig2, mwFrq1, mwFrq2)) { 1871 // phase signals used (see mwBias) 1872 QStringList used; 1873 QStringList pSigs = _phaseSignals.value(staSys).values(); 1874 pSigs.sort(); 1875 for (const QString& sig : {mwSig1, mwSig2}) { 1876 QString uu = pSigs.contains(sig) ? sig : QString(); 1877 for (const QString& ps : pSigs) { 1878 if (uu.isEmpty() && ps[0] == sig[0]) uu = ps; 1879 } 1880 used << "L" + uu; 1881 } 1882 lines << QString("MW check: phase biases %1 with the code biases C%2 C%3 of the reference signals, " 1883 "wide-lane cycles (%4 m)") 1884 .arg(used.join(" ")).arg(mwSig1).arg(mwSig2) 1885 .arg(t_CST::c / (t_CST::freq(mwFrq1, 0) - t_CST::freq(mwFrq2, 0)), 0, 'f', 3); 1886 } 1887 if (_mwStat.contains(staID)) { 1888 QMapIterator<QString, QMap<char, t_mwStat> > itOther(_mwStat[staID]); 1889 while (itOther.hasNext()) { 1890 itOther.next(); 1891 if (!itOther.value().contains(sys)) continue; 1892 const t_mwStat& ms = itOther.value()[sys]; 1893 if (ms.numRes == 0) continue; 1894 double rms = sqrt(ms.sRes2 / ms.numRes); 1895 QString verdict = (rms < MW_OK) ? "consistent (integer wide-lane biases)" : 1896 (rms > MW_BAD) ? "NOT consistent" : "not clearly consistent"; 1897 lines << QString("MW biases vs. %1 (%2 epochs, %3 satellites): fractional parts about the " 1898 "common offset %4 cycles: RMS %5 cycles, %6") 1899 .arg(itOther.key()).arg(ms.numEpo).arg(ms.satRes.size()) 1900 .arg(ms.offset, 0, 'f', 2).arg(rms, 0, 'f', 3).arg(verdict); 1901 QStringList dev; 1902 QMapIterator<QString, QPair<unsigned, double> > itS(ms.satRes); 1903 while (itS.hasNext()) { 1904 itS.next(); 1905 double rmsSat = sqrt(itS.value().second / itS.value().first); 1906 if (rmsSat > MW_BAD) { 1907 dev << QString("%1(%2)").arg(itS.key()).arg(rmsSat, 0, 'f', 2); 1908 } 1909 } 1910 if (!dev.isEmpty() && rms < MW_BAD) { 1911 lines << QString("MW biases vs. %1: satellites with RMS > %2 cycles: %3") 1912 .arg(itOther.key()).arg(MW_BAD, 0, 'f', 2).arg(dev.join(" ")); 1913 } 1914 } 1915 } 1672 1916 if (numPB) { 1673 1917 if (numYaw == 0) { … … 1768 2012 _cmpEpochs.clear(); 1769 2013 _attEvents.clear(); 2014 _pbIndStat.clear(); 2015 _mwStat.clear(); 1770 2016 for (QMap<QString, t_vtecStat>::iterator it = _vtecStat.begin(); it != _vtecStat.end(); ++it) { 1771 2017 t_vtecStat fresh;
Note:
See TracChangeset
for help on using the changeset viewer.
