Ignore:
Timestamp:
Dec 17, 2020, 4:11:09 PM (4 years ago)
Author:
stuerze
Message:

some lines are added to consider corrected GPS BRDC data sets which come 16 seconds before nominal TOC

File:
1 edited

Legend:

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

    r9300 r9322  
    158158  }
    159159
    160   if (ephOld == 0 || newEph->isNewerThan(ephOld)) {
     160  if ( (ephOld == 0) ||
     161       newEph->isNewerThan(ephOld) ||
     162       newCorrectedGpsEphSet(newEph)  ) {
    161163    checkEphemeris(newEph, realTime);
    162164    eph->setCheckState(newEph->checkState());
     
    170172      newEph->checkState() != t_eph::outdated) {
    171173    deque<t_eph*>& qq = _eph[prn];
    172     if (qq.empty() ||
    173         newEph->isNewerThan(qq.back())){
    174       qq.push_back(newEph);
    175       if (qq.size() > _maxQueueSize) {
    176         delete qq.front();
    177         qq.pop_front();
    178       }
    179       ephBufferChanged();
    180       return success;
    181     }
    182     else {
    183       delete newEph;
    184       return failure;
    185     }
    186 
     174    qq.push_back(newEph);
     175    if (qq.size() > _maxQueueSize) {
     176      delete qq.front();
     177      qq.pop_front();
     178    }
     179    ephBufferChanged();
     180    return success;
    187181  }
    188182  else {
     
    280274    ColumnVector vvL(3);
    281275    ephL->getCrd(eph->TOC(), xcL, vvL, false);
    282     double dt = eph->TOC() - ephL->TOC();
    283     if (dt < 0.0) {
    284       dt += 604800.0;
    285     }
     276
    286277    double diff  = (xc.Rows(1,3) - xcL.Rows(1,3)).norm_Frobenius();
    287278    double diffC = fabs(xc(4) - xcL(4)) * t_CST::c;
    288279
    289280    if (diff < MAXDIFF && diffC < MAXDIFF) {
    290       if (diff < MINDIFF && diffC < MINDIFF && ephL->checkState() == t_eph::ok) {
     281      if (diff < MINDIFF && diffC < MINDIFF &&
     282          ephL->checkState() == t_eph::ok) {
    291283        // to prevent the same data sets with different TOC values
    292284        eph->setCheckState(t_eph::bad);
     
    302294      }
    303295    }
     296
     297    double dt = eph->TOC() - ephL->TOC();
    304298    // some lines to allow update of ephemeris data sets after an outage
     299    // -----------------------------------------------------------------
    305300    // update interval: 2h,
     301    // sometimes corrected BRDC sets are sent with TOC values 16 seconds
     302    // before the nominal TOC (integer time)
    306303    if      (eph->type() == t_eph::GPS     && dt > (2*3600.0 + 60.0)) {
    307304      ephL->setCheckState(t_eph::outdated);
     
    314311    }
    315312    // updated every 30 minutes
    316     else if (eph->type() == t_eph::GLONASS && dt > (1800.0 + 60.0)) {
     313    else if (eph->type() == t_eph::GLONASS && dt > (  1800.0 + 60.0)) {
    317314      ephL->setCheckState(t_eph::outdated);
    318315      return;
     
    340337  }
    341338}
     339
     340//
     341////////////////////////////////////////////////////////////////////////////
     342bool bncEphUser::newCorrectedGpsEphSet(const t_eph* eph) {
     343
     344  bool correctedGpsEphSet = false;
     345  bool newCorrectedGpsEphSet = false;
     346
     347  if (eph->prn().system() != 'G') {
     348    return newCorrectedGpsEphSet;
     349  }
     350
     351  if ((fmod(eph->TOC().daysec()+16.0, 7200) == 0.0)) {
     352    // sometimes corrected BRDC sets are sent with TOC values 16 seconds
     353    // before the nominal TOC (integer time)
     354    correctedGpsEphSet = true;
     355  }
     356
     357  QString      prn     = QString(eph->prn().toInternalString().c_str());
     358  t_eph*       ephL    = ephLast(prn);
     359  if (!ephL) { // first set for GPS Sat
     360    return correctedGpsEphSet;
     361  }
     362
     363
     364  double dt = eph->TOC() - ephL->TOC();
     365  if (correctedGpsEphSet){
     366    if (dt == 0.0) {
     367      newCorrectedGpsEphSet = false;
     368    }
     369    else {
     370      newCorrectedGpsEphSet = true;
     371    }
     372  }
     373  return  newCorrectedGpsEphSet;
     374}
Note: See TracChangeset for help on using the changeset viewer.