Changeset 1807 in ntrip
- Timestamp:
- Apr 23, 2009, 7:11:25 PM (16 years ago)
- Location:
- trunk/BNC
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/RTCM3Decoder.cpp
r1580 r1807 40 40 41 41 #include <iostream> 42 #include <iomanip> 43 #include <sstream> 42 44 #include <math.h> 43 45 #include <string.h> 44 46 45 47 #include "RTCM3Decoder.h" 48 #include "../RTCM/rtcm_utils.h" 46 49 #include "bncconst.h" 47 50 #include "bncapp.h" … … 89 92 // ---------------------------------------------- 90 93 _mode = unknown; 94 95 // Antenna position (used for decoding of message 1003) 96 // ---------------------------------------------------- 97 _antXYZ[0] = _antXYZ[1] = _antXYZ[2] = 0; 98 91 99 } 92 100 … … 148 156 _antList.back().zz = _Parser.antZ * 1e-4; 149 157 _antList.back().message = rr; 158 159 // Remember station position for 1003 message decoding 160 _antXYZ[0] = _Parser.antX * 1e-4; 161 _antXYZ[1] = _Parser.antY * 1e-4; 162 _antXYZ[2] = _Parser.antZ * 1e-4; 150 163 } 151 164 … … 162 175 _antList.back().height_f = true; 163 176 _antList.back().message = rr; 177 178 // Remember station position for 1003 message decoding 179 _antXYZ[0] = _Parser.antX * 1e-4; 180 _antXYZ[1] = _Parser.antY * 1e-4; 181 _antXYZ[2] = _Parser.antZ * 1e-4; 164 182 } 165 183 … … 174 192 } 175 193 194 // apply "GPS Integer L1 Pseudorange Modulus Ambiguity" 195 bool applyModulusAmb = false; 196 ///if (rr == 2) { 197 /// applyModulusAmb = true; 198 ///} 199 176 200 if (rr == 2) { 177 201 emit(newMessage( (_staID + ": No valid RINEX! All values are modulo 299792.458!").toAscii(), true)); … … 195 219 obs->_o.GPSWeek = _Parser.Data.week; 196 220 obs->_o.GPSWeeks = _Parser.Data.timeofweek / 1000.0; 221 222 // Estimate "GPS Integer L1 Pseudorange Modulus Ambiguity" 223 // ------------------------------------------------------- 224 double modulusAmb = 0; 225 if (applyModulusAmb) { 226 // Missing antenna coordinates: skip all data 227 if ( !_antXYZ[0] && !_antXYZ[1] && !_antXYZ[2] ) { 228 continue; 229 } 230 231 ostringstream prns; 232 prns << obs->_o.satSys << setfill('0') << setw(2) << obs->_o.satNum; 233 234 string prn = prns.str(); 235 236 // Missing ephemerides, skip satellite 237 if (_ephList.find(prn) == _ephList.end()) { 238 continue; 239 } 240 241 const t_eph* eph = &(_ephList.find(prn)->second); 242 243 double rho, xSat, ySat, zSat, clkSat, GPSWeeks_tot; 244 int GPSWeek_tot; 245 cmpRho(eph, _antXYZ[0], _antXYZ[1], _antXYZ[2], 246 obs->_o.GPSWeek, obs->_o.GPSWeeks, 247 rho, GPSWeek_tot, GPSWeeks_tot, 248 xSat, ySat, zSat, clkSat); 249 250 const double CC = 299792458.0; 251 252 int nn = static_cast<int>(rho / (CC * 0.001)); 253 254 modulusAmb = nn * CC * 0.001; 255 } 197 256 257 // Loop over all data types 258 // ------------------------ 198 259 for (int jj = 0; jj < _Parser.numdatatypesGPS; jj++) { 199 260 int v = 0; … … 228 289 // variables df and pos are used consequently. Perlt 229 290 if (df & GNSSDF_C1DATA) { 230 obs->_o.C1 = _Parser.Data.measdata[ii][pos] ;291 obs->_o.C1 = _Parser.Data.measdata[ii][pos] + modulusAmb; 231 292 } 232 293 else if (df & GNSSDF_C2DATA) { 233 obs->_o.C2 = _Parser.Data.measdata[ii][pos] ;294 obs->_o.C2 = _Parser.Data.measdata[ii][pos] + modulusAmb; 234 295 } 235 296 else if (df & GNSSDF_P1DATA) { 236 obs->_o.P1 = _Parser.Data.measdata[ii][pos] ;297 obs->_o.P1 = _Parser.Data.measdata[ii][pos] + modulusAmb; 237 298 } 238 299 else if (df & GNSSDF_P2DATA) { 239 obs->_o.P2 = _Parser.Data.measdata[ii][pos] ;300 obs->_o.P2 = _Parser.Data.measdata[ii][pos] + modulusAmb; 240 301 } 241 302 else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) { 242 obs->_o.L1 = _Parser.Data.measdata[ii][pos] ;303 obs->_o.L1 = _Parser.Data.measdata[ii][pos] + modulusAmb; 243 304 obs->_o.SNR1 = _Parser.Data.snrL1[ii]; 244 305 obs->_o.lock_timei_L1 = _Parser.lastlockl1[isat]; 245 306 } 246 307 else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) { 247 obs->_o.L2 = _Parser.Data.measdata[ii][pos] ;308 obs->_o.L2 = _Parser.Data.measdata[ii][pos] + modulusAmb; 248 309 obs->_o.SNR2 = _Parser.Data.snrL2[ii]; 249 310 obs->_o.lock_timei_L2 = _Parser.lastlockl2[isat]; … … 290 351 } 291 352 } 353 354 // Store ephemerides 355 //////////////////////////////////////////////////////////////////////////////////////// 356 bool RTCM3Decoder::storeEph(const gpsephemeris& gpseph) { 357 t_ephGPS eph; eph.set(&gpseph); 358 359 return storeEph(eph); 360 } 361 362 363 bool RTCM3Decoder::storeEph(const t_ephGPS& gpseph) { 364 double weekold = 0.0; 365 double weeknew = gpseph.GPSweek() + gpseph.GPSweeks() / 86400.0; 366 if ( _ephList.find(gpseph.prn()) != _ephList.end() ) { 367 weekold = _ephList.find(gpseph.prn())->second.GPSweek() 368 + _ephList.find(gpseph.prn())->second.GPSweeks() / 86400.0; 369 } 370 371 if ( weeknew - weekold > 1/86400.0 ) { 372 _ephList[gpseph.prn()] = gpseph; 373 374 return true; 375 } 376 377 return false; 378 } -
trunk/BNC/RTCM3/RTCM3Decoder.h
r1567 r1807 27 27 28 28 #include <QtCore> 29 #include <map> 30 29 31 #include "../RTCM/GPSDecoder.h" 30 32 #include "../RTCM/GPSDecoder.h" 31 33 #include "RTCM3coDecoder.h" 34 #include "ephemeris.h" 32 35 33 36 extern "C" { … … 45 48 } 46 49 50 bool storeEph(const gpsephemeris& gpseph); 51 bool storeEph(const t_ephGPS& gpseph); 52 47 53 signals: 48 54 void newMessage(QByteArray msg,bool showOnScreen); … … 58 64 RTCM3coDecoder* _coDecoder; 59 65 t_mode _mode; 66 67 std::map<std::string, t_ephGPS> _ephList; 68 double _antXYZ[3]; 69 60 70 }; 61 71 -
trunk/BNC/RTCM3/ephemeris.h
r1025 r1807 4 4 #include <stdio.h> 5 5 #include <string> 6 extern "C" { 6 7 #include "RTCM3/rtcm3torinex.h" 8 } 7 9 8 10 class t_eph { -
trunk/BNC/bnccaster.cpp
r1770 r1807 239 239 connect(getThread, SIGNAL(getThreadFinished(QByteArray)), 240 240 this, SLOT(slotGetThreadFinished(QByteArray))); 241 242 connect(((bncApp*)qApp), SIGNAL(newEphGPS(gpsephemeris)), 243 getThread, SLOT(slotNewEphGPS(gpsephemeris))); 241 244 242 245 _staIDs.push_back(getThread->staID()); -
trunk/BNC/bncgetthread.cpp
r1779 r1807 653 653 ////////////////////////////////////////////////////////////////////////////// 654 654 void bncGetThread::slotNewEphGPS(gpsephemeris gpseph) { 655 RTCM2Decoder* decoder = dynamic_cast<RTCM2Decoder*>(_decoder); 656 657 if ( decoder ) { 655 RTCM2Decoder* decoder2 = dynamic_cast<RTCM2Decoder*>(_decoder); 656 RTCM3Decoder* decoder3 = dynamic_cast<RTCM3Decoder*>(_decoder); 657 658 if ( decoder2 ) { 658 659 QMutexLocker locker(&_mutex); 659 660 … … 661 662 vector<int> IODs; 662 663 663 if ( decoder ->storeEph(gpseph, storedPRN, IODs) ) {664 if ( decoder2->storeEph(gpseph, storedPRN, IODs) ) { 664 665 #ifdef DEBUG_RTCM2_2021 665 666 QString msg = _staID + QString(": stored eph %1 IODs").arg(storedPRN.c_str()); … … 673 674 } 674 675 } 675 } 676 676 677 if ( decoder3 ) { 678 QMutexLocker locker(&_mutex); 679 680 if ( decoder3->storeEph(gpseph) ) { 681 QString msg = _staID + QString(": RTCM3Decoder, stored eph for satellite %1").arg(gpseph.satellite); 682 emit(newMessage(msg.toAscii(),true)); 683 } 684 } 685 } 686
Note:
See TracChangeset
for help on using the changeset viewer.