WIP extending thermal controller
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Ulrich Mohr 2022-05-23 00:37:49 +02:00
parent 0119f3f8a6
commit c024756540
4 changed files with 77 additions and 34 deletions

View File

@ -23,6 +23,8 @@ TemperatureSensorsDummy::TemperatureSensorsDummy()
ObjectManager::instance()->insert(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, this);
ObjectManager::instance()->insert(objects::RTD_14_IC17_TCS_BOARD, this);
ObjectManager::instance()->insert(objects::RTD_15_IC18_IMTQ, this);
ObjectManager::instance()->insert(objects::TMP1075_HANDLER_1, this);
ObjectManager::instance()->insert(objects::TMP1075_HANDLER_2, this);
}
ReturnValue_t TemperatureSensorsDummy::initialize() {
@ -47,6 +49,7 @@ void TemperatureSensorsDummy::performControlOperation() {
value = sin(iteration / 80. * M_PI) * 10;
max31865Set.read();
max31865Set.rtdValue = value - 5;
max31865Set.temperatureCelcius = value;
max31865Set.commit();
}

View File

@ -6,6 +6,7 @@
ThermalController::ThermalController(object_id_t objectId, object_id_t parentId)
: ExtendedControllerBase(objectId, parentId),
sensorTemperatures(this),
deviceTemperatures(this),
componentTemperatures(this),
max31865Set0(objects::RTD_0_IC3_PLOC_HEATSPREADER),
max31865Set1(objects::RTD_1_IC4_PLOC_MISSIONBOARD),
@ -22,7 +23,9 @@ ThermalController::ThermalController(object_id_t objectId, object_id_t parentId)
max31865Set12(objects::RTD_12_IC15_ACU),
max31865Set13(objects::RTD_13_IC16_PLPCDU_HEATSPREADER),
max31865Set14(objects::RTD_14_IC17_TCS_BOARD),
max31865Set15(objects::RTD_15_IC18_IMTQ) {}
max31865Set15(objects::RTD_15_IC18_IMTQ),
tmp1075Set1(objects::TMP1075_HANDLER_1),
tmp1075Set2(objects::TMP1075_HANDLER_2) {}
ReturnValue_t ThermalController::initialize() {
auto result = ExtendedControllerBase::initialize();
@ -36,41 +39,22 @@ ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) {
void ThermalController::performControlOperation() {
ReturnValue_t result = sensorTemperatures.read();
if (result != RETURN_OK) {
return;
if (result == RETURN_OK) {
copySensors();
sensorTemperatures.commit();
}
copySensors();
result = deviceTemperatures.read();
if (result == RETURN_OK) {
copyDevices();
deviceTemperatures.commit();
}
result = componentTemperatures.read();
if (result != RETURN_OK) {
return;
}
/*sensorTemperatures.sensor_ploc_heatspreader =
((int)sensorTemperatures.sensor_ploc_heatspreader.value + 1) % 100;
sensorTemperatures.sensor_ploc_missionboard =
((int)sensorTemperatures.sensor_ploc_missionboard.value + 2) % 100;
sensorTemperatures.sensor_4k_camera = ((int)sensorTemperatures.sensor_4k_camera.value + 3) % 100;
sensorTemperatures.sensor_dac_heatspreader =
((int)sensorTemperatures.sensor_dac_heatspreader.value + 4) % 100;
sensorTemperatures.sensor_startracker =
((int)sensorTemperatures.sensor_startracker.value + 10) % 100;
sensorTemperatures.sensor_rw1 = ((int)sensorTemperatures.sensor_rw1.value + 10) % 100;
sensorTemperatures.sensor_dro = ((int)sensorTemperatures.sensor_dro.value + 10) % 100;
sensorTemperatures.sensor_scex = ((int)sensorTemperatures.sensor_scex.value + 10) % 100;
sensorTemperatures.sensor_x8 = ((int)sensorTemperatures.sensor_x8.value + 10) % 100;
sensorTemperatures.sensor_hpa = ((int)sensorTemperatures.sensor_hpa.value + 10) % 100;
sensorTemperatures.sensor_tx_modul = ((int)sensorTemperatures.sensor_tx_modul.value + 10) % 100;
sensorTemperatures.sensor_mpa = ((int)sensorTemperatures.sensor_mpa.value + 10) % 100;
sensorTemperatures.sensor_acu = ((int)sensorTemperatures.sensor_acu.value + 10) % 100;
sensorTemperatures.sensor_plpcdu_heatspreader =
((int)sensorTemperatures.sensor_plpcdu_heatspreader.value + 10) % 100;
sensorTemperatures.sensor_tcs_board = ((int)sensorTemperatures.sensor_tcs_board.value + 10) % 100;
sensorTemperatures.sensor_magnettorquer =
((int)sensorTemperatures.sensor_magnettorquer.value + 10) % 100;*/
sensorTemperatures.commit();
componentTemperatures.commit();
}
@ -101,6 +85,10 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo
new PoolEntry<float>({14.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MAGNETTORQUER,
new PoolEntry<float>({15.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_1,
new PoolEntry<float>({15.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_2,
new PoolEntry<float>({15.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::COMPONENT_RW, new PoolEntry<float>({0.0}));
@ -132,13 +120,12 @@ ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode
}
void ThermalController::copySensors() {
PoolReadGuard pg0(&max31865Set0);
if (pg0.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_ploc_heatspreader.value = max31865Set0.temperatureCelcius.value;
sensorTemperatures.sensor_ploc_heatspreader.setValid(max31865Set0.temperatureCelcius.isValid());
}
PoolReadGuard pg1(&max31865Set1);
if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_ploc_missionboard.value = max31865Set1.temperatureCelcius.value;
@ -229,4 +216,22 @@ void ThermalController::copySensors() {
sensorTemperatures.sensor_magnettorquer.value = max31865Set15.temperatureCelcius.value;
sensorTemperatures.sensor_magnettorquer.setValid(max31865Set15.temperatureCelcius.isValid());
}
}
PoolReadGuard pg111(&tmp1075Set1);
if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_tmp1075_1.value = tmp1075Set1.temperatureCelcius.value;
sensorTemperatures.sensor_tmp1075_1.setValid(tmp1075Set1.temperatureCelcius.isValid());
if (not tmp1075Set1.temperatureCelcius.isValid()) {
sensorTemperatures.sensor_tmp1075_1.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg112(&tmp1075Set2);
if (pg2.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_tmp1075_2.value = tmp1075Set2.temperatureCelcius.value;
sensorTemperatures.sensor_tmp1075_2.setValid(tmp1075Set2.temperatureCelcius.isValid());
if (not tmp1075Set2.temperatureCelcius.isValid()) {
sensorTemperatures.sensor_tmp1075_2.value = INVALID_TEMPERATURE;
}
}
}
void ThermalController::copyDevices() {}

View File

@ -4,9 +4,12 @@
#include <fsfw/controller/ExtendedControllerBase.h>
#include <mission/controller/controllerdefinitions/ThermalControllerDefinitions.h>
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
class ThermalController : public ExtendedControllerBase {
public:
static const uint16_t INVALID_TEMPERATURE = 999;
ThermalController(object_id_t objectId, object_id_t parentId);
ReturnValue_t initialize() override;
@ -25,6 +28,7 @@ class ThermalController : public ExtendedControllerBase {
private:
thermalControllerDefinitions::SensorTemperatures sensorTemperatures;
thermalControllerDefinitions::DeviceTemperatures deviceTemperatures;
thermalControllerDefinitions::ComponentTemperatures componentTemperatures;
Max31865Definitions::Max31865Set max31865Set0;
@ -43,8 +47,12 @@ class ThermalController : public ExtendedControllerBase {
Max31865Definitions::Max31865Set max31865Set13;
Max31865Definitions::Max31865Set max31865Set14;
Max31865Definitions::Max31865Set max31865Set15;
TMP1075::Tmp1075Dataset tmp1075Set1;
TMP1075::Tmp1075Dataset tmp1075Set2;
void copySensors();
void copyDevices();
};
#endif /* MISSION_CONTROLLER_THERMALCONTROLLER_H_ */

View File

@ -6,7 +6,7 @@
namespace thermalControllerDefinitions {
enum SetIds : uint32_t { SENSOR_TEMPERATURES, COMPONENT_TEMPERATURES };
enum SetIds : uint32_t { SENSOR_TEMPERATURES, DEVICE_TEMPERATURES, COMPONENT_TEMPERATURES };
enum PoolIds : lp_id_t {
SENSOR_PLOC_HEATSPREADER,
@ -25,13 +25,16 @@ enum PoolIds : lp_id_t {
SENSOR_PLPCDU_HEATSPREADER,
SENSOR_TCS_BOARD,
SENSOR_MAGNETTORQUER,
SENSOR_TMP1075_1,
SENSOR_TMP1075_2,
COMPONENT_RW
};
/**
* @brief This dataset can be used to store the collected temperatures of all temperature sensors
*/
class SensorTemperatures : public StaticLocalDataSet<16> {
class SensorTemperatures : public StaticLocalDataSet<18> {
public:
SensorTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SENSOR_TEMPERATURES) {}
@ -54,6 +57,30 @@ class SensorTemperatures : public StaticLocalDataSet<16> {
lp_var_t<float> sensor_plpcdu_heatspreader = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_PLPCDU_HEATSPREADER, this);
lp_var_t<float> sensor_tcs_board = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_TCS_BOARD, this);
lp_var_t<float> sensor_magnettorquer = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_MAGNETTORQUER, this);
lp_var_t<float> sensor_tmp1075_1 = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_TMP1075_1, this);
lp_var_t<float> sensor_tmp1075_2 = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_TMP1075_2, this);
};
/**
* @brief This dataset can be used to store the collected temperatures of all device temperature sensors
*/
class DeviceTemperatures : public StaticLocalDataSet<18> {
public:
DeviceTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SENSOR_TEMPERATURES) {}
DeviceTemperatures(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, DEVICE_TEMPERATURES)) {}
};
/**
* @brief This dataset can be used to store the collected temperatures of all SUS temperature sensors
*/
class SusTemperatures : public StaticLocalDataSet<18> {
public:
SusTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SENSOR_TEMPERATURES) {}
SusTemperatures(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, DEVICE_TEMPERATURES)) {}
};
/**