new design heater control for camera body
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Irini Kosmidou 2022-12-12 21:33:12 +01:00
parent 762ae04bb2
commit 873bb2f79e
2 changed files with 31 additions and 37 deletions

View File

@ -105,8 +105,7 @@ void ThermalController::performControlOperation() {
}
// TODO: Heater control
// TODO: Hysterese offset
ctrl4KCameraHeater();
ctrl4KCamera();
}
@ -955,29 +954,36 @@ void ThermalController::copyDevices() {
}
}
void ThermalController::ctrl4KCameraHeater(){
// 4K Camera - Heater
void ThermalController::ctrl4KCamera() {
// 4K Camera
float cameraTemp;
bool cameraTempAvailable = true;
if (sensorTemperatures.sensor_4k_camera.isValid()) {
if (not heaterHandler.checkSwitchState(heater::HEATER_4_CAMERA)) {
if (sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit) {
heaterHandler.switchHeater(heater::HEATER_4_CAMERA, HeaterHandler::SwitchState::ON);
heater4Countdown.resetTimer();
}
} else if (heaterHandler.checkSwitchState(heater::HEATER_4_CAMERA)) {
if (sensorTemperatures.sensor_4k_camera.value >= cameraLimits.opLowerLimit + TEMP_OFFSET) {
heaterHandler.switchHeater(heater::HEATER_4_CAMERA, HeaterHandler::SwitchState::OFF);
}
} else {
if (heater4Countdown.hasTimedOut()) {
// Sensor or heater failure
heaterHandler.switchHeater(heater::HEATER_4_CAMERA, HeaterHandler::SwitchState::OFF);
triggerEvent(HEATER_MAX_BURNTIME_REACHED, heater::HEATER_4_CAMERA);
};
}
cameraTemp = sensorTemperatures.sensor_4k_camera.value;
} else if (sensorTemperatures.sensor_dro.isValid()) {
cameraTemp = sensorTemperatures.sensor_dro.value;
} else if (sensorTemperatures.sensor_mpa.isValid()) {
cameraTemp = sensorTemperatures.sensor_mpa.value;
} else {
if (heaterHandler.checkSwitchState(heater::HEATER_4_CAMERA)) {
heaterHandler.switchHeater(heater::HEATER_4_CAMERA, HeaterHandler::SwitchState::OFF);
}
triggerEvent(INVALID_SENSOR_TEMPERATURE, heater::HEATER_4_CAMERA);
triggerEvent(NO_VALID_SENSOR_TEMPERATURE, heater::HEATER_4_CAMERA);
cameraTempAvailable = false;
}
// TODO: include redundant heater
if (cameraTempAvailable) {
if (not heaterHandler.checkSwitchState(heater::HEATER_4_CAMERA)) {
// TODO: check if op or nop
if (cameraTemp < cameraLimits.opLowerLimit) {
heaterHandler.switchHeater(heater::HEATER_4_CAMERA, HeaterHandler::SwitchState::ON);
} else if (heaterHandler.checkSwitchState(heater::HEATER_4_CAMERA)) {
if (cameraTemp >= cameraLimits.opLowerLimit + TEMP_OFFSET) {
heaterHandler.switchHeater(heater::HEATER_4_CAMERA, HeaterHandler::SwitchState::OFF);
}
}
}
}
}

View File

@ -54,14 +54,12 @@ class ThermalController : public ExtendedControllerBase {
private:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::HEATER_HANDLER;
static constexpr Event HEATER_MAX_BURNTIME_REACHED = MAKE_EVENT(0, severity::LOW);
static constexpr Event INVALID_SENSOR_TEMPERATURE = MAKE_EVENT(1, severity::LOW);
static constexpr Event NO_VALID_SENSOR_TEMPERATURE = MAKE_EVENT(0, severity::LOW);
static const uint32_t DELAY = 500;
// TODO to be changed
static const uint32_t OP_TIME = 1000;
static const uint32_t TEMP_OFFSET = 10;
static const uint32_t TEMP_OFFSET = 5;
enum class InternalState { STARTUP, INITIAL_DELAY, READY };
@ -138,16 +136,6 @@ class ThermalController : public ExtendedControllerBase {
// Initial delay to make sure all pool variables have been initialized their owners
Countdown initialCountdown = Countdown(DELAY);
// Heater Countdown to make sure heater
Countdown heater0Countdown = Countdown(OP_TIME);
Countdown heater1Countdown = Countdown(OP_TIME);
Countdown heater2Countdown = Countdown(OP_TIME);
Countdown heater3Countdown = Countdown(OP_TIME);
Countdown heater4Countdown = Countdown(OP_TIME);
Countdown heater5Countdown = Countdown(OP_TIME);
Countdown heater6Countdown = Countdown(OP_TIME);
Countdown heater7Countdown = Countdown(OP_TIME);
PoolEntry<float> tmp1075Tcs0 = PoolEntry<float>(10.0);
PoolEntry<float> tmp1075Tcs1 = PoolEntry<float>(10.0);
PoolEntry<float> tmp1075PlPcdu0 = PoolEntry<float>(10.0);
@ -159,7 +147,7 @@ class ThermalController : public ExtendedControllerBase {
void copySus();
void copyDevices();
void ctrl4KCameraHeater();
void ctrl4KCamera();
};
#endif /* MISSION_CONTROLLER_THERMALCONTROLLER_H_ */