Changeset 2778 in ntrip for trunk/BNC/bncpppclient.cpp


Ignore:
Timestamp:
Dec 12, 2010, 6:09:08 PM (13 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncpppclient.cpp

    r2777 r2778  
    147147  slipInfo& sInfo  = _slips[satData->prn];
    148148  if ( sInfo.slipCntL1 == obs.slip_cnt_L1  &&
    149        sInfo.slipCntL2 == obs.slip_cnt_L2 ) {
     149       sInfo.slipCntL2 == obs.slip_cnt_L2  &&
     150       sInfo.slipCntL5 == obs.slip_cnt_L5 ) {
    150151    satData->slipFlag = false;
    151152  }
     
    163164  }
    164165
    165   // Set Code Observations
    166   // --------------------- 
     166  // Set Code Observations - P1 or C1
     167  // --------------------------------
     168  bool haveP1 = false;
    167169  if      (obs.P1) {
    168170    satData->P1         = obs.P1 + (bb ? bb->p1 : 0.0);
    169171    satData->codeTypeF1 = t_satData::P_CODE;
     172    haveP1 = true;
    170173  }
    171174  else if (obs.C1) {
    172175    satData->P1         = obs.C1 + (bb ? bb->c1 : 0.0);
    173176    satData->codeTypeF1 = t_satData::C_CODE;
    174   }
    175   else {
     177    haveP1 = true;
     178  }
     179
     180  if (!haveP1) {
    176181    delete satData;
    177182    return;
    178183  }
    179    
     184
     185  // P2 or C2, and C5
     186  // ----------------   
     187  bool haveP2 = false;
    180188  if      (obs.P2) {
    181189    satData->P2         = obs.P2 + (bb ? bb->p2 : 0.0);
    182190    satData->codeTypeF2 = t_satData::P_CODE;
     191    haveP2 = true;
    183192  }
    184193  else if (obs.C2) {
    185194    satData->P2         = obs.C2;
    186195    satData->codeTypeF2 = t_satData::C_CODE;
    187   }
    188   else {
     196    haveP2 = true;
     197  }
     198
     199  bool haveP5 = false;
     200  if      (obs.C5) {
     201    satData->P5         = obs.C5;
     202    satData->codeTypeF2 = t_satData::P_CODE;
     203    haveP5 = true;
     204  }
     205
     206  if (!haveP2 && !haveP5) {
    189207    delete satData;
    190208    return;
    191209  }
    192 
    193   double f1 = t_CST::freq1;
    194   double f2 = t_CST::freq2;
    195 
    196   if (obs.satSys == 'R') {
    197     f1 = 1602000000.0 + 562500.0 * obs.slotNum;
    198     f2 = 1246000000.0 + 437500.0 * obs.slotNum;
    199   }
    200 
    201   // Ionosphere-Free Combination
    202   // ---------------------------
    203   double c1 =   f1 * f1 / (f1 * f1 - f2 * f2);
    204   double c2 = - f2 * f2 / (f1 * f1 - f2 * f2);
    205  
    206   satData->P3 =  c1 * satData->P1 + c2 * satData->P2;
    207 
    208   // Set Phase Observations
    209   // ---------------------- 
    210   if (obs.L1() && obs.L2()) {
    211     satData->L1 = obs.L1() * t_CST::c / f1;
    212     satData->L2 = obs.L2() * t_CST::c / f2;
    213   }
    214   else {
    215     delete satData;
    216     return;
    217   }
    218   satData->L3 =  c1 * satData->L1 + c2 * satData->L2;
    219 
    220   // Set Ionosphere-Free Wavelength
    221   // ------------------------------
    222   satData->lambda3 = c1 * t_CST::c / f1 + c2 * t_CST::c / f2;
    223210
    224211  // Add new Satellite to the epoch
     
    237224  }
    238225
     226  // Set Ionosphere-Free Combinations
     227  // --------------------------------
    239228  if      (obs.satSys == 'G') {
     229    double f1 = t_CST::freq1;
     230    double f2 = t_CST::freq2;
     231    double c1 =   f1 * f1 / (f1 * f1 - f2 * f2);
     232    double c2 = - f2 * f2 / (f1 * f1 - f2 * f2);
     233
     234    if (obs.L1() && obs.L2()) {
     235      satData->L1 = obs.L1() * t_CST::c / f1;
     236      satData->L2 = obs.L2() * t_CST::c / f2;
     237    }
     238    else {
     239      delete satData;
     240      return;
     241    }
     242
     243    satData->P3      = c1 * satData->P1 + c2 * satData->P2;
     244    satData->L3      = c1 * satData->L1 + c2 * satData->L2;
     245    satData->lambda3 = c1 * t_CST::c / f1 + c2 * t_CST::c / f2;
     246
    240247    _epoData->satDataGPS[satData->prn] = satData;
    241248  }
    242249  else if (obs.satSys == 'R') {
     250    double f1 = 1602000000.0 + 562500.0 * obs.slotNum;
     251    double f2 = 1246000000.0 + 437500.0 * obs.slotNum;
     252    double c1 =   f1 * f1 / (f1 * f1 - f2 * f2);
     253    double c2 = - f2 * f2 / (f1 * f1 - f2 * f2);
     254
     255    if (obs.L1() && obs.L2()) {
     256      satData->L1 = obs.L1() * t_CST::c / f1;
     257      satData->L2 = obs.L2() * t_CST::c / f2;
     258    }
     259    else {
     260      delete satData;
     261      return;
     262    }
     263
     264    satData->P3      = c1 * satData->P1 + c2 * satData->P2;
     265    satData->L3      = c1 * satData->L1 + c2 * satData->L2;
     266    satData->lambda3 = c1 * t_CST::c / f1 + c2 * t_CST::c / f2;
     267
    243268    _epoData->satDataGlo[satData->prn] = satData;
     269  }
     270  else if (obs.satSys == 'E') {
     271    double f1 = t_CST::freq1;
     272    double f5 = t_CST::freq5;
     273    double c1 =   f1 * f1 / (f1 * f1 - f5 * f5);
     274    double c5 = - f5 * f5 / (f1 * f1 - f5 * f5);
     275
     276    if (obs.L1() && obs.L5) {
     277      satData->L1 = obs.L1() * t_CST::c / f1;
     278      satData->L5 = obs.L5   * t_CST::c / f5;
     279    }
     280    else {
     281      delete satData;
     282      return;
     283    }
     284
     285    satData->P3      = c1 * satData->P1 + c5 * satData->P5;
     286    satData->L3      = c1 * satData->L1 + c5 * satData->L5;
     287    satData->lambda3 = c1 * t_CST::c / f1 + c5 * t_CST::c / f5;
     288
     289    _epoData->satDataGal[satData->prn] = satData;
    244290  }
    245291}
     
    294340    t_ephGlo* eLast = new t_ephGlo();
    295341    eLast->set(&gloeph);
     342    _eph.insert(prn, new t_ephPair());
     343    _eph[prn]->last = eLast;
     344  }
     345}
     346
     347//
     348////////////////////////////////////////////////////////////////////////////
     349void bncPPPclient::slotNewEphGalileo(galileoephemeris galeph) {
     350  QMutexLocker locker(&_mutex);
     351
     352  QString prn = QString("E%1").arg(galeph.satellite, 2, 10, QChar('0'));
     353
     354  if (_eph.contains(prn)) {
     355    t_ephGal* eLast = static_cast<t_ephGal*>(_eph.value(prn)->last);
     356    if ( (eLast->GPSweek() <  galeph.Week) ||
     357         (eLast->GPSweek() == galeph.Week && 
     358          eLast->TOC()     <  galeph.TOC) ) {
     359      delete static_cast<t_ephGal*>(_eph.value(prn)->prev);
     360      _eph.value(prn)->prev = _eph.value(prn)->last;
     361      _eph.value(prn)->last = new t_ephGal();
     362      static_cast<t_ephGal*>(_eph.value(prn)->last)->set(&galeph);
     363    }
     364  }
     365  else {
     366    t_ephGal* eLast = new t_ephGal();
     367    eLast->set(&galeph);
    296368    _eph.insert(prn, new t_ephPair());
    297369    _eph[prn]->last = eLast;
     
    557629  }
    558630}
    559 
    560 //
    561 ////////////////////////////////////////////////////////////////////////////
    562 void bncPPPclient::slotNewEphGalileo(galileoephemeris galeph) {
    563   QMutexLocker locker(&_mutex);
    564 
    565   QString prn = QString("E%1").arg(galeph.satellite, 2, 10, QChar('0'));
    566 
    567   if (_eph.contains(prn)) {
    568     t_ephGal* eLast = static_cast<t_ephGal*>(_eph.value(prn)->last);
    569     if ( (eLast->GPSweek() <  galeph.Week) ||
    570          (eLast->GPSweek() == galeph.Week && 
    571           eLast->TOC()     <  galeph.TOC) ) {
    572       delete static_cast<t_ephGal*>(_eph.value(prn)->prev);
    573       _eph.value(prn)->prev = _eph.value(prn)->last;
    574       _eph.value(prn)->last = new t_ephGal();
    575       static_cast<t_ephGal*>(_eph.value(prn)->last)->set(&galeph);
    576     }
    577   }
    578   else {
    579     t_ephGal* eLast = new t_ephGal();
    580     eLast->set(&galeph);
    581     _eph.insert(prn, new t_ephPair());
    582     _eph[prn]->last = eLast;
    583   }
    584 }
Note: See TracChangeset for help on using the changeset viewer.