bug fixed
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Irini Kosmidou 2023-01-22 20:37:51 +01:00
parent 2b3fe93906
commit 6fd10e7180
5 changed files with 51 additions and 27 deletions

View File

@ -6,8 +6,8 @@
#include <cstdlib> #include <cstdlib>
TemperatureSensorInserter::TemperatureSensorInserter( TemperatureSensorInserter::TemperatureSensorInserter(
object_id_t objectId, const std::map<object_id_t, Max31865Dummy>& tempSensorDummies_, object_id_t objectId, const std::map<object_id_t, Max31865Dummy*>& tempSensorDummies_,
const std::map<object_id_t, Tmp1075Dummy>& tempTmpSensorDummies_) const std::map<object_id_t, Tmp1075Dummy*>& tempTmpSensorDummies_)
: SystemObject(objects::THERMAL_TEMP_INSERTER) {} : SystemObject(objects::THERMAL_TEMP_INSERTER) {}
ReturnValue_t TemperatureSensorInserter::initialize() { ReturnValue_t TemperatureSensorInserter::initialize() {

View File

@ -9,8 +9,8 @@
class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject { class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject {
public: public:
explicit TemperatureSensorInserter( explicit TemperatureSensorInserter(
object_id_t objectId, const std::map<object_id_t, Max31865Dummy>& tempSensorDummies_, object_id_t objectId, const std::map<object_id_t, Max31865Dummy*>& tempSensorDummies_,
const std::map<object_id_t, Tmp1075Dummy>& tempTmpSensorDummies_); const std::map<object_id_t, Tmp1075Dummy*>& tempTmpSensorDummies_);
ReturnValue_t initialize() override; ReturnValue_t initialize() override;

View File

@ -82,7 +82,7 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
} }
if (cfg.addTempSensorDummies) { if (cfg.addTempSensorDummies) {
std::map<object_id_t, Max31865Dummy> tempSensorDummies; std::map<object_id_t, Max31865Dummy*> tempSensorDummies;
tempSensorDummies.emplace(objects::RTD_0_IC3_PLOC_HEATSPREADER, tempSensorDummies.emplace(objects::RTD_0_IC3_PLOC_HEATSPREADER,
new Max31865Dummy(objects::RTD_0_IC3_PLOC_HEATSPREADER, new Max31865Dummy(objects::RTD_0_IC3_PLOC_HEATSPREADER,
objects::DUMMY_COM_IF, comCookieDummy)); objects::DUMMY_COM_IF, comCookieDummy));
@ -132,7 +132,7 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
objects::RTD_15_IC18_IMTQ, objects::RTD_15_IC18_IMTQ,
new Max31865Dummy(objects::RTD_15_IC18_IMTQ, objects::DUMMY_COM_IF, comCookieDummy)); new Max31865Dummy(objects::RTD_15_IC18_IMTQ, objects::DUMMY_COM_IF, comCookieDummy));
std::map<object_id_t, Tmp1075Dummy> tempTmpSensorDummies; std::map<object_id_t, Tmp1075Dummy*> tempTmpSensorDummies;
tempTmpSensorDummies.emplace( tempTmpSensorDummies.emplace(
objects::TMP1075_HANDLER_TCS_0, objects::TMP1075_HANDLER_TCS_0,
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_0, objects::DUMMY_COM_IF, comCookieDummy)); new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_0, objects::DUMMY_COM_IF, comCookieDummy));

View File

@ -984,11 +984,20 @@ void ThermalController::copyDevices() {
} }
void ThermalController::ctrlAcsBoard() { void ThermalController::ctrlAcsBoard() {
ctrlComponentTemperature(heater::HEATER_2_ACS_BRD, heater::HEATER_0_OBC_BRD, // TODO: add red sensors, check sensor 4
deviceTemperatures.gyro0SideA, deviceTemperatures.mgm0SideA, heater::Switchers switchNr = heater::HEATER_2_ACS_BRD;
deviceTemperatures.gyro1SideA, // mgm1(int), heater::Switchers redSwitchNr = heater::HEATER_0_OBC_BRD;
// sensorTemperatures.sensor_tcs_board, chooseHeater(switchNr, redSwitchNr);
&acsBoardLimits); // TODO: add red sensors
if (heaterAvailable) {
/*chooseOf5Sensors(switchNr, deviceTemperatures.gyro0SideA, deviceTemperatures.mgm0SideA,
deviceTemperatures.gyro1SideA, deviceTemperatures.mgt,
sensorTemperatures.sensor_tcs_board);*/
if (sensorTempAvailable) {
ctrlHeater(switchNr, redSwitchNr, &acsBoardLimits);
}
}
} }
void ThermalController::ctrlMgt() { void ThermalController::ctrlMgt() {
@ -1164,8 +1173,6 @@ void ThermalController::chooseHeater(heater::Switchers& switchNr, heater::Switch
} else { } else {
heaterAvailable = false; heaterAvailable = false;
triggerEvent(NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); triggerEvent(NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr);
sif::error << "ThermalController::chooseSensor: Both heater: " << switchNr << " + "
<< redSwitchNr << " not healthy" << std::endl;
} }
} else { } else {
redSwitchNrInUse = false; redSwitchNrInUse = false;
@ -1173,8 +1180,7 @@ void ThermalController::chooseHeater(heater::Switchers& switchNr, heater::Switch
} }
void ThermalController::chooseSensor(heater::Switchers switchNr, const lp_float_t& sensor1, void ThermalController::chooseSensor(heater::Switchers switchNr, const lp_float_t& sensor1,
const lp_float_t& sensor2, const lp_float_t& sensor3, const lp_float_t& sensor2, const lp_float_t& sensor3) {
bool moreThan3Sensors) {
sensorTempAvailable = true; sensorTempAvailable = true;
if (sensor1.isValid()) { if (sensor1.isValid()) {
@ -1183,16 +1189,11 @@ void ThermalController::chooseSensor(heater::Switchers switchNr, const lp_float_
sensorTemp = sensor2.value; sensorTemp = sensor2.value;
} else if (sensor3.isValid()) { } else if (sensor3.isValid()) {
sensorTemp = sensor3.value; sensorTemp = sensor3.value;
/*} else if (moreThan3Sensors and sensor4.isValid()) {
sensorTemp = sensor4.value;
} else if (moreThan3Sensors and sensor5.isValid()) {
sensorTemp = sensor5.value; */
} else { } else {
if (heaterHandler.checkSwitchState(switchNr)) { if (heaterHandler.checkSwitchState(switchNr)) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF); heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
} }
// TODO: triggerEvent(NO_VALID_SENSOR_TEMPERATURE, switchNr); triggerEvent(NO_VALID_SENSOR_TEMPERATURE, switchNr);
sif::error << "ThermalController::chooseSensor: No valid Sensor found" << std::endl;
sensorTempAvailable = false; sensorTempAvailable = false;
} }
} }
@ -1201,15 +1202,37 @@ void ThermalController::ctrlComponentTemperature(heater::Switchers switchNr,
heater::Switchers redSwitchNr, heater::Switchers redSwitchNr,
const lp_float_t& sensor1, const lp_float_t& sensor1,
const lp_float_t& sensor2, const lp_float_t& sensor2,
const lp_float_t& sensor3, TempLimits* tempLimit, const lp_float_t& sensor3, TempLimits* tempLimit) {
bool moreThan3Sensors) {
chooseHeater(switchNr, redSwitchNr); chooseHeater(switchNr, redSwitchNr);
if (heaterAvailable) { if (heaterAvailable) {
chooseSensor(switchNr, sensor1, sensor2, sensor3, moreThan3Sensors); chooseSensor(switchNr, sensor1, sensor2, sensor3);
if (sensorTempAvailable) { if (sensorTempAvailable) {
ctrlHeater(switchNr, redSwitchNr, tempLimit); ctrlHeater(switchNr, redSwitchNr, tempLimit);
} }
} }
} }
void ThermalController::chooseOf5Sensors(heater::Switchers switchNr, const lp_float_t& sensor1,
const lp_float_t& sensor2, const lp_float_t& sensor3,
const lp_float_t& sensor4, const lp_float_t& sensor5) {
sensorTempAvailable = true;
if (sensor1.isValid()) {
sensorTemp = sensor1.value;
} else if (sensor2.isValid()) {
sensorTemp = sensor2.value;
} else if (sensor3.isValid()) {
sensorTemp = sensor3.value;
} else if (sensor4.isValid()) {
sensorTemp = sensor4.value;
} else if (sensor5.isValid()) {
sensorTemp = sensor5.value;
} else {
if (heaterHandler.checkSwitchState(switchNr)) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
}
triggerEvent(NO_VALID_SENSOR_TEMPERATURE, switchNr);
sensorTempAvailable = false;
}
}

View File

@ -162,12 +162,13 @@ class ThermalController : public ExtendedControllerBase {
void ctrlComponentTemperature( void ctrlComponentTemperature(
heater::Switchers switchNr, heater::Switchers redSwitchNr, const lp_float_t& sensor1, heater::Switchers switchNr, heater::Switchers redSwitchNr, const lp_float_t& sensor1,
const lp_float_t& sensor2, const lp_float_t& sensor3, TempLimits* tempLimit, const lp_float_t& sensor2, const lp_float_t& sensor3, TempLimits* tempLimit); // TODO sensor 4, 5 = default argument, if not available
bool moreThan3Sensors = false); // TODO sensor 4, 5 = default argument, if not available
void ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr, TempLimits* tempLimit); void ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr, TempLimits* tempLimit);
void chooseHeater(heater::Switchers& switchNr, heater::Switchers redSwitchNr); void chooseHeater(heater::Switchers& switchNr, heater::Switchers redSwitchNr);
void chooseSensor(heater::Switchers switchNr, const lp_float_t& sensor1, void chooseSensor(heater::Switchers switchNr, const lp_float_t& sensor1,
const lp_float_t& sensor2, const lp_float_t& sensor3, bool moreThan3Sensors); const lp_float_t& sensor2, const lp_float_t& sensor3);
void chooseOf5Sensors(heater::Switchers switchNr, const lp_float_t& sensor1,
const lp_float_t& sensor2, const lp_float_t& sensor3, const lp_float_t& sensor4, const lp_float_t& sensor5);
void ctrlAcsBoard(); void ctrlAcsBoard();
void ctrlMgt(); void ctrlMgt();