Changeset 18149
- Timestamp:
- 02/18/15 12:26:02 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/biasctrl.cc
r18126 r18149 274 274 fPresent[board] = true; 275 275 276 if ( fEmergencyLimit>0 && fCurrent[id]>fEmergencyLimit &&!fEmergencyShutdown)276 if (!fEmergencyShutdown) 277 277 { 278 Info("Emergency shutdown initiated."); 279 RampAllDacs(0); 280 fEmergencyShutdown = true; 278 if (fCurrent[id]<0) 279 { 280 Warn("OverCurrent detected."); 281 fEmergencyShutdown = true; 282 } 283 284 if (fEmergencyLimit>0 && fCurrent[id]>fEmergencyLimit && !fEmergencyShutdown) 285 { 286 Warn("Emergency limit exceeded."); 287 fEmergencyShutdown = true; 288 } 289 290 if (fEmergencyShutdown) 291 { 292 Error("Emergency ramp down initiated."); 293 Dim::SendCommandNB("MCP/STOP"); 294 RampAllDacs(0); 295 } 281 296 } 282 297 } … … 433 448 if (oc) 434 449 { 435 Warn("OverCurrent detected - ramping stopped."); 436 fIsRamping = false; 450 if (!fEmergencyShutdown) 451 { 452 Warn("OverCurrent detected - emergency ramp down initiated."); 453 Dim::SendCommandNB("MCP/STOP"); 454 RampAllDacs(0); 455 fEmergencyShutdown = true; 456 } 437 457 } 438 458 else … … 1890 1910 } 1891 1911 1892 int Shutdown( )1912 int Shutdown(const string &reason) 1893 1913 { 1894 1914 fBias.RampAllDacs(0); 1895 T::Info("Emergency shutdown initiated .");1915 T::Info("Emergency shutdown initiated ["+reason+"]."); 1896 1916 return State::kLocked; 1897 1917 } … … 1899 1919 int Unlock() 1900 1920 { 1921 fBias.ResetEmergencyShutdown(); 1901 1922 return fBias.GetStatus(); 1902 1923 } … … 1906 1927 const int state = fBias.GetStatus(); 1907 1928 1908 if (fBias.IsEmergencyShutdown() && state>State::kInitializing && state<State::kExpertMode) 1909 { 1929 if (fBias.IsEmergencyShutdown()/* && state>State::kInitializing && state<State::kExpertMode*/) 1930 { 1931 // This needs to be repeated for the case that in between a different command was processed 1910 1932 fBias.RampAllDacs(0); 1911 fBias.ResetEmergencyShutdown();1912 1933 return State::kLocked; 1913 1934 } … … 1923 1944 1924 1945 if (shutdown) 1925 { 1926 T::Error("Voltage on at end of nautical twilight!"); 1927 Shutdown(); 1928 } 1946 Shutdown("beginning of civil twilight"); 1929 1947 1930 1948 fSunRise = now.GetNextSunRise(-6); … … 2070 2088 ("Set all channels to a zero reference voltage. Starts ramping if necessary."); 2071 2089 T::AddEvent("SHUTDOWN")(State::kConnected)(State::kVoltageOff)(State::kVoltageOn)(State::kNotReferenced)(State::kOverCurrent)(State::kRamping) 2072 (bind(&StateMachineBias::Shutdown, this ))2090 (bind(&StateMachineBias::Shutdown, this, "user request")) 2073 2091 ("Same as SET_ZERO_VOLTAGE; but goes to locked state afterwards."); 2074 2092
Note:
See TracChangeset
for help on using the changeset viewer.