this should cover upper bound checking when heater is off
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
dc44af5b29
commit
715a69db89
@ -1539,8 +1539,33 @@ void ThermalController::checkLimitsAndCtrlHeater(heater::Switchers switchNr,
|
||||
const TempLimits& tempLimit) {
|
||||
componentAboveCutOffLimit = false;
|
||||
componentAboveUpperLimit = false;
|
||||
// if Heater off
|
||||
auto tempTooHighHandler = [&](const char* whatLimit, bool heaterIsOn) {
|
||||
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
|
||||
sif::info << "ThermalController::checkLimitsAndCtrlHeater: Reached " << whatLimit << ": Heater "
|
||||
<< static_cast<int>(thermalComponent) << " OFF" << std::endl;
|
||||
heaterStates[switchNr].switchTransition = true;
|
||||
if (heaterIsOn) {
|
||||
heaterHandler.switchHeater(redSwitchNr, HeaterHandler::SwitchState::OFF);
|
||||
heaterStates[redSwitchNr].switchTransition = true;
|
||||
}
|
||||
};
|
||||
auto checkUpperLimits = [&](bool heaterIsOn) {
|
||||
if (sensorTemp >= tempLimit.nopUpperLimit) {
|
||||
componentAboveUpperLimit = true;
|
||||
tempTooHighHandler("NOP-Limit", heaterIsOn);
|
||||
overHeatEventToTrigger = ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH;
|
||||
return true;
|
||||
} else if (sensorTemp >= tempLimit.opUpperLimit) {
|
||||
componentAboveUpperLimit = true;
|
||||
tempTooHighHandler("OP-Limit", heaterIsOn);
|
||||
overHeatEventToTrigger = ThermalComponentIF::COMPONENT_TEMP_HIGH;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
// Stay passive during switch transitions, wait for heater switching to complete.
|
||||
if (not heaterStates[switchNr].switchTransition) {
|
||||
// Heater off
|
||||
if (not heaterHandler.checkSwitchState(switchNr)) {
|
||||
// TODO: check NOP limit and maybe trigger fdir
|
||||
if (sensorTemp < tempLimit.opLowerLimit) {
|
||||
@ -1552,10 +1577,11 @@ void ThermalController::checkLimitsAndCtrlHeater(heater::Switchers switchNr,
|
||||
} else {
|
||||
thermalStates[thermalComponent].heating = false;
|
||||
}
|
||||
|
||||
// if Heater on
|
||||
checkUpperLimits(false);
|
||||
// Heater on
|
||||
} else if (heaterHandler.checkSwitchState(switchNr)) {
|
||||
if (thermalStates[thermalComponent].heating) {
|
||||
// We are already in a heating cycle, so need to check whether heating task is complete.
|
||||
if (sensorTemp >= tempLimit.opLowerLimit + TEMP_OFFSET) {
|
||||
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
|
||||
sif::info << "ThermalController::checkLimitsAndCtrlHeater: Heater "
|
||||
@ -1564,28 +1590,14 @@ void ThermalController::checkLimitsAndCtrlHeater(heater::Switchers switchNr,
|
||||
thermalStates[thermalComponent].heating = false;
|
||||
}
|
||||
} else {
|
||||
auto tempTooHighHandler = [&](const char* whatLimit) {
|
||||
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
|
||||
sif::info << "ThermalController::checkLimitsAndCtrlHeater: Reached " << whatLimit
|
||||
<< ": Heater " << static_cast<int>(thermalComponent) << " OFF" << std::endl;
|
||||
heaterStates[switchNr].switchTransition = true;
|
||||
if (heaterHandler.checkSwitchState(redSwitchNr)) {
|
||||
heaterHandler.switchHeater(redSwitchNr, HeaterHandler::SwitchState::OFF);
|
||||
heaterStates[redSwitchNr].switchTransition = true;
|
||||
}
|
||||
};
|
||||
if (sensorTemp >= tempLimit.nopUpperLimit) {
|
||||
componentAboveUpperLimit = true;
|
||||
tempTooHighHandler("NOP-Limit");
|
||||
overHeatEventToTrigger = ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH;
|
||||
} else if (sensorTemp >= tempLimit.opUpperLimit) {
|
||||
componentAboveUpperLimit = true;
|
||||
tempTooHighHandler("OP-Limit");
|
||||
overHeatEventToTrigger = ThermalComponentIF::COMPONENT_TEMP_HIGH;
|
||||
}
|
||||
// This can happen if heater is used as alternative heater (no regular heating cycle), so we
|
||||
// should still check the upper limits.
|
||||
bool tooHighHandlerAlreadyCalled = checkUpperLimits(true);
|
||||
if (sensorTemp >= tempLimit.cutOffLimit) {
|
||||
componentAboveCutOffLimit = true;
|
||||
tempTooHighHandler("CutOff-Limit");
|
||||
if (not tooHighHandlerAlreadyCalled) {
|
||||
tempTooHighHandler("CutOff-Limit", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user