Changeset 5916 in ntrip for trunk/BNC/src/PPP/pppFilter.cpp


Ignore:
Timestamp:
Aug 12, 2014, 5:08:34 PM (10 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/PPP/pppFilter.cpp

    r5877 r5916  
    8484    return failure;
    8585  }
    86   vector<t_pppSatObs*>& obsVector = epoch->obsVector();
     86  vector<t_pppSatObs*>& allObs = epoch->obsVector();
    8787
    8888  // Time of the Epoch
    8989  // -----------------
    9090  _epoTime = epoch->epoTime();
    91 
    92   // Auxiliary vectors of processed linear combinations
    93   // --------------------------------------------------
    94   vector<t_lc::type> LCsCode;
    95   vector<t_lc::type> LCsPhase;
    96   vector<t_lc::type> LCsAll = OPT->LCs();
    97   for (unsigned ii = 0; ii < LCsAll.size(); ii++) {
    98     const t_lc::type& tLC = LCsAll[ii];
    99     if (t_lc::includesCode(tLC) && !t_lc::includesPhase(tLC)) {
    100       LCsCode.push_back(tLC);
    101     }
    102     else {
    103       LCsPhase.push_back(tLC);
    104     }
    105   }
    106   vector<t_lc::type> ambLCs;
    107   if      (LCsPhase.size() == 1) {
    108     ambLCs.push_back(LCsPhase[0]);
    109   }
    110   else if (LCsPhase.size() > 1) {
    111     ambLCs.push_back(t_lc::l1);
    112     ambLCs.push_back(t_lc::l2);
    113   }
    11491 
    11592  // Set Parameters
    11693  // --------------
    117   _parlist->set(_epoTime, ambLCs, obsVector);
     94  _parlist->set(_epoTime, allObs);
    11895  const vector<t_pppParam*>& params = _parlist->params();
    11996
     
    149126  }
    150127
    151   // Process LCs containing code separately
    152   // --------------------------------------
    153   for (unsigned ipc = 0; ipc <= 1; ipc++) {
    154     const vector<t_lc::type>& LCsHlp = (ipc == 0 ? LCsCode : LCsPhase);
    155     if (LCsHlp.size() > 0) {
    156       if ( processLC(LCsHlp, obsVector) != success ) {
    157         return failure;
    158       }
    159     }
    160   }
     128  // Process Satellite Systems separately
     129  // ------------------------------------
     130  for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) {
     131    char system = OPT->systems()[iSys];
     132    vector<t_pppSatObs*> obsVector;
     133    for (unsigned jj = 0; jj < allObs.size(); jj++) {
     134      if (allObs[jj]->prn().system() == system) {
     135        obsVector.push_back(allObs[jj]);
     136      }
     137    }
     138    if ( processSystem(OPT->LCs(system), obsVector) != success ) {
     139      return failure;
     140    }
     141  }
     142   
     143  cmpDOP(allObs);
    161144
    162145  _parlist->printResult(_epoTime, _QFlt, _xFlt);
     
    167150// Process Selected LCs
    168151////////////////////////////////////////////////////////////////////////////
    169 t_irc t_pppFilter::processLC(const vector<t_lc::type>& LCs,
    170                                vector<t_pppSatObs*>& obsVector) {
     152t_irc t_pppFilter::processSystem(const vector<t_lc::type>& LCs,
     153                                 const vector<t_pppSatObs*>& obsVector) {
    171154
    172155  LOG.setf(ios::fixed);
     
    257240    double     maxOutlier      = 0.0;
    258241    int        maxOutlierIndex = -1;
    259     t_lc::type maxOutlierLC = t_lc::dummy;
    260     for (unsigned sysGPS = 0; sysGPS <= 1; sysGPS++) { // first GLONASS then GPS
    261       for (unsigned ii = 0; ii < usedObs.size(); ii++) {
    262         if (usedObs[ii]->prn().system() != 'G' || sysGPS == 1) {
    263           const t_lc::type tLC = usedTypes[ii];
    264           double res = fabs(vv[ii]);
    265           if (res > OPT->maxRes(tLC)) {
    266             if (res > fabs(maxOutlier)) {
    267               maxOutlier      = vv[ii];
    268               maxOutlierIndex = ii;
    269               maxOutlierLC    = tLC;
    270             }
    271           }
    272         }
    273       }
    274       if (maxOutlierIndex != -1) {
    275         break;
     242    t_lc::type maxOutlierLC    = t_lc::dummy;
     243    for (unsigned ii = 0; ii < usedObs.size(); ii++) {
     244      const t_lc::type tLC = usedTypes[ii];
     245      double res = fabs(vv[ii]);
     246      if (res > usedObs[ii]->maxRes(tLC)) {
     247        if (res > fabs(maxOutlier)) {
     248          maxOutlier      = vv[ii];
     249          maxOutlierIndex = ii;
     250          maxOutlierLC    = tLC;
     251        }
    276252      }
    277253    }
     
    322298        }
    323299      }
    324       cmpDOP(LCs, AA);
    325300      break;
    326301    }
     
    333308////////////////////////////////////////////////////////////////////////////
    334309t_irc t_pppFilter::detectCycleSlips(const vector<t_lc::type>& LCs,
    335                                       const vector<t_pppSatObs*>& obsVector) {
     310                                    const vector<t_pppSatObs*>& obsVector) {
    336311
    337312  const double            SLIP       = 20.0;  // slip threshold
     
    402377////////////////////////////////////////////////////////////////////////////
    403378t_irc t_pppFilter::resetAmb(t_prn prn, const vector<t_pppSatObs*>& obsVector,
    404                          SymmetricMatrix* QSav, ColumnVector* xSav) {
     379                            SymmetricMatrix* QSav, ColumnVector* xSav) {
    405380  t_irc irc = failure;
    406381  vector<t_pppParam*>& params = _parlist->params();
     
    438413// Compute various DOP Values
    439414////////////////////////////////////////////////////////////////////////////
    440 void t_pppFilter::cmpDOP(const std::vector<t_lc::type>& LCs, const Matrix& AA) {
     415void t_pppFilter::cmpDOP(const vector<t_pppSatObs*>& obsVector) {
    441416
    442417  _dop.reset();
    443   _numSat = 0;
     418
    444419  try {
    445     _numSat = AA.Nrows() / LCs.size();
    446    
     420    const unsigned numPar = 4;
     421    Matrix AA(obsVector.size(), numPar);
     422    _numSat = 0;
     423    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
     424      t_pppSatObs* obs = obsVector[ii];
     425      if (obs->isValid() && !obs->outlier()) {
     426        ++_numSat;
     427        for (unsigned iPar = 0; iPar < numPar; iPar++) {
     428          const t_pppParam* par = _parlist->params()[iPar];
     429          AA[_numSat-1][iPar] = par->partial(_epoTime, obs, t_lc::c1);
     430        }
     431      }
     432    }
    447433    if (_numSat < 4) {
    448434      return;
    449435    }
    450    
    451     Matrix BB(_numSat, 4);
    452    
    453     for (int ii = 1; ii <= _numSat; ii++) {
    454       BB.Row(ii) = AA.Row(ii*LCs.size()).columns(1,4);
    455     }
    456    
    457     SymmetricMatrix NN; NN << BB.t() * BB; 
     436    AA = AA.Rows(1, _numSat);
     437    SymmetricMatrix NN; NN << AA.t() * AA; 
    458438    SymmetricMatrix QQ = NN.i();
    459439   
Note: See TracChangeset for help on using the changeset viewer.