changes thermal control
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Irini Kosmidou 2022-12-19 10:51:31 +01:00
parent 8a9ed28845
commit 6365f497a7
2 changed files with 92 additions and 18 deletions

View File

@ -105,7 +105,29 @@ void ThermalController::performControlOperation() {
}
// TODO: Heater control
ctrlAcsBoard();
ctrlMgt();
ctrlRw();
ctrlStr();
ctrlIfBoard();
ctrlTcsBoard();
ctrlObc();
ctrlObcIfBoard();
ctrlSBandTransceiver();
ctrlPcduP60Board();
ctrlPcduAcu();
ctrlPcduPdu();
ctrlPlPcduBoard();
ctrlPlocMissionBoard();
ctrlPlocProcessingBoard();
ctrlDac();
ctrlCameraBody();
ctrlDro();
ctrlX8();
ctrlHpa();
ctrlTx();
ctrlMpa();
ctrlScexBoard();
}
ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
@ -953,9 +975,8 @@ void ThermalController::copyDevices() {
}
}
void ThermalController::ctrlAcsBoard() {}
void ThermalController::ctrlMgt() {
float opLowerLimit = mgtLimits.opLowerLimit;
float cutOffLimit = mgtLimits.cutOffLimit;
heater::Switchers switchNr = heater::HEATER_2_ACS_BRD;
heater::Switchers redSwitchNr = heater::HEATER_3_PCDU_PDU;
@ -963,21 +984,70 @@ void ThermalController::ctrlMgt() {
if (heaterAvailable) {
chooseSensor(switchNr, sensorTemperatures.sensor_magnettorquer.value,
sensorTemperatures.sensor_magnettorquer.value,
deviceTemperatures.mgt.value,
sensorTemperatures.sensor_plpcdu_heatspreader.value,
sensorTemperatures.sensor_magnettorquer.isValid(),
sensorTemperatures.sensor_magnettorquer.isValid(),
sensorTemperatures.sensor_plpcdu_heatspreader.isValid()); // TODO: int sensor
deviceTemperatures.mgt.isValid(),
sensorTemperatures.sensor_plpcdu_heatspreader.isValid());
if (sensorTempAvailable) {
ctrlHeater(switchNr, redSwitchNr, opLowerLimit, cutOffLimit);
ctrlHeater(switchNr, redSwitchNr, &mgtLimits);
}
}
}
void ThermalController::ctrlRw() {}
void ThermalController::ctrlStr() {
heater::Switchers switchNr = heater::HEATER_5_STR;
heater::Switchers redSwitchNr = heater::HEATER_6_DRO;
chooseHeater(switchNr, redSwitchNr);
if (heaterAvailable) {
chooseSensor(switchNr, sensorTemperatures.sensor_startracker.value,
deviceTemperatures.startracker.value,
sensorTemperatures.sensor_dro.value,
sensorTemperatures.sensor_startracker.isValid(),
deviceTemperatures.startracker.isValid(),
sensorTemperatures.sensor_dro.isValid());
if (sensorTempAvailable) {
ctrlHeater(switchNr, redSwitchNr, &strLimits);
}
}
}
void ThermalController::ctrlIfBoard() {
heater::Switchers switchNr = heater::HEATER_2_ACS_BRD;
heater::Switchers redSwitchNr = heater::HEATER_3_PCDU_PDU;
chooseHeater(switchNr, redSwitchNr);
if (heaterAvailable) {
chooseSensor(switchNr, sensorTemperatures.tmp1075IfBrd.value,
sensorTemperatures.sensor_magnettorquer.value,
deviceTemperatures.mgm2SideB.value,
sensorTemperatures.tmp1075IfBrd.isValid(),
sensorTemperatures.sensor_magnettorquer.isValid(),
deviceTemperatures.mgm2SideB.isValid());
if (sensorTempAvailable) {
ctrlHeater(switchNr, redSwitchNr, &ifBoardLimits);
}
}
}
void ThermalController::ctrlTcsBoard() {}
void ThermalController::ctrlObc() {}
void ThermalController::ctrlObcIfBoard() {}
void ThermalController::ctrlSBandTransceiver() {}
void ThermalController::ctrlPcduP60Board() {}
void ThermalController::ctrlPcduAcu() {}
void ThermalController::ctrlPcduPdu() {}
void ThermalController::ctrlPlPcduBoard() {}
void ThermalController::ctrlPlocMissionBoard() {}
void ThermalController::ctrlPlocProcessingBoard() {}
void ThermalController::ctrlDac() {}
void ThermalController::ctrlCameraBody() {
// Camera Body
float opLowerLimit = cameraLimits.opLowerLimit;
float cutOffLimit = cameraLimits.cutOffLimit;
heater::Switchers switchNr = heater::HEATER_4_CAMERA;
heater::Switchers redSwitchNr = heater::HEATER_6_DRO;
@ -990,27 +1060,33 @@ void ThermalController::ctrlCameraBody() {
sensorTemperatures.sensor_dro.isValid(), sensorTemperatures.sensor_mpa.isValid());
if (sensorTempAvailable) {
ctrlHeater(switchNr, redSwitchNr, opLowerLimit, cutOffLimit);
ctrlHeater(switchNr, redSwitchNr, &cameraLimits);
}
}
}
void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr,
float opLowerLimit, float cutOffLimit) {
void ThermalController::ctrlDro() {}
void ThermalController::ctrlX8() {}
void ThermalController::ctrlHpa() {}
void ThermalController::ctrlTx() {}
void ThermalController::ctrlMpa() {}
void ThermalController::ctrlScexBoard() {}
void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr, struct TempLimits *tempLimit) {
// Heater off
if (not heaterHandler.checkSwitchState(switchNr)) {
// TODO: check if OP or NOP
if (sensorTemp < opLowerLimit) {
if (sensorTemp < (*tempLimit).opLowerLimit) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::ON);
}
// Heater on
} else if (heaterHandler.checkSwitchState(switchNr)) {
if (sensorTemp >= opLowerLimit + TEMP_OFFSET) {
if (sensorTemp >= (*tempLimit).opLowerLimit + TEMP_OFFSET) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
}
} else if (not redSwitchNrInUse) {
if (heaterHandler.checkSwitchState(redSwitchNr)) {
if (sensorTemp >= cutOffLimit) {
if (sensorTemp >= (*tempLimit).cutOffLimit) {
heaterHandler.switchHeater(redSwitchNr, HeaterHandler::SwitchState::OFF);
}
}
@ -1037,7 +1113,6 @@ void ThermalController::chooseHeater(heater::Switchers& switchNr, heater::Switch
void ThermalController::chooseSensor(heater::Switchers switchNr, float sensorValue1,
float sensorValue2, float sensorValue3, bool sensor1Valid,
bool sensor2Valid, bool sensor3Valid) {
// Choose sensor
sensorTempAvailable = true;
if (sensor1Valid) {

View File

@ -154,8 +154,7 @@ class ThermalController : public ExtendedControllerBase {
void copySus();
void copyDevices();
void ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr, float opLowerLimit,
float cutOffLimit);
void ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr, struct TempLimits *tempLimit);
void chooseHeater(heater::Switchers& switchNr, heater::Switchers redSwitchNr);
void chooseSensor(heater::Switchers switchNr, float sensorValue1, float sensorValue2,
float sensorValue3, bool sensor1Valid, bool sensor2Valid, bool sensor3Valid);