Changeset 9676 in ntrip


Ignore:
Timestamp:
Apr 7, 2022, 4:21:51 PM (2 years ago)
Author:
stuerze
Message:

combination is extended to use/provide Code Biases

Location:
trunk/BNC/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncmain.cpp

    r9652 r9676  
    256256      "   cmbMethodFilter {Combination approach [character string: Single-Epoch|Filter]\n"
    257257      "   cmbMaxres       {Clock outlier residuum threshold in meters [floating-point number]\n"
    258       "   cmbSampl        {Clock sampling rate [integer number of seconds: 10|20|30|40|50|60]}\n"
     258      "   cmbSampl        {Clock sampling rate [integer number of seconds: 0|10|20|30|40|50|60]}\n"
    259259      "   cmbGps          {GPS correction usage [integer number: 0=no,2=yes]}\n"
    260260      "   cmbGlo          {GLONASS correction usage [integer number: 0=no,2=yes]}\n"
  • trunk/BNC/src/bncwindow.cpp

    r9652 r9676  
    482482
    483483  _cmbSamplSpinBox = new QSpinBox;
    484   _cmbSamplSpinBox->setMinimum(10);
     484  _cmbSamplSpinBox->setMinimum(0);
    485485  _cmbSamplSpinBox->setMaximum(60);
    486486  _cmbSamplSpinBox->setSingleStep(10);
     
    12671267  cmbLayout->addWidget(_cmbSamplSpinBox,                                         6,  7, Qt::AlignRight);
    12681268  cmbLayout->addWidget(new QLabel("GNSS"),                                       7,  6, Qt::AlignLeft);
    1269   cmbLayout->addWidget(new QLabel("GPS (1W/2W)"),                                7,  7);
     1269  cmbLayout->addWidget(new QLabel("GPS (C1W/C2W)"),                                7,  7);
    12701270  cmbLayout->addWidget(_cmbGpsCheckBox,                                          7,  8);
    1271   cmbLayout->addWidget(new QLabel("GLONASS (1P/2P)"),                            7,  9);
     1271  cmbLayout->addWidget(new QLabel("GLONASS (C1P/C2P)"),                          7,  9);
    12721272  cmbLayout->addWidget(_cmbGloCheckBox,                                          7, 10);
    1273   cmbLayout->addWidget(new QLabel("Galileo (1C/5Q)"),                            7, 11);
     1273  cmbLayout->addWidget(new QLabel("Galileo (C1C/C5Q)"),                          7, 11);
    12741274  cmbLayout->addWidget(_cmbGalCheckBox,                                          7, 12);
    1275   cmbLayout->addWidget(new QLabel("Beidou (2I/6I)"),                             7, 13);
     1275  cmbLayout->addWidget(new QLabel("Beidou (C2I/C6I)"),                           7, 13);
    12761276  cmbLayout->addWidget(_cmbBdsCheckBox,                                          7, 14);
    1277   cmbLayout->addWidget(new QLabel("QZSS (1C/2L)"),                               8,  7);
     1277  cmbLayout->addWidget(new QLabel("QZSS (C1C/C2L)"),                             8,  7);
    12781278  cmbLayout->addWidget(_cmbQzssCheckBox,                                         8,  8);
    1279   cmbLayout->addWidget(new QLabel("SBAS (1C/5Q)"),                               8,  9);
     1279  cmbLayout->addWidget(new QLabel("SBAS (C1C/C5Q)"),                             8,  9);
    12801280  cmbLayout->addWidget(_cmbSbasCheckBox,                                         8, 10);
    12811281  cmbLayout->addWidget(new QLabel("IRNSS"),                                      8, 11);
     
    14951495  _cmbMethodComboBox->setWhatsThis(tr("<p>Select a clock combination approach. Options are 'Single-Epoch' and Kalman 'Filter'.</p><p>It is suggested to use the Kalman filter approach for the purpose of Precise Point Positioning. <i>[key: cmbMethod]</i></p>"));
    14961496  _cmbMaxresLineEdit->setWhatsThis(tr("<p>BNC combines all incoming clocks according to specified weights. Individual clock estimates that differ by more than 'Maximal residuum' meters from the average of all clocks will be ignored.<p></p>It is suggested to specify a value of about 0.2 m for the Kalman filter combination approach and a value of about 3.0 meters for the Single-Epoch combination approach.</p><p>Default is a value of '999.0'. <i>[key: cmbMaxres]</i></p>"));
    1497   _cmbSamplSpinBox->setWhatsThis(tr("<p>Select a combination Sampling interval for the clocks. Clock corrections will be produced following that interval.</p><p>A value of 10 sec may be an appropriate choice. <i>[key: cmbSampl]</i></p>"));
     1497  _cmbSamplSpinBox->setWhatsThis(tr("<p>Select a combination Sampling interval for the clocks. Clock corrections will be produced following that interval.</p><p>A value of 10 sec may be an appropriate choice. A value of zero '0' tells BNC to use all available samples. <i>[key:  ]</i></p>"));
    14981498  _cmbGpsCheckBox->setWhatsThis(tr("<p>GPS clock corrections shall be combined. <i>[key: cmbGps]</i></p>"));
    14991499  _cmbGloCheckBox->setWhatsThis(tr("<p>GLONASS clock corrections shall be combined; GPS Broadcast ephemeris and corrections are required. <i>[key: cmbGlo]</i></p>"));
  • trunk/BNC/src/combination/bnccomb.cpp

    r9635 r9676  
    2121
    2222#include "bnccomb.h"
     23#include <combination/bncbiassnx.h>
    2324#include "bnccore.h"
    2425#include "upload/bncrtnetdecoder.h"
     
    130131  _cmbSampl = settings.value("cmbSampl").toInt();
    131132  if (_cmbSampl <= 0) {
    132     _cmbSampl = 10;
     133    _cmbSampl = 5;
    133134  }
    134135  _useGps = (Qt::CheckState(settings.value("cmbGps").toInt()) == Qt::Checked) ? true : false;
     
    286287  }
    287288
     289
     290  // Bias SINEX File
     291  // ---------------
     292  _bsx = 0;
     293  QString bsxFileName = settings.value("cmbBsxFile").toString();
     294  if (!bsxFileName.isEmpty()) {
     295    _bsx = new bncBiasSnx();
     296    if (_bsx->readFile(bsxFileName) != success) {
     297      emit newMessage("wrong Bias SINEX file", true);
     298      delete _bsx;
     299      _bsx = 0;
     300    }
     301  }
     302  if (_bsx) {
     303    _nextShotTimeBsx = QTime(23, 59, 59, 999);
     304  }
     305
     306
    288307  // Maximal Residuum
    289308  // ----------------
     
    306325  }
    307326  delete _antex;
     327  delete _bsx;
    308328  QMapIterator<char, unsigned> itSys(_cmbSysPrn);
    309329  while (itSys.hasNext()) {
     
    321341
    322342}
     343
     344void bncComb::slotReadBiasSnxFile() {
     345  bncSettings settings;
     346  QString bsxFileName = settings.value("cmbBsxFile").toString();
     347  if (!bsxFileName.isEmpty()) {
     348    _bsx = new bncBiasSnx();
     349  }
     350
     351  if (_bsx->readFile(bsxFileName) != success) {
     352    emit newMessage("wrong Bias SINEX file", true);
     353    delete _bsx;
     354    _bsx = 0;
     355  }
     356#ifdef BNC_DEBUG_CMB
     357  else {
     358    emit newMessage("Successfully read Bias SINEX file", true);
     359  }
     360#endif
     361}
     362
    323363
    324364// Remember orbit corrections
     
    358398}
    359399
    360 // Remember satllite code biases
     400// Remember Satellite Code Biases
    361401////////////////////////////////////////////////////////////////////////////
    362402void bncComb::slotNewCodeBiases(QList<t_satCodeBias> satCodeBiases) {
     
    442482    // --------------------
    443483    if (_resTime.valid() && clkCorr._time <= _resTime) {
     484#ifdef BNC_DEBUG_CMB
    444485      emit newMessage("bncComb: old correction: " + acName.toLatin1() + " " + prn.mid(0,3).toLatin1(), true);
     486#endif
    445487      continue;
    446488    }
     
    478520    t_eph* ephPrev = _ephUser.ephPrev(prn);
    479521    if (ephLast == 0) {
     522#ifdef BNC_DEBUG_CMB
    480523      emit newMessage("bncComb: eph not found for "  + prn.mid(0,3).toLatin1(), true);
     524#endif
    481525      delete newCorr;
    482526      continue;
     
    485529             ephLast->checkState() == t_eph::outdated ||
    486530             ephLast->checkState() == t_eph::unhealthy) {
    487       emit newMessage("bncComb: ephLast not ok for "  + prn.mid(0,3).toLatin1(), true);
     531#ifdef BNC_DEBUG_CMB
     532      emit newMessage("bncComb: ephLast not ok (checkState: " +  ephLast->checkStateToString().toLatin1() + ") for "  + prn.mid(0,3).toLatin1(), true);
     533#endif
    488534      delete newCorr;
    489535      continue;
     
    499545      }
    500546      else {
     547#ifdef BNC_DEBUG_CMB
    501548        emit newMessage("bncComb: eph not found for "  + prn.mid(0,3).toLatin1() +
    502549                        QString(" with IOD %1").arg(newCorr->_iod).toLatin1(), true);
     550#endif
    503551        delete newCorr;
    504552        continue;
     
    519567      }
    520568      else {
    521         t_satCodeBias& satCodeBias = storage[clkCorr._prn];
    522         QMap<t_frequency::type, double> codeBias;
    523         for (unsigned ii = 1; ii < t_lcRefSig::cIF; ii++) {
    524           t_frequency::type frqType = t_lcRefSig::toFreq(sys,  static_cast<t_lcRefSig::type>(ii));
     569        newCorr->_satCodeBias = storage[clkCorr._prn];
     570        QMap<t_frequency::type, double> codeBiasesRefSig;
     571        for (unsigned ii = 1; ii < cmbRefSig::cIF; ii++) {
     572          t_frequency::type frqType = cmbRefSig::toFreq(sys,  static_cast<cmbRefSig::type>(ii));
    525573          char frqNum = t_frequency::toString(frqType)[1];
    526           char attrib = t_lcRefSig::toAttrib(sys,  static_cast<t_lcRefSig::type>(ii));
    527           QString obsType = QString("%1%2").arg(frqNum).arg(attrib);
    528           for (unsigned ii = 0; ii < satCodeBias._bias.size(); ii++) {
    529             const t_frqCodeBias& bias = satCodeBias._bias[ii];
    530             if (obsType.toStdString() == bias._rnxType2ch) {
    531               codeBias[frqType] = bias._value;
     574          char attrib = cmbRefSig::toAttrib(sys,  static_cast<cmbRefSig::type>(ii));
     575          QString rnxType2ch = QString("%1%2").arg(frqNum).arg(attrib);
     576          for (unsigned ii = 0; ii < newCorr->_satCodeBias._bias.size(); ii++) {
     577            const t_frqCodeBias& bias = newCorr->_satCodeBias._bias[ii];
     578            if (rnxType2ch.toStdString() == bias._rnxType2ch) {
     579              codeBiasesRefSig[frqType] = bias._value;
    532580            }
    533581          }
    534582        }
     583        if (codeBiasesRefSig.size() < 2) {
     584          delete newCorr;
     585          continue;
     586        }
    535587        map<t_frequency::type, double> codeCoeff;
    536588        double channel = double(newCorr->_eph->slotNum());
    537         t_lcRefSig::coeff(sys, t_lcRefSig::cIF, channel, codeCoeff);
     589        cmbRefSig::coeff(sys, cmbRefSig::cIF, channel, codeCoeff);
    538590        map<t_frequency::type, double>::const_iterator it;
    539591        for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
    540592          t_frequency::type frqType = it->first;
    541           newCorr->_codeBiasIF += it->second * codeBias[frqType];
    542         }
    543       }
    544       cout <<  acName.toStdString() << " " << clkCorr._prn.toString().c_str() << " _codeBiasIF: " << newCorr->_codeBiasIF << endl;
     593          newCorr->_codeBiasIF += it->second * codeBiasesRefSig[frqType];
     594        }
     595        newCorr->_satCodeBias._bias.clear();
     596      }
     597      //cout <<  acName.toStdString() << " " << clkCorr._prn.toString().c_str() << " _codeBiasIF: " << newCorr->_codeBiasIF << endl;
    545598    }
    546599
     
    622675  out << "\n" <<           "Combination: " << sys << "\n"
    623676      << "--------------------------------" << "\n";
     677
     678  // Re-read Bias SINEX file
     679  // -----------------------
     680  if (_bsx) {
     681    QTime currTime = currentDateAndTimeGPS().time();
     682    int ms = currTime.msecsTo(_nextShotTimeBsx);
     683    if (ms < 30000) {
     684      ms = 30000;
     685    }
     686    QTimer::singleShot(ms, this, SLOT(slotReadBiasSnxFile()));
     687  }
    624688
    625689  // Observation Statistics
     
    696760      if (pp->type == cmbParam::clkSat) {
    697761        if (resCorr.find(pp->prn) != resCorr.end()) {
     762          // set clock result
    698763          resCorr[pp->prn]->_dClkResult = pp->xx / t_CST::c;
     764          // Add Code Biases from SINEX File
     765          if (_bsx) {
     766            map<t_frequency::type, double> codeCoeff;
     767            double channel = double(resCorr[pp->prn]->_eph->slotNum());
     768            cmbRefSig::coeff(sys, cmbRefSig::cIF, channel, codeCoeff);
     769            t_frequency::type fType1 = cmbRefSig::toFreq(sys, cmbRefSig::c1);
     770            t_frequency::type fType2 = cmbRefSig::toFreq(sys, cmbRefSig::c2);
     771            _bsx->determineSsrSatCodeBiases(pp->prn.mid(0,3), codeCoeff[fType1], codeCoeff[fType2], resCorr[pp->prn]->_satCodeBias);
     772          }
    699773        }
    700774      }
     
    836910      out << "bncComb::printResuls bug" << "\n";
    837911    }
     912    out.flush();
    838913  }
    839914}
     
    845920  QList<t_orbCorr> orbCorrections;
    846921  QList<t_clkCorr> clkCorrections;
    847 
    848   QString     outLines;
     922  QList<t_satCodeBias> satCodeBiasList;
     923
    849924  unsigned year, month, day, hour, minute;
    850925  double   sec;
     
    852927  _resTime.civil_time(hour, minute, sec);
    853928
    854   outLines.sprintf("*  %4d %2d %2d %d %d %12.8f\n",
    855                    year, month, day, hour, minute, sec);
     929  QString outLines = QString().asprintf("*  %4d %2d %2d %d %d %12.8f\n",
     930                                        year, month, day, hour, minute, sec);
    856931
    857932  QMapIterator<QString, cmbCorr*> it(resCorr);
     
    859934    it.next();
    860935    cmbCorr* corr = it.value();
    861 
     936    // ORBIT
    862937    t_orbCorr orbCorr(corr->_orbCorr);
    863938    orbCorr._staID = "INTERNAL";
    864939    orbCorrections.push_back(orbCorr);
    865 
     940    // CLOCK
    866941    t_clkCorr clkCorr(corr->_clkCorr);
    867942    clkCorr._staID      = "INTERNAL";
     
    892967
    893968    outLines += corr->_prn.mid(0,3);
    894     QString hlp;
    895     hlp.sprintf(" APC 3 %15.4f %15.4f %15.4f"
    896                 " Clk 1 %15.4f"
    897                 " Vel 3 %15.4f %15.4f %15.4f"
    898                 " CoM 3 %15.4f %15.4f %15.4f\n",
    899                 xc(1), xc(2), xc(3),
    900                 xc(4) *  t_CST::c,
    901                 vv(1), vv(2), vv(3),
    902                 xc(1)-dx(1), xc(2)-dx(2), xc(3)-dx(3));
     969    QString hlp = QString().asprintf(" APC 3 %15.4f %15.4f %15.4f"
     970                  " Clk 1 %15.4f"
     971                  " Vel 3 %15.4f %15.4f %15.4f"
     972                  " CoM 3 %15.4f %15.4f %15.4f",
     973                  xc(1), xc(2), xc(3),
     974                  xc(4) *  t_CST::c,
     975                  vv(1), vv(2), vv(3),
     976                  xc(1)-dx(1), xc(2)-dx(2), xc(3)-dx(3));
    903977    outLines += hlp;
    904 
    905     QString line;
    906     int messageType   = _ssrCorr->COTYPE_GPSCOMBINED;
    907     int updateInt     = 0;
    908     line.sprintf("%d %d %d %.1f %s"
    909                  "   %lu"
    910                  "   %8.3f %8.3f %8.3f %8.3f"
    911                  "   %10.5f %10.5f %10.5f %10.5f"
    912                  "   %10.5f INTERNAL",
    913                  messageType, updateInt, _resTime.gpsw(), _resTime.gpssec(),
    914                  corr->_prn.mid(0,3).toLatin1().data(),
    915                  corr->_iod,
    916                  corr->_dClkResult * t_CST::c,
    917                  corr->_orbCorr._xr[0],
    918                  corr->_orbCorr._xr[1],
    919                  corr->_orbCorr._xr[2],
    920                  0.0,
    921                  corr->_orbCorr._dotXr[0],
    922                  corr->_orbCorr._dotXr[1],
    923                  corr->_orbCorr._dotXr[2],
    924                  0.0);
    925 
     978    hlp.clear();
     979
     980    // CODE BIASES
     981    t_satCodeBias satCodeBias(corr->_satCodeBias);
     982    satCodeBias._staID = "INTERNAL";
     983    satCodeBiasList.push_back(satCodeBias);
     984
     985    if (satCodeBias._bias.size()) {
     986      hlp = QString().asprintf(" CodeBias %2lu", satCodeBias._bias.size());
     987      outLines += hlp;
     988      hlp.clear();
     989      for (unsigned ii = 0; ii < satCodeBias._bias.size(); ii++) {
     990        const t_frqCodeBias& frqCodeBias = satCodeBias._bias[ii];
     991        if (!frqCodeBias._rnxType2ch.empty()) {
     992          hlp = QString().asprintf(" %s%10.6f", frqCodeBias._rnxType2ch.c_str(), frqCodeBias._value);
     993          outLines += hlp;
     994          hlp.clear();
     995        }
     996      }
     997    }
     998    outLines += "\n";
     999    //cout << outLines.toStdString();
    9261000    delete corr;
    9271001  }
     
    9411015    emit newOrbCorrections(orbCorrections);
    9421016    emit newClkCorrections(clkCorrections);
     1017  }
     1018  if (satCodeBiasList.size()) {
     1019    emit newCodeBiases(satCodeBiasList);
    9431020  }
    9441021}
  • trunk/BNC/src/combination/bnccomb.h

    r9635 r9676  
    1515class bncSP3;
    1616class bncAntex;
     17class bncBiasSnx;
    1718
    1819class bncComb : public QObject {
     
    2930  void slotNewClkCorrections(QList<t_clkCorr> clkCorrections);
    3031  void slotNewCodeBiases(QList<t_satCodeBias> satCodeBiases);
     32
     33
     34 private slots:
     35  void slotReadBiasSnxFile();
    3136
    3237 signals:
     
    8287      _iod        = 0;
    8388      _dClkResult = 0.0;
    84       _codeBiasIF   = 0.0;
     89      _codeBiasIF = 0.0;
    8590    }
    8691    ~cmbCorr() {}
    87     QString       _prn;
    88     bncTime       _time;
    89     unsigned long _iod;
    90     t_eph*        _eph;
    91     t_orbCorr     _orbCorr;
    92     t_clkCorr     _clkCorr;
    93     t_satCodeBias _satCodeBias;
    94     QString       _acName;
    95     double        _codeBiasIF;
    96     double        _dClkResult;
    97     ColumnVector  _diffRao;
     92    QString        _prn;
     93    bncTime        _time;
     94    unsigned long  _iod;
     95    t_eph*         _eph;
     96    t_orbCorr      _orbCorr;
     97    t_clkCorr      _clkCorr;
     98    t_satCodeBias  _satCodeBias;
     99    QString        _acName;
     100    double         _codeBiasIF;
     101    double         _dClkResult;
     102    ColumnVector   _diffRao;
    98103    QString ID() {return _acName + "_" + _prn;}
    99104  };
     
    111116  };
    112117
    113   class t_lcRefSig {
     118  class cmbRefSig {
    114119   public:
    115120    enum type {dummy = 0, c1, c2, cIF};
     
    183188          codeCoeff[fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
    184189          return;
    185         case t_lcRefSig::dummy:
     190        case cmbRefSig::dummy:
    186191          return;
    187192      }
     
    213218  QByteArray                                 _log;
    214219  bncAntex*                                  _antex;
     220  bncBiasSnx*                                _bsx;
     221  QTime                                      _nextShotTimeBsx;
    215222  double                                     _MAXRES;
    216223  QMap<char, QString>                        _masterOrbitAC;
  • trunk/BNC/src/src.pri

    r9652 r9676  
    3434#debug:DEFINES   += BNC_DEBUG_PPP
    3535#debug:DEFINES   += BNC_DEBUG_SSR
     36#debug:DEFINES   += BNC_DEBUG_CMB
    3637
    3738# Include Path
     
    7980          rinex/availplot.h        rinex/eleplot.h                    \
    8081          rinex/dopplot.h          orbComp/sp3Comp.h                  \
    81           combination/bnccomb.h
     82          combination/bnccomb.h combination/bncbiassnx.h
    8283
    8384HEADERS       += serial/qextserialbase.h serial/qextserialport.h
     
    118119          rinex/availplot.cpp      rinex/eleplot.cpp                  \
    119120          rinex/dopplot.cpp        orbComp/sp3Comp.cpp                \
    120           combination/bnccomb.cpp
     121          combination/bnccomb.cpp combination/bncbiassnx.cpp
    121122
    122123SOURCES       += serial/qextserialbase.cpp serial/qextserialport.cpp
Note: See TracChangeset for help on using the changeset viewer.