Changeset 6137 in ntrip for trunk/BNC/src
- Timestamp:
- Sep 13, 2014, 12:19:37 PM (10 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/GPSDecoder.cpp
r5884 r6137 46 46 #include "bncrinex.h" 47 47 48 extern "C" {49 #include "rtcm3torinex.h"50 }51 52 48 using namespace std; 53 49 … … 82 78 // Write RINEX Epoch 83 79 ////////////////////////////////////////////////////////////////////////////// 84 void GPSDecoder::dumpRinexEpoch(const t_ obs& obs, const QByteArray& format) {80 void GPSDecoder::dumpRinexEpoch(const t_satObs& obs, const QByteArray& format) { 85 81 if (_rnx) { 86 long iSec = long(floor(obs. GPSWeeks+0.5));87 long obsTime = obs. GPSWeek* 7*24*3600 + iSec;82 long iSec = long(floor(obs._time.gpssec()+0.5)); 83 long obsTime = obs._time.gpsw() * 7*24*3600 + iSec; 88 84 if (_rnx->samplingRate() == 0 || iSec % _rnx->samplingRate() == 0) { 89 85 _rnx->deepCopy(obs); … … 101 97 } 102 98 103 //104 //////////////////////////////////////////////////////////////////////////////105 void t_obs::setMeasdata(QString rnxStr, float rnxVers, double value) {106 int ie = iEntry(rnxStr, rnxVers);107 108 if (ie != -1) {109 _codetype[ie] = rnxStr.mid(1);110 _measdata[ie] = value;111 }112 }113 114 //115 //////////////////////////////////////////////////////////////////////////////116 double t_obs::measdata(QString rnxStr, float rnxVers) const {117 int ie = iEntry(rnxStr, rnxVers);118 119 if (ie != -1) {120 return _measdata[ie];121 }122 123 return 0.0;124 }125 126 //127 //////////////////////////////////////////////////////////////////////////////128 QString t_obs::rnxStr(int iEntry) const {129 QString str(1,' ');130 switch(iEntry & 3) {131 case GNSSENTRY_CODE: str[0] = 'C'; break;132 case GNSSENTRY_PHASE: str[0] = 'L'; break;133 case GNSSENTRY_DOPPLER: str[0] = 'D'; break;134 case GNSSENTRY_SNR: str[0] = 'S'; break;135 }136 str += _codetype[iEntry];137 return str.trimmed();138 }139 140 //141 //////////////////////////////////////////////////////////////////////////////142 int t_obs::iEntry(QString rnxStr, float rnxVers, bool cmode) const {143 144 int res = 0;145 bool tryagain = false;146 QString rnxStrOrig = rnxStr;147 148 if (rnxVers < 3.0) {149 if (rnxStr == "C1") rnxStr = "C1C";150 else if (rnxStr == "P1") rnxStr = "C1P";151 else if (rnxStr == "C2") rnxStr = "C2C";152 else if (rnxStr == "P2") rnxStr = "C2P";153 if(cmode)154 {155 if (rnxStr == "S1") rnxStr = "S1C";156 else if (rnxStr == "L1") rnxStr = "L1C";157 else if (rnxStr == "S2") rnxStr = "S2C";158 else if (rnxStr == "L2") rnxStr = "L2C";159 }160 else161 {162 if (rnxStr == "S1") {rnxStr = "S1P"; tryagain = true; }163 else if (rnxStr == "L1") {rnxStr = "L1P"; tryagain = true; }164 else if (rnxStr == "S2") {rnxStr = "S2P"; tryagain = true; }165 else if (rnxStr == "L2") {rnxStr = "L2P"; tryagain = true; }166 }167 }168 169 // Observation Type (Code, Phase, Doppler, SNR)170 // --------------------------------------------171 if (rnxStr[0] == 'C') {172 res += GNSSENTRY_CODE;173 }174 else if (rnxStr[0] == 'L') {175 res += GNSSENTRY_PHASE;176 }177 else if (rnxStr[0] == 'D') {178 res += GNSSENTRY_DOPPLER;179 }180 else if (rnxStr[0] == 'S') {181 res += GNSSENTRY_SNR;182 }183 else {184 return -1;185 }186 187 // Frequency188 // ---------189 if (rnxStr[1] == '1') {190 if (rnxStr.length() < 3) {191 res += GNSSENTRY_TYPEC1;192 }193 else if (QString("ABCIQ").indexOf(rnxStr[2]) != -1) {194 res += GNSSENTRY_TYPEC1;195 }196 else if (QString("SL").indexOf(rnxStr[2]) != -1) {197 res += GNSSENTRY_TYPEC1N;198 }199 else if (QString("PWY").indexOf(rnxStr[2]) != -1) {200 res += GNSSENTRY_TYPEP1;201 }202 else if (rnxStr[2] == 'Z') {203 res += GNSSENTRY_TYPECSAIF;204 }205 else if (rnxStr[2] == 'X') {206 if (satSys == 'C' || satSys == 'E') {207 res += GNSSENTRY_TYPEC1;208 }209 else {210 res += GNSSENTRY_TYPEC1N;211 }212 }213 else {214 return -1;215 }216 }217 else if (rnxStr[1] == '2') {218 if (rnxStr.length() < 3) {219 res += GNSSENTRY_TYPEC2;220 }221 else if (QString("PWY").indexOf(rnxStr[2]) != -1) {222 res += GNSSENTRY_TYPEP2;223 }224 else if (QString("CSLX").indexOf(rnxStr[2]) != -1) {225 res += GNSSENTRY_TYPEC2;226 }227 else if (rnxStr[2] == 'I') {228 if (satSys == 'C') {229 res += GNSSENTRY_TYPEC1; // Compass: RINEX 3.01 "2I" corresponds to "1I" RINEX 3.02230 }231 else {232 res += GNSSENTRY_TYPEC2;233 }234 }235 else if (rnxStr[2] == 'Q') {236 res += GNSSENTRY_TYPEC2;237 }238 else {239 return -1;240 }241 }242 else if (rnxStr[1] == '5') {243 res += GNSSENTRY_TYPEC5;244 }245 else if (rnxStr[1] == '6') {246 res += GNSSENTRY_TYPEC6;247 }248 else if (rnxStr[1] == '7') {249 res += GNSSENTRY_TYPEC5B;250 }251 else if (rnxStr[1] == '8') {252 res += GNSSENTRY_TYPEC5AB;253 }254 else {255 return -1;256 }257 258 /* Note: We prefer P over C for Lx or Sx (i.e. we first try for P values) */259 if(_codetype[res].isEmpty() && tryagain)260 res = iEntry(rnxStrOrig, rnxVers, true);261 262 return res;263 } -
trunk/BNC/src/GPSDecoder.h
r5884 r6137 34 34 #include "bncconst.h" 35 35 #include "bnctime.h" 36 37 extern "C" { 38 #include "rtcm3torinex.h" 39 } 36 #include "satObs.h" 40 37 41 38 class bncRinex; 42 43 class t_obs {44 public:45 t_obs() {46 StatID[0] = '\x0';47 satSys = 'G';48 satNum = 0;49 slotNum = 0;50 GPSWeek = 0;51 GPSWeeks = 0.0;52 _dataflags = 0;53 _dataflags2 = 0;54 for (int ie = 0; ie < GNSSENTRY_NUMBER; ie++) {55 _measdata[ie] = 0.0;56 }57 slip_cnt_L1 = -1;58 slip_cnt_L2 = -1;59 slip_cnt_L5 = -1;60 snrL1 = 0;61 snrL2 = 0;62 snrL5 = 0;63 slipL1 = false;64 slipL2 = false;65 slipL5 = false;66 }67 68 ~t_obs() {}69 70 double measdata(QString rnxStr, float rnxVer) const;71 void setMeasdata(QString rnxStr, float rnxVer, double value);72 73 char StatID[20+1]; // Station ID74 char satSys; // Satellite System ('G' or 'R')75 int satNum; // Satellite Number (PRN for GPS NAVSTAR)76 int slotNum; // Slot Number (for Glonass)77 int GPSWeek; // Week of GPS-Time78 double GPSWeeks; // Second of Week (GPS-Time)79 80 int slip_cnt_L1; // L1 cumulative loss of continuity indicator (negative value = undefined)81 int slip_cnt_L2; // L2 cumulative loss of continuity indicator (negative value = undefined)82 int slip_cnt_L5; // L5 cumulative loss of continuity indicator (negative value = undefined)83 84 int snrL1; // signal-to-noise ratio mapped to <1,9>85 int snrL2; // s = int(floor(SNR/6)); if (s > 9) s = 9; if (s < 1) s = 1;86 int snrL5;87 88 bool slipL1;89 bool slipL2;90 bool slipL5;91 92 double _measdata[GNSSENTRY_NUMBER]; // data fields */93 unsigned long long _dataflags; // GNSSDF_xxx */94 unsigned int _dataflags2; // GNSSDF2_xxx */95 QString _codetype[GNSSENTRY_NUMBER];96 97 QString rnxStr(int iEntry) const;98 99 private:100 int iEntry(QString rnxStr, float rnxVers, bool cmode=false) const;101 };102 39 103 40 class GPSDecoder { … … 116 53 const QByteArray& nmea, const QByteArray& ntripVersion); 117 54 118 void dumpRinexEpoch(const t_ obs& obs, const QByteArray& format);55 void dumpRinexEpoch(const t_satObs& obs, const QByteArray& format); 119 56 120 57 void setRinexReconnectFlag(bool flag); … … 139 76 }; 140 77 141 QList<t_ obs>_obsList;78 QList<t_satObs> _obsList; 142 79 QList<int> _typeList; // RTCM message types 143 80 QStringList _antType; // RTCM antenna descriptor -
trunk/BNC/src/RTCM/RTCM2Decoder.cpp
r4403 r6137 46 46 #include "../bncutils.h" 47 47 #include "rtcm_utils.h" 48 #include "GPSDecoder.h"49 48 #include "RTCM2Decoder.h" 50 49 … … 137 136 138 137 for (int iSat=0; iSat < _ObsBlock.nSat; iSat++) { 139 t_ obs obs;138 t_satObs obs; 140 139 if (_ObsBlock.PRN[iSat] > 100) { 141 obs.satNum = _ObsBlock.PRN[iSat] % 100; 142 obs.satSys = 'R'; 140 obs._prn.set('R', _ObsBlock.PRN[iSat] % 100); 143 141 } 144 else { 145 obs.satNum = _ObsBlock.PRN[iSat]; 146 obs.satSys = 'G'; 142 else { 143 obs._prn.set('R', _ObsBlock.PRN[iSat]); 147 144 } 148 obs.GPSWeek = epochWeek; 149 obs.GPSWeeks = epochSecs; 150 obs.setMeasdata("C1", 2.0, _ObsBlock.rng_C1[iSat]); 151 obs.setMeasdata("P1", 2.0, _ObsBlock.rng_P1[iSat]); 152 obs.setMeasdata("P2", 2.0, _ObsBlock.rng_P2[iSat]); 153 obs.setMeasdata("L1", 2.0, _ObsBlock.resolvedPhase_L1(iSat)); 154 obs.setMeasdata("L2", 2.0, _ObsBlock.resolvedPhase_L2(iSat)); 155 obs.slip_cnt_L1 = _ObsBlock.slip_L1[iSat]; 156 obs.slip_cnt_L2 = _ObsBlock.slip_L2[iSat]; 145 obs._time.set(epochWeek, epochSecs); 146 t_frqObs* frqObs1C = new t_frqObs; 147 frqObs1C->_rnxType2ch = "1C"; 148 frqObs1C->_codeValid = true; 149 frqObs1C->_code = _ObsBlock.rng_C1[iSat]; 150 obs._obs.push_back(frqObs1C); 151 152 t_frqObs* frqObs1P = new t_frqObs; 153 frqObs1P->_rnxType2ch = "1P"; 154 frqObs1P->_codeValid = true; 155 frqObs1P->_code = _ObsBlock.rng_P1[iSat]; 156 obs._obs.push_back(frqObs1P); 157 frqObs1P->_phaseValid = true; 158 frqObs1P->_phase = _ObsBlock.resolvedPhase_L1(iSat); 159 frqObs1P->_slipCounter = _ObsBlock.slip_L1[iSat]; 160 obs._obs.push_back(frqObs1P); 161 162 t_frqObs* frqObs2P = new t_frqObs; 163 frqObs2P->_rnxType2ch = "2P"; 164 frqObs2P->_codeValid = true; 165 frqObs2P->_code = _ObsBlock.rng_P2[iSat]; 166 obs._obs.push_back(frqObs2P); 167 frqObs2P->_phaseValid = true; 168 frqObs2P->_phase = _ObsBlock.resolvedPhase_L2(iSat); 169 frqObs2P->_slipCounter = _ObsBlock.slip_L2[iSat]; 170 obs._obs.push_back(frqObs2P); 157 171 158 172 _obsList.push_back(obs); … … 283 297 284 298 // new observation 285 t_obs* new_obs = 0; 299 t_satObs* new_obs = 0; 300 301 t_frqObs* frqObs1C = new t_frqObs; 302 frqObs1C->_rnxType2ch = "1C"; 303 new_obs->_obs.push_back(frqObs1C); 304 305 t_frqObs* frqObs1P = new t_frqObs; 306 frqObs1P->_rnxType2ch = "1P"; 307 new_obs->_obs.push_back(frqObs1P); 308 309 t_frqObs* frqObs2P = new t_frqObs; 310 frqObs2P->_rnxType2ch = "2P"; 311 new_obs->_obs.push_back(frqObs2P); 286 312 287 313 // missing IOD … … 354 380 // ------------------- 355 381 if ( !new_obs ) { 356 new_obs = new t_ obs();357 358 new_obs->StatID[0] = '\x0';359 new_obs->satSys = (corr->PRN < 200 ? 'G' : 'R'); 360 new_obs->satNum = (corr->PRN < 200 ? corr->PRN : corr->PRN - 200); 361 362 new_obs->GPSWeek = GPSWeek_rcv; 363 new_obs-> GPSWeeks = GPSWeeks_rcv;382 new_obs = new t_satObs(); 383 if (corr->PRN < 200) { 384 new_obs->_prn.set('G', corr->PRN); 385 } 386 else { 387 new_obs->_prn.set('R', corr->PRN-200); 388 } 389 new_obs->_time.set(GPSWeek_rcv, GPSWeeks_rcv); 364 390 } 365 391 … … 368 394 switch (ii) { 369 395 case 0: // --- L1 --- 370 new_obs->setMeasdata("L1", 2.0, *obsVal / LAMBDA_1); 371 new_obs->slip_cnt_L1 = corr->lock1; 396 frqObs1P->_phaseValid = true; 397 frqObs1P->_phase = *obsVal / LAMBDA_1; 398 frqObs1P->_slipCounter = corr->lock1; 372 399 break; 373 400 case 1: // --- L2 --- 374 new_obs->setMeasdata("L2", 2.0, *obsVal / LAMBDA_2); 375 new_obs->slip_cnt_L2 = corr->lock2; 401 frqObs2P->_phaseValid = true; 402 frqObs2P->_phase = *obsVal / LAMBDA_2; 403 frqObs2P->_slipCounter = corr->lock2; 376 404 break; 377 405 case 2: // --- C1 / P1 --- 378 if ( corr->Pind1 ) 379 new_obs->setMeasdata("P1", 2.0, *obsVal); 380 else 381 new_obs->setMeasdata("C1", 2.0, *obsVal); 406 if ( corr->Pind1 ) { 407 frqObs1P->_codeValid = true; 408 frqObs1P->_code = *obsVal; 409 } 410 else { 411 frqObs1C->_codeValid = true; 412 frqObs1C->_code = *obsVal; 413 } 382 414 break; 383 415 case 3: // --- C2 / P2 --- 384 if ( corr->Pind2 ) 385 new_obs->setMeasdata("P2", 2.0, *obsVal);386 else 387 new_obs->setMeasdata("C2", 2.0, *obsVal);416 if ( corr->Pind2 ) { 417 frqObs2P->_codeValid = true; 418 frqObs2P->_code = *obsVal; 419 } 388 420 break; 389 421 default: -
trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
r5545 r6137 228 228 for (int iSat = 0; iSat < gnssData.numsats; iSat++) { 229 229 230 t_ obs obs;230 t_satObs obs; 231 231 int satID = gnssData.satellites[iSat]; 232 232 … … 234 234 // --- 235 235 if (satID >= PRN_GPS_START && satID <= PRN_GPS_END) { 236 obs.satSys = 'G'; 237 obs.satNum = satID; 236 obs._prn.set('G', satID); 238 237 } 239 238 … … 241 240 // ------- 242 241 else if (satID >= PRN_GLONASS_START && satID <= PRN_GLONASS_END) { 243 obs.satSys = 'R'; 244 obs.satNum = satID - PRN_GLONASS_START + 1; 245 if (obs.satNum <= PRN_GLONASS_NUM && 246 parser.GLOFreq[obs.satNum-1] != 0) { 247 obs.slotNum = parser.GLOFreq[obs.satNum-1] - 100; 248 } 249 else { 250 continue; 251 } 242 obs._prn.set('R', satID - PRN_GLONASS_START + 1); 252 243 } 253 244 … … 255 246 // ------- 256 247 else if (satID >= PRN_GALILEO_START && satID <= PRN_GALILEO_END) { 257 obs.satSys = 'E'; 258 obs.satNum = satID - PRN_GALILEO_START + 1; 248 obs._prn.set('E', satID - PRN_GALILEO_START + 1); 259 249 } 260 250 … … 262 252 // ---- 263 253 else if (satID >= PRN_SBAS_START && satID <= PRN_SBAS_END) { 264 obs.satSys = 'S'; 265 obs.satNum = satID - PRN_SBAS_START + 20; 254 obs._prn.set('S', satID - PRN_SBAS_START + 20); 266 255 } 267 256 … … 269 258 // ------------- 270 259 else if (satID >= PRN_GIOVE_START && satID <= PRN_GIOVE_END) { 271 obs.satSys = 'E'; 272 obs.satNum = satID - PRN_GIOVE_START + PRN_GIOVE_OFFSET; 260 obs._prn.set('E', satID - PRN_GIOVE_START + PRN_GIOVE_OFFSET); 273 261 } 274 262 … … 276 264 // ------------- 277 265 else if (satID >= PRN_QZSS_START && satID <= PRN_QZSS_END) { 278 obs.satSys = 'J'; 279 obs.satNum = satID - PRN_QZSS_START + 1; 266 obs._prn.set('J', satID - PRN_QZSS_START + 1); 280 267 } 281 268 … … 283 270 // ------------- 284 271 else if (satID >= PRN_COMPASS_START && satID <= PRN_COMPASS_END) { 285 obs.satSys = 'C'; 286 obs.satNum = satID - PRN_COMPASS_START + 1; 272 obs._prn.set('C', satID - PRN_COMPASS_START + 1); 287 273 } 288 274 … … 293 279 } 294 280 295 obs.GPSWeek = gnssData.week; 296 obs.GPSWeeks = gnssData.timeofweek / 1000.0; 297 298 QString prn = QString("%1%2").arg(obs.satSys) 299 .arg(obs.satNum, 2, 10, QChar('0')); 281 obs._time.set(gnssData.week, gnssData.timeofweek / 1000.0); 282 283 QString prn(obs._prn.toString().c_str()); 284 285 int obs_slip_cnt_L1 = 0; 286 int obs_slip_cnt_L2 = 0; 287 int obs_slip_cnt_L5 = 0; 300 288 301 289 // Handle loss-of-lock flags … … 314 302 _slip_cnt_L1[prn] = 1; 315 303 } 316 obs .slip_cnt_L1 = _slip_cnt_L1[prn];304 obs_slip_cnt_L1 = _slip_cnt_L1[prn]; 317 305 } 318 306 if (GNSSDF2_LOCKLOSSL2 & gnssData.dataflags2[iSat]) { … … 323 311 _slip_cnt_L2[prn] = 1; 324 312 } 325 obs .slip_cnt_L2 = _slip_cnt_L2[prn];313 obs_slip_cnt_L2 = _slip_cnt_L2[prn]; 326 314 } 327 315 if (GNSSDF2_LOCKLOSSL5 & gnssData.dataflags2[iSat]) { … … 332 320 _slip_cnt_L5[prn] = 1; 333 321 } 334 obs.slip_cnt_L5 = _slip_cnt_L5[prn]; 335 } 336 337 obs._dataflags = gnssData.dataflags[iSat]; 338 obs._dataflags2 = gnssData.dataflags2[iSat]; 322 obs_slip_cnt_L5 = _slip_cnt_L5[prn]; 323 } 339 324 340 325 // Loop over all data types 341 326 // ------------------------ 342 327 for (int iEntry = 0; iEntry < GNSSENTRY_NUMBER; ++iEntry) { 343 obs._measdata[iEntry] = gnssData.measdata[iSat][iEntry]; 344 obs._codetype[iEntry] = gnssData.codetype[iSat][iEntry]; 328 if (gnssData.codetype[iSat][iEntry] == 0) { 329 continue; 330 } 331 string rnxType(gnssData.codetype[iSat][iEntry]); 332 cout << "rnxType " << rnxType << endl; 333 334 t_frqObs* frqObs = 0; 335 for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) { 336 if (obs._obs[iFrq]->_rnxType2ch == rnxType) { 337 frqObs = obs._obs[iFrq]; 338 break; 339 } 340 } 341 if (frqObs == 0) { 342 frqObs = new t_frqObs; 343 frqObs->_rnxType2ch = rnxType; 344 obs._obs.push_back(frqObs); 345 } 346 347 switch(iEntry & 3) { 348 case GNSSENTRY_CODE: 349 frqObs->_codeValid = true; 350 frqObs->_code = gnssData.measdata[iSat][iEntry]; 351 break; 352 case GNSSENTRY_PHASE: 353 frqObs->_phaseValid = true; 354 frqObs->_phase = gnssData.measdata[iSat][iEntry]; 355 if (rnxType[0] == '1') { 356 frqObs->_slipCounter = obs_slip_cnt_L1; 357 } 358 else if (rnxType[0] == '2') { 359 frqObs->_slipCounter = obs_slip_cnt_L2; 360 } 361 else if (rnxType[0] == '5') { 362 frqObs->_slipCounter = obs_slip_cnt_L5; 363 } 364 break; 365 case GNSSENTRY_DOPPLER: 366 frqObs->_dopplerValid = true; 367 frqObs->_doppler = gnssData.measdata[iSat][iEntry]; 368 break; 369 case GNSSENTRY_SNR: 370 frqObs->_snrValid = true; 371 frqObs->_snr = gnssData.measdata[iSat][iEntry]; 372 break; 373 } 345 374 } 346 375 _obsList.push_back(obs); -
trunk/BNC/src/bnccaster.cpp
r5996 r6137 51 51 #include "bncutils.h" 52 52 #include "bncsettings.h" 53 #include "GPSDecoder.h"54 53 55 54 using namespace std; … … 113 112 } 114 113 115 _epochs = new QMultiMap<long, t_ obs>;114 _epochs = new QMultiMap<long, t_satObs>; 116 115 117 116 _samplingRate = settings.value("binSampl").toInt(); … … 164 163 // New Observations 165 164 //////////////////////////////////////////////////////////////////////////// 166 void bncCaster::slotNewObs(const QByteArray staID, QList<t_ obs> obsList) {165 void bncCaster::slotNewObs(const QByteArray staID, QList<t_satObs> obsList) { 167 166 168 167 QMutexLocker locker(&_mutex); … … 171 170 172 171 unsigned index = 0; 173 QMutableListIterator<t_ obs> it(obsList);172 QMutableListIterator<t_satObs> it(obsList); 174 173 while (it.hasNext()) { 175 174 ++index; 176 t_ obs& obs = it.next();177 178 long iSec = long(floor(obs. GPSWeeks+0.5));179 long newTime = obs. GPSWeek* 7*24*3600 + iSec;175 t_satObs& obs = it.next(); 176 177 long iSec = long(floor(obs._time.gpssec()+0.5)); 178 long newTime = obs._time.gpsw() * 7*24*3600 + iSec; 180 179 181 180 // Rename the Station 182 181 // ------------------ 183 strncpy(obs.StatID, staID.constData(),sizeof(obs.StatID)); 184 obs.StatID[sizeof(obs.StatID)-1] = '\0'; 182 obs._staID = staID.data(); 185 183 186 184 // Output into the socket … … 190 188 ostringstream oStr; 191 189 oStr.setf(ios::showpoint | ios::fixed); 192 oStr << obs. StatID<< " "193 << setw(4) << obs. GPSWeek<< " "194 << setw(14) << setprecision(7) << obs. GPSWeeks<< " "190 oStr << obs._staID << " " 191 << setw(4) << obs._time.gpsw() << " " 192 << setw(14) << setprecision(7) << obs._time.gpssec() << " " 195 193 << bncRinex::asciiSatLine(obs) << endl; 196 194 … … 276 274 void bncCaster::addGetThread(bncGetThread* getThread, bool noNewThread) { 277 275 278 qRegisterMetaType<t_ obs>("t_obs");279 qRegisterMetaType< QList<t_ obs> >("QList<t_obs>");276 qRegisterMetaType<t_satObs>("t_satObs"); 277 qRegisterMetaType< QList<t_satObs> >("QList<t_satObs>"); 280 278 qRegisterMetaType<gpsephemeris>("gpsephemeris"); 281 279 qRegisterMetaType<glonassephemeris>("glonassephemeris"); 282 280 qRegisterMetaType<galileoephemeris>("galileoephemeris"); 283 281 284 connect(getThread, SIGNAL(newObs(QByteArray, QList<t_ obs>)),285 this, SLOT(slotNewObs(QByteArray, QList<t_ obs>)));286 287 connect(getThread, SIGNAL(newObs(QByteArray, QList<t_ obs>)),288 this, SIGNAL(newObs(QByteArray, QList<t_ obs>)));282 connect(getThread, SIGNAL(newObs(QByteArray, QList<t_satObs>)), 283 this, SLOT(slotNewObs(QByteArray, QList<t_satObs>))); 284 285 connect(getThread, SIGNAL(newObs(QByteArray, QList<t_satObs>)), 286 this, SIGNAL(newObs(QByteArray, QList<t_satObs>))); 289 287 290 288 connect(getThread, SIGNAL(newRawData(QByteArray, QByteArray)), … … 336 334 (_samplingRate == 0 || sec % _samplingRate == 0) ) { 337 335 338 QList<t_ obs> allObs = _epochs->values(sec);336 QList<t_satObs> allObs = _epochs->values(sec); 339 337 340 QListIterator<t_ obs> it(allObs);338 QListIterator<t_satObs> it(allObs); 341 339 bool firstObs = true; 342 340 while (it.hasNext()) { 343 const t_ obs& obs = it.next();341 const t_satObs& obs = it.next(); 344 342 345 343 ostringstream oStr; … … 347 345 if (firstObs) { 348 346 firstObs = false; 349 oStr << "> " << obs. GPSWeek<< ' '350 << setprecision(7) << obs. GPSWeeks<< endl;;347 oStr << "> " << obs._time.gpsw() << ' ' 348 << setprecision(7) << obs._time.gpssec() << endl;; 351 349 } 352 oStr << obs. StatID << ' ' << bncRinex::asciiSatLine(obs) << endl;350 oStr << obs._staID << ' ' << bncRinex::asciiSatLine(obs) << endl; 353 351 if (!it.hasNext()) { 354 352 oStr << endl; -
trunk/BNC/src/bnccaster.h
r5994 r6137 29 29 #include <QtNetwork> 30 30 #include <QMultiMap> 31 32 #include "GPSDecoder.h" 31 #include "satObs.h" 33 32 34 33 class bncGetThread; … … 45 44 46 45 public slots: 47 void slotNewObs(QByteArray staID, QList<t_ obs> obsList);46 void slotNewObs(QByteArray staID, QList<t_satObs> obsList); 48 47 void slotNewRawData(QByteArray staID, QByteArray data); 49 48 void slotNewNMEAstr(QByteArray staID, QByteArray str); … … 54 53 void getThreadsFinished(); 55 54 void newMessage(QByteArray msg, bool showOnScreen); 56 void newObs(QByteArray staID, QList<t_ obs> obsList);55 void newObs(QByteArray staID, QList<t_satObs> obsList); 57 56 58 57 private slots: … … 68 67 void reopenOutFile(); 69 68 70 QFile* _outFile;71 int _port;72 QTextStream* _out;73 QMultiMap<long, t_ obs>*_epochs;74 long _lastDumpSec;75 QTcpServer* _server;76 QTcpServer* _uServer;77 QTcpServer* _nmeaServer;78 QList<QTcpSocket*>* _sockets;79 QList<QTcpSocket*>* _uSockets;80 QList<QTcpSocket*>* _nmeaSockets;81 QList<QByteArray> _staIDs;82 QList<bncGetThread*> _threads;83 int _samplingRate;84 long _waitTime;85 QMutex _mutex;86 int _confInterval;87 QString _miscMount;88 int _miscPort;89 QTcpServer* _miscServer;90 QList<QTcpSocket*>* _miscSockets;69 QFile* _outFile; 70 int _port; 71 QTextStream* _out; 72 QMultiMap<long, t_satObs>* _epochs; 73 long _lastDumpSec; 74 QTcpServer* _server; 75 QTcpServer* _uServer; 76 QTcpServer* _nmeaServer; 77 QList<QTcpSocket*>* _sockets; 78 QList<QTcpSocket*>* _uSockets; 79 QList<QTcpSocket*>* _nmeaSockets; 80 QList<QByteArray> _staIDs; 81 QList<bncGetThread*> _threads; 82 int _samplingRate; 83 long _waitTime; 84 QMutex _mutex; 85 int _confInterval; 86 QString _miscMount; 87 int _miscPort; 88 QTcpServer* _miscServer; 89 QList<QTcpSocket*>* _miscSockets; 91 90 }; 92 91 -
trunk/BNC/src/bncgetthread.cpp
r5903 r6137 471 471 // Loop over all observations (observations output) 472 472 // ------------------------------------------------ 473 QListIterator<t_ obs> it(decoder()->_obsList);474 475 QList<t_ obs> obsListHlp;473 QListIterator<t_satObs> it(decoder()->_obsList); 474 475 QList<t_satObs> obsListHlp; 476 476 477 477 while (it.hasNext()) { 478 const t_obs& obs = it.next(); 479 480 QString prn = QString("%1%2").arg(obs.satSys) 481 .arg(obs.satNum, 2, 10, QChar('0')); 482 long iSec = long(floor(obs.GPSWeeks+0.5)); 483 long obsTime = obs.GPSWeek * 7*24*3600 + iSec; 478 const t_satObs& obs = it.next(); 479 480 QString prn(obs._prn.toString().c_str()); 481 long iSec = long(floor(obs._time.gpssec()+0.5)); 482 long obsTime = obs._time.gpsw()*7*24*3600 + iSec; 484 483 485 484 // Check observation epoch … … 660 659 // ----------------------- 661 660 for (int ii = 0; ii < decoder()->_obsList.size(); ii++) { 662 t_ obs& obs = decoder()->_obsList[ii];663 QVector<QString>& rnxTypes = _rnxTypes[obs. satSys];661 t_satObs& obs = decoder()->_obsList[ii]; 662 QVector<QString>& rnxTypes = _rnxTypes[obs._prn.system()]; 664 663 bool allFound = true; 665 for (int iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) { 666 if (obs._measdata[iEntry] != 0.0) { 667 if (rnxTypes.indexOf(obs.rnxStr(iEntry)) == -1) { 668 allFound = false; 669 rnxTypes << obs.rnxStr(iEntry); 670 } 664 for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) { 665 QString rnxStr(obs._obs[iFrq]->_rnxType2ch.c_str()); 666 if (rnxTypes.indexOf(rnxStr) == -1) { 667 allFound = false; 668 rnxTypes << rnxStr; 671 669 } 672 670 } … … 674 672 QString msg; 675 673 QTextStream str(&msg); 676 str << obs. satSys<< " " << rnxTypes.size() << " ";674 str << obs._prn.system() << " " << rnxTypes.size() << " "; 677 675 for (int iType = 0; iType < rnxTypes.size(); iType++) { 678 676 str << " " << rnxTypes[iType]; -
trunk/BNC/src/bncgetthread.h
r5873 r6137 31 31 #include <QFile> 32 32 33 #include "GPSDecoder.h"34 33 #include "rtcm3torinex.h" 35 34 #include "bncconst.h" … … 37 36 #include "bnctime.h" 38 37 #include "bncrawfile.h" 38 #include "satObs.h" 39 39 40 class GPSDecoder; 40 41 class QextSerialPort; 41 42 class latencyChecker; … … 78 79 void newRawData(QByteArray staID, QByteArray data); 79 80 void newLatency(QByteArray staID, double clate); 80 void newObs(QByteArray staID, QList<t_ obs> obsList);81 void newObs(QByteArray staID, QList<t_satObs> obsList); 81 82 void newAntCrd(QByteArray staID, double xx, double yy, double zz, 82 83 double hh, QByteArray antType); -
trunk/BNC/src/bncrinex.cpp
r6120 r6137 439 439 // Stores Observation into Internal Array 440 440 //////////////////////////////////////////////////////////////////////////// 441 void bncRinex::deepCopy(t_ obs obs) {441 void bncRinex::deepCopy(t_satObs obs) { 442 442 _obs.push_back(obs); 443 443 } … … 449 449 // Select observations older than maxTime 450 450 // -------------------------------------- 451 QList<t_ obs> dumpList;452 QMutableListIterator<t_ obs> mIt(_obs);451 QList<t_satObs> dumpList; 452 QMutableListIterator<t_satObs> mIt(_obs); 453 453 while (mIt.hasNext()) { 454 t_ obs obs = mIt.next();455 if (obs. GPSWeek * 7*24*3600 + obs.GPSWeeks< maxTime - 0.05) {454 t_satObs obs = mIt.next(); 455 if (obs._time.gpsw() * 7*24*3600 + obs._time.gpssec() < maxTime - 0.05) { 456 456 dumpList.push_back(obs); 457 457 mIt.remove(); … … 467 467 // Time of Epoch 468 468 // ------------- 469 const t_ obs& fObs = dumpList.first();470 QDateTime datTim = dateAndTimeFromGPSweek(fObs. GPSWeek, fObs.GPSWeeks);471 QDateTime datTimNom = dateAndTimeFromGPSweek(fObs. GPSWeek,472 floor(fObs. GPSWeeks+0.5));469 const t_satObs& fObs = dumpList.first(); 470 QDateTime datTim = dateAndTimeFromGPSweek(fObs._time.gpsw(), fObs._time.gpssec()); 471 QDateTime datTimNom = dateAndTimeFromGPSweek(fObs._time.gpsw(), 472 floor(fObs._time.gpssec()+0.5)); 473 473 474 474 // Close the file … … 482 482 // ------------------ 483 483 if (!_headerWritten) { 484 _header._startTime.set(fObs. GPSWeek, fObs.GPSWeeks);484 _header._startTime.set(fObs._time.gpsw(), fObs._time.gpssec()); 485 485 writeHeader(format, datTimNom); 486 486 } … … 488 488 // Check whether observation types available 489 489 // ----------------------------------------- 490 QMutableListIterator<t_ obs> mItDump(dumpList);490 QMutableListIterator<t_satObs> mItDump(dumpList); 491 491 while (mItDump.hasNext()) { 492 t_ obs& obs = mItDump.next();493 if (!_header._obsTypes.contains(obs. satSys) && !_header._obsTypes.contains(obs.satSys)) {492 t_satObs& obs = mItDump.next(); 493 if (!_header._obsTypes.contains(obs._prn.system()) && !_header._obsTypes.contains(obs._prn.system())) { 494 494 mItDump.remove(); 495 495 } … … 499 499 } 500 500 501 double sec = double(datTim.time().second()) + fmod(fObs. GPSWeeks,1.0);501 double sec = double(datTim.time().second()) + fmod(fObs._time.gpssec(),1.0); 502 502 503 503 // Epoch header line: RINEX Version 3 … … 515 515 << " " << 0 << setw(3) << dumpList.size(); 516 516 517 QListIterator<t_ obs> it(dumpList); int iSat = 0;517 QListIterator<t_satObs> it(dumpList); int iSat = 0; 518 518 while (it.hasNext()) { 519 519 iSat++; 520 const t_ obs& obs = it.next();521 _out << obs. satSys << setw(2) << obs.satNum;520 const t_satObs& obs = it.next(); 521 _out << obs._prn; 522 522 if (iSat == 12 && it.hasNext()) { 523 523 _out << endl << " "; … … 528 528 } 529 529 530 QListIterator<t_ obs> it(dumpList);530 QListIterator<t_satObs> it(dumpList); 531 531 while (it.hasNext()) { 532 const t_ obs& obs = it.next();532 const t_satObs& obs = it.next(); 533 533 534 534 // Cycle slips detection 535 535 // --------------------- 536 QString prn = QString("%1%2").arg(obs.satSys) 537 .arg(obs.satNum, 2, 10, QChar('0')); 538 539 char lli1 = ' '; 540 char lli2 = ' '; 541 char lli5 = ' '; 542 if ( obs.slip_cnt_L1 >= 0 ) { 543 if ( _slip_cnt_L1.find(prn) != _slip_cnt_L1.end() && 544 _slip_cnt_L1.find(prn).value() != obs.slip_cnt_L1 ) { 545 lli1 = '1'; 546 } 547 } 548 549 if ( obs.slip_cnt_L2 >= 0 ) { 550 if ( _slip_cnt_L2.find(prn) != _slip_cnt_L2.end() && 551 _slip_cnt_L2.find(prn).value() != obs.slip_cnt_L2 ) { 552 lli2 = '1'; 553 } 554 } 555 556 if ( obs.slip_cnt_L5 >= 0 ) { 557 if ( _slip_cnt_L5.find(prn) != _slip_cnt_L5.end() && 558 _slip_cnt_L5.find(prn).value() != obs.slip_cnt_L5 ) { 559 lli5 = '1'; 560 } 561 } 562 563 _slip_cnt_L1[prn] = obs.slip_cnt_L1; 564 _slip_cnt_L2[prn] = obs.slip_cnt_L2; 565 _slip_cnt_L5[prn] = obs.slip_cnt_L5; 536 QString prn(obs._prn.toString().c_str()); 537 char lli1 = ' '; 538 char lli2 = ' '; 539 char lli5 = ' '; 540 char* lli = 0; 541 542 for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) { 543 const t_frqObs* frqObs = obs._obs[iFrq]; 544 QMap<QString, int>* slip_cnt = 0; 545 if (frqObs->_rnxType2ch[0] == '1') { 546 slip_cnt = &_slip_cnt_L1; 547 lli = &lli1; 548 } 549 else if (frqObs->_rnxType2ch[0] == '2') { 550 slip_cnt = &_slip_cnt_L2; 551 lli = &lli2; 552 } 553 else if (frqObs->_rnxType2ch[0] == '5') { 554 slip_cnt = &_slip_cnt_L5; 555 lli = &lli5; 556 } 557 else { 558 continue; 559 } 560 if (frqObs->_slip) { 561 if ( slip_cnt->find(prn) != slip_cnt->end() && 562 slip_cnt->find(prn).value() != frqObs->_slipCounter ) { 563 *lli = '1'; 564 } 565 } 566 (*slip_cnt)[prn] = frqObs->_slipCounter; 567 } 566 568 567 569 // Write the data … … 594 596 // One Line in RINEX v2 or v3 595 597 //////////////////////////////////////////////////////////////////////////// 596 string bncRinex::rinexSatLine(const t_obs& obs, char lli1, char lli2, 597 char lli5) { 598 string bncRinex::rinexSatLine(const t_satObs& obs, char lli1, char lli2, char lli5) { 598 599 ostringstream str; 599 str.setf(ios::showpoint | ios::fixed); 600 601 if (_header._version >= 3.0) { 602 str << obs.satSys 603 << setw(2) << setfill('0') << obs.satNum << setfill(' '); 604 } 605 606 const QVector<QString>& types = _header._obsTypes[obs.satSys]; 607 for (int ii = 0; ii < types.size(); ii++) { 608 if (_header._version < 3.0 && ii > 0 && ii % 5 == 0) { 609 str << endl; 610 } 611 double value = obs.measdata(types[ii], _header._version); 612 str << setw(14) << setprecision(3) << value; 613 if (value != 0.0 && types[ii].indexOf("L1") == 0) { 614 str << lli1 << ' '; 615 } 616 else if (value != 0.0 && types[ii].indexOf("L2") == 0) { 617 str << lli2 << ' '; 618 } 619 else if (value != 0.0 && types[ii].indexOf("L5") == 0) { 620 str << lli5 << ' '; 621 } 622 else { 623 str << " "; 624 } 625 } 600 //// str.setf(ios::showpoint | ios::fixed); 601 //// 602 //// if (_header._version >= 3.0) { 603 //// str << obs._prn; 604 //// } 605 //// 606 //// const QVector<QString>& types = _header._obsTypes[obs._prn.system()]; 607 //// for (int ii = 0; ii < types.size(); ii++) { 608 //// if (_header._version < 3.0 && ii > 0 && ii % 5 == 0) { 609 //// str << endl; 610 //// } 611 //// for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) { 612 //// const t_frqObs* frqObs = obs._obs[iFrq]; 613 //// 614 //// 615 //// double value = obs.measdata(types[ii], _header._version); 616 //// str << setw(14) << setprecision(3) << value; 617 //// if (value != 0.0 && types[ii].indexOf("L1") == 0) { 618 //// str << lli1 << ' '; 619 //// } 620 //// else if (value != 0.0 && types[ii].indexOf("L2") == 0) { 621 //// str << lli2 << ' '; 622 //// } 623 //// else if (value != 0.0 && types[ii].indexOf("L5") == 0) { 624 //// str << lli5 << ' '; 625 //// } 626 //// else { 627 //// str << " "; 628 //// } 629 //// } 626 630 627 631 return str.str(); … … 644 648 // One Line in ASCII (Internal) Format 645 649 //////////////////////////////////////////////////////////////////////////// 646 string bncRinex::asciiSatLine(const t_ obs& obs) {650 string bncRinex::asciiSatLine(const t_satObs& obs) { 647 651 648 652 ostringstream str; 649 str.setf(ios::showpoint | ios::fixed); 650 651 str << obs.satSys << setw(2) << setfill('0') << obs.satNum << setfill(' '); 652 653 if (obs.satSys == 'R') { // Glonass 654 str << ' ' << setw(2) << obs.slotNum << ' '; 655 } 656 else { 657 str << " "; 658 } 659 660 float rnxVers = 3.0; 661 662 for (int ie = 0; ie < GNSSENTRY_NUMBER; ie++) { 663 QString rnxStr = obs.rnxStr(ie); 664 if (rnxStr.length() >= 2) { 665 double data = obs.measdata(rnxStr, rnxVers); 666 if (data != 0.0) { 667 int width = (rnxStr[0] == 'S') ? 8 : 14; 668 int prec = 3; 669 str << ' ' << rnxStr.toAscii().data() 670 << ' ' << obsToStr(data, width, prec); 671 if (rnxStr[0] == 'L') { 672 int slipCnt = 0; 673 if (rnxStr[1] == '1') { 674 slipCnt = obs.slip_cnt_L1; 675 } 676 else if (rnxStr[1] == '2') { 677 slipCnt = obs.slip_cnt_L2; 678 } 679 else if (rnxStr[1] == '5') { 680 slipCnt = obs.slip_cnt_L5; 681 } 682 str << ' ' << setw(3) << slipCnt; 683 } 684 } 685 } 686 } 653 //// str.setf(ios::showpoint | ios::fixed); 654 //// 655 //// str << obs._prn << ' '; 656 //// 657 //// float rnxVers = 3.0; 658 //// 659 //// for (int ie = 0; ie < GNSSENTRY_NUMBER; ie++) { 660 //// QString rnxStr = obs.rnxStr(ie); 661 //// if (rnxStr.length() >= 2) { 662 //// double data = obs.measdata(rnxStr, rnxVers); 663 //// if (data != 0.0) { 664 //// int width = (rnxStr[0] == 'S') ? 8 : 14; 665 //// int prec = 3; 666 //// str << ' ' << rnxStr.toAscii().data() 667 //// << ' ' << obsToStr(data, width, prec); 668 //// if (rnxStr[0] == 'L') { 669 //// int slipCnt = 0; 670 //// if (rnxStr[1] == '1') { 671 //// slipCnt = obs.slip_cnt_L1; 672 //// } 673 //// else if (rnxStr[1] == '2') { 674 //// slipCnt = obs.slip_cnt_L2; 675 //// } 676 //// else if (rnxStr[1] == '5') { 677 //// slipCnt = obs.slip_cnt_L5; 678 //// } 679 //// str << ' ' << setw(3) << slipCnt; 680 //// } 681 //// } 682 //// } 683 //// } 687 684 688 685 return str.str(); -
trunk/BNC/src/bncrinex.h
r4532 r6137 30 30 31 31 #include "bncconst.h" 32 #include "satObs.h" 32 33 #include "rinex/rnxobsfile.h" 33 34 class t_obs;35 34 36 35 class bncRinex { … … 42 41 43 42 int samplingRate() const {return _samplingRate;} 44 void deepCopy(t_ obs obs);43 void deepCopy(t_satObs obs); 45 44 void dumpEpoch(const QByteArray& format, long maxTime); 46 45 void setReconnectFlag(bool flag){_reconnectFlag = flag;} … … 49 48 const QString& intStr, 50 49 QDateTime* nextEpoch = 0); 51 static std::string asciiSatLine(const t_ obs& obs);50 static std::string asciiSatLine(const t_satObs& obs); 52 51 53 52 private: 54 std::string rinexSatLine(const t_ obs& obs, char lli1, char lli2, char lli5);53 std::string rinexSatLine(const t_satObs& obs, char lli1, char lli2, char lli5); 55 54 static std::string obsToStr(double val, int width = 14, int precision = 3); 56 55 void resolveFileName(const QDateTime& datTim); … … 60 59 t_irc downloadSkeleton(); 61 60 62 QByteArray _statID;63 QByteArray _fName;64 QList<t_ obs>_obs;65 std::ofstream _out;66 bool _headerWritten;67 QDateTime _nextCloseEpoch;68 QString _rnxScriptName;69 QUrl _mountPoint;70 QString _pgmName;71 QString _userName;72 QString _sklName;73 QByteArray _latitude;74 QByteArray _longitude;75 QByteArray _nmea;76 QByteArray _ntripVersion;77 bool _reconnectFlag;78 QDate _skeletonDate;79 int _samplingRate;80 QStringList _addComments;61 QByteArray _statID; 62 QByteArray _fName; 63 QList<t_satObs> _obs; 64 std::ofstream _out; 65 bool _headerWritten; 66 QDateTime _nextCloseEpoch; 67 QString _rnxScriptName; 68 QUrl _mountPoint; 69 QString _pgmName; 70 QString _userName; 71 QString _sklName; 72 QByteArray _latitude; 73 QByteArray _longitude; 74 QByteArray _nmea; 75 QByteArray _ntripVersion; 76 bool _reconnectFlag; 77 QDate _skeletonDate; 78 int _samplingRate; 79 QStringList _addComments; 81 80 82 81 QMap<QString, int> _slip_cnt_L1; -
trunk/BNC/src/bnctableitem.cpp
r5738 r6137 41 41 #include "bnctableitem.h" 42 42 #include "bncgetthread.h" 43 #include "GPSDecoder.h"44 43 45 44 // Constructor -
trunk/BNC/src/latencychecker.cpp
r5070 r6137 306 306 // Perform latency checks (observations) 307 307 ////////////////////////////////////////////////////////////////////////////// 308 void latencyChecker::checkObsLatency(const QList<t_ obs>& obsList) {308 void latencyChecker::checkObsLatency(const QList<t_satObs>& obsList) { 309 309 310 310 if (_perfIntr > 0 ) { 311 311 312 QListIterator<t_ obs> it(obsList);312 QListIterator<t_satObs> it(obsList); 313 313 while (it.hasNext()) { 314 const t_ obs& obs = it.next();314 const t_satObs& obs = it.next(); 315 315 316 _newSecGPS = static_cast<int>(obs. GPSWeeks);316 _newSecGPS = static_cast<int>(obs._time.gpssec()); 317 317 if (_newSecGPS != _oldSecGPS) { 318 318 if (_newSecGPS % _perfIntr < _oldSecGPS % _perfIntr) { … … 363 363 // Compute the observations latency 364 364 // -------------------------------- 365 int week;366 double sec;365 int week; 366 double sec; 367 367 currentGPSWeeks(week, sec); 368 368 const double secPerWeek = 7.0 * 24.0 * 3600.0; 369 if (week < obs.GPSWeek) {369 if (week < int(obs._time.gpsw())) { 370 370 week += 1; 371 371 sec -= secPerWeek; 372 372 } 373 if (week > obs.GPSWeek) {373 if (week > int(obs._time.gpsw())) { 374 374 week -= 1; 375 375 sec += secPerWeek; 376 376 } 377 _curLat = sec - obs. GPSWeeks;377 _curLat = sec - obs._time.gpssec(); 378 378 _sumLat += _curLat; 379 379 _sumLatQ += _curLat * _curLat; -
trunk/BNC/src/latencychecker.h
r5738 r6137 27 27 28 28 #include <QDateTime> 29 30 #include "GPSDecoder.h" 29 #include "satObs.h" 31 30 32 31 class latencyChecker : public QObject { … … 38 37 void checkReconnect(); 39 38 void checkOutage(bool decoded); 40 void checkObsLatency(const QList<t_ obs>& obsList);39 void checkObsLatency(const QList<t_satObs>& obsList); 41 40 void checkCorrLatency(int corrGPSEpochTime); 42 41 double currentLatency() const {return _curLat;} -
trunk/BNC/src/pppRun.cpp
r6046 r6137 90 90 } 91 91 92 connect(BNC_CORE->caster(), SIGNAL(newObs(QByteArray, QList<t_ obs>)),93 this, SLOT(slotNewObs(QByteArray, QList<t_ obs>)),conType);92 connect(BNC_CORE->caster(), SIGNAL(newObs(QByteArray, QList<t_satObs>)), 93 this, SLOT(slotNewObs(QByteArray, QList<t_satObs>)),conType); 94 94 95 95 connect(BNC_CORE, SIGNAL(newEphGPS(gpsephemeris)), … … 186 186 // 187 187 //////////////////////////////////////////////////////////////////////////// 188 void t_pppRun::slotNewObs(QByteArray staID, QList<t_ obs> obsList) {188 void t_pppRun::slotNewObs(QByteArray staID, QList<t_satObs> obsList) { 189 189 QMutexLocker locker(&_mutex); 190 190 … … 195 195 // Loop over all obsevations (possible different epochs) 196 196 // ----------------------------------------------------- 197 QListIterator<t_ obs> it(obsList);197 QListIterator<t_satObs> it(obsList); 198 198 while (it.hasNext()) { 199 const t_obs& oldObs = it.next(); 200 t_satObs* newObs = new t_satObs; 201 202 newObs->_prn.set(oldObs.satSys, oldObs.satNum); 203 newObs->_time.set(oldObs.GPSWeek, oldObs.GPSWeeks); 199 const t_satObs& oldObs = it.next(); 200 t_satObs* newObs = new t_satObs(oldObs); 204 201 205 202 // Find the corresponding data epoch or create a new one … … 221 218 } 222 219 223 // Fill the new observation and add it to the correspondingepoch224 // ----------------------- ---------------------------------------220 // Put data into the epoch 221 // ----------------------- 225 222 if (epoch != 0) { 226 223 epoch->_satObs.push_back(newObs); 227 map<string, t_frqObs*> frqObsMap; 228 for (unsigned iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) { 229 string hlp = oldObs.rnxStr(iEntry).toAscii().data(); 230 if (hlp.length() >= 2 && oldObs._measdata[iEntry] != 0.0) { 231 char obsType = hlp[0]; 232 string rnxType2ch = hlp.substr(1); 233 if (obsType == 'C' || obsType == 'L') { 234 t_frqObs* frqObs = 0; 235 if (frqObsMap.find(rnxType2ch) == frqObsMap.end()) { 236 frqObs = new t_frqObs(); 237 frqObsMap[rnxType2ch] = frqObs; 238 frqObs->_rnxType2ch = rnxType2ch; 239 newObs->_obs.push_back(frqObs); 240 } 241 else { 242 frqObs = frqObsMap[rnxType2ch]; 243 } 244 if (obsType == 'C') { 245 frqObs->_code = oldObs._measdata[iEntry]; 246 frqObs->_codeValid = true; 247 } 248 else if (obsType == 'L') { 249 frqObs->_phase = oldObs._measdata[iEntry]; 250 frqObs->_phaseValid = true; 251 } 252 } 253 } 254 } 224 } 225 else { 226 delete newObs; 255 227 } 256 228 } … … 477 449 // Create list of observations and start epoch processing 478 450 // ------------------------------------------------------ 479 QList<t_ obs> obsList;451 QList<t_satObs> obsList; 480 452 for (unsigned iObs = 0; iObs < epo->rnxSat.size(); iObs++) { 481 453 const t_rnxObsFile::t_rnxSat& rnxSat = epo->rnxSat[iObs]; 482 454 483 t_ obs obs;455 t_satObs obs; 484 456 t_rnxObsFile::setObsFromRnx(_rnxObsFile, epo, rnxSat, obs); 485 457 obsList << obs; -
trunk/BNC/src/pppRun.h
r6046 r6137 6 6 #include <QtCore> 7 7 8 #include "GPSDecoder.h"9 8 #include "pppOptions.h" 10 9 #include "pppClient.h" … … 39 38 void slotNewEphGalileo(galileoephemeris galeph); 40 39 void slotNewCorrections(QStringList corrList); 41 void slotNewObs(QByteArray staID, QList<t_ obs> obsList);40 void slotNewObs(QByteArray staID, QList<t_satObs> obsList); 42 41 void slotSetSpeed(int speed); 43 42 void slotSetStopFlag(); -
trunk/BNC/src/pppThread.h
r6046 r6137 6 6 #include <QtCore> 7 7 8 #include "GPSDecoder.h"9 8 #include "pppOptions.h" 10 9 #include "pppClient.h" -
trunk/BNC/src/rinex/reqcanalyze.cpp
r6122 r6137 237 237 for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) { 238 238 const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs]; 239 t_ obs obs;239 t_satObs obs; 240 240 t_rnxObsFile::setObsFromRnx(obsFile, _currEpo, rnxSat, obs); 241 241 242 QString prn = QString("%1%2").arg(obs.satSys) 243 .arg(obs.satNum, 2, 10, QChar('0')); 242 QString prn(obs._prn.toString().c_str()); 244 243 245 t_ephGlo* ephGlo = 0; 246 if (obs.satSys == 'R') { 244 t_ephGlo* ephGlo = 0; 245 int slotNum = 0; 246 if (obs._prn.system() == 'R') { 247 247 for (int ie = 0; ie < _ephs.size(); ie++) { 248 248 if (QString(_ephs[ie]->prn().toString().c_str()) == prn) { … … 252 252 } 253 253 if (ephGlo) { 254 obs.slotNum = ephGlo->slotNum();254 slotNum = ephGlo->slotNum(); 255 255 } 256 256 } 257 257 258 t_irc irc = _allObsMap[prn].addObs(obs );258 t_irc irc = _allObsMap[prn].addObs(obs, slotNum); 259 259 260 260 if (irc == success) { … … 339 339 // 340 340 //////////////////////////////////////////////////////////////////////////// 341 t_irc t_reqcAnalyze::t_allObs::addObs(const t_ obs& obs) {342 343 t_oneObs* newObs = new t_oneObs(obs. GPSWeek, obs.GPSWeeks);341 t_irc t_reqcAnalyze::t_allObs::addObs(const t_satObs& obs, int slotNum) { 342 343 t_oneObs* newObs = new t_oneObs(obs._time.gpsw(), obs._time.gpssec()); 344 344 bool okFlag = false; 345 345 346 346 // Availability and Slip Flags 347 347 // --------------------------- 348 double L1 = obs.measdata("L1", 3.0); 349 if (L1 != 0) { 350 newObs->_hasL1 = true; 351 } 352 double L2 = obs.satSys == 'E' ? obs.measdata("L5", 3.0) : obs.measdata("L2", 3.0);; 353 if (L2 != 0) { 354 newObs->_hasL2 = true; 355 } 356 if (obs.slipL1) { 357 newObs->_slipL1 = true; 358 } 359 if (obs.slipL2) { 360 newObs->_slipL2 = true; 348 double L1 = 0.0; 349 double L2 = 0.0; 350 double P1 = 0.0; 351 double P2 = 0.0; 352 353 for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) { 354 const t_frqObs* frqObs = obs._obs[iFrq]; 355 if (frqObs->_rnxType2ch[0] == '1') { 356 if (frqObs->_phaseValid) { 357 L1 = frqObs->_phase; 358 newObs->_hasL1 = true; 359 newObs->_slipL1 = frqObs->_slip; 360 } 361 if (frqObs->_codeValid) { 362 P1 = frqObs->_code; 363 } 364 if (frqObs->_snrValid) { 365 newObs->_SNR1 = frqObs->_snr; 366 } 367 } 368 else if ( (obs._prn.system() != 'E' && frqObs->_rnxType2ch[0] == '2') || 369 (obs._prn.system() == 'E' && frqObs->_rnxType2ch[0] == '5') ) { 370 if (frqObs->_phaseValid) { 371 L2 = frqObs->_phase; 372 newObs->_hasL2 = true; 373 newObs->_slipL2 = frqObs->_slip; 374 } 375 if (frqObs->_codeValid) { 376 P2 = frqObs->_code; 377 } 378 if (frqObs->_snrValid) { 379 newObs->_SNR2 = frqObs->_snr; 380 } 381 } 361 382 } 362 383 … … 366 387 double f1 = 0.0; 367 388 double f2 = 0.0; 368 if (obs. satSys== 'G') {389 if (obs._prn.system() == 'G') { 369 390 f1 = t_CST::freq(t_frequency::G1, 0); 370 391 f2 = t_CST::freq(t_frequency::G2, 0); 371 392 } 372 else if (obs. satSys== 'R') {373 f1 = t_CST::freq(t_frequency::R1, obs.slotNum);374 f2 = t_CST::freq(t_frequency::R2, obs.slotNum);375 } 376 else if (obs. satSys== 'E') {393 else if (obs._prn.system() == 'R') { 394 f1 = t_CST::freq(t_frequency::R1, slotNum); 395 f2 = t_CST::freq(t_frequency::R2, slotNum); 396 } 397 else if (obs._prn.system() == 'E') { 377 398 f1 = t_CST::freq(t_frequency::E1, 0); 378 399 f2 = t_CST::freq(t_frequency::E5, 0); … … 382 403 L2 = L2 * t_CST::c / f2; 383 404 384 double P1 = obs.measdata("C1", 3.0);385 405 if (P1 != 0.0) { 386 406 newObs->_MP1 = P1 - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2); 387 407 okFlag = true; 388 408 } 389 double P2 = obs.satSys == 'E' ? obs.measdata("C5", 3.0) : obs.measdata("C2", 3.0);390 409 if (P2 != 0.0) { 391 410 newObs->_MP2 = P2 - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2); 392 okFlag = true;393 }394 }395 396 // Signal-to-Noise397 // ---------------398 double S1 = obs.measdata("S1", 3.0);399 if (S1 != 0.0) {400 newObs->_SNR1 = floor(S1/6);401 if (newObs->_SNR1 > 9.0) {402 newObs->_SNR1 = 9.0;403 }404 if (newObs->_SNR1 < 1.0) {405 newObs->_SNR1 = 1.0;406 }407 okFlag = true;408 }409 else {410 if (obs.snrL1 > 0) {411 newObs->_SNR1 = obs.snrL1;412 okFlag = true;413 }414 }415 double S2 = obs.satSys == 'E' ? obs.measdata("S5", 3.0) : obs.measdata("S2", 3.0);416 if (S2 != 0.0) {417 newObs->_SNR2 = floor(S2/6);418 if (newObs->_SNR2 > 9.0) {419 newObs->_SNR2 = 9.0;420 }421 if (newObs->_SNR2 < 1.0) {422 newObs->_SNR2 = 1.0;423 }424 okFlag = true;425 }426 else {427 if (obs.snrL2 > 0) {428 newObs->_SNR2 = obs.snrL2;429 411 okFlag = true; 430 412 } -
trunk/BNC/src/rinex/reqcanalyze.h
r5883 r6137 29 29 #include "rnxobsfile.h" 30 30 #include "rnxnavfile.h" 31 #include "GPSDecoder.h"32 31 #include "ephemeris.h" 32 #include "satObs.h" 33 33 34 34 class t_polarPoint; … … 150 150 } 151 151 } 152 t_irc addObs(const t_ obs& obs);152 t_irc addObs(const t_satObs& obs, int slotNum); 153 153 QVector<t_oneObs*> _oneObsVec; 154 154 }; -
trunk/BNC/src/rinex/rnxobsfile.cpp
r6130 r6137 1038 1038 // Set Observations from RINEX File 1039 1039 //////////////////////////////////////////////////////////////////////////// 1040 void t_rnxObsFile::setObsFromRnx(const t_rnxObsFile* rnxObsFile, 1041 const t_rnxObsFile::t_rnxEpo* epo, 1042 const t_rnxObsFile::t_rnxSat& rnxSat, 1043 t_obs& obs) { 1044 1045 strncpy(obs.StatID, rnxObsFile->markerName().toAscii().constData(), sizeof(obs.StatID)); 1046 1047 obs.satSys = rnxSat.prn.system(); 1048 obs.satNum = rnxSat.prn.number(); 1049 obs.GPSWeek = epo->tt.gpsw(); 1050 obs.GPSWeeks = epo->tt.gpssec(); 1051 1052 for (int iType = 0; iType < rnxObsFile->nTypes(obs.satSys); iType++) { 1053 QString type = rnxObsFile->obsType(obs.satSys, iType); 1040 void t_rnxObsFile::setObsFromRnx(const t_rnxObsFile* rnxObsFile, const t_rnxObsFile::t_rnxEpo* epo, 1041 const t_rnxObsFile::t_rnxSat& rnxSat, t_satObs& obs) { 1042 1043 obs._staID = rnxObsFile->markerName().toAscii().constData(); 1044 obs._prn = rnxSat.prn; 1045 obs._time = epo->tt; 1046 1047 char sys = rnxSat.prn.system(); 1048 1049 for (int iType = 0; iType < rnxObsFile->nTypes(sys); iType++) { 1050 QString type = rnxObsFile->obsType(sys, iType); 1054 1051 if (rnxSat.obs.contains(type)) { 1055 1052 const t_rnxObs& rnxObs = rnxSat.obs[type]; 1056 obs.setMeasdata(type, rnxObsFile->version(), rnxObs.value); 1057 if (type.indexOf("L1") == 0) { 1058 obs.snrL1 = rnxObs.snr; 1059 obs.slipL1 = (rnxObs.lli & 1); 1060 } 1061 else if (type.indexOf("L2") == 0) { 1062 obs.snrL2 = rnxObs.snr; 1063 obs.slipL2 = (rnxObs.lli & 1); 1064 } 1065 else if (type.indexOf("L5") == 0) { 1066 obs.snrL5 = rnxObs.snr; 1067 obs.slipL5 = (rnxObs.lli & 1); 1068 } 1069 } 1070 } 1071 } 1072 1053 string type2ch(type.mid(1).toAscii().data()); 1054 1055 1056 t_frqObs* frqObs = 0; 1057 for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) { 1058 if (obs._obs[iFrq]->_rnxType2ch == type2ch) { 1059 frqObs = obs._obs[iFrq]; 1060 break; 1061 } 1062 } 1063 if (frqObs == 0) { 1064 frqObs = new t_frqObs; 1065 frqObs->_rnxType2ch = type2ch; 1066 obs._obs.push_back(frqObs); 1067 } 1068 1069 switch( type.toAscii().data()[0] ) { 1070 case 'C': 1071 frqObs->_codeValid = true; 1072 frqObs->_code = rnxObs.value; 1073 break; 1074 case 'L': 1075 frqObs->_phaseValid = true; 1076 frqObs->_phase = rnxObs.value; 1077 frqObs->_slip = (rnxObs.lli & 1); 1078 break; 1079 case 'D': 1080 frqObs->_dopplerValid = true; 1081 frqObs->_doppler = rnxObs.value; 1082 break; 1083 case 'S': 1084 frqObs->_snrValid = true; 1085 frqObs->_snr = rnxObs.value; 1086 break; 1087 } 1088 } 1089 } 1090 } 1091 -
trunk/BNC/src/rinex/rnxobsfile.h
r6130 r6137 36 36 #include "bnctime.h" 37 37 #include "t_prn.h" 38 #include " GPSDecoder.h"38 #include "satObs.h" 39 39 40 40 class t_rnxObsHeader { … … 163 163 const t_rnxObsFile::t_rnxEpo* epo, 164 164 const t_rnxObsFile::t_rnxSat& rnxSat, 165 t_ obs& obs);165 t_satObs& obs); 166 166 167 167 static QString type2to3(char sys, const QString& typeV2); -
trunk/BNC/src/satObs.h
r6135 r6137 42 42 public: 43 43 t_satObs() {} 44 t_satObs(const t_satObs& old) { // copy constructor (deep copy) 45 _staID = old._staID; 46 _prn = old._prn; 47 _time = old._time; 48 for (unsigned ii = 0; ii < old._obs.size(); ii++) { 49 _obs.push_back(new t_frqObs(*old._obs[ii])); 50 } 51 } 44 52 ~t_satObs() {for (unsigned ii = 0; ii < _obs.size(); ii++) delete _obs[ii];} 53 std::string _staID; 45 54 t_prn _prn; 46 55 bncTime _time; -
trunk/BNC/src/src.pro
r6013 r6137 2 2 TARGET = ../bnc 3 3 4 CONFIG -= debug5 CONFIG += release4 CONFIG -= release 5 CONFIG += debug 6 6 7 7 include(src.pri)
Note:
See TracChangeset
for help on using the changeset viewer.