continue thermal controller overheating
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2023-03-13 15:59:19 +01:00
parent 721a01409e
commit bf2d97bd60
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
11 changed files with 166 additions and 117 deletions

View File

@ -10,6 +10,7 @@
</envs> </envs>
</ADDITIONAL_GENERATION_ENVIRONMENT> </ADDITIONAL_GENERATION_ENVIRONMENT>
</configuration> </configuration>
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" NO_GENERATOR="true" />
</configurations> </configurations>
</component> </component>
</project> </project>

View File

@ -32,8 +32,13 @@ xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY; xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
CoreController::CoreController(object_id_t objectId) CoreController::CoreController(object_id_t objectId)
: ExtendedControllerBase(objectId, 5), cmdExecutor(4096), cmdReplyBuf(4096, true), cmdRepliesSizes(128), : ExtendedControllerBase(objectId, 5),
opDivider5(5), opDivider10(10), hkSet(this) { cmdExecutor(4096),
cmdReplyBuf(4096, true),
cmdRepliesSizes(128),
opDivider5(5),
opDivider10(10),
hkSet(this) {
cmdExecutor.setRingBuffer(&cmdReplyBuf, &cmdRepliesSizes); cmdExecutor.setRingBuffer(&cmdReplyBuf, &cmdRepliesSizes);
try { try {
sdcMan = SdCardManager::instance(); sdcMan = SdCardManager::instance();
@ -102,14 +107,14 @@ void CoreController::performControlOperation() {
sdStateMachine(); sdStateMachine();
performMountedSdCardOperations(); performMountedSdCardOperations();
readHkData(); readHkData();
if(shellCmdIsExecuting) { if (shellCmdIsExecuting) {
bool replyReceived = false; bool replyReceived = false;
// TODO: We could read the data in the ring buffer and send it as an action data reply. // TODO: We could read the data in the ring buffer and send it as an action data reply.
if(cmdExecutor.check(replyReceived) == CommandExecutor::EXECUTION_FINISHED) { if (cmdExecutor.check(replyReceived) == CommandExecutor::EXECUTION_FINISHED) {
actionHelper.finish(true, successRecipient, EXECUTE_SHELL_CMD); actionHelper.finish(true, successRecipient, EXECUTE_SHELL_CMD);
shellCmdIsExecuting = false; shellCmdIsExecuting = false;
cmdReplyBuf.clear(); cmdReplyBuf.clear();
while(not cmdRepliesSizes.empty()) { while (not cmdRepliesSizes.empty()) {
cmdRepliesSizes.pop(); cmdRepliesSizes.pop();
} }
successRecipient = MessageQueueIF::NO_QUEUE; successRecipient = MessageQueueIF::NO_QUEUE;
@ -316,14 +321,15 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
// Warning: This function will never return, because it reboots the system // Warning: This function will never return, because it reboots the system
return actionReboot(data, size); return actionReboot(data, size);
} }
case(EXECUTE_SHELL_CMD): { case (EXECUTE_SHELL_CMD): {
std::string cmd = std::string(cmd, size); std::string cmd = std::string(cmd, size);
if(cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING or shellCmdIsExecuting) { if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING or
shellCmdIsExecuting) {
return HasActionsIF::IS_BUSY; return HasActionsIF::IS_BUSY;
} }
cmdExecutor.load(cmd, false, false); cmdExecutor.load(cmd, false, false);
ReturnValue_t result = cmdExecutor.execute(); ReturnValue_t result = cmdExecutor.execute();
if(result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
shellCmdIsExecuting = true; shellCmdIsExecuting = true;

View File

@ -1,6 +1,7 @@
#include "ThermalController.h" #include "ThermalController.h"
#include <bsp_q7s/core/CoreDefinitions.h> #include <bsp_q7s/core/CoreDefinitions.h>
#include <eive/objects.h>
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <fsfw/thermal/ThermalComponentIF.h> #include <fsfw/thermal/ThermalComponentIF.h>
#include <fsfw_hal/devicehandlers/devicedefinitions/mgmLis3Helpers.h> #include <fsfw_hal/devicehandlers/devicedefinitions/mgmLis3Helpers.h>
@ -14,7 +15,6 @@
#include <mission/devices/devicedefinitions/payloadPcduDefinitions.h> #include <mission/devices/devicedefinitions/payloadPcduDefinitions.h>
#include <mission/devices/devicedefinitions/rwHelpers.h> #include <mission/devices/devicedefinitions/rwHelpers.h>
#include <objects/systemObjectList.h> #include <objects/systemObjectList.h>
#include <eive/objects.h>
ThermalController::ThermalController(object_id_t objectId, HeaterHandler& heater) ThermalController::ThermalController(object_id_t objectId, HeaterHandler& heater)
: ExtendedControllerBase(objectId), : ExtendedControllerBase(objectId),
@ -65,8 +65,12 @@ ThermalController::ThermalController(object_id_t objectId, HeaterHandler& heater
} }
ReturnValue_t ThermalController::initialize() { ReturnValue_t ThermalController::initialize() {
auto result = ExtendedControllerBase::initialize(); auto* camSwitcher = ObjectManager::instance()->get<HasHealthIF>(objects::CAM_SWITCHER);
return result; if (camSwitcher == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
camId = camSwitcher->getCommandQueue();
return ExtendedControllerBase::initialize();
} }
ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) { ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) {
@ -992,7 +996,8 @@ void ThermalController::ctrlAcsBoard() {
if (chooseHeater(switchNr, redSwitchNr)) { if (chooseHeater(switchNr, redSwitchNr)) {
if (heaterHandler.checkSwitchState(switchNr)) { if (heaterHandler.checkSwitchState(switchNr)) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF); heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
sif::info << "ThermalController::ctrlHeater: Heater" << switchNr << " OFF" << std::endl; sif::info << "ThermalController::ctrlHeater: Heater" << static_cast<int>(thermalComponent)
<< " OFF" << std::endl;
} }
} }
} }
@ -1082,9 +1087,7 @@ void ThermalController::ctrlStr() {
sensors[2].second = sensorTemperatures.sensor_dro.value; sensors[2].second = sensorTemperatures.sensor_dro.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_5_STR, heater::HEATER_6_DRO, strLimits); ctrlComponentTemperature(heater::HEATER_5_STR, heater::HEATER_6_DRO, strLimits);
if (componentAboveOpUpperLimit){ tooHotHandler(objects::STAR_TRACKER, strTooHotFlag);
EventManagerIF::triggerEvent(objects::STAR_TRACKER, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH);
}
} }
void ThermalController::ctrlIfBoard() { void ThermalController::ctrlIfBoard() {
@ -1121,8 +1124,11 @@ void ThermalController::ctrlObc() {
sensors[2].second = sensorTemperatures.tmp1075Tcs0.value; sensors[2].second = sensorTemperatures.tmp1075Tcs0.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_0_OBC_BRD, heater::HEATER_2_ACS_BRD, obcLimits); ctrlComponentTemperature(heater::HEATER_0_OBC_BRD, heater::HEATER_2_ACS_BRD, obcLimits);
if (componentAboveCutOffLimit) { if (componentAboveUpperLimit and not obcTooHotFlag) {
triggerEvent(OBC_OVERHEATING); triggerEvent(tcsCtrl::OBC_OVERHEATING);
obcTooHotFlag = true;
} else if (not componentAboveUpperLimit) {
obcTooHotFlag = false;
} }
} }
@ -1136,6 +1142,12 @@ void ThermalController::ctrlObcIfBoard() {
sensors[2].second = sensorTemperatures.tmp1075Tcs1.value; sensors[2].second = sensorTemperatures.tmp1075Tcs1.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_0_OBC_BRD, heater::HEATER_2_ACS_BRD, obcIfBoardLimits); ctrlComponentTemperature(heater::HEATER_0_OBC_BRD, heater::HEATER_2_ACS_BRD, obcIfBoardLimits);
if (componentAboveUpperLimit and not obcTooHotFlag) {
triggerEvent(tcsCtrl::OBC_OVERHEATING);
obcTooHotFlag = true;
} else if (not componentAboveUpperLimit) {
obcTooHotFlag = false;
}
} }
void ThermalController::ctrlSBandTransceiver() { void ThermalController::ctrlSBandTransceiver() {
@ -1149,13 +1161,12 @@ void ThermalController::ctrlSBandTransceiver() {
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_7_S_BAND, heater::HEATER_4_CAMERA, ctrlComponentTemperature(heater::HEATER_7_S_BAND, heater::HEATER_4_CAMERA,
sBandTransceiverLimits); sBandTransceiverLimits);
if (componentAboveCutOffLimit) { if (componentAboveUpperLimit and not syrlinksTooHotFlag) {
float sensorTempAsFloat = sensorTemp; triggerEvent(tcsCtrl::SYRLINKS_OVERHEATING, tempFloatToU32());
syrlinksTooHotFlag = true;
SerializeIF::serialize() } else if (not componentAboveUpperLimit) {
triggerEvent(SYRLINKS_OVERHEATING, static_cast<u_int8_t>(sensorTemp)); //TODO: TEMP mitgeben pcduSystemTooHotFlag = false;
} }
} }
void ThermalController::ctrlPcduP60Board() { void ThermalController::ctrlPcduP60Board() {
thermalComponent = PCDUP60_BOARD; thermalComponent = PCDUP60_BOARD;
@ -1165,6 +1176,12 @@ void ThermalController::ctrlPcduP60Board() {
sensors[1].second = deviceTemperatures.temp2P60dock.value; sensors[1].second = deviceTemperatures.temp2P60dock.value;
numSensors = 2; numSensors = 2;
ctrlComponentTemperature(heater::HEATER_3_PCDU_PDU, heater::HEATER_2_ACS_BRD, pcduP60BoardLimits); ctrlComponentTemperature(heater::HEATER_3_PCDU_PDU, heater::HEATER_2_ACS_BRD, pcduP60BoardLimits);
if (componentAboveUpperLimit and not pcduSystemTooHotFlag) {
triggerEvent(tcsCtrl::PCDU_SYSTEM_OVERHEATING, tempFloatToU32());
pcduSystemTooHotFlag = true;
} else if (not componentAboveUpperLimit) {
pcduSystemTooHotFlag = false;
}
} }
void ThermalController::ctrlPcduAcu() { void ThermalController::ctrlPcduAcu() {
@ -1175,8 +1192,7 @@ void ThermalController::ctrlPcduAcu() {
if (chooseHeater(switchNr, redSwitchNr)) { if (chooseHeater(switchNr, redSwitchNr)) {
bool sensorTempAvailable = true; bool sensorTempAvailable = true;
if (deviceTemperatures.acu.value[0] != if (deviceTemperatures.acu.value[0] != INVALID_TEMPERATURE) {
INVALID_TEMPERATURE) {
sensorTemp = deviceTemperatures.acu.value[0]; sensorTemp = deviceTemperatures.acu.value[0];
} else if (deviceTemperatures.acu.value[1] != INVALID_TEMPERATURE) { } else if (deviceTemperatures.acu.value[1] != INVALID_TEMPERATURE) {
sensorTemp = deviceTemperatures.acu.value[1]; sensorTemp = deviceTemperatures.acu.value[1];
@ -1185,15 +1201,18 @@ void ThermalController::ctrlPcduAcu() {
} else if (sensorTemperatures.sensor_acu.isValid()) { } else if (sensorTemperatures.sensor_acu.isValid()) {
sensorTemp = sensorTemperatures.sensor_acu.value; sensorTemp = sensorTemperatures.sensor_acu.value;
} else { } else {
triggerEvent(NO_VALID_SENSOR_TEMPERATURE, thermalComponent); triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, thermalComponent);
sensorTempAvailable = false; sensorTempAvailable = false;
} }
if (sensorTempAvailable) { if (sensorTempAvailable) {
ctrlHeater(switchNr, redSwitchNr, pcduAcuLimits); ctrlHeater(switchNr, redSwitchNr, pcduAcuLimits);
} }
} }
if (componentAboveOpUpperLimit){ if (componentAboveUpperLimit and not pcduSystemTooHotFlag) {
EventManagerIF::triggerEvent(objects::PCDU_HANDLER, ThermalComponentIF::COMPONENT_TEMP_HIGH); triggerEvent(tcsCtrl::PCDU_SYSTEM_OVERHEATING, tempFloatToU32());
pcduSystemTooHotFlag = true;
} else if (not componentAboveUpperLimit) {
pcduSystemTooHotFlag = false;
} }
} }
@ -1207,10 +1226,11 @@ void ThermalController::ctrlPcduPdu() {
sensors[2].second = sensorTemperatures.tmp1075Tcs0.value; sensors[2].second = sensorTemperatures.tmp1075Tcs0.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_3_PCDU_PDU, heater::HEATER_2_ACS_BRD, pcduPduLimits); ctrlComponentTemperature(heater::HEATER_3_PCDU_PDU, heater::HEATER_2_ACS_BRD, pcduPduLimits);
if (componentAboveOpUpperLimit){ if (componentAboveUpperLimit and not pcduSystemTooHotFlag) {
EventManagerIF::triggerEvent(objects::PCDU_HANDLER, ThermalComponentIF::COMPONENT_TEMP_HIGH); triggerEvent(tcsCtrl::PCDU_SYSTEM_OVERHEATING, tempFloatToU32());
}else if(componentAboveOpUpperLimit){ //TODO: NOp bool pcduSystemTooHotFlag = true;
EventManagerIF::triggerEvent(objects::PCDU_HANDLER, ThermalComponentIF::COMPONENT_TEMP_HIGH); } else if (not componentAboveUpperLimit) {
pcduSystemTooHotFlag = false;
} }
} }
@ -1226,9 +1246,7 @@ void ThermalController::ctrlPlPcduBoard() {
sensors[3].second = sensorTemperatures.sensor_plpcdu_heatspreader.value; sensors[3].second = sensorTemperatures.sensor_plpcdu_heatspreader.value;
numSensors = 4; numSensors = 4;
ctrlComponentTemperature(heater::HEATER_3_PCDU_PDU, heater::HEATER_2_ACS_BRD, plPcduBoardLimits); ctrlComponentTemperature(heater::HEATER_3_PCDU_PDU, heater::HEATER_2_ACS_BRD, plPcduBoardLimits);
if (componentAboveCutOffLimit) { tooHotHandler(objects::PLPCDU_HANDLER, eBandTooHotFlag);
triggerEvent(PLPCDU_OVERHEATING);
}
} }
void ThermalController::ctrlPlocMissionBoard() { void ThermalController::ctrlPlocMissionBoard() {
@ -1242,12 +1260,7 @@ void ThermalController::ctrlPlocMissionBoard() {
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_1_PLOC_PROC_BRD, heater::HEATER_0_OBC_BRD, ctrlComponentTemperature(heater::HEATER_1_PLOC_PROC_BRD, heater::HEATER_0_OBC_BRD,
plocMissionBoardLimits); plocMissionBoardLimits);
if (componentAboveCutOffLimit) { tooHotHandler(objects::PLOC_MPSOC_HANDLER, plocTooHotFlag);
triggerEvent(PLOC_OVERHEATING);
}
if (componentAboveOpUpperLimit){
EventManagerIF::triggerEvent(objects::PLOC_MPSOC_HANDLER, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH);
}
} }
void ThermalController::ctrlPlocProcessingBoard() { void ThermalController::ctrlPlocProcessingBoard() {
@ -1261,9 +1274,7 @@ void ThermalController::ctrlPlocProcessingBoard() {
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_1_PLOC_PROC_BRD, heater::HEATER_0_OBC_BRD, ctrlComponentTemperature(heater::HEATER_1_PLOC_PROC_BRD, heater::HEATER_0_OBC_BRD,
plocProcessingBoardLimits); plocProcessingBoardLimits);
if (componentAboveOpUpperLimit){ tooHotHandler(objects::PLOC_MPSOC_HANDLER, plocTooHotFlag);
EventManagerIF::triggerEvent(objects::PLOC_MPSOC_HANDLER, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH);
}
} }
void ThermalController::ctrlDac() { void ThermalController::ctrlDac() {
@ -1276,9 +1287,7 @@ void ThermalController::ctrlDac() {
sensors[2].second = sensorTemperatures.sensor_ploc_heatspreader.value; sensors[2].second = sensorTemperatures.sensor_ploc_heatspreader.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_1_PLOC_PROC_BRD, heater::HEATER_0_OBC_BRD, dacLimits); ctrlComponentTemperature(heater::HEATER_1_PLOC_PROC_BRD, heater::HEATER_0_OBC_BRD, dacLimits);
if (componentAboveOpUpperLimit){ tooHotHandler(objects::PLPCDU_HANDLER, eBandTooHotFlag);
//EventManagerIF::triggerEvent(objects::, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH);
}
} }
void ThermalController::ctrlCameraBody() { void ThermalController::ctrlCameraBody() {
@ -1291,9 +1300,19 @@ void ThermalController::ctrlCameraBody() {
sensors[2].second = sensorTemperatures.sensor_mpa.value; sensors[2].second = sensorTemperatures.sensor_mpa.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_4_CAMERA, heater::HEATER_6_DRO, cameraLimits); ctrlComponentTemperature(heater::HEATER_4_CAMERA, heater::HEATER_6_DRO, cameraLimits);
// if (componentAboveOpUpperLimit){ if (componentAboveUpperLimit and not camTooHotOneShotFlag) {
// EventManagerIF::triggerEvent(objects::, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH); triggerEvent(tcsCtrl::CAMERA_OVERHEATING, tempFloatToU32());
// } CommandMessage msg;
HealthMessage::setHealthMessage(&msg, HealthMessage::HEALTH_SET, HealthState::FAULTY);
ReturnValue_t result = commandQueue->sendMessage(camId, &msg);
if (result != returnvalue::OK) {
sif::error << "ThermalController::ctrlCameraBody(): Sending health message failed"
<< std::endl;
}
camTooHotOneShotFlag = true;
} else if (not componentAboveUpperLimit) {
camTooHotOneShotFlag = false;
}
} }
void ThermalController::ctrlDro() { void ThermalController::ctrlDro() {
@ -1306,9 +1325,7 @@ void ThermalController::ctrlDro() {
sensors[2].second = sensorTemperatures.sensor_mpa.value; sensors[2].second = sensorTemperatures.sensor_mpa.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_4_CAMERA, droLimits); ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_4_CAMERA, droLimits);
if (componentAboveOpUpperLimit){ tooHotHandler(objects::PLPCDU_HANDLER, eBandTooHotFlag);
EventManagerIF::triggerEvent(objects::PLPCDU_HANDLER, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH);
}
} }
void ThermalController::ctrlX8() { void ThermalController::ctrlX8() {
@ -1321,9 +1338,7 @@ void ThermalController::ctrlX8() {
sensors[2].second = sensorTemperatures.sensor_tx_modul.value; sensors[2].second = sensorTemperatures.sensor_tx_modul.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_4_CAMERA, x8Limits); ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_4_CAMERA, x8Limits);
if (componentAboveOpUpperLimit){ tooHotHandler(objects::PLPCDU_HANDLER, eBandTooHotFlag);
EventManagerIF::triggerEvent(objects::PLPCDU_HANDLER, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH);
}
} }
void ThermalController::ctrlTx() { void ThermalController::ctrlTx() {
@ -1336,9 +1351,7 @@ void ThermalController::ctrlTx() {
sensors[2].second = sensorTemperatures.sensor_mpa.value; sensors[2].second = sensorTemperatures.sensor_mpa.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_4_CAMERA, txLimits); ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_4_CAMERA, txLimits);
if (componentAboveOpUpperLimit){ tooHotHandler(objects::PLPCDU_HANDLER, eBandTooHotFlag);
EventManagerIF::triggerEvent(objects::PLPCDU_HANDLER, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH);
}
} }
void ThermalController::ctrlMpa() { void ThermalController::ctrlMpa() {
@ -1351,9 +1364,7 @@ void ThermalController::ctrlMpa() {
sensors[2].second = sensorTemperatures.sensor_tx_modul.value; sensors[2].second = sensorTemperatures.sensor_tx_modul.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_4_CAMERA, mpaLimits); ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_4_CAMERA, mpaLimits);
if (componentAboveOpUpperLimit){ tooHotHandler(objects::PLPCDU_HANDLER, eBandTooHotFlag);
EventManagerIF::triggerEvent(objects::PLPCDU_HANDLER, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH);
}
} }
void ThermalController::ctrlHpa() { void ThermalController::ctrlHpa() {
@ -1366,12 +1377,7 @@ void ThermalController::ctrlHpa() {
sensors[2].second = sensorTemperatures.sensor_mpa.value; sensors[2].second = sensorTemperatures.sensor_mpa.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_4_CAMERA, hpaLimits); ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_4_CAMERA, hpaLimits);
if (componentAboveCutOffLimit) { tooHotHandler(objects::PLPCDU_HANDLER, eBandTooHotFlag);
triggerEvent(HPA_OVERHEATING);
}
if (componentAboveOpUpperLimit){
EventManagerIF::triggerEvent(objects::PLPCDU_HANDLER, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH);
}
} }
void ThermalController::ctrlScexBoard() { void ThermalController::ctrlScexBoard() {
@ -1384,9 +1390,7 @@ void ThermalController::ctrlScexBoard() {
sensors[2].second = sensorTemperatures.sensor_hpa.value; sensors[2].second = sensorTemperatures.sensor_hpa.value;
numSensors = 3; numSensors = 3;
ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_5_STR, scexBoardLimits); ctrlComponentTemperature(heater::HEATER_6_DRO, heater::HEATER_5_STR, scexBoardLimits);
if (componentAboveOpUpperLimit){ tooHotHandler(objects::SCEX, scexTooHotFlag);
EventManagerIF::triggerEvent(objects::SCEX, ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH);
}
} }
void ThermalController::performThermalModuleCtrl() { void ThermalController::performThermalModuleCtrl() {
@ -1427,7 +1431,8 @@ void ThermalController::ctrlComponentTemperature(heater::Switchers switchNr,
redSwitchNr)) { // TODO: muss der Heater dann wirklich abgeschalten werden? redSwitchNr)) { // TODO: muss der Heater dann wirklich abgeschalten werden?
if (heaterHandler.checkSwitchState(switchNr)) { if (heaterHandler.checkSwitchState(switchNr)) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF); heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
sif::info << "ThermalController::ctrlHeater: Heater" << static_cast<u_int8_t>(switchNr) << " OFF" << std::endl; // TODO: printouts löschen sif::info << "ThermalController::ctrlHeater: Heater" << static_cast<u_int8_t>(switchNr)
<< " OFF" << std::endl; // TODO: printouts löschen
} }
} }
} }
@ -1445,11 +1450,11 @@ bool ThermalController::selectAndReadSensorTemp() {
thermalStates[thermalComponent].errorCounter++; thermalStates[thermalComponent].errorCounter++;
if (thermalComponent != RW and thermalComponent != ACS_BOARD) { if (thermalComponent != RW and thermalComponent != ACS_BOARD) {
if (thermalStates[thermalComponent].errorCounter <= 3) { if (thermalStates[thermalComponent].errorCounter <= 3) {
triggerEvent(NO_VALID_SENSOR_TEMPERATURE, thermalComponent); triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, thermalComponent);
} }
} else { } else {
if (thermalStates[thermalComponent].errorCounter <= 8) { if (thermalStates[thermalComponent].errorCounter <= 8) {
triggerEvent(NO_VALID_SENSOR_TEMPERATURE, thermalComponent); triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, thermalComponent);
} }
} }
@ -1464,7 +1469,7 @@ bool ThermalController::chooseHeater(heater::Switchers& switchNr, heater::Switch
redSwitchNrInUse = true; redSwitchNrInUse = true;
} else { } else {
heaterAvailable = false; heaterAvailable = false;
triggerEvent(NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr);
} }
} else { } else {
redSwitchNrInUse = false; redSwitchNrInUse = false;
@ -1474,17 +1479,16 @@ bool ThermalController::chooseHeater(heater::Switchers& switchNr, heater::Switch
void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr, void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr,
struct TempLimits& tempLimit) { struct TempLimits& tempLimit) {
componentAboveCutOffLimit = false; componentAboveCutOffLimit = false;
componentAboveOpUpperLimit = false; componentAboveUpperLimit = false;
// if Heater off // if Heater off
if (not heaterStates[switchNr].switchTransition) { if (not heaterStates[switchNr].switchTransition) {
if (not heaterHandler.checkSwitchState(switchNr)) { if (not heaterHandler.checkSwitchState(switchNr)) {
if (sensorTemp < tempLimit.opLowerLimit) { if (sensorTemp < tempLimit.opLowerLimit) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::ON); heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::ON);
sif::info << "ThermalController::ctrlHeater: Heater " << static_cast<u_int8_t>(thermalComponent) << " ON" sif::info << "ThermalController::ctrlHeater: Heater " << static_cast<int>(thermalComponent)
<< std::endl; << " ON" << std::endl;
heaterStates[switchNr].switchTransition = true; heaterStates[switchNr].switchTransition = true;
thermalStates[thermalComponent].heating = true; thermalStates[thermalComponent].heating = true;
// TODO: EVENT; aber heaterHandler erstellt schon event
} else { } else {
thermalStates[thermalComponent].heating = false; thermalStates[thermalComponent].heating = false;
} }
@ -1494,36 +1498,34 @@ void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers
if (thermalStates[thermalComponent].heating) { if (thermalStates[thermalComponent].heating) {
if (sensorTemp >= tempLimit.opLowerLimit + TEMP_OFFSET) { if (sensorTemp >= tempLimit.opLowerLimit + TEMP_OFFSET) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF); heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
sif::info << "ThermalController::ctrlHeater: Heater " << static_cast<u_int8_t>(thermalComponent) << " OFF" sif::info << "ThermalController::ctrlHeater: Heater "
<< std::endl; << static_cast<int>(thermalComponent) << " OFF" << std::endl;
heaterStates[switchNr].switchTransition = true; heaterStates[switchNr].switchTransition = true;
thermalStates[thermalComponent].heating = false; thermalStates[thermalComponent].heating = false;
} }
} else { } else {
// TODO: if >= opLimit -> Event; nicht für syrlinks auto tempTooHighHandler = [&](const char* whatLimit) {
if (sensorTemp >= tempLimit.opUpperLimit) {
componentAboveOpUpperLimit = true;
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF); heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
sif::info << "ThermalController::ctrlHeater: Reached CutOffLimit: Heater " sif::info << "ThermalController::ctrlHeater: Reached " << whatLimit << ": Heater "
<< static_cast<u_int8_t>(thermalComponent) << " OFF" << std::endl; << static_cast<int>(thermalComponent) << " OFF" << std::endl;
heaterStates[switchNr].switchTransition = true; heaterStates[switchNr].switchTransition = true;
if (heaterHandler.checkSwitchState(redSwitchNr)) { if (heaterHandler.checkSwitchState(redSwitchNr)) {
heaterHandler.switchHeater(redSwitchNr, HeaterHandler::SwitchState::OFF); heaterHandler.switchHeater(redSwitchNr, HeaterHandler::SwitchState::OFF);
heaterStates[redSwitchNr].switchTransition = true; 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;
} }
if (sensorTemp >= tempLimit.cutOffLimit) { if (sensorTemp >= tempLimit.cutOffLimit) {
componentAboveCutOffLimit = true; componentAboveCutOffLimit = true;
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF); tempTooHighHandler("CutOff-Limit");
sif::info << "ThermalController::ctrlHeater: Reached CutOffLimit: Heater "
<< thermalComponent << " OFF" << std::endl;
heaterStates[switchNr].switchTransition = true;
if (heaterHandler.checkSwitchState(redSwitchNr)) {
heaterHandler.switchHeater(redSwitchNr, HeaterHandler::SwitchState::OFF);
sif::info << "ThermalController::ctrlHeater: Reached CutOffLimit: RedundantHeater "
<< thermalComponent << " OFF" << std::endl;
heaterStates[redSwitchNr].switchTransition = true;
}
} }
} }
} }
@ -1548,3 +1550,19 @@ void ThermalController::heaterTransitionControl() {
} }
} }
} }
uint32_t ThermalController::tempFloatToU32() {
auto sensorTempAsFloat = static_cast<float>(sensorTemp);
uint32_t tempRaw = 0;
size_t dummyLen = 0;
SerializeAdapter::serialize(&sensorTempAsFloat, reinterpret_cast<uint8_t*>(&tempRaw), &dummyLen,
sizeof(tempRaw), SerializeIF::Endianness::NETWORK);
return tempRaw;
}
void ThermalController::tooHotHandler(object_id_t object, bool& oneShotFlag) {
if (componentAboveUpperLimit and not oneShotFlag) {
EventManagerIF::triggerEvent(object, overHeatEventToTrigger, tempFloatToU32());
oneShotFlag = true;
} else if (not componentAboveUpperLimit) {
oneShotFlag = false;
}
}

View File

@ -4,7 +4,7 @@
#include <fsfw/controller/ExtendedControllerBase.h> #include <fsfw/controller/ExtendedControllerBase.h>
#include <fsfw/devicehandlers/DeviceHandlerThermalSet.h> #include <fsfw/devicehandlers/DeviceHandlerThermalSet.h>
#include <fsfw/timemanager/Countdown.h> #include <fsfw/timemanager/Countdown.h>
#include <mission/controller/controllerdefinitions/ThermalControllerDefinitions.h> #include <mission/controller/controllerdefinitions/tcsCtrlDefs.h>
#include <mission/devices/devicedefinitions/Max31865Definitions.h> #include <mission/devices/devicedefinitions/Max31865Definitions.h>
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h> #include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
#include <mission/devices/devicedefinitions/susMax1227Helpers.h> #include <mission/devices/devicedefinitions/susMax1227Helpers.h>
@ -97,15 +97,6 @@ class ThermalController : public ExtendedControllerBase {
uint32_t* msToReachTheMode) override; uint32_t* msToReachTheMode) override;
private: private:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TCS_CONTROLLER;
static constexpr Event NO_VALID_SENSOR_TEMPERATURE = MAKE_EVENT(0, severity::MEDIUM);
static constexpr Event NO_HEALTHY_HEATER_AVAILABLE = MAKE_EVENT(1, severity::MEDIUM);
static constexpr Event SYRLINKS_OVERHEATING = MAKE_EVENT(2, severity::HIGH);
static constexpr Event PLOC_OVERHEATING = MAKE_EVENT(3, severity::HIGH);
static constexpr Event OBC_OVERHEATING = MAKE_EVENT(4, severity::HIGH);
static constexpr Event HPA_OVERHEATING = MAKE_EVENT(5, severity::HIGH);
static constexpr Event PLPCDU_OVERHEATING = MAKE_EVENT(6, severity::HIGH);
static const uint32_t DELAY = 500; static const uint32_t DELAY = 500;
static const uint32_t TEMP_OFFSET = 5; static const uint32_t TEMP_OFFSET = 5;
@ -192,8 +183,18 @@ class ThermalController : public ExtendedControllerBase {
double sensorTemp = INVALID_TEMPERATURE; double sensorTemp = INVALID_TEMPERATURE;
ThermalComponents thermalComponent = NONE; ThermalComponents thermalComponent = NONE;
bool redSwitchNrInUse = false; bool redSwitchNrInUse = false;
MessageQueueId_t camId = MessageQueueIF::NO_QUEUE;
bool componentAboveCutOffLimit = false; bool componentAboveCutOffLimit = false;
bool componentAboveOpUpperLimit = false; bool componentAboveUpperLimit = false;
Event overHeatEventToTrigger;
bool eBandTooHotFlag = false;
bool camTooHotOneShotFlag = false;
bool scexTooHotFlag = false;
bool plocTooHotFlag = false;
bool pcduSystemTooHotFlag = false;
bool syrlinksTooHotFlag = false;
bool obcTooHotFlag = false;
bool strTooHotFlag = false;
std::array<ThermalState, 30> thermalStates{}; std::array<ThermalState, 30> thermalStates{};
std::array<HeaterState, 7> heaterStates{}; std::array<HeaterState, 7> heaterStates{};
@ -252,6 +253,8 @@ class ThermalController : public ExtendedControllerBase {
void ctrlMpa(); void ctrlMpa();
void ctrlScexBoard(); void ctrlScexBoard();
void heaterTransitionControl(); void heaterTransitionControl();
uint32_t tempFloatToU32();
void tooHotHandler(object_id_t object, bool& oneShotFlag);
}; };
#endif /* MISSION_CONTROLLER_THERMALCONTROLLER_H_ */ #endif /* MISSION_CONTROLLER_THERMALCONTROLLER_H_ */

View File

@ -49,7 +49,7 @@ void ActuatorCmd::cmdSpeedToRws(int32_t speedRw0, int32_t speedRw1, int32_t spee
} else if (rwCmdSpeed[i] < -maxRwSpeed) { } else if (rwCmdSpeed[i] < -maxRwSpeed) {
rwCmdSpeed[i] = -maxRwSpeed; rwCmdSpeed[i] = -maxRwSpeed;
} }
} }
} }
void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, int16_t *dipolMomentActuator, void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, int16_t *dipolMomentActuator,

View File

@ -5,9 +5,19 @@
#include <fsfw/datapoollocal/StaticLocalDataSet.h> #include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include "devices/heaterSwitcherList.h" #include "devices/heaterSwitcherList.h"
#include "eive/eventSubsystemIds.h"
namespace tcsCtrl { namespace tcsCtrl {
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TCS_CONTROLLER;
static constexpr Event NO_VALID_SENSOR_TEMPERATURE = MAKE_EVENT(0, severity::MEDIUM);
static constexpr Event NO_HEALTHY_HEATER_AVAILABLE = MAKE_EVENT(1, severity::MEDIUM);
static constexpr Event SYRLINKS_OVERHEATING = MAKE_EVENT(2, severity::HIGH);
static constexpr Event PLOC_OVERHEATING = MAKE_EVENT(3, severity::HIGH);
static constexpr Event OBC_OVERHEATING = MAKE_EVENT(4, severity::HIGH);
static constexpr Event CAMERA_OVERHEATING = MAKE_EVENT(5, severity::HIGH);
static constexpr Event PCDU_SYSTEM_OVERHEATING = MAKE_EVENT(6, severity::HIGH);
enum SetId : uint32_t { enum SetId : uint32_t {
SENSOR_TEMPERATURES = 0, SENSOR_TEMPERATURES = 0,
DEVICE_TEMPERATURES = 1, DEVICE_TEMPERATURES = 1,
@ -93,9 +103,10 @@ static const uint8_t ENTRIES_SUS_TEMPERATURE_SET = 12;
*/ */
class SensorTemperatures : public StaticLocalDataSet<ENTRIES_SENSOR_TEMPERATURE_SET> { class SensorTemperatures : public StaticLocalDataSet<ENTRIES_SENSOR_TEMPERATURE_SET> {
public: public:
SensorTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SENSOR_TEMPERATURES) {} explicit SensorTemperatures(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, SENSOR_TEMPERATURES) {}
SensorTemperatures(object_id_t objectId) explicit SensorTemperatures(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, SENSOR_TEMPERATURES)) {} : StaticLocalDataSet(sid_t(objectId, SENSOR_TEMPERATURES)) {}
lp_var_t<float> sensor_ploc_heatspreader = lp_var_t<float> sensor_ploc_heatspreader =
@ -137,9 +148,10 @@ class SensorTemperatures : public StaticLocalDataSet<ENTRIES_SENSOR_TEMPERATURE_
*/ */
class DeviceTemperatures : public StaticLocalDataSet<ENTRIES_DEVICE_TEMPERATURE_SET> { class DeviceTemperatures : public StaticLocalDataSet<ENTRIES_DEVICE_TEMPERATURE_SET> {
public: public:
DeviceTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, DEVICE_TEMPERATURES) {} explicit DeviceTemperatures(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, DEVICE_TEMPERATURES) {}
DeviceTemperatures(object_id_t objectId) explicit DeviceTemperatures(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, DEVICE_TEMPERATURES)) {} : StaticLocalDataSet(sid_t(objectId, DEVICE_TEMPERATURES)) {}
lp_var_t<float> q7s = lp_var_t<float>(sid.objectId, PoolIds::TEMP_Q7S, this); lp_var_t<float> q7s = lp_var_t<float>(sid.objectId, PoolIds::TEMP_Q7S, this);
@ -178,9 +190,11 @@ class DeviceTemperatures : public StaticLocalDataSet<ENTRIES_DEVICE_TEMPERATURE_
*/ */
class SusTemperatures : public StaticLocalDataSet<ENTRIES_SUS_TEMPERATURE_SET> { class SusTemperatures : public StaticLocalDataSet<ENTRIES_SUS_TEMPERATURE_SET> {
public: public:
SusTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SUS_TEMPERATURES) {} explicit SusTemperatures(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, SUS_TEMPERATURES) {}
SusTemperatures(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, SUS_TEMPERATURES)) {} explicit SusTemperatures(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, SUS_TEMPERATURES)) {}
lp_var_t<float> sus_0_n_loc_xfyfzm_pt_xf = lp_var_t<float> sus_0_n_loc_xfyfzm_pt_xf =
lp_var_t<float>(sid.objectId, PoolIds::SUS_0_N_LOC_XFYFZM_PT_XF, this); lp_var_t<float>(sid.objectId, PoolIds::SUS_0_N_LOC_XFYFZM_PT_XF, this);

View File

@ -3,3 +3,8 @@
CamSwitcher::CamSwitcher(object_id_t objectId, PowerSwitchIF &pwrSwitcher, CamSwitcher::CamSwitcher(object_id_t objectId, PowerSwitchIF &pwrSwitcher,
power::Switch_t pwrSwitch) power::Switch_t pwrSwitch)
: PowerSwitcherComponent(objectId, &pwrSwitcher, pwrSwitch) {} : PowerSwitcherComponent(objectId, &pwrSwitcher, pwrSwitch) {}
void CamSwitcher::performFaultyOperation() {
if (not switcher.active() and switcher.getState() != PowerSwitcher::SWITCH_IS_OFF) {
switcher.turnOff();
}
}

View File

@ -8,6 +8,7 @@ class CamSwitcher : public PowerSwitcherComponent {
CamSwitcher(object_id_t objectId, PowerSwitchIF &pwrSwitcher, power::Switch_t pwrSwitch); CamSwitcher(object_id_t objectId, PowerSwitchIF &pwrSwitcher, power::Switch_t pwrSwitch);
private: private:
void performFaultyOperation() override;
}; };
#endif /* MISSION_SYSTEM_OBJECTS_CAMSWITCHER_H_ */ #endif /* MISSION_SYSTEM_OBJECTS_CAMSWITCHER_H_ */

View File

@ -51,7 +51,7 @@ void EiveSystem::performChildOperation() {
} }
ReturnValue_t EiveSystem::initialize() { ReturnValue_t EiveSystem::initialize() {
EventManagerIF* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER); auto* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
if (manager == nullptr) { if (manager == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "AcsSubsystem::initialize: Invalid event manager" << std::endl; sif::error << "AcsSubsystem::initialize: Invalid event manager" << std::endl;
@ -67,6 +67,7 @@ ReturnValue_t EiveSystem::initialize() {
#endif #endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
// TODO: manager->subscribeToEvent(eventQueue->getId(), )
return Subsystem::initialize(); return Subsystem::initialize();
} }

2
thirdparty/lwgps vendored

@ -1 +1 @@
Subproject commit 52999ddfe5177493b96b55871961a8a97131596d Subproject commit 22d865662eb7be6c9849275da9166f6b410f906a

2
tmtc

@ -1 +1 @@
Subproject commit a40c881b9fc292fe598204280db38720a784b71f Subproject commit d8367f7e62a47516d7772c129c18ee8f7b07703b