Changeset 12805
- Timestamp:
- 02/01/12 09:09:38 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/feedback.cc
r12716 r12805 93 93 vector<int64_t> fCurrentsRms; 94 94 95 vector<double> fCalibration; 96 95 97 vector<vector<float>> fData; 96 98 … … 243 245 } 244 246 245 vector<float> val(2*416, 0);247 fCalibration.resize(416); 246 248 for (int i=0; i<416; i++) 247 249 { 248 val[i] = double(fCurrentsAvg[i])/fCursor;249 val[i+416] = sqrt(double(fCurrentsRms[i])/fCursor-val[i]*val[i]);250 } 251 252 fDimCalibration.Update( val);250 fCalibration[i] = double(fCurrentsAvg[i])/fCursor; 251 fCalibration[i+416] = sqrt(double(fCurrentsRms[i])/fCursor-val[i]*val[i]); 252 } 253 254 fDimCalibration.Update(fCalibration); 253 255 254 256 fOutputEnabled = false; … … 522 524 } 523 525 526 int PrintCalibration() 527 { 528 if (fCalibration.size()==0) 529 { 530 Out() << "No calibration performed so far." << endl; 531 return GetCurrentStatus(); 532 } 533 534 for (int k=0; k<13; k++) 535 for (int j=0; j<8; j++) 536 { 537 Out() << setw(2) << k << "|" << setw(2) << j*4 << "|"; 538 for (int i=0; i<4; i++) 539 Out() << Tools::Format(" %6.1f+-4.1f", fCalibration[i], fCalibration[i+416]); 540 Out() << endl; 541 } 542 } 543 544 return GetCurrentState(); 545 } 546 524 547 int SetConstant(const EventImp &evt, int constant) 525 548 { … … 644 667 fCurrentsAvg.assign(416, 0); 645 668 fCurrentsRms.assign(416, 0); 669 fCalibration.resize(0); 646 670 fStartTime = Time(); 647 671 fOutputEnabled = true; … … 673 697 fStatusFSC.second<2) 674 698 return kStateConnecting; 675 676 if (GetCurrentState()==kStateCalibrating && fCursor<100)677 return GetCurrentState();678 699 679 700 /* … … 720 741 721 742 if (fControlType==kTemp) 743 { 744 if (GetCurrentState()==kStateCalibrating && fCursor<100) 745 return GetCurrentState(); 746 722 747 return fOutputEnabled ? kStateTempCtrlRunning : kStateTempCtrlIdle; 748 } 723 749 724 750 return kStateConnected; … … 834 860 AddEvent("PRINT") 835 861 (bind(&StateMachineFeedback::Print, this)) 862 (""); 863 864 AddEvent("PRINT_CALIBRATION") 865 (bind(&StateMachineFeedback::PrintCalibration, this)) 836 866 (""); 837 867 }
Note:
See TracChangeset
for help on using the changeset viewer.