- Timestamp:
- Feb 20, 2010, 9:17:00 AM (15 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bnccaster.cpp
r2312 r2316 121 121 _epochs = new QMultiMap<long, p_obs>; 122 122 123 _lastDumpSec Xrate= 0;123 _lastDumpSec = 0; 124 124 125 125 _confInterval = -1; … … 159 159 obs->_status = t_obs::received; 160 160 161 long iSec Xrate = long(floor(obs->_o.GPSWeeks * _maxRate +0.5));162 long newTime Xrate = obs->_o.GPSWeek * 7*24*3600 * _maxRate + iSecXrate;161 long iSec = long(floor(obs->_o.GPSWeeks+0.5)); 162 long newTime = obs->_o.GPSWeek * 7*24*3600 + iSec; 163 163 164 164 // Rename the Station … … 199 199 // First time, set the _lastDumpSec immediately 200 200 // -------------------------------------------- 201 if (_lastDumpSec Xrate== 0) {202 _lastDumpSec Xrate = newTimeXrate - 1;201 if (_lastDumpSec == 0) { 202 _lastDumpSec = newTime - 1; 203 203 } 204 204 205 205 // An old observation - throw it away 206 206 // ---------------------------------- 207 if (newTime Xrate <= _lastDumpSecXrate) {207 if (newTime <= _lastDumpSec) { 208 208 if (firstObs) { 209 209 bncSettings settings; … … 211 211 !settings.value("outPort").toString().isEmpty() ) { 212 212 213 QTime enomtime = QTime(0,0,0).add MSecs(iSecXrate/_maxRate/1000);213 QTime enomtime = QTime(0,0,0).addSecs(iSec); 214 214 215 215 emit( newMessage(QString("%1: Old epoch %2 (%3) thrown away") 216 .arg(staID.data()).arg(iSec Xrate/_maxRate)216 .arg(staID.data()).arg(iSec) 217 217 .arg(enomtime.toString("HH:mm:ss")) 218 218 .toAscii(), true) ); … … 225 225 // Save the observation 226 226 // -------------------- 227 _epochs->insert(newTime Xrate, obs);227 _epochs->insert(newTime, obs); 228 228 229 229 // Dump Epochs 230 230 // ----------- 231 if (newTime Xrate - _waitTimeXrate > _lastDumpSecXrate) {232 dumpEpochs(_lastDumpSec Xrate + 1, newTimeXrate - _waitTimeXrate);233 _lastDumpSec Xrate = newTimeXrate - _waitTimeXrate;231 if (newTime - _waitTime > _lastDumpSec) { 232 dumpEpochs(_lastDumpSec + 1, newTime - _waitTime); 233 _lastDumpSec = newTime - _waitTime; 234 234 } 235 235 } … … 303 303 // Dump Complete Epochs 304 304 //////////////////////////////////////////////////////////////////////////// 305 void bncCaster::dumpEpochs(long minTime Xrate, long maxTimeXrate) {305 void bncCaster::dumpEpochs(long minTime, long maxTime) { 306 306 307 307 const char begEpoch[] = "BEGEPOCH"; … … 311 311 const int endEpochNBytes = sizeof(endEpoch) - 1; 312 312 313 for (long sec Xrate = minTimeXrate; secXrate <= maxTimeXrate; ++secXrate) {313 for (long sec = minTime; sec <= maxTime; sec++) { 314 314 315 315 bool first = true; 316 QList<p_obs> allObs = _epochs->values(sec Xrate);316 QList<p_obs> allObs = _epochs->values(sec); 317 317 318 318 QListIterator<p_obs> it(allObs); … … 320 320 p_obs obs = it.next(); 321 321 322 if (_samplingRate == 0 || (secXrate/_maxRate)% _samplingRate == 0) {322 if (_samplingRate == 0 || sec % _samplingRate == 0) { 323 323 324 324 if (first) { … … 401 401 402 402 delete obs; 403 _epochs->remove(sec Xrate);403 _epochs->remove(sec); 404 404 first = false; 405 405 } … … 415 415 // Reread several options 416 416 // ---------------------- 417 _maxRate = 20; 418 419 _samplingRate = settings.value("binSampl").toInt(); 420 _waitTimeXrate = settings.value("waitTime").toInt() * _maxRate; 421 if (_waitTimeXrate < 1) { 422 _waitTimeXrate = 1; 417 _samplingRate = settings.value("binSampl").toInt(); 418 _waitTime = settings.value("waitTime").toInt(); 419 if (_waitTime < 1) { 420 _waitTime = 1; 423 421 } 424 422 -
trunk/BNC/bnccaster.h
r2312 r2316 60 60 61 61 private: 62 void dumpEpochs(long minTime Xrate, long maxTimeXrate);62 void dumpEpochs(long minTime, long maxTime); 63 63 static int myWrite(QTcpSocket* sock, const char* buf, int bufLen); 64 64 … … 67 67 QTextStream* _out; 68 68 QMultiMap<long, p_obs>* _epochs; 69 long _lastDumpSec Xrate;69 long _lastDumpSec; 70 70 QTcpServer* _server; 71 71 QTcpServer* _uServer; … … 77 77 QList<bncGetThread*> _threads; 78 78 int _samplingRate; 79 long _waitTime Xrate;79 long _waitTime; 80 80 QMutex _mutex; 81 81 int _confInterval; 82 int _maxRate;83 82 }; 84 83
Note:
See TracChangeset
for help on using the changeset viewer.