Changeset 2073 in ntrip
- Timestamp:
- Dec 5, 2009, 12:07:52 PM (15 years ago)
- Location:
- trunk/BNC
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncmodel.cpp
r2071 r2073 52 52 const unsigned MINOBS = 4; 53 53 const double MINELE = 10.0 * M_PI / 180.0; 54 const double sig_crd_0 = 100.0; 55 const double sig_crd_p = 100.0; 56 const double sig_clk_0 = 1000.0; 54 57 55 58 // Constructor 56 59 //////////////////////////////////////////////////////////////////////////// 57 bncParam::bncParam(bncParam::parType typeIn) { 58 type = typeIn; 60 bncParam::bncParam(bncParam::parType typeIn, int indexIn) { 61 type = typeIn; 62 index = indexIn; 63 x0 = 0.0; 64 xx = 0.0; 59 65 } 60 66 … … 86 92 bncModel::bncModel() { 87 93 _xcBanc.ReSize(4); _xcBanc = 0.0; 88 _params.push_back(new bncParam(bncParam::CRD_X ));89 _params.push_back(new bncParam(bncParam::CRD_Y ));90 _params.push_back(new bncParam(bncParam::CRD_Z ));91 _params.push_back(new bncParam(bncParam::RECCLK ));94 _params.push_back(new bncParam(bncParam::CRD_X, 1)); 95 _params.push_back(new bncParam(bncParam::CRD_Y, 2)); 96 _params.push_back(new bncParam(bncParam::CRD_Z, 3)); 97 _params.push_back(new bncParam(bncParam::RECCLK, 4)); 92 98 _ellBanc.ReSize(3); 99 100 unsigned nPar = _params.size(); 101 _QQ.ReSize(nPar); 102 _QQ = 0.0; 103 104 _QQ(1,1) = sig_crd_0 * sig_crd_0; 105 _QQ(2,2) = sig_crd_0 * sig_crd_0; 106 _QQ(3,3) = sig_crd_0 * sig_crd_0; 107 _QQ(4,4) = sig_clk_0 * sig_clk_0; 108 109 _xx.ReSize(nPar); 110 _xx = 0.0; 93 111 } 94 112 … … 123 141 bancroft(BB, _xcBanc); 124 142 125 // Set Parameter A Priori Values126 // -----------------------------127 QListIterator<bncParam*> itPar(_params);128 while (itPar.hasNext()) {129 bncParam* par = itPar.next();130 if (par->type == bncParam::CRD_X) {131 par->x0 = _xcBanc(1);132 }133 else if (par->type == bncParam::CRD_Y) {134 par->x0 = _xcBanc(2);135 }136 else if (par->type == bncParam::CRD_Z) {137 par->x0 = _xcBanc(3);138 }139 else if (par->type == bncParam::RECCLK) {140 par->x0 = _xcBanc(4);141 }142 }143 144 143 // Ellipsoidal Coordinates 145 144 // ------------------------ … … 179 178 double bncModel::cmpValueP3(t_satData* satData) { 180 179 181 double rho0 = (satData->xx - _xcBanc.Rows(1,3)).norm_Frobenius();182 183 180 ColumnVector xRec(3); 181 xRec(1) = x(); 182 xRec(2) = y(); 183 xRec(3) = z(); 184 185 double rho0 = (satData->xx - xRec).norm_Frobenius(); 184 186 double dPhi = t_CST::omega * rho0 / t_CST::c; 185 xRec(1) = _xcBanc(1) * cos(dPhi) - _xcBanc(2) * sin(dPhi); 186 xRec(2) = _xcBanc(2) * cos(dPhi) + _xcBanc(1) * sin(dPhi); 187 xRec(3) = _xcBanc(3); 187 188 xRec(1) = x() * cos(dPhi) - y() * sin(dPhi); 189 xRec(2) = y() * cos(dPhi) + x() * sin(dPhi); 190 xRec(3) = z(); 188 191 189 192 satData->rho = (satData->xx - xRec).norm_Frobenius(); … … 191 194 double tropDelay = delay_saast(satData->eleSat); 192 195 193 return satData->rho + _xcBanc(4) - satData->clk + tropDelay;196 return satData->rho + clk() - satData->clk + tropDelay; 194 197 } 195 198 … … 227 230 } 228 231 232 // Prediction Step of the Filter 233 //////////////////////////////////////////////////////////////////////////// 234 void bncModel::predict() { 235 236 _params[0]->x0 = _xcBanc(1); 237 _params[1]->x0 = _xcBanc(2); 238 _params[2]->x0 = _xcBanc(3); 239 _params[3]->x0 = _xcBanc(4); 240 241 _params[0]->xx = 0.0; 242 _params[1]->xx = 0.0; 243 _params[2]->xx = 0.0; 244 _params[3]->xx = 0.0; 245 246 _QQ(1,1) += sig_crd_p * sig_crd_p; 247 _QQ(2,2) += sig_crd_p * sig_crd_p; 248 _QQ(3,3) += sig_crd_p * sig_crd_p; 249 250 for (int iPar = 1; iPar <= _params.size(); iPar++) { 251 _QQ(iPar, 4) = 0.0; 252 } 253 _QQ(4,4) = sig_clk_0 * sig_clk_0; 254 255 _xx = 0.0; 256 } 257 229 258 // Update Step of the Filter (currently just a single-epoch solution) 230 259 //////////////////////////////////////////////////////////////////////////// … … 235 264 } 236 265 266 predict(); 267 237 268 unsigned nPar = _params.size(); 238 269 unsigned nObs = epoData->size(); … … 240 271 // Create First-Design Matrix 241 272 // -------------------------- 242 _AA.ReSize(nObs, nPar); // variance-covariancematrix243 _ll.ReSize(nObs); // tems observed-computed273 Matrix AA(nObs, nPar); // first design matrix 274 ColumnVector ll(nObs); // tems observed-computed 244 275 245 276 unsigned iObs = 0; … … 250 281 QString prn = itObs.key(); 251 282 t_satData* satData = itObs.value(); 252 _ll(iObs) = satData->P3 - cmpValueP3(satData); 253 254 unsigned iPar = 0; 255 QListIterator<bncParam*> itPar(_params); 256 while (itPar.hasNext()) { 257 ++iPar; 258 bncParam* par = itPar.next(); 259 _AA(iObs, iPar) = par->partialP3(satData); 283 ll(iObs) = satData->P3 - cmpValueP3(satData); 284 285 for (int iPar = 1; iPar <= _params.size(); iPar++) { 286 AA(iObs, iPar) = _params[iPar-1]->partialP3(satData); 260 287 } 261 288 } 262 289 263 // Compute Least-Squares Solution264 // --------------------- ---------265 _QQ.ReSize(nPar);266 _QQ << _AA.t() * _AA;267 _QQ = _QQ.i();268 _dx = _QQ * _AA.t() * _ll;269 270 // Compute Residuals271 // -----------------272 ColumnVector vv = _AA * _dx - _ll;290 // Compute Kalman Update 291 // --------------------- 292 IdentityMatrix PP(nObs); 293 SymmetricMatrix HH; HH << PP + AA * _QQ * AA.t(); 294 SymmetricMatrix Hi = HH.i(); 295 Matrix KK = _QQ * AA.t() * Hi; 296 ColumnVector v1 = ll - AA * _xx; 297 _xx = _xx + KK * v1; 298 IdentityMatrix Id(nPar); 299 _QQ << (Id - KK * AA) * _QQ; 273 300 274 301 // Set Solution Vector 275 302 // ------------------- 276 _xx.ReSize(nPar); 277 unsigned iPar = 0; 278 QListIterator<bncParam*> itPar(_params); 303 QVectorIterator<bncParam*> itPar(_params); 279 304 while (itPar.hasNext()) { 280 ++iPar;281 305 bncParam* par = itPar.next(); 282 _xx(iPar) = par->x0 + _dx(iPar);306 par->xx = _xx(par->index); 283 307 } 284 308 -
trunk/BNC/bncmodel.h
r2065 r2073 37 37 public: 38 38 enum parType {CRD_X, CRD_Y, CRD_Z, RECCLK, TROPO, AMB_L3}; 39 bncParam(parType typeIn );39 bncParam(parType typeIn, int indexIn); 40 40 ~bncParam(); 41 41 double partialP3(t_satData* satData); 42 bool isCrd() const { 43 return (type == CRD_X || type == CRD_Y || type == CRD_Z); 44 } 45 double solVal() const {return x0 + xx;} 46 double aprVal() const {return x0;} 42 47 parType type; 48 double xx; 43 49 double x0; 50 int index; 44 51 }; 45 52 … … 50 57 t_irc cmpBancroft(t_epoData* epoData); 51 58 t_irc update(t_epoData* epoData); 52 const ColumnVector& xcBanc() const {return _xcBanc;} 53 const ColumnVector& xx() const {return _xx;} 59 double x() const {return _params[0]->solVal();} 60 double y() const {return _params[1]->solVal();} 61 double z() const {return _params[2]->solVal();} 62 double clk() const {return _params[3]->solVal();} 54 63 55 64 private: 56 65 double cmpValueP3(t_satData* satData); 57 66 double delay_saast(double Ele); 67 void predict(); 58 68 59 QList<bncParam*> _params; 60 SymmetricMatrix _QQ; 61 Matrix _AA; 62 ColumnVector _ll; 63 ColumnVector _dx; 64 ColumnVector _xx; 65 ColumnVector _xcBanc; 66 ColumnVector _ellBanc; 69 QVector<bncParam*> _params; 70 SymmetricMatrix _QQ; 71 ColumnVector _xx; 72 ColumnVector _xcBanc; 73 ColumnVector _ellBanc; 67 74 }; 68 75 -
trunk/BNC/bncpppclient.cpp
r2069 r2073 344 344 str << " PPP " << _staID.data() << " " 345 345 << _epoData->tt.timestr(1) << " " << _epoData->size() << " " 346 << setw(14) << setprecision(3) << _model->x x()(1) << " "347 << setw(14) << setprecision(3) << _model-> xx()(2) << " "348 << setw(14) << setprecision(3) << _model-> xx()(3);346 << setw(14) << setprecision(3) << _model->x() << " " 347 << setw(14) << setprecision(3) << _model->y() << " " 348 << setw(14) << setprecision(3) << _model->z(); 349 349 350 350 emit newMessage(QString(str.str().c_str()).toAscii(), true);
Note:
See TracChangeset
for help on using the changeset viewer.