Changeset 15029
- Timestamp:
- 03/11/13 22:32:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/ratecontrol.cc
r15027 r15029 393 393 // Keep all median currents of the past 10 seconds 394 394 fCurrents.push_back(make_pair(time, med)); 395 while (fCurrents.size()>0) 396 if (time-fCurrents.front().first>boost::posix_time::seconds(10)) 397 fCurrents.pop_front(); 395 while (!fCurrents.empty()) 396 { 397 if (time-fCurrents.front().first<boost::posix_time::seconds(10)) 398 break; 399 400 fCurrents.pop_front(); 401 } 398 402 399 403 // If we are not doing a calibration no further action necessary … … 422 426 423 427 fThresholdMin = 36.0833*pow(avg, 0.638393)+184.037; 428 fThresholdReference = fThresholdMin; 424 429 fThresholds.assign(160, fThresholdMin); 425 430 … … 471 476 } 472 477 478 cout << "-1-" << endl; 479 473 480 if (fDimDrive.state()<Drive::State::kMoving) 474 481 Warn("Drive not even moving..."); 482 483 cout << "-2-" << endl; 475 484 476 485 fCounter = 0; … … 478 487 fCalibrationTimeStart = Time(); 479 488 489 cout << "-3-" << endl; 490 480 491 ostringstream out; 481 492 out << "Rate calibration by current " << fThresholdReference << " with a target rate of " << fTargetRate << " Hz"; 482 493 Info(out); 483 494 495 cout << "START" << endl; 496 484 497 return RateControl::State::kSettingGlobalThreshold; 485 498 } … … 514 527 int Print() const 515 528 { 529 cout << "PRINT" << endl; 516 530 Out() << fDim << endl; 517 531 Out() << fDimFTM << endl; … … 566 580 fDimRS("RATE_SCAN"), 567 581 fDimDrive("DRIVE_CONTROL"), 568 569 582 fDimThreshold("RATE_CONTROL/THRESHOLD", "S:1;D:1;D:1", 570 583 "Resulting threshold after calibration" … … 583 596 fDimFTM.Subscribe(*this); 584 597 fDimRS.Subscribe(*this); 598 fDimDrive.Subscribe(*this); 585 599 586 600 Subscribe("FTM_CONTROL/TRIGGER_RATES")
Note:
See TracChangeset
for help on using the changeset viewer.