TCS observability
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-07-11 13:52:41 +02:00
parent 46bb602c96
commit 13e965948c
Signed by: muellerr
GPG Key ID: 407F9B00F858F270
4 changed files with 9 additions and 82 deletions

View File

@ -139,7 +139,7 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
}
std::istringstream valSstream(valstring);
valSstream >> val;
if(valSstream.bad()) {
if (valSstream.bad()) {
sif::warning << "Xadc: Conversion of value to target type failed" << std::endl;
fclose(fp);
return returnvalue::FAILED;

View File

@ -1603,9 +1603,10 @@ void ThermalController::ctrlComponentTemperature(HeaterContext& htrCtx) {
if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) {
// Also track the counter to prevent heater handler message spam. The heater handle can only
// process 2 messages per cycle.
if (heaterCtrlAllowed() and (thermalStates[currThermalComponent].noSensorAvailableCounter < 3)) {
heaterSwitchHelper(htrCtx.switchNr, heater::SwitchState::OFF, currThermalComponent);
}
if (heaterCtrlAllowed() and
(thermalStates[ctrlCtx.thermalComponent].noSensorAvailableCounter < 3)) {
heaterSwitchHelper(htrCtx.switchNr, heater::SwitchState::OFF, ctrlCtx.thermalComponent);
}
}
}
resetSensorsArray();
@ -1622,8 +1623,8 @@ bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) {
}
}
thermalStates[currThermalComponent].noSensorAvailableCounter++;
if (currThermalComponent != RW and currThermalComponent != ACS_BOARD) {
thermalStates[ctrlCtx.thermalComponent].noSensorAvailableCounter++;
if (ctrlCtx.thermalComponent != tcsCtrl::RW and ctrlCtx.thermalComponent != tcsCtrl::ACS_BOARD) {
if (thermalStates[ctrlCtx.thermalComponent].noSensorAvailableCounter <= 3) {
triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, ctrlCtx.thermalComponent);
}

View File

@ -26,80 +26,6 @@
#include <list>
#include <optional>
/**
* NOP Limit: Hard limit for device, usually from datasheet. Device damage is possible lif NOP limit
* is exceeded.
* OP Limit: Soft limit. Device should be switched off or TCS controller should take action if the
* limit is exceeded to avoid reaching NOP limit
*/
struct TempLimits {
TempLimits(float nopLowerLimit, float opLowerLimit, float cutOffLimit, float opUpperLimit,
float nopUpperLimit)
: opLowerLimit(opLowerLimit),
opUpperLimit(opUpperLimit),
cutOffLimit(cutOffLimit),
nopLowerLimit(nopLowerLimit),
nopUpperLimit(nopUpperLimit) {}
float opLowerLimit;
float opUpperLimit;
float cutOffLimit;
float nopLowerLimit;
float nopUpperLimit;
};
struct ThermalState {
uint8_t noSensorAvailableCounter;
// Which sensor is used for this component?
uint8_t sensorIndex = 0;
// Is heating on for that thermal module?
bool heating = false;
// Which switch is being used for heating the component
heater::Switch heaterSwitch = heater::Switch::NUMBER_OF_SWITCHES;
// Heater start time and end times as UNIX seconds. Please note that these times will be updated
// when a switch command is sent, with no guarantess that the heater actually went on.
uint32_t heaterStartTime = 0;
uint32_t heaterEndTime = 0;
};
struct HeaterState {
bool switchTransition = false;
HeaterHandler::SwitchState target = HeaterHandler::SwitchState::OFF;
uint8_t heaterSwitchControlCycles = 0;
bool trackHeaterMaxPeriod = false;
Countdown heaterOnPeriod;
};
using HeaterSwitchStates = std::array<HeaterHandler::SwitchState, heater::NUMBER_OF_SWITCHES>;
enum ThermalComponents : uint8_t {
NONE = 0,
ACS_BOARD = 1,
MGT = 2,
RW = 3,
STR = 4,
IF_BOARD = 5,
TCS_BOARD = 6,
OBC = 7,
// Not used anymore, was identical to OBC module.
LEGACY_OBCIF_BOARD = 8,
SBAND_TRANSCEIVER = 9,
PCDUP60_BOARD = 10,
PCDUACU = 11,
PCDUPDU = 12,
PLPCDU_BOARD = 13,
PLOCMISSION_BOARD = 14,
PLOCPROCESSING_BOARD = 15,
DAC = 16,
CAMERA = 17,
DRO = 18,
X8 = 19,
HPA = 20,
TX = 21,
MPA = 22,
SCEX_BOARD = 23,
NUM_ENTRIES
};
class ThermalController : public ExtendedControllerBase {
public:
static constexpr uint8_t SUBMODE_NO_HEATER_CTRL = 1;

View File

@ -34,7 +34,7 @@ struct TempLimits {
* Abstraction for the state of a single thermal component
*/
struct ThermalState {
uint8_t errorCounter;
uint8_t noSensorAvailableCounter;
// Which sensor is used for this component?
uint8_t sensorIndex = 0;
// Is heating on for that thermal module?
@ -69,7 +69,7 @@ enum ThermalComponents : uint8_t {
IF_BOARD = 5,
TCS_BOARD = 6,
OBC = 7,
OBCIF_BOARD = 8,
LEGACY_OBCIF_BOARD = 8,
SBAND_TRANSCEIVER = 9,
PCDUP60_BOARD = 10,
PCDUACU = 11,