Ignore:
Timestamp:
May 10, 2023, 11:19:40 AM (11 months ago)
Author:
stuerze
Message:

minor changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/combination/bnccomb.cpp

    r10035 r10038  
    114114}
    115115
     116
     117// Define the static Singleton pointer
     118////////////////////////////////////////////////////////////////////////////
     119bncComb* bncComb::_instPtr = NULL;
     120
    116121// Singleton
    117122////////////////////////////////////////////////////////////////////////////
    118123bncComb* bncComb::instance() {
    119   static bncComb _bncComb;
    120   return &_bncComb;
     124  if (_instPtr == NULL) {
     125    _instPtr = new bncComb();
     126  }
     127  return(_instPtr);
    121128}
    122129
     
    318325  delete _antex;
    319326  delete _bsx;
     327
    320328  QMapIterator<char, unsigned> itSys(_cmbSysPrn);
    321329  while (itSys.hasNext()) {
     
    325333      delete _params[sys][iPar-1];
    326334    }
    327     QListIterator<bncTime> itTime(_buffer[sys].keys());
    328     while (itTime.hasNext()) {
    329       bncTime epoTime = itTime.next();
    330       _buffer[sys].remove(epoTime);
    331     }
    332   }
    333 
     335    _buffer.remove(sys);
     336  }
     337  while (!_epoClkData.empty()) {
     338    delete _epoClkData.front();
     339    _epoClkData.pop_front();
     340  }
    334341}
    335342
     
    389396    // Store the correction
    390397    // --------------------
    391     QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
    392     storage[orbCorr._prn] = orbCorr;
     398    QMap<t_prn, t_orbCorr*>& storage = _orbCorrections[acName];
     399    if (storage[orbCorr._prn]) {
     400      delete  storage[orbCorr._prn];
     401    }
     402    storage[orbCorr._prn] = new t_orbCorr(orbCorr);
    393403  }
    394404}
     
    425435    // Store the correction
    426436    // --------------------
    427     QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName];
    428     storage[satCodeBias._prn] = satCodeBias;
     437    QMap<t_prn, t_satCodeBias*>& storage = _satCodeBiases[acName];
     438    if (storage[satCodeBias._prn]) {
     439      delete storage[satCodeBias._prn];
     440    }
     441    storage[satCodeBias._prn] = new t_satCodeBias(satCodeBias);
    429442  }
    430443}
     
    434447void bncComb::slotNewClkCorrections(QList<t_clkCorr> clkCorrections) {
    435448  QMutexLocker locker(&_mutex);
    436 
    437   bncTime lastTime;
    438 
     449  const double outWait = 1.0 * _cmbSampl;
     450
     451  // Loop over all observations (possible different epochs)
     452  // -----------------------------------------------------
    439453  for (int ii = 0; ii < clkCorrections.size(); ii++) {
    440     t_clkCorr& clkCorr = clkCorrections[ii];
    441     QString    staID(clkCorr._staID.c_str());
    442     QString    prn(clkCorr._prn.toInternalString().c_str());
    443     char       sys = clkCorr._prn.system();
    444 
     454    t_clkCorr* newClk = new t_clkCorr(clkCorrections[ii]);
     455
     456    char sys = newClk->_prn.system();
    445457    if (!_cmbSysPrn.contains(sys)){
     458      delete newClk;
     459      continue;
     460    }
     461
     462    // Check Modulo Time
     463    // -----------------
     464    int sec = int(nint(newClk->_time.gpssec()*10));
     465    if (sec % (_cmbSampl*10) != 0.0) {
     466      delete newClk;
     467      continue;
     468    }
     469
     470    // Find/Check the AC Name
     471    // ----------------------
     472    QString acName;
     473    QString staID(newClk->_staID.c_str());
     474    QListIterator<cmbAC*> icAC(_ACs);
     475    while (icAC.hasNext()) {
     476      cmbAC* AC = icAC.next();
     477      if (AC->mountPoint == staID) {
     478        acName = AC->name;
     479        break;
     480      }
     481    }
     482    if (acName.isEmpty()) {
     483      delete newClk;
    446484      continue;
    447485    }
     
    449487    // Set the last time
    450488    // -----------------
    451     if (lastTime.undef() || clkCorr._time > lastTime) {
    452       lastTime = clkCorr._time;
    453     }
     489    if (_lastClkCorrTime.undef() || newClk->_time > _lastClkCorrTime) {
     490      _lastClkCorrTime = newClk->_time;
     491    }
     492
     493    // Check Correction Age
     494    // --------------------
     495    //if (_lastEpoTimeOK.valid() && newClk->_time <= _lastEpoTimeOK) {
     496    if (_lastClkCorrTime.valid() && newClk->_time < _lastClkCorrTime) {
     497      emit newMessage("bncComb: old correction: " + acName.toLatin1() + " " + newClk->_prn.toString().c_str() +
     498                       //QString(" %1 ").arg(_lastEpoTimeOK.timestr().c_str()).toLatin1() + "vs. old" +
     499                       QString(" %1 ").arg(_lastClkCorrTime.timestr().c_str()).toLatin1() + "vs. old" +
     500                       QString(" %1 ").arg(newClk->_time.timestr().c_str()).toLatin1(), true);
     501      delete newClk;
     502      continue;
     503    }
     504
     505    // Find the corresponding data epoch or create a new one
     506    // -----------------------------------------------------
     507    epoClkData* epoch = 0;
     508    deque<epoClkData*>::const_iterator it;
     509    for (it = _epoClkData.begin(); it != _epoClkData.end(); it++) {
     510      if (newClk->_time == (*it)->_time) {
     511      epoch = *it;
     512        break;
     513      }
     514    }
     515    if (epoch == 0) {
     516      if (_epoClkData.empty() || newClk->_time > _epoClkData.back()->_time) {
     517        epoch = new epoClkData;
     518        epoch->_time = newClk->_time;
     519        _epoClkData.push_back(epoch);
     520      }
     521    }
     522
     523    // Put data into the epoch
     524    // -----------------------
     525    if (epoch != 0) {
     526      epoch->_clkCorr.push_back(newClk);
     527    }
     528    else {
     529      delete newClk;
     530    }
     531  }
     532
     533  // Make sure the buffer does not grow beyond any limit
     534  // ---------------------------------------------------
     535  const unsigned MAX_EPODATA_SIZE = 10;
     536  if (_epoClkData.size() > MAX_EPODATA_SIZE) {
     537    delete _epoClkData.front();
     538    _epoClkData.pop_front();
     539  }
     540
     541  // Process the oldest epochs
     542  // ------------------------
     543  while (_epoClkData.size()) {
     544
     545    if(!_lastClkCorrTime.valid()) {
     546      return;
     547    }
     548
     549    const vector<t_clkCorr*>& clkCorrVec = _epoClkData.front()->_clkCorr;
     550
     551    bncTime epoTime = _epoClkData.front()->_time;
     552
     553    // Process the front epoch
     554    // -----------------------
     555    if (epoTime < (_lastClkCorrTime - outWait)) {
     556      processEpoch(epoTime, clkCorrVec);
     557      delete _epoClkData.front();
     558      _epoClkData.pop_front();
     559    }
     560    else {
     561      return;
     562    }
     563  }
     564}
     565
     566// Change the correction so that it refers to last received ephemeris
     567////////////////////////////////////////////////////////////////////////////
     568void bncComb::switchToLastEph(t_eph* lastEph, cmbCorr* corr) {
     569
     570  if (corr->_eph == lastEph) {
     571    return;
     572  }
     573
     574  ColumnVector oldXC(6);
     575  ColumnVector oldVV(3);
     576  if (corr->_eph->getCrd(corr->_time, oldXC, oldVV, false) != success) {
     577    return;
     578  }
     579
     580  ColumnVector newXC(6);
     581  ColumnVector newVV(3);
     582  if (lastEph->getCrd(corr->_time, newXC, newVV, false) != success) {
     583    return;
     584  }
     585
     586  ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3);
     587  ColumnVector dV = newVV           - oldVV;
     588  double       dC = newXC(4)        - oldXC(4);
     589
     590  ColumnVector dRAO(3);
     591  XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO);
     592
     593  ColumnVector dDotRAO(3);
     594  XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
     595
     596  QString msg = "switch corr " + corr->_prn.mid(0,3)
     597    + QString(" %1 -> %2 %3").arg(corr->_iod,3).arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
     598
     599  emit newMessage(msg.toLatin1(), false);
     600
     601  corr->_iod = lastEph->IOD();
     602  corr->_eph = lastEph;
     603
     604  corr->_orbCorr->_xr    += dRAO;
     605  corr->_orbCorr->_dotXr += dDotRAO;
     606  corr->_clkCorr->_dClk  -= dC;
     607}
     608
     609// Process Epoch
     610////////////////////////////////////////////////////////////////////////////
     611void bncComb::processEpoch(bncTime epoTime, const vector<t_clkCorr*>& clkCorrVec) {
     612
     613  for (unsigned ii = 0; ii < clkCorrVec.size(); ii++) {
     614    const t_clkCorr* clkCorr = clkCorrVec.at(ii);
     615    QString    staID(clkCorr->_staID.c_str());
     616    QString    prn(clkCorr->_prn.toInternalString().c_str());
     617    char       sys = clkCorr->_prn.system();
    454618
    455619    // Find/Check the AC Name
     
    466630      }
    467631    }
    468     if (acName.isEmpty()) {
    469       continue;
    470     }
    471 
    472     // Check Modulo Time
    473     // -----------------
    474     int sec = int(nint(clkCorr._time.gpssec()*10));
    475     if (sec % (_cmbSampl*10) != 0.0) {
    476       continue;
    477     }
    478 
    479     // Check Correction Age
    480     // --------------------
    481     if (_resTime.valid() && clkCorr._time <= _resTime) {
    482       emit newMessage("bncComb: old correction: " + acName.toLatin1() + " " + prn.mid(0,3).toLatin1() +
    483                        QString("%1").arg(_resTime.timestr().c_str()).toLatin1() + " vs. old " +
    484                        QString("%1").arg(clkCorr._time.timestr().c_str()).toLatin1(), true);
    485       continue;
    486     }
    487632
    488633    // Create new correction
    489634    // ---------------------
    490     cmbCorr* newCorr  = new cmbCorr();
    491     newCorr->_prn     = prn;
    492     newCorr->_time    = clkCorr._time;
    493     newCorr->_iod     = clkCorr._iod;
    494     newCorr->_acName  = acName;
    495     newCorr->_clkCorr = clkCorr;
     635    cmbCorr* newCorr       = new cmbCorr();
     636    newCorr->_prn          = prn;
     637    newCorr->_time         = clkCorr->_time;
     638    newCorr->_iod          = clkCorr->_iod;
     639    newCorr->_acName       = acName;
    496640    newCorr->_weightFactor = weigthFactor;
     641    newCorr->_clkCorr = new t_clkCorr(*clkCorrVec[ii]);
    497642
    498643    // Check orbit correction
     
    503648    }
    504649    else {
    505       QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
    506       if (!storage.contains(clkCorr._prn)  ||
    507            storage[clkCorr._prn]._iod != newCorr->_iod) {
     650      QMap<t_prn, t_orbCorr*>& storage = _orbCorrections[acName];
     651      if (!storage.contains(clkCorr->_prn)  ||
     652           storage[clkCorr->_prn]->_iod != newCorr->_iod) {
    508653        delete newCorr;
    509654        continue;
    510655      }
    511656      else {
    512         newCorr->_orbCorr = storage[clkCorr._prn];
     657        newCorr->_orbCorr = storage[clkCorr->_prn];
    513658      }
    514659    }
     
    556701    // ----------------------------
    557702    if (_satCodeBiases.contains(acName)) {
    558       QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName];
    559       if (storage.contains(clkCorr._prn)) {
    560         newCorr->_satCodeBias = storage[clkCorr._prn];
     703      QMap<t_prn, t_satCodeBias*>& storage = _satCodeBiases[acName];
     704      if (storage.contains(clkCorr->_prn)) {
     705        newCorr->_satCodeBias = storage[clkCorr->_prn];
    561706        QMap<t_frequency::type, double> codeBiasesRefSig;
    562707        for (unsigned ii = 1; ii < cmbRefSig::cIF; ii++) {
    563           t_frequency::type frqType = cmbRefSig::toFreq(sys,  static_cast<cmbRefSig::type>(ii));
     708          t_frequency::type frqType = cmbRefSig::toFreq(sys, static_cast<cmbRefSig::type>(ii));
    564709          char frqNum = t_frequency::toString(frqType)[1];
    565           char attrib = cmbRefSig::toAttrib(sys,  static_cast<cmbRefSig::type>(ii));
     710          char attrib = cmbRefSig::toAttrib(sys, static_cast<cmbRefSig::type>(ii));
    566711          QString rnxType2ch = QString("%1%2").arg(frqNum).arg(attrib);
    567           for (unsigned ii = 0; ii < newCorr->_satCodeBias._bias.size(); ii++) {
    568             const t_frqCodeBias& bias = newCorr->_satCodeBias._bias[ii];
     712          for (unsigned ii = 0; ii < newCorr->_satCodeBias->_bias.size(); ii++) {
     713            const t_frqCodeBias& bias = newCorr->_satCodeBias->_bias[ii];
    569714            if (rnxType2ch.toStdString() == bias._rnxType2ch) {
    570715              codeBiasesRefSig[frqType] = bias._value;
     
    582727          }
    583728        }
    584         newCorr->_satCodeBias._bias.clear();
     729        newCorr->_satCodeBias->_bias.clear();
    585730      }
    586731    }
     
    588733    // Store correction into the buffer
    589734    // --------------------------------
    590     QVector<cmbCorr*>& corrs = _buffer[sys][newCorr->_time].corrs;
    591     corrs.push_back(newCorr);
    592   }
    593 
    594   // Process previous Epoch(s)
    595   // -------------------------
    596   const double outWait = 1.0 * _cmbSampl;
     735    QVector<cmbCorr*>& corrs = _buffer[sys].corrs;
     736
     737    QVectorIterator<cmbCorr*> itCorr(corrs);
     738    bool available = false;
     739    while (itCorr.hasNext()) {
     740      cmbCorr* corr = itCorr.next();
     741      QString  prn  = corr->_prn;
     742      QString  acName = corr->_acName;
     743      if (newCorr->_acName == acName && newCorr->_prn == prn) {
     744        available = true;
     745      }
     746    }
     747    if (!available) {
     748      corrs.push_back(newCorr);
     749    }
     750    else {
     751      delete newCorr;
     752      continue;
     753    }
     754  }
     755
     756  // Process Systems of this Epoch
     757  // ------------------------------
    597758  QMapIterator<char, unsigned> itSys(_cmbSysPrn);
    598759  while (itSys.hasNext()) {
    599760    itSys.next();
    600761    char sys = itSys.key();
    601     QListIterator<bncTime> itTime(_buffer[sys].keys());
    602     while (itTime.hasNext()) {
    603       bncTime epoTime = itTime.next();
    604       if (epoTime < lastTime - outWait) {
    605         _resTime = epoTime;
    606         processEpoch(sys);
    607       }
    608     }
    609   }
    610 }
    611 
    612 // Change the correction so that it refers to last received ephemeris
    613 ////////////////////////////////////////////////////////////////////////////
    614 void bncComb::switchToLastEph(t_eph* lastEph, cmbCorr* corr) {
    615 
    616   if (corr->_eph == lastEph) {
    617     return;
    618   }
    619 
    620   ColumnVector oldXC(6);
    621   ColumnVector oldVV(3);
    622   if (corr->_eph->getCrd(corr->_time, oldXC, oldVV, false) != success) {
    623     return;
    624   }
    625 
    626   ColumnVector newXC(6);
    627   ColumnVector newVV(3);
    628   if (lastEph->getCrd(corr->_time, newXC, newVV, false) != success) {
    629     return;
    630   }
    631 
    632   ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3);
    633   ColumnVector dV = newVV           - oldVV;
    634   double       dC = newXC(4)        - oldXC(4);
    635 
    636   ColumnVector dRAO(3);
    637   XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO);
    638 
    639   ColumnVector dDotRAO(3);
    640   XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
    641 
    642   QString msg = "switch corr " + corr->_prn.mid(0,3)
    643     + QString(" %1 -> %2 %3").arg(corr->_iod,3).arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
    644 
    645   emit newMessage(msg.toLatin1(), false);
    646 
    647   corr->_iod = lastEph->IOD();
    648   corr->_eph = lastEph;
    649 
    650   corr->_orbCorr._xr    += dRAO;
    651   corr->_orbCorr._dotXr += dDotRAO;
    652   corr->_clkCorr._dClk  -= dC;
    653 }
    654 
    655 // Process Epoch
    656 ////////////////////////////////////////////////////////////////////////////
    657 void bncComb::processEpoch(char sys) {
    658 
    659   _log.clear();
    660 
    661   QTextStream out(&_log, QIODevice::WriteOnly);
     762    _log.clear();
     763    QTextStream out(&_log, QIODevice::WriteOnly);
     764    processSystem(epoTime, sys, out);
     765    emit newMessage(_log, false);
     766  }
     767}
     768
     769void bncComb::processSystem(bncTime epoTime, char sys, QTextStream& out) {
    662770
    663771  out << "\n" <<           "Combination: " << sys << "\n"
     
    694802    if (_masterMissingEpochs[sys] < switchMasterAfterGap) {
    695803      out << "Missing Master, Epoch skipped" << "\n";
    696       _buffer[sys].remove(_resTime);
     804      _buffer.remove(sys);
    697805      emit newMessage(_log, false);
    698806      return;
     
    707815              << _masterOrbitAC[sys].toLatin1().data() << " --> "
    708816              << AC->name.toLatin1().data()   << " "
    709               << _resTime.datestr().c_str()    << " "
    710               << _resTime.timestr().c_str()    << "\n";
     817              << epoTime.datestr().c_str()    << " "
     818              << epoTime.timestr().c_str()    << "\n";
    711819          _masterOrbitAC[sys] = AC->name;
    712820          break;
     
    723831  ColumnVector dx;
    724832  if (_method == filter) {
    725     irc = processEpoch_filter(sys, out, resCorr, dx);
     833    irc = processEpoch_filter(epoTime, sys, out, resCorr, dx);
    726834  }
    727835  else {
    728     irc = processEpoch_singleEpoch(sys, out, resCorr, dx);
     836    irc = processEpoch_singleEpoch(epoTime, sys, out, resCorr, dx);
    729837  }
    730838
     
    746854            t_frequency::type fType1 = cmbRefSig::toFreq(sys, cmbRefSig::c1);
    747855            t_frequency::type fType2 = cmbRefSig::toFreq(sys, cmbRefSig::c2);
     856            if (resCorr[pp->prn]->_satCodeBias == 0) {
     857              resCorr[pp->prn]->_satCodeBias = new t_satCodeBias();
     858            }
    748859            _bsx->determineSsrSatCodeBiases(pp->prn.mid(0,3), codeCoeff[fType1], codeCoeff[fType2], resCorr[pp->prn]->_satCodeBias);
    749860          }
    750861        }
    751862      }
    752       out << _resTime.datestr().c_str() << " "
    753           << _resTime.timestr().c_str() << " ";
     863      out << epoTime.datestr().c_str() << " "
     864          << epoTime.timestr().c_str() << " ";
    754865      out.setRealNumberNotation(QTextStream::FixedNotation);
    755866      out.setFieldWidth(8);
     
    759870      out.setFieldWidth(0);
    760871    }
    761     printResults(out, resCorr);
    762     dumpResults(resCorr);
    763   }
    764 
    765   // Delete Data, emit Message
    766   // -------------------------
    767   _buffer[sys].remove(_resTime);
    768   emit newMessage(_log, false);
     872    printResults(epoTime, out, resCorr);
     873    dumpResults(epoTime, resCorr);
     874  }
     875  // Delete Data
     876  // -----------
     877  _buffer.remove(sys);
    769878}
    770879
    771880// Process Epoch - Filter Method
    772881////////////////////////////////////////////////////////////////////////////
    773 t_irc bncComb::processEpoch_filter(char sys, QTextStream& out,
     882t_irc bncComb::processEpoch_filter(bncTime epoTime, char sys, QTextStream& out,
    774883                                   QMap<QString, cmbCorr*>& resCorr,
    775884                                   ColumnVector& dx) {
     
    795904  // Check Satellite Positions for Outliers
    796905  // --------------------------------------
    797   if (checkOrbits(sys, out) != success) {
     906  if (checkOrbits(epoTime, sys, out) != success) {
    798907    return failure;
    799908  }
     
    821930    out.setRealNumberNotation(QTextStream::FixedNotation);
    822931    out.setRealNumberPrecision(3);
    823     out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
     932    out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str()
    824933        << " Maximum Residuum " << maxRes << ' '
    825934        << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3);
     
    846955      for (int ii = 0; ii < corrs(sys).size(); ii++) {
    847956      const cmbCorr* corr = corrs(sys)[ii];
    848         out << _resTime.datestr().c_str() << ' '
    849             << _resTime.timestr().c_str() << " "
     957        out << epoTime.datestr().c_str() << ' '
     958            << epoTime.timestr().c_str() << " "
    850959            << corr->_acName << ' ' << corr->_prn.mid(0,3);
    851960        out.setFieldWidth(10);
     
    862971// Print results
    863972////////////////////////////////////////////////////////////////////////////
    864 void bncComb::printResults(QTextStream& out,
     973void bncComb::printResults(bncTime epoTime, QTextStream& out,
    865974                           const QMap<QString, cmbCorr*>& resCorr) {
    866975
     
    873982      ColumnVector xc(6);
    874983      ColumnVector vv(3);
    875       if (eph->getCrd(_resTime, xc, vv, false) != success) {
     984      if (eph->getCrd(epoTime, xc, vv, false) != success) {
    876985        continue;
    877986      }
    878       out << _resTime.datestr().c_str() << " "
    879           << _resTime.timestr().c_str() << " ";
     987      out << epoTime.datestr().c_str() << " "
     988          << epoTime.timestr().c_str() << " ";
    880989      out.setFieldWidth(3);
    881990      out << "Full Clock " << corr->_prn.mid(0,3) << " " << corr->_iod << " ";
     
    8931002// Send results to RTNet Decoder and directly to PPP Client
    8941003////////////////////////////////////////////////////////////////////////////
    895 void bncComb::dumpResults(const QMap<QString, cmbCorr*>& resCorr) {
     1004void bncComb::dumpResults(bncTime epoTime, const QMap<QString, cmbCorr*>& resCorr) {
    8961005
    8971006  QList<t_orbCorr> orbCorrections;
     
    9011010  unsigned year, month, day, hour, minute;
    9021011  double   sec;
    903   _resTime.civil_date(year, month, day);
    904   _resTime.civil_time(hour, minute, sec);
     1012  epoTime.civil_date(year, month, day);
     1013  epoTime.civil_time(hour, minute, sec);
    9051014
    9061015  QString outLines = QString().asprintf("*  %4d %2d %2d %d %d %12.8f\n",
     
    9111020    it.next();
    9121021    cmbCorr* corr = it.value();
     1022
    9131023    // ORBIT
    914     t_orbCorr orbCorr(corr->_orbCorr);
     1024    t_orbCorr orbCorr(static_cast<t_orbCorr>(*corr->_orbCorr));
    9151025    orbCorr._staID = "INTERNAL";
    9161026    orbCorrections.push_back(orbCorr);
     1027
    9171028    // CLOCK
    918     t_clkCorr clkCorr(corr->_clkCorr);
     1029    t_clkCorr clkCorr(static_cast<t_clkCorr>(*corr->_clkCorr));
    9191030    clkCorr._staID      = "INTERNAL";
    9201031    clkCorr._dClk       = corr->_dClkResult;
     
    9221033    clkCorr._dotDotDClk = 0.0;
    9231034    clkCorrections.push_back(clkCorr);
     1035
    9241036    // CODE BIASES
    925     t_satCodeBias satCodeBias(corr->_satCodeBias);
     1037    t_satCodeBias satCodeBias(static_cast<t_satCodeBias>(*corr->_satCodeBias));
    9261038    satCodeBias._staID = "INTERNAL";
    9271039    satCodeBiasList.push_back(satCodeBias);
     
    9311043    corr->_eph->setClkCorr(dynamic_cast<const t_clkCorr*>(&clkCorr));
    9321044    corr->_eph->setOrbCorr(dynamic_cast<const t_orbCorr*>(&orbCorr));
    933     if (corr->_eph->getCrd(_resTime, xc, vv, true) != success) {
     1045    if (corr->_eph->getCrd(epoTime, xc, vv, true) != success) {
    9341046      delete corr;
    9351047      continue;
     
    9401052    ColumnVector dx(3); dx = 0.0;
    9411053    if (_antex) {
    942       double Mjd = _resTime.mjd() + _resTime.daysec()/86400.0;
     1054      double Mjd = epoTime.mjd() + epoTime.daysec()/86400.0;
    9431055      if (_antex->satCoMcorrection(corr->_prn, Mjd, xc.Rows(1,3), dx) != success) {
    9441056        dx = 0;
     
    10341146    }
    10351147
    1036     ll(iObs) = (corr->_clkCorr._dClk * t_CST::c - corr->_satCodeBiasIF) - DotProduct(AA.Row(iObs), x0);
     1148    ll(iObs) = (corr->_clkCorr->_dClk * t_CST::c - corr->_satCodeBiasIF) - DotProduct(AA.Row(iObs), x0);
    10371149
    10381150    PP(iObs, iObs) *= 1.0 / (corr->_weightFactor * corr->_weightFactor);
     
    10811193// Process Epoch - Single-Epoch Method
    10821194////////////////////////////////////////////////////////////////////////////
    1083 t_irc bncComb::processEpoch_singleEpoch(char sys, QTextStream& out,
     1195t_irc bncComb::processEpoch_singleEpoch(bncTime epoTime, char sys, QTextStream& out,
    10841196                                        QMap<QString, cmbCorr*>& resCorr,
    10851197                                        ColumnVector& dx) {
     
    10871199  // Check Satellite Positions for Outliers
    10881200  // --------------------------------------
    1089   if (checkOrbits(sys, out) != success) {
     1201  if (checkOrbits(epoTime, sys, out) != success) {
    10901202    return failure;
    10911203  }
     
    12031315    out.setRealNumberNotation(QTextStream::FixedNotation);
    12041316    out.setRealNumberPrecision(3);
    1205     out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
     1317    out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str()
    12061318        << " Maximum Residuum " << maxRes << ' '
    12071319        << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3);
     
    12181330      for (int ii = 0; ii < vv.Nrows(); ii++) {
    12191331        const cmbCorr* corr = corrs(sys)[ii];
    1220         out << _resTime.datestr().c_str() << ' '
    1221             << _resTime.timestr().c_str() << " "
     1332        out << epoTime.datestr().c_str() << ' '
     1333            << epoTime.timestr().c_str() << " "
    12221334            << corr->_acName << ' ' << corr->_prn.mid(0,3);
    12231335        out.setFieldWidth(6);
     
    12351347// Check Satellite Positions for Outliers
    12361348////////////////////////////////////////////////////////////////////////////
    1237 t_irc bncComb::checkOrbits(char sys, QTextStream& out) {
     1349t_irc bncComb::checkOrbits(bncTime epoTime, char sys, QTextStream& out) {
    12381350
    12391351  const double MAX_DISPLACEMENT = 0.20;
     
    12831395      if (meanRao.find(prn) == meanRao.end()) {
    12841396        meanRao[prn].ReSize(4);
    1285         meanRao[prn].Rows(1,3) = corr->_orbCorr._xr;
     1397        meanRao[prn].Rows(1,3) = corr->_orbCorr->_xr;
    12861398        meanRao[prn](4)        = 1;
    12871399      }
    12881400      else {
    1289         meanRao[prn].Rows(1,3) += corr->_orbCorr._xr;
     1401        meanRao[prn].Rows(1,3) += corr->_orbCorr->_xr;
    12901402        meanRao[prn](4)        += 1;
    12911403      }
     
    13091421        meanRao[prn](4) = 0;
    13101422      }
    1311       corr->_diffRao = corr->_orbCorr._xr - meanRao[prn].Rows(1,3);
     1423      corr->_diffRao = corr->_orbCorr->_xr - meanRao[prn].Rows(1,3);
    13121424      if (maxDiff.find(prn) == maxDiff.end()) {
    13131425        maxDiff[prn] = corr;
     
    13401452        double norm = corr->_diffRao.NormFrobenius();
    13411453        if (norm > MAX_DISPLACEMENT) {
    1342           out << _resTime.datestr().c_str()    << " "
    1343               << _resTime.timestr().c_str()    << " "
     1454          out << epoTime.datestr().c_str()    << " "
     1455              << epoTime.timestr().c_str()    << " "
    13441456              << "Orbit Outlier: "
    13451457              << corr->_acName.toLatin1().data() << " "
     
    13741486  QListIterator<cmbAC*> icAC(_ACs);
    13751487  while (icAC.hasNext()) {
    1376     cmbAC* AC = icAC.next();
     1488    cmbAC *AC = icAC.next();
    13771489    if (AC->mountPoint == mountPoint) {
    13781490      acName = AC->name;
    1379       out << "Provider ID changed: AC " << AC->name.toLatin1().data()   << " "
    1380           << _resTime.datestr().c_str()    << " "
    1381           << _resTime.timestr().c_str()    << "\n";
     1491      out << "Provider ID changed: AC " << AC->name.toLatin1().data() << " "
     1492//          << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
     1493          << "\n";
    13821494      break;
    13831495    }
     
    13921504    // Remove all corrections of the corresponding AC
    13931505    // ----------------------------------------------
    1394     QListIterator<bncTime> itTime(_buffer[sys].keys());
    1395     while (itTime.hasNext()) {
    1396       bncTime epoTime = itTime.next();
    1397       QVector<cmbCorr*>& corrVec = _buffer[sys][epoTime].corrs;
    1398       QMutableVectorIterator<cmbCorr*> it(corrVec);
    1399       while (it.hasNext()) {
    1400         cmbCorr* corr = it.next();
    1401         if (acName == corr->_acName) {
    1402           delete corr;
    1403           it.remove();
    1404         }
    1405       }
    1406     }
    1407 
     1506    QVector<cmbCorr*> &corrVec = _buffer[sys].corrs;
     1507    QMutableVectorIterator<cmbCorr*> it(corrVec);
     1508    while (it.hasNext()) {
     1509      cmbCorr *corr = it.next();
     1510      if (acName == corr->_acName) {
     1511        delete corr;
     1512        it.remove();
     1513      }
     1514    }
    14081515    // Reset Satellite Offsets
    14091516    // -----------------------
    14101517    if (_method == filter) {
    14111518      for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
    1412         cmbParam* pp = _params[sys][iPar-1];
     1519        cmbParam *pp = _params[sys][iPar - 1];
    14131520        if (pp->AC == acName && pp->type == cmbParam::offACSat) {
    14141521          pp->xx = 0.0;
    1415           _QQ[sys].Row(iPar)    = 0.0;
     1522          _QQ[sys].Row(iPar) = 0.0;
    14161523          _QQ[sys].Column(iPar) = 0.0;
    1417           _QQ[sys](iPar,iPar) = pp->sig0 * pp->sig0;
     1524          _QQ[sys](iPar, iPar) = pp->sig0 * pp->sig0;
    14181525        }
    14191526      }
Note: See TracChangeset for help on using the changeset viewer.