Changeset 3440 in ntrip for trunk/BNC


Ignore:
Timestamp:
Sep 22, 2011, 11:05:02 AM (13 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/combination
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/combination/bnccomb.cpp

    r3439 r3440  
    3838const double sigP_clkSat   =  100.0;
    3939
     40const double sigObs        =   0.05;
     41
    4042const int MAXPRN_GPS = 32;
    4143
     
    356358
    357359  int nPar = _params.size();
    358   int nObs = corrs().size();
    359 
    360   if (nObs == 0) {
    361     return;
    362   }
    363360
    364361  _log.clear();
     
    402399  }
    403400
    404   // Create First Design Matrix and Vector of Measurements
    405   // -----------------------------------------------------
    406   const double Pl = 1.0 / (0.05 * 0.05);
    407 
    408   const int nCon = (_firstReg == false) ? 1 + MAXPRN_GPS : 1;
    409   Matrix         AA(nObs+nCon, nPar);  AA = 0.0;
    410   ColumnVector   ll(nObs+nCon);        ll = 0.0;
    411   DiagonalMatrix PP(nObs+nCon);        PP = Pl;
    412 
    413   int iObs = 0;
    414 
     401  Matrix         AA;
     402  ColumnVector   ll;
     403  DiagonalMatrix PP;
    415404  QMap<QString, t_corr*> resCorr;
    416405
    417   QVectorIterator<cmbCorr*> itCorr(corrs());
    418   while (itCorr.hasNext()) {
    419     cmbCorr* corr = itCorr.next();
    420     QString  prn  = corr->prn;
    421     switchToLastEph(_eph[prn]->last, corr);
    422     ++iObs;
    423 
    424     if (resCorr.find(prn) == resCorr.end()) {
    425       resCorr[prn] = new t_corr(*corr);
    426     }
    427 
    428     for (int iPar = 1; iPar <= _params.size(); iPar++) {
    429       cmbParam* pp = _params[iPar-1];
    430       AA(iObs, iPar) = pp->partial(corr->acName, prn);
    431     }
    432 
    433     ll(iObs) = corr->dClk * t_CST::c - DotProduct(AA.Row(iObs), x0);
    434   }
    435 
    436   // Regularization
    437   // --------------
    438   const double Ph = 1.e6;
    439   int iCond = 1;
    440   PP(nObs+iCond)          = Ph;
    441   for (int iPar = 1; iPar <= _params.size(); iPar++) {
    442     cmbParam* pp = _params[iPar-1];
    443     if (pp->type == cmbParam::clkSat &&
    444         AA.Column(iPar).maximum_absolute_value() > 0.0) {
    445       AA(nObs+iCond, iPar) = 1.0;
    446     }
    447   }
    448 
    449   if (!_firstReg) {
    450     _firstReg = true;
    451     for (int iGps = 1; iGps <= MAXPRN_GPS; iGps++) {
    452       ++iCond;
    453       QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
    454       PP(nObs+1+iGps)       = Ph;
    455       for (int iPar = 1; iPar <= _params.size(); iPar++) {
    456         cmbParam* pp = _params[iPar-1];
    457         if (pp->type == cmbParam::offACSat && pp->prn == prn) {
    458           AA(nObs+iCond, iPar) = 1.0;
    459         }
    460       }
    461     }
     406  if (createAmat(AA, ll, PP, x0, resCorr) != success) {
     407    return;
    462408  }
    463409
     
    689635  }
    690636}
     637
     638// Create First Design Matrix and Vector of Measurements
     639////////////////////////////////////////////////////////////////////////////
     640t_irc bncComb::createAmat(Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
     641                          const ColumnVector& x0,
     642                          QMap<QString, t_corr*>& resCorr) {
     643
     644  unsigned nPar = _params.size();
     645  unsigned nObs = corrs().size();
     646
     647  if (nObs == 0) {
     648    return failure;
     649  }
     650
     651  const int nCon = (_firstReg == false) ? 2 + MAXPRN_GPS : 2;
     652
     653  AA.ReSize(nObs+nCon, nPar);  AA = 0.0;
     654  ll.ReSize(nObs+nCon);        ll = 0.0;
     655  PP.ReSize(nObs+nCon);        PP = 1.0 / (sigObs * sigObs);
     656
     657  int iObs = 0;
     658
     659  QVectorIterator<cmbCorr*> itCorr(corrs());
     660  while (itCorr.hasNext()) {
     661    cmbCorr* corr = itCorr.next();
     662    QString  prn  = corr->prn;
     663    switchToLastEph(_eph[prn]->last, corr);
     664    ++iObs;
     665
     666    if (resCorr.find(prn) == resCorr.end()) {
     667      resCorr[prn] = new t_corr(*corr);
     668    }
     669
     670    for (int iPar = 1; iPar <= _params.size(); iPar++) {
     671      cmbParam* pp = _params[iPar-1];
     672      AA(iObs, iPar) = pp->partial(corr->acName, prn);
     673    }
     674
     675    ll(iObs) = corr->dClk * t_CST::c - DotProduct(AA.Row(iObs), x0);
     676  }
     677
     678  // Regularization
     679  // --------------
     680  const double Ph = 1.e6;
     681  int iCond = 1;
     682  PP(nObs+iCond)          = Ph;
     683  for (int iPar = 1; iPar <= _params.size(); iPar++) {
     684    cmbParam* pp = _params[iPar-1];
     685    if (pp->type == cmbParam::clkSat &&
     686        AA.Column(iPar).maximum_absolute_value() > 0.0) {
     687      AA(nObs+iCond, iPar) = 1.0;
     688    }
     689  }
     690
     691  ++iCond;
     692  PP(nObs+iCond) = Ph;
     693  for (int iPar = 1; iPar <= _params.size(); iPar++) {
     694    cmbParam* pp = _params[iPar-1];
     695    if (pp->type == cmbParam::offAC &&
     696        AA.Column(iPar).maximum_absolute_value() > 0.0) {
     697      AA(nObs+iCond, iPar) = 1.0;
     698    }
     699  }
     700
     701  if (!_firstReg) {
     702    _firstReg = true;
     703    for (int iGps = 1; iGps <= MAXPRN_GPS; iGps++) {
     704      ++iCond;
     705      QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
     706      PP(nObs+1+iGps)       = Ph;
     707      for (int iPar = 1; iPar <= _params.size(); iPar++) {
     708        cmbParam* pp = _params[iPar-1];
     709        if (pp->type == cmbParam::offACSat && pp->prn == prn) {
     710          AA(nObs+iCond, iPar) = 1.0;
     711        }
     712      }
     713    }
     714  }
     715
     716  return success;
     717}
  • trunk/BNC/combination/bnccomb.h

    r3439 r3440  
    7373
    7474  void processEpoch();
     75  t_irc createAmat(Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
     76                   const ColumnVector& x0, QMap<QString, t_corr*>& resCorr);
    7577  void dumpResults(const QMap<QString, t_corr*>& resCorr);
    7678  void printResults(QTextStream& out, const QMap<QString, t_corr*>& resCorr);
Note: See TracChangeset for help on using the changeset viewer.