thermal control first draft
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Irini Kosmidou 2022-11-27 16:58:57 +01:00
parent 23f12d2fd1
commit 0484daac23
2 changed files with 37 additions and 0 deletions

View File

@ -105,6 +105,28 @@ void ThermalController::performControlOperation() {
}
// TODO: Heater control
//TODO: Hysterese offset
if(heaterHandler.heaterVec[heater::HEATER_4_CAMERA].switchState == HeaterHandler::SwitchState::OFF){
if(sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit) {
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].cmdActive = true;
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].action = HeaterHandler::SET_SWITCH_ON;
heaterHandler.handleSwitchOnCommand(heater::HEATER_4_CAMERA);
heater4Countdown.resetTimer();
}
}else if(heaterHandler.heaterVec[heater::HEATER_4_CAMERA].switchState == HeaterHandler::SwitchState::ON){
if(sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit){
if(heater4Countdown.hasTimedOut()){
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].cmdActive = true;
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].action = HeaterHandler::SET_SWITCH_OFF;
//triggerEvent(HEATER_TIMEOUT, heater::HEATER_4_CAMERA);
heaterHandler.handleSwitchOffCommand(heater::HEATER_4_CAMERA);
}
}else {
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].cmdActive = true;
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].action = HeaterHandler::SET_SWITCH_OFF;
heaterHandler.handleSwitchOffCommand(heater::HEATER_4_CAMERA);
};
}
}
ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,

View File

@ -8,6 +8,8 @@
#include <mission/devices/devicedefinitions/SusDefinitions.h>
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
#include <list>
#include "../devices/HeaterHandler.h"
/**
@ -32,6 +34,7 @@ struct TempLimits {
class ThermalController : public ExtendedControllerBase {
public:
static const uint16_t INVALID_TEMPERATURE = 999;
static const uint8_t NUMBER_OF_SENSORS = 16;
ThermalController(object_id_t objectId, HeaterHandler& heater);
@ -50,9 +53,11 @@ class ThermalController : public ExtendedControllerBase {
private:
static const uint32_t DELAY = 500;
static const uint32_t OP_TIME = 1000; //TODO to be changed
enum class InternalState { STARTUP, INITIAL_DELAY, READY };
InternalState internalState = InternalState::STARTUP;
HeaterHandler& heaterHandler;
@ -119,6 +124,16 @@ 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);