352 const float fAbsoluteMedianCurrentLimit = 85;
353 const float fRelativePixelCurrentLimit3 = 20;
354 const float fRelativePixelCurrentLimit0 = 45;
356 const float fAbsolutePixelCurrentLimit3 = fAbsoluteMedianCurrentLimit + fRelativePixelCurrentLimit3;
357 const float fAbsolutePixelCurrentLimit0 = fAbsoluteMedianCurrentLimit + fRelativePixelCurrentLimit0;
359 const float fRelativeCurrentLimitWarning = 10;
360 const float fRelativeCurrentLimitCritical = 15;
361 const float fRelativeCurrentLimitShutdown = 25;
366 vector<float> v(I, I+320);
373 sort(v.begin(), v.end());
375 const float &imax0 = v[319];
376 const float &imax3 = v[316];
377 const float &imed = v[161];
379 const bool shutdown =
380 imed >fAbsoluteMedianCurrentLimit+fRelativeCurrentLimitShutdown ||
381 imax3>fAbsolutePixelCurrentLimit3+fRelativeCurrentLimitShutdown ||
382 imax0>fAbsolutePixelCurrentLimit0+fRelativeCurrentLimitShutdown;
384 const bool critical =
385 imed >fAbsoluteMedianCurrentLimit+fRelativeCurrentLimitCritical ||
386 imax3>fAbsolutePixelCurrentLimit3+fRelativeCurrentLimitCritical ||
387 imax0>fAbsolutePixelCurrentLimit0+fRelativeCurrentLimitCritical;
390 imed >fAbsoluteMedianCurrentLimit+fRelativeCurrentLimitWarning ||
391 imax3>fAbsolutePixelCurrentLimit3+fRelativeCurrentLimitWarning ||
392 imax0>fAbsolutePixelCurrentLimit0+fRelativeCurrentLimitWarning;
400 imed <fAbsoluteMedianCurrentLimit &&
401 imax3<fAbsolutePixelCurrentLimit3 &&
402 imax0<fAbsolutePixelCurrentLimit0)
411 if (!standby && shutdown)
419 Error(
"Current limit for shutdown exceeded.... switching to standby mode.");
425 if (!standby && critical)
444 Warn(
"Critical current limit exceeded timeout.... switching to standby mode.");
450 if (!standby && warning)
int GetCurrentState() const
return the current state of the machine
Adds some functionality to boost::posix_time::ptime for our needs.
uint16_t fTimeoutCritical
int Error(const std::string &str)
void SendCommandNB(const std::string &command)
int Warn(const std::string &str)
int Info(const std::string &str)