Reduce SUS FDIR Events #806

Merged
muellerr merged 7 commits from sus-fdir-reduce-events into main 2023-10-27 14:16:47 +02:00
3 changed files with 22 additions and 4 deletions

View File

@ -52,6 +52,9 @@ will consitute of a breaking change warranting a new major release:
code. code.
- Added a 3 second delay in the EIVE system between commanding all PL components except the SUPV, - Added a 3 second delay in the EIVE system between commanding all PL components except the SUPV,
and the SUPV itself OFF when the power level becomes low or critical. and the SUPV itself OFF when the power level becomes low or critical.
- SUS FDIR should now trigger less events. The finish event is now only triggered once the
SUS has been working properly for a minute again. It will then display the number of periods
during which the SUS was not working as well as the maximum amount of invalid messages.
# [v7.1.0] 2023-10-11 # [v7.1.0] 2023-10-11

View File

@ -97,7 +97,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
// appear sometimes for the SUS device: Allow invalid message up to a certain threshold // appear sometimes for the SUS device: Allow invalid message up to a certain threshold
// before triggering FDIR reactions. // before triggering FDIR reactions.
if (reply->tempRaw == 0xfff and not waitingForRecovery) { if (reply->tempRaw == 0xfff and not waitingForRecovery) {
if (invalidMsgCounter == 0) { if (invalidMsgCounter == 0 and invalidMsgPeriodCounter == 0) {
triggerEvent(TEMPERATURE_ALL_ONES_START); triggerEvent(TEMPERATURE_ALL_ONES_START);
} else if (invalidMsgCounter == susMax1227::MAX_INVALID_MSG_COUNT) { } else if (invalidMsgCounter == susMax1227::MAX_INVALID_MSG_COUNT) {
triggerEvent(DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT); triggerEvent(DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT);
@ -110,8 +110,17 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
return returnvalue::OK; return returnvalue::OK;
} }
if (invalidMsgCounter > 0) { if (invalidMsgCounter > 0) {
triggerEvent(TEMPERATURE_ALL_ONES_RECOVERY, invalidMsgCounter); invalidMsgPeriodCounter++;
if (invalidMsgCounter > invalidMsgCounterMax) {
invalidMsgCounterMax = invalidMsgCounter;
}
invalidMsgCounter = 0; invalidMsgCounter = 0;
invalidMsgCountdown.resetTimer();
}
if (invalidMsgCountdown.hasTimedOut() and invalidMsgPeriodCounter > 0) {
triggerEvent(TEMPERATURE_ALL_ONES_RECOVERY, invalidMsgPeriodCounter, invalidMsgCounterMax);
invalidMsgPeriodCounter = 0;
invalidMsgCounterMax = 0;
} }
dataset.setValidity(true, true); dataset.setValidity(true, true);
dataset.tempC = max1227::getTemperature(reply->tempRaw); dataset.tempC = max1227::getTemperature(reply->tempRaw);

View File

@ -20,8 +20,9 @@ class SusHandler : public DeviceHandlerBase {
//! [EXPORT] : [COMMENT] Detected invalid values, starting invalid message counting //! [EXPORT] : [COMMENT] Detected invalid values, starting invalid message counting
static constexpr Event TEMPERATURE_ALL_ONES_START = static constexpr Event TEMPERATURE_ALL_ONES_START =
event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM); event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
//! [EXPORT] : [COMMENT] Detected valid values again, resetting invalid message counter. //! [EXPORT] : [COMMENT] Detected valid values for a prolonged time again, resetting all counters.
//! P1: Invalid message counter. //! P1: Number of periods with invalid messages.
//! P2: Maximum invalid message counter.
static constexpr Event TEMPERATURE_ALL_ONES_RECOVERY = static constexpr Event TEMPERATURE_ALL_ONES_RECOVERY =
event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO); event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
@ -54,8 +55,13 @@ class SusHandler : public DeviceHandlerBase {
susMax1227::SusDataset dataset; susMax1227::SusDataset dataset;
acs::SusRequest request{}; acs::SusRequest request{};
uint8_t susIdx; uint8_t susIdx;
// After 1 minute, trigger the event for the invalid messages.
Countdown invalidMsgCountdown = Countdown(60000);
bool waitingForRecovery = true; bool waitingForRecovery = true;
uint32_t invalidMsgCounter = 0; uint32_t invalidMsgCounter = 0;
uint32_t invalidMsgCounterMax = 0;
uint32_t invalidMsgPeriodCounter = 0;
uint32_t transitionDelay = 1000; uint32_t transitionDelay = 1000;
bool goToNormalMode = false; bool goToNormalMode = false;