Changeset 6141 in ntrip
- Timestamp:
- Sep 13, 2014, 5:08:22 PM (10 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP/pppEphPool.cpp
r6107 r6141 81 81 ///////////////////////////////////////////////////////////////////////////// 82 82 void t_pppEphPool::t_satEphPool::putOrbCorrection(t_orbCorr* corr) { 83 cout << "ORB: " << corr->_prn.toString() << ' ' << corr->IOD() << endl; 83 84 for (unsigned ii = 0; ii < _ephs.size(); ii++) { 84 85 t_eph* eph = _ephs[ii]; … … 88 89 } 89 90 } 91 cout << "wrong" << endl; 90 92 delete corr; 91 93 } … … 94 96 ///////////////////////////////////////////////////////////////////////////// 95 97 void t_pppEphPool::t_satEphPool::putClkCorrection(t_clkCorr* corr) { 98 cout << "CLK: " << corr->_prn.toString() << ' ' << corr->IOD() << ' ' << corr->_dClk << endl; 99 bool set = false; 96 100 for (unsigned ii = 0; ii < _ephs.size(); ii++) { 97 101 t_eph* eph = _ephs[ii]; 98 102 if (eph->IOD() == corr->IOD()) { 99 103 eph->setClkCorr(corr); 104 set = true; 100 105 } 106 } 107 if (!set) { 108 cout << "wrong" << endl; 101 109 } 102 110 delete corr; … … 107 115 t_irc t_pppEphPool::t_satEphPool::getCrd(const bncTime& tt, ColumnVector& xc, 108 116 ColumnVector& vv) const { 117 cout << "getCrd " << endl; 109 118 for (unsigned ii = 0; ii < _ephs.size(); ii++) { 110 119 t_eph* eph = _ephs[ii]; 111 120 t_irc irc = eph->getCrd(tt, xc, vv, OPT->useOrbClkCorr()); 121 cout << "getCrd " << eph->prn().toString() << ' ' << irc << endl; 112 122 if (irc == success) { 113 123 if (eph->prn().system() == 'R') { -
trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
r5665 r6141 69 69 _fileNameSkl = path + staID; 70 70 } 71 _out = 0; 72 _GPSweeks = -1.0; 71 _out = 0; 73 72 74 73 qRegisterMetaType<bncTime>("bncTime"); 75 76 connect(this, SIGNAL(newCorrLine(QString, QString, bncTime)), 77 BNC_CORE, SLOT(slotNewCorrLine(QString, QString, bncTime))); 74 qRegisterMetaType< QList<t_orbCorr> >("QList:t_orbCorr"); 75 qRegisterMetaType< QList<t_clkCorr> >("QList:t_clkCorr"); 76 77 connect(this, SIGNAL(newOrbCorrections(QList<t_orbCorr>)), 78 BNC_CORE, SLOT(slotNewOrbCorrections(QList<t_orbCorr>))); 79 80 connect(this, SIGNAL(newClkCorrections(QList<t_clkCorr>)), 81 BNC_CORE, SLOT(slotNewClkCorrections(QList<t_clkCorr>))); 78 82 79 83 connect(this, SIGNAL(providerIDChanged(QString)), … … 99 103 // Reopen Output File 100 104 //////////////////////////////////////////////////////////////////////// 101 void RTCM3coDecoder::reopen(const QString& fileNameSkl, QString& fileName, 102 ofstream*& out) { 103 104 if (!fileNameSkl.isEmpty()) { 105 void RTCM3coDecoder::reopen() { 106 107 if (!_fileNameSkl.isEmpty()) { 105 108 106 109 bncSettings settings; … … 111 114 settings.value("corrIntr").toString()); 112 115 113 QString fileNameHlp = fileNameSkl116 QString fileNameHlp = _fileNameSkl 114 117 + QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) 115 118 + hlpStr + datTim.toString(".yyC"); 116 119 117 if ( fileName == fileNameHlp) {120 if (_fileName == fileNameHlp) { 118 121 return; 119 122 } 120 123 else { 121 fileName = fileNameHlp;122 } 123 124 delete out;124 _fileName = fileNameHlp; 125 } 126 127 delete _out; 125 128 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) { 126 out = new ofstream( fileName.toAscii().data(), 127 ios_base::out | ios_base::app ); 129 _out = new ofstream( _fileName.toAscii().data(), ios_base::out | ios_base::app ); 128 130 } 129 131 else { 130 out = new ofstream(fileName.toAscii().data() );132 _out = new ofstream( _fileName.toAscii().data() ); 131 133 } 132 134 } … … 170 172 _bias.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _bias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ) { 171 173 172 reopen( _fileNameSkl, _fileName, _out);174 reopen(); 173 175 174 176 // Guess GPS week and sec using system time … … 189 191 GPSweek -= 1; 190 192 } 191 _ GPSweeks = GPSEpochTime;193 _lastTime.set(GPSweek, double(GPSEpochTime)); 192 194 } 193 195 … … 223 225 } 224 226 } 225 226 _GPSweeks = weekDay * 86400.0 + GPSDaySec; 227 _lastTime.set(GPSweek, weekDay * 86400.0 + GPSDaySec); 227 228 } 228 229 229 230 checkProviderID(); 230 231 231 QStringList asciiLines = corrsToASCIIlines(GPSweek, _GPSweeks, 232 _co, &_bias); 233 234 QStringListIterator it(asciiLines); 235 while (it.hasNext()) { 236 QString line = it.next(); 237 printLine(line, GPSweek, _GPSweeks); 238 } 232 sendResults(); 239 233 240 234 retCode = success; 235 241 236 memset(&_co, 0, sizeof(_co)); 242 237 memset(&_bias, 0, sizeof(_bias)); … … 245 240 } 246 241 247 if (retCode != success) {248 _GPSweeks = -1.0;249 }250 242 return retCode; 251 243 } … … 253 245 // 254 246 //////////////////////////////////////////////////////////////////////////// 255 void RTCM3coDecoder::printLine(const QString& line, int GPSweek, 256 double GPSweeks) { 257 if (_out) { 258 *_out << line.toAscii().data() << endl; 259 _out->flush(); 260 } 261 262 int currWeek; 263 double currSec; 264 currentGPSWeeks(currWeek, currSec); 265 bncTime currTime(currWeek, currSec); 266 267 bncTime coTime(GPSweek, GPSweeks); 268 269 double dt = currTime - coTime; 270 const double MAXDT = 10 * 60.0; 271 if (fabs(dt) > MAXDT) { 272 emit newMessage("suspicious correction: " + _staID.toAscii() + " " 273 + line.toAscii(), false); 274 } 275 else { 276 emit newCorrLine(line, _staID, coTime); 277 } 278 } 279 280 // 281 //////////////////////////////////////////////////////////////////////////// 282 QStringList RTCM3coDecoder::corrsToASCIIlines(int GPSweek, double GPSweeks, 283 const ClockOrbit& co, 284 const CodeBias* bias) { 285 286 QStringList retLines; 247 void RTCM3coDecoder::sendResults() { 248 249 QList<t_orbCorr> orbCorrections; 250 QList<t_clkCorr> clkCorrections; 287 251 288 252 // Loop over all satellites (GPS and Glonass) 289 253 // ------------------------------------------ 290 if (co.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) { 291 QString line1; 292 line1.sprintf("! Orbits/Clocks: %d GPS %d Glonass", 293 co.NumberOfSat[CLOCKORBIT_SATGPS], co.NumberOfSat[CLOCKORBIT_SATGLONASS]); 294 retLines << line1; 295 } 296 for (int ii = 0; ii < CLOCKORBIT_NUMGPS+co.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) { 254 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _co.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) { 297 255 char sysCh = ' '; 298 if (ii < co.NumberOfSat[CLOCKORBIT_SATGPS]) {256 if (ii < _co.NumberOfSat[CLOCKORBIT_SATGPS]) { 299 257 sysCh = 'G'; 300 258 } … … 302 260 sysCh = 'R'; 303 261 } 304 305 if (sysCh != ' ') { 306 307 QString linePart; 308 linePart.sprintf("%d %d %d %.1f %c%2.2d", 309 co.messageType, co.UpdateInterval, GPSweek, GPSweeks, 310 sysCh, co.Sat[ii].ID); 311 312 // Combined message (orbit and clock) 313 // ---------------------------------- 314 if ( co.messageType == COTYPE_GPSCOMBINED || 315 co.messageType == COTYPE_GLONASSCOMBINED ) { 316 QString line; 317 line.sprintf(" %3d" 318 " %8.3f %8.3f %8.3f %8.3f" 319 " %10.5f %10.5f %10.5f %10.5f" 320 " %10.5f", 321 co.Sat[ii].IOD, 322 co.Sat[ii].Clock.DeltaA0, 323 co.Sat[ii].Orbit.DeltaRadial, 324 co.Sat[ii].Orbit.DeltaAlongTrack, 325 co.Sat[ii].Orbit.DeltaCrossTrack, 326 co.Sat[ii].Clock.DeltaA1, 327 co.Sat[ii].Orbit.DotDeltaRadial, 328 co.Sat[ii].Orbit.DotDeltaAlongTrack, 329 co.Sat[ii].Orbit.DotDeltaCrossTrack, 330 co.Sat[ii].Clock.DeltaA2); 331 retLines << linePart+line; 262 else { 263 continue; 264 } 265 266 // Orbit correction 267 // ---------------- 268 if ( _co.messageType == COTYPE_GPSCOMBINED || 269 _co.messageType == COTYPE_GLONASSCOMBINED || 270 _co.messageType == COTYPE_GPSORBIT || 271 _co.messageType == COTYPE_GLONASSORBIT ) { 272 273 t_orbCorr orbCorr; 274 orbCorr._prn.set(sysCh, _co.Sat[ii].ID); 275 orbCorr._staID = _staID.toAscii().data(); 276 orbCorr._iod = _co.Sat[ii].IOD; 277 orbCorr._time = _lastTime; 278 orbCorr._system = 'R'; 279 orbCorr._xr[0] = _co.Sat[ii].Orbit.DeltaRadial; 280 orbCorr._xr[1] = _co.Sat[ii].Orbit.DeltaAlongTrack; 281 orbCorr._xr[2] = _co.Sat[ii].Orbit.DeltaCrossTrack; 282 orbCorr._dotXr[0] = _co.Sat[ii].Orbit.DotDeltaRadial; 283 orbCorr._dotXr[1] = _co.Sat[ii].Orbit.DotDeltaAlongTrack; 284 orbCorr._dotXr[2] = _co.Sat[ii].Orbit.DotDeltaCrossTrack; 285 286 orbCorrections.push_back(orbCorr); 287 288 _IODs[orbCorr._prn.toString()] = _co.Sat[ii].IOD; 289 } 290 291 if ( _co.messageType == COTYPE_GPSCOMBINED || 292 _co.messageType == COTYPE_GLONASSCOMBINED || 293 _co.messageType == COTYPE_GPSCLOCK || 294 _co.messageType == COTYPE_GLONASSCLOCK ) { 295 296 t_clkCorr clkCorr; 297 clkCorr._prn.set(sysCh, _co.Sat[ii].ID); 298 clkCorr._staID = _staID.toAscii().data(); 299 clkCorr._time = _lastTime; 300 clkCorr._dClk = _co.Sat[ii].Clock.DeltaA0, 301 clkCorr._dotDClk = _co.Sat[ii].Clock.DeltaA1, 302 clkCorr._dotDotDClk = _co.Sat[ii].Clock.DeltaA2; 303 clkCorr._clkPartial = 0.0; 304 305 if (_IODs.contains(clkCorr._prn.toString())) { 306 clkCorr._iod = _IODs[clkCorr._prn.toString()]; 307 clkCorrections.push_back(clkCorr); 332 308 } 333 334 // Orbits only 335 // ----------- 336 else if ( co.messageType == COTYPE_GPSORBIT || 337 co.messageType == COTYPE_GLONASSORBIT ) { 338 QString line; 339 line.sprintf(" %3d" 340 " %8.3f %8.3f %8.3f" 341 " %10.5f %10.5f %10.5f", 342 co.Sat[ii].IOD, 343 co.Sat[ii].Orbit.DeltaRadial, 344 co.Sat[ii].Orbit.DeltaAlongTrack, 345 co.Sat[ii].Orbit.DeltaCrossTrack, 346 co.Sat[ii].Orbit.DotDeltaRadial, 347 co.Sat[ii].Orbit.DotDeltaAlongTrack, 348 co.Sat[ii].Orbit.DotDeltaCrossTrack); 349 retLines << linePart+line; 350 } 351 352 // Clocks only 353 // ----------- 354 else if ( co.messageType == COTYPE_GPSCLOCK || 355 co.messageType == COTYPE_GLONASSCLOCK ) { 356 QString line; 357 line.sprintf(" %8.3f %10.5f %10.5f", 358 co.Sat[ii].Clock.DeltaA0, 359 co.Sat[ii].Clock.DeltaA1, 360 co.Sat[ii].Clock.DeltaA2); 361 retLines << linePart+line; 362 } 363 364 // User Range Accuracy 365 // ------------------- 366 else if ( co.messageType == COTYPE_GPSURA || 367 co.messageType == COTYPE_GLONASSURA ) { 368 QString line; 369 line.sprintf(" %f", co.Sat[ii].UserRangeAccuracy); 370 retLines << linePart+line; 371 } 372 373 // High-Resolution Clocks 374 // ---------------------- 375 else if ( co.messageType == COTYPE_GPSHR || 376 co.messageType == COTYPE_GLONASSHR ) { 377 QString line; 378 line.sprintf(" %8.3f", co.Sat[ii].hrclock); 379 retLines << linePart+line; 380 } 309 } 310 311 // High-Resolution Clocks 312 // ---------------------- 313 if ( _co.messageType == COTYPE_GPSHR || 314 _co.messageType == COTYPE_GLONASSHR ) { 381 315 } 382 316 } … … 384 318 // Loop over all satellites (GPS and Glonass) 385 319 // ------------------------------------------ 386 if (bias) { 387 if (bias->NumberOfSat[CLOCKORBIT_SATGPS] > 0 || bias->NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) { 388 QString line1; 389 line1.sprintf("! Biases: %d GPS %d Glonass", 390 bias->NumberOfSat[CLOCKORBIT_SATGPS], bias->NumberOfSat[CLOCKORBIT_SATGLONASS]); 391 retLines << line1; 392 } 393 for (int ii = 0; ii < CLOCKORBIT_NUMGPS + bias->NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) { 394 char sysCh = ' '; 395 int messageType; 396 if (ii < bias->NumberOfSat[CLOCKORBIT_SATGPS]) { 397 sysCh = 'G'; 398 messageType = BTYPE_GPS; 399 } 400 else if (ii >= CLOCKORBIT_NUMGPS) { 401 sysCh = 'R'; 402 messageType = BTYPE_GLONASS; 403 } 404 if (sysCh != ' ') { 405 QString line; 406 line.sprintf("%d %d %d %.1f %c%2.2d %d", 407 messageType, bias->UpdateInterval, GPSweek, GPSweeks, 408 sysCh, bias->Sat[ii].ID, 409 bias->Sat[ii].NumberOfCodeBiases); 410 for (int jj = 0; jj < bias->Sat[ii].NumberOfCodeBiases; jj++) { 411 QString hlp; 412 hlp.sprintf(" %d %8.3f", bias->Sat[ii].Biases[jj].Type, 413 bias->Sat[ii].Biases[jj].Bias); 414 line += hlp; 415 } 416 retLines << line; 417 } 418 } 419 } 420 421 return retLines; 320 QList<t_satBias> satBiases; 321 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _bias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) { 322 char sysCh = ' '; 323 if (ii < _bias.NumberOfSat[CLOCKORBIT_SATGPS]) { 324 sysCh = 'G'; 325 } 326 else if (ii >= CLOCKORBIT_NUMGPS) { 327 sysCh = 'R'; 328 } 329 else { 330 continue; 331 } 332 t_satBias satBias; 333 satBias._prn.set(sysCh, _bias.Sat[ii].ID); 334 satBias._time = _lastTime; 335 satBias._nx = 0; 336 satBias._jumpCount = 0; 337 for (unsigned jj = 0; jj < _bias.Sat[ii].NumberOfCodeBiases; jj++) { 338 } 339 } 340 341 if (orbCorrections.size() > 0) { 342 emit newOrbCorrections(orbCorrections); 343 } 344 if (clkCorrections.size() > 0) { 345 emit newClkCorrections(clkCorrections); 346 } 347 if (_out) { 348 QListIterator<t_orbCorr> itOrb(orbCorrections); 349 while (itOrb.hasNext()) { 350 const t_orbCorr& orbCorr = itOrb.next(); 351 *_out << "O " << orbCorr.toString() << endl; 352 } 353 QListIterator<t_clkCorr> itClk(clkCorrections); 354 while (itClk.hasNext()) { 355 const t_clkCorr& clkCorr = itClk.next(); 356 *_out << "C " << clkCorr.toString() << endl; 357 } 358 _out->flush(); 359 } 422 360 } 423 361 -
trunk/BNC/src/RTCM3/RTCM3coDecoder.h
r5738 r6141 27 27 28 28 #include <fstream> 29 30 29 #include <QtCore> 31 30 #include <QtNetwork> 32 33 31 #include "GPSDecoder.h" 34 32 35 33 extern "C" { 36 # include "clock_orbit_rtcm.h"34 # include "clock_orbit_rtcm.h" 37 35 } 38 36 … … 43 41 virtual ~RTCM3coDecoder(); 44 42 virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg); 45 virtual int corrGPSEpochTime() const {return (int) _GPSweeks;}43 virtual int corrGPSEpochTime() const {return int(_lastTime.gpssec());} 46 44 47 static QStringList corrsToASCIIlines(int GPSweek, double GPSweeks,48 const ClockOrbit& co, const CodeBias* bias);49 static void reopen(const QString& fileNameSkl, QString& fileName,50 std::ofstream*& out);51 45 signals: 52 void newCorrLine(QString line, QString staID, bncTime coTime); 46 void newOrbCorrections(QList<t_orbCorr> orbCorr); 47 void newClkCorrections(QList<t_clkCorr> clkCorr); 48 void newBiases(QList<t_satBias> biases); 53 49 void newMessage(QByteArray msg, bool showOnScreen); 54 50 void providerIDChanged(QString staID); 55 51 56 52 private: 57 void printLine(const QString& line, int GPSweek, double GPSweeks); 53 void sendResults(); 54 void reopen(); 58 55 void checkProviderID(); 59 56 std::ofstream* _out; … … 62 59 QString _fileName; 63 60 QByteArray _buffer; 64 double _GPSweeks;65 61 ClockOrbit _co; 66 62 CodeBias _bias; 67 63 int _providerID[3]; 64 bncTime _lastTime; 65 QMap<std::string, unsigned short> _IODs; 68 66 }; 69 67 -
trunk/BNC/src/bnccore.cpp
r6051 r6141 118 118 _userName = _userName.leftJustified(20, ' ', true); 119 119 120 _corrs = new QMultiMap<bncTime, QString>;120 _corrs = new QMultiMap<bncTime, t_clkCorr>; 121 121 122 122 _dateAndTimeGPS = 0; … … 633 633 //////////////////////////////////////////////////////////////////////////// 634 634 void t_bncCore::slotQuit() { 635 cout << "t_bncCore::slotQuit" << endl;636 635 delete _caster; _caster = 0; 637 636 qApp->quit(); … … 640 639 // 641 640 //////////////////////////////////////////////////////////////////////////// 642 void t_bncCore::slotNewCorrLine(QString line, QString staID, bncTime coTime) { 643 641 void t_bncCore::slotNewOrbCorrections(QList<t_orbCorr> orbCorrections) { 642 emit newOrbCorrections(orbCorrections); 643 } 644 645 // 646 //////////////////////////////////////////////////////////////////////////// 647 void t_bncCore::slotNewClkCorrections(QList<t_clkCorr> clkCorrections) { 644 648 QMutexLocker locker(&_mutex); 649 650 if (clkCorrections.size() == 0) { 651 return; 652 } 653 bncTime coTime = clkCorrections[0]._time; 654 QString staID(clkCorrections[0]._staID.c_str()); 645 655 646 656 // Combination of Corrections … … 648 658 #ifdef USE_COMBINATION 649 659 if (_bncComb) { 650 _bncComb->processC orrLine(staID, line);660 _bncComb->processClkCorrections(clkCorrections); 651 661 } 652 662 #endif … … 677 687 } 678 688 679 _corrs->insert(coTime, QString(line + " " + staID)); 689 for (int ii = 0; ii < clkCorrections.size(); ii++) { 690 _corrs->insert(coTime, clkCorrections[ii]); 691 } 680 692 681 693 // Dump Corrections … … 693 705 //////////////////////////////////////////////////////////////////////////// 694 706 void t_bncCore::dumpCorrs(bncTime minTime, bncTime maxTime) { 695 Q StringListallCorrs;696 QMutableMapIterator<bncTime, QString> it(*_corrs);707 QList<t_clkCorr> allCorrs; 708 QMutableMapIterator<bncTime, t_clkCorr> it(*_corrs); 697 709 while (it.hasNext()) { 698 710 it.next(); … … 709 721 //////////////////////////////////////////////////////////////////////////// 710 722 void t_bncCore::dumpCorrs() { 711 Q StringListallCorrs;712 QMutableMapIterator<bncTime, QString> it(*_corrs);723 QList<t_clkCorr> allCorrs; 724 QMutableMapIterator<bncTime, t_clkCorr> it(*_corrs); 713 725 while (it.hasNext()) { 714 726 allCorrs << it.next().value(); … … 720 732 // Dump List of Corrections 721 733 //////////////////////////////////////////////////////////////////////////// 722 void t_bncCore::dumpCorrs(const Q StringList& allCorrs) {723 emit newC orrections(allCorrs);734 void t_bncCore::dumpCorrs(const QList<t_clkCorr>& allCorrs) { 735 emit newClkCorrections(allCorrs); 724 736 if (_socketsCorr) { 725 QListIterator< QString> it(allCorrs);737 QListIterator<t_clkCorr> it(allCorrs); 726 738 while (it.hasNext()) { 727 QString corrLine = it.next() + "\n"; 728 739 const t_clkCorr& corr = it.next(); 729 740 QMutableListIterator<QTcpSocket*> is(*_socketsCorr); 730 741 while (is.hasNext()) { 731 742 QTcpSocket* sock = is.next(); 732 743 if (sock->state() == QAbstractSocket::ConnectedState) { 733 if (sock->write(corr Line.toAscii()) == -1) {744 if (sock->write(corr.toString().c_str()) == -1) { 734 745 delete sock; 735 746 is.remove(); -
trunk/BNC/src/bnccore.h
r5991 r6141 81 81 void slotNewGlonassEph(glonassephemeris* glonasseph, const QString& staID); 82 82 void slotNewGalileoEph(galileoephemeris* galileoeph); 83 void slotNewCorrLine(QString line, QString staID, bncTime coTime); 83 void slotNewOrbCorrections(QList<t_orbCorr> orbCorr); 84 void slotNewClkCorrections(QList<t_clkCorr> clkCorr); 84 85 void slotQuit(); 85 86 … … 89 90 void newEphGlonass(glonassephemeris glonasseph); 90 91 void newEphGalileo(galileoephemeris galileoeph); 91 void newCorrections(QStringList); 92 void newOrbCorrections(QList<t_orbCorr> orbCorr); 93 void newClkCorrections(QList<t_clkCorr> clkCorr); 92 94 void providerIDChanged(QString); 93 95 void newPosition(QByteArray staID, bncTime time, QVector<double> xx); … … 111 113 void dumpCorrs(bncTime minTime, bncTime maxTime); 112 114 void dumpCorrs(); 113 void dumpCorrs(const Q StringList& allCorrs);115 void dumpCorrs(const QList<t_clkCorr>& allCorrs); 114 116 void messagePrivate(const QByteArray& msg); 115 117 void checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph); … … 147 149 QMap<QString, bncTime> _lastCorrDumpTime; 148 150 double _waitCoTime; 149 QMultiMap<bncTime, QString>* _corrs;151 QMultiMap<bncTime, t_clkCorr>* _corrs; 150 152 QString _confFileName; 151 153 QDate _fileDate; -
trunk/BNC/src/bncephuser.cpp
r6140 r6141 186 186 } 187 187 188 //189 ////////////////////////////////////////////////////////////////////////////190 t_irc t_corr::readLine(const QString& line) {191 192 if (line[0] == '!') {193 return failure;194 }195 196 QTextStream in(line.toAscii());197 198 in >> messageType;199 200 if (!relevantMessageType(messageType)) {201 return failure;202 }203 204 int updateInterval;205 int GPSweek;206 double GPSweeks;207 in >> updateInterval >> GPSweek >> GPSweeks >> prn;208 209 if ( messageType == COTYPE_GPSCOMBINED ||210 messageType == COTYPE_GLONASSCOMBINED ) {211 rao.ReSize(3); rao = 0.0;212 dotRao.ReSize(3); dotRao = 0.0;213 dClk = 0.0;214 dotDClk = 0.0;215 dotDotDClk = 0.0;216 in >> iod217 >> dClk >> rao[0] >> rao[1] >> rao[2]218 >> dotDClk >> dotRao[0] >> dotRao[1] >> dotRao[2]219 >> dotDotDClk;220 221 dClk /= t_CST::c;222 dotDClk /= t_CST::c;223 dotDotDClk /= t_CST::c;224 225 tClk.set(GPSweek, GPSweeks);226 tRao.set(GPSweek, GPSweeks);227 }228 else if ( messageType == COTYPE_GPSORBIT ||229 messageType == COTYPE_GLONASSORBIT ) {230 rao.ReSize(3); rao = 0.0;231 dotRao.ReSize(3); dotRao = 0.0;232 in >> iod233 >> rao[0] >> rao[1] >> rao[2]234 >> dotRao[0] >> dotRao[1] >> dotRao[2];235 236 tRao.set(GPSweek, GPSweeks);237 238 if (tClk != tRao) {239 dClk = 0.0;240 dotDClk = 0.0;241 dotDotDClk = 0.0;242 tClk.reset();243 }244 }245 else if ( messageType == COTYPE_GPSCLOCK ||246 messageType == COTYPE_GLONASSCLOCK ) {247 dClk = 0.0;248 dotDClk = 0.0;249 dotDotDClk = 0.0;250 in >> dClk >> dotDClk >> dotDotDClk;251 dClk /= t_CST::c;252 dotDClk /= t_CST::c;253 dotDotDClk /= t_CST::c;254 255 tClk.set(GPSweek, GPSweeks);256 }257 else if ( messageType == COTYPE_GPSHR ||258 messageType == COTYPE_GLONASSHR ) {259 if (tRao.valid() && tClk.valid()) {260 in >> hrClk;261 hrClk /= t_CST::c;262 }263 }264 265 return success;266 }267 -
trunk/BNC/src/bncephuser.h
r6140 r6141 36 36 # include "clock_orbit_rtcm.h" 37 37 } 38 39 class t_corr {40 public:41 t_corr() {42 rao.ReSize(3);43 dotRao.ReSize(3);44 messageType = 0;45 iod = 0;46 dClk = 0.0;47 dotDClk = 0.0;48 dotDotDClk = 0.0;49 hrClk = 0.0;50 rao = 0.0;51 dotRao = 0.0;52 eph = 0;53 }54 55 ~t_corr() {}56 57 bool ready() {return tRao.valid() && tClk.valid();}58 59 static bool relevantMessageType(int msgType) {60 return ( msgType == COTYPE_GPSCOMBINED ||61 msgType == COTYPE_GLONASSCOMBINED ||62 msgType == COTYPE_GPSORBIT ||63 msgType == COTYPE_GPSCLOCK ||64 msgType == COTYPE_GLONASSORBIT ||65 msgType == COTYPE_GLONASSCLOCK ||66 msgType == COTYPE_GPSHR ||67 msgType == COTYPE_GLONASSHR );68 }69 70 t_irc readLine(const QString& line);71 72 int messageType;73 QString prn;74 bncTime tClk;75 bncTime tRao;76 int iod;77 double dClk;78 double dotDClk;79 double dotDotDClk;80 double hrClk;81 ColumnVector rao;82 ColumnVector dotRao;83 const t_eph* eph;84 };85 38 86 39 class bncEphUser : public QObject { -
trunk/BNC/src/combination/bnccomb.h
r5861 r6141 6 6 #include <newmat.h> 7 7 #include "bncephuser.h" 8 #include "satObs.h" 8 9 9 10 class bncRtnetDecoder; … … 35 36 bncComb(); 36 37 virtual ~bncComb(); 37 void processCorrLine(const QString& staID, const QString& line); 38 void processOrbCorrections(const QList<t_orbCorr>& orbCorrections); 39 void processClkCorrections(const QList<t_clkCorr>& clkCorrections); 38 40 int nStreams() const {return _ACs.size();} 39 41 … … 62 64 }; 63 65 64 class cmbCorr : public t_c orr {66 class cmbCorr : public t_clkCorr { 65 67 public: 66 68 QString acName; 67 69 ColumnVector diffRao; 68 QString ID() {return acName + "_" + prn;}70 QString ID() {return acName + "_" + QString(_prn.toString().c_str());} 69 71 }; 70 72 … … 83 85 void processEpoch(); 84 86 t_irc processEpoch_filter(QTextStream& out, 85 QMap<QString, t_c orr*>& resCorr,87 QMap<QString, t_clkCorr*>& resCorr, 86 88 ColumnVector& dx); 87 89 t_irc processEpoch_singleEpoch(QTextStream& out, 88 QMap<QString, t_c orr*>& resCorr,90 QMap<QString, t_clkCorr*>& resCorr, 89 91 ColumnVector& dx); 90 92 t_irc createAmat(Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP, 91 const ColumnVector& x0, QMap<QString, t_c orr*>& resCorr);92 void dumpResults(const QMap<QString, t_c orr*>& resCorr);93 void printResults(QTextStream& out, const QMap<QString, t_c orr*>& resCorr);94 void switchToLastEph(const t_eph* lastEph, t_c orr* corr);93 const ColumnVector& x0, QMap<QString, t_clkCorr*>& resCorr); 94 void dumpResults(const QMap<QString, t_clkCorr*>& resCorr); 95 void printResults(QTextStream& out, const QMap<QString, t_clkCorr*>& resCorr); 96 void switchToLastEph(const t_eph* lastEph, t_clkCorr* corr); 95 97 t_irc checkOrbits(QTextStream& out); 96 98 -
trunk/BNC/src/ephemeris.cpp
r6109 r6141 12 12 #include "bnccore.h" 13 13 #include "bncutils.h" 14 #include "satObs.h" 14 15 #include "pppInclude.h" 15 16 … … 26 27 // 27 28 //////////////////////////////////////////////////////////////////////////// 28 void t_eph::setOrbCorr(const BNC_PPP::t_orbCorr* orbCorr) {29 void t_eph::setOrbCorr(const t_orbCorr* orbCorr) { 29 30 delete _orbCorr; 30 _orbCorr = new BNC_PPP::t_orbCorr(*orbCorr);31 _orbCorr = new t_orbCorr(*orbCorr); 31 32 } 32 33 33 34 // 34 35 //////////////////////////////////////////////////////////////////////////// 35 void t_eph::setClkCorr(const BNC_PPP::t_clkCorr* clkCorr) {36 void t_eph::setClkCorr(const t_clkCorr* clkCorr) { 36 37 delete _clkCorr; 37 _clkCorr = new BNC_PPP::t_clkCorr(*clkCorr);38 _clkCorr = new t_clkCorr(*clkCorr); 38 39 } 39 40 -
trunk/BNC/src/ephemeris.h
r6139 r6141 14 14 } 15 15 16 namespace BNC_PPP { 17 class t_orbCorr; 18 class t_clkCorr; 19 } 16 class t_orbCorr; 17 class t_clkCorr; 20 18 21 19 class t_eph { … … 35 33 t_prn prn() const {return _prn;} 36 34 t_irc getCrd(const bncTime& tt, ColumnVector& xc, ColumnVector& vv, bool useCorr) const; 37 void setOrbCorr(const BNC_PPP::t_orbCorr* orbCorr);38 void setClkCorr(const BNC_PPP::t_clkCorr* clkCorr);35 void setOrbCorr(const t_orbCorr* orbCorr); 36 void setClkCorr(const t_clkCorr* clkCorr); 39 37 const QDateTime& receptDateTime() const {return _receptDateTime;} 40 38 static QString rinexDateStr(const bncTime& tt, const t_prn& prn, double version); … … 44 42 protected: 45 43 virtual void position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0; 46 t_prn 47 bncTime 48 QDateTime 49 bool 50 BNC_PPP::t_orbCorr* _orbCorr;51 BNC_PPP::t_clkCorr* _clkCorr;44 t_prn _prn; 45 bncTime _TOC; 46 QDateTime _receptDateTime; 47 bool _ok; 48 t_orbCorr* _orbCorr; 49 t_clkCorr* _clkCorr; 52 50 }; 53 51 -
trunk/BNC/src/pppInclude.h
r6135 r6141 35 35 std::string _log; 36 36 bool _error; 37 };38 39 class t_orbCorr {40 public:41 t_prn prn() const {return _prn;}42 unsigned short IOD() const {return _iod;}43 t_prn _prn;44 unsigned short _iod;45 bncTime _time;46 char _system;47 double _xr[3];48 double _dotXr[3];49 };50 51 class t_clkCorr {52 public:53 t_prn prn() const {return _prn;}54 unsigned short IOD() const {return _iod;}55 t_prn _prn;56 unsigned short _iod;57 bncTime _time;58 double _dClk;59 double _dotDClk;60 double _dotDotDClk;61 double _clkPartial;62 };63 64 class t_frqBias {65 public:66 t_frqBias() {67 _code = 0.0;68 _codeValid = false;69 _phase = 0.0;70 _phaseValid = false;71 }72 std::string _rnxType2ch;73 double _code;74 bool _codeValid;75 double _phase;76 bool _phaseValid;77 };78 79 class t_satBias {80 public:81 t_prn _prn;82 bncTime _time;83 int _nx;84 int _jumpCount;85 std::vector<t_frqBias> _bias;86 37 }; 87 38 -
trunk/BNC/src/pppRun.cpp
r6140 r6141 75 75 BNC_CORE, SIGNAL(newNMEAstr(QByteArray, QByteArray))); 76 76 77 for (unsigned iPrn = 0; iPrn <= t_prn::MAXPRN; iPrn++) {78 _lastOrbCorrIOD[iPrn] = -1;79 _lastClkCorrValue[iPrn] = 0.0;80 }81 82 77 _pppClient = new t_pppClient(_opt); 83 78 … … 102 97 this, SLOT(slotNewEphGalileo(galileoephemeris)),conType); 103 98 104 connect(BNC_CORE, SIGNAL(newCorrections(QStringList)), 105 this, SLOT(slotNewCorrections(QStringList)),conType); 99 connect(BNC_CORE, SIGNAL(newOrbCorrections(QList<t_orbCorr>)), 100 this, SLOT(slotNewOrbCorrections(QList<t_orbCorr>)),conType); 101 102 connect(BNC_CORE, SIGNAL(newClkCorrections(QList<t_clkCorr>)), 103 this, SLOT(slotNewClkCorrections(QList<t_clkCorr>)),conType); 106 104 } 107 105 else { … … 230 228 // Process the oldest epochs 231 229 // ------------------------ 230 cout << "epoData " << _epoData.size() << endl; 231 232 232 while (_epoData.size() && !waitForCorr(_epoData.front()->_time)) { 233 233 234 234 const vector<t_satObs*>& satObs = _epoData.front()->_satObs; 235 236 cout << "satObs " << satObs.size() << endl; 235 237 236 238 t_output output; … … 287 289 // 288 290 //////////////////////////////////////////////////////////////////////////// 289 void t_pppRun::slotNew Corrections(QStringList corrList) {290 QMutexLocker locker(&_mutex);291 292 // Check the Mountpoint (source of corrections)293 // -------------------------------------------- 291 void t_pppRun::slotNewOrbCorrections(QList<t_orbCorr> orbCorr) { 292 if (orbCorr.size() == 0) { 293 return; 294 } 295 294 296 if (_opt->_realTime) { 295 if (_opt->_corrMount.empty() ) {297 if (_opt->_corrMount.empty() || _opt->_corrMount != orbCorr[0]._staID) { 296 298 return; 297 299 } 298 QMutableListIterator<QString> itm(corrList); 299 while (itm.hasNext()) { 300 QStringList hlp = itm.next().split(" "); 301 if (hlp.size() > 0) { 302 QString mountpoint = hlp[hlp.size()-1]; 303 if (mountpoint != QString(_opt->_corrMount.c_str())) { 304 itm.remove(); 305 } 306 } 307 } 308 } 309 310 if (corrList.size() == 0) { 300 } 301 vector<t_orbCorr*> corrections; 302 for (int ii = 0; ii < orbCorr.size(); ii++) { 303 corrections.push_back(new t_orbCorr(orbCorr[ii])); 304 _lastClkCorrTime = orbCorr[ii]._time; 305 } 306 307 _pppClient->putOrbCorrections(corrections); 308 } 309 310 // 311 //////////////////////////////////////////////////////////////////////////// 312 void t_pppRun::slotNewClkCorrections(QList<t_clkCorr> clkCorr) { 313 if (clkCorr.size() == 0) { 311 314 return; 312 315 } 313 316 314 vector<t_orbCorr*> orbCorr; 315 vector<t_clkCorr*> clkCorr; 316 vector<t_satBias*> satBias; 317 318 QListIterator<QString> it(corrList); 319 while (it.hasNext()) { 320 QString line = it.next(); 321 322 QTextStream in(&line); 323 int messageType; 324 int updateInterval; 325 int GPSweek; 326 double GPSweeks; 327 QString prn; 328 in >> messageType >> updateInterval >> GPSweek >> GPSweeks >> prn; 329 330 if ( t_corr::relevantMessageType(messageType) ) { 331 t_corr corr; 332 corr.readLine(line); 333 if (messageType == COTYPE_GPSCOMBINED || messageType == COTYPE_GLONASSCOMBINED || 334 messageType == COTYPE_GPSORBIT || messageType == COTYPE_GLONASSORBIT ) { 335 t_orbCorr* cc = new t_orbCorr(); 336 cc->_prn.set(corr.prn.toAscii().data()); 337 cc->_iod = corr.iod; 338 cc->_time = corr.tRao; 339 cc->_system = 'R'; 340 cc->_xr[0] = corr.rao[0]; 341 cc->_xr[1] = corr.rao[1]; 342 cc->_xr[2] = corr.rao[2]; 343 cc->_dotXr[0] = corr.dotRao[0]; 344 cc->_dotXr[0] = corr.dotRao[1]; 345 cc->_dotXr[0] = corr.dotRao[2]; 346 orbCorr.push_back(cc); 347 348 _lastOrbCorrIOD[cc->_prn.toInt()] = cc->_iod; 349 } 350 else if (messageType == COTYPE_GPSCOMBINED || messageType == COTYPE_GLONASSCOMBINED || 351 messageType == COTYPE_GPSCLOCK || messageType == COTYPE_GLONASSCLOCK ) { 352 t_clkCorr* cc = new t_clkCorr(); 353 cc->_prn.set(corr.prn.toAscii().data()); 354 cc->_iod = corr.iod; 355 cc->_time = corr.tClk; 356 cc->_dClk = corr.dClk; 357 cc->_dotDClk = corr.dotDClk; 358 cc->_dotDotDClk = corr.dotDotDClk; 359 cc->_clkPartial = 0.0; 360 if (messageType == COTYPE_GPSCLOCK || messageType == COTYPE_GLONASSCLOCK) { 361 int lastIOD = _lastOrbCorrIOD[cc->_prn.toInt()]; 362 if (lastIOD != -1) { 363 cc->_iod = lastIOD; 364 } 365 else { 366 delete cc; 367 cc = 0; 368 } 369 } 370 if (cc) { 371 clkCorr.push_back(cc); 372 _lastClkCorrValue[cc->_prn.toInt()] = cc->_dClk; 373 if (_lastClkCorrTime.undef() || cc->_time > _lastClkCorrTime) { 374 _lastClkCorrTime = cc->_time; 375 } 376 } 377 } 378 } 379 else if ( messageType == BTYPE_GPS || messageType == BTYPE_GLONASS ) { 380 } 381 } 382 383 _pppClient->putOrbCorrections(orbCorr); 384 _pppClient->putClkCorrections(clkCorr); 385 _pppClient->putBiases(satBias); 386 387 for (unsigned ii = 0; ii < orbCorr.size(); ii++) { 388 delete orbCorr[ii]; 389 } 390 for (unsigned ii = 0; ii < clkCorr.size(); ii++) { 391 delete clkCorr[ii]; 392 } 393 for (unsigned ii = 0; ii < satBias.size(); ii++) { 394 delete satBias[ii]; 395 } 396 } 397 317 if (_opt->_realTime) { 318 if (_opt->_corrMount.empty() || _opt->_corrMount != clkCorr[0]._staID) { 319 return; 320 } 321 } 322 vector<t_clkCorr*> corrections; 323 for (int ii = 0; ii < clkCorr.size(); ii++) { 324 corrections.push_back(new t_clkCorr(clkCorr[ii])); 325 } 326 327 _pppClient->putClkCorrections(corrections); 328 } 398 329 399 330 // -
trunk/BNC/src/pppRun.h
r6137 r6141 6 6 #include <QtCore> 7 7 8 #include "satObs.h" 8 9 #include "pppOptions.h" 9 10 #include "pppClient.h" … … 37 38 void slotNewEphGlonass(glonassephemeris gloeph); 38 39 void slotNewEphGalileo(galileoephemeris galeph); 39 void slotNewCorrections(QStringList corrList); 40 void slotNewOrbCorrections(QList<t_orbCorr> orbCorr); 41 void slotNewClkCorrections(QList<t_clkCorr> clkCorr); 40 42 void slotNewObs(QByteArray staID, QList<t_satObs> obsList); 41 43 void slotSetSpeed(int speed); … … 61 63 t_pppClient* _pppClient; 62 64 std::deque<t_epoData*> _epoData; 63 int _lastOrbCorrIOD[t_prn::MAXPRN+1];64 double _lastClkCorrValue[t_prn::MAXPRN+1];65 65 bncTime _lastClkCorrTime; 66 66 t_rnxObsFile* _rnxObsFile; -
trunk/BNC/src/rinex/corrfile.cpp
r5732 r6141 71 71 } 72 72 73 QStringList corrs;73 QStringList lines; 74 74 75 75 if (!_lastLine.isEmpty()) { 76 corrs << _lastLine;76 lines << _lastLine; 77 77 } 78 78 … … 85 85 86 86 if (stopRead(tt)) { 87 if (corrs.size()) { 88 89 QListIterator<QString> it(corrs); 90 while (it.hasNext()) { 91 const QString& cLine = it.next(); 92 t_corr* corr = new t_corr(); 93 corr->readLine(cLine); 94 if (corr->tRao.valid()) { 95 _corrIODs[corr->prn] = corr->iod; 96 } 87 QList<t_orbCorr> orbCorr; 88 QList<t_clkCorr> clkCorr; 89 QListIterator<QString> it(lines); 90 while (it.hasNext()) { 91 const QString& str = it.next(); 92 if (str[0] == 'C') { 93 t_clkCorr corr(str.toAscii().data()); 94 _lastTime = corr._time; 95 clkCorr.push_back(corr); 97 96 } 98 99 emit newCorrections(corrs); 97 else if (str[0] == 'O') { 98 t_orbCorr corr(str.toAscii().data()); 99 _lastTime = corr._time; 100 orbCorr.push_back(corr); 101 } 102 } 103 if (orbCorr.size() > 0) { 104 emit newOrbCorrections(orbCorr); 105 } 106 if (clkCorr.size() > 0) { 107 emit newClkCorrections(clkCorr); 100 108 } 101 109 return; 102 110 } 103 111 else { 104 corrs << _lastLine;112 lines << _lastLine; 105 113 } 106 114 } … … 111 119 bool t_corrFile::stopRead(const bncTime& tt) { 112 120 113 if (_last Line.isEmpty()) {121 if (_lastTime.undef()) { 114 122 return false; 115 123 } 116 124 117 QTextStream in(_lastLine.toAscii(), QIODevice::ReadOnly); 118 int messageType, updateInterval, GPSweek; 119 double GPSweeks; 120 in >> messageType >> updateInterval >> GPSweek >> GPSweeks; 121 122 bncTime tNew(GPSweek, GPSweeks); 123 124 if (tNew > tt) { 125 if (_lastTime > tt) { 125 126 return true; 126 127 } -
trunk/BNC/src/rinex/corrfile.h
r5732 r6141 29 29 #include "bncconst.h" 30 30 #include "bnctime.h" 31 #include "satObs.h" 31 32 32 33 class t_corrFile : public QObject { … … 40 41 41 42 signals: 42 void newCorrections(QStringList); 43 void newOrbCorrections(QList<t_orbCorr>); 44 void newClkCorrections(QList<t_clkCorr>); 43 45 44 46 private: … … 48 50 QString _lastLine; 49 51 QMap<QString, int> _corrIODs; 52 bncTime _lastTime; 50 53 }; 51 54 -
trunk/BNC/src/satObs.h
r6137 r6141 59 59 class t_orbCorr { 60 60 public: 61 t_orbCorr(); 62 t_orbCorr(const std::string& str); 61 63 t_prn prn() const {return _prn;} 62 64 unsigned short IOD() const {return _iod;} 65 std::string toString() const; 66 std::string _staID; 63 67 t_prn _prn; 64 68 unsigned short _iod; … … 71 75 class t_clkCorr { 72 76 public: 77 t_clkCorr(); 78 t_clkCorr(const std::string& str); 73 79 t_prn prn() const {return _prn;} 74 80 unsigned short IOD() const {return _iod;} 81 std::string toString() const; 82 std::string _staID; 75 83 t_prn _prn; 76 84 unsigned short _iod; … … 99 107 class t_satBias { 100 108 public: 109 std::string _staID; 101 110 t_prn _prn; 102 111 bncTime _time; -
trunk/BNC/src/src.pri
r6136 r6141 84 84 bncephuser.cpp bncoutf.cpp bncclockrinex.cpp bncsp3.cpp \ 85 85 bncbytescounter.cpp bncsslconfig.cpp reqcdlg.cpp \ 86 ephemeris.cpp t_prn.cpp 86 ephemeris.cpp t_prn.cpp satObs.cpp \ 87 87 upload/bncrtnetdecoder.cpp upload/bncuploadcaster.cpp \ 88 88 upload/bncrtnetuploadcaster.cpp upload/bnccustomtrafo.cpp \ … … 110 110 QT += network 111 111 112 exists(combination/bnccomb.h) {113 DEFINES += USE_COMBINATION114 HEADERS += combination/bnccomb.h115 SOURCES += combination/bnccomb.cpp116 }112 # exists(combination/bnccomb.h) { 113 # DEFINES += USE_COMBINATION 114 # HEADERS += combination/bnccomb.h 115 # SOURCES += combination/bnccomb.cpp 116 # } 117 117 118 118 exists(PPP) {
Note:
See TracChangeset
for help on using the changeset viewer.