Changeset 9370 in ntrip for branches/BNC_2.12/src/ephemeris.cpp


Ignore:
Timestamp:
Mar 11, 2021, 2:50:05 PM (3 years ago)
Author:
stuerze
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/BNC_2.12/src/ephemeris.cpp

    r9291 r9370  
    153153// Constructor
    154154//////////////////////////////////////////////////////////////////////////////
    155 t_ephGPS::t_ephGPS(float rnxVersion, const QStringList& lines) {
     155t_ephGPS::t_ephGPS(double rnxVersion, const QStringList& lines) {
    156156
    157157  const int nLines = 8;
     
    511511// Constructor
    512512//////////////////////////////////////////////////////////////////////////////
    513 t_ephGlo::t_ephGlo(float rnxVersion, const QStringList& lines) {
    514 
    515   const int nLines = 4;
     513t_ephGlo::t_ephGlo(double rnxVersion, const QStringList& lines) {
     514
     515  int nLines = 4;
     516  if (rnxVersion >= 3.05) {
     517    nLines += 1;
     518    _flags_unknown = false;
     519  }
     520  else {
     521    _M_delta_tau = 0.9999e9; // unknown
     522    _M_FT = 1.5e1;           // unknown
     523    _flags_unknown = true;
     524  }
    516525
    517526  if (lines.size() != nLines) {
     
    523532  // ------------
    524533  int fieldLen = 19;
     534  double statusflags = 0.0;
     535  double healthflags = 0.0;
    525536
    526537  int pos[4];
     
    604615        _checkState = bad;
    605616        return;
     617      }
     618    }
     619
     620    else if ( iLine == 4 ) {
     621      if ( readDbl(line, pos[0], fieldLen, statusflags    )  ||
     622           readDbl(line, pos[1], fieldLen, _M_delta_tau   )  ||
     623           readDbl(line, pos[2], fieldLen, _M_FT          )  ||
     624           readDbl(line, pos[3], fieldLen, healthflags    ) ) {
     625        _checkState = bad;
     626        return;
     627      }
     628      else {
     629        // status flags
     630        // ============
     631        // bit 0-1
     632        _M_P  = double(bitExtracted(statusflags, 2, 0));
     633        // bit 2-3
     634        _P1   = double(bitExtracted(statusflags, 2, 2));
     635        // bit 4
     636        _P2   = double(bitExtracted(statusflags, 1, 4));
     637        // bit 5
     638        _P3   = double(bitExtracted(statusflags, 1, 5));
     639        // bit 6
     640        _M_P4 = double(bitExtracted(statusflags, 1, 6));
     641        // bit 7-8
     642        _M_M  = double(bitExtracted(statusflags, 2, 7));
     643        /// GLO M/K exclusive flags/values only valid if flag M is set to '01'
     644        if (!_M_M) {
     645          _M_P4 = 0.0;
     646          _M_P  = 0.0;
     647        }
     648        // health flags
     649        // ============
     650        // bit 0 (is to be ignored, if bit 1 is zero)
     651        _almanac_health = double(bitExtracted(healthflags, 1, 0));
     652        // bit 1
     653        _almanac_health_availablility_indicator = double(bitExtracted(healthflags, 1, 1));
     654        //  bit 2
     655        _M_l3 = double(bitExtracted(healthflags, 1, 2));
    606656      }
    607657    }
     
    702752    .arg(_E,              19, 'e', 12);
    703753
     754  if (version >= 3.05) {
     755    // unknown (RINEX version < 3.05)
     756    if (_flags_unknown) {
     757      out << QString(fmt)
     758        .arg("",            19, QChar(' '))  // statusflags blank if unknown
     759        .arg(_M_delta_tau,  19, 'e', 12)
     760        .arg(_M_FT,         19, 'e', 12)
     761        .arg("",            19, QChar(' ')); // healthflags blank if unknown
     762    }
     763    else {
     764      int statusflags = 0;
     765      // bit 7-8
     766      if (_M_M == 2.0) {
     767        statusflags |= (1<<7);
     768      }
     769      // bit 6
     770      if (_M_P4) {
     771        statusflags |= (1<<6);
     772      }
     773      // bit 5
     774      if (_P3) {
     775        statusflags |= (1<<5);
     776      }
     777      // bit 4
     778      if (_P2) {
     779        statusflags |= (1<<4);
     780      }
     781      // bit 2-3
     782      if      (_P1 == 2.0) {
     783        statusflags |= (1<<2);
     784      }
     785      else if (_P1 == 1.0) {
     786        statusflags |= (1<<3);
     787      }
     788      else if (_P1 == 3.0) {
     789        statusflags |= (1<<2);
     790        statusflags |= (1<<3);
     791      }
     792      // bit 0-1
     793      if       (_M_P == 2.0) {
     794        statusflags |= (1<<0);
     795      }
     796      else if (_M_P == 1.0) {
     797        statusflags |= (1<<1);
     798      }
     799      else if (_M_P == 3.0) {
     800        statusflags |= (1<<0);
     801        statusflags |= (1<<1);
     802      }
     803      // health flags
     804      // ============
     805      int healthflags = 0;
     806      // bit 0 (is to be ignored, if bit 1 is zero)
     807      if (_almanac_health) {
     808        healthflags |= (1<<0);
     809      }
     810      // bit 1
     811      if (_almanac_health_availablility_indicator) {
     812        healthflags |= (1<<1);
     813      }
     814      //  bit 2
     815      if (_M_l3) {
     816        healthflags |= (1<<2);
     817      }
     818      out << QString(fmt)
     819        .arg(double(statusflags), 19, 'e', 12)
     820        .arg(_M_delta_tau,        19, 'e', 12)
     821        .arg(_M_FT,               19, 'e', 12)
     822        .arg(double(healthflags), 19, 'e', 12);
     823    }
     824  }
     825
    704826  return rnxStr;
    705827}
     
    770892// Constructor
    771893//////////////////////////////////////////////////////////////////////////////
    772 t_ephGal::t_ephGal(float rnxVersion, const QStringList& lines) {
     894t_ephGal::t_ephGal(double rnxVersion, const QStringList& lines) {
    773895  int       year, month, day, hour, min;
    774896  double    sec;
     
    8901012      } else {
    8911013        // Bit 0
    892         _e1DataInValid = (int(SVhealth) & (1<<0));
     1014        _e1DataInValid  = (int(SVhealth) & (1<<0));
    8931015        // Bit 1-2
    894         _E1_bHS = double((int(SVhealth) >> 1) & 0x3);
     1016        _E1_bHS         = double((int(SVhealth) >> 1) & 0x3);
    8951017        // Bit 3
    8961018        _e5aDataInValid = (int(SVhealth) & (1<<3));
    8971019        // Bit 4-5
    898         _E5aHS = double((int(SVhealth) >> 4) & 0x3);
     1020        _E5aHS          = double((int(SVhealth) >> 4) & 0x3);
    8991021        // Bit 6
    9001022        _e5bDataInValid = (int(SVhealth) & (1<<6));
    9011023        // Bit 7-8
    902         _E5bHS = double((int(SVhealth) >> 7) & 0x3);
     1024        _E5bHS          = double((int(SVhealth) >> 7) & 0x3);
    9031025
    9041026        if (prnStr.at(0) == 'E') {
     
    11611283// Constructor
    11621284//////////////////////////////////////////////////////////////////////////////
    1163 t_ephSBAS::t_ephSBAS(float rnxVersion, const QStringList& lines) {
     1285t_ephSBAS::t_ephSBAS(double rnxVersion, const QStringList& lines) {
    11641286
    11651287  const int nLines = 4;
     
    13541476// Constructor
    13551477//////////////////////////////////////////////////////////////////////////////
    1356 t_ephBDS::t_ephBDS(float rnxVersion, const QStringList& lines) {
     1478t_ephBDS::t_ephBDS(double rnxVersion, const QStringList& lines) {
    13571479
    13581480  const int nLines = 8;
Note: See TracChangeset for help on using the changeset viewer.