Changeset 10614 in ntrip for trunk/BNC/src/rinex/reqcedit.cpp


Ignore:
Timestamp:
Feb 28, 2025, 5:53:12 PM (9 hours ago)
Author:
stuerze
Message:

bug fixes egarding RINEX Editing and QC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/rinex/reqcedit.cpp

    r10603 r10614  
    7575  _begTime        = bncTime(settings.value("reqcStartDateTime").toString().toLatin1().data());
    7676  _endTime        = bncTime(settings.value("reqcEndDateTime").toString().toLatin1().data());
     77
     78  _checkEph = false;
    7779
    7880}
     
    171173  while (it.hasNext()) {
    172174    QString fileName = it.next();
    173     if (fileName.indexOf('*') != -1 || fileName.indexOf('?') != -1) {
     175    if (fileName.indexOf('*') != -1 ||
     176        fileName.indexOf('?') != -1) {
    174177      QFileInfo fileInfo(fileName);
    175178      QDir dir = fileInfo.dir();
     
    316319    t_rnxObsFile* obsFile = _rnxObsFiles[ii];
    317320    if (_log) {
    318       *_log << "Processing File: " << obsFile->fileName() << "  start: "
     321      *_log << "Input Obs File: " << obsFile->fileName() << "  start: "
    319322            << obsFile->startTime().datestr().c_str() << ' '
    320323            << obsFile->startTime().timestr(0).c_str() << Qt::endl;
     
    520523////////////////////////////////////////////////////////////////////////////
    521524void t_reqcEdit::readEphemerides(const QStringList& navFileNames,
    522                                  QVector<t_eph*>& ephs) {
     525                                 QVector<t_eph*>& ephs, QTextStream* log,
     526                                 bool checkEph) {
    523527
    524528  QStringListIterator it(navFileNames);
    525529  while (it.hasNext()) {
    526530    QString fileName = it.next();
    527     if (fileName.indexOf('*') != -1 || fileName.indexOf('?') != -1) {
     531    if (fileName.indexOf('*') != -1 ||
     532        fileName.indexOf('?') != -1) {
    528533      QFileInfo fileInfo(fileName);
    529534      QDir dir = fileInfo.dir();
     
    532537      while (it.hasNext()) {
    533538        QString filePath = it.next().filePath();
    534         appendEphemerides(filePath, ephs);
     539        appendEphemerides(filePath, ephs, log, checkEph);
    535540      }
    536541    }
    537542    else {
    538       appendEphemerides(fileName, ephs);
     543      appendEphemerides(fileName, ephs, log, checkEph);
    539544    }
    540545  }
     
    565570  while (it.hasNext()) {
    566571    QString fileName = it.next();
     572
    567573    t_rnxNavFile rnxNavFile(fileName, t_rnxNavFile::input);
    568574    QStringListIterator itCmnt(rnxNavFile.comments());
     
    580586  // Read Ephemerides
    581587  // ----------------
    582   t_reqcEdit::readEphemerides(_navFileNames, _ephs);
     588  t_reqcEdit::readEphemerides(_navFileNames, _ephs, _log, _checkEph);
    583589
    584590  // Check Satellite Systems
     
    709715////////////////////////////////////////////////////////////////////////////
    710716void t_reqcEdit::appendEphemerides(const QString& fileName,
    711                                    QVector<t_eph*>& ephs) {
     717                                   QVector<t_eph*>& ephs, QTextStream* log,
     718                                   bool checkEph) {
    712719  t_rnxNavFile rnxNavFile(fileName, t_rnxNavFile::input);
     720  unsigned numOK  = 0;
     721  unsigned numBad = 0;
     722  unsigned numUnhealthy = 0;
     723  bncEphUser ephUser(false);
     724
     725  if (log) {
     726    QFileInfo navFi(rnxNavFile.fileName());
     727      *log << "Input Nav File     : " << navFi.fileName()      << Qt::endl;
     728    if (checkEph) {
     729      *log << "RINEX Version      : " << rnxNavFile.version()  << Qt::endl;
     730    }
     731  }
     732
    713733  for (unsigned ii = 0; ii < rnxNavFile.ephs().size(); ii++) {
    714734    t_eph* eph   = rnxNavFile.ephs()[ii];
     
    724744
    725745    if (isNew) {
    726       if      (eph->system() == t_eph::GPS &&
    727                eph->type()   == t_eph::LNAV) {
     746
     747      if (checkEph) {
     748        ephUser.putNewEph(eph, false);
     749        if      (eph->checkState() == t_eph::bad) {
     750          ++numBad;
     751        }
     752        else if (eph->checkState() == t_eph::unhealthy) {
     753          ++numUnhealthy;
     754        }
     755        else {
     756          ++numOK;
     757        }
     758        if (eph->checkState() == t_eph::bad) {
     759          continue;
     760        }
     761      }
     762
     763      if      (eph->system() == t_eph::GPS) {
    728764        ephs.append(new t_ephGPS(*dynamic_cast<t_ephGPS*>(eph)));
    729765      }
    730       else if (eph->system() == t_eph::GLONASS &&
    731                eph->type()   == t_eph::FDMA_M) {
     766      else if (eph->system() == t_eph::GLONASS) {
    732767        ephs.append(new t_ephGlo(*dynamic_cast<t_ephGlo*>(eph)));
    733768      }
    734       else if (eph->system() == t_eph::Galileo &&
    735                eph->type()   ==  t_eph::INAV) {
     769      else if (eph->system() == t_eph::Galileo) {
    736770        ephs.append(new t_ephGal(*dynamic_cast<t_ephGal*>(eph)));
    737771      }
    738       else if (eph->system() == t_eph::QZSS &&
    739                eph->type()   == t_eph::LNAV) {
     772      else if (eph->system() == t_eph::QZSS) {
    740773        ephs.append(new t_ephGPS(*dynamic_cast<t_ephGPS*>(eph)));
    741774      }
    742       else if (eph->system() == t_eph::SBAS &&
    743                eph->type()   == t_eph::SBASL1) {
     775      else if (eph->system() == t_eph::SBAS) {
    744776        ephs.append(new t_ephSBAS(*dynamic_cast<t_ephSBAS*>(eph)));
    745777      }
    746       else if (eph->system() == t_eph::BDS &&
    747                (eph->type()  == t_eph::D1 ||
    748                 eph->type()  == t_eph::D2)) {
     778      else if (eph->system() == t_eph::BDS) {
    749779        ephs.append(new t_ephBDS(*dynamic_cast<t_ephBDS*>(eph)));
    750780      }
    751       else if (eph->system() == t_eph::IRNSS &&
    752                eph->type()   == t_eph::LNAV) {
     781      else if (eph->system() == t_eph::IRNSS) {
    753782        ephs.append(new t_ephGPS(*dynamic_cast<t_ephGPS*>(eph)));
    754783      }
    755784    }
     785  }
     786
     787  if (log && checkEph) {
     788    *log << "Ephemeris Check    : " << numOK        << " OK   "
     789                                    << numUnhealthy << " UNHEALTHY   "
     790                                    << numBad       << " WRONG\n";
     791    if (numBad > 0) {
     792      for (unsigned ii = 0; ii < rnxNavFile.ephs().size(); ii++) {
     793        t_eph* eph = rnxNavFile.ephs()[ii];
     794        QFileInfo navFi(fileName);
     795        if (eph->checkState() == t_eph::bad) {
     796          if (log) {
     797            *log << "                   : "
     798                 << QString("WRONG %2:%3\n")
     799                         .arg(eph->typeStr(eph->type(), eph->prn(), 99.0))
     800                         .arg(eph->rinexDateStr(eph->TOC(), eph->prn(), 99.0)).toLatin1();
     801          }
     802        }
     803      }
     804    }
     805    *log << Qt::endl;
    756806  }
    757807}
Note: See TracChangeset for help on using the changeset viewer.