Changeset 10034 in ntrip for trunk


Ignore:
Timestamp:
Apr 21, 2023, 11:48:24 AM (12 months ago)
Author:
stuerze
Message:
 
Location:
trunk/BNC
Files:
19 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/BNC/scripts/Bnc.pm

    r10007 r10034  
    627627    if ( @OFF_BDSs && scalar @EPOCHs_OFF_BDS != scalar @OFF_BDSs ) { LOGDIE "number of epochs and OFF_BDSs not equal\n" }
    628628
     629
    629630    my %data = (
    630631                 EPOCHS    => \@EPOCHs,
     
    634635                 SATNUM    => \%SATNUM,
    635636                 TRPs      => \@TRPs,
    636                  CLKs      => \@CLKs,
     637                 CLKs    => \@CLKs,
    637638                 OFF_GLOs  => \@OFF_GLOs,
    638639                 OFF_GALs  => \@OFF_GALs,
  • trunk/BNC/scripts/cmbPlot.pl

    r9830 r10034  
    431431$pdf->save();
    432432$pdf->end();
    433 system ("rm $inputDir/*png");
     433#system ("rm $inputDir/*png");
    434434system("evince $inputDir/$pdf_name&");
    435435
  • trunk/BNC/scripts/pppPlot.pl

    r10010 r10034  
    228228                                                     title   => "Receiver clock",
    229229                                                     timefmt => '%s',
    230                                                      style   => "points",
     230                                                     style   => "linespoints",
    231231            );
    232232            $chartCLK->plot2d($dataset);
     
    261261                                                         title   => "Receiver Offset GLONASS",
    262262                                                         timefmt => '%s',
    263                                                          style   => "points",
     263                                                         style   => "linespoints",
    264264                );
    265265                $chartOFF_GLO->plot2d($dataset);    #system ("display $pngName&");
     
    294294                                                         title   => "Receiver Offset Galileo",
    295295                                                         timefmt => '%s',
    296                                                          style   => "points",
     296                                                         style   => "linespoints",
    297297                );
    298298                $chartOFF_GAL->plot2d($dataset);    #system ("display $pngName&");
     
    327327                                                         title   => "Receiver Offset Beidou",
    328328                                                         timefmt => '%s',
    329                                                          style   => "points",
     329                                                         style   => "linespoints",
    330330                );
    331331                $chartOFF_BDS->plot2d($dataset);    #system ("display $pngName&");
     
    624624
    625625                if ( $key_resType =~ /^c/ ) {
    626                     $chartRES->set( yrange => [ " -10.0 ", " 10.0 " ] );
     626                    $chartRES->set( yrange => [ " -6.0 ", " 6.0 " ] );
    627627                }
    628628                elsif ( $key_resType =~ /^l/ ) {
    629                     $chartRES->set( yrange => [ " -0.10 ", " 0.10 " ] );
     629                    $chartRES->set( yrange => [ " -0.06 ", " 0.06 " ] );
    630630                }
    631631
     
    666666    system ("rm *.png");
    667667    if (Common::amInteractiv ) {
    668 #   system ("evince $inputDir/$pdf_name");
     668   system ("evince $inputDir/$pdf_name");
    669669    }
    670670}    # -----  next logfile  -----
  • trunk/BNC/src/PPP/pppClient.cpp

    r10031 r10034  
    2020#include <iomanip>
    2121#include <cmath>
     22#include <stdlib.h>
    2223#include <string.h>
    2324#include <stdexcept>
     
    5455  _obsPool  = new t_pppObsPool();
    5556  _staRover = new t_pppStation();
    56   _filter   = new t_pppFilter(_obsPool);
     57  _filter   = new t_pppFilter();
    5758  _tides    = new t_tides();
    5859  _antex    = 0;
     
    6566    }
    6667  }
    67 
    68   if (_opt->_refSatRequired) {
    69     for (unsigned iSys = 0; iSys < _opt->systems().size(); iSys++) {
    70       char sys = _opt->systems()[iSys];
    71       _refSatMap[sys] = new t_pppRefSat();
    72     }
    73   }
    74 
     68  _offGlo = 0.0;
     69  _offGal = 0.0;
     70  _offBds = 0.0;
    7571  CLIENTS.setLocalData(this);  // CLIENTS takes ownership over "this"
    7672}
     
    8177  delete _log;
    8278  delete _opt;
    83   delete _filter;
    8479  delete _ephPool;
    8580  delete _obsPool;
     
    8883    delete _antex;
    8984  }
     85  delete _filter;
    9086  delete _tides;
    9187  clearObs();
    92   QMapIterator<char, t_pppRefSat*> it(_refSatMap);
    93   while (it.hasNext()) {
    94     it.next();
    95     delete it.value();
    96   }
    97   _refSatMap.clear();
    9888}
    9989
     
    165155  // -------
    166156  epoTime.reset();
    167   clearObs();
     157  //clearObs();
    168158
    169159  // Create vector of valid observations
     
    218208    while (it != obsVector.end()) {
    219209      t_pppSatObs* satObs = *it;
    220       char sys = satObs->prn().system();
    221       t_pppRefSat* refSat = _refSatMap[sys];
    222       double stecRef = refSat->stecValue();
    223       if (stecRef && !satObs->isReference()) {
    224         pseudoObsIono = true;
    225         satObs->setPseudoObsIono(t_frequency::G1, stecRef);
    226       }
     210      pseudoObsIono = satObs->setPseudoObsIono(t_frequency::G1);
    227211      it++;
    228212    }
    229213  }
    230 
    231 /*
    232   vector<t_pppSatObs*>::iterator it = obsVector.begin();
     214  /*vector<t_pppSatObs*>::iterator it = obsVector.begin();
    233215      while (it != obsVector.end()) {
    234216        t_pppSatObs* satObs = *it;
    235217        satObs->printObsMinusComputed();
    236218        it++;
    237       }
    238 */
     219      }*/
     220
    239221  return pseudoObsIono;
    240222}
     
    330312    }
    331313    if (maxRes < BLUNDER) {
    332       if (print && _numEpoProcessing == 1) {
     314      if (print) {
    333315        LOG.setf(ios::fixed);
    334316        LOG << "\nPPP of Epoch ";
     
    354336  return success;
    355337}
    356 
     338// Compute A Priori Glonass Receiver Clock Offset
     339//////////////////////////////////////////////////////////////////////////////
     340double t_pppClient::cmpOffGlo(vector<t_pppSatObs*>& obsVector) {
     341
     342  t_lc::type tLC   = t_lc::dummy;
     343  double     offGlo = 0.0;
     344
     345  if (OPT->useSystem('R')) {
     346
     347    while (obsVector.size() > 0) {
     348      offGlo = 0.0;
     349      double   maxRes      = 0.0;
     350      int      maxResIndex = -1;
     351      t_prn    maxResPrn;
     352      unsigned nObs        = 0;
     353      for (unsigned ii = 0; ii < obsVector.size(); ii++) {
     354        t_pppSatObs* satObs = obsVector.at(ii);
     355        if (satObs->prn().system() == 'R') {
     356          if (tLC == t_lc::dummy) {
     357            tLC = satObs->isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
     358          }
     359          if (satObs->isValid(tLC) && (!satObs->modelSet() || satObs->eleSat() >= OPT->_minEle)) {
     360            double ll = satObs->obsValue(tLC) - satObs->cmpValue(tLC);
     361            ++nObs;
     362            offGlo += ll;
     363            if (fabs(ll) > fabs(maxRes)) {
     364              maxRes      = ll;
     365              maxResIndex = ii;
     366              maxResPrn   = satObs->prn();
     367            }
     368          }
     369        }
     370      }
     371
     372      if (nObs > 0) {
     373        offGlo = offGlo / nObs;
     374      }
     375      else {
     376        offGlo = 0.0;
     377      }
     378
     379      if (fabs(maxRes) > 1000.0) {
     380        LOG << "t_pppClient::cmpOffGlo outlier " << maxResPrn.toString() << " " << maxRes << endl;
     381        obsVector.erase(obsVector.begin() + maxResIndex);
     382      }
     383      else {
     384        break;
     385      }
     386    }
     387  }
     388
     389  return offGlo;
     390}
     391
     392// Compute A Priori Galileo Receiver Clock Offset
     393//////////////////////////////////////////////////////////////////////////////
     394double t_pppClient::cmpOffGal(vector<t_pppSatObs*>& obsVector) {
     395
     396  t_lc::type tLC   = t_lc::dummy;
     397  double     offGal = 0.0;
     398
     399  if (OPT->useSystem('E')) {
     400
     401    while (obsVector.size() > 0) {
     402      offGal = 0.0;
     403      double   maxRes      = 0.0;
     404      int      maxResIndex = -1;
     405      t_prn    maxResPrn;
     406      unsigned nObs        = 0;
     407      for (unsigned ii = 0; ii < obsVector.size(); ii++) {
     408        t_pppSatObs* satObs = obsVector.at(ii);
     409        if (satObs->prn().system() == 'E') {
     410          if (tLC == t_lc::dummy) {
     411            tLC = satObs->isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
     412          }
     413          if (satObs->isValid(tLC) && (!satObs->modelSet() || satObs->eleSat() >= OPT->_minEle)) {
     414            double ll = satObs->obsValue(tLC) - satObs->cmpValue(tLC);
     415            ++nObs;
     416            offGal += ll;
     417            if (fabs(ll) > fabs(maxRes)) {
     418              maxRes      = ll;
     419              maxResIndex = ii;
     420              maxResPrn   = satObs->prn();
     421            }
     422          }
     423        }
     424      }
     425
     426      if (nObs > 0) {
     427        offGal = offGal / nObs;
     428      }
     429      else {
     430        offGal = 0.0;
     431      }
     432
     433      if (fabs(maxRes) > 1000.0) {
     434        LOG << "t_pppClient::cmpOffGal outlier " << maxResPrn.toString() << " " << maxRes << endl;
     435        obsVector.erase(obsVector.begin() + maxResIndex);
     436      }
     437      else {
     438        break;
     439      }
     440    }
     441  }
     442
     443  return offGal;
     444}
     445
     446
     447// Compute A Priori BDS Receiver Clock Offset
     448//////////////////////////////////////////////////////////////////////////////
     449double t_pppClient::cmpOffBds(vector<t_pppSatObs*>& obsVector) {
     450
     451  t_lc::type tLC   = t_lc::dummy;
     452  double     offBds = 0.0;
     453
     454  if (_opt->useSystem('C')) {
     455    while (obsVector.size() > 0) {
     456      offBds = 0.0;
     457      double   maxRes      = 0.0;
     458      int      maxResIndex = -1;
     459      t_prn    maxResPrn;
     460      unsigned nObs        = 0;
     461      for (unsigned ii = 0; ii < obsVector.size(); ii++) {
     462        const t_pppSatObs* satObs = obsVector.at(ii);
     463        if (satObs->prn().system() == 'C') {
     464          if (tLC == t_lc::dummy) {
     465            tLC = satObs->isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
     466          }
     467          if (satObs->isValid(tLC) && (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle)) {
     468            double ll = satObs->obsValue(tLC) - satObs->cmpValue(tLC);
     469            ++nObs;
     470            offBds += ll;
     471            if (fabs(ll) > fabs(maxRes)) {
     472              maxRes      = ll;
     473              maxResIndex = ii;
     474              maxResPrn   = satObs->prn();
     475            }
     476          }
     477        }
     478      }
     479
     480      if (nObs > 0) {
     481        offBds = offBds / nObs;
     482      }
     483      else {
     484        offBds = 0.0;
     485      }
     486
     487      if (fabs(maxRes) >  1000.0) {
     488        LOG << "t_pppClient::cmpOffBds outlier " << maxResPrn.toString() << " " << maxRes << endl;
     489        delete obsVector.at(maxResIndex);
     490        obsVector.erase(obsVector.begin() + maxResIndex);
     491      }
     492      else {
     493        break;
     494      }
     495    }
     496  }
     497  return offBds;
     498}
    357499//
    358500//////////////////////////////////////////////////////////////////////////////
     
    403545  else {
    404546    _output->_error = true;
    405     if (OPT->_obsModelType == OPT->DCMcodeBias ||
    406         OPT->_obsModelType == OPT->DCMphaseBias) {
    407       if (ind == 1 || ind == 6 || ind > 7) {
    408         reset();
    409       }
    410       //else {_filter->restoreState(ind);}
    411     }
    412   }
     547  }
     548
    413549  _output->_log = _log->str();
    414550  delete _log; _log = new ostringstream();
     
    426562  station->setAntName(_opt->_antNameRover);
    427563  station->setEpochTime(time);
     564
    428565  if (_opt->xyzAprRoverSet()) {
    429566    station->setXyzApr(_opt->_xyzAprRover);
     
    472609  try {
    473610    initOutput(output);
    474     bool epochReProcessing = false;
    475     _numEpoProcessing = 0;
    476     if (!_historicalRefSats.isEmpty()) {
    477       _historicalRefSats.clear();
    478     }
    479 
    480     do {
    481       if ((_numEpoProcessing++) > 30) {
    482         LOG << "t_pppClient::processEpoch:  _numEpoProcessing > 30" << endl;
    483         return finish(failure,12);
    484       }
    485 
    486       if (_obsPool->refSatChanged()) {
    487         if(_filter->datumTransformation(_refSatMap) != success) {
    488           LOG << "t_pppFilter::datumTransformation() != success" << endl;
    489           return finish(failure,1);
    490         }
    491         else {
    492           LOG << "t_pppFilter::datumTransformation() == success" << endl;
    493           _filter->rememberState(1);
    494         }
    495       }
    496 
    497       // Prepare Observations of the Rover
    498       // ---------------------------------
    499       if (prepareObs(satObs, _obsRover, _epoTimeRover) != success) {
    500         return finish(failure,2);
    501       }
    502 
    503       for (int iter = 1; iter <= 2; iter++) {
    504         ColumnVector xyzc(4); xyzc = 0.0;
    505         bool print = (iter == 2);
    506         if (cmpBancroft(_epoTimeRover, _obsRover, xyzc, print) != success) {
    507           return finish(failure,3);
    508         }
    509 
    510         if (cmpModel(_staRover, xyzc, _obsRover) != success) {
    511           return finish(failure,4);
    512         }
    513       }
    514       // use observations only if satellite code biases are available
    515       // ------------------------------------------------------------
    516       if (!_opt->_corrMount.empty() &&
    517           (OPT->_obsModelType == OPT->DCMcodeBias ||
    518            OPT->_obsModelType == OPT->DCMphaseBias)) {
     611
     612    // Prepare Observations of the Rover
     613    // ---------------------------------
     614    if (prepareObs(satObs, _obsRover, _epoTimeRover) != success) {
     615      return finish(failure, 1);
     616    }
     617
     618    for (int iter = 1; iter <= 2; iter++) {
     619      ColumnVector xyzc(4); xyzc = 0.0;
     620      bool print = (iter == 2);
     621      if (cmpBancroft(_epoTimeRover, _obsRover, xyzc, print) != success) {
     622        return finish(failure, 2);
     623      }
     624       if (cmpModel(_staRover, xyzc, _obsRover) != success) {
     625        return finish(failure, 3);
     626      }
     627    }
     628    // use observations only if satellite code biases are available
     629    /* ------------------------------------------------------------
     630    if (!_opt->_corrMount.empty() {
    519631        useObsWithCodeBiasesOnly(_obsRover);
    520       }
    521 
    522       if (int(_obsRover.size()) < _opt->_minObs) {
    523         LOG << "t_pppClient::processEpoch not enough observations" << endl;
    524         return finish(failure,5);
    525       }
    526 
    527       if (_opt->_refSatRequired) {
    528         if (handleRefSatellites(_obsRover) != success) {
    529           return finish(failure,6);
    530         }
    531         if (_obsPool->refSatChanged()) {
    532           epochReProcessing = true;
    533           continue;
    534         }
    535       }
    536 
    537       // Prepare Pseudo Observations of the Rover
    538       // ----------------------------------------
    539       _pseudoObsIono = preparePseudoObs(_obsRover);
    540 
    541       // Store last epoch of data
    542       // ------------------------
    543       _obsPool->putEpoch(_epoTimeRover, _obsRover, _pseudoObsIono, _refSatMap);
    544 #ifdef BNC_DEBUG_PPP
    545       LOG << "PUT EPOCH t_pppClient::processEpoch " << _epoTimeRover.timestr().c_str() << endl;
    546 #endif
    547 
    548       // Process Epoch in Filter
    549       // -----------------------
    550       if (_filter->processEpoch(_numEpoProcessing) != success) {
    551         LOG << "filter->processEpoch() != success" << endl;
    552         return finish(failure,7);
    553       }
    554 
    555       // Epoch re-processing required?
    556       // -----------------------------
    557       if (_obsPool->refSatChangeRequired() && //SLIP
    558           _opt->_obsModelType  != t_pppOptions::UncombPPP) {
    559         LOG << "pppClient: _obsPool->refSatChangeRequired() " << endl;
    560         epochReProcessing = true;
    561 #ifdef BNC_DEBUG_PPP
    562         LOG <<  "DELETE EPOCH" << endl;
    563 #endif
    564         _obsPool->deleteLastEpoch();
    565         _filter->restoreState(0);
    566         setHistoricalRefSats();
    567       }
    568       else {
    569          epochReProcessing = false;
    570          if (OPT->_obsModelType == OPT->DCMcodeBias ||
    571              OPT->_obsModelType == OPT->DCMphaseBias) {
    572            _filter->rememberState(0);
    573          }
    574       }
    575     } while (epochReProcessing);
    576 
     632    }*/
     633
     634    if (int(_obsRover.size()) < _opt->_minObs) {
     635      LOG << "t_pppClient::processEpoch not enough observations" << endl;
     636      return finish(failure, 4);
     637    }
     638   
     639      _offGlo = cmpOffGlo(_obsRover);
     640      _offGal = cmpOffGal(_obsRover);
     641      _offBds = cmpOffBds(_obsRover);
     642     
     643    // Prepare Pseudo Observations of the Rover
     644    // ----------------------------------------
     645    _pseudoObsIono = preparePseudoObs(_obsRover);
     646
     647    // Store last epoch of data
     648    // ------------------------
     649    _obsPool->putEpoch(_epoTimeRover, _obsRover, _pseudoObsIono);
     650
     651    // Process Epoch in Filter
     652    // -----------------------
     653    if (_filter->processEpoch(_obsPool) != success) {
     654      LOG << "filter->processEpoch() != success" << endl;
     655      return finish(failure, 5);
     656    }
    577657  }
    578658  catch (Exception& exc) {
    579659    LOG << exc.what() << endl;
    580     return finish(failure,8);
     660    return finish(failure, 6);
    581661  }
    582662  catch (t_except msg) {
    583663    LOG << msg.what() << endl;
    584     return finish(failure,9);
     664    return finish(failure, 7);
    585665  }
    586666  catch (const char* msg) {
    587667    LOG << msg << endl;
    588     return finish(failure,10);
     668    return finish(failure, 8);
    589669  }
    590670  catch (...) {
    591671    LOG << "unknown exception" << endl;
    592     return finish(failure,11);
    593   }
    594   return finish(success,0);
     672    return finish(failure, 9);
     673  }
     674  return finish(success, 0);
    595675}
    596676
     
    684764//
    685765//////////////////////////////////////////////////////////////////////////////
    686 void t_pppClient::setRefSatellites(std::vector<t_pppSatObs*>& obsVector) {
    687   // reference satellite definition per system
    688   for (unsigned iSys = 0; iSys < _opt->systems().size(); iSys++) {
    689     t_irc  refSatReDefinition = success;
    690     char sys = _opt->systems()[iSys];
    691     bool refSatDefined = false;
    692     t_pppRefSat* refSat = _refSatMap[sys];
    693     for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    694       t_pppSatObs* satObs = obsVector.at(ii);
    695       if (satObs->eleSat() < _opt->_minEle) {
    696         continue;
    697       }
    698       // reference satellite is unchanged
    699       // ================================
    700       if (     !_obsPool->refSatChangeRequired(sys) && refSat->prn() == satObs->prn()) {
    701         refSatDefined = true;
    702         obsVector[ii]->setAsReference();
    703       }
    704       // reference satellite has changed
    705       // ===============================
    706       else if ( _obsPool->refSatChangeRequired(sys) && refSat->prn() != satObs->prn()) {
    707         if (satObs->prn().system() == sys) {
    708           if (!_historicalRefSats[sys].contains(satObs->prn())) {
    709             refSatDefined = true;
    710             obsVector[ii]->setAsReference();
    711             refSat->setPrn(satObs->prn());
    712           }
    713           else if ( _historicalRefSats[sys].contains(satObs->prn())) {
    714             refSatReDefinition = failure;
    715           }
    716         }
    717       }
    718       if (refSatDefined) {
    719         if (OPT->_pseudoObsIono) {
    720           refSat->setStecValue(satObs->getIonoCodeDelay(t_frequency::G1));
    721         }
    722         break;
    723       }
    724     }
    725 
    726     // all available satellites were already tried to use
    727     if ((!refSatDefined) && (refSatReDefinition == failure)) {
    728       refSat->setPrn(t_prn(sys, 99));
    729       _obsPool->setRefSatChangeRequired(sys, false);
    730       return;
    731     }
    732 
    733     // reference satellite has to be initialized
    734     // =========================================
    735     if (!refSatDefined) {
    736       for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    737         t_pppSatObs* satObs = obsVector.at(ii);
    738         if (satObs->eleSat() < _opt->_minEle) {
    739           continue;
    740         }
    741         if (satObs->prn().system() == sys &&
    742             !_historicalRefSats[sys].contains(satObs->prn())) {
    743           obsVector[ii]->setAsReference();
    744           refSat->setPrn(satObs->prn());
    745           if (OPT->_pseudoObsIono) {
    746             refSat->setStecValue(satObs->getIonoCodeDelay(t_frequency::G1));
    747           }
    748           refSatDefined = true;
    749           break;
    750         }
    751       }
    752     }
    753 
    754     // no observations for that system
    755     // ===============================
    756     if (!refSatDefined) {
    757       refSat->setPrn(t_prn());
    758     }
    759     _obsPool->setRefSatChangeRequired(sys, false); // done or impossible
    760   }
    761 
    762   return;
    763 }
    764 
    765 //
    766 //////////////////////////////////////////////////////////////////////////////
    767 t_irc t_pppClient::handleRefSatellites(std::vector<t_pppSatObs*>& obsVector) {
    768 
    769   // set refSats in current epoch
    770   // ============================
    771   setRefSatellites(obsVector); // current epoch
    772   LOG.setf(ios::fixed);
    773   t_pppObsPool::t_epoch* epoch = _obsPool->lastEpoch();
    774   const QMap<char, t_pppRefSat*>& refSatMapLastEpoch = epoch->refSatMap();
    775 
    776   QMapIterator<char, t_pppRefSat*> it(_refSatMap);
    777   while (it.hasNext()) {
    778     it.next();
    779     char  sys = it.key();
    780     t_prn prn = it.value()->prn();
    781     t_prn refSatLastEpochPrn = t_prn();
    782     if (epoch) {
    783       refSatLastEpochPrn =  refSatMapLastEpoch[sys]->prn();
    784     }
    785     if      (prn.number() ==  0) { // no obs for that system available
    786       continue;
    787     }
    788     else if (prn.number() == 99) { // refSat re-definition not possible
    789       LOG << " => refSat re-definition impossible: " << sys << endl;
    790       return failure;
    791     }
    792     QString str;
    793     if (prn == refSatLastEpochPrn || refSatLastEpochPrn == t_prn() )  {
    794       _obsPool->setRefSatChanged(sys, false);
    795       str = " SET   ";
    796     }
    797     else {
    798       _obsPool->setRefSatChanged(sys, true);
    799       str = " RESET ";
    800     }
    801     LOG << string(_epoTimeRover) <<  str.toStdString() << " REFSAT  " << sys << ": " << prn.toString() << endl;
    802   }
    803   return success;
    804 }
    805 
    806 void t_pppClient::setHistoricalRefSats() {
    807   QMapIterator<char, t_pppRefSat*> it(_refSatMap);
    808   while (it.hasNext()) {
    809     it.next();
    810     t_prn prn = it.value()->prn();
    811     char sys = prn.system();
    812     if (_obsPool->refSatChangeRequired(sys)) {
    813       _historicalRefSats[sys].append(prn);
    814     }
    815   }
    816 }
    817 
    818 //
    819 //////////////////////////////////////////////////////////////////////////////
    820 void t_pppClient::reset() {LOG << "t_pppClient::reset()" << endl;
     766void t_pppClient::reset() {cout << "t_pppClient::reset()" << endl;
    821767
    822768  // to delete old orbit and clock corrections
     
    830776  // to delete all parameters
    831777  delete _filter;
    832   _filter   = new t_pppFilter(_obsPool);
    833 
    834 }
     778  _filter   = new t_pppFilter();
     779
     780}
  • trunk/BNC/src/PPP/pppClient.h

    r10031 r10034  
    44#include <sstream>
    55#include <vector>
    6 #include <QMap>
    76#include "pppInclude.h"
    87#include "ephemeris.h"
    98#include "pppOptions.h"
    109#include "pppModel.h"
    11 #include "pppRefSat.h"
    1210
    1311class bncAntex;
     
    3836  const bncAntex*     antex() const {return _antex;}
    3937  const t_pppStation* staRover() const {return _staRover;}
     38  double              offGlo() const {return _offGlo;}
     39  double              offGal() const {return _offGal;}
     40  double              offBds() const {return _offBds;}
    4041
    4142  std::ostringstream& log() {return *_log;}
     
    6364  double cmpOffGal(std::vector<t_pppSatObs*>& obsVector);
    6465  double cmpOffBds(std::vector<t_pppSatObs*>& obsVector);
    65   t_irc handleRefSatellites(std::vector<t_pppSatObs*>& obsVector);
    66   void setRefSatellites(std::vector<t_pppSatObs*>& obsVector);
    67   void setHistoricalRefSats();
    68 
     66 
    6967  t_output*                 _output;
    7068  t_pppEphPool*             _ephPool;
     
    7472  bncAntex*                 _antex;
    7573  t_pppFilter*              _filter;
     74  double                    _offGlo;
     75  double                    _offGal;
     76  double                    _offBds; 
    7677  std::vector<t_pppSatObs*> _obsRover;
    77   QMap<char, t_pppRefSat*>  _refSatMap;
    7878  std::ostringstream*       _log;
    7979  t_pppOptions*             _opt;
    8080  t_tides*                  _tides;
    8181  bool                      _pseudoObsIono;
    82   int                       _numEpoProcessing;
    83   QMap<char, QList<t_prn>>  _historicalRefSats;
    8482};
    8583
  • trunk/BNC/src/PPP/pppFilter.cpp

    r10033 r10034  
    2727#include "pppObsPool.h"
    2828#include "pppStation.h"
     29#include "pppClient.h"
    2930
    3031using namespace BNC_PPP;
     
    3334// Constructor
    3435////////////////////////////////////////////////////////////////////////////
    35 t_pppFilter::t_pppFilter(t_pppObsPool *obsPool) {
    36   _numSat = 0;
    37   _obsPool = obsPool;
    38   _refPrn = t_prn();
    39   _datumTrafo = new t_datumTrafo();
     36t_pppFilter::t_pppFilter() {
     37  _parlist = 0;
    4038}
    4139
     
    4341////////////////////////////////////////////////////////////////////////////
    4442t_pppFilter::~t_pppFilter() {
    45   delete _datumTrafo;
     43  delete _parlist;
    4644}
    4745
    4846// Process Single Epoch
    4947////////////////////////////////////////////////////////////////////////////
    50 t_irc t_pppFilter::processEpoch(int num) {
     48t_irc t_pppFilter::processEpoch(t_pppObsPool* obsPool) {
     49
    5150  _numSat = 0;
    5251  const double maxSolGap = 60.0;
    5352  bool setNeuNoiseToZero = false;
    5453
    55   if (num > 1) {
    56     setNeuNoiseToZero = true;
     54  if (!_parlist) {
     55    _parlist = new t_pppParlist();
    5756  }
    5857
    5958  // Vector of all Observations
    6059  // --------------------------
    61   t_pppObsPool::t_epoch *epoch = _obsPool->lastEpoch();
     60  t_pppObsPool::t_epoch *epoch = obsPool->lastEpoch();
    6261  if (!epoch) {
    6362    return failure;
     
    7776  string epoTimeStr = string(_epoTime);
    7877
    79   const QMap<char, t_pppRefSat*> &refSatMap = epoch->refSatMap();
    80 
    81   const QList<char> &usedSystems = _parlist.usedSystems();
    82   //--
     78  const QList<char> &usedSystems = _parlist->usedSystems();
     79
    8380  // Set Parameters
    84   if (_parlist.set(_epoTime, allObs, refSatMap) != success) {
     81  // --------------
     82  if (_parlist->set(_epoTime, allObs) != success) {
    8583    return failure;
    8684  }
    87 
    88 #ifdef BNC_DEBUG_PPP
    89   if (OPT->_obsModelType == OPT->DCMcodeBias ||
    90       OPT->_obsModelType == OPT->DCMphaseBias) {
    91 //    _parlist.printParams(_epoTime);
    92   }
    93 #endif
    9485
    9586  // Status Vector, Variance-Covariance Matrix
     
    9990  setStateVectorAndVarCovMatrix(xFltOld, QFltOld, setNeuNoiseToZero);
    10091
    101   // Pre-Process Satellite Systems separately
    102   // ----------------------------------------
    103   bool preProcessing = false;
    104   if (OPT->_obsModelType == OPT->DCMcodeBias ||
    105       OPT->_obsModelType == OPT->DCMphaseBias) {
    106     preProcessing = true;
    107     for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
    108       char sys = usedSystems[iSys];
    109       _refPrn.set(sys, 0);
    110       if (OPT->_refSatRequired) {
    111         _refPrn = refSatMap[sys]->prn();
    112       }
    113       vector<t_pppSatObs*> obsVector;
    114       for (unsigned jj = 0; jj < allObs.size(); jj++) {
    115         if (allObs[jj]->prn().system() == sys) {
    116           obsVector.push_back(allObs[jj]);
    117         }
    118       }
    119       if (iSys == 0) {
    120         _datumTrafo->setFirstSystem(sys);
    121       }
    122       if (processSystem(OPT->LCs(sys), obsVector, _refPrn,
    123           epoch->pseudoObsIono(), preProcessing) != success) {
    124         LOG << sys << ": processSystem !=  success (pre-processing)" << endl;
    125         _xFlt = xFltOld;
    126         _QFlt = QFltOld;
    127         restoreState(1);
    128         return failure;
    129       }
    130     }
    131     // refSat change required?
    132     // -----------------------
    133     if (_obsPool->refSatChangeRequired()) {
    134       _xFlt = xFltOld;
    135       _QFlt = QFltOld;
    136       return success;
    137     } else if (!_obsPool->refSatChangeRequired()) {
    138       initDatumTransformation(allObs, epoch->pseudoObsIono());
    139     }
    140   }
    141 
    14292  // Process Satellite Systems separately
    14393  // ------------------------------------
    144   preProcessing = false;
    14594  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
    14695    char sys = usedSystems[iSys];
    147     _refPrn.set(sys, 0);
    148     if (OPT->_refSatRequired) {
    149       _refPrn = refSatMap[sys]->prn();
    150     }
    15196    unsigned int num = 0;
    15297    vector<t_pppSatObs*> obsVector;
     
    15499      if (allObs[jj]->prn().system() == sys) {
    155100        obsVector.push_back(allObs[jj]);
    156         ++num;
    157       }
    158     }
    159     if (iSys == 0 && OPT->_obsModelType == OPT->UncombPPP) {
    160       _datumTrafo->setFirstSystem(sys);
    161     }
    162     LOG << epoTimeStr << " SATNUM " << sys << ' ' << right << setw(2) << num
    163         << endl;
    164     if (processSystem(OPT->LCs(sys), obsVector, _refPrn,
    165         epoch->pseudoObsIono(), preProcessing) != success) {
    166       LOG << "processSystem !=  success (fin-processing)" << endl;
    167       if (OPT->_obsModelType == OPT->DCMcodeBias ||
    168           OPT->_obsModelType == OPT->DCMphaseBias) {
    169         _xFlt = xFltOld;
    170         _QFlt = QFltOld;
    171         restoreState(2);
    172       }
     101        num++;
     102      }
     103    }
     104    LOG << epoTimeStr << " SATNUM " << sys << ' ' << right << setw(2) << num  << endl;
     105    if (processSystem(OPT->LCs(sys), obsVector, epoch->pseudoObsIono()) != success) {
     106      LOG << "processSystem !=  success: " << sys << endl;
    173107      return failure;
    174108    }
     
    177111  // close epoch processing
    178112  // ----------------------
    179   cmpDOP(allObs, refSatMap);
    180   _parlist.printResult(_epoTime, _QFlt, _xFlt);
     113  cmpDOP(allObs);
     114  _parlist->printResult(_epoTime, _QFlt, _xFlt);
    181115  _lastEpoTimeOK = _epoTime; // remember time of last successful epoch processing
    182116  return success;
     
    186120////////////////////////////////////////////////////////////////////////////
    187121t_irc t_pppFilter::processSystem(const vector<t_lc::type> &LCs,
    188     const vector<t_pppSatObs*> &obsVector, const t_prn &refPrn,
    189     bool pseudoObsIonoAvailable, bool preProcessing) {
     122                                 const vector<t_pppSatObs*> &obsVector,
     123                                 bool pseudoObsIonoAvailable) {
    190124  LOG.setf(ios::fixed);
    191   char sys = refPrn.system();
    192125
    193126  // Detect Cycle Slips
    194127  // ------------------
    195   if (detectCycleSlips(LCs, obsVector, refPrn, preProcessing) != success) {
     128  if (detectCycleSlips(LCs, obsVector) != success) {
    196129    return failure;
    197130  }
    198   if (preProcessing && _obsPool->refSatChangeRequired(sys)) {
    199     return success;
    200   }
    201 
    202   ColumnVector xSav = _xFlt;
     131
     132  ColumnVector    xSav = _xFlt;
    203133  SymmetricMatrix QSav = _QFlt;
    204   string epoTimeStr = string(_epoTime);
    205   const vector<t_pppParam*> &params = _parlist.params();
    206   unsigned nPar = _parlist.nPar();
     134  string          epoTimeStr = string(_epoTime);
     135  const vector<t_pppParam*> &params = _parlist->params();
     136  unsigned        nPar = _parlist->nPar();
    207137
    208138  unsigned usedLCs = LCs.size();
     
    213143  unsigned maxObs = obsVector.size() * usedLCs;
    214144
    215   if (OPT->_pseudoObsIono && pseudoObsIonoAvailable) {
    216     maxObs -= 1; // pseudo obs iono with respect to refSat
    217   }
    218 
    219145  // Outlier Detection Loop
    220146  // ----------------------
     
    229155    // -----------------------------------------------------------
    230156    Matrix AA(maxObs, nPar);
    231     ColumnVector ll(maxObs);
    232     DiagonalMatrix PP(maxObs);
    233     PP = 0.0;
     157    ColumnVector ll(maxObs);   ll = 0.0;
     158    DiagonalMatrix PP(maxObs); PP = 0.0;
    234159
    235160    int iObs = -1;
     
    242167    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    243168      t_pppSatObs *obs = obsVector[ii];
    244       if (iOutlier == 0 && !preProcessing) {
     169      if (iOutlier == 0) {
    245170        obs->resetOutlier();
    246171      }
     
    257182          for (unsigned iPar = 0; iPar < nPar; iPar++) {
    258183            const t_pppParam *par = params[iPar];
    259             AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
     184            AA[iObs][iPar] = par->partial(_epoTime, obs, tLC);
    260185          }
    261           ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC)
    262                    - DotProduct(_x0, AA.Row(iObs + 1));
     186          ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs + 1));
    263187          PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
    264188        }
     
    269193    // ----------------------------
    270194    if ((iObs +1) < OPT->_minObs) {
    271       LOG << "t_pppFilter::processSystem not enough observations " << sys << ": " << iObs + 1 << "\n";
     195      LOG << "t_pppFilter::processSystem not enough observations " << iObs + 1 << "\n";
    272196      return failure;
    273     }
    274 
    275     if ((!iOutlier) &&
    276         (OPT->_obsModelType == OPT->DCMcodeBias ||
    277          OPT->_obsModelType == OPT->DCMphaseBias) && (!preProcessing)) {
    278       _datumTrafo->updateIndices(sys, iObs + 1);
    279       _datumTrafo->prepareAA(AA.SubMatrix(1, iObs + 1, 1, _parlist.nPar()), 1);
    280197    }
    281198
     
    288205          for (unsigned jj = 0; jj < usedLCs; jj++) {
    289206            const t_lc::type tLC = LCs[jj];
    290             if (tLC == t_lc::GIM && !obs->isReference()) {
     207            if (tLC == t_lc::GIM) {
    291208              ++iObs;
    292209            } else {
     
    297214            for (unsigned iPar = 0; iPar < nPar; iPar++) {
    298215              const t_pppParam *par = params[iPar];
    299               AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
     216              AA[iObs][iPar] = par->partial(_epoTime, obs, tLC);
    300217            }
    301             ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC)
    302                      - DotProduct(_x0, AA.Row(iObs + 1));
     218            ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs + 1));
    303219            PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
    304220          }
     
    340256      t_pppSatObs *obs = usedObs[maxOutlierIndex];
    341257      t_pppParam *par = 0;
     258      LOG << epoTimeStr << " Outlier " << t_lc::toString(maxOutlierLC) << ' '
     259          << obs->prn().toString() << ' ' << setw(8) << setprecision(4)
     260          << maxOutlier << endl;
    342261      for (unsigned iPar = 0; iPar < nPar; iPar++) {
    343262        t_pppParam *hlp = params[iPar];
    344263        if (hlp->type() == t_pppParam::amb &&
    345             hlp->prn() == obs->prn() &&
    346             hlp->tLC() == usedTypes[maxOutlierIndex]) {
     264            hlp->prn()  == obs->prn() &&
     265            hlp->tLC()  == usedTypes[maxOutlierIndex]) {
    347266          par = hlp;
    348267        }
    349268      }
    350       if (preProcessing) {
    351         if (obs->prn() == refPrn) {
    352             LOG << epoTimeStr << " Outlier ("
    353                 << ((preProcessing) ? "pre-processing) " : "fin-processing) ")
    354                 << t_lc::toString(maxOutlierLC) << ' ' << obs->prn().toString()
    355                 << ' ' << setw(8) << setprecision(4) << maxOutlier << endl;
    356             _obsPool->setRefSatChangeRequired(sys, true);
    357             break;
     269      if (par) {
     270        if (par->ambResetCandidate()) {
     271          resetAmb(par->prn(), obsVector, maxOutlierLC, &QSav, &xSav);
    358272        }
    359273        else {
     274          par->setAmbResetCandidate();
    360275          obs->setOutlier();
    361276        }
    362277      }
    363       else {    // fin-processing
    364         LOG << epoTimeStr << " Outlier " << t_lc::toString(maxOutlierLC) << ' '
    365             << obs->prn().toString() << ' ' << setw(8) << setprecision(4)
    366             << maxOutlier << endl;
    367         if (par) {
    368           if (par->ambResetCandidate() ||
    369               OPT->_obsModelType == OPT->DCMcodeBias ||
    370               OPT->_obsModelType == OPT->DCMphaseBias) {
    371             resetAmb(par->prn(), obsVector, maxOutlierLC, &QSav, &xSav);
    372           }
    373           else {
    374             par->setAmbResetCandidate();
    375             obs->setOutlier();
    376           }
    377         }
    378         else {
    379           obs->setOutlier();
    380         }
     278      else {
     279        obs->setOutlier();
    381280      }
    382281    }
     
    384283    // ---------------
    385284    else {
    386       if (!preProcessing) {
    387285        for (unsigned jj = 0; jj < LCs.size(); jj++) {
    388286          for (unsigned ii = 0; ii < usedObs.size(); ii++) {
     
    393291              LOG << epoTimeStr << " RES " << left << setw(3)
    394292                  << t_lc::toString(tLC) << right << ' '
    395                   << obs->prn().toString();
    396               LOG << setw(9) << setprecision(4) << vv[ii] << endl;
    397             }
     293                  << obs->prn().toString() << ' '
     294                  << setw(8) << setprecision(4) << vv[ii] << endl;
    398295          }
    399296        }
     
    408305////////////////////////////////////////////////////////////////////////////
    409306t_irc t_pppFilter::detectCycleSlips(const vector<t_lc::type> &LCs,
    410     const vector<t_pppSatObs*> &obsVector, const t_prn &refPrn,
    411     bool preProcessing) {
    412   const double SLIP = 50.0;
    413   char sys = refPrn.system();
     307                                    const vector<t_pppSatObs*> &obsVector) {
     308
     309  const double SLIP = 20.0;
    414310  string epoTimeStr = string(_epoTime);
    415   const vector<t_pppParam*> &params = _parlist.params();
    416   unsigned nPar = _parlist.nPar();
     311  const vector<t_pppParam*> &params = _parlist->params();
    417312
    418313  for (unsigned ii = 0; ii < LCs.size(); ii++) {
     
    426321        bool slip = false;
    427322
    428         // in pre-processing only the reference satellite has to be checked
    429         if (preProcessing && obs->prn() != refPrn) {
    430           continue;
    431         }
    432 
    433323        if (obs->slip()) {
    434           LOG << epoTimeStr << "cycle slip set (obs) " << obs->prn().toString()
    435               << endl;
     324          LOG << epoTimeStr << "cycle slip set (obs) " << obs->prn().toString() << endl;
    436325          slip = true;
    437326        }
    438327
    439         if (_slips[obs->prn()]._obsSlipCounter != -1
    440             && _slips[obs->prn()]._obsSlipCounter != obs->slipCounter()) {
    441           LOG << epoTimeStr << "cycle slip set (obsSlipCounter) "
    442               << obs->prn().toString() << endl;
     328        if (_slips[obs->prn()]._obsSlipCounter != -1 &&
     329            _slips[obs->prn()]._obsSlipCounter != obs->slipCounter()) {
     330          LOG << epoTimeStr  << "cycle slip set (obsSlipCounter) " << obs->prn().toString()  << endl;
    443331          slip = true;
    444332        }
    445         if (!preProcessing) {
    446           _slips[obs->prn()]._obsSlipCounter = obs->slipCounter();
    447         }
    448         if (_slips[obs->prn()]._biasJumpCounter != -1
    449             && _slips[obs->prn()]._biasJumpCounter != obs->biasJumpCounter()) {
    450           LOG << epoTimeStr << "cycle slip set (biasJumpCounter) "
    451               << obs->prn().toString() << endl;
     333        _slips[obs->prn()]._obsSlipCounter = obs->slipCounter();
     334
     335        if (_slips[obs->prn()]._biasJumpCounter != -1 &&
     336            _slips[obs->prn()]._biasJumpCounter != obs->biasJumpCounter()) {
     337          LOG << epoTimeStr  << "cycle slip set (biasJumpCounter) " << obs->prn().toString() << endl;
    452338          slip = true;
    453339        }
    454         if (!preProcessing) {
    455           _slips[obs->prn()]._biasJumpCounter = obs->biasJumpCounter();
    456         }
     340        _slips[obs->prn()]._biasJumpCounter = obs->biasJumpCounter();
     341
    457342        // Slip Set
    458343        // --------
    459344        if (slip) {
    460           if (preProcessing) {
    461             _obsPool->setRefSatChangeRequired(sys, true);
    462           } else {
     345          resetAmb(obs->prn(), obsVector, tLC);
     346        }
     347
     348        // Check Pre-Fit Residuals
     349        // -----------------------
     350        else {
     351          ColumnVector AA(params.size());
     352          for (unsigned iPar = 0; iPar < params.size(); iPar++) {
     353            const t_pppParam* par = params[iPar];
     354            AA[iPar] = par->partial(_epoTime, obs, tLC);
     355          }
     356
     357          double ll = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA);
     358          double vv = DotProduct(AA, _xFlt) - ll;
     359
     360          if (fabs(vv) > SLIP) {
     361            LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC) << ' '
     362                << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << vv << endl;
    463363            resetAmb(obs->prn(), obsVector, tLC);
    464364          }
    465365        }
    466         // Check Pre-Fit Residuals
    467         /* -----------------------
    468         else {
    469           if (!preProcessing) {
    470             ColumnVector AA(nPar);
    471             for (unsigned iPar = 0; iPar < nPar; iPar++) {
    472               const t_pppParam *par = params[iPar];
    473               AA[iPar] = par->partial(_epoTime, obs, tLC, refPrn);
    474             }
    475             double ll = obs->obsValue(tLC) - obs->cmpValue(tLC)
    476                       - DotProduct(_x0, AA);
    477             double vv = DotProduct(AA, _xFlt) - ll;
    478             if (fabs(vv) > SLIP) {
    479               LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC)
    480                   << ' ' << obs->prn().toString() << ' ' << setw(8)
    481                   << setprecision(4) << vv << endl;
    482               resetAmb(obs->prn(), obsVector, tLC);
    483             }
    484           }
    485         }*/
    486       }
    487     }
    488   }
     366      }
     367    }
     368  }
     369
    489370  return success;
    490371}
     
    496377
    497378  t_irc irc = failure;
    498   vector<t_pppParam*> &params = _parlist.params();
     379  vector<t_pppParam*>& params = _parlist->params();
    499380  for (unsigned iPar = 0; iPar < params.size(); iPar++) {
    500381    t_pppParam *par = params[iPar];
     
    506387      }
    507388      LOG << string(_epoTime) << " RESET " << par->toString() << endl;
    508       delete par;
    509       par = new t_pppParam(t_pppParam::amb, prn, tLC, &obsVector);
     389      delete par; par = new t_pppParam(t_pppParam::amb, prn, tLC, &obsVector);
    510390      par->setIndex(ind);
    511391      params[iPar] = par;
     
    532412}
    533413
    534 // Add infinite noise to iono
    535 ////////////////////////////////////////////////////////////////////////////
    536 t_irc t_pppFilter::addNoiseToPar(t_pppParam::e_type parType, char sys) {
    537   t_irc irc = failure;
    538   vector<t_pppParam*> &params = _parlist.params();
    539   for (unsigned iPar = 0; iPar < params.size(); iPar++) {
    540     t_pppParam *par = params[iPar];
    541     if (par->type() == parType && par->prn().system() == sys) {
    542       int ind = par->indexNew();
    543       LOG << string(_epoTime) << " ADD NOISE TO " << par->toString() << endl;
    544       par->setIndex(ind);
    545       _QFlt(ind + 1, ind + 1) = par->sigma0() * par->sigma0();
    546       irc = success;
    547     }
    548   }
    549 
    550   return irc;
    551 }
    552 
    553414// Compute various DOP Values
    554415////////////////////////////////////////////////////////////////////////////
    555 void t_pppFilter::cmpDOP(const vector<t_pppSatObs*> &obsVector,
    556     const QMap<char, t_pppRefSat*> &refSatMap) {
     416void t_pppFilter::cmpDOP(const vector<t_pppSatObs*> &obsVector) {
    557417
    558418  _dop.reset();
     
    564424    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    565425      t_pppSatObs *obs = obsVector[ii];
    566       char sys = obs->prn().system();
    567       t_prn refPrn = t_prn();
    568       if (OPT->_refSatRequired) {
    569         refPrn = refSatMap[sys]->prn();
    570       }
    571426      if (obs->isValid() && !obs->outlier()) {
    572427        ++_numSat;
    573428        for (unsigned iPar = 0; iPar < numPar; iPar++) {
    574           const t_pppParam *par = _parlist.params()[iPar];
    575           AA[_numSat - 1][iPar] = par->partial(_epoTime, obs, t_lc::c1, refPrn);
     429          const t_pppParam* par = _parlist->params()[iPar];
     430          AA[_numSat - 1][iPar] = par->partial(_epoTime, obs, t_lc::c1);
    576431        }
    577432      }
     
    581436    }
    582437    AA = AA.Rows(1, _numSat);
    583     SymmetricMatrix NN;
    584     NN << AA.t() * AA;
     438    SymmetricMatrix NN; NN << AA.t() * AA;
    585439    SymmetricMatrix QQ = NN.i();
    586440
     
    590444    _dop.T = sqrt(QQ(4, 4));
    591445    _dop.G = sqrt(QQ(1, 1) + QQ(2, 2) + QQ(3, 3) + QQ(4, 4));
    592   } catch (...) {
     446  }
     447  catch (...) {
    593448  }
    594449}
     
    598453void t_pppFilter::predictCovCrdPart(const SymmetricMatrix &QFltOld, bool setNeuNoiseToZero) {
    599454
    600   const vector<t_pppParam*> &params = _parlist.params();
     455  const vector<t_pppParam*>& params = _parlist->params();
     456
    601457  if (params.size() < 3) {
    602458    return;
     
    605461  bool first = (params[0]->indexOld() < 0);
    606462
    607   SymmetricMatrix Qneu(3);
    608   Qneu = 0.0;
     463  SymmetricMatrix Qneu(3); Qneu = 0.0;
    609464  for (unsigned ii = 0; ii < 3; ii++) {
    610465    const t_pppParam *par = params[ii];
    611466    if (first) {
    612467      Qneu[ii][ii] = par->sigma0() * par->sigma0();
    613     } else {
     468    }
     469    else {
    614470      Qneu[ii][ii] = par->noise() * par->noise();
    615471    }
     
    622478  if (first) {
    623479    _QFlt.SymSubMatrix(1, 3) = Qxyz;
    624   } else {
     480  }
     481  else {
    625482    double dt = _epoTime - _firstEpoTime;
    626483    if (dt < OPT->_seedingTime || setNeuNoiseToZero) {
    627484      _QFlt.SymSubMatrix(1, 3) = QFltOld.SymSubMatrix(1, 3);
    628     } else {
     485    }
     486    else {
    629487      _QFlt.SymSubMatrix(1, 3) = QFltOld.SymSubMatrix(1, 3) + Qxyz;
    630488    }
     
    637495    const SymmetricMatrix &QFltOld, bool setNeuNoiseToZero) {
    638496
    639   const vector<t_pppParam*> &params = _parlist.params();
     497  const vector<t_pppParam*>& params = _parlist->params();
    640498  unsigned nPar = params.size();
    641499
    642   _QFlt.ReSize(nPar);
    643   _QFlt = 0.0;
    644   _xFlt.ReSize(nPar);
    645   _xFlt = 0.0;
    646   _x0.ReSize(nPar);
    647   _x0 = 0.0;
     500  _QFlt.ReSize(nPar); _QFlt = 0.0;
     501  _xFlt.ReSize(nPar); _xFlt = 0.0;
     502  _x0.ReSize(nPar);   _x0   = 0.0;
    648503
    649504  for (unsigned ii = 0; ii < nPar; ii++) {
     
    671526}
    672527
    673 // Compute datum transformation
    674 ////////////////////////////////////////////////////////////////////////////
    675 t_irc t_pppFilter::datumTransformation(
    676     const QMap<char, t_pppRefSat*> &refSatMap) {
    677 
    678   // get last epoch
    679   t_pppObsPool::t_epoch *epoch = _obsPool->lastEpoch();
    680 #ifdef BNC_DEBUG_PPP
    681     LOG << "GET LAST EPOCH" << endl;
    682 #endif
    683   if (!epoch) {
    684     LOG << "t_pppFilter::datumTransformation: !lastEpoch" << endl;
    685     return failure;
    686   }
    687   _epoTime = epoch->epoTime();
    688 
    689   LOG.setf(ios::fixed);
    690   LOG  << "DATUM TRANSFORMATION in Epoch  "<<  string(_epoTime) << endl;
    691 
    692   vector<t_pppSatObs*> &allObs = epoch->obsVector();
    693 
    694   const QMap<char, t_pppRefSat*> &refSatMapLastEpoch = epoch->refSatMap();
    695 
    696   bool pseudoObsIono = epoch->pseudoObsIono();
    697 
    698   // reset old and set new refSats in last epoch (ambiguities/GIM)
    699   // =============================================================
    700   if (resetRefSatellitesLastEpoch(allObs, refSatMap, refSatMapLastEpoch) != true) {
    701     LOG << "datumTransformation: resetRefSatellitesLastEpoch != success"  << endl;
    702     return failure;
    703   }
    704 
    705   if (OPT->_obsModelType == OPT->UncombPPP) {
    706     _obsPool->putEpoch(_epoTime, allObs, pseudoObsIono, refSatMap);
    707     return success;
    708   }
    709 
    710   // set AA2
    711   // =======
    712   if (_parlist.set(_epoTime, allObs, refSatMap) != success) {
    713     return failure;
    714   }
    715 #ifdef BNC_DEBUG_PPP
    716   //_parlist.printParams(_epoTime);
    717 #endif
    718 
    719   const QList<char> &usedSystems = _parlist.usedSystems();
    720   for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
    721     char sys = usedSystems[iSys];
    722     t_prn refPrn = refSatMap[sys]->prn();
    723     vector<t_pppSatObs*> obsVector;
    724     for (unsigned jj = 0; jj < allObs.size(); jj++) {
    725       if (allObs[jj]->prn().system() == sys) {
    726         allObs[jj]->resetOutlier();
    727         obsVector.push_back(allObs[jj]);
    728       }
    729     }
    730     if (iSys == 0) {
    731       _datumTrafo->setFirstSystem(sys);
    732     }
    733     vector<t_lc::type> LCs = OPT->LCs(sys);
    734     unsigned usedLCs = LCs.size();
    735     if (OPT->_pseudoObsIono && !pseudoObsIono) {
    736       usedLCs -= 1;  // GIM not used
    737     }
    738     // max Obs
    739     unsigned maxObs = obsVector.size() * usedLCs;
    740 
    741     if (OPT->_pseudoObsIono && pseudoObsIono) {
    742       maxObs -= 1; // pseudo obs iono with respect to refSat
    743     }
    744 
    745     const vector<t_pppParam*> &params = _parlist.params();
    746     unsigned nPar = _parlist.nPar();
    747 
    748     Matrix AA(maxObs, nPar); AA = 0.0;
    749 
    750     // Real Observations
    751     // -----------------
    752     int iObs = -1;
    753     for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    754       t_pppSatObs *obs = obsVector[ii];
    755       for (unsigned jj = 0; jj < usedLCs; jj++) {
    756         const t_lc::type tLC = LCs[jj];
    757         if (tLC == t_lc::GIM) {
    758           continue;
    759         }
    760         ++iObs;
    761         for (unsigned iPar = 0; iPar < nPar; iPar++) {
    762           const t_pppParam *par = params[iPar];
    763           AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
    764         }
    765       }
    766     }
    767 
    768     if (!(iObs+1)) {
    769       continue;
    770     }
    771     _datumTrafo->updateIndices(sys, iObs + 1);
    772 
    773     if (_datumTrafo->prepareAA(AA.SubMatrix(1, iObs + 1, 1, nPar), 2)  != success) {
    774       return failure;
    775     }
    776   }
    777   _datumTrafo->updateNumObs();
    778 
    779   // Datum Transformation
    780   // ====================
    781   if (_datumTrafo->computeTrafoMatrix() != success) {
    782     return failure;
    783   }
    784 
    785   ColumnVector    xFltOld = _xFlt;
    786   SymmetricMatrix QFltOld = _QFlt;
    787 
    788   _QFlt << _datumTrafo->D21() * QFltOld * _datumTrafo->D21().t();
    789   _xFlt = _datumTrafo->D21() * xFltOld;
    790 
    791 #ifdef BNC_DEBUG_PPP
    792 //  LOG << "xFltOld:\n" << xFltOld << endl;
    793 //  LOG << "xFlt   :\n" << _xFlt   << endl;
    794 #endif
    795 
    796   // Reset Ambiguities after Datum Transformation
    797   // ============================================
    798   for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
    799     char sys = usedSystems[iSys];
    800     vector<t_lc::type> LCs = OPT->LCs(sys);
    801     unsigned usedLCs = LCs.size();
    802     if (OPT->_pseudoObsIono && !pseudoObsIono) {
    803       usedLCs -= 1;  // GIM not used
    804     }
    805     t_prn refPrnOld = refSatMapLastEpoch[sys]->prn();
    806     t_prn refPrnNew = refSatMap[sys]->prn();
    807     if (refPrnNew != refPrnOld) {
    808       for (unsigned jj = 0; jj < usedLCs; jj++) {
    809         const t_lc::type tLC = LCs[jj];
    810         if (tLC == t_lc::GIM) {
    811           continue;
    812         }
    813         resetAmb(refPrnOld, allObs, tLC);
    814       }
    815     }
    816   }
    817 
    818   // switch AA2 to AA1
    819   // =================
    820   _datumTrafo->switchAA();
    821 
    822   _obsPool->putEpoch(_epoTime, allObs, pseudoObsIono, refSatMap);
    823 #ifdef BNC_DEBUG_PPP
    824   LOG << "PUT EPOCH t_pppFilter::datumTransformation " << _epoTime.timestr().c_str() << endl;
    825 #endif
    826 
    827   return success;
    828 }
    829 
    830 // Init datum transformation
    831 ////////////////////////////////////////////////////////////////////////////
    832 void t_pppFilter::initDatumTransformation(
    833     const std::vector<t_pppSatObs*> &allObs, bool pseudoObsIono) {
    834   unsigned trafoObs = 0;
    835   const QList<char> &usedSystems = _parlist.usedSystems();
    836   for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
    837     char sys = usedSystems[iSys];
    838     int satNum = 0;
    839     for (unsigned jj = 0; jj < allObs.size(); jj++) {
    840       if (allObs[jj]->prn().system() == sys) {
    841         satNum++;
    842       }
    843     }
    844     // all LCs
    845     unsigned realUsedLCs = OPT->LCs(sys).size();
    846     // exclude pseudo obs GIM
    847     if (OPT->_pseudoObsIono && !pseudoObsIono) {
    848       realUsedLCs -= 1;
    849     }
    850 
    851     trafoObs += satNum * realUsedLCs;
    852 
    853     if (OPT->_pseudoObsIono && pseudoObsIono) {
    854       trafoObs -= 1; // pseudo obs iono with respect to refSat
    855     }
    856   }
    857   _datumTrafo->setNumObs(trafoObs);
    858   _datumTrafo->setNumPar(_parlist.nPar());
    859   _datumTrafo->initAA();
    860 }
    861 
    862 //
    863 //////////////////////////////////////////////////////////////////////////////
    864 bool t_pppFilter::resetRefSatellitesLastEpoch(
    865     std::vector<t_pppSatObs*> &obsVector,
    866     const QMap<char, t_pppRefSat*> &refSatMap,
    867     const QMap<char, t_pppRefSat*> &refSatMapLastEpoch) {
    868   bool resetRefSat;
    869   // reference satellite definition per system
    870   const QList<char> &usedSystems = _parlist.usedSystems();
    871   for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
    872     resetRefSat = false;
    873     char sys = usedSystems[iSys];
    874     t_prn newPrn = refSatMap[sys]->prn();
    875     t_prn oldPrn = refSatMapLastEpoch[sys]->prn();
    876 #ifdef BNC_DEBUG_PPP
    877     if (oldPrn != newPrn) {
    878       LOG << "oldRef: " << oldPrn.toString() << " => newRef " <<  newPrn.toString() << endl;
    879     }
    880 #endif
    881     vector<t_pppSatObs*>::iterator it = obsVector.begin();
    882     while (it != obsVector.end()) {
    883       t_pppSatObs *satObs = *it;
    884       if (satObs->prn() == newPrn) {
    885         resetRefSat = true;
    886         satObs->setAsReference();
    887       } else if (satObs->prn() == oldPrn) {
    888         satObs->resetReference();
    889       }
    890       it++;
    891     }
    892     if (!resetRefSat) {
    893       _obsPool->setRefSatChangeRequired(sys, true);
    894       return resetRefSat;
    895     }
    896   }
    897   return resetRefSat;
    898 }
  • trunk/BNC/src/PPP/pppFilter.h

    r10028 r10034  
    88#include "bnctime.h"
    99#include "t_prn.h"
    10 #include "pppClient.h"
    1110
    1211namespace BNC_PPP {
     
    1817class t_pppFilter {
    1918 public:
    20   t_pppFilter(t_pppObsPool* obsPool);
     19  t_pppFilter();
    2120  ~t_pppFilter();
    2221
    23   t_irc processEpoch(int num);
     22  t_irc processEpoch(t_pppObsPool* obsPool);
    2423
    2524  const ColumnVector&    x() const {return _xFlt;}
    2625  const SymmetricMatrix& Q() const {return _QFlt;}
    27 
    28   t_irc datumTransformation(const QMap<char, t_pppRefSat*>& refSatMap);
    29   void initDatumTransformation(const std::vector<t_pppSatObs*>& allObs, bool pseudoObsIono);
    30   unsigned setTrafoObs();
    31   void restoreState(int num)  {
    32 #ifdef BNC_DEBUG_PPP
    33     LOG << "Restore parameter from last successful epoch: _parlist = _parlist_sav ("<<  num << ")\n";
    34 #endif
    35     _QFlt    = _QFlt_sav;
    36     _parlist = _parlist_sav;
    37   }
    38   void rememberState(int num) {
    39 #ifdef BNC_DEBUG_PPP
    40     LOG << "Remember parameters from successful epoch   : _parlist_sav = _parlist ("<<  num << ")\n";
    41 #endif
    42     _QFlt_sav    = _QFlt;
    43     _parlist_sav = _parlist;
    44   }
    4526
    4627  int    numSat() const {return _numSat;}
     
    5031  double GDOP() const {return _dop.G;}
    5132  double trp() const {
    52     const std::vector<t_pppParam*>& par = _parlist.params();
     33    const std::vector<t_pppParam*>& par = _parlist->params();
    5334    for (unsigned ii = 0; ii < par.size(); ++ii) {
    5435      if (par[ii]->type() == t_pppParam::trp) {
     
    5940  };
    6041  double trpStdev() const {
    61     const std::vector<t_pppParam*>& par = _parlist.params();
     42    const std::vector<t_pppParam*>& par = _parlist->params();
    6243    for (unsigned ii = 0; ii < par.size(); ++ii) {
    6344      if (par[ii]->type() == t_pppParam::trp) {
     
    9273  };
    9374
    94   class t_datumTrafo {
    95   public:
    96     t_datumTrafo () {initIndices();}
    97     ~t_datumTrafo (){}
    98 
    99     void initIndices() {_firstRow = 1; _lastRow = 0;}
    100     void updateIndices(char sys, int maxObsSys) {
    101       if (firstSystem(sys)) {
    102         initIndices();
    103       }
    104       else {
    105         _firstRow = _lastRow + 1;
    106       }
    107       _lastRow += maxObsSys;
    108 
    109     };
    110 
    111     void setFirstSystem(char firstSys) { _firstSys = firstSys;}
    112     bool firstSystem(char sys) {
    113       if (_firstSys == sys) {
    114         return true;
    115       }
    116       return false;
    117     }
    118     void setNumObs(int maxObs) {_maxObs = maxObs;}
    119     void setNumPar(int numPar) {_numPar = numPar;}
    120     int numPar() {return _numPar;}
    121     int numObs() {return _maxObs;}
    122     void updateNumObs() {
    123       _maxObs = _lastRow;
    124       _AA1 = _AA1.SubMatrix(1, _lastRow, 1, _numPar);
    125       _AA2 = _AA2.SubMatrix(1, _lastRow, 1, _numPar);
    126     }
    127 
    128     const Matrix& AA1() {return _AA1;}
    129     const Matrix& AA2() {return _AA2;}
    130     const Matrix& D21() {return _D21;}
    131 
    132     void initAA() {
    133       _AA1.ReSize(_maxObs, _numPar); _AA1 = 0.0;
    134       _AA2.ReSize(_maxObs, _numPar); _AA2 = 0.0;
    135       _D21.ReSize(_numPar, _numPar); _D21 = 0.0;
    136     }
    137     t_irc prepareAA(const Matrix& AA, int ind) {
    138 
    139       Matrix* Prep = &_AA2;
    140       if (ind == 1) {
    141         Prep = &_AA1;
    142       }
    143       if (AA.Ncols() != _numPar) {
    144         LOG << "t_pppFilter::prepareAA: AA.Ncols() != _numPar: " << AA.Ncols() << " != " << _numPar << "\n RETURN FAILURE" <<  std::endl;
    145         return failure;
    146       }
    147       Prep->SubMatrix(_firstRow, _lastRow, 1, _numPar) = AA;
    148       return success;
    149     }
    150     void switchAA() {
    151       _AA1 = _AA2;
    152     }
    153     t_irc computeTrafoMatrix() {
    154       if (((_AA2.t() * _AA2)).Determinant() == 0.0) {
    155         LOG << "t_pppFilter::computeTrafoMatrix: (_AA2.t() * _AA2).inv() is singular" << std::endl;
    156         return failure;
    157       }
    158       _D21 = ((_AA2.t() * _AA2).i()) * _AA2.t() * _AA1;
    159       return success;
    160     }
    161 
    162     void printMatrix(const Matrix& X, int nRow, int nCol) {
    163       for (int rr = 0; rr < nRow; rr++) {
    164         for (int cc = 0; cc < nCol; cc++) {
    165           LOG << std::setw(6) << std::setprecision(3) << X[rr][cc] << " ;";
    166         }
    167         LOG << std::endl;
    168       }
    169       LOG << std::endl;
    170     }
    171   private:
    172     int               _firstRow;
    173     int               _lastRow;
    174     Matrix            _AA1;
    175     Matrix            _AA2;
    176     Matrix            _D21;
    177     char              _firstSys;
    178     int               _maxObs;
    179     int               _numPar;
    180     QMap<char, t_prn> _refSatMapPseudoObs;
    181   };
    182 
    18375  t_irc processSystem(const std::vector<t_lc::type>& LCs,
    18476                      const std::vector<t_pppSatObs*>& obsVector,
    185                       const t_prn& refPrn,
    186                       bool pseudoObsIonoAvailable,
    187                       bool preProcessing);
     77                      bool pseudoObsIonoAvailable);
    18878
    18979  t_irc detectCycleSlips(const std::vector<t_lc::type>& LCs,
    190                          const std::vector<t_pppSatObs*>& obsVector,
    191                          const t_prn& refPrn,
    192                          bool preProcessing);
     80                         const std::vector<t_pppSatObs*>& obsVector);
    19381
    19482  t_irc resetAmb(t_prn prn, const std::vector<t_pppSatObs*>& obsVector, t_lc::type lc,
    19583                 SymmetricMatrix* QSav = 0, ColumnVector* xSav = 0);
    19684
    197   void cmpDOP(const std::vector<t_pppSatObs*>& obsVector,
    198               const QMap<char, t_pppRefSat*>& refSatMap);
     85  void cmpDOP(const std::vector<t_pppSatObs*>& obsVector);
    19986
    20087  void setStateVectorAndVarCovMatrix(const ColumnVector& xFltOld, const SymmetricMatrix& QFltOld,
     
    20390  void predictCovCrdPart(const SymmetricMatrix& QFltOld, bool setNeuNoiseToZero);
    20491
    205   t_irc addNoiseToPar(t_pppParam::e_type parType, char sys);
    206 
    207   bool resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector,
    208                                    const QMap<char, t_pppRefSat*>& refSatMap,
    209                                    const QMap<char, t_pppRefSat*>& refSatMapLastEpoch);
    210 
    21192  bncTime         _epoTime;
    212   t_pppParlist    _parlist;
    213   t_pppParlist    _parlist_sav;
    214   t_pppObsPool*   _obsPool;
    215   t_datumTrafo*   _datumTrafo;
     93  t_pppParlist*   _parlist;
    21694  SymmetricMatrix _QFlt;
    217   SymmetricMatrix _QFlt_sav;
    21895  ColumnVector    _xFlt;
    21996  ColumnVector    _x0;
     
    223100  bncTime         _firstEpoTime;
    224101  bncTime         _lastEpoTimeOK;
    225   t_prn           _refPrn;
    226102};
    227103
  • trunk/BNC/src/PPP/pppObsPool.cpp

    r10018 r10034  
    2323/////////////////////////////////////////////////////////////////////////////
    2424t_pppObsPool::t_epoch::t_epoch(const bncTime& epoTime, vector<t_pppSatObs*>& obsVector,
    25                                bool pseudoObsIono, const QMap<char, t_pppRefSat*>& refSatMap) {
     25                               bool pseudoObsIono) {
    2626  _epoTime        = epoTime;
    2727  _pseudoObsIono  = pseudoObsIono;
     
    3030  }
    3131  obsVector.clear();
    32 
    33   QMapIterator<char, t_pppRefSat*> it(refSatMap);
    34   while (it.hasNext()) {
    35     it.next();
    36     char sys = it.key();
    37     t_pppRefSat* refSat = it.value();
    38     _refSatMap[sys] = new t_pppRefSat(refSat->prn(), refSat->stecValue());
    39   }
    40   //refSatMap.clear();
    4132}
    4233
     
    4738    delete _obsVector[ii];
    4839  }
    49 
    50   QMapIterator<char, t_pppRefSat*> it(_refSatMap);
    51   while (it.hasNext()) {
    52     it.next();
    53     delete it.value();
    54   }
    55   _refSatMap.clear();
    5640}
    5741
     
    6650  }
    6751  _vTec = 0;
    68   _refSatChangeRequiredMap['G'] = false;
    69   _refSatChangeRequiredMap['R'] = false;
    70   _refSatChangeRequiredMap['E'] = false;
    71   _refSatChangeRequiredMap['C'] = false;
    72 
    7352}
    7453
     
    11695/////////////////////////////////////////////////////////////////////////////
    11796void t_pppObsPool::putEpoch(const bncTime& epoTime, vector<t_pppSatObs*>& obsVector,
    118                             bool pseudoObsIono, const QMap<char, t_pppRefSat*>& refSatMap) {
     97                            bool pseudoObsIono) {
    11998  const unsigned MAXSIZE = 2;
    120   _epochs.push_back(new t_epoch(epoTime, obsVector, pseudoObsIono, refSatMap));
     99  _epochs.push_back(new t_epoch(epoTime, obsVector, pseudoObsIono));
    121100
    122101  if (_epochs.size() > MAXSIZE) {
     
    125104  }
    126105}
    127 
    128 //
    129 /////////////////////////////////////////////////////////////////////////////
    130 void t_pppObsPool::deleteLastEpoch() {
    131 
    132   if (!_epochs.empty()) {
    133     //LOG << " " << _epochs.back()->epoTime().timestr().c_str() << endl;
    134     delete _epochs.back();
    135     _epochs.pop_back();
    136   }
    137 }
  • trunk/BNC/src/PPP/pppObsPool.h

    r9508 r10034  
    44#include <vector>
    55#include <deque>
    6 #include <QMap>
    76#include <iostream>
    87#include "pppSatObs.h"
    98#include "bnctime.h"
    10 #include "pppRefSat.h"
    119
    1210namespace BNC_PPP {
     
    1816   public:
    1917    t_epoch(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector,
    20             bool pseudoObsIono, const QMap<char, t_pppRefSat*>& refSatMap);
     18            bool pseudoObsIono);
    2119    ~t_epoch();
    2220          std::vector<t_pppSatObs*>& obsVector() {return _obsVector;}
    2321    const std::vector<t_pppSatObs*>& obsVector() const {return _obsVector;}
    24     const QMap<char, t_pppRefSat*>& refSatMap() const {return _refSatMap;}
    2522    const bncTime& epoTime() const {return _epoTime;}
    2623    bool pseudoObsIono() const {return _pseudoObsIono;}
     
    2926    bool                      _pseudoObsIono;
    3027    std::vector<t_pppSatObs*> _obsVector;
    31     QMap<char, t_pppRefSat*>  _refSatMap;
    3228  };
    3329
     
    3935
    4036  void putEpoch(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector,
    41                 bool pseudoObsIono, const QMap<char, t_pppRefSat*>& refSatMap);
    42 
    43   void deleteLastEpoch();
     37                bool pseudoObsIono);
    4438
    4539  const t_satCodeBias* satCodeBias(const t_prn& prn) const {
     
    6054  }
    6155
    62   // RefSat change required in current epoch
    63   // =======================================
    64   void setRefSatChangeRequired(char sys, bool refSatChangeRequired) {
    65     _refSatChangeRequiredMap[sys] = refSatChangeRequired;
    66   }
    67   bool refSatChangeRequired() {
    68     QMapIterator<char, bool> it(_refSatChangeRequiredMap);
    69       while (it.hasNext()) {
    70         it.next();
    71         if (it.value() == true) {
    72           return true;
    73         }
    74       }
    75     return false;
    76   }
    77   bool refSatChangeRequired(char sys) {
    78     return _refSatChangeRequiredMap[sys];
    79   }
    80 
    81   // RefSat changed in current epoch (different from last epoch)
    82   // ===========================================================
    83   void setRefSatChanged(char sys, bool refSatChanged) {
    84     _refSatChangedMap[sys] = refSatChanged;
    85   }
    86   bool refSatChanged() {
    87     QMapIterator<char, bool> it(_refSatChangedMap);
    88       while (it.hasNext()) {
    89         it.next();
    90         if (it.value() == true) {
    91           return true;
    92         }
    93       }
    94     return false;
    95   }
    96   bool refSatChanged(char sys) {
    97     return _refSatChangedMap[sys];
    98   }
    99 
    10056 private:
    10157  t_satCodeBias*           _satCodeBiases[t_prn::MAXPRN+1];
     
    10359  t_vTec*                  _vTec;
    10460  std::deque<t_epoch*>     _epochs;
    105   QMap<char, bool>         _refSatChangeRequiredMap;
    106   QMap<char, bool>         _refSatChangedMap;
    10761};
    10862
  • trunk/BNC/src/PPP/pppParlist.cpp

    r10031 r10034  
    6262     _noise   = OPT->_noiseCrd[2];
    6363     break;
    64    case rClkG:
    65      _epoSpec = true;
    66      _sigma0  = OPT->_aprSigClk;
    67      break;
    68    case rClkR:
    69      _epoSpec = true;
    70      _sigma0  = OPT->_aprSigClk;
    71      break;
    72    case rClkE:
    73      _epoSpec = true;
    74      _sigma0  = OPT->_aprSigClk;
    75      break;
    76    case rClkC:
     64   case clkR:
    7765     _epoSpec = true;
    7866     _sigma0  = OPT->_aprSigClk;
     
    8674         const t_pppSatObs* obs = obsVector->at(ii);
    8775         if (obs->prn() == _prn) {
    88            _x0 = floor((obs->obsValue(tLC) - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
     76           double offGlo = 0;
     77           if (_prn.system() == 'R' && tLC != t_lc::MW) {
     78             offGlo = PPP_CLIENT->offGlo();
     79           }
     80           double offGal = 0;
     81           if (_prn.system() == 'E' && tLC != t_lc::MW) {
     82             offGal = PPP_CLIENT->offGal();
     83           }
     84           double offBds = 0;
     85           if (_prn.system() == 'C' && tLC != t_lc::MW) {
     86             offBds = PPP_CLIENT->offBds();
     87           }
     88           _x0 = floor((obs->obsValue(tLC) - offGlo - offGal - offBds - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
    8989           break;
    9090         }
    9191       }
    9292     }
     93     break;
     94   case offGlo:
     95     _epoSpec = true;
     96     _sigma0  = OPT->_aprSigClk;
     97     _x0      = PPP_CLIENT->offGlo();
     98     break;
     99   case offGal:
     100     _epoSpec = true;
     101     _sigma0  = OPT->_aprSigClk;
     102     _x0      = PPP_CLIENT->offGal();
     103     break;
     104   case offBds:
     105     _epoSpec = true;
     106     _sigma0  = OPT->_aprSigClk;
     107     _x0      = PPP_CLIENT->offBds();
    93108     break;
    94109   case trp:
     
    117132}
    118133
    119 //
    120 ////////////////////////////////////////////////////////////////////////////
    121 t_pppParam::t_pppParam(const t_pppParam* old) {
    122   _type     = old->type();
    123   _prn      = old->prn();
    124   _tLC      = old->tLC();
    125   _indexOld = old->indexOld();
    126   _indexNew = old->indexNew();
    127   _noise    = old->noise();
    128   _sigma0   = old->sigma0();
    129   _epoSpec  = old->epoSpec();
    130   _x0       = old->x0();
    131   setFirstObsTime(old->firstObsTime());
    132   setLastObsTime(old->lastObsTime());
    133   _ambInfo  = 0;
    134   if (_type == t_pppParam::amb) {
    135     _ambInfo  = new t_ambInfo();
    136     _ambInfo->_resetCandidate = old->_ambInfo->_resetCandidate;
    137     _ambInfo->_eleSat         = old->_ambInfo->_eleSat;
    138     _ambInfo->_numEpo         = old->_ambInfo->_numEpo;
    139   }
    140 }
    141 
    142134// Destructor
    143135////////////////////////////////////////////////////////////////////////////
     
    150142////////////////////////////////////////////////////////////////////////////
    151143double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs,
    152                            const t_lc::type& tLC, const t_prn refPrn) const {
     144                           const t_lc::type& tLC) const {
    153145
    154146  // Special Case - Melbourne-Wuebbena
     
    176168    if (tLC == t_lc::GIM) {return 0.0;}
    177169    return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius();
    178   case rClkG:
     170  case clkR:
    179171    if (tLC == t_lc::GIM) {return 0.0;}
    180     return (obs->prn().system() == 'G') ? 1.0 : 0.0;
    181   case rClkR:
     172    return 1.0;
     173  case offGlo:
    182174    if (tLC == t_lc::GIM) {return 0.0;}
    183175    return (obs->prn().system() == 'R') ? 1.0 : 0.0;
    184   case rClkE:
     176  case offGal:
    185177    if (tLC == t_lc::GIM) {return 0.0;}
    186178    return (obs->prn().system() == 'E') ? 1.0 : 0.0;
    187   case rClkC:
     179  case offBds:
    188180    if (tLC == t_lc::GIM) {return 0.0;}
    189181    return (obs->prn().system() == 'C') ? 1.0 : 0.0;
    190182  case amb:
    191     if      (tLC == t_lc::GIM) {return 0.0;}
    192     else if ((OPT->_obsModelType == OPT->IF)     ||
    193              (OPT->_obsModelType == OPT->PPPRTK) ||
    194              (OPT->_obsModelType == OPT->UncombPPP) ||
    195              (OPT->_obsModelType == OPT->DCMcodeBias  && !obs->isReference()) ||
    196              (OPT->_obsModelType == OPT->DCMphaseBias && !obs->isReference())   ) {
    197 
     183    if (tLC == t_lc::GIM) {
     184      return 0.0;
     185    }
     186    else {
    198187      if (obs->prn() == _prn) {
    199188        if      (tLC == _tLC) {
     
    236225      }
    237226      else if (tLC == t_lc::GIM) {
    238         return -1.0;
    239       }
    240     }
    241     if (tLC == t_lc::GIM && _prn == refPrn) {
    242       return 1.0;
     227        return 1.0;
     228      }
    243229    }
    244230    break;
     
    310296    ss << "CRD_Z";
    311297    break;
    312   case rClkG:
    313     ss << "REC_CLK  G  ";
    314     break;
    315   case rClkR:
    316     ss << "REC_CLK  R  ";
    317     break;
    318   case rClkE:
    319     ss << "REC_CLK  E  ";
    320     break;
    321   case rClkC:
    322     ss << "REC_CLK  C  ";
     298  case clkR:
     299    ss << "REC_CLK     ";
     300    break;
     301  case offGlo:
     302    ss << "OFF_GLO     ";
     303    break;
     304  case offGal:
     305    ss << "OFF_GAL     ";
     306    break;
     307  case offBds:
     308    ss << "OFF_BDS     ";
    323309    break;
    324310  case trp:
     
    361347  _usedSystems.clear();
    362348
    363   vector<t_pppParam*>::iterator it = _params.begin();
    364   while (it != _params.end()) {
    365     t_pppParam* par = *it;
    366     delete par;
    367     it = _params.erase(it);
     349  for (unsigned ii = 0; ii < _params.size(); ii++) {
     350    delete _params[ii];
    368351  }
    369352}
     
    371354//
    372355////////////////////////////////////////////////////////////////////////////
    373 t_pppParlist::t_pppParlist(const t_pppParlist& old) {
    374 
    375   _usedSystems = old._usedSystems;
    376 
    377   vector<t_pppParam*>::const_iterator it = old.params().begin();
    378   while (it != old.params().end()) {
    379     const t_pppParam* oldParam = *it;
    380     _params.push_back(new t_pppParam(oldParam));
    381   }
    382 }
    383 
    384 //
    385 ////////////////////////////////////////////////////////////////////////////
    386 const t_pppParlist& t_pppParlist::operator= (const t_pppParlist& p) {
    387 
    388   _usedSystems.clear();
    389 
    390   _usedSystems = p._usedSystems;
    391 
    392   vector<t_pppParam*>::iterator it = _params.begin();
    393   while (it != _params.end()) {
    394     t_pppParam* par = *it;
    395     delete par;
    396     it = _params.erase(it);
    397   }
    398 
    399   for (unsigned jj = 0; jj < p.params().size(); jj++) {
    400     t_pppParam* parFrom = p.params()[jj];
    401     _params.push_back(new t_pppParam(parFrom));
    402   }
    403   return *this;
    404 }
    405 
    406 //
    407 ////////////////////////////////////////////////////////////////////////////
    408 t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector,
    409     const QMap<char, t_pppRefSat*>& refSatMap) {
     356t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector) {
    410357
    411358  // Remove some Parameters
     
    421368    }
    422369
    423     else if (par->type() == t_pppParam::crdX ||
     370    else if (par->type() == t_pppParam::amb  ||
     371             par->type() == t_pppParam::ion  ||
     372             par->type() == t_pppParam::crdX ||
    424373             par->type() == t_pppParam::crdY ||
    425374             par->type() == t_pppParam::crdZ) {
     
    429378    }
    430379
    431     else if (par->type() == t_pppParam::amb) {
    432       if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
    433           remove = true;
    434       }
    435       if (OPT->_obsModelType == OPT->DCMcodeBias ||
    436           OPT->_obsModelType == OPT->DCMphaseBias) {
    437         char sys = par->prn().system();
    438         t_prn refPrn = (refSatMap[sys])->prn();
    439         if (par->lastObsTime().valid() && par->prn() == refPrn) {
    440             remove = true;
    441         }
    442       }
    443     }
    444 
    445     else if (par->type() == t_pppParam::ion) {
    446       if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
    447           remove = true;
    448       }
    449     }
    450380    if (remove) {
    451381#ifdef BNC_DEBUG_PPP
     
    495425  }
    496426
    497   if (OPT->_obsModelType == OPT->DCMcodeBias ||
    498       OPT->_obsModelType == OPT->DCMphaseBias) {
    499     // Check if ambiguity parameters have observations
    500     // -----------------------------------------------
     427  if (OPT->_obsModelType == OPT->PPPRTK || OPT->_pseudoObsIono) {
    501428    vector<t_pppParam*>::iterator it = _params.begin();
    502     QList<t_prn> lostSats;
    503429    while (it != _params.end()) {
    504430      t_pppParam* par = *it;
    505       if ((par->type() == t_pppParam::amb) &&
    506           (!par->lastObsTime().valid() || (epoTime - par->lastObsTime() > 0.0))) {
    507 #ifdef BNC_DEBUG_PPP
    508         //LOG << "remove1 " << par->toString() << std::endl;
    509 #endif
    510         lostSats.append(par->prn());
    511         delete par;
    512         it = _params.erase(it);
    513       }
    514431      // Check if systems have to be presented per biases
    515432      // ----------------------------------------------
    516       else if ((par->type() == t_pppParam::cBiasG1 ||
     433      if ((     par->type() == t_pppParam::cBiasG1 ||
    517434                par->type() == t_pppParam::cBiasG2 ||
    518435                par->type() == t_pppParam::pBiasG1 ||
     
    558475      }
    559476    }
    560     // remove respective iono parameters
    561     // ---------------------------------
    562     it = _params.begin();
    563     while (it != _params.end()) {
    564       t_pppParam* par = *it;
    565       if ((par->type() == t_pppParam::ion) &&
    566           (lostSats.contains(par->prn()) || (epoTime - par->lastObsTime() > 0.0))) {
    567 #ifdef BNC_DEBUG_PPP
    568        //LOG << "remove1 " << par->toString() << std::endl;
    569 #endif
    570         delete par;
    571         it = _params.erase(it);
    572       }
    573       else {
    574         ++it;
    575       }
    576     }
    577   }
    578 
     477  }
    579478
    580479  // Required Set of Parameters
     
    588487  required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn(), t_lc::dummy));
    589488
     489  // Receiver Clock
     490  // --------------
     491  required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy));
     492
     493  // GLONASS Clock Offset
     494  // --------------------
     495  if ( _usedSystems.contains('R')  &&
     496      (_usedSystems.contains('G') || _usedSystems.contains('E') || _usedSystems.contains('C'))) {
     497    required.push_back(new t_pppParam(t_pppParam::offGlo, t_prn(), t_lc::dummy));
     498  }
     499
     500  // Galileo Clock Offset
     501  // --------------------
     502  if (_usedSystems.contains('E') && _usedSystems.contains('G')) {
     503    required.push_back(new t_pppParam(t_pppParam::offGal, t_prn(), t_lc::dummy));
     504  }
     505
     506  // BDS Clock Offset
     507  // ----------------
     508  if (_usedSystems.contains('C')  && (_usedSystems.contains('G') || _usedSystems.contains('E'))) {
     509    required.push_back(new t_pppParam(t_pppParam::offBds, t_prn(), t_lc::dummy));
     510  }
     511
     512  // Troposphere
     513  // -----------
     514  if (OPT->estTrp()) {
     515    required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
     516  }
     517
     518  // Ionosphere
     519  // ----------
     520  if (OPT->_obsModelType == OPT->UncombPPP) {
     521    for (unsigned jj = 0; jj < obsVector.size(); jj++) {
     522      const t_pppSatObs* satObs = obsVector[jj];
     523      required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
     524    }
     525  }
     526  // Ambiguities
     527  // -----------
     528  for (unsigned jj = 0; jj < obsVector.size(); jj++) {
     529    const t_pppSatObs*  satObs = obsVector[jj];
     530    const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system());
     531    for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
     532      required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
     533    }
     534  }
     535
    590536  // Receiver Code Biases
    591537  // --------------------
    592   if (OPT->_obsModelType == OPT->DCMcodeBias) {
     538  if (OPT->_obsModelType == OPT->PPPRTK) {
    593539    std::vector<t_lc::type> lc;
    594540    if (_usedSystems.contains('G')) {
     
    629575    }
    630576  }
     577  if (OPT->_pseudoObsIono) {
     578    std::vector<t_lc::type> lc;
     579    if (_usedSystems.contains('G')) {
     580      lc = OPT->LCs('G');
     581      if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
     582        required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
     583      }
     584    }
     585    if (_usedSystems.contains('R')) {
     586      lc = OPT->LCs('R');
     587      if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
     588        required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
     589      }
     590    }
     591    if (_usedSystems.contains('E')) {
     592      lc = OPT->LCs('E');
     593      if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
     594        required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
     595      }
     596    }
     597    if (_usedSystems.contains('C')) {
     598      lc = OPT->LCs('C');
     599      if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
     600        required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
     601      }
     602    }
     603  }
    631604
    632605  // Receiver Phase Biases
    633606  // ---------------------
    634   if ((OPT->_obsModelType == OPT->DCMphaseBias) ||
    635       (OPT->_obsModelType == OPT->PPPRTK)     ) {
     607  if (OPT->_obsModelType == OPT->PPPRTK) {
    636608    std::vector<t_lc::type> lc;
    637609    if (_usedSystems.contains('G')) {
     
    669641      if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
    670642        required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2));
    671       }
    672     }
    673   }
    674 
    675   // Receiver Clocks
    676   // ---------------
    677    if (_usedSystems.contains('G')) {
    678      required.push_back(new t_pppParam(t_pppParam::rClkG, t_prn(), t_lc::dummy));
    679    }
    680 
    681    if (_usedSystems.contains('R')) {
    682      required.push_back(new t_pppParam(t_pppParam::rClkR, t_prn(), t_lc::dummy));
    683    }
    684 
    685    if (_usedSystems.contains('E')) {
    686      required.push_back(new t_pppParam(t_pppParam::rClkE, t_prn(), t_lc::dummy));
    687    }
    688 
    689    if (_usedSystems.contains('C')) {
    690      required.push_back(new t_pppParam(t_pppParam::rClkC, t_prn(), t_lc::dummy));
    691    }
    692 
    693   // Troposphere
    694   // -----------
    695   if (OPT->estTrp()) {
    696     required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
    697   }
    698 
    699   // Ionosphere
    700   // ----------
    701   if (OPT->_obsModelType == OPT->UncombPPP    ||
    702       OPT->_obsModelType == OPT->DCMcodeBias  ||
    703       OPT->_obsModelType == OPT->DCMphaseBias   ) {
    704     for (unsigned jj = 0; jj < obsVector.size(); jj++) {
    705       const t_pppSatObs* satObs = obsVector[jj];
    706       required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
    707     }
    708   }
    709   // Ambiguities
    710   // -----------
    711   for (unsigned jj = 0; jj < obsVector.size(); jj++) {
    712     const t_pppSatObs*  satObs = obsVector[jj];
    713     if ((OPT->_obsModelType == OPT->IF)        ||
    714         (OPT->_obsModelType == OPT->PPPRTK)    ||
    715         (OPT->_obsModelType == OPT->UncombPPP) ||
    716         (OPT->_obsModelType == OPT->DCMcodeBias  && !satObs->isReference()) ||
    717         (OPT->_obsModelType == OPT->DCMphaseBias && !satObs->isReference())   ) {
    718       const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system());
    719       for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
    720         required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
    721643      }
    722644    }
     
    779701  t_pppParam* parY = 0;
    780702  t_pppParam* parZ = 0;
    781   vector<t_pppParam*>::const_iterator it = _params.begin();
    782   while (it != _params.end()) {
    783     t_pppParam* par = *it;
     703  for (unsigned ii = 0; ii < _params.size(); ii++) {
     704    t_pppParam* par = _params[ii];
    784705    if      (par->type() == t_pppParam::crdX) {
    785706      parX = par;
     
    805726      LOG << endl;
    806727    }
    807     ++it;
    808728  }
    809729
  • trunk/BNC/src/PPP/pppParlist.h

    r10023 r10034  
    77#include "t_prn.h"
    88#include "bnctime.h"
    9 #include "pppRefSat.h"
    109
    1110namespace BNC_PPP {
     
    1514class t_pppParam {
    1615 public:
    17   enum e_type {crdX, crdY, crdZ, rClkG, rClkR, rClkE, rClkC, trp, ion, amb,
     16  enum e_type {crdX, crdY, crdZ, clkR, offGlo, offGal, offBds, trp, ion, amb,
    1817               cBiasG1, cBiasR1, cBiasE1, cBiasC1, pBiasG1, pBiasR1, pBiasE1, pBiasC1,
    1918               cBiasG2, cBiasR2, cBiasE2, cBiasC2, pBiasG2, pBiasR2, pBiasE2, pBiasC2};
    2019
    2120  t_pppParam(e_type type, const t_prn& prn, t_lc::type tLC, const std::vector<t_pppSatObs*>* obsVector = 0);
    22   t_pppParam(const t_pppParam* old);
    2321  ~t_pppParam();
    2422
    2523  e_type type() const {return _type;}
    2624  double x0()  const {return _x0;}
    27   double partial(const bncTime& epoTime, const t_pppSatObs* obs,
    28                  const t_lc::type& tLC, const t_prn refPrn) const;
     25  double partial(const bncTime& epoTime, const t_pppSatObs* obs, 
     26                 const t_lc::type& tLC) const;
    2927  bool   epoSpec() const {return _epoSpec;}
    3028  bool   isEqual(const t_pppParam* par2) const {
     
    103101  t_pppParlist();
    104102  ~t_pppParlist();
    105   t_pppParlist(const t_pppParlist& old);
    106   const t_pppParlist&operator= (const t_pppParlist& p);
    107   t_irc set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector,
    108             const QMap<char, t_pppRefSat*>& refSatMap);
     103  t_irc set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector);
    109104  unsigned nPar() const {return _params.size();}
    110105  const std::vector<t_pppParam*>& params() const {return _params;}
    111         std::vector<t_pppParam*>& params()      {return _params;}
     106  std::vector<t_pppParam*>& params() {return _params;}
    112107  const QList<char>& usedSystems() const {return _usedSystems;}
    113108  void printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
  • trunk/BNC/src/PPP/pppRefSat.h

    r9507 r10034  
    99#define PPPREFSAT_H_
    1010
     11#include <vector>
    1112#include "t_prn.h"
    1213
     
    3233  double   _stecValue;
    3334};
     35
     36class t_refSatellites {
     37 public:
     38  t_refSatellites(std::vector<char> systems) {
     39    for (unsigned iSys = 0; iSys < systems.size(); iSys++) {
     40      char sys = systems[iSys];
     41      _refSatMap[sys] = new t_pppRefSat();
     42    }
     43  }
     44  ~t_refSatellites() {
     45    QMapIterator<char, t_pppRefSat*> it(_refSatMap);
     46    while (it.hasNext()) {
     47      it.next();
     48      delete it.value();
     49    }
     50    _refSatMap.clear();
     51  }
     52  const QMap<char, t_pppRefSat*>& refSatMap() const {return _refSatMap;}
     53
     54 private:
     55  QMap<char, t_pppRefSat*> _refSatMap;
     56
     57};
     58
     59
    3460}
    3561
  • trunk/BNC/src/PPP/pppSatObs.cpp

    r10014 r10034  
    4444  _valid      = true;
    4545  _reference  = false;
    46   _stecRefSat = 0.0;
    4746  _stecSat    = 0.0;
    4847  _signalPriorities = QString::fromStdString(OPT->_signalPriorities);
    4948  if (!_signalPriorities.size()) {
    50     if (OPT->_obsModelType == OPT->DCMcodeBias ||
    51         OPT->_obsModelType == OPT->DCMphaseBias) {
    52       // at the moment only one code or phase bias per system (G,R,E,C)/modulation considered
    53       _signalPriorities = "G:12&CW R:12&CP E:1&CX E:5&QX C:26&I";
    54     }
    55     else {
    56       _signalPriorities = "G:12&CWPSLX R:12&CP E:1&CBX E:5&QIX C:26&IQX";
    57     }
     49    _signalPriorities = "G:12&CWPSLX R:12&CP E:1&CBX E:5&QIX C:26&IQX";
    5850  }
    5951
     
    109101            if (obs->_rnxType2ch == obsType.toStdString() &&
    110102                obs->_codeValid && obs->_code &&
    111                 obs->_phaseValid && obs->_phase) {
     103                obs->_phaseValid && obs->_phase &&
     104                obs->_lockTimeValid &&  obs->_lockTime > 5.0) {
    112105              _obs[iFreq] = new t_frqObs(*obs); //cout << "================> newObs: " << obs->_rnxType2ch <<endl;
    113106            }
     
    261254  // Pseudo observations
    262255  if (tLC == t_lc::GIM) {
    263     if (_stecRefSat == 0.0 || _stecSat == 0.0) {
     256    if (_stecSat == 0.0) {
    264257      if (valid) *valid = false;
    265258      return 0.0;
    266259    }
    267260    else {
    268       return _stecRefSat;
     261      return _stecSat;
    269262    }
    270263  }
     
    339332
    340333  if (tLC == t_lc::GIM) {
    341     retVal = OPT->_sigmaGIM * OPT->_sigmaGIM + OPT->_sigmaGIM * OPT->_sigmaGIM;
     334    retVal = OPT->_sigmaGIM * OPT->_sigmaGIM;
    342335  }
    343336
     
    587580    double f1GPS = t_CST::freq(t_frequency::G1, 0);
    588581    for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
    589       if (OPT->_pseudoObsIono) { // DCMcodeBias, DCMphaseBias
     582      if (OPT->_pseudoObsIono) {
    590583        // For scaling the slant ionospheric delays the trick is to be consistent with units!
    591584        // The conversion of TECU into meters requires the frequency of the signal.
     
    737730//
    738731////////////////////////////////////////////////////////////////////////////
    739 void  t_pppSatObs::setPseudoObsIono(t_frequency::type freq, double stecRefSat) {
     732bool  t_pppSatObs::setPseudoObsIono(t_frequency::type freq) {
     733  bool pseudoObsIono = false;
    740734  _stecSat    = _model._ionoCodeDelay[freq];
    741   _stecRefSat = stecRefSat;
    742 }
     735  if (_stecSat) {
     736    pseudoObsIono = true;
     737  }
     738  return pseudoObsIono;
     739}
  • trunk/BNC/src/PPP/pppSatObs.h

    r9866 r10034  
    4747  void                setRes(t_lc::type tLC, double res);
    4848  double              getRes(t_lc::type tLC) const;
    49   void                setPseudoObsIono(t_frequency::type freq, double stecRefSat);
     49  bool                setPseudoObsIono(t_frequency::type freq);
    5050  double              getIonoCodeDelay(t_frequency::type freq) {return _model._ionoCodeDelay[freq];}
    5151  double              getCodeBias(t_frequency::type freq) {return _model._codeBias[freq];}
     
    149149  std::map<t_lc::type, double> _res;
    150150  double                       _signalPropagationTime;
    151   double                       _stecRefSat;
    152151  double                       _stecSat;
    153152  double                       _tropo0;
  • trunk/BNC/src/bncmain.cpp

    r9958 r10034  
    249249      "   PPP/lcGalileo    {Select observations from Galileo code and/or phase data [character string: Pi&Li|Pi|Li|no]}\n"
    250250      "   PPP/lcBDS        {Select observations from BDS code and/or phase data [character string:     Pi&Li|Pi|Li|no]}\n"
    251       "   PPP/modelObs     {select observation model [character string: Uncombined PPP|Ionosphere-free PPP|DCM with Code Biases|DCM with Phase Biases]}\n"
     251      "   PPP/modelObs     {select observation model [character string: Uncombined PPP|Ionosphere-free PPP]}\n"
    252252      "   PPP/sigmaC1      {Sigma for code observations in meters [floating-point number]}\n"
    253253      "   PPP/sigmaL1      {Sigma for phase observations in meters [floating-point number]}\n"
  • trunk/BNC/src/bncwindow.cpp

    r10032 r10034  
    14891489  _pppWidgets._lcGalileo->setWhatsThis(tr("<p>Specify which kind of Galileo observations you want to use</p><p><ul><li>Specifying 'Pi' means that you request BNC to use code data of two frequencies.</li><li>Specifying'Li' means that you request BNC to use phase data of two frequencies.</li> <li>Specifying'Pi&Li' means that you request BNC to use both, code and phase data of two frequencies.</li></ul></p><p>Specifying 'no' means that you don't want BNC to use Galileo data. <i>[key: PPP/lcGalileo]</i></p>"));
    14901490  _pppWidgets._lcBDS->setWhatsThis(tr("<p>Specify which kind of BDS observations you want to use</p><p><ul><li>Specifying 'Pi' means that you request BNC to use code data from two frequencies.</li><li>Specifying'Li' means that you request BNC to use phase data of two frequencies.</li> <li>Specifying'Pi&Li' means that you request BNC to use both, code and phase data of two frequencies.</li></ul></p><p>Specifying 'no' means that you don't want BNC to use BDS data. <i>[key: PPP/lcBDS]</i></p>"));
    1491   _pppWidgets._modelObs->setWhatsThis(tr("<p>Specify which kind of PPP model you want to use:</p><p><ul><li>Uncombined PPP</li><li>Iopnosphere-free PPP</li><li>PPP-RTK (currently not activated because of an incomplete standardized SSR model)</li><li>DCM with Code or Phase Biases</li><li></p><p>[key: PPP/modelObs]</i></p>"));
     1491  _pppWidgets._modelObs->setWhatsThis(tr("<p>Specify which kind of PPP model you want to use:</p><p><ul><li>Uncombined PPP</li><li>Iopnosphere-free PPP</li><li>PPP-RTK (currently not activated because of an incomplete standardized SSR model)</li><li></p><p>[key: PPP/modelObs]</i></p>"));
    14921492  _pppWidgets._pseudoObs->setWhatsThis(tr("<p>Specify whether pseudo observations regarding the Ionosphere shall be used. Please note, this is useful, as soon as the ionospheric information is more accurate than the code data accuracy. <i>[key: PPP/pseudoObs]</i></p>"));
    14931493  _pppWidgets._sigmaC1->setWhatsThis(tr("<p>Enter a Sigma for GPS C1 code observations in meters.</p><p>The higher the sigma you enter, the less the contribution of GPS C1 code observations to a PPP solution from combined code and phase data. 2.0 is likely to be an appropriate choice.</p><p>Default is an empty option field, meaning<br>'Sigma C1 = 2.0' <i>[key: PPP/sigmaC1]</i></p>"));
  • trunk/BNC/src/pppMain.cpp

    r10029 r10034  
    215215      }
    216216    }
    217     else if (settings.value("PPP/modelObs").toString() == "DCM with Code Biases") {
    218       opt->_obsModelType = t_pppOptions::DCMcodeBias;
    219       opt->_refSatRequired = true;
    220     }
    221     else if (settings.value("PPP/modelObs").toString() == "DCM with Phase Biases") {
    222       opt->_obsModelType = t_pppOptions::DCMphaseBias;
    223       opt->_refSatRequired = true;
    224     }
    225217#endif
    226218    // GPS
  • trunk/BNC/src/pppOptions.h

    r9866 r10034  
    1111class t_pppOptions {
    1212 public:
    13   enum e_type {IF, UncombPPP, PPPRTK, DCMcodeBias, DCMphaseBias};
     13  enum e_type {IF, UncombPPP, PPPRTK};
    1414  t_pppOptions();
    1515  ~t_pppOptions();
     
    3030  QStringList             _obsmodelTypeStr = QStringList()
    3131      << "IF PPP"
    32       << "Uncombined PPP"
    33       << "DCM with Code Biases"
    34       << "DCM with Phase Biases";
     32      << "Uncombined PPP";
    3533  bool                    _realTime;
    3634  std::string             _crdFile;
  • trunk/BNC/src/pppWidgets.cpp

    r10013 r10034  
    156156  _pseudoObs->addItems(QString("no").split(","));
    157157#else
    158   _modelObs->addItems(QString("Uncombined PPP,Ionosphere-free PPP,DCM with Code Biases,DCM with Phase Biases").split(","));
     158  _modelObs->addItems(QString("Uncombined PPP,Ionosphere-free PPP").split(","));
    159159  _pseudoObs->addItems(QString("no,Ionosphere").split(","));
    160160#endif
     
    588588  int iRow = _staTable->rowCount();
    589589  _staTable->insertRow(iRow);
    590   QString preferredAttributes = "G:12&CWPSLX R:12&CP E:1&CBX E:5&QIX C:26&IQX";
    591   if (_modelObs->currentText().contains("DCM")) {
    592     preferredAttributes = "G:12&CW R:12&CP E:1&CX E:5&QX C:26&I";
    593   }
     590  QString preferredAttributes = "G:12&W R:12&P E:1&C E:5&Q C:26&I";
    594591
    595592  for (int iCol = 0; iCol < _staTable->columnCount(); iCol++) {
Note: See TracChangeset for help on using the changeset viewer.