Changeset 2060 in ntrip


Ignore:
Timestamp:
Dec 1, 2009, 1:20:17 PM (14 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncmodel.cpp

    r2059 r2060  
    4040
    4141#include <iomanip>
     42#include <newmatio.h>
    4243
    4344#include "bncmodel.h"
     
    5657////////////////////////////////////////////////////////////////////////////
    5758bncParam::~bncParam() {
     59}
     60
     61// Partial
     62////////////////////////////////////////////////////////////////////////////
     63double bncParam::partialP3(t_satData* satData) {
     64  if      (type == CRD_X) {
     65    return (x0 - satData->xx(1)) / satData->rho;
     66  }
     67  else if (type == CRD_Y) {
     68    return (x0 - satData->xx(2)) / satData->rho;
     69  }
     70  else if (type == CRD_Z) {
     71    return (x0 - satData->xx(3)) / satData->rho;
     72  }
     73  else if (type == RECCLK) {
     74    return 1.0;
     75  }
     76  return 0.0;
    5877}
    5978
     
    6584  _params.push_back(new bncParam(bncParam::CRD_Y));
    6685  _params.push_back(new bncParam(bncParam::CRD_Z));
     86  _params.push_back(new bncParam(bncParam::RECCLK));
    6787}
    6888
     
    87107  int iObs = 0;
    88108  while (it.hasNext()) {
     109    ++iObs;
    89110    it.next();
    90111    QString    prn     = it.key();
    91112    t_satData* satData = it.value();
    92     ++iObs;
    93113    BB(iObs, 1) = satData->xx(1);
    94114    BB(iObs, 2) = satData->xx(2);
     
    99119  bancroft(BB, _xcBanc);
    100120
     121  // Set Parameter A Priori Values
     122  // -----------------------------
     123  QListIterator<bncParam*> itPar(_params);
     124  while (itPar.hasNext()) {
     125    bncParam* par = itPar.next();
     126    if      (par->type == bncParam::CRD_X) {
     127      par->x0 = _xcBanc(1);
     128    }
     129    else if (par->type == bncParam::CRD_Y) {
     130      par->x0 = _xcBanc(2);
     131    }
     132    else if (par->type == bncParam::CRD_Z) {
     133      par->x0 = _xcBanc(3);
     134    }
     135    else if (par->type == bncParam::RECCLK) {
     136      par->x0 = _xcBanc(4);
     137    }
     138  }
     139
    101140  return success;
    102141}
     142
     143// Computed Value
     144////////////////////////////////////////////////////////////////////////////
     145double bncModel::cmpValueP3(t_satData* satData) {
     146
     147  double rho0 = (satData->xx - _xcBanc.Rows(1,3)).norm_Frobenius();
     148
     149  ColumnVector xRec(3);
     150  double dPhi = t_CST::omega * rho0 / t_CST::c;
     151  xRec(1) = _xcBanc(1) * cos(dPhi) - _xcBanc(2) * sin(dPhi);
     152  xRec(2) = _xcBanc(2) * cos(dPhi) + _xcBanc(1) * sin(dPhi);
     153  xRec(3) = _xcBanc(3);
     154
     155  satData->rho = (satData->xx - xRec).norm_Frobenius();
     156
     157  double tropDelay = 0.0;
     158
     159  return satData->rho + _xcBanc(4) + tropDelay;
     160}
     161
     162// Update Step of the Filter (currently just a single-epoch solution)
     163////////////////////////////////////////////////////////////////////////////
     164t_irc bncModel::update(t_epoData* epoData) {
     165
     166  unsigned nPar = _params.size();
     167  unsigned nObs = epoData->size();
     168
     169  cout << "update " << nPar << " " << nObs << endl;
     170
     171  _AA.ReSize(nObs, nPar);  // variance-covariance matrix
     172  _ll.ReSize(nObs);        // tems observed-computed
     173
     174  unsigned iObs = 0;
     175  QMapIterator<QString, t_satData*> itObs(epoData->satData);
     176  while (itObs.hasNext()) {
     177    ++iObs;
     178    itObs.next();
     179    QString    prn     = itObs.key();
     180    t_satData* satData = itObs.value();
     181    _ll(iObs) = cmpValueP3(satData);
     182
     183    unsigned iPar = 0;
     184    QListIterator<bncParam*> itPar(_params);
     185    while (itPar.hasNext()) {
     186      ++iPar;
     187      bncParam* par = itPar.next();
     188      _AA(iObs, iPar) = par->partialP3(satData);
     189    }
     190  }
     191
     192  cout << _AA << endl;
     193  cout.flush();
     194
     195  _QQ.ReSize(nPar);
     196  _QQ << _AA.t() * _AA;
     197  _QQ = _QQ.i();
     198  _dx = _QQ * _AA.t() * _ll;
     199
     200  _xx.ReSize(nPar);
     201
     202  unsigned iPar = 0;
     203  QListIterator<bncParam*> itPar(_params);
     204  while (itPar.hasNext()) {
     205    ++iPar;
     206    bncParam* par = itPar.next();
     207    _xx(iPar) = par->x0 + _dx(iPar);
     208  }
     209
     210  return success;
     211}
  • trunk/BNC/bncmodel.h

    r2059 r2060  
    3232
    3333class t_epoData;
     34class t_satData;
    3435
    3536class bncParam {
    3637 public:
    37   enum parType {CRD_X, CRD_Y, CRD_Z, TROPO, AMB_L3};
     38  enum parType {CRD_X, CRD_Y, CRD_Z, RECCLK, TROPO, AMB_L3};
    3839  bncParam(parType typeIn);
    3940  ~bncParam();
     41  double partialP3(t_satData* satData);
    4042  parType  type;
    4143  double   x0;
     
    4749  ~bncModel();
    4850  t_irc cmpBancroft(t_epoData* epoData);
     51  t_irc update(t_epoData* epoData);
    4952  const ColumnVector& xcBanc() const {return _xcBanc;}
     53  const ColumnVector& xx()     const {return _xx;}
    5054 
    5155 private:
     56  double cmpValueP3(t_satData* satData);
    5257  QList<bncParam*> _params;
    53   Matrix           _QQ;
     58  SymmetricMatrix  _QQ;
     59  Matrix           _AA;
     60  ColumnVector     _ll;
     61  ColumnVector     _dx;
    5462  ColumnVector     _xx;
    5563  ColumnVector     _xcBanc;
  • trunk/BNC/bncpppclient.cpp

    r2058 r2060  
    311311  }
    312312
     313  // Filter Solution
     314  // ---------------
     315  if (_model->update(_epoData) != success) {
     316    return;
     317  }
     318
    313319  ostringstream str;
    314320  str.setf(ios::fixed);
  • trunk/BNC/bncpppclient.h

    r2058 r2060  
    5252  double       clk;
    5353  bool         clkCorr;
     54  double       rho;
    5455};
    5556
Note: See TracChangeset for help on using the changeset viewer.