Changeset 16965
- Timestamp:
- 07/19/13 12:49:59 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/biasctrl.cc
r16941 r16965 85 85 vector<float> fBreakdownVoltage; // Breakdown voltage of GAPDs 86 86 vector<float> fOvervoltage; // Requested overvoltage of GAPDs 87 vector<float> fChannelCalibration; // Bias crate channel offset88 87 vector<float> fChannelOffset; // User defined channel offset 88 89 vector<float> fCalibrationOffset; // Bias crate channel offset 90 vector<float> fCalibrationSlope; // Bias crate channel slope 89 91 90 92 float fVoltageMaxAbs; // Maximum voltage … … 840 842 fBreakdownVoltage(kNumChannels, 0), 841 843 fOvervoltage(kNumChannels), 842 fChannelCalibration(kNumChannels),843 844 fChannelOffset(kNumChannels), 845 fCalibrationOffset(kNumChannels), 846 fCalibrationSlope(kNumChannels, 90./4096), 844 847 fVoltageMaxAbs(75), 845 848 fVoltageMaxRel(2), … … 942 945 uint16_t ConvertVoltToDac(uint16_t ch, double volt) 943 946 { 944 volt += fChannelCalibration[ch]; 947 volt -= fCalibrationOffset[ch]; 948 volt /= fCalibrationSlope[ch]; 945 949 if (volt<0) 946 950 volt = 0; 947 951 948 return volt*4096/90;952 return nearbyint(volt); 949 953 } 950 954 951 955 double ConvertDacToVolt(uint16_t ch, uint16_t dac) 952 956 { 953 return dac* 90./4096 - fChannelCalibration[ch];957 return dac*fCalibrationSlope[ch] + fCalibrationOffset[ch]; 954 958 } 955 959 … … 1110 1114 } 1111 1115 1112 bool SetReferences(const vector<float> &volt, const vector<float> &offset )1116 bool SetReferences(const vector<float> &volt, const vector<float> &offset, const vector<float> &slope) 1113 1117 { 1114 1118 if (volt.size()!=kNumChannels) … … 1122 1126 { 1123 1127 ostringstream out; 1124 out << "SetReferences - Given vector has " << volt.size() << " elements - expected " << kNumChannels << endl;1128 out << "SetReferences - Given vector has " << offset.size() << " elements - expected " << kNumChannels << endl; 1125 1129 Error(out); 1126 1130 return false; 1127 1131 } 1128 1129 fBreakdownVoltage = volt; 1130 fChannelCalibration = offset; 1132 if (slope.size()!=kNumChannels) 1133 { 1134 ostringstream out; 1135 out << "SetReferences - Given vector has " << slope.size() << " elements - expected " << kNumChannels << endl; 1136 Error(out); 1137 return false; 1138 } 1139 1140 fBreakdownVoltage = volt; 1141 fCalibrationOffset = offset; 1142 fCalibrationSlope = slope; 1131 1143 fOvervoltage.assign(kNumChannels, 0); 1132 1144 … … 1528 1540 volt.insert(volt.end(), fBreakdownVoltage.begin(), fBreakdownVoltage.end()); 1529 1541 volt.insert(volt.end(), fOvervoltage.begin(), fOvervoltage.end()); 1530 volt.insert(volt.end(), fChannelCalibration.begin(), fChannelCalibration.end()); 1542 volt.insert(volt.end(), fCalibrationOffset.begin(), fCalibrationOffset.end()); 1543 volt.insert(volt.end(), fCalibrationSlope.begin(), fCalibrationSlope.end()); 1531 1544 fDimGapd.Update(volt); 1532 1545 } … … 1542 1555 fDimVolt("BIAS_CONTROL/VOLTAGE", "F:416", 1543 1556 "|Uout[V]:Output voltage"), 1544 fDimGapd("BIAS_CONTROL/NOMINAL", "F:416;F:416;F:416 ",1557 fDimGapd("BIAS_CONTROL/NOMINAL", "F:416;F:416;F:416;F:416", 1545 1558 "|Ubr[V]:Nominal breakdown voltage at 25deg C" 1546 1559 "|Uov[V]:Nominal overvoltage" 1547 "|Uoff[V]:Bias crate channel offsets") 1560 "|Uoff[V]:Bias crate channel calibration offsets" 1561 "|Uslope[V/dac]:Bias crate channel calibration slope") 1548 1562 { 1549 1563 } … … 2140 2154 } 2141 2155 2142 if (!fBias.SetReferences(map.Vgapd(), map.Voffset() ))2156 if (!fBias.SetReferences(map.Vgapd(), map.Voffset(), map.Vslope())) 2143 2157 { 2144 2158 T::Error("Setting reference voltages failed.");
Note:
See TracChangeset
for help on using the changeset viewer.