Changeset 12108


Ignore:
Timestamp:
09/15/11 22:53:50 (13 years ago)
Author:
tbretz
Message:
Added states for the status of the voltage.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/HeadersBIAS.h

    r11939 r12108  
    3838        kRamping,
    3939        kOverCurrent,
    40         kAtReference,
     40        kVoltageOff,
     41        kNotReferenced,
     42        kVoltageOn,
    4143        kExpertMode // 'forward' declaration to be used in StateMachineBias
    4244    };
  • trunk/FACT++/src/biasctrl.cc

    r12090 r12108  
    13611361
    13621362        for (int ch=0; ch<kNumChannels; ch++)
     1363            if (fPresent[ch/kNumChannelsPerBoard] && fVolt[ch]==0)
     1364                return BIAS::kVoltageOff;
     1365
     1366        for (int ch=0; ch<kNumChannels; ch++)
    13631367            if (fPresent[ch/kNumChannelsPerBoard] && fVolt[ch]!=fVoltRef[ch])
    1364                 return BIAS::kConnected;
    1365 
    1366         return BIAS::kAtReference;
     1368                return BIAS::kNotReferenced;
     1369
     1370        return BIAS::kVoltageOn;
    13671371    }
    13681372};
     
    17241728                        "USB connection to bias-power supply established.");
    17251729
    1726         T::AddStateName(kAtReference, "Referenced",
    1727                         "Internal reference voltage matches last sent voltage.");
     1730        T::AddStateName(kNotReferenced, "NotReferenced",
     1731                        "Internal reference voltage does not match last sent voltage.");
     1732
     1733        T::AddStateName(kVoltageOff, "VoltageOff",
     1734                        "All voltages are supposed to be switched off.");
     1735
     1736        T::AddStateName(kVoltageOn, "VoltageOn",
     1737                        "At least one voltage is switched on and all are at reference.");
    17281738
    17291739        T::AddStateName(kOverCurrent, "OverCurrent",
     
    17431753
    17441754        // Conenction commands
    1745         T::AddEvent("DISCONNECT", kConnected, kAtReference)
     1755        T::AddEvent("DISCONNECT", kConnected, kVoltageOff)
    17461756            (bind(&StateMachineBias::Disconnect, this))
    17471757            ("disconnect from USB");
    17481758
    1749         T::AddEvent("RECONNECT", "O", kDisconnected, kConnected, kAtReference)
     1759        T::AddEvent("RECONNECT", "O", kDisconnected, kConnected, kVoltageOff)
    17501760            (bind(&StateMachineBias::Reconnect, this, placeholders::_1))
    17511761            ("(Re)connect USB connection to Bias power supply, a new address can be given"
     
    17541764
    17551765
    1756         T::AddEvent("REQUEST_STATUS", kConnected, kAtReference, kOverCurrent)
     1766        T::AddEvent("REQUEST_STATUS", kConnected, kVoltageOn, kVoltageOff, kNotReferenced, kOverCurrent)
    17571767            (Wrapper(bind(&ConnectionBias::ReadAllChannels, &fBias, false)))
    17581768            ("Asynchronously request the status (current) of all channels.");
     
    17641774
    17651775
    1766         T::AddEvent("SET_GLOBAL_VOLTAGE", "F:1", kConnected, kAtReference, kOverCurrent)
     1776        T::AddEvent("SET_GLOBAL_VOLTAGE", "F:1", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    17671777            (bind(&StateMachineBias::SetGlobalVolt, this, placeholders::_1))
    17681778            ("Set all channels to a new reference voltage. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"
    17691779             "|voltage[V]:Global target voltage in volts (will be converted to DAC units)");
    17701780
    1771         T::AddEvent("SET_GLOBAL_DAC", "S:1", kConnected, kAtReference, kOverCurrent)
     1781        T::AddEvent("SET_GLOBAL_DAC", "S:1", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    17721782            (bind(&StateMachineBias::SetGlobalDac, this, placeholders::_1))
    17731783            ("Set all channels to a new DAC reference. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"
    17741784             "|voltage[dac]:Global target voltage as DAC counts.");
    17751785
    1776         T::AddEvent("INCREASE_GLOBAL_VOLTAGE", "F:1", kConnected, kAtReference, kOverCurrent)
     1786        T::AddEvent("INCREASE_GLOBAL_VOLTAGE", "F:1", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    17771787            (bind(&StateMachineBias::IncGlobalVolt, this, placeholders::_1))
    17781788            ("Set all channels to a new reference voltage. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"
    17791789             "|offset[V]:Offset to be added to all channels (will be converted to DAC counts)");
    17801790
    1781         T::AddEvent("INCREASE_GLOBAL_DAC", "S:1", kConnected, kAtReference, kOverCurrent)
     1791        T::AddEvent("INCREASE_GLOBAL_DAC", "S:1", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    17821792            (bind(&StateMachineBias::IncGlobalDac, this, placeholders::_1))
    17831793            ("Set all channels to a new DAC reference. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"
    17841794             "|offset[dac]:Offset to be added to all channels as DAC counts");
    17851795
    1786         T::AddEvent("DECREASE_GLOBAL_VOLTAGE", "F:1", kConnected, kAtReference, kOverCurrent)
     1796        T::AddEvent("DECREASE_GLOBAL_VOLTAGE", "F:1", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    17871797            (bind(&StateMachineBias::DecGlobalVolt, this, placeholders::_1))
    17881798            ("Set all channels to a new reference voltage. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"
    17891799             "|offset[V]:Offset to be subtracted from all channels (will be converted to DAC counts)");
    17901800
    1791         T::AddEvent("DECREASE_GLOBAL_DAC", "S:1", kConnected, kAtReference, kOverCurrent)
     1801        T::AddEvent("DECREASE_GLOBAL_DAC", "S:1", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    17921802            (bind(&StateMachineBias::DecGlobalDac, this, placeholders::_1))
    17931803            ("Set all channels to a new DAC reference. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"
    17941804             "|offset[dac]:Offset to be subtracted from all channels as DAC counts");
    17951805
    1796         T::AddEvent("SET_CHANNEL_VOLTAGE", "S:1;F:1", kConnected, kAtReference, kOverCurrent)
     1806        T::AddEvent("SET_CHANNEL_VOLTAGE", "S:1;F:1", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    17971807            (bind(&StateMachineBias::SetChannelVolt, this, placeholders::_1))
    17981808            ("Set a single channel to a new reference voltage. Starts ramping if necessary."
     
    18001810             "|voltage[V]:Target voltage in volts for the given channel (will be converted to DAC units)");
    18011811
    1802         T::AddEvent("SET_CHANNEL_DAC", "S:1;S:1", kConnected, kAtReference, kOverCurrent)
     1812        T::AddEvent("SET_CHANNEL_DAC", "S:1;S:1", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    18031813            (bind(&StateMachineBias::SetChannelDac, this, placeholders::_1))
    18041814            ("Set a single channel to a new DAC reference value. Starts ramping if necessary."
     
    18061816             "|voltage[dac]:Target voltage in DAC units for the given channel");
    18071817
    1808         T::AddEvent("SET_GLOBAL_GAPD_REFERENCE_VOLTAGE", kConnected, kAtReference, kOverCurrent)
     1818        T::AddEvent("SET_GLOBAL_GAPD_REFERENCE_VOLTAGE", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    18091819            (Wrapper(bind(&ConnectionBias::SetGapdVoltage, &fBias, 0.)))
    18101820            ("Set all channels to their G-APD reference voltage. Starts ramping if necessary.");
    18111821
    1812         T::AddEvent("SET_CHANNEL_GAPD_REFERENCE_VOLTAGE", "S:1", kConnected, kAtReference, kOverCurrent)
     1822        T::AddEvent("SET_CHANNEL_GAPD_REFERENCE_VOLTAGE", "S:1", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    18131823            (bind(&StateMachineBias::SetGapdReferenceCh, this, placeholders::_1))
    18141824            ("Set a single channel channels to its G-APD reference voltage. Starts ramping if necessary."
    18151825             "|channel[short]:Channel for which to set the target voltage [0-416]");
    18161826
    1817         T::AddEvent("SET_GAPD_REFERENCE_OFFSET", "F:1", kConnected, kAtReference, kOverCurrent)
     1827        T::AddEvent("SET_GAPD_REFERENCE_OFFSET", "F:1", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    18181828            (bind(&StateMachineBias::SetGapdVoltage, this, placeholders::_1))
    18191829            ("Set all channels to their G-APD reference voltage plus the given offset. Starts ramping if necessary."
    18201830             "|offset[V]:Offset to be added to teh G-APD reference voltage globally");
    18211831
    1822         T::AddEvent("SET_ZERO_VOLTAGE", kConnected, kAtReference, kOverCurrent)
     1832        T::AddEvent("SET_ZERO_VOLTAGE", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    18231833            (Wrapper(bind(&ConnectionBias::SetZero, &fBias)))
    18241834            ("Set all channels to a zero reference voltage. Starts ramping if necessary.");
    18251835
    1826         T::AddEvent("SET_REFERENCE_VOLTAGES", "F:416", kConnected, kAtReference, kOverCurrent)
     1836        T::AddEvent("SET_REFERENCE_VOLTAGES", "F:416", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    18271837            (bind(&StateMachineBias::SetReferenceVolt, this, placeholders::_1))
    18281838            ("Set all channels to the given new reference voltage. Starts ramping if necessary."
    18291839             "voltage[V]:New reference voltage for all channels");
    18301840
    1831         T::AddEvent("SET_REFERENCE_DACS", "S:416", kConnected, kAtReference, kOverCurrent)
     1841        T::AddEvent("SET_REFERENCE_DACS", "S:416", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    18321842            (bind(&StateMachineBias::SetReferenceDac, this, placeholders::_1))
    18331843            ("Set all channels to the given new reference voltage. Starts ramping if necessary."
    18341844             "voltage[dac]:New reference voltage for all channels in DAC units");
    18351845
    1836         T::AddEvent("ADD_REFERENCE_VOLTAGES", "F:416", kConnected, kAtReference, kOverCurrent)
     1846        T::AddEvent("ADD_REFERENCE_VOLTAGES", "F:416", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    18371847            (bind(&StateMachineBias::AddReferenceVolt, this, placeholders::_1))
    18381848            ("Add the given voltages to the current reference voltages. Starts ramping if necessary."
    18391849             "offset[V]:Offsets to be added to the reference voltage of all channels in volts");
    18401850
    1841         T::AddEvent("ADD_REFERENCE_DACS", "S:416", kConnected, kAtReference, kOverCurrent)
     1851        T::AddEvent("ADD_REFERENCE_DACS", "S:416", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
    18421852            (bind(&StateMachineBias::AddReferenceDac, this, placeholders::_1))
    18431853            ("Add the given voltages to the current reference voltages. Starts ramping if necessary."
     
    18471857
    18481858
    1849         T::AddEvent("STOP", kConnected, kRamping, kAtReference, kOverCurrent)
     1859        T::AddEvent("STOP", kConnected, kRamping)
    18501860            (Wrapper(bind(&ConnectionBias::RampStop, &fBias)))
    18511861            ("Stop an on-going ramping");
    18521862
    1853         T::AddEvent("START", kConnected, kOverCurrent)
     1863        T::AddEvent("START", kConnected, kNotReferenced)
    18541864            (Wrapper(bind(&ConnectionBias::RampStart, &fBias)))
    18551865            ("Start a ramping if no ramping is in progress and if reference values differ from current voltages");
Note: See TracChangeset for help on using the changeset viewer.