TCS heater upper burn limit #732

Merged
muellerr merged 18 commits from tcs-heater-upper-limit into main 2023-07-11 10:56:44 +02:00
3 changed files with 24 additions and 20 deletions
Showing only changes of commit 7337595d47 - Show all commits

View File

@ -1759,8 +1759,8 @@ void ThermalController::heaterTransitionControl(const HeaterSwitchStates& curren
if (heaterStates[i].switchTransition) { if (heaterStates[i].switchTransition) {
if (currentHeaterStates[i] == heaterStates[i].target) { if (currentHeaterStates[i] == heaterStates[i].target) {
// Required for max heater period control // Required for max heater period control
if (currentHeaterStates[i] == HeaterHandler::SwitchState::ON) { if (currentHeaterStates[i] == heater::SwitchState::ON) {
heaterStates[i].heaterOnPeriod.setTimeout(MAX_HEATER_ON_DURATIONS[i]); heaterStates[i].heaterOnPeriod.setTimeout(MAX_HEATER_ON_DURATIONS_MS[i]);
heaterStates[i].heaterOnPeriod.resetTimer(); heaterStates[i].heaterOnPeriod.resetTimer();
} else { } else {
// The heater might still be one for some thermal components, so cross-check // The heater might still be one for some thermal components, so cross-check
@ -1786,7 +1786,9 @@ void ThermalController::heaterMaxDurationControl(const HeaterSwitchStates& curre
heaterStates[i].heaterOnPeriod.hasTimedOut()) { heaterStates[i].heaterOnPeriod.hasTimedOut()) {
heaterStates[i].switchTransition = false; heaterStates[i].switchTransition = false;
heaterStates[i].heaterSwitchControlCycles = 0; heaterStates[i].heaterSwitchControlCycles = 0;
heaterHandler.switchHeater(static_cast<heater::Switch>(i), HeaterHandler::SwitchState::OFF); heaterHandler.switchHeater(static_cast<heater::Switch>(i), heater::SwitchState::OFF);
triggerEvent(tcsCtrl::TCS_HEATER_MAX_BURN_TIME_REACHED, static_cast<uint32_t>(i),
MAX_HEATER_ON_DURATIONS_MS[i]);
// The heater might still be one for some thermal components, so cross-check // The heater might still be one for some thermal components, so cross-check
// those components // those components
crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(static_cast<heater::Switch>(i)); crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(static_cast<heater::Switch>(i));

View File

@ -107,23 +107,23 @@ class ThermalController : public ExtendedControllerBase {
static constexpr int16_t SANITY_LIMIT_UPPER_TEMP = 160; static constexpr int16_t SANITY_LIMIT_UPPER_TEMP = 160;
// 1 hour // 1 hour
static constexpr uint32_t MAX_HEATER_ON_DURATION_MS = 60 * 60 * 1000; static constexpr uint32_t DEFAULT_MAX_HEATER_ON_DURATION_MS = 60 * 60 * 1000;
static constexpr uint32_t MAX_HEATER_ON_DURATIONS[8] = {// PLOC PROC board static constexpr uint32_t MAX_HEATER_ON_DURATIONS_MS[8] = {// PLOC PROC board
MAX_HEATER_ON_DURATION_MS, DEFAULT_MAX_HEATER_ON_DURATION_MS,
// PCDU PDU // PCDU PDU
MAX_HEATER_ON_DURATION_MS, DEFAULT_MAX_HEATER_ON_DURATION_MS,
// ACS Board // ACS Board
MAX_HEATER_ON_DURATION_MS, DEFAULT_MAX_HEATER_ON_DURATION_MS,
// OBC Board // OBC Board
MAX_HEATER_ON_DURATION_MS, DEFAULT_MAX_HEATER_ON_DURATION_MS,
// Camera // Camera
MAX_HEATER_ON_DURATION_MS, DEFAULT_MAX_HEATER_ON_DURATION_MS,
// STR // STR
MAX_HEATER_ON_DURATION_MS, DEFAULT_MAX_HEATER_ON_DURATION_MS,
// DRO // DRO
MAX_HEATER_ON_DURATION_MS, DEFAULT_MAX_HEATER_ON_DURATION_MS,
// S-Band // S-Band
MAX_HEATER_ON_DURATION_MS}; DEFAULT_MAX_HEATER_ON_DURATION_MS};
ThermalController(object_id_t objectId, HeaterHandler& heater, ThermalController(object_id_t objectId, HeaterHandler& heater,
const std::atomic_bool& tcsBoardShortUnavailable, bool pollPcdu1Tmp); const std::atomic_bool& tcsBoardShortUnavailable, bool pollPcdu1Tmp);

View File

@ -22,6 +22,8 @@ static constexpr Event MGT_OVERHEATING = MAKE_EVENT(8, severity::HIGH);
static constexpr Event TCS_SWITCHING_HEATER_ON = MAKE_EVENT(9, severity::INFO); static constexpr Event TCS_SWITCHING_HEATER_ON = MAKE_EVENT(9, severity::INFO);
//! [EXPORT] : [COMMENT] P1: Module index. P2: Heater index //! [EXPORT] : [COMMENT] P1: Module index. P2: Heater index
static constexpr Event TCS_SWITCHING_HEATER_OFF = MAKE_EVENT(10, severity::INFO); static constexpr Event TCS_SWITCHING_HEATER_OFF = MAKE_EVENT(10, severity::INFO);
//! [EXPORT] : [COMMENT] P1: Heater index. P2: Maximum burn time for heater.
static constexpr Event TCS_HEATER_MAX_BURN_TIME_REACHED = MAKE_EVENT(11, severity::MEDIUM);
enum SetId : uint32_t { enum SetId : uint32_t {
SENSOR_TEMPERATURES = 0, SENSOR_TEMPERATURES = 0,