Changeset 3029 in ntrip for trunk/BNC/combination


Ignore:
Timestamp:
Feb 24, 2011, 2:46:03 PM (14 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/combination
Files:
2 edited

Legend:

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

    r3028 r3029  
    190190  }
    191191
     192  newCorr->AC = AC->name;
     193   
    192194  // Reject delayed corrections
    193195  // --------------------------
     
    197199  }
    198200
    199   // Check the IOD
    200   //--------------
     201  // Check the Ephemeris
     202  //--------------------
    201203  if (_eph.find(newCorr->prn) == _eph.end()) {
    202204    delete newCorr;
     
    206208    t_eph* lastEph = _eph[newCorr->prn]->last;
    207209    t_eph* prevEph = _eph[newCorr->prn]->prev;
    208     if (prevEph && prevEph->IOD() == newCorr->iod) {
    209       switchToLastEph(AC->name, lastEph, prevEph, newCorr);
    210     }
    211     else if (!lastEph || lastEph->IOD() != newCorr->iod) {
     210    if      (lastEph && lastEph->IOD() == newCorr->iod) {
     211      newCorr->eph = lastEph;
     212    }
     213    else if (prevEph && prevEph->IOD() == newCorr->iod) {
     214      newCorr->eph = prevEph;
     215    }
     216    else {
    212217      delete newCorr;
    213218      return;
    214219    }
    215     newCorr->eph = lastEph;
    216   }
     220  }
     221   
    217222
    218223  // Process all older Epochs (if there are any)
     
    357362// Change the correction so that it refers to last received ephemeris
    358363////////////////////////////////////////////////////////////////////////////
    359 void bncComb::switchToLastEph(const QString& ACname, const t_eph* lastEph,
    360                               const t_eph* prevEph, t_corr* newCorr) {
     364void bncComb::switchToLastEph(const t_eph* lastEph, t_corr* corr) {
    361365
    362366  ColumnVector oldXC(4);
    363367  ColumnVector oldVV(3);
    364   prevEph->position(newCorr->tt.gpsw(), newCorr->tt.gpssec(),
    365                     oldXC.data(), oldVV.data());
     368  corr->eph->position(corr->tt.gpsw(), corr->tt.gpssec(),
     369                      oldXC.data(), oldVV.data());
    366370
    367371  ColumnVector newXC(4);
    368372  ColumnVector newVV(3);
    369   lastEph->position(newCorr->tt.gpsw(), newCorr->tt.gpssec(),
     373  lastEph->position(corr->tt.gpsw(), corr->tt.gpssec(),
    370374                    newXC.data(), newVV.data());
    371375
     
    380384  XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
    381385
    382   newCorr->iod = lastEph->IOD();
    383   newCorr->rao    -= dRAO;
    384   newCorr->dotRao -= dDotRAO;
    385   newCorr->dClk   -= dC;
    386 
    387   QString msg = "switch " + newCorr->prn
    388     + QString(" %1 -> %2 %3").arg(prevEph->IOD(),3)
     386  QString msg = "switch " + corr->prn
     387    + QString(" %1 -> %2 %3").arg(corr->iod,3)
    389388    .arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
    390389
    391   // Check/change the static offset parameters
    392   // -----------------------------------------
    393   for (int iPar = 1; iPar <= _params.size(); iPar++) {
    394     cmbParam* pp = _params[iPar-1];
    395     if (pp->type == cmbParam::Sat_offset &&
    396         pp->prn  == newCorr->prn         &&
    397         pp->AC   == ACname) {
    398       if (pp->iod != lastEph->IOD()) {
    399         pp->iod = lastEph->IOD();
    400         msg += " need corr ";
    401       }
    402     }
    403   }
    404 
    405390  emit newMessage(msg.toAscii(), false);
     391
     392  corr->iod     = lastEph->IOD();
     393  corr->eph     = lastEph;
     394  corr->rao    -= dRAO;
     395  corr->dotRao -= dDotRAO;
     396  corr->dClk   -= dC;
     397
     398//  for (int iPar = 1; iPar <= _params.size(); iPar++) {
     399//    cmbParam* pp = _params[iPar-1];
     400//    if (pp->type == cmbParam::Sat_offset           &&
     401//        pp->prn == corr->prn && pp->AC == corr->AC) {
     402//      if (pp->iod != corr->iod) {
     403//        pp->xx  += dC * t_CST::c;
     404//        pp->iod = corr->iod;
     405//      }
     406//    }
     407//  }
    406408}
    407409
     
    452454  while (itEpo.hasNext()) {
    453455    cmbEpoch* epo = itEpo.next();
    454     QMapIterator<QString, t_corr*> itCorr(epo->corr);
     456    QMutableMapIterator<QString, t_corr*> itCorr(epo->corr);
    455457    while (itCorr.hasNext()) {
    456458      itCorr.next();
    457       ++nObs;
     459      t_corr* corr = itCorr.value();
     460
     461      // Switch to new ephemeris
     462      // -----------------------
     463      t_eph* lastEph = _eph[corr->prn]->last;
     464      if (lastEph == corr->eph) {     
     465        ++nObs;
     466      }
     467      else {
     468        if (corr->eph == _eph[corr->prn]->prev) {
     469          switchToLastEph(lastEph, corr);
     470          ++nObs;
     471        }
     472        else {
     473          itCorr.remove();
     474        }
     475      }
    458476    }
    459477  }
     
    528546    it.next();
    529547    t_corr* corr = it.value();
    530     t_eph* eph = corr->eph;
     548    const t_eph* eph = corr->eph;
    531549    if (eph) {
    532550      double xx, yy, zz, cc;
  • trunk/BNC/combination/bnccomb.h

    r3028 r3029  
    7272  void printResults(QTextStream& out, const bncTime& resTime,
    7373                    const QMap<QString, t_corr*>& resCorr);
    74   void switchToLastEph(const QString& ACname, const t_eph* lastEph,
    75                        const t_eph* prevEph, t_corr* newCorr);
     74  void switchToLastEph(const t_eph* lastEph, t_corr* corr);
    7675
    7776  QMap<QString, cmbAC*> _ACs;   // Analytical Centers (key is mountpoint)
Note: See TracChangeset for help on using the changeset viewer.