- Timestamp:
- 02/13/15 09:22:52 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/biasctrl.cc
r18116 r18124 65 65 Time fLastConnect; 66 66 67 int32_t fEmergencyLimit; 68 bool fEmergencyShutdown; 69 67 70 protected: 68 71 … … 270 273 fCurrent[id] = status ? -(ddd==0?1:ddd) : ddd; 271 274 fPresent[board] = true; 275 276 if (fEmergencyLimit>0 && fCurrent[id]>fEmergencyLimit && !fEmergencyShutdown) 277 { 278 Info("Emergency shutdown initiated."); 279 RampAllDacs(0); 280 fEmergencyShutdown = true; 281 } 272 282 } 273 283 … … 840 850 fWaitingForAnswer(-1), 841 851 fCounter(8), 852 fEmergencyLimit(0), 853 fEmergencyShutdown(false), 842 854 fCurrent(kNumChannels), 843 855 fOperationVoltage(kNumChannels, 0), … … 1498 1510 fReconnectDelay = delay; 1499 1511 } 1512 1513 void SetEmergencyLimit(int32_t limit=0) 1514 { 1515 fEmergencyLimit = limit; 1516 } 1517 1518 void ResetEmergencyShutdown() 1519 { 1520 fEmergencyShutdown = false; 1521 } 1522 1523 bool IsEmergencyShutdown() const 1524 { 1525 return fEmergencyShutdown; 1526 } 1500 1527 }; 1501 1528 … … 1879 1906 const int state = fBias.GetStatus(); 1880 1907 1908 if (fBias.IsEmergencyShutdown() && state>State::kInitializing && state<State::kExpertMode) 1909 { 1910 fBias.RampAllDacs(0); 1911 fBias.ResetEmergencyShutdown(); 1912 return State::kLocked; 1913 } 1914 1881 1915 const Time now; 1882 1916 if (now>fSunRise) … … 1900 1934 } 1901 1935 1936 if (T::GetCurrentState()==State::kLocked) 1937 return T::GetCurrentState(); 1938 1902 1939 if (fExpertMode && state>=State::kConnected) 1903 1940 return State::kExpertMode; … … 1943 1980 1944 1981 T::AddStateName(State::kLocked, "Locked", 1945 "Locked , no commands accepted except UNLOCK.");1982 "Locked due to emergency shutdown, no commands accepted except UNLOCK."); 1946 1983 1947 1984 // Verbosity commands … … 2121 2158 fBias.SetRampTime(time); 2122 2159 fBias.SetUpdateInterval(conf.Get<uint32_t>("update-interval")); 2160 fBias.SetEmergencyLimit(conf.Get<uint16_t>("emergency-limit")); 2123 2161 fBias.SetSyncDelay(conf.Get<uint16_t>("sync-delay")); 2124 2162 … … 2222 2260 ("bias-map-file", var<string>(), "File with nominal and offset voltages for each channel.") 2223 2261 ("bias-database", var<string>(), "") 2262 ("emergency-limit", var<uint16_t>(2200), "A current limit in ADC counts which, if exceeded, will initiate an emergency shutdown (0=off)") 2224 2263 ; 2225 2264
Note:
See TracChangeset
for help on using the changeset viewer.