FACT++  1.0
template<class T , class S >
int StateMachineBias< T, S >::Execute ( )
inlineprivatevirtual

Implements StateMachineAsio< T >.

Definition at line 1938 of file biasctrl.cc.

References Time::GetNextSunRise(), State::kConnected, BIAS::State::kExpertMode, BIAS::State::kLocked, BIAS::State::kNotReferenced, BIAS::State::kOverCurrent, BIAS::State::kRamping, and Agilent::State::kVoltageOn.

1939  {
1940  const int state = fBias.GetStatus();
1941 
1942  if (fBias.IsEmergencyShutdown()/* && state>State::kInitializing && state<State::kExpertMode*/)
1943  {
1944  // This needs to be repeated for the case that in between a different command was processed
1945  fBias.RampAllDacs(0);
1946  return State::kLocked;
1947  }
1948 
1949  const Time now;
1950  if (now>fSunRise)
1951  {
1952  const bool shutdown =
1953  state==State::kRamping ||
1954  state==State::kVoltageOn ||
1955  state==State::kNotReferenced ||
1956  state==State::kOverCurrent;
1957 
1958  if (shutdown)
1959  Shutdown("beginning of civil twilight");
1960 
1961  fSunRise = now.GetNextSunRise(-6);
1962 
1963  ostringstream msg;
1964  msg << "During next sun-rise nautical twilight will end at " << fSunRise;
1965  T::Info(msg);
1966 
1967  if (shutdown)
1968  return State::kLocked;
1969  }
1970 
1971  if (T::GetCurrentState()==State::kLocked)
1972  return T::GetCurrentState();
1973 
1974  if (fExpertMode && state>=State::kConnected)
1975  return State::kExpertMode;
1976 
1977  return state;
1978  }
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
Time GetNextSunRise(double horizon) const
Definition: Time.cc:346
int Shutdown(const string &reason)
Definition: biasctrl.cc:1925

+ Here is the call graph for this function: