- Timestamp:
- Dec 1, 2009, 1:20:17 PM (15 years ago)
- Location:
- trunk/BNC
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncmodel.cpp
r2059 r2060 40 40 41 41 #include <iomanip> 42 #include <newmatio.h> 42 43 43 44 #include "bncmodel.h" … … 56 57 //////////////////////////////////////////////////////////////////////////// 57 58 bncParam::~bncParam() { 59 } 60 61 // Partial 62 //////////////////////////////////////////////////////////////////////////// 63 double 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; 58 77 } 59 78 … … 65 84 _params.push_back(new bncParam(bncParam::CRD_Y)); 66 85 _params.push_back(new bncParam(bncParam::CRD_Z)); 86 _params.push_back(new bncParam(bncParam::RECCLK)); 67 87 } 68 88 … … 87 107 int iObs = 0; 88 108 while (it.hasNext()) { 109 ++iObs; 89 110 it.next(); 90 111 QString prn = it.key(); 91 112 t_satData* satData = it.value(); 92 ++iObs;93 113 BB(iObs, 1) = satData->xx(1); 94 114 BB(iObs, 2) = satData->xx(2); … … 99 119 bancroft(BB, _xcBanc); 100 120 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 101 140 return success; 102 141 } 142 143 // Computed Value 144 //////////////////////////////////////////////////////////////////////////// 145 double 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 //////////////////////////////////////////////////////////////////////////// 164 t_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 32 32 33 33 class t_epoData; 34 class t_satData; 34 35 35 36 class bncParam { 36 37 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}; 38 39 bncParam(parType typeIn); 39 40 ~bncParam(); 41 double partialP3(t_satData* satData); 40 42 parType type; 41 43 double x0; … … 47 49 ~bncModel(); 48 50 t_irc cmpBancroft(t_epoData* epoData); 51 t_irc update(t_epoData* epoData); 49 52 const ColumnVector& xcBanc() const {return _xcBanc;} 53 const ColumnVector& xx() const {return _xx;} 50 54 51 55 private: 56 double cmpValueP3(t_satData* satData); 52 57 QList<bncParam*> _params; 53 Matrix _QQ; 58 SymmetricMatrix _QQ; 59 Matrix _AA; 60 ColumnVector _ll; 61 ColumnVector _dx; 54 62 ColumnVector _xx; 55 63 ColumnVector _xcBanc; -
trunk/BNC/bncpppclient.cpp
r2058 r2060 311 311 } 312 312 313 // Filter Solution 314 // --------------- 315 if (_model->update(_epoData) != success) { 316 return; 317 } 318 313 319 ostringstream str; 314 320 str.setf(ios::fixed); -
trunk/BNC/bncpppclient.h
r2058 r2060 52 52 double clk; 53 53 bool clkCorr; 54 double rho; 54 55 }; 55 56
Note:
See TracChangeset
for help on using the changeset viewer.