FACT++  1.0
template<class T , class S >
StateMachineBias< T, S >::StateMachineBias ( ostream &  out = cout)
inline

Definition at line 1981 of file biasctrl.cc.

References StateMachineBias< T, S >::Disconnect(), StateMachineBias< T, S >::ExpertLoadMapFile(), ConnectionBias::ExpertReset(), StateMachineBias< T, S >::ExpertSetChannelDac(), StateMachineBias< T, S >::ExpertSetChannelVolt(), StateMachineBias< T, S >::ExpertSetGlobalDac(), StateMachineBias< T, S >::ExpertSetGlobalVolt(), State::kConnected, State::kConnecting, State::kDisconnected, BIAS::State::kExpertMode, BIAS::State::kInitializing, BIAS::State::kLocked, BIAS::State::kNotReferenced, BIAS::State::kOverCurrent, BIAS::State::kRamping, Agilent::State::kVoltageOff, Agilent::State::kVoltageOn, ConnectionBias::OverCurrentReset(), ConnectionBias::PrintA(), ConnectionBias::PrintInfo(), ConnectionBias::PrintReferenceVoltage(), ConnectionBias::PrintV(), ConnectionBias::RampAllDacs(), ConnectionBias::RampStart(), ConnectionBias::RampStop(), ConnectionBias::ReadAllChannels(), StateMachineBias< T, S >::Reconnect(), StateMachineBias< T, S >::SetAllChannelsDac(), StateMachineBias< T, S >::SetAllChannelsVolt(), StateMachineBias< T, S >::SetChannelDac(), StateMachineBias< T, S >::SetChannelVolt(), StateMachineBias< T, S >::SetDummyMode(), StateMachineBias< T, S >::SetExpertMode(), StateMachineBias< T, S >::SetGlobalDac(), StateMachineBias< T, S >::SetGlobalVolt(), StateMachineBias< T, S >::SetUpdateInterval(), StateMachineBias< T, S >::SetVerbosity(), StateMachineBias< T, S >::Shutdown(), and StateMachineBias< T, S >::Unlock().

1981  :
1982  StateMachineAsio<T>(out, "BIAS_CONTROL"), fBias(*this, *this),
1983  fExpertMode(false), fSunRise(Time().GetNextSunRise(-6))
1984  {
1985  // State names
1986  T::AddStateName(State::kDisconnected, "Disconnected",
1987  "Bias-power supply not connected via USB.");
1988 
1989  T::AddStateName(State::kConnecting, "Connecting",
1990  "Trying to establish USB connection to bias-power supply.");
1991 
1992  T::AddStateName(State::kInitializing, "Initializing",
1993  "USB connection to bias-power supply established, synchronizing USB stream.");
1994 
1995  T::AddStateName(State::kConnected, "Connected",
1996  "USB connection to bias-power supply established.");
1997 
1998  T::AddStateName(State::kNotReferenced, "NotReferenced",
1999  "Internal reference voltage does not match last sent voltage.");
2000 
2001  T::AddStateName(State::kVoltageOff, "VoltageOff",
2002  "All voltages are supposed to be switched off.");
2003 
2004  T::AddStateName(State::kVoltageOn, "VoltageOn",
2005  "At least one voltage is switched on and all are at reference.");
2006 
2007  T::AddStateName(State::kOverCurrent, "OverCurrent",
2008  "At least one channel is in over current state.");
2009 
2010  T::AddStateName(State::kExpertMode, "ExpertMode",
2011  "Special (risky!) mode to directly send command to the bias-power supply.");
2012 
2013  T::AddStateName(State::kRamping, "Ramping",
2014  "Voltage ramping in progress.");
2015 
2016  T::AddStateName(State::kLocked, "Locked",
2017  "Locked due to emergency shutdown, no commands accepted except UNLOCK.");
2018 
2019  // Verbosity commands
2020  T::AddEvent("SET_VERBOSE", "B:1")
2021  (bind(&StateMachineBias::SetVerbosity, this, placeholders::_1))
2022  ("set verbosity state"
2023  "|verbosity[bool]:disable or enable verbosity for received data (yes/no), except dynamic data");
2024 
2025  T::AddEvent("ENABLE_DUMMY_MODE", "B:1")
2026  (bind(&StateMachineBias::SetDummyMode, this, placeholders::_1))
2027  ("Enable dummy mode. In this mode SetAllChannels prints informations instead of sending anything to the bias crate."
2028  "|enable[bool]:disable or enable dummy mode");
2029 
2030  // Conenction commands
2031  T::AddEvent("DISCONNECT", State::kConnected, State::kVoltageOff)
2032  (bind(&StateMachineBias::Disconnect, this))
2033  ("disconnect from USB");
2034  T::AddEvent("RECONNECT", "O", State::kDisconnected, State::kConnected, State::kVoltageOff)
2035  (bind(&StateMachineBias::Reconnect, this, placeholders::_1))
2036  ("(Re)connect USB connection to Bias power supply, a new address can be given"
2037  "|tty[string]:new USB address");
2038 
2039 
2040  T::AddEvent("SET_UPDATE_INTERVAL", "I:1")
2041  (bind(&StateMachineBias::SetUpdateInterval, this, placeholders::_1))
2042  ("Set the updat einterval how often the currents are requested"
2043  "|interval[ms]:Update interval in milliseconds");
2044 
2045 
2046 
2048  (Wrapper(bind(&ConnectionBias::ReadAllChannels, &fBias, false)))
2049  ("Asynchronously request the status (current) of all channels.");
2050 
2051  T::AddEvent("RESET_OVER_CURRENT_STATUS", State::kOverCurrent)
2053  ("Set all channels in over current state to 0V and send a system reset to reset the over current flags.");
2054 
2055 
2057  (bind(&StateMachineBias::SetChannelDac, this, placeholders::_1))
2058  ("Set a new target value in DAC counts for a single channel. Starts ramping if necessary."
2059  "|channel[short]:Channel for which to set the target voltage [0-415]"
2060  "|voltage[dac]:Target voltage in DAC units for the given channel");
2062  (bind(&StateMachineBias::SetGlobalDac, this, placeholders::_1))
2063  ("Set a new target value for all channels in DAC counts. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"
2064  "|voltage[dac]:Global target voltage in DAC counts.");
2066  (bind(&StateMachineBias::SetAllChannelsDac, this, placeholders::_1))
2067  ("Set a new target value for all channels in DAC counts. Starts ramping if necessary."
2068  "|voltage[dac]:Global target voltage in DAC counts for all channels");
2069 
2070 
2072  (bind(&StateMachineBias::SetChannelVolt, this, placeholders::_1))
2073  ("Set a new target voltage for a single channel. Starts ramping if necessary."
2074  "|channel[short]:Channel for which to set the target voltage [0-415]"
2075  "|voltage[V]:Target voltage in volts for the given channel (will be converted to DAC units)");
2077  (bind(&StateMachineBias::SetGlobalVolt, this, placeholders::_1))
2078  ("Set a new target voltage for all channels. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"
2079  "|voltage[V]:Global target voltage in volts (will be converted to DAC units)");
2081  (bind(&StateMachineBias::SetAllChannelsVolt, this, placeholders::_1))
2082  ("Set all channels to the given new reference voltage. Starts ramping if necessary."
2083  "|voltage[V]:New reference voltage for all channels");
2084 
2085 /*
2086  T::AddEvent("INCREASE_CHANNEL_VOLTAGE", "S:1;F:1", State::kConnected, State::kVoltageOff, State::kVoltageOn, State::kNotReferenced, State::kOverCurrent)
2087  (bind(&StateMachineBias::IncChannelVolt, this, placeholders::_1))
2088  ("Increases the voltage of all channels by the given offset. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"
2089  "|channel[short]:Channel for which to adapt the voltage [0-415]"
2090  "|offset[V]:Offset to be added to all channels (will be converted to DAC counts)");
2091  T::AddEvent("INCREASE_GLOBAL_VOLTAGE", "F:1", State::kConnected, State::kVoltageOff, State::kVoltageOn, State::kNotReferenced, State::kOverCurrent)
2092  (bind(&StateMachineBias::IncGlobalVolt, this, placeholders::_1))
2093  ("Increases the voltage of all channels by the given offset. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"
2094  "|offset[V]:Offset to be added to all channels (will be converted to DAC counts)");
2095  T::AddEvent("INCREASE_ALL_CHANNELS_VOLTAGE", "F:416", State::kConnected, State::kVoltageOff, State::kVoltageOn, State::kNotReferenced, State::kOverCurrent)
2096  (bind(&StateMachineBias::IncAllChannelsVolt, this, placeholders::_1))
2097  ("Add the given voltages to the current reference voltages. Starts ramping if necessary."
2098  "offset[V]:Offsets to be added to the reference voltage of all channels in volts");
2099 */
2100 
2101 
2102 
2105  ("Set all channels to a zero reference voltage. Starts ramping if necessary.");
2107  (bind(&StateMachineBias::Shutdown, this, "user request"))
2108  ("Same as SET_ZERO_VOLTAGE; but goes to locked state afterwards.");
2109 
2110  T::AddEvent("UNLOCK", State::kLocked)
2111  (bind(&StateMachineBias::Unlock, this))
2112  ("Unlock if in locked state.");
2113 
2114 
2115 
2116 
2117 
2118  T::AddEvent("STOP", State::kConnected, State::kRamping)
2120  ("Stop an on-going ramping");
2121 
2122  T::AddEvent("START", State::kConnected, State::kNotReferenced)
2124  ("Start a ramping if no ramping is in progress and if reference values differ from current voltages");
2125 
2126 
2127 
2128  T::AddEvent("PRINT_INFO")
2130  ("Print a table with all current read back with the last request operation");
2131  T::AddEvent("PRINT_CURRENTS")
2133  ("Print a table with all current read back with the last request operation");
2134  T::AddEvent("PRINT_VOLTAGES")
2136  ("Print a table with all voltages (current and reference voltages as currently in memory)");
2137  T::AddEvent("PRINT_GAPD_REFERENCE_VOLTAGES")
2139  ("Print the G-APD reference values (breakdown voltage + overvoltage) obtained from file");
2140 
2141 
2142  T::AddEvent("EXPERT_MODE", "B:1")
2143  (bind(&StateMachineBias::SetExpertMode, this, placeholders::_1))
2144  ("Enable usage of expert commands (note that for safty reasons the are exclusive with the standard commands)");
2145 
2146  T::AddEvent("EXPERT_RESET", State::kExpertMode)
2147  (Wrapper(bind(&ConnectionBias::ExpertReset, &fBias, true)))
2148  ("Send the RESET command (note that this is possibly harmfull command)");
2149 
2150  T::AddEvent("EXPERT_SET_GLOBAL_VOLTAGE", "F:1", State::kExpertMode)
2151  (bind(&StateMachineBias::ExpertSetGlobalVolt, this, placeholders::_1))
2152  ("Send the global set command. The given voltage is converted to DAC counts.");
2153 
2154  T::AddEvent("EXPERT_SET_GLOBAL_DAC", "S:1", State::kExpertMode)
2155  (bind(&StateMachineBias::ExpertSetGlobalDac, this, placeholders::_1))
2156  ("Send the global set command.");
2157 
2158  T::AddEvent("EXPERT_SET_CHANNEL_VOLTAGE", "S:1;F:1", State::kExpertMode)
2159  (bind(&StateMachineBias::ExpertSetChannelVolt, this, placeholders::_1))
2160  ("Send a single channel set command. The given voltage is converted to DAC commands.");
2161 
2162  T::AddEvent("EXPERT_SET_CHANNEL_DAC", "S:1;S:1", State::kExpertMode)
2163  (bind(&StateMachineBias::ExpertSetChannelDac, this, placeholders::_1))
2164  ("Send a single channel set command.");
2165 
2166  T::AddEvent("EXPERT_LOAD_MAP_FILE", "C", State::kExpertMode)
2167  (bind(&StateMachineBias::ExpertLoadMapFile, this, placeholders::_1))
2168  ("Load a new mapping file.");
2169  }
void RampStop()
Definition: biasctrl.cc:1188
int ExpertSetGlobalVolt(const EventImp &evt)
Definition: biasctrl.cc:1768
void PrintReferenceVoltage()
Definition: biasctrl.cc:1428
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
void PrintInfo()
Definition: biasctrl.cc:1326
int ExpertSetChannelDac(const EventImp &evt)
Definition: biasctrl.cc:1798
int SetExpertMode(const EventImp &evt)
Definition: biasctrl.cc:1912
bool RampAllDacs(uint16_t dac)
Definition: biasctrl.cc:970
void RampStart()
Definition: biasctrl.cc:1196
int SetChannelVolt(const EventImp &evt)
Definition: biasctrl.cc:1697
int ExpertLoadMapFile(const EventImp &evt)
Definition: biasctrl.cc:1808
int SetDummyMode(const EventImp &evt)
Definition: biasctrl.cc:1902
int SetAllChannelsVolt(const EventImp &evt)
Definition: biasctrl.cc:1719
int SetChannelDac(const EventImp &evt)
Definition: biasctrl.cc:1684
void OverCurrentReset()
Definition: biasctrl.cc:1099
int SetGlobalDac(const EventImp &evt)
Definition: biasctrl.cc:1660
int ExpertSetChannelVolt(const EventImp &evt)
Definition: biasctrl.cc:1788
int SetGlobalVolt(const EventImp &evt)
Definition: biasctrl.cc:1708
function< int(const EventImp &)> Wrapper(function< void()> func)
Definition: biasctrl.cc:1634
int Shutdown(const string &reason)
Definition: biasctrl.cc:1925
void ExpertReset(bool expert_mode=true)
Definition: biasctrl.cc:1226
int SetAllChannelsDac(const EventImp &evt)
Definition: biasctrl.cc:1671
int ExpertSetGlobalDac(const EventImp &evt)
Definition: biasctrl.cc:1778
int Reconnect(const EventImp &evt)
Definition: biasctrl.cc:1873
int SetUpdateInterval(const EventImp &evt)
Definition: biasctrl.cc:1849
int SetVerbosity(const EventImp &evt)
Definition: biasctrl.cc:1892
void ReadAllChannels(bool special=false)
Definition: biasctrl.cc:1124

+ Here is the call graph for this function: