Changeset 9205 in ntrip for branches/BNC_2.12


Ignore:
Timestamp:
Nov 3, 2020, 1:15:38 PM (3 years ago)
Author:
stuerze
Message:

ephemeris checks + debugging output added

Location:
branches/BNC_2.12/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/BNC_2.12/src/RTCM3/RTCM3Decoder.cpp

    r9193 r9205  
    936936    if ((i & ((1 << 20) - 1)) != 0x80000) {
    937937      frqObs->_code = l1range * 0.02;
    938       frqObs->_phase = (l1range * 0.02 + i * 0.0005)
    939           / GLO_WAVELENGTH_L1(freq - 7);
     938      frqObs->_phase = (l1range * 0.02 + i * 0.0005) / GLO_WAVELENGTH_L1(freq - 7);
    940939      frqObs->_codeValid = frqObs->_phaseValid = true;
    941940    }
     
    10471046    GETFLOATSIGN(eph._Cus, 16, 1.0 / (double )(1 << 29))
    10481047    GETFLOAT(eph._sqrt_A, 32, 1.0 / (double )(1 << 19))
    1049     if (eph._sqrt_A < 1000.0) {return false;}
     1048    if (eph._sqrt_A < 1000.0) {
     1049      emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
     1050           .arg(_staID).arg(1020,4).arg(eph._prn.toString().c_str())
     1051           .arg(eph._sqrt_A,10,'F',3).toAscii(), true));
     1052      return false;
     1053    }
    10501054    GETBITS(i, 16)
    10511055    i <<= 4;
     
    11021106    GETBITS(eph._almanac_health, 1) /* almanac healthy */
    11031107    GETBITS(eph._almanac_health_availablility_indicator, 1) /* almanac health ok */
    1104     if (eph._almanac_health_availablility_indicator == 0.0) {return false;}
     1108    if (eph._almanac_health_availablility_indicator == 0.0) {
     1109      emit(newMessage(QString("%1: Block %2 (%3): ALM = %4: missing data!")
     1110           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str())
     1111           .arg(eph._almanac_health_availablility_indicator).toAscii(), true));
     1112      return false;
     1113    }
    11051114    GETBITS(eph._P1, 2) /*  P1 */
    11061115    GETBITS(i, 5)
     
    11381147    GETBITS(eph._M_FT, 4) /* GLONASS-M Ft */
    11391148    GETBITS(eph._M_NT, 11) /* GLONASS-M Nt */
    1140     if (eph._M_NT == 0.0) {return false;}
     1149    if (eph._M_NT == 0.0) {
     1150      emit(newMessage(QString("%1: Block %2 (%3): NT = %4: missing data!")
     1151           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str()).arg(eph._M_NT,4).toAscii(), true));
     1152      return false;
     1153    }
    11411154    GETBITS(eph._M_M, 2) /* GLONASS-M M */
    11421155    GETBITS(eph._additional_data_availability, 1) /* GLONASS-M The Availability of Additional Data */
    1143     if (eph._additional_data_availability == 0.0) {return false;}
     1156    if (eph._additional_data_availability == 0.0) {
     1157      emit(newMessage(QString("%1: Block %2 (%3): ADD = %4: missing data!")
     1158           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str())
     1159           .arg(eph._additional_data_availability).toAscii(), true));
     1160      return false;
     1161    }
    11441162    GETBITS(eph._NA, 11) /* GLONASS-M Na */
    11451163    GETFLOATSIGNM(eph._tauC, 32, 1.0/(double)(1<<30)/(double)(1<<1)) /* GLONASS tau c */
     
    11561174    eph._xv(2) = eph._y_pos * 1.e3;
    11571175    eph._xv(3) = eph._z_pos * 1.e3;
     1176    if (eph._xv.Rows(1,3).NormFrobenius() < 1.0) {
     1177      emit(newMessage(QString("%1: Block %2 (%3): zero position!")
     1178           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str()).toAscii(), true));
     1179      return false;
     1180    }
    11581181    eph._xv(4) = eph._x_velocity * 1.e3;
    11591182    eph._xv(5) = eph._y_velocity * 1.e3;
    11601183    eph._xv(6) = eph._z_velocity * 1.e3;
    1161 
     1184    if (eph._xv.Rows(4,6).NormFrobenius() < 1.0) {
     1185      emit(newMessage(QString("%1: Block %2 (%3): zero velocity!")
     1186           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str()).toAscii(), true));
     1187      return false;
     1188    }
    11621189    GLOFreq[sv - 1] = 100 + eph._frequency_number ; /* store frequency for other users (MSM) */
    11631190    _gloFrq = QString("%1 %2").arg(eph._prn.toString().c_str()).arg(eph._frequency_number, 2, 'f', 0);
     
    12041231    GETFLOATSIGN(eph._Cus, 16, 1.0 / (double )(1 << 29))
    12051232    GETFLOAT(eph._sqrt_A, 32, 1.0 / (double )(1 << 19))
    1206     if (eph._sqrt_A < 1000.0) {return false;}
     1233    if (eph._sqrt_A < 1000.0) {
     1234      emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
     1235           .arg(_staID).arg(1044,4).arg(eph._prn.toString().c_str())
     1236           .arg(eph._sqrt_A,10,'F',3).toAscii(), true));
     1237      return false;
     1238    }
    12071239    GETBITS(i, 16)
    12081240    i <<= 4;
     
    13131345    GETFLOAT(eph._e,            32, 1.0 / (double )(1 << 30) / (double )(1 << 3))
    13141346    GETFLOAT(eph._sqrt_A,       32, 1.0 / (double )(1 << 19))
    1315     if (eph._sqrt_A < 1000.0) {return false;}
     1347    if (eph._sqrt_A < 1000.0) {
     1348      emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
     1349           .arg(_staID).arg(1041,4).arg(eph._prn.toString().c_str())
     1350           .arg(eph._sqrt_A,10,'F',3).toAscii(), true));
     1351      return false;
     1352    }
    13161353    GETFLOATSIGN(eph._OMEGA0,   32, R2R_PI/(double)(1<<30)/(double)(1<< 1))
    13171354    GETFLOATSIGN(eph._omega,    32, R2R_PI/(double)(1<<30)/(double)(1<< 1))
     
    13551392    GETFLOATSIGN(eph._y_pos, 30, 0.08)
    13561393    GETFLOATSIGN(eph._z_pos, 25, 0.4)
     1394    ColumnVector pos(3);
     1395    pos(1) = eph._x_pos; pos(2) = eph._y_pos; pos(3) = eph._z_pos;
     1396    if (pos.NormFrobenius() < 1.0) {
     1397      emit(newMessage(QString("%1: Block %2 (%3): zero position!")
     1398           .arg(_staID).arg(1043,4).arg(eph._prn.toString().c_str()).toAscii(), true));
     1399      return false;
     1400    }
    13571401    GETFLOATSIGN(eph._x_velocity, 17, 0.000625)
    13581402    GETFLOATSIGN(eph._y_velocity, 17, 0.000625)
     
    14111455    GETFLOATSIGN(eph._Cus, 16, 1.0 / (double )(1 << 29))
    14121456    GETFLOAT(eph._sqrt_A, 32, 1.0 / (double )(1 << 19))
    1413     if (eph._sqrt_A < 1000.0) {return false;}
    14141457    GETBITSFACTOR(eph._TOEsec, 14, 60)
    14151458    /* FIXME: overwrite value, copied from old code */
     
    14341477      GETBITS(eph._e1DataInValid, 1)
    14351478      if (eph._E5bHS != eph._E1_bHS) {
     1479        emit(newMessage(QString("%1: Block %2 (%3) SHS E5b %4 E1B %5: inconsistent health!")
     1480             .arg(_staID).arg(1046,4).arg(eph._prn.toString().c_str())
     1481             .arg(eph._E5bHS).arg(eph._E1_bHS).toAscii(), true));
    14361482        return false;
    14371483      }
    14381484      if ((eph._BGD_1_5A == 0.0 && fabs(eph._BGD_1_5B) > 1e-9) ||
    14391485          (eph._BGD_1_5B == 0.0 && fabs(eph._BGD_1_5A) > 1e-9)) {
     1486        emit(newMessage(QString("%1: Block %2 (%3) BGD_15a = %4 BGD_15b = %5: inconsistent BGD!")
     1487             .arg(_staID).arg(1046,4).arg(eph._prn.toString().c_str())
     1488             .arg(eph._BGD_1_5A,10,'E',3).arg(eph._BGD_1_5B,10,'E',3).toAscii(), true));
    14401489        return false;
    14411490      }
     
    14531502    }
    14541503    eph._TOT = 0.9999e9;
     1504
     1505    if (eph._sqrt_A < 1000.0) {
     1506      emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
     1507           .arg(_staID).arg(eph._inav? 1046 : 1045,4).arg(eph._prn.toString().c_str())
     1508           .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
     1509      return false;
     1510    }
    14551511
    14561512    emit newGalileoEph(eph);
     
    14991555    GETFLOATSIGN(eph._Cus, 18, 1.0 / (double )(1 << 30) / (double )(1 << 1))
    15001556    GETFLOAT(eph._sqrt_A, 32, 1.0 / (double )(1 << 19))
    1501         if (eph._sqrt_A < 1000.0) {return false;}
    1502         GETBITS(i, 17)
     1557    if (eph._sqrt_A < 1000.0) {
     1558      emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
     1559           .arg(_staID).arg(1042,4).arg(eph._prn.toString().c_str())
     1560           .arg(eph._sqrt_A,10,'F',3).toAscii(), true));
     1561      return false;
     1562    }
     1563          GETBITS(i, 17)
    15031564    i <<= 3;
    15041565    eph._TOEsec = i;
     
    16921753          case 1045:
    16931754          case 1046:
    1694             // reject 1045/1046 from JAXA RTKLIB encoded stations
    16951755            if (_staID.contains("AIRA") || _staID.contains("STK2") ||
    16961756                _staID.contains("CCJ2") || _staID.contains("SYOG")) {
     1757              emit(newMessage(QString("%1: Block temporary %2 from JAXA RTKLIB encoded stations!")
     1758                   .arg(_staID).arg(id).toAscii(), true));
    16971759              break;
    16981760            }
     
    17251787uint32_t RTCM3Decoder::CRC24(long size, const unsigned char *buf) {
    17261788  uint32_t crc = 0;
    1727   int i;
    1728 
    1729   while (size--) {
     1789  int ii;
     1790 while (size--) {
    17301791    crc ^= (*buf++) << (16);
    1731     for (i = 0; i < 8; i++) {
     1792    for (ii = 0; ii < 8; ii++) {
    17321793      crc <<= 1;
    17331794      if (crc & 0x1000000)
  • branches/BNC_2.12/src/bncephuser.cpp

    r9200 r9205  
    206206  }
    207207  double rr = xc.Rows(1,3).norm_Frobenius();
    208   double rv = vv.norm_Frobenius();
     208
    209209  const double MINDIST = 2.e7;
    210210  const double MAXDIST = 6.e7;
    211211  if (rr < MINDIST || rr > MAXDIST || std::isnan(rr)) {
    212     eph->setCheckState(t_eph::bad);
    213     return;
    214   }
    215   if (eph->type() == t_eph::GLONASS && rv < 1.0) {
    216212    eph->setCheckState(t_eph::bad);
    217213    return;
     
    224220    QDateTime now = currentDateAndTimeGPS();
    225221    bncTime currentTime(now.toString(Qt::ISODate).toStdString());
    226     double dt = fabs(currentTime - toc);
     222    double dt = currentTime - toc;
    227223
    228224    // update interval: 2h, data sets are valid for 4 hours
    229     if      (eph->type() == t_eph::GPS     && dt > 4*3600) {
     225    if      (eph->type() == t_eph::GPS     && (dt > 4*3600.0 || dt < -2*3600.0)) {
    230226      eph->setCheckState(t_eph::outdated);
    231227      return;
    232228    }
    233229    // update interval: 3h, data sets are valid for 4 hours
    234     else if (eph->type() == t_eph::Galileo && dt > 4*3600) {
     230    else if (eph->type() == t_eph::Galileo && (dt > 4*3600.0 || dt <       0.0)) {
    235231      eph->setCheckState(t_eph::outdated);
    236232      return;
    237233    }
    238234    // updated every 30 minutes
    239     else if (eph->type() == t_eph::GLONASS && dt > 2*3600) {
     235    else if (eph->type() == t_eph::GLONASS && (dt > 1*3600.0 || dt <   -1800.0)) {
    240236      eph->setCheckState(t_eph::outdated);
    241237      return;
    242238    }
    243239    // orbit parameters are valid for 7200 seconds (minimum)
    244     else if (eph->type() == t_eph::QZSS    && dt > 3*3600) {
     240    else if (eph->type() == t_eph::QZSS    && (dt > 2*3600.0 || dt < -1*3600.0)) {
    245241      eph->setCheckState(t_eph::outdated);
    246242      return;
    247243    }
    248244    // maximum update interval: 300 sec
    249     else if (eph->type() == t_eph::SBAS    && dt > 1*3600) {
     245    else if (eph->type() == t_eph::SBAS    && (dt >     600 || dt <       -300)) {
    250246      eph->setCheckState(t_eph::outdated);
    251247      return;
    252248    }
    253249    // updates 1h (GEO) up to 6 hours non-GEO
    254     else if (eph->type() == t_eph::BDS     && dt > 6*3600) {
     250    else if (eph->type() == t_eph::BDS     && (dt > 6*3600  || dt <        0.0)) {
    255251      eph->setCheckState(t_eph::outdated);
    256252      return;
    257253    }
    258254    // update interval: up to 24 hours
    259     else if (eph->type() == t_eph::IRNSS   && dt > 24*3600) {
     255    else if (eph->type() == t_eph::IRNSS   && fabs(dt > 24*3600)) {
    260256      eph->setCheckState(t_eph::outdated);
    261257      return;
     
    281277
    282278    // some lines to allow update of ephemeris data sets after outage
    283     if      (eph->type() == t_eph::GPS     && dt >  4*3600) {
    284       ephL->setCheckState(t_eph::outdated);
    285       return;
    286     }
    287     else if (eph->type() == t_eph::Galileo && dt >  4*3600) {
    288       ephL->setCheckState(t_eph::outdated);
    289       return;
    290     }
    291     else if (eph->type() == t_eph::GLONASS && dt >  2*3600) {
    292       ephL->setCheckState(t_eph::outdated);
    293       return;
    294     }
    295     else if (eph->type() == t_eph::QZSS    && dt >  3*3600) {
    296       ephL->setCheckState(t_eph::outdated);
    297       return;
    298     }
    299     else if  (eph->type() == t_eph::SBAS   && dt >    3600) {
    300       ephL->setCheckState(t_eph::outdated);
    301       return;
    302     }
     279    // update interval: 2h,
     280    if      (eph->type() == t_eph::GPS     && dt >  2*3600) {
     281      ephL->setCheckState(t_eph::outdated);
     282      return;
     283    }
     284    // update interval: 3h,
     285    else if (eph->type() == t_eph::Galileo && dt >  3*3600) {
     286      ephL->setCheckState(t_eph::outdated);
     287      return;
     288    }
     289    // updated every 30 minutes
     290    else if (eph->type() == t_eph::GLONASS && dt >    1800) {
     291      ephL->setCheckState(t_eph::outdated);
     292      return;
     293    }
     294    // updated every ?
     295    else if (eph->type() == t_eph::QZSS    && dt >  2*3600) {
     296      ephL->setCheckState(t_eph::outdated);
     297      return;
     298    }
     299    // maximum update interval: 300 sec
     300    else if  (eph->type() == t_eph::SBAS   && dt >     300) {
     301      ephL->setCheckState(t_eph::outdated);
     302      return;
     303    }
     304    // updates 1h (GEO) up to 6 hours non-GEO
    303305    else if  (eph->type() == t_eph::BDS    && dt >  6*3600) {
    304306      ephL->setCheckState(t_eph::outdated);
    305307      return;
    306308    }
     309    // update interval: up to 24 hours
    307310    else if  (eph->type() == t_eph::IRNSS  && dt > 24*3600) {
    308311      ephL->setCheckState(t_eph::outdated);
Note: See TracChangeset for help on using the changeset viewer.