Changeset 13553 for trunk/FACT++


Ignore:
Timestamp:
05/03/12 22:51:11 (13 years ago)
Author:
tbretz
Message:
Fixed a unit problem in the new rasistor correction; added some output which helps in case of problems; correctly display the calibration offset when the calibration is started.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/feedback.cc

    r13482 r13553  
    204204
    205205            // Convert from DAC counts to uA
    206             const double conv = 5000e-6/4096;
     206            const double conv = 5000./4096;
    207207
    208208            // 3900 Ohm/n + 1000 Ohm + 1100 Ohm  (with n=4 or n=5)
     
    237237
    238238                // Average measured current
    239                 const double Im = double(fCurrentsAvg[i])/fCursorCur * conv; // [A]
     239                const double Im = double(fCurrentsAvg[i])/fCursorCur * conv; // [uA]
    240240
    241241                // Group index (0 or 1) of the of the pixel (4 or 5 pixel patch)
     
    258258                // Offset at the calibration point (make sure that the calibration is
    259259                // valid (Im[i]>Iavg[i]) and we operate above the calibration point)
    260                 const double I = Im>Iavg[i] ? Im - Iavg[i]*1e-6 : 0; // [A]
     260                const double I = Im>Iavg[i] ? Im - Iavg[i] : 0; // [uA]
    261261
    262262                // Make sure that the averaged resistor is valid
    263                 const double dU = Ravg[i]>0 ? r*(I+dI) : 0;
     263                const double dU = Ravg[i]>0 ? r*(I*1e-6+dI) : 0;
    264264
    265265                vec[i+BIAS::kNumChannels] += dU;
     
    872872    }
    873873
     874    void WarnState(bool needfsc, bool needfad)
     875    {
     876        const bool bias = fStatusBias.second >= BIAS::kConnecting;
     877        const bool fsc  = fStatusFSC.second  >= 2;
     878        const bool fad  = fStatusFAD.second  >= FAD::kConnected;
     879
     880        if (!bias)
     881            Warn("Bias control not yet ready.");
     882        if (needfsc && !fsc)
     883            Warn("FSC control not yet ready.");
     884        if (needfad && !fad)
     885            Warn("FAD control not yet ready.");
     886    }
     887
    874888    int SetConstant(const EventImp &evt, int constant)
    875889    {
     
    934948            return kSM_FatalError;
    935949
     950        WarnState(false, true);
     951
    936952        ResetData(evt.GetShort());
    937953
     
    946962            return kSM_FatalError;
    947963
     964        WarnState(false, true);
     965
    948966        ResetData(evt.GetShort());
    949967
     
    957975        if (!CheckEventSize(evt.GetSize(), "StartTempCtrl", 4))
    958976            return kSM_FatalError;
     977
     978        WarnState(true, false);
    959979
    960980        fBiasOffset = evt.GetFloat();
     
    9811001            return GetCurrentState();
    9821002        }
     1003
     1004        WarnState(true, false);
    9831005
    9841006        ResetData(0);
     
    10671089        }
    10681090
     1091        WarnState(true, false);
     1092
    10691093        ostringstream out;
    1070         out << "Starting temperature feedback for calibration with an offset of -2V";
     1094        out << "Starting temperature feedback for calibration with an offset of " << fCalibrationOffset << "V";
    10711095        Message(out);
    10721096
Note: See TracChangeset for help on using the changeset viewer.