Changeset 7287 in ntrip for trunk/BNC/src
- Timestamp:
- Sep 18, 2015, 12:38:18 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP_SSR_I/pppFilter.cpp
r7235 r7287 35 35 * Created: 01-Dec-2009 36 36 * 37 * Changes: 37 * Changes: 38 38 * 39 39 * -----------------------------------------------------------------------*/ … … 66 66 // Constructor 67 67 //////////////////////////////////////////////////////////////////////////// 68 t_pppParam::t_pppParam(t_pppParam::parType typeIn, int indexIn, 68 t_pppParam::t_pppParam(t_pppParam::parType typeIn, int indexIn, 69 69 const QString& prnIn) { 70 70 type = typeIn; … … 90 90 // ----------- 91 91 if (type == CRD_X) { 92 return (xx - satData->xx(1)) / satData->rho; 92 return (xx - satData->xx(1)) / satData->rho; 93 93 } 94 94 else if (type == CRD_Y) { 95 return (xx - satData->xx(2)) / satData->rho; 95 return (xx - satData->xx(2)) / satData->rho; 96 96 } 97 97 else if (type == CRD_Z) { 98 return (xx - satData->xx(3)) / satData->rho; 98 return (xx - satData->xx(3)) / satData->rho; 99 99 } 100 100 … … 108 108 // ----------- 109 109 else if (type == TROPO) { 110 return 1.0 / sin(satData->eleSat); 110 return 1.0 / sin(satData->eleSat); 111 111 } 112 112 … … 238 238 } 239 239 240 _QQ.ReSize(_params.size()); 240 _QQ.ReSize(_params.size()); 241 241 _QQ = 0.0; 242 242 for (int iPar = 1; iPar <= _params.size(); iPar++) { … … 244 244 pp->xx = 0.0; 245 245 if (pp->isCrd()) { 246 _QQ(iPar,iPar) = OPT->_aprSigCrd(1) * OPT->_aprSigCrd(1); 246 _QQ(iPar,iPar) = OPT->_aprSigCrd(1) * OPT->_aprSigCrd(1); 247 247 } 248 248 else if (pp->type == t_pppParam::RECCLK) { 249 _QQ(iPar,iPar) = OPT->_noiseClk * OPT->_noiseClk; 249 _QQ(iPar,iPar) = OPT->_noiseClk * OPT->_noiseClk; 250 250 } 251 251 else if (pp->type == t_pppParam::TROPO) { 252 _QQ(iPar,iPar) = OPT->_aprSigTrp * OPT->_aprSigTrp; 252 _QQ(iPar,iPar) = OPT->_aprSigTrp * OPT->_aprSigTrp; 253 253 pp->xx = lastTrp; 254 254 } … … 327 327 328 328 double rho0 = (satData->xx - xRec).norm_Frobenius(); 329 double dPhi = t_CST::omega * rho0 / t_CST::c; 330 331 xRec(1) = x() * cos(dPhi) - y() * sin(dPhi); 332 xRec(2) = y() * cos(dPhi) + x() * sin(dPhi); 329 double dPhi = t_CST::omega * rho0 / t_CST::c; 330 331 xRec(1) = x() * cos(dPhi) - y() * sin(dPhi); 332 xRec(2) = y() * cos(dPhi) + x() * sin(dPhi); 333 333 xRec(3) = z(); 334 334 … … 337 337 satData->rho = (satData->xx - xRec).norm_Frobenius(); 338 338 339 double tropDelay = delay_saast(satData->eleSat) + 339 double tropDelay = delay_saast(satData->eleSat) + 340 340 trp() / sin(satData->eleSat); 341 341 … … 364 364 } 365 365 double phaseCenter = 0.0; 366 if (_antex) { 366 if (_antex) { 367 367 bool found; 368 368 phaseCenter = satData->lkA * _antex->rcvCorr(OPT->_antNameRover, frqA, … … 382 382 double cose = cos(satData->eleSat); 383 383 double sine = sin(satData->eleSat); 384 antennaOffset = -OPT->_neuEccRover(1) * cosa*cose 385 -OPT->_neuEccRover(2) * sina*cose 384 antennaOffset = -OPT->_neuEccRover(1) * cosa*cose 385 -OPT->_neuEccRover(2) * sina*cose 386 386 -OPT->_neuEccRover(3) * sine; 387 387 388 return satData->rho + phaseCenter + antennaOffset + clk() 388 return satData->rho + phaseCenter + antennaOffset + clk() 389 389 + offset - satData->clk + tropDelay + wind; 390 390 } … … 396 396 Tracer tracer("t_pppFilter::delay_saast"); 397 397 398 double xyz[3]; 398 double xyz[3]; 399 399 xyz[0] = x(); 400 400 xyz[1] = y(); 401 401 xyz[2] = z(); 402 double ell[3]; 402 double ell[3]; 403 403 xyz2ell(xyz, ell); 404 404 double height = ell[2]; … … 410 410 411 411 double h_km = height / 1000.0; 412 412 413 413 if (h_km < 0.0) h_km = 0.0; 414 414 if (h_km > 5.0) h_km = 5.0; 415 415 int ii = int(h_km + 1); 416 416 double href = ii - 1; 417 418 double bCor[6]; 417 418 double bCor[6]; 419 419 bCor[0] = 1.156; 420 420 bCor[1] = 1.006; … … 423 423 bCor[4] = 0.654; 424 424 bCor[5] = 0.563; 425 425 426 426 double BB = bCor[ii-1] + (bCor[ii]-bCor[ii-1]) * (h_km - href); 427 427 428 428 double zen = M_PI/2.0 - Ele; 429 429 … … 447 447 reset(); 448 448 } 449 449 450 450 // Use different white noise for Quick-Start mode 451 451 // ---------------------------------------------- … … 459 459 for (int iPar = 1; iPar <= _params.size(); iPar++) { 460 460 t_pppParam* pp = _params[iPar-1]; 461 461 462 462 // Coordinates 463 463 // ----------- … … 494 494 } 495 495 _QQ(iPar,iPar) += sigCrdP_used * sigCrdP_used; 496 } 497 496 } 497 498 498 // Receiver Clocks 499 499 // --------------- … … 505 505 _QQ(iPar,iPar) = OPT->_noiseClk * OPT->_noiseClk; 506 506 } 507 507 508 508 // Tropospheric Delay 509 509 // ------------------ … … 511 511 _QQ(iPar,iPar) += OPT->_noiseTrp * OPT->_noiseTrp; 512 512 } 513 513 514 514 // Glonass Offset 515 515 // -------------- … … 531 531 // ---------- 532 532 else if (pp->type == t_pppParam::BDS_OFFSET) { 533 _QQ(iPar,iPar) = 1000.0 * 1000.0; //TODO: TEST533 _QQ(iPar,iPar) += 0.1 * 0.1; //TODO: TEST 534 534 } 535 535 } … … 544 544 // ----------------------------------------------- 545 545 SymmetricMatrix QQ_old = _QQ; 546 546 547 547 for (int iPar = 1; iPar <= _params.size(); iPar++) { 548 548 _params[iPar-1]->index_old = _params[iPar-1]->index; 549 549 _params[iPar-1]->index = 0; 550 550 } 551 551 552 552 // Remove Ambiguity Parameters without observations 553 553 // ------------------------------------------------ … … 569 569 } 570 570 } 571 571 572 572 // Add new ambiguity parameters 573 573 // ---------------------------- … … 578 578 addAmb(satData); 579 579 } 580 580 581 581 int nPar = _params.size(); 582 582 _QQ.ReSize(nPar); _QQ = 0.0; … … 593 593 } 594 594 } 595 595 596 596 for (int ii = 1; ii <= nPar; ii++) { 597 597 t_pppParam* par = _params[ii-1]; … … 634 634 t_pppParam* par = itPar.next(); 635 635 if (par->type == t_pppParam::RECCLK) { 636 LOG << "\n clk = " << setw(10) << setprecision(3) << par->xx 637 << " +- " << setw(6) << setprecision(3) 636 LOG << "\n clk = " << setw(10) << setprecision(3) << par->xx 637 << " +- " << setw(6) << setprecision(3) 638 638 << sqrt(_QQ(par->index,par->index)); 639 639 } … … 641 641 ++par->numEpo; 642 642 LOG << "\n amb " << par->prn.mid(0,3).toAscii().data() << " = " 643 << setw(10) << setprecision(3) << par->xx 644 << " +- " << setw(6) << setprecision(3) 643 << setw(10) << setprecision(3) << par->xx 644 << " +- " << setw(6) << setprecision(3) 645 645 << sqrt(_QQ(par->index,par->index)) 646 646 << " nEpo = " << par->numEpo; … … 651 651 << setw(7) << setprecision(3) << aprTrp << " " 652 652 << setw(6) << setprecision(3) << showpos << par->xx << noshowpos 653 << " +- " << setw(6) << setprecision(3) 653 << " +- " << setw(6) << setprecision(3) 654 654 << sqrt(_QQ(par->index,par->index)); 655 655 } 656 656 else if (par->type == t_pppParam::GLONASS_OFFSET) { 657 LOG << "\n offGlo = " << setw(10) << setprecision(3) << par->xx 658 << " +- " << setw(6) << setprecision(3) 657 LOG << "\n offGlo = " << setw(10) << setprecision(3) << par->xx 658 << " +- " << setw(6) << setprecision(3) 659 659 << sqrt(_QQ(par->index,par->index)); 660 660 } 661 661 else if (par->type == t_pppParam::GALILEO_OFFSET) { 662 LOG << "\n offGal = " << setw(10) << setprecision(3) << par->xx 663 << " +- " << setw(6) << setprecision(3) 662 LOG << "\n offGal = " << setw(10) << setprecision(3) << par->xx 663 << " +- " << setw(6) << setprecision(3) 664 664 << sqrt(_QQ(par->index,par->index)); 665 665 } … … 679 679 // Final Message (both log file and screen) 680 680 // ---------------------------------------- 681 LOG << OPT->_roverName << " PPP " 681 LOG << OPT->_roverName << " PPP " 682 682 << epoData->tt.timestr(1) << " " << epoData->sizeAll() << " " 683 683 << setw(14) << setprecision(3) << x() << " +- " … … 722 722 QString prnGPS; 723 723 QString prnGlo; 724 double maxResGPS = 0.0; // all the other systems except GLONASS725 double maxResGlo = 0.0; // GLONASS 724 double maxResGPS = 0.0; // GPS + Galileo 725 double maxResGlo = 0.0; // GLONASS + BDS 726 726 findMaxRes(vv, satData, prnGPS, prnGlo, maxResGPS, maxResGlo); 727 727 728 728 if (iPhase == 1) { 729 if (maxResGlo > 2.98 * OPT->_maxResL1) { 729 if (maxResGlo > 2.98 * OPT->_maxResL1) { 730 730 LOG << "Outlier Phase " << prnGlo.mid(0,3).toAscii().data() << ' ' << maxResGlo << endl; 731 731 return prnGlo; 732 732 } 733 else if (maxResGPS > 2.98 * OPT->_maxResL1) { 733 else if (maxResGPS > 2.98 * OPT->_maxResL1) { 734 734 LOG << "Outlier Phase " << prnGPS.mid(0,3).toAscii().data() << ' ' << maxResGPS << endl; 735 735 return prnGPS; … … 762 762 // ----------------------------------- 763 763 if (!_windUpTime.contains(prn) || _windUpTime[prn] != Mjd) { 764 _windUpTime[prn] = Mjd; 764 _windUpTime[prn] = Mjd; 765 765 766 766 // Unit Vector GPS Satellite --> Receiver … … 768 768 ColumnVector rho = rRec - rSat; 769 769 rho /= rho.norm_Frobenius(); 770 770 771 771 // GPS Satellite unit Vectors sz, sy, sx 772 772 // ------------------------------------- … … 781 781 // Effective Dipole of the GPS Satellite Antenna 782 782 // --------------------------------------------- 783 ColumnVector dipSat = sx - rho * DotProduct(rho,sx) 783 ColumnVector dipSat = sx - rho * DotProduct(rho,sx) 784 784 - crossproduct(rho, sy); 785 785 786 786 // Receiver unit Vectors rx, ry 787 787 // ---------------------------- … … 791 791 double recEll[3]; xyz2ell(rRec.data(), recEll) ; 792 792 double neu[3]; 793 793 794 794 neu[0] = 1.0; 795 795 neu[1] = 0.0; 796 796 neu[2] = 0.0; 797 797 neu2xyz(recEll, neu, rx.data()); 798 798 799 799 neu[0] = 0.0; 800 800 neu[1] = -1.0; 801 801 neu[2] = 0.0; 802 802 neu2xyz(recEll, neu, ry.data()); 803 803 804 804 // Effective Dipole of the Receiver Antenna 805 805 // ---------------------------------------- 806 ColumnVector dipRec = rx - rho * DotProduct(rho,rx) 806 ColumnVector dipRec = rx - rho * DotProduct(rho,rx) 807 807 + crossproduct(rho, ry); 808 808 809 809 // Resulting Effect 810 810 // ---------------- 811 double alpha = DotProduct(dipSat,dipRec) / 811 double alpha = DotProduct(dipSat,dipRec) / 812 812 (dipSat.norm_Frobenius() * dipRec.norm_Frobenius()); 813 813 814 814 if (alpha > 1.0) alpha = 1.0; 815 815 if (alpha < -1.0) alpha = -1.0; 816 816 817 817 double dphi = acos(alpha) / 2.0 / M_PI; // in cycles 818 818 819 819 if ( DotProduct(rho, crossproduct(dipSat, dipRec)) < 0.0 ) { 820 820 dphi = -dphi; … … 824 824 } 825 825 826 return _windUpSum[prn]; 827 } 828 829 // 826 return _windUpSum[prn]; 827 } 828 829 // 830 830 /////////////////////////////////////////////////////////////////////////// 831 831 void t_pppFilter::cmpEle(t_satData* satData) { … … 844 844 } 845 845 846 // 846 // 847 847 /////////////////////////////////////////////////////////////////////////// 848 848 void t_pppFilter::addAmb(t_satData* satData) { … … 853 853 bool found = false; 854 854 for (int iPar = 1; iPar <= _params.size(); iPar++) { 855 if (_params[iPar-1]->type == t_pppParam::AMB_L3 && 855 if (_params[iPar-1]->type == t_pppParam::AMB_L3 && 856 856 _params[iPar-1]->prn == satData->prn) { 857 857 found = true; … … 860 860 } 861 861 if (!found) { 862 t_pppParam* par = new t_pppParam(t_pppParam::AMB_L3, 862 t_pppParam* par = new t_pppParam(t_pppParam::AMB_L3, 863 863 _params.size()+1, satData->prn); 864 864 _params.push_back(par); … … 867 867 } 868 868 869 // 869 // 870 870 /////////////////////////////////////////////////////////////////////////// 871 871 void t_pppFilter::addObs(int iPhase, unsigned& iObs, t_satData* satData, … … 876 876 const double ELEWGHT = 20.0; 877 877 double ellWgtCoef = 1.0; 878 double eleD = satData->eleSat * 180.0 / M_PI; 878 double eleD = satData->eleSat * 180.0 / M_PI; 879 879 if (eleD < ELEWGHT) { 880 880 ellWgtCoef = 1.5 - 0.5 / (ELEWGHT - 10.0) * (eleD - 10.0); … … 903 903 _params[iPar-1]->prn == satData->prn) { 904 904 ll(iObs) -= _params[iPar-1]->xx; 905 } 905 } 906 906 AA(iObs, iPar) = _params[iPar-1]->partial(satData, true); 907 907 } … … 912 912 else { 913 913 double sigP3 = 2.98 * OPT->_sigmaC1; 914 if (satData->system() == 'C') {915 sigP3 *= BDS_WEIGHT_FACTOR;916 }917 914 ll(iObs) = satData->P3 - cmpValue(satData, false); 918 915 PP(iObs,iObs) = 1.0 / (sigP3 * sigP3) / (ellWgtCoef * ellWgtCoef); … … 923 920 } 924 921 925 // 922 // 926 923 /////////////////////////////////////////////////////////////////////////// 927 QByteArray t_pppFilter::printRes(int iPhase, const ColumnVector& vv, 924 QByteArray t_pppFilter::printRes(int iPhase, const ColumnVector& vv, 928 925 const QMap<QString, t_satData*>& satDataMap) { 929 926 … … 950 947 } 951 948 952 // 949 // 953 950 /////////////////////////////////////////////////////////////////////////// 954 951 void t_pppFilter::findMaxRes(const ColumnVector& vv, 955 952 const QMap<QString, t_satData*>& satData, 956 QString& prnGPS, QString& prnGlo, 957 double& maxResGPS, double& maxResGlo) { 953 QString& prnGPS, QString& prnGlo, 954 double& maxResGPS, double& maxResGlo) { 958 955 959 956 Tracer tracer("t_pppFilter::findMaxRes"); … … 968 965 if (satData->obsIndex != 0) { 969 966 QString prn = satData->prn; 970 if (prn[0] == 'R' ) {967 if (prn[0] == 'R' || prn[0] == 'C') { 971 968 if (fabs(vv(satData->obsIndex)) > maxResGlo) { 972 969 maxResGlo = fabs(vv(satData->obsIndex)); … … 983 980 } 984 981 } 985 982 986 983 // Update Step (private - loop over outliers) 987 984 //////////////////////////////////////////////////////////////////////////// … … 1010 1007 1011 1008 // First update using code observations, then phase observations 1012 // ------------------------------------------------------------- 1009 // ------------------------------------------------------------- 1013 1010 bool usePhase = OPT->ambLCs('G').size() || OPT->ambLCs('R').size() || 1014 1011 OPT->ambLCs('E').size() || OPT->ambLCs('C').size() ; … … 1019 1016 // ----------------- 1020 1017 predict(iPhase, epoData); 1021 1018 1022 1019 // Create First-Design Matrix 1023 1020 // -------------------------- … … 1034 1031 } 1035 1032 } 1036 1033 1037 1034 // Prepare first-design Matrix, vector observed-computed 1038 1035 // ----------------------------------------------------- 1039 1036 Matrix AA(nObs, nPar); // first design matrix 1040 ColumnVector ll(nObs); // te ms observed-computed1037 ColumnVector ll(nObs); // terms observed-computed 1041 1038 DiagonalMatrix PP(nObs); PP = 0.0; 1042 1039 1043 1040 unsigned iObs = 0; 1044 1041 QMapIterator<QString, t_satData*> it(epoData->satData); … … 1061 1058 kalman(AA, ll, PP, _QQ, dx); 1062 1059 ColumnVector vv = ll - AA * dx; 1063 1060 1064 1061 // Print Residuals 1065 1062 // --------------- 1066 if 1063 if (iPhase == 0) { 1067 1064 strResCode = printRes(iPhase, vv, epoData->satData); 1068 1065 } … … 1162 1159 } 1163 1160 1164 // 1165 //////////////////////////////////////////////////////////////////////////// 1166 t_irc t_pppFilter::selectSatellites(const QString& lastOutlierPrn, 1161 // 1162 //////////////////////////////////////////////////////////////////////////// 1163 t_irc t_pppFilter::selectSatellites(const QString& lastOutlierPrn, 1167 1164 QMap<QString, t_satData*>& satData) { 1168 1165 1169 // First Call 1166 // First Call 1170 1167 // ---------- 1171 1168 if (lastOutlierPrn.isEmpty()) { … … 1179 1176 else { 1180 1177 1181 if (lastOutlierPrn[0] == 'R' ) {1178 if (lastOutlierPrn[0] == 'R' || lastOutlierPrn[0] == 'C') { 1182 1179 _outlierGlo << lastOutlierPrn; 1183 1180 } … … 1193 1190 } 1194 1191 1195 if (lastOutlierPrn[0] == 'R' ) {1192 if (lastOutlierPrn[0] == 'R' || lastOutlierPrn[0] == 'C') { 1196 1193 _outlierGPS.clear(); 1197 1194 return success; … … 1213 1210 } 1214 1211 1215 // 1212 // 1216 1213 //////////////////////////////////////////////////////////////////////////// 1217 1214 double lorentz(const ColumnVector& aa, const ColumnVector& bb) { … … 1219 1216 } 1220 1217 1221 // 1218 // 1222 1219 //////////////////////////////////////////////////////////////////////////// 1223 1220 void t_pppFilter::bancroft(const Matrix& BBpass, ColumnVector& pos) { … … 1237 1234 if (iter > 1) { 1238 1235 double zz = BB(ii,3); 1239 double rho = sqrt( (xx-pos(1)) * (xx-pos(1)) + 1240 (yy-pos(2)) * (yy-pos(2)) + 1236 double rho = sqrt( (xx-pos(1)) * (xx-pos(1)) + 1237 (yy-pos(2)) * (yy-pos(2)) + 1241 1238 (zz-pos(3)) * (zz-pos(3)) ); 1242 1239 traveltime = rho / t_CST::c; … … 1248 1245 BB(ii,2) = -sina * xx + cosa * yy; 1249 1246 } 1250 1247 1251 1248 Matrix BBB; 1252 1249 if (mm > 4) { … … 1260 1257 ColumnVector alpha(mm); alpha = 0.0; 1261 1258 for (int ii = 1; ii <= mm; ii++) { 1262 alpha(ii) = lorentz(BB.Row(ii).t(),BB.Row(ii).t())/2.0; 1259 alpha(ii) = lorentz(BB.Row(ii).t(),BB.Row(ii).t())/2.0; 1263 1260 } 1264 1261 ColumnVector BBBe = BBB * ee; … … 1269 1266 double root = sqrt(bb*bb-aa*cc); 1270 1267 1271 Matrix hlpPos(4,2); 1268 Matrix hlpPos(4,2); 1272 1269 hlpPos.Column(1) = (-bb-root)/aa * BBBe + BBBalpha; 1273 1270 hlpPos.Column(2) = (-bb+root)/aa * BBBe + BBBalpha; … … 1276 1273 for (int pp = 1; pp <= 2; pp++) { 1277 1274 hlpPos(4,pp) = -hlpPos(4,pp); 1278 omc(pp) = BB(1,4) - 1275 omc(pp) = BB(1,4) - 1279 1276 sqrt( (BB(1,1)-hlpPos(1,pp)) * (BB(1,1)-hlpPos(1,pp)) + 1280 1277 (BB(1,2)-hlpPos(2,pp)) * (BB(1,2)-hlpPos(2,pp)) + 1281 (BB(1,3)-hlpPos(3,pp)) * (BB(1,3)-hlpPos(3,pp)) ) - 1278 (BB(1,3)-hlpPos(3,pp)) * (BB(1,3)-hlpPos(3,pp)) ) - 1282 1279 hlpPos(4,pp); 1283 1280 } … … 1291 1288 } 1292 1289 1293 // 1290 // 1294 1291 //////////////////////////////////////////////////////////////////////////// 1295 1292 void t_pppFilter::cmpDOP(t_epoData* epoData) { … … 1319 1316 } 1320 1317 AA = AA.Rows(1, _numSat); 1321 SymmetricMatrix NN; NN << AA.t() * AA; 1318 SymmetricMatrix NN; NN << AA.t() * AA; 1322 1319 SymmetricMatrix QQ = NN.i(); 1323 1320 1324 1321 _pDop = sqrt(QQ(1,1) + QQ(2,2) + QQ(3,3)); 1325 1322 }
Note:
See TracChangeset
for help on using the changeset viewer.