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>
TemperatureSensorInserter::TemperatureSensorInserter(
object_id_t objectId, const std::map<object_id_t, Max31865Dummy>& tempSensorDummies_,
const std::map<object_id_t, Tmp1075Dummy>& tempTmpSensorDummies_)
object_id_t objectId, const std::map<object_id_t, Max31865Dummy*>& tempSensorDummies_,
const std::map<object_id_t, Tmp1075Dummy*>& tempTmpSensorDummies_)
: SystemObject(objects::THERMAL_TEMP_INSERTER) {}
ReturnValue_t TemperatureSensorInserter::initialize() {

View File

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

View File

@ -82,7 +82,7 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
}
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,
new Max31865Dummy(objects::RTD_0_IC3_PLOC_HEATSPREADER,
objects::DUMMY_COM_IF, comCookieDummy));
@ -132,7 +132,7 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
objects::RTD_15_IC18_IMTQ,
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(
objects::TMP1075_HANDLER_TCS_0,
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_0, objects::DUMMY_COM_IF, comCookieDummy));

View File

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