Changeset 18798


Ignore:
Timestamp:
04/01/17 22:00:42 (8 years ago)
Author:
tbretz
Message:
Issue the ramping in emergency case only if any channel is not at 0.
File:
1 edited

Legend:

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

    r18463 r18798  
    14941494    }
    14951495
     1496    bool HasOvercurrent() const
     1497    {
     1498        for (int ch=0; ch<kNumChannels; ch++)
     1499            if (fPresent[ch/kNumChannelsPerBoard] && fCurrent[ch]<0)
     1500                return true;
     1501
     1502        return false;
     1503    }
     1504
     1505    bool IsVoltageOff() const
     1506    {
     1507        for (int ch=0; ch<kNumChannels; ch++)
     1508            if (fPresent[ch/kNumChannelsPerBoard] && fDacActual[ch]!=0)
     1509                return false;
     1510
     1511        return true;
     1512    }
     1513
    14961514    State::states_t GetStatus()
    14971515    {
     
    15081526            return State::kRamping;
    15091527
    1510         for (int ch=0; ch<kNumChannels; ch++)
    1511             if (fPresent[ch/kNumChannelsPerBoard] && fCurrent[ch]<0)
    1512                 return State::kOverCurrent;
    1513 
    1514         bool isoff = true;
    1515         for (int ch=0; ch<kNumChannels; ch++)
    1516             if (fPresent[ch/kNumChannelsPerBoard] && fDacActual[ch]!=0)
    1517                 isoff = false;
    1518         if (isoff)
     1528        if (HasOvercurrent())
     1529            return State::kOverCurrent;
     1530
     1531        if (IsVoltageOff())
    15191532            return State::kVoltageOff;
    15201533
     
    19431956        {
    19441957            // This needs to be repeated for the case that in between a different command was processed
    1945             fBias.RampAllDacs(0);
     1958            if (!fBias.IsVoltageOff())
     1959                fBias.RampAllDacs(0);
     1960
    19461961            return State::kLocked;
    19471962        }
Note: See TracChangeset for help on using the changeset viewer.