Changeset 2239 in ntrip


Ignore:
Timestamp:
Jan 12, 2010, 3:17:14 PM (14 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncmodel.cpp

    r2238 r2239  
    8484// Partial
    8585////////////////////////////////////////////////////////////////////////////
    86 double bncParam::partial(t_satData* satData, const QString& prnIn) {
     86double bncParam::partial(t_satData* satData, bool phase) {
     87
     88  // Coordinates
     89  // -----------
    8790  if      (type == CRD_X) {
    8891    return (xx - satData->xx(1)) / satData->rho;
     
    9497    return (xx - satData->xx(3)) / satData->rho;
    9598  }
    96   else if (type == RECCLK) {
    97     return 1.0;
    98   }
     99
     100  // Receiver Clocks
     101  // ---------------
     102  else if (type == RECCLK_GPS) {
     103    if (satData->prn[0] == 'G') {
     104      return 1.0;
     105    }
     106    else {
     107      return 0.0;
     108    }
     109  }
     110  else if (type == RECCLK_GLO) {
     111    if (satData->prn[0] == 'R') {
     112      return 1.0;
     113    }
     114    else {
     115      return 0.0;
     116    }
     117  }
     118
     119  // Troposphere
     120  // -----------
    99121  else if (type == TROPO) {
    100122    return 1.0 / sin(satData->eleSat);
    101123  }
     124
     125  // Ambiguities
     126  // -----------
    102127  else if (type == AMB_L3) {
    103     if (prnIn == prn) {
     128    if (phase && satData->prn == prn) {
    104129      return 1.0;
    105130    }
     
    108133    }
    109134  }
     135
     136  // Default return
     137  // --------------
    110138  return 0.0;
    111139}
     
    140168  _ellBanc.ReSize(3); _ellBanc = 0.0;
    141169
    142   _params.push_back(new bncParam(bncParam::CRD_X,  1, ""));
    143   _params.push_back(new bncParam(bncParam::CRD_Y,  2, ""));
    144   _params.push_back(new bncParam(bncParam::CRD_Z,  3, ""));
    145   _params.push_back(new bncParam(bncParam::RECCLK, 4, ""));
     170  if ( Qt::CheckState(settings.value("pppGLONASS").toInt()) == Qt::Checked) {
     171    _useGlonass = true;
     172  }
     173  else {
     174    _useGlonass = false;
     175  }
     176
     177  int nextPar = 0;
     178  _params.push_back(new bncParam(bncParam::CRD_X,      ++nextPar, ""));
     179  _params.push_back(new bncParam(bncParam::CRD_Y,      ++nextPar, ""));
     180  _params.push_back(new bncParam(bncParam::CRD_Z,      ++nextPar, ""));
     181  _params.push_back(new bncParam(bncParam::RECCLK_GPS, ++nextPar, ""));
     182  if (_useGlonass) {
     183    _params.push_back(new bncParam(bncParam::RECCLK_GLO,  ++nextPar, ""));
     184  }
    146185  if (_estTropo) {
    147     _params.push_back(new bncParam(bncParam::TROPO,  5, ""));
     186    _params.push_back(new bncParam(bncParam::TROPO,       ++nextPar, ""));
    148187  }
    149188
     
    151190
    152191  _QQ.ReSize(nPar);
     192
    153193  _QQ = 0.0;
    154194
    155   _QQ(1,1) = sig_crd_0 * sig_crd_0;
    156   _QQ(2,2) = sig_crd_0 * sig_crd_0;
    157   _QQ(3,3) = sig_crd_0 * sig_crd_0;
    158   _QQ(4,4) = sig_clk_0 * sig_clk_0;
    159   if (_estTropo) {
    160     _QQ(5,5) = sig_trp_0 * sig_trp_0;
     195  for (int iPar = 1; iPar <= _params.size(); iPar++) {
     196    bncParam* pp = _params[iPar-1];
     197    if      (pp->isCrd()) {
     198      _QQ(iPar,iPar) = sig_crd_0 * sig_crd_0;
     199    }
     200    else if (pp->isClk()) {
     201      _QQ(iPar,iPar) = sig_clk_0 * sig_clk_0;
     202    }
     203    else if (pp->type == bncParam::TROPO) {
     204      _QQ(iPar,iPar) = sig_trp_0 * sig_trp_0;
     205    }
    161206  }
    162207
     
    300345                     trp() / sin(satData->eleSat);
    301346
    302   return satData->rho + clk() - satData->clk + tropDelay;
     347  double clk = 0.0;
     348  if      (satData->prn[0] == 'G') {
     349    clk = clkGPS();
     350  }
     351  else if (satData->prn[0] == 'R') {
     352    clk = clkGlo();
     353  }
     354
     355  cout << satData->prn.toAscii().data() << "  "
     356       << clk << " " << satData->rho + clk - satData->clk + tropDelay << endl;
     357
     358  return satData->rho + clk - satData->clk + tropDelay;
    303359}
    304360
     
    378434      iGPS.next();
    379435      QString prn        = iGPS.key();
    380       t_satData* satData = iGPS.value();
    381436      bool    found = false;
    382437      for (int iPar = 1; iPar <= _params.size(); iPar++) {
     
    437492  }
    438493
    439   // Coordinates
    440   // -----------
    441   if (_static) {
    442     if (x() == 0.0 && y() == 0.0 && z() == 0.0) {
    443       _params[0]->xx = _xcBanc(1);
    444       _params[1]->xx = _xcBanc(2);
    445       _params[2]->xx = _xcBanc(3);
    446     }
    447   }
    448   else {
    449     _params[0]->xx = _xcBanc(1);
    450     _params[1]->xx = _xcBanc(2);
    451     _params[2]->xx = _xcBanc(3);
    452 
    453     _QQ(1,1) += sig_crd_p * sig_crd_p;
    454     _QQ(2,2) += sig_crd_p * sig_crd_p;
    455     _QQ(3,3) += sig_crd_p * sig_crd_p;
    456   }
    457 
    458   // Receiver Clocks
    459   // ---------------
    460   _params[3]->xx = _xcBanc(4);
     494  bool firstCrd = x() == 0.0 && y() == 0.0 && z() == 0.0;
     495
    461496  for (int iPar = 1; iPar <= _params.size(); iPar++) {
    462     _QQ(iPar, 4) = 0.0;
    463   }
    464   _QQ(4,4) = sig_clk_0 * sig_clk_0;
    465 
    466   // Tropospheric Delay
    467   // ------------------
    468   if (_estTropo) {
    469     _QQ(5,5) += sig_trp_p * sig_trp_p;
     497    bncParam* pp = _params[iPar-1];
     498 
     499    // Coordinates
     500    // -----------
     501    if      (pp->type == bncParam::CRD_X) {
     502      if (firstCrd || !_static) {
     503        pp->xx = _xcBanc(1);
     504      }
     505      _QQ(iPar,iPar) += sig_crd_p * sig_crd_p;
     506    }
     507    else if (pp->type == bncParam::CRD_Y) {
     508      if (firstCrd || !_static) {
     509        pp->xx = _xcBanc(2);
     510      }
     511      _QQ(iPar,iPar) += sig_crd_p * sig_crd_p;
     512    }
     513    else if (pp->type == bncParam::CRD_Z) {
     514      if (firstCrd || !_static) {
     515        pp->xx = _xcBanc(3);
     516      }
     517      _QQ(iPar,iPar) += sig_crd_p * sig_crd_p;
     518    }   
     519
     520    // Receiver Clocks
     521    // ---------------
     522    else if (pp->isClk()) {
     523      pp->xx = _xcBanc(4);
     524      for (int jj = 1; jj <= _params.size(); jj++) {
     525        _QQ(iPar, jj) = 0.0;
     526      }
     527      _QQ(iPar,iPar) = sig_clk_0 * sig_clk_0;
     528    }
     529
     530    // Tropospheric Delay
     531    // ------------------
     532    else if (pp->type == bncParam::TROPO) {
     533      _QQ(iPar,iPar) += sig_trp_p * sig_trp_p;
     534    }
    470535  }
    471536}
     
    543608      PP(iObs,iObs) = 1.0 / (sig_P3 * sig_P3) / ellWgtCoeff;
    544609      for (int iPar = 1; iPar <= _params.size(); iPar++) {
    545         AA(iObs, iPar) = _params[iPar-1]->partial(satData, "");
     610        AA(iObs, iPar) = _params[iPar-1]->partial(satData, false);
    546611      }
    547612   
     
    555620            ll(iObs) -= _params[iPar-1]->xx;
    556621          }
    557           AA(iObs, iPar) = _params[iPar-1]->partial(satData, prn);
     622          AA(iObs, iPar) = _params[iPar-1]->partial(satData, true);
    558623        }
    559624      }
     
    586651            ll(iObs) -= _params[iPar-1]->xx;
    587652          }
    588           AA(iObs, iPar) = _params[iPar-1]->partial(satData, prn);
     653          AA(iObs, iPar) = _params[iPar-1]->partial(satData, true);
    589654        }
    590655     
     
    623688    bncParam* par = itPar.next();
    624689    par->xx += dx(par->index);
    625     if      (par->type == bncParam::RECCLK) {
    626       str1 << "\n    clk = " << setw(6) << setprecision(3) << par->xx
     690    if      (par->type == bncParam::RECCLK_GPS) {
     691      str1 << "\n    clk GPS = " << setw(6) << setprecision(3) << par->xx
     692           << " +- " << setw(6) << setprecision(3)
     693           << sqrt(_QQ(par->index,par->index));
     694    }
     695    if      (par->type == bncParam::RECCLK_GLO) {
     696      str1 << "\n    clk GLO = " << setw(6) << setprecision(3) << par->xx
    627697           << " +- " << setw(6) << setprecision(3)
    628698           << sqrt(_QQ(par->index,par->index));
     
    656726       << setw(14) << setprecision(3) << z()                  << " +- "
    657727       << setw(6)  << setprecision(3) << sqrt(_QQ(3,3));
    658   if (_estTropo) {
    659     str2 << "    " << setw(6) << setprecision(3) << trp()     << " +- "
    660          << setw(6)  << setprecision(3) << sqrt(_QQ(5,5));
    661   }
    662728
    663729  emit newMessage(_log, false);
Note: See TracChangeset for help on using the changeset viewer.