Changeset 18606 for trunk/FACT++
- Timestamp:
- 09/17/16 19:33:02 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/ratecontrol.cc
r18599 r18606 15 15 16 16 #include "HeadersFTM.h" 17 #include "HeadersLid.h" 17 18 #include "HeadersDrive.h" 18 19 #include "HeadersRateScan.h" … … 56 57 DimDescribedState fDimFTM; 57 58 DimDescribedState fDimRS; 59 DimDescribedState fDimLid; 58 60 DimDescribedState fDimDrive; 59 61 … … 433 435 // Record only currents when the drive is tracking to avoid 434 436 // bias from the movement 435 if (fDimDrive.state()<Drive::State::kTracking )437 if (fDimDrive.state()<Drive::State::kTracking || fDimLid.state()==Lid::State::kClosed) 436 438 return GetCurrentState(); 437 439 … … 553 555 int Calibrate() 554 556 { 555 if (!fPhysTriggerEnabled)556 {557 Info("Physics trigger not enabled... CALIBRATE command ignored.");558 559 fTriggerOn = false;560 fPhysTriggerEnabled = false;561 return RateControl::State::kGlobalThresholdSet;562 }563 564 557 const int32_t val[2] = { -1, fThresholdReference }; 565 558 Dim::SendCommandNB("FTM_CONTROL/SET_THRESHOLD", val); … … 584 577 int CalibrateByCurrent() 585 578 { 586 if (!fPhysTriggerEnabled)587 {588 Info("Physics trigger not enabled... CALIBRATE command ignored.");589 590 fTriggerOn = false;591 fPhysTriggerEnabled = false;592 return RateControl::State::kGlobalThresholdSet;593 }594 595 if (fDimDrive.state()<Drive::State::kMoving)596 Warn("Drive not even moving...");597 598 579 fCounter = 0; 599 580 fCalibrateByCurrent = true; … … 629 610 const config &conf = it->second; 630 611 612 if (conf.fCalibrationType!=0) 613 { 614 615 if (!fPhysTriggerEnabled) 616 { 617 Info("Calibration requested, but physics trigger not enabled... CALIBRATE command ignored."); 618 619 fTriggerOn = false; 620 fPhysTriggerEnabled = false; 621 return RateControl::State::kGlobalThresholdSet; 622 } 623 624 if (fDimLid.state()==Lid::State::kClosed) 625 { 626 Info("Calibration requested, but lid closed... setting all thresholds to "+to_string(conf.fMinThreshold)+"."); 627 628 const int32_t val[2] = { -1, conf.fMinThreshold }; 629 Dim::SendCommandNB("FTM_CONTROL/SET_THRESHOLD", val); 630 631 fThresholds.assign(160, conf.fMinThreshold); 632 633 const double mjd = Time().Mjd(); 634 635 const RateControl::DimThreshold data = { conf.fMinThreshold, mjd, mjd }; 636 fDimThreshold.setQuality(3); 637 fDimThreshold.Update(data); 638 639 fCalibrateByCurrent = true; 640 fTriggerOn = false; 641 fPhysTriggerEnabled = false; 642 return RateControl::State::kSettingGlobalThreshold; 643 } 644 645 if (fDimDrive.state()<Drive::State::kMoving) 646 Warn("Calibration requested, but drive not even moving..."); 647 } 648 631 649 switch (conf.fCalibrationType) 632 650 { … … 687 705 Out() << fDimFTM << endl; 688 706 Out() << fDimRS << endl; 707 Out() << fDimLid << endl; 689 708 Out() << fDimDrive << endl; 690 709 … … 745 764 fDimFTM("FTM_CONTROL"), 746 765 fDimRS("RATE_SCAN"), 766 fDimLid("LID_CONTROL"), 747 767 fDimDrive("DRIVE_CONTROL"), 748 768 fDimThreshold("RATE_CONTROL/THRESHOLD", "S:1;D:1;D:1", … … 762 782 fDimFTM.Subscribe(*this); 763 783 fDimRS.Subscribe(*this); 784 fDimLid.Subscribe(*this); 764 785 fDimDrive.Subscribe(*this); 765 786
Note:
See TracChangeset
for help on using the changeset viewer.