Changeset 10791 in ntrip for trunk/BNC/src/PPP/pppSatObs.cpp


Ignore:
Timestamp:
Dec 3, 2025, 5:37:16 PM (4 weeks ago)
Author:
mervart
Message:

BNC Multifrequency and PPPAR Client (initial version)

File:
1 edited

Legend:

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

    r10626 r10791  
    1919#include <iomanip>
    2020#include <cmath>
     21#include <algorithm>
     22#include <set>
    2123#include <newmatio.h>
    2224
     
    4345  _reference  = false;
    4446  _stecSat    = 0.0;
    45   _signalPriorities = QString::fromStdString(OPT->_signalPriorities);
    4647  for (unsigned ii = 0; ii < t_frequency::max; ii++) {
    4748    _obs[ii] = 0;
     
    6061//
    6162////////////////////////////////////////////////////////////////////////////
    62 void t_pppSatObs::prepareObs(const t_satObs& pppSatObs) {
     63bool t_pppSatObs::isBetter(const t_frqObs* aa, t_frqObs* bb, const string& trkModes) const {
     64
     65  if (!trkModes.empty()) {
     66    size_t posA = trkModes.find(aa->trkChar());
     67    size_t posB = trkModes.find(bb->trkChar());
     68    if (posA != posB) {
     69      if      (posA == string::npos) {
     70        return false;
     71      }
     72      else if (posB == string::npos) {
     73        return true;
     74      }
     75      else {
     76        return posA < posB;
     77      }
     78    }
     79  }
     80     
     81  unsigned numValA = 0;
     82  if (aa->_codeValid)  numValA += 1;
     83  if (aa->_phaseValid) numValA += 1;
     84
     85  unsigned numValB = 0;
     86  if (bb->_codeValid)  numValB += 1;
     87  if (bb->_phaseValid) numValB += 1;
     88
     89  if (numValA != numValB) {
     90    return numValA > numValB;
     91  }
     92
     93  return false;
     94}
     95
     96//
     97////////////////////////////////////////////////////////////////////////////
     98void t_pppSatObs::prepareObs(const t_satObs& satObs) {
    6399
    64100  _model.reset();
    65101
    66   std::vector<char> bb = OPT->frqBands(_prn.system());
    67   char frqNum1 = '0';
    68   if (bb.size() >= 1) {
    69     frqNum1 = bb[0];
    70   }
    71   char frqNum2 = '0';
    72   if (bb.size() == 2) {
    73     frqNum2 = bb[1];
    74   }
    75 
    76   // Select pseudo-ranges and phase observations
    77   // -------------------------------------------
    78   QStringList priorList = _signalPriorities.split(" ", Qt::SkipEmptyParts);
    79   string preferredAttrib;
    80   for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
    81     t_frequency::type frqType = static_cast<t_frequency::type>(iFreq);
    82     char frqSys = t_frequency::toString(frqType)[0]; //cout << "frqSys: " << frqSys << endl;
    83     char frqNum = t_frequency::toString(frqType)[1]; //cout << "frqNum: " << frqNum << endl;
    84     if (frqSys != _prn.system()) {
    85       continue;
    86     }
    87     if (frqNum != frqNum1 &&
    88         frqNum != frqNum2 ) {
    89       continue;
    90     }
    91     QStringList hlp;
    92     for (int ii = 0; ii < priorList.size(); ii++) {
    93       if (priorList[ii].indexOf(":") != -1) {
    94         hlp = priorList[ii].split(":", Qt::SkipEmptyParts);
    95         if (hlp.size() == 2 && hlp[0].length() == 1 && hlp[0][0] == frqSys) {
    96           hlp = hlp[1].split("&", Qt::SkipEmptyParts);
    97         }
    98         if (hlp.size() == 2 && hlp[0].indexOf(frqNum) != -1) {
    99           preferredAttrib = hlp[1].toStdString(); //cout << "preferredAttrib: " << preferredAttrib << endl;
    100         }
    101       }
    102       for (unsigned iPref = 0; iPref < preferredAttrib.length(); iPref++) {
    103         QString obsType = QString("%1").arg(frqNum) + preferredAttrib[iPref];  //cout << "obstype: " << obsType.toStdString().c_str() << endl;
    104         if (_obs[iFreq] == 0) {
    105           for (unsigned ii = 0; ii < pppSatObs._obs.size(); ii++) {
    106             const t_frqObs* obs = pppSatObs._obs[ii];
    107             //cout << "observation2char: " << obs->_rnxType2ch << " vs. " << obsType.toStdString().c_str()<< endl;
    108             if (obs->_rnxType2ch == obsType.toStdString() &&
    109                 obs->_codeValid  && obs->_code &&
    110                 obs->_phaseValid && obs->_phase) {
    111               _obs[iFreq] = new t_frqObs(*obs); //cout << "================> newObs: " << obs->_rnxType2ch << " obs->_lockTime: " << obs->_lockTime << endl;
    112             }
    113           }
    114         }
    115       }
    116     }
    117   }
    118 
    119   // Used frequency types
    120   // --------------------
    121   _fType1 = t_frqBand::toFreq(_prn.system(), frqNum1);
    122   _fType2 = t_frqBand::toFreq(_prn.system(), frqNum2);
    123 
     102  const t_pppOptions::SysTrkModes* sysTrkModes = OPT->sysTrkModes(_prn.system());
     103  using FrqTrkModes = t_pppOptions::SysTrkModes::FrqTrkModes;
     104 
     105  for (const t_frqObs* obs : satObs._obs) {
     106    if ( (obs->_codeValid || obs->_phaseValid)) {
     107      t_frequency::type frq = t_frequency::toFreq(_prn.system(), obs->frqChar());
     108      if (frq == t_frequency::dummy) {
     109        continue;
     110      }
     111      string trkModes;
     112      if (sysTrkModes) {
     113        const vector<FrqTrkModes>& frqTrkModes = sysTrkModes->_frqTrkModes;
     114        auto it = find_if(frqTrkModes.begin(), frqTrkModes.end(),
     115                          [frq](const FrqTrkModes& mm){return mm._frq == frq;});
     116        if (it != frqTrkModes.end()) {
     117          trkModes = it->_trkModes;
     118        }
     119      }
     120      if (_obs[frq] == 0 || isBetter(obs, _obs[frq], trkModes)) {
     121        delete _obs[frq]; 
     122        _obs[frq] = new t_frqObs(*obs);
     123      }
     124    }
     125  }
     126 
    124127  // Check whether all required frequencies available
    125128  // ------------------------------------------------
    126   for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) {
    127     t_lc::type tLC = OPT->LCs(_prn.system())[ii];
    128     if (tLC == t_lc::GIM) {continue;}
    129     if (!isValid(tLC)) {
     129  const std::vector<t_lc>& LCs = OPT->LCs(_prn.system());
     130  for (unsigned ii = 0; ii < LCs.size(); ii++) {
     131    t_lc LC = LCs[ii];
     132    if (LC._type == t_lc::GIM) {
     133      continue;
     134    }
     135    if (LC._frq1 != t_frequency::G5 && !isValid(LC)) {
    130136      _valid = false;
    131137      return;
     
    148154  bool totOK  = false;
    149155  ColumnVector satPosOld(6); satPosOld = 0.0;
    150   t_lc::type tLC = t_lc::dummy;
    151   if (isValid(t_lc::cIF)) {
    152     tLC = t_lc::cIF;
    153   }
    154   if (tLC == t_lc::dummy && isValid(t_lc::c1)) {
    155       tLC = t_lc::c1;
    156   }
    157   if (tLC == t_lc::dummy && isValid(t_lc::c2)) {
    158       tLC = t_lc::c2;
    159   }
    160   if (tLC == t_lc::dummy) {
    161     _valid = false;
     156
     157  _valid = false;
     158  t_frequency::type frq1 = t_frequency::dummy;
     159  t_frequency::type frq2 = t_frequency::dummy;
     160  OPT->defaultFrqs(_prn.system(), frq1, frq2);
     161  if (frq1 != t_frequency::dummy) {
     162    t_lc lc1(t_lc::code, frq1);
     163    if (isValid(lc1)) {
     164      _valid = true;
     165      _rangeLC = lc1;
     166    }
     167    if (frq2 != t_frequency::dummy) {
     168      t_lc lcIF(t_lc::codeIF, frq1, frq2);
     169      if (isValid(lcIF)) {
     170        _valid = true;
     171        _rangeLC = lcIF;
     172      }
     173    }
     174  }
     175  if (!_valid) {
    162176    return;
    163177  }
    164   double prange = obsValue(tLC);
     178 
     179  double prange = obsValue(_rangeLC);
    165180  for (int ii = 1; ii <= 10; ii++) {
    166181    bncTime ToT = _time - prange / t_CST::c - _xcSat[3];
     
    188203//
    189204////////////////////////////////////////////////////////////////////////////
    190 void t_pppSatObs::lcCoeff(t_lc::type tLC,
     205void t_pppSatObs::lcCoeff(t_lc LC,
    191206                          map<t_frequency::type, double>& codeCoeff,
    192207                          map<t_frequency::type, double>& phaseCoeff,
     
    197212  ionoCoeff.clear();
    198213
    199   double f1 = t_CST::freq(_fType1, _channel);
    200   double f2 = t_CST::freq(_fType2, _channel);
     214  double f1 = t_CST::freq(LC._frq1, _channel);
     215  double f2 = t_CST::freq(LC._frq2, _channel);
    201216  double f1GPS = t_CST::freq(t_frequency::G1, 0);
    202217
    203   switch (tLC) {
    204   case t_lc::l1:
    205     phaseCoeff[_fType1] =  1.0;
    206     ionoCoeff [_fType1] = -1.0 * pow(f1GPS, 2) / pow(f1, 2);
     218  switch (LC._type) {
     219  case t_lc::phase:
     220    phaseCoeff[LC._frq1] =  1.0;
     221    ionoCoeff [LC._frq1] = -1.0 * pow(f1GPS, 2) / pow(f1, 2);
    207222    return;
    208   case t_lc::l2:
    209     phaseCoeff[_fType2] = 1.0;
    210     ionoCoeff [_fType2] = -1.0 * pow(f1GPS, 2) / pow(f2, 2);
     223  case t_lc::code:
     224    codeCoeff[LC._frq1] = 1.0;
     225    ionoCoeff[LC._frq1] = pow(f1GPS, 2) / pow(f1, 2);
    211226    return;
    212   case t_lc::lIF:
    213     phaseCoeff[_fType1] =  f1 * f1 / (f1 * f1 - f2 * f2);
    214     phaseCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
     227  case t_lc::phaseIF:
     228    phaseCoeff[LC._frq1] =  f1 * f1 / (f1 * f1 - f2 * f2);
     229    phaseCoeff[LC._frq2] = -f2 * f2 / (f1 * f1 - f2 * f2);
     230    return;
     231  case t_lc::codeIF:
     232    codeCoeff[LC._frq1] =  f1 * f1 / (f1 * f1 - f2 * f2);
     233    codeCoeff[LC._frq2] = -f2 * f2 / (f1 * f1 - f2 * f2);
    215234    return;
    216235  case t_lc::MW:
    217     phaseCoeff[_fType1] =  f1 / (f1 - f2);
    218     phaseCoeff[_fType2] = -f2 / (f1 - f2);
    219     codeCoeff[_fType1] = -f1 / (f1 + f2);
    220     codeCoeff[_fType2] = -f2 / (f1 + f2);
     236    phaseCoeff[LC._frq1] =  f1 / (f1 - f2);
     237    phaseCoeff[LC._frq2] = -f2 / (f1 - f2);
     238    codeCoeff [LC._frq1] = -f1 / (f1 + f2);
     239    codeCoeff [LC._frq2] = -f2 / (f1 + f2);
    221240    return;
    222241  case t_lc::CL:
    223     phaseCoeff[_fType1] =  0.5;
    224     codeCoeff [_fType1] =  0.5;
    225     return;
    226   case t_lc::c1:
    227     codeCoeff[_fType1] = 1.0;
    228     ionoCoeff[_fType1] = pow(f1GPS, 2) / pow(f1, 2);
    229     return;
    230   case t_lc::c2:
    231     codeCoeff[_fType2] = 1.0;
    232     ionoCoeff[_fType2] = pow(f1GPS, 2) / pow(f2, 2);
    233     return;
    234   case t_lc::cIF:
    235     codeCoeff[_fType1] =  f1 * f1 / (f1 * f1 - f2 * f2);
    236     codeCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
     242    phaseCoeff[LC._frq1] =  0.5;
     243    codeCoeff [LC._frq1] =  0.5;
    237244    return;
    238245  case t_lc::GIM:
     
    245252//
    246253////////////////////////////////////////////////////////////////////////////
    247 bool t_pppSatObs::isValid(t_lc::type tLC) const {
     254bool t_pppSatObs::isValid(t_lc LC) const {
    248255  bool valid = true;
    249   obsValue(tLC, &valid);
     256  obsValue(LC, &valid);
    250257
    251258  return valid;
     
    253260//
    254261////////////////////////////////////////////////////////////////////////////
    255 double t_pppSatObs::obsValue(t_lc::type tLC, bool* valid) const {
     262double t_pppSatObs::obsValue(t_lc LC, bool* valid) const {
    256263
    257264  double retVal = 0.0;
     
    259266
    260267  // Pseudo observations
    261   if (tLC == t_lc::GIM) {
     268  if (LC._type == t_lc::GIM) {
    262269    if (_stecSat == 0.0) {
    263270      if (valid) *valid = false;
     
    272279  map<t_frequency::type, double> phaseCoeff;
    273280  map<t_frequency::type, double> ionoCoeff;
    274   lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
     281  lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff);
    275282
    276283  map<t_frequency::type, double>::const_iterator it;
     
    303310//
    304311////////////////////////////////////////////////////////////////////////////
    305 double t_pppSatObs::lambda(t_lc::type tLC) const {
    306 
    307   double f1 = t_CST::freq(_fType1, _channel);
    308   double f2 = t_CST::freq(_fType2, _channel);
    309 
    310   if      (tLC == t_lc::l1) {
     312double t_pppSatObs::lambda(t_lc LC) const {
     313
     314  double f1 = t_CST::freq(LC._frq1, _channel);
     315  double f2 = t_CST::freq(LC._frq2, _channel);
     316
     317  if      (LC._type == t_lc::phase) {
    311318    return t_CST::c / f1;
    312319  }
    313   else if (tLC == t_lc::l2) {
    314     return t_CST::c / f2;
    315   }
    316   else if (tLC == t_lc::lIF) {
     320  else if (LC._type == t_lc::phaseIF) {
    317321    return t_CST::c / (f1 + f2);
    318322  }
    319   else if (tLC == t_lc::MW) {
     323  else if (LC._type == t_lc::MW) {
    320324    return t_CST::c / (f1 - f2);
    321325  }
    322   else if (tLC == t_lc::CL) {
     326  else if (LC._type == t_lc::CL) {
    323327    return t_CST::c / f1 / 2.0;
    324328  }
     
    329333//
    330334////////////////////////////////////////////////////////////////////////////
    331 double t_pppSatObs::sigma(t_lc::type tLC) const {
     335double t_pppSatObs::sigma(t_lc LC) const {
    332336
    333337  double retVal = 0.0;
     
    335339  map<t_frequency::type, double> phaseCoeff;
    336340  map<t_frequency::type, double> ionoCoeff;
    337   lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
    338 
    339   if (tLC == t_lc::GIM) {
     341  lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff);
     342
     343  if (LC._type == t_lc::GIM) {
    340344    retVal = OPT->_sigmaGIM * OPT->_sigmaGIM;
    341345  }
     
    354358  // De-Weight R
    355359  // -----------
    356   if (_prn.system() == 'R'&& t_lc::includesCode(tLC)) {
     360  if (_prn.system() == 'R'&& LC.includesCode()) {
    357361    retVal *= 5.0;
    358362  }
     
    361365  // -----------------------------
    362366  double cEle = 1.0;
    363   if ( (OPT->_eleWgtCode  && t_lc::includesCode(tLC)) ||
    364        (OPT->_eleWgtPhase && t_lc::includesPhase(tLC)) ) {
     367  if ( (OPT->_eleWgtCode  && LC.includesCode()) ||
     368       (OPT->_eleWgtPhase && LC.includesPhase()) ) {
    365369    double eleD = eleSat()*180.0/M_PI;
    366370    double hlp  = fabs(90.0 - eleD);
     
    373377//
    374378////////////////////////////////////////////////////////////////////////////
    375 double t_pppSatObs::maxRes(t_lc::type tLC) const {
     379double t_pppSatObs::maxRes(t_lc LC) const {
    376380  double retVal = 0.0;
    377381
     
    379383  map<t_frequency::type, double> phaseCoeff;
    380384  map<t_frequency::type, double> ionoCoeff;
    381   lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
     385  lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff);
    382386
    383387  map<t_frequency::type, double>::const_iterator it;
     
    388392    retVal += it->second * it->second * OPT->_maxResL1 * OPT->_maxResL1;
    389393  }
    390   if (tLC == t_lc::GIM) {
     394  if (LC._type == t_lc::GIM) {
    391395    retVal = OPT->_maxResGIM * OPT->_maxResGIM + OPT->_maxResGIM * OPT->_maxResGIM;
    392396  }
     
    517521        }
    518522        const t_frqObs* obs = _obs[iFreq];
    519         if (obs &&
    520             obs->_rnxType2ch == bias._rnxType2ch) {
    521           _model._codeBias[iFreq]  = bias._value;
     523        if (obs && obs->_rnxType2ch == bias._rnxType2ch) {
     524          _model._codeBias[iFreq] = (bias._value != 0.0 ? bias._value : ZEROVALUE);
    522525        }
    523526      }
     
    527530  // Phase Biases
    528531  // -----------
    529   const t_satPhaseBias* satPhaseBias = PPP_CLIENT->obsPool()->satPhaseBias(_prn);
    530   double yaw = 0.0;
    531   bool ssr = false;
    532   if (satPhaseBias) {
    533     double dt = station->epochTime() - satPhaseBias->_time;
    534     if (satPhaseBias->_updateInt) {
    535       dt -= (0.5 * ssrUpdateInt[satPhaseBias->_updateInt]);
    536     }
    537     yaw = satPhaseBias->_yaw + satPhaseBias->_yawRate * dt;
    538     ssr = true;
    539     for (unsigned ii = 0; ii < satPhaseBias->_bias.size(); ii++) {
    540       const t_frqPhaseBias& bias = satPhaseBias->_bias[ii];
    541       for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
    542         string frqStr = t_frequency::toString(t_frequency::type(iFreq));
    543         if (frqStr[0] != _prn.system()) {
    544           continue;
    545         }
    546         const t_frqObs* obs = _obs[iFreq];
    547         if (obs &&
    548             obs->_rnxType2ch == bias._rnxType2ch) {
    549           _model._phaseBias[iFreq]  = bias._value;
     532  double yaw    = 0.0;
     533  bool   useYaw = false;
     534  if (OPT->arSystem(_prn.system())) {
     535    const t_satPhaseBias* satPhaseBias = PPP_CLIENT->obsPool()->satPhaseBias(_prn);
     536    if (satPhaseBias) {
     537      if (OPT->_ar._useYaw) {
     538        double dt = station->epochTime() - satPhaseBias->_time;
     539        if (satPhaseBias->_updateInt) {
     540          dt -= (0.5 * ssrUpdateInt[satPhaseBias->_updateInt]);
     541        }
     542        yaw = satPhaseBias->_yaw + satPhaseBias->_yawRate * dt;
     543        useYaw = true;
     544      }
     545      for (unsigned ii = 0; ii < satPhaseBias->_bias.size(); ii++) {
     546        const t_frqPhaseBias& bias = satPhaseBias->_bias[ii];
     547        if (bias._fixIndicator) {  // if AR, biases without fixIndicator not used
     548          for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
     549            string frqStr = t_frequency::toString(t_frequency::type(iFreq));
     550            if (frqStr[0] != _prn.system()) {
     551              continue;
     552            }
     553            t_frqObs* obs = _obs[iFreq];
     554            if (obs && obs->_rnxType2ch[0] == bias._rnxType2ch[0]) { // allow different tracking mode
     555              _model._phaseBias[iFreq] = (bias._value != 0.0 ? bias._value : ZEROVALUE);
     556              obs->_biasJumpCounter = bias._jumpCounter;
     557            }
     558          }
    550559        }
    551560      }
     
    555564  // Phase Wind-Up
    556565  // -------------
    557   _model._windUp = station->windUp(_time, _prn, rSat, ssr, yaw, vSat) ;
     566  _model._windUp = station->windUp(_time, _prn, rSat, useYaw, yaw, vSat) ;
    558567
    559568  // Relativistic effect due to earth gravity
     
    574583  bool vTecUsage = true;
    575584  for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) {
    576     t_lc::type tLC = OPT->LCs(_prn.system())[ii];
    577     if (tLC == t_lc::cIF || tLC == t_lc::lIF) {
     585    t_lc LC = OPT->LCs(_prn.system())[ii];
     586    if (LC._type == t_lc::codeIF || LC._type == t_lc::phaseIF) {
    578587      vTecUsage = false;
    579588    }
     
    601610  _model._set = true;
    602611
    603   //printModel();
     612  if (OPT->_logMode == t_pppOptions::all) {
     613    printModel();
     614  }
    604615
    605616  return success;
     
    636647      if (_prn.system() == frqStr[0]) {
    637648      LOG << "PCO           : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq]       << endl
    638           << "BIAS CODE     : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq]     << "\t(" << _obs[iFreq]->_rnxType2ch[1] << ") " << endl
    639           << "BIAS PHASE    : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq]    << "\t(" << _obs[iFreq]->_rnxType2ch[1] << ") " << endl
     649          << "BIAS CODE     : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq]     << "\t(" << _obs[iFreq]->trkChar() << ") " << endl
     650          << "BIAS PHASE    : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq]    << "\t(" << _obs[iFreq]->trkChar() << ") " << endl
    640651          << "IONO CODEDELAY: " << frqStr << setw(12) << setprecision(3) << _model._ionoCodeDelay[iFreq]<< endl;
    641652      }
     
    652663  char sys = _prn.system();
    653664  for (unsigned ii = 0; ii < OPT->LCs(sys).size(); ii++) {
    654     t_lc::type tLC = OPT->LCs(sys)[ii];
    655     LOG << "OBS-CMP " << setw(4) << t_lc::toString(tLC) << ": " << _prn.toString() << " "
    656         << setw(12) << setprecision(3) << obsValue(tLC) << " "
    657         << setw(12) << setprecision(3) << cmpValue(tLC) << " "
    658         << setw(12) << setprecision(3) << obsValue(tLC)  - cmpValue(tLC) << endl;
    659   }
    660 }
    661 
    662 //
    663 ////////////////////////////////////////////////////////////////////////////
    664 double t_pppSatObs::cmpValueForBanc(t_lc::type tLC) const {
    665   return cmpValue(tLC) - _model._rho - _model._sagnac - _model._recClkM;
    666 }
    667 
    668 //
    669 ////////////////////////////////////////////////////////////////////////////
    670 double t_pppSatObs::cmpValue(t_lc::type tLC) const {
     665    t_lc LC = OPT->LCs(sys)[ii];
     666    LOG << "OBS-CMP " << setw(4) << LC.toString() << ": " << _prn.toString() << " "
     667        << setw(12) << setprecision(3) << obsValue(LC) << " "
     668        << setw(12) << setprecision(3) << cmpValue(LC) << " "
     669        << setw(12) << setprecision(3) << obsValue(LC)  - cmpValue(LC) << endl;
     670  }
     671}
     672
     673//
     674////////////////////////////////////////////////////////////////////////////
     675double t_pppSatObs::cmpValueForBanc(t_lc LC) const {
     676  return cmpValue(LC) - _model._rho - _model._sagnac - _model._recClkM;
     677}
     678
     679//
     680////////////////////////////////////////////////////////////////////////////
     681double t_pppSatObs::cmpValue(t_lc LC) const {
    671682  double cmpValue;
    672683
    673   if      (!isValid(tLC)) {
     684  if      (!isValid(LC)) {
    674685    cmpValue =  0.0;
    675686  }
    676   else if (tLC == t_lc::GIM) {
     687  else if (LC._type == t_lc::GIM) {
    677688    cmpValue =  _stecSat;
    678689  }
     
    691702    map<t_frequency::type, double> phaseCoeff;
    692703    map<t_frequency::type, double> ionoCoeff;
    693     lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
     704    lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff);
    694705    map<t_frequency::type, double>::const_iterator it;
    695706    for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
    696707      t_frequency::type tFreq = it->first;
    697708      dispPart += it->second * (_model._antPCO[tFreq] - _model._codeBias[tFreq]);
    698       if (OPT->PPP_RTK) {
    699         dispPart += it->second * (_model._ionoCodeDelay[tFreq]);
    700       }
    701709    }
    702710    for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
     
    704712      dispPart += it->second * (_model._antPCO[tFreq] - _model._phaseBias[tFreq] +
    705713                                _model._windUp * t_CST::lambda(tFreq, _channel));
    706       if (OPT->PPP_RTK) {
    707         dispPart += it->second * (- _model._ionoCodeDelay[tFreq]);
    708       }
    709714    }
    710715    cmpValue = nonDisp + dispPart;
     
    716721//
    717722////////////////////////////////////////////////////////////////////////////
    718 void t_pppSatObs::setRes(t_lc::type tLC, double res) {
    719   _res[tLC] = res;
    720 }
    721 
    722 //
    723 ////////////////////////////////////////////////////////////////////////////
    724 double t_pppSatObs::getRes(t_lc::type tLC) const {
    725   map<t_lc::type, double>::const_iterator it = _res.find(tLC);
     723void t_pppSatObs::setRes(t_lc LC, double res) {
     724  _res[LC] = res;
     725}
     726
     727//
     728////////////////////////////////////////////////////////////////////////////
     729double t_pppSatObs::getRes(t_lc LC) const {
     730  map<t_lc, double>::const_iterator it = _res.find(LC);
    726731  if (it != _res.end()) {
    727732    return it->second;
     
    742747  return pseudoObsIono;
    743748}
     749
     750//
     751////////////////////////////////////////////////////////////////////////////
     752bool t_pppSatObs::hasBiases() const {
     753  bool ar = OPT->arSystem(_prn.system());
     754  set<t_frequency::type> frqs;
     755  for (const auto& lc : OPT->LCs(_prn.system())) {
     756    if (lc._frq1 != t_frequency::dummy) frqs.insert(lc._frq1);
     757    if (lc._frq2 != t_frequency::dummy) frqs.insert(lc._frq2);
     758  }
     759  for (int iFreq : frqs) {
     760    if (_obs[iFreq] != 0) {
     761      if (_model._codeBias[iFreq] == 0 || (ar && _model._phaseBias[iFreq] == 0)) {
     762        return false;
     763      }
     764    }
     765  }
     766  return true;
     767}
Note: See TracChangeset for help on using the changeset viewer.