Changeset 10614 in ntrip


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

bug fixes egarding RINEX Editing and QC

Location:
trunk/BNC/src
Files:
7 edited

Legend:

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

    r10603 r10614  
    266266//////////////////////////////////////////////////////////////////////////////
    267267t_ephGPS::t_ephGPS(double rnxVersion, const QStringList &lines, QString typeStr) {
    268  
     268
    269269  setType(typeStr);
    270  
     270
    271271  int nLines = 8; // LNAV
    272272  // Source RINEX version < 4
     
    10571057  // Source RINEX version < 4
    10581058  if (type() == t_eph::undefined) {
    1059     _type = t_eph::FDMA;
     1059    // cannot be determined from input data
     1060    // but is set to be able to work with old RINEX files in BNC applications
     1061    _type = t_eph::FDMA_M;
    10601062  }
    10611063
     
    10651067    _M_delta_tau = 0.9999e9; // unknown
    10661068    _M_FT        = 1.5e1;    // unknown
     1069    _statusflags_unknown = true;
     1070    _healthflags_unknown = true;
    10671071  }
    10681072
     
    11501154    // =====================
    11511155    else if (iLine == 2) {
    1152       if (type() == t_eph::FDMA) {
     1156      if (type() == t_eph::FDMA ||
     1157          type() == t_eph::FDMA_M) {
    11531158        if (   readDbl(line, pos[0], fieldLen, _y_pos)
    11541159            || readDbl(line, pos[1], fieldLen, _y_vel)
     
    11741179    // =====================
    11751180    else if (iLine == 3) {
    1176       if (type() == t_eph::FDMA) {
     1181      if (type() == t_eph::FDMA ||
     1182          type() == t_eph::FDMA_M) {
    11771183        if (   readDbl(line, pos[0], fieldLen, _z_pos)
    11781184            || readDbl(line, pos[1], fieldLen, _z_vel)
     
    12061212    // =====================
    12071213    else if (iLine == 4) {
    1208       if (type() == t_eph::FDMA) {
     1214      if (type() == t_eph::FDMA ||
     1215          type() == t_eph::FDMA_M) {
    12091216        if (readDbl(line, pos[0], fieldLen, statusflags)) {
    12101217          //status flags BLK, do nothing
     
    12391246            _M_tau_GPS   = 0.0;
    12401247            _M_delta_tau = 0.0;
     1248            _type = t_eph::FDMA;
    12411249          }
    12421250          else {
  • trunk/BNC/src/ephemeris.h

    r10603 r10614  
    276276    _angular_rate_max = 0.0;
    277277    _data_validity = 0;
    278     _healthflags_unknown = false;
    279     _statusflags_unknown = false;
     278    _healthflags_unknown = true;
     279    _statusflags_unknown = true;
    280280    _almanac_health = 0.0;
    281281    _almanac_health_availablility_indicator = 0.0;
  • trunk/BNC/src/rinex/reqcanalyze.cpp

    r10605 r10614  
    7575  analyzePlotSignals();
    7676
     77  _checkEph = true;
     78
    7779  qRegisterMetaType< QVector<t_skyPlotData> >("QVector<t_skyPlotData>");
    7880
     
    121123  }
    122124
    123   // Check Ephemerides
    124   // -----------------
    125   checkEphemerides();
    126 
    127125  // Initialize RINEX Observation Files
    128126  // ----------------------------------
     
    131129  // Read Ephemerides
    132130  // ----------------
    133   t_reqcEdit::readEphemerides(_navFileNames, _ephs);
     131  t_reqcEdit::readEphemerides(_navFileNames, _ephs, _log, _checkEph);
    134132
    135133  // Loop over all RINEX Files
     
    968966//
    969967////////////////////////////////////////////////////////////////////////////
    970 void t_reqcAnalyze::checkEphemerides() {
    971 
    972   QString navFileName;
    973   QStringListIterator namIt(_navFileNames);
    974   bool firstName = true;
    975   while (namIt.hasNext()) {
    976     QFileInfo navFi(namIt.next());
    977     if (firstName) {
    978       firstName = false;
    979       navFileName += navFi.fileName();
    980     }
    981     else {
    982       navFileName += ", " + navFi.fileName();
    983     }
    984   }
    985   if (_log) {
    986     *_log << "Navigation File(s) : " << navFileName  << Qt::endl;
    987   }
    988   QStringListIterator it(_navFileNames);
    989   while (it.hasNext()) {
    990     const QString& fileName = it.next();
    991     unsigned numOK  = 0;
    992     unsigned numBad = 0;
    993     unsigned numUnhealthy = 0;
    994     bncEphUser ephUser(false);
    995     t_rnxNavFile rnxNavFile(fileName, t_rnxNavFile::input);
    996     for (unsigned ii = 0; ii < rnxNavFile.ephs().size(); ii++) {
    997       t_eph* eph = rnxNavFile.ephs()[ii];
    998       ephUser.putNewEph(eph, false);
    999       if      (eph->checkState() == t_eph::bad) {
    1000         ++numBad;
    1001       }
    1002       else if (eph->checkState() == t_eph::unhealthy) {
    1003         ++numUnhealthy;
    1004       }
    1005       else {
    1006         ++numOK;
    1007       }
    1008     }
    1009     if (_log) {
    1010       *_log << "Ephemeris          : " << numOK        << " OK   "
    1011                                        << numUnhealthy << " UNHEALTHY   "
    1012                                        << numBad       << " WRONG\n";
    1013       if (numBad > 0) {
    1014         for (unsigned ii = 0; ii < rnxNavFile.ephs().size(); ii++) {
    1015           t_eph* eph = rnxNavFile.ephs()[ii];
    1016           QFileInfo navFi(fileName);
    1017           if (eph->checkState() == t_eph::bad) {
    1018             *_log  << "                     "
    1019                 << navFi.fileName() << ' ' << QString(": WRONG %2:%3\n")
    1020                            .arg(eph->typeStr(eph->type(), eph->prn(), 99.0))
    1021                            .arg(eph->rinexDateStr(eph->TOC(), eph->prn(), 99.0)).toLatin1();
    1022           }
    1023         }
    1024       }
    1025       *_log << Qt::endl;
    1026     }
    1027   }
    1028 }
    1029 
    1030968void t_reqcAnalyze::setExpectedObs(const bncTime& startTime, const bncTime& endTime,
    1031969                                   double interval, const ColumnVector& xyzSta) {
    1032 
    1033 
    1034970  for(QMap<t_prn, int>::iterator it = _numExpObs.begin(); it != _numExpObs.end(); it++) {
    1035971    t_eph* eph = 0;
  • trunk/BNC/src/rinex/reqcanalyze.h

    r8756 r10614  
    179179
    180180 private:
    181   void   checkEphemerides();
    182181
    183182  void   analyzePlotSignals();
     
    202201
    203202  static bool mpLessThan(const t_polarPoint* p1, const t_polarPoint* p2);
    204    
     203
    205204  QString                    _logFileName;
    206205  QFile*                     _logFile;
    207206  QTextStream*               _log;
     207  bool                       _checkEph;
    208208  QStringList                _obsFileNames;
    209209  QVector<t_rnxObsFile*>     _rnxObsFiles;
  • 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}
  • trunk/BNC/src/rinex/reqcedit.h

    r8397 r10614  
    5151                              QTextStream* log);
    5252  static void readEphemerides(const QStringList& navFileNames,
    53                               QVector<t_eph*>& ephs);
    54   static void appendEphemerides(const QString& fileName, QVector<t_eph*>& ephs);
     53                              QVector<t_eph*>& ephs, QTextStream* log,
     54                              bool checkEph);
     55  static void appendEphemerides(const QString& fileName,
     56                                QVector<t_eph*>& ephs,
     57                                QTextStream* log, bool checkEph);
    5558
    5659 private:
     
    6568  QFile*                 _logFile;
    6669  QTextStream*           _log;
     70  bool                   _checkEph;
    6771  QStringList            _obsFileNames;
    6872  QVector<t_rnxObsFile*> _rnxObsFiles;
  • trunk/BNC/src/rinex/rnxnavfile.h

    r10587 r10614  
    6262  t_eph* getNextEph(const bncTime& tt, const QMap<QString, unsigned int>* corrIODs);
    6363  const std::vector<t_eph*> ephs() const {return _ephs;}
     64  const QString& fileName() const {return _fileName;}
    6465  double version() const {return _header._version;}
    6566  void   setVersion(double version) {_header._version = version;}
Note: See TracChangeset for help on using the changeset viewer.