Changeset 1566 in ntrip for trunk/BNC/latencychecker.cpp
- Timestamp:
- Feb 4, 2009, 9:19:20 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/latencychecker.cpp
r1564 r1566 338 338 // Perform latency checks (corrections) 339 339 ////////////////////////////////////////////////////////////////////////////// 340 void latencyChecker::checkCorrLatency( QList<int>* epochList) {341 342 if ( epochList ==0) {340 void latencyChecker::checkCorrLatency(int corrGPSEpochTime) { 341 342 if (corrGPSEpochTime < 0) { 343 343 return; 344 344 } … … 347 347 if (_perfIntr > 0) { 348 348 349 QListIterator<int> it(*epochList); 350 while (it.hasNext()) { 351 _newSecGPS = it.next(); 352 353 int week; 354 double sec; 355 currentGPSWeeks(week, sec); 356 double dt = fabs(sec - _newSecGPS); 357 const double secPerWeek = 7.0 * 24.0 * 3600.0; 358 if (dt > 0.5 * secPerWeek) { 359 if (sec > _newSecGPS) { 360 sec -= secPerWeek; 361 } else { 362 sec += secPerWeek; 363 } 364 } 365 if (_newSecGPS != _oldSecGPS) { 366 if (int(_newSecGPS) % _perfIntr < int(_oldSecGPS) % _perfIntr) { 367 if (_numLat>0) { 368 QString late; 369 if (_meanDiff>0.) { 370 late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs, %6 gaps") 371 .arg(int(_sumLat/_numLat*100)/100.) 372 .arg(int(_minLat*100)/100.) 373 .arg(int(_maxLat*100)/100.) 374 .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.) 375 .arg(_numLat) 376 .arg(_numGaps); 377 emit(newMessage(QString(_staID + late ).toAscii(), true) ); 378 } 379 else { 380 late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs") 381 .arg(int(_sumLat/_numLat*100)/100.) 382 .arg(int(_minLat*100)/100.) 383 .arg(int(_maxLat*100)/100.) 384 .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.) 385 .arg(_numLat); 386 emit(newMessage(QString(_staID + late ).toAscii(), true) ); 387 } 349 _newSecGPS = corrGPSEpochTime; 350 351 int week; 352 double sec; 353 currentGPSWeeks(week, sec); 354 double dt = fabs(sec - _newSecGPS); 355 const double secPerWeek = 7.0 * 24.0 * 3600.0; 356 if (dt > 0.5 * secPerWeek) { 357 if (sec > _newSecGPS) { 358 sec -= secPerWeek; 359 } else { 360 sec += secPerWeek; 361 } 362 } 363 if (_newSecGPS != _oldSecGPS) { 364 if (int(_newSecGPS) % _perfIntr < int(_oldSecGPS) % _perfIntr) { 365 if (_numLat>0) { 366 QString late; 367 if (_meanDiff>0.) { 368 late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs, %6 gaps") 369 .arg(int(_sumLat/_numLat*100)/100.) 370 .arg(int(_minLat*100)/100.) 371 .arg(int(_maxLat*100)/100.) 372 .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.) 373 .arg(_numLat) 374 .arg(_numGaps); 375 emit(newMessage(QString(_staID + late ).toAscii(), true) ); 376 } 377 else { 378 late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs") 379 .arg(int(_sumLat/_numLat*100)/100.) 380 .arg(int(_minLat*100)/100.) 381 .arg(int(_maxLat*100)/100.) 382 .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.) 383 .arg(_numLat); 384 emit(newMessage(QString(_staID + late ).toAscii(), true) ); 388 385 } 389 _meanDiff = int(_diffSecGPS)/_numLat;390 _diffSecGPS = 0;391 _numGaps= 0;392 _sumLat = 0.0;393 _sumLatQ= 0.0;394 _numLat =0;395 _minLat = 1000.;396 _maxLat = -1000.;397 }398 if (_followSec) {399 _diffSecGPS += _newSecGPS - _oldSecGPS;400 if (_meanDiff>0.) {401 if (_newSecGPS - _oldSecGPS > 1.5 * _meanDiff) {402 _numGaps += 1;403 }386 } 387 _meanDiff = int(_diffSecGPS)/_numLat; 388 _diffSecGPS = 0; 389 _numGaps = 0; 390 _sumLat = 0.0; 391 _sumLatQ = 0.0; 392 _numLat = 0; 393 _minLat = 1000.; 394 _maxLat = -1000.; 395 } 396 if (_followSec) { 397 _diffSecGPS += _newSecGPS - _oldSecGPS; 398 if (_meanDiff>0.) { 399 if (_newSecGPS - _oldSecGPS > 1.5 * _meanDiff) { 400 _numGaps += 1; 404 401 } 405 402 } 406 _curLat = sec - _newSecGPS; 407 _sumLat += _curLat; 408 _sumLatQ += _curLat * _curLat; 409 if (_curLat < _minLat) { 410 _minLat = _curLat; 411 } 412 if (_curLat >= _maxLat) { 413 _maxLat = _curLat; 414 } 415 _numLat += 1; 416 _oldSecGPS = _newSecGPS; 417 _followSec = true; 418 } 419 } 420 } 421 } 422 423 epochList->clear(); 403 } 404 _curLat = sec - _newSecGPS; 405 _sumLat += _curLat; 406 _sumLatQ += _curLat * _curLat; 407 if (_curLat < _minLat) { 408 _minLat = _curLat; 409 } 410 if (_curLat >= _maxLat) { 411 _maxLat = _curLat; 412 } 413 _numLat += 1; 414 _oldSecGPS = _newSecGPS; 415 _followSec = true; 416 } 417 } 418 } 424 419 } 425 420
Note:
See TracChangeset
for help on using the changeset viewer.