- Timestamp:
- 03/15/12 09:27:28 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/feedback.cc
r13091 r13116 103 103 vector<vector<float>> fData; 104 104 105 uint64_t fCursorCur;105 int64_t fCursorCur; 106 106 uint64_t fCursorAmpl; 107 107 … … 172 172 if (fCursorCur==0) 173 173 { 174 DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0); 174 if (fStatusBias.second==BIAS::kVoltageOn) 175 DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0); 175 176 return; 176 177 } … … 181 182 { 182 183 // 3900 Ohm/n + 1000 Ohm + 1150 Ohm 183 const double R = fMap.hv(i).group()==0 ? 3125 : 2930; 184 const double I = double(fCurrentsAvg[i])/fCursorCur - fCalibration[i]; 184 const double R = fMap.hv(i).group()==0 ? 3125 : 2930; 185 const double Im = double(fCurrentsAvg[i])/fCursorCur; 186 const double I = Im>fCalibration[i] ? Im-fCalibration[i] : 0; 185 187 vec[i+416] += R * I*conv; 186 188 if (fCalibration[i]>0) … … 215 217 return -1; 216 218 217 if (fStatusBias.second ==BIAS::kRamping)219 if (fStatusBias.second!=BIAS::kVoltageOn) 218 220 return false; 221 222 if (fCursorCur++<0) 223 return true; 219 224 220 225 const int16_t *ptr = static_cast<int16_t*>(fBiasA.getData()); … … 226 231 } 227 232 228 fCursorCur++;229 230 233 return true; 231 234 } … … 240 243 if (fCursorCur<100) 241 244 { 242 if (fStatusBias.second !=BIAS::kRamping)245 if (fStatusBias.second==BIAS::kVoltageOn) 243 246 DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0); 244 247 return; … … 260 263 fControlType = kIdle; 261 264 262 DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0); 265 if (fStatusBias.second==BIAS::kVoltageOn) 266 DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0); 263 267 } 264 268 … … 805 809 Message(out); 806 810 807 DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0); 811 if (fStatusBias.second==BIAS::kVoltageOn) 812 DimClient::sendCommandNB("BIAS_CONTROL/REQUEST_STATUS", NULL, 0); 808 813 809 814 return GetCurrentState(); … … 817 822 if (fCalibration.size()==0) 818 823 { 819 ostringstream out; 820 out << "Current control needs a bias crate calibration first... command ignored."; 821 Error(out); 824 Warn("Current control needs a bias crate calibration first... command ignored."); 822 825 return GetCurrentState(); 823 826 } … … 896 899 // return kSM_FatalError; 897 900 901 if (fStatusBias.second==BIAS::kRamping) 902 { 903 Warn("Calibration cannot be started when biasctrl is in state Ramping."); 904 return GetCurrentState(); 905 } 906 898 907 ostringstream out; 899 out << "Starting temperature feedback with an offset of -2V";908 out << "Starting temperature feedback for calibration with an offset of -2V"; 900 909 Message(out); 901 910 902 911 fBiasOffset = -2; 903 912 fControlType = kTemp; 904 fCursorCur = 0;913 fCursorCur = -10; 905 914 fCurrentsAvg.assign(416, 0); 906 915 fCurrentsRms.assign(416, 0);
Note:
See TracChangeset
for help on using the changeset viewer.