changes thermal control
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
0b1136ad28
commit
8a9ed28845
@ -954,80 +954,49 @@ void ThermalController::copyDevices() {
|
||||
}
|
||||
|
||||
void ThermalController::ctrlMgt() {
|
||||
float sensorTemp;
|
||||
float opLowerLimit = mgtLimits.opLowerLimit;
|
||||
float cutOffLimit = mgtLimits.cutOffLimit;
|
||||
heater::Switchers switchNr = heater::HEATER_2_ACS_BRD;
|
||||
heater::Switchers redSwitchNr = heater::HEATER_3_PCDU_PDU;
|
||||
bool cameraTempAvailable = true;
|
||||
bool heaterAvailable = true;
|
||||
bool redSwitchNrInUse = false;
|
||||
|
||||
// Choose Heater
|
||||
chooseHeater(switchNr, redSwitchNr, redSwitchNrInUse, heaterAvailable);
|
||||
chooseHeater(switchNr, redSwitchNr);
|
||||
|
||||
if (heaterAvailable) {
|
||||
// Choose sensor
|
||||
if (sensorTemperatures.sensor_magnettorquer.isValid()) {
|
||||
sensorTemp = sensorTemperatures.sensor_magnettorquer.value;
|
||||
} else if (sensorTemperatures.sensor_magnettorquer.isValid()) { // TODO: int sensor
|
||||
sensorTemp = sensorTemperatures.sensor_magnettorquer.value;
|
||||
} else if (sensorTemperatures.sensor_plpcdu_heatspreader.isValid()) {
|
||||
sensorTemp = sensorTemperatures.sensor_plpcdu_heatspreader.value;
|
||||
} else {
|
||||
if (heaterHandler.checkSwitchState(switchNr)) {
|
||||
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
|
||||
}
|
||||
triggerEvent(NO_VALID_SENSOR_TEMPERATURE, switchNr);
|
||||
cameraTempAvailable = false;
|
||||
}
|
||||
chooseSensor(switchNr, sensorTemperatures.sensor_magnettorquer.value,
|
||||
sensorTemperatures.sensor_magnettorquer.value,
|
||||
sensorTemperatures.sensor_plpcdu_heatspreader.value,
|
||||
sensorTemperatures.sensor_magnettorquer.isValid(),
|
||||
sensorTemperatures.sensor_magnettorquer.isValid(),
|
||||
sensorTemperatures.sensor_plpcdu_heatspreader.isValid()); // TODO: int sensor
|
||||
|
||||
// Thermal Control
|
||||
if (cameraTempAvailable) {
|
||||
ctrlHeater(switchNr, redSwitchNr, redSwitchNrInUse, sensorTemp, opLowerLimit, cutOffLimit);
|
||||
if (sensorTempAvailable) {
|
||||
ctrlHeater(switchNr, redSwitchNr, opLowerLimit, cutOffLimit);
|
||||
}
|
||||
}
|
||||
}
|
||||
void ThermalController::ctrlCameraBody() {
|
||||
// Camera Body
|
||||
float sensorTemp;
|
||||
float opLowerLimit = cameraLimits.opLowerLimit;
|
||||
float cutOffLimit = cameraLimits.cutOffLimit;
|
||||
heater::Switchers switchNr = heater::HEATER_4_CAMERA;
|
||||
heater::Switchers redSwitchNr = heater::HEATER_6_DRO;
|
||||
bool cameraTempAvailable = true;
|
||||
bool heaterAvailable = true;
|
||||
bool redSwitchNrInUse = false;
|
||||
|
||||
// Choose Heater
|
||||
chooseHeater(switchNr, redSwitchNr, redSwitchNrInUse, heaterAvailable);
|
||||
chooseHeater(switchNr, redSwitchNr);
|
||||
|
||||
if (heaterAvailable) {
|
||||
// Choose sensor
|
||||
if (sensorTemperatures.sensor_4k_camera.isValid()) {
|
||||
sensorTemp = sensorTemperatures.sensor_4k_camera.value;
|
||||
} else if (sensorTemperatures.sensor_dro.isValid()) {
|
||||
sensorTemp = sensorTemperatures.sensor_dro.value;
|
||||
} else if (sensorTemperatures.sensor_mpa.isValid()) {
|
||||
sensorTemp = sensorTemperatures.sensor_mpa.value;
|
||||
} else {
|
||||
if (heaterHandler.checkSwitchState(switchNr)) {
|
||||
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
|
||||
}
|
||||
triggerEvent(NO_VALID_SENSOR_TEMPERATURE, switchNr);
|
||||
cameraTempAvailable = false;
|
||||
}
|
||||
chooseSensor(switchNr, sensorTemperatures.sensor_4k_camera.value,
|
||||
sensorTemperatures.sensor_dro.value, sensorTemperatures.sensor_mpa.value,
|
||||
sensorTemperatures.sensor_4k_camera.isValid(),
|
||||
sensorTemperatures.sensor_dro.isValid(), sensorTemperatures.sensor_mpa.isValid());
|
||||
|
||||
// Thermal Control
|
||||
if (cameraTempAvailable) {
|
||||
ctrlHeater(switchNr, redSwitchNr, redSwitchNrInUse, sensorTemp, opLowerLimit, cutOffLimit);
|
||||
if (sensorTempAvailable) {
|
||||
ctrlHeater(switchNr, redSwitchNr, opLowerLimit, cutOffLimit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr,
|
||||
bool redSwitchNrInUse, float sensorTemp, float opLowerLimit,
|
||||
float cutOffLimit) {
|
||||
float opLowerLimit, float cutOffLimit) {
|
||||
// Heater off
|
||||
if (not heaterHandler.checkSwitchState(switchNr)) {
|
||||
// TODO: check if OP or NOP
|
||||
@ -1048,9 +1017,10 @@ void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers
|
||||
}
|
||||
}
|
||||
|
||||
void ThermalController::chooseHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr,
|
||||
bool& redSwitchNrInUse, bool& heaterAvailable) {
|
||||
void ThermalController::chooseHeater(heater::Switchers& switchNr, heater::Switchers redSwitchNr) {
|
||||
// Choose Heater
|
||||
heaterAvailable = true;
|
||||
|
||||
if (heaterHandler.getHealth(switchNr) != HasHealthIF::HEALTHY) {
|
||||
if (heaterHandler.getHealth(redSwitchNr) == HasHealthIF::HEALTHY) {
|
||||
switchNr = redSwitchNr;
|
||||
@ -1059,5 +1029,28 @@ void ThermalController::chooseHeater(heater::Switchers switchNr, heater::Switche
|
||||
heaterAvailable = false;
|
||||
// TODO: triggerEvent ?
|
||||
}
|
||||
} else {
|
||||
redSwitchNrInUse = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ThermalController::chooseSensor(heater::Switchers switchNr, float sensorValue1,
|
||||
float sensorValue2, float sensorValue3, bool sensor1Valid,
|
||||
bool sensor2Valid, bool sensor3Valid) {
|
||||
// Choose sensor
|
||||
sensorTempAvailable = true;
|
||||
|
||||
if (sensor1Valid) {
|
||||
sensorTemp = sensorValue1;
|
||||
} else if (sensor2Valid) {
|
||||
sensorTemp = sensorValue2;
|
||||
} else if (sensor3Valid) {
|
||||
sensorTemp = sensorValue3;
|
||||
} else {
|
||||
if (heaterHandler.checkSwitchState(switchNr)) {
|
||||
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
|
||||
}
|
||||
triggerEvent(NO_VALID_SENSOR_TEMPERATURE, switchNr);
|
||||
sensorTempAvailable = false;
|
||||
}
|
||||
}
|
@ -134,6 +134,11 @@ class ThermalController : public ExtendedControllerBase {
|
||||
TempLimits mpaLimits = TempLimits(-40.0, -30.0, -75.0, 80.0, 90.0);
|
||||
TempLimits scexBoardLimits = TempLimits(-60.0, -40.0, 80.0, 85.0, 150.0);
|
||||
|
||||
float sensorTemp;
|
||||
bool sensorTempAvailable = true;
|
||||
bool heaterAvailable = true;
|
||||
bool redSwitchNrInUse = false;
|
||||
|
||||
// Initial delay to make sure all pool variables have been initialized their owners
|
||||
Countdown initialCountdown = Countdown(DELAY);
|
||||
|
||||
@ -144,14 +149,16 @@ class ThermalController : public ExtendedControllerBase {
|
||||
PoolEntry<float> tmp1075IfBrd = PoolEntry<float>(10.0);
|
||||
|
||||
static constexpr dur_millis_t MUTEX_TIMEOUT = 50;
|
||||
|
||||
void copySensors();
|
||||
void copySus();
|
||||
void copyDevices();
|
||||
|
||||
void ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr, bool redSwitchNrInUse,
|
||||
float sensorTemp, float opLowerLimit, float cutOffLimit);
|
||||
void chooseHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr,
|
||||
bool& redSwitchNrInUse, bool& heaterAvailable);
|
||||
void ctrlHeater(heater::Switchers switchNr, heater::Switchers redSwitchNr, float opLowerLimit,
|
||||
float cutOffLimit);
|
||||
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);
|
||||
|
||||
void ctrlAcsBoard();
|
||||
void ctrlMgt();
|
||||
|
Loading…
Reference in New Issue
Block a user