Heater Handling #325

Merged
muellerr merged 78 commits from heater_handling into develop 2023-02-08 21:35:05 +01:00
2 changed files with 37 additions and 0 deletions
Showing only changes of commit 0484daac23 - Show all commits

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);