v1.12.0 #269

Merged
muellerr merged 493 commits from develop into main 2022-07-04 11:19:05 +02:00
10 changed files with 411 additions and 21 deletions
Showing only changes of commit b878508fec - Show all commits

View File

@ -149,7 +149,11 @@ void initmission::initTasks() {
"THERMAL_CTL_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); "THERMAL_CTL_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = dummyTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER); result = dummyTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("RTD_0", objects::RTD_0_IC3_PLOC_HEATSPREADER); initmission::printAddObjectError("RTD_0_dummy", objects::RTD_0_IC3_PLOC_HEATSPREADER);
}
result = dummyTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SUS_0_dummy", objects::SUS_0_N_LOC_XFYFZM_PT_XF);
} }
#if OBSW_ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1
result = testTask->addComponent(objects::TEST_TASK); result = testTask->addComponent(objects::TEST_TASK);

View File

@ -27,6 +27,7 @@
#endif #endif
#include "dummies/TemperatureSensorsDummy.h" #include "dummies/TemperatureSensorsDummy.h"
#include "dummies/SusDummy.h"
void Factory::setStaticFrameworkObjectIds() { void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
@ -49,6 +50,7 @@ void ObjectFactory::produce(void* args) {
new TemperatureSensorsDummy(); new TemperatureSensorsDummy();
new SusDummy();
new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT); new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT);
//new TestTask(objects::TEST_TASK); //new TestTask(objects::TEST_TASK);

View File

@ -1 +1 @@
target_sources(${OBSW_NAME} PUBLIC TemperatureSensorsDummy.cpp) target_sources(${OBSW_NAME} PUBLIC TemperatureSensorsDummy.cpp SusDummy.cpp)

View File

@ -0,0 +1,82 @@
#include "SusDummy.h"
#include <objects/systemObjectList.h>
#include <cmath>
#include <cstdlib>
SusDummy::SusDummy()
: ExtendedControllerBase(objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::NO_OBJECT),
susSet(this) {
ObjectManager::instance()->insert(objects::SUS_6_R_LOC_XFYBZM_PT_XF, this);
ObjectManager::instance()->insert(objects::SUS_1_N_LOC_XBYFZM_PT_XB, this);
ObjectManager::instance()->insert(objects::SUS_7_R_LOC_XBYBZM_PT_XB, this);
ObjectManager::instance()->insert(objects::SUS_2_N_LOC_XFYBZB_PT_YB, this);
ObjectManager::instance()->insert(objects::SUS_8_R_LOC_XBYBZB_PT_YB, this);
ObjectManager::instance()->insert(objects::SUS_3_N_LOC_XFYBZF_PT_YF, this);
ObjectManager::instance()->insert(objects::SUS_9_R_LOC_XBYBZB_PT_YF, this);
ObjectManager::instance()->insert(objects::SUS_4_N_LOC_XMYFZF_PT_ZF, this);
ObjectManager::instance()->insert(objects::SUS_10_N_LOC_XMYBZF_PT_ZF, this);
ObjectManager::instance()->insert(objects::SUS_5_N_LOC_XFYMZB_PT_ZB, this);
ObjectManager::instance()->insert(objects::SUS_11_R_LOC_XBYMZB_PT_ZB, this);
}
ReturnValue_t SusDummy::initialize() {
static bool done = false;
if (not done) {
done = true;
ReturnValue_t result = ExtendedControllerBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t SusDummy::handleCommandMessage(CommandMessage* message) {
return RETURN_FAILED;
}
void SusDummy::performControlOperation() {
iteration++;
value = sin(iteration / 80. * M_PI + 10) * 10 - 10;
susSet.read();
susSet.temperatureCelcius = value;
if ((iteration % 100) < 20) {
susSet.setValidity(false, true);
} else {
susSet.setValidity(true, true);
}
susSet.commit();
}
ReturnValue_t SusDummy::initializeLocalDataPool(
localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(SUS::SusPoolIds::TEMPERATURE_C,
new PoolEntry<float>({0}, 1, true));
localDataPoolMap.emplace(SUS::SusPoolIds::CHANNEL_VEC, new PoolEntry<uint16_t>({0}));
return RETURN_OK;
}
LocalPoolDataSetBase* SusDummy::getDataSetHandle(sid_t sid) {
switch (sid.ownerSetId) {
case SUS::SUS_DATA_SET_ID:
return &susSet;
default:
return nullptr;
}
}
ReturnValue_t SusDummy::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) {
if (submode != SUBMODE_NONE) {
return INVALID_SUBMODE;
}
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
return INVALID_MODE;
}
return RETURN_OK;
}

View File

@ -0,0 +1,27 @@
#pragma once
#include <fsfw/controller/ExtendedControllerBase.h>
#include <mission/devices/devicedefinitions/SusDefinitions.h>
class SusDummy : public ExtendedControllerBase {
public:
SusDummy();
ReturnValue_t initialize() override;
protected:
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override;
virtual void performControlOperation() override;
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
// Mode abstract functions
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override;
private:
int iteration = 0;
float value = 0;
SUS::SusDataset susSet;
};

View File

@ -51,6 +51,11 @@ void TemperatureSensorsDummy::performControlOperation() {
max31865Set.read(); max31865Set.read();
max31865Set.rtdValue = value - 5; max31865Set.rtdValue = value - 5;
max31865Set.temperatureCelcius = value; max31865Set.temperatureCelcius = value;
if ((iteration % 100) < 20) {
max31865Set.setValidity(false, true);
} else {
max31865Set.setValidity(true, true);
}
max31865Set.commit(); max31865Set.commit();
} }

View File

@ -6,6 +6,7 @@
ThermalController::ThermalController(object_id_t objectId, object_id_t parentId) ThermalController::ThermalController(object_id_t objectId, object_id_t parentId)
: ExtendedControllerBase(objectId, parentId), : ExtendedControllerBase(objectId, parentId),
sensorTemperatures(this), sensorTemperatures(this),
susTemperatures(this),
deviceTemperatures(this), deviceTemperatures(this),
componentTemperatures(this), componentTemperatures(this),
max31865Set0(objects::RTD_0_IC3_PLOC_HEATSPREADER), max31865Set0(objects::RTD_0_IC3_PLOC_HEATSPREADER),
@ -25,7 +26,19 @@ ThermalController::ThermalController(object_id_t objectId, object_id_t parentId)
max31865Set14(objects::RTD_14_IC17_TCS_BOARD), max31865Set14(objects::RTD_14_IC17_TCS_BOARD),
max31865Set15(objects::RTD_15_IC18_IMTQ), max31865Set15(objects::RTD_15_IC18_IMTQ),
tmp1075Set1(objects::TMP1075_HANDLER_1), tmp1075Set1(objects::TMP1075_HANDLER_1),
tmp1075Set2(objects::TMP1075_HANDLER_2) {} tmp1075Set2(objects::TMP1075_HANDLER_2),
susSet0(objects::SUS_0_N_LOC_XFYFZM_PT_XF),
susSet1(objects::SUS_1_N_LOC_XBYFZM_PT_XB),
susSet2(objects::SUS_2_N_LOC_XFYBZB_PT_YB),
susSet3(objects::SUS_3_N_LOC_XFYBZF_PT_YF),
susSet4(objects::SUS_4_N_LOC_XMYFZF_PT_ZF),
susSet5(objects::SUS_5_N_LOC_XFYMZB_PT_ZB),
susSet6(objects::SUS_6_R_LOC_XFYBZM_PT_XF),
susSet7(objects::SUS_7_R_LOC_XBYBZM_PT_XB),
susSet8(objects::SUS_8_R_LOC_XBYBZB_PT_YB),
susSet9(objects::SUS_9_R_LOC_XBYBZB_PT_YF),
susSet10(objects::SUS_10_N_LOC_XMYBZF_PT_ZF),
susSet11(objects::SUS_11_R_LOC_XBYMZB_PT_ZB) {}
ReturnValue_t ThermalController::initialize() { ReturnValue_t ThermalController::initialize() {
auto result = ExtendedControllerBase::initialize(); auto result = ExtendedControllerBase::initialize();
@ -44,6 +57,12 @@ void ThermalController::performControlOperation() {
sensorTemperatures.commit(); sensorTemperatures.commit();
} }
result = susTemperatures.read();
if (result == RETURN_OK) {
copySus();
susTemperatures.commit();
}
result = deviceTemperatures.read(); result = deviceTemperatures.read();
if (result == RETURN_OK) { if (result == RETURN_OK) {
copyDevices(); copyDevices();
@ -54,7 +73,7 @@ void ThermalController::performControlOperation() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
return; return;
} }
componentTemperatures.commit(); componentTemperatures.commit();
} }
@ -90,9 +109,35 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_2, localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_2,
new PoolEntry<float>({15.0})); new PoolEntry<float>({15.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_0_N_LOC_XFYFZM_PT_XF,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_6_R_LOC_XFYBZM_PT_XF,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_1_N_LOC_XBYFZM_PT_XB,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_7_R_LOC_XBYBZM_PT_XB,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_2_N_LOC_XFYBZB_PT_YB,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_8_R_LOC_XBYBZB_PT_YB,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_3_N_LOC_XFYBZF_PT_YF,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_9_R_LOC_XBYBZB_PT_YF,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_4_N_LOC_XMYFZF_PT_ZF,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_10_N_LOC_XMYBZF_PT_ZF,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_5_N_LOC_XFYMZB_PT_ZB,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_11_R_LOC_XBYMZB_PT_ZB,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::COMPONENT_RW, new PoolEntry<float>({0.0})); localDataPoolMap.emplace(thermalControllerDefinitions::COMPONENT_RW, new PoolEntry<float>({0.0}));
poolManager.subscribeForPeriodicPacket(sensorTemperatures.getSid(), true, 1.0, false); poolManager.subscribeForPeriodicPacket(sensorTemperatures.getSid(), true, 1.0, false);
poolManager.subscribeForPeriodicPacket(susTemperatures.getSid(), true, 1.0, false);
return RETURN_OK; return RETURN_OK;
} }
@ -101,8 +146,8 @@ LocalPoolDataSetBase* ThermalController::getDataSetHandle(sid_t sid) {
switch (sid.ownerSetId) { switch (sid.ownerSetId) {
case thermalControllerDefinitions::SENSOR_TEMPERATURES: case thermalControllerDefinitions::SENSOR_TEMPERATURES:
return &sensorTemperatures; return &sensorTemperatures;
case thermalControllerDefinitions::COMPONENT_TEMPERATURES: case thermalControllerDefinitions::SUS_TEMPERATURES:
return &componentTemperatures; return &susTemperatures;
default: default:
return nullptr; return nullptr;
} }
@ -124,78 +169,117 @@ void ThermalController::copySensors() {
if (pg0.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg0.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_ploc_heatspreader.value = max31865Set0.temperatureCelcius.value; sensorTemperatures.sensor_ploc_heatspreader.value = max31865Set0.temperatureCelcius.value;
sensorTemperatures.sensor_ploc_heatspreader.setValid(max31865Set0.temperatureCelcius.isValid()); sensorTemperatures.sensor_ploc_heatspreader.setValid(max31865Set0.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_ploc_heatspreader.isValid()) {
sensorTemperatures.sensor_ploc_heatspreader.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg1(&max31865Set1); PoolReadGuard pg1(&max31865Set1);
if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_ploc_missionboard.value = max31865Set1.temperatureCelcius.value; sensorTemperatures.sensor_ploc_missionboard.value = max31865Set1.temperatureCelcius.value;
sensorTemperatures.sensor_ploc_missionboard.setValid(max31865Set1.temperatureCelcius.isValid()); sensorTemperatures.sensor_ploc_missionboard.setValid(max31865Set1.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_ploc_missionboard.isValid()) {
sensorTemperatures.sensor_ploc_missionboard.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg2(&max31865Set2); PoolReadGuard pg2(&max31865Set2);
if (pg2.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg2.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_4k_camera.value = max31865Set2.temperatureCelcius.value; sensorTemperatures.sensor_4k_camera.value = max31865Set2.temperatureCelcius.value;
sensorTemperatures.sensor_4k_camera.setValid(max31865Set2.temperatureCelcius.isValid()); sensorTemperatures.sensor_4k_camera.setValid(max31865Set2.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_4k_camera.isValid()) {
sensorTemperatures.sensor_4k_camera.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg3(&max31865Set3); PoolReadGuard pg3(&max31865Set3);
if (pg3.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg3.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_dac_heatspreader.value = max31865Set3.temperatureCelcius.value; sensorTemperatures.sensor_dac_heatspreader.value = max31865Set3.temperatureCelcius.value;
sensorTemperatures.sensor_dac_heatspreader.setValid(max31865Set3.temperatureCelcius.isValid()); sensorTemperatures.sensor_dac_heatspreader.setValid(max31865Set3.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_dac_heatspreader.isValid()) {
sensorTemperatures.sensor_dac_heatspreader.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg4(&max31865Set4); PoolReadGuard pg4(&max31865Set4);
if (pg4.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg4.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_startracker.value = max31865Set4.temperatureCelcius.value; sensorTemperatures.sensor_startracker.value = max31865Set4.temperatureCelcius.value;
sensorTemperatures.sensor_startracker.setValid(max31865Set4.temperatureCelcius.isValid()); sensorTemperatures.sensor_startracker.setValid(max31865Set4.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_startracker.isValid()) {
sensorTemperatures.sensor_startracker.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg5(&max31865Set5); PoolReadGuard pg5(&max31865Set5);
if (pg5.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg5.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_rw1.value = max31865Set5.temperatureCelcius.value; sensorTemperatures.sensor_rw1.value = max31865Set5.temperatureCelcius.value;
sensorTemperatures.sensor_rw1.setValid(max31865Set5.temperatureCelcius.isValid()); sensorTemperatures.sensor_rw1.setValid(max31865Set5.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_rw1.isValid()) {
sensorTemperatures.sensor_rw1.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg6(&max31865Set6); PoolReadGuard pg6(&max31865Set6);
if (pg6.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg6.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_dro.value = max31865Set6.temperatureCelcius.value; sensorTemperatures.sensor_dro.value = max31865Set6.temperatureCelcius.value;
sensorTemperatures.sensor_dro.setValid(max31865Set6.temperatureCelcius.isValid()); sensorTemperatures.sensor_dro.setValid(max31865Set6.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_dro.isValid()) {
sensorTemperatures.sensor_dro.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg7(&max31865Set7); PoolReadGuard pg7(&max31865Set7);
if (pg7.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg7.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_scex.value = max31865Set7.temperatureCelcius.value; sensorTemperatures.sensor_scex.value = max31865Set7.temperatureCelcius.value;
sensorTemperatures.sensor_scex.setValid(max31865Set7.temperatureCelcius.isValid()); sensorTemperatures.sensor_scex.setValid(max31865Set7.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_scex.isValid()) {
sensorTemperatures.sensor_scex.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg8(&max31865Set8); PoolReadGuard pg8(&max31865Set8);
if (pg8.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg8.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_x8.value = max31865Set8.temperatureCelcius.value; sensorTemperatures.sensor_x8.value = max31865Set8.temperatureCelcius.value;
sensorTemperatures.sensor_x8.setValid(max31865Set8.temperatureCelcius.isValid()); sensorTemperatures.sensor_x8.setValid(max31865Set8.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_x8.isValid()) {
sensorTemperatures.sensor_x8.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg9(&max31865Set9); PoolReadGuard pg9(&max31865Set9);
if (pg9.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg9.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_hpa.value = max31865Set9.temperatureCelcius.value; sensorTemperatures.sensor_hpa.value = max31865Set9.temperatureCelcius.value;
sensorTemperatures.sensor_hpa.setValid(max31865Set9.temperatureCelcius.isValid()); sensorTemperatures.sensor_hpa.setValid(max31865Set9.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_hpa.isValid()) {
sensorTemperatures.sensor_hpa.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg10(&max31865Set10); PoolReadGuard pg10(&max31865Set10);
if (pg10.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg10.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_tx_modul.value = max31865Set10.temperatureCelcius.value; sensorTemperatures.sensor_tx_modul.value = max31865Set10.temperatureCelcius.value;
sensorTemperatures.sensor_tx_modul.setValid(max31865Set10.temperatureCelcius.isValid()); sensorTemperatures.sensor_tx_modul.setValid(max31865Set10.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_tx_modul.isValid()) {
sensorTemperatures.sensor_tx_modul.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg11(&max31865Set11); PoolReadGuard pg11(&max31865Set11);
if (pg11.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg11.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_mpa.value = max31865Set11.temperatureCelcius.value; sensorTemperatures.sensor_mpa.value = max31865Set11.temperatureCelcius.value;
sensorTemperatures.sensor_mpa.setValid(max31865Set11.temperatureCelcius.isValid()); sensorTemperatures.sensor_mpa.setValid(max31865Set11.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_mpa.isValid()) {
sensorTemperatures.sensor_mpa.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg12(&max31865Set12); PoolReadGuard pg12(&max31865Set12);
if (pg12.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg12.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_acu.value = max31865Set12.temperatureCelcius.value; sensorTemperatures.sensor_acu.value = max31865Set12.temperatureCelcius.value;
sensorTemperatures.sensor_acu.setValid(max31865Set12.temperatureCelcius.isValid()); sensorTemperatures.sensor_acu.setValid(max31865Set12.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_acu.isValid()) {
sensorTemperatures.sensor_acu.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg13(&max31865Set13); PoolReadGuard pg13(&max31865Set13);
@ -203,18 +287,27 @@ void ThermalController::copySensors() {
sensorTemperatures.sensor_plpcdu_heatspreader.value = max31865Set13.temperatureCelcius.value; sensorTemperatures.sensor_plpcdu_heatspreader.value = max31865Set13.temperatureCelcius.value;
sensorTemperatures.sensor_plpcdu_heatspreader.setValid( sensorTemperatures.sensor_plpcdu_heatspreader.setValid(
max31865Set13.temperatureCelcius.isValid()); max31865Set13.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_plpcdu_heatspreader.isValid()) {
sensorTemperatures.sensor_plpcdu_heatspreader.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg14(&max31865Set14); PoolReadGuard pg14(&max31865Set14);
if (pg14.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg14.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_tcs_board.value = max31865Set14.temperatureCelcius.value; sensorTemperatures.sensor_tcs_board.value = max31865Set14.temperatureCelcius.value;
sensorTemperatures.sensor_tcs_board.setValid(max31865Set14.temperatureCelcius.isValid()); sensorTemperatures.sensor_tcs_board.setValid(max31865Set14.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_tcs_board.isValid()) {
sensorTemperatures.sensor_tcs_board.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg15(&max31865Set15); PoolReadGuard pg15(&max31865Set15);
if (pg15.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg15.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
sensorTemperatures.sensor_magnettorquer.value = max31865Set15.temperatureCelcius.value; sensorTemperatures.sensor_magnettorquer.value = max31865Set15.temperatureCelcius.value;
sensorTemperatures.sensor_magnettorquer.setValid(max31865Set15.temperatureCelcius.isValid()); sensorTemperatures.sensor_magnettorquer.setValid(max31865Set15.temperatureCelcius.isValid());
if (not sensorTemperatures.sensor_magnettorquer.isValid()) {
sensorTemperatures.sensor_magnettorquer.value = INVALID_TEMPERATURE;
}
} }
PoolReadGuard pg111(&tmp1075Set1); PoolReadGuard pg111(&tmp1075Set1);
if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
@ -234,4 +327,114 @@ void ThermalController::copySensors() {
} }
} }
void ThermalController::copySus() {
PoolReadGuard pg0(&susSet0);
if (pg0.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.value = susSet0.temperatureCelcius.value;
susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.setValid(susSet0.temperatureCelcius.isValid());
if (not susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.isValid()) {
susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg1(&susSet1);
if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_6_r_loc_xfybzm_pt_xf.value = susSet1.temperatureCelcius.value;
susTemperatures.sus_6_r_loc_xfybzm_pt_xf.setValid(susSet1.temperatureCelcius.isValid());
if (not susTemperatures.sus_6_r_loc_xfybzm_pt_xf.isValid()) {
susTemperatures.sus_6_r_loc_xfybzm_pt_xf.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg2(&susSet2);
if (pg2.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.value = susSet2.temperatureCelcius.value;
susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.setValid(susSet2.temperatureCelcius.isValid());
if (not susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.isValid()) {
susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg3(&susSet3);
if (pg3.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_7_r_loc_xbybzm_pt_xb.value = susSet3.temperatureCelcius.value;
susTemperatures.sus_7_r_loc_xbybzm_pt_xb.setValid(susSet3.temperatureCelcius.isValid());
if (not susTemperatures.sus_7_r_loc_xbybzm_pt_xb.isValid()) {
susTemperatures.sus_7_r_loc_xbybzm_pt_xb.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg4(&susSet4);
if (pg4.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_2_n_loc_xfybzb_pt_yb.value = susSet4.temperatureCelcius.value;
susTemperatures.sus_2_n_loc_xfybzb_pt_yb.setValid(susSet4.temperatureCelcius.isValid());
if (not susTemperatures.sus_2_n_loc_xfybzb_pt_yb.isValid()) {
susTemperatures.sus_2_n_loc_xfybzb_pt_yb.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg5(&susSet5);
if (pg5.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_8_r_loc_xbybzb_pt_yb.value = susSet5.temperatureCelcius.value;
susTemperatures.sus_8_r_loc_xbybzb_pt_yb.setValid(susSet5.temperatureCelcius.isValid());
if (not susTemperatures.sus_8_r_loc_xbybzb_pt_yb.isValid()) {
susTemperatures.sus_8_r_loc_xbybzb_pt_yb.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg6(&susSet6);
if (pg6.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_3_n_loc_xfybzf_pt_yf.value = susSet6.temperatureCelcius.value;
susTemperatures.sus_3_n_loc_xfybzf_pt_yf.setValid(susSet6.temperatureCelcius.isValid());
if (not susTemperatures.sus_3_n_loc_xfybzf_pt_yf.isValid()) {
susTemperatures.sus_3_n_loc_xfybzf_pt_yf.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg7(&susSet7);
if (pg7.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_9_r_loc_xbybzb_pt_yf.value = susSet7.temperatureCelcius.value;
susTemperatures.sus_9_r_loc_xbybzb_pt_yf.setValid(susSet7.temperatureCelcius.isValid());
if (not susTemperatures.sus_9_r_loc_xbybzb_pt_yf.isValid()) {
susTemperatures.sus_9_r_loc_xbybzb_pt_yf.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg8(&susSet8);
if (pg8.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.value = susSet8.temperatureCelcius.value;
susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.setValid(susSet8.temperatureCelcius.isValid());
if (not susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.isValid()) {
susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg9(&susSet9);
if (pg9.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_10_n_loc_xmybzf_pt_zf.value = susSet9.temperatureCelcius.value;
susTemperatures.sus_10_n_loc_xmybzf_pt_zf.setValid(susSet9.temperatureCelcius.isValid());
if (not susTemperatures.sus_10_n_loc_xmybzf_pt_zf.isValid()) {
susTemperatures.sus_10_n_loc_xmybzf_pt_zf.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg10(&susSet10);
if (pg10.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_5_n_loc_xfymzb_pt_zb.value = susSet10.temperatureCelcius.value;
susTemperatures.sus_5_n_loc_xfymzb_pt_zb.setValid(susSet10.temperatureCelcius.isValid());
if (not susTemperatures.sus_5_n_loc_xfymzb_pt_zb.isValid()) {
susTemperatures.sus_5_n_loc_xfymzb_pt_zb.value = INVALID_TEMPERATURE;
}
}
PoolReadGuard pg11(&susSet11);
if (pg11.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
susTemperatures.sus_11_r_loc_xbymzb_pt_zb.value = susSet11.temperatureCelcius.value;
susTemperatures.sus_11_r_loc_xbymzb_pt_zb.setValid(susSet11.temperatureCelcius.isValid());
if (not susTemperatures.sus_11_r_loc_xbymzb_pt_zb.isValid()) {
susTemperatures.sus_11_r_loc_xbymzb_pt_zb.value = INVALID_TEMPERATURE;
}
}
}
void ThermalController::copyDevices() {} void ThermalController::copyDevices() {}

View File

@ -4,6 +4,7 @@
#include <fsfw/controller/ExtendedControllerBase.h> #include <fsfw/controller/ExtendedControllerBase.h>
#include <mission/controller/controllerdefinitions/ThermalControllerDefinitions.h> #include <mission/controller/controllerdefinitions/ThermalControllerDefinitions.h>
#include <mission/devices/devicedefinitions/Max31865Definitions.h> #include <mission/devices/devicedefinitions/Max31865Definitions.h>
#include <mission/devices/devicedefinitions/SusDefinitions.h>
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h> #include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
class ThermalController : public ExtendedControllerBase { class ThermalController : public ExtendedControllerBase {
@ -13,7 +14,6 @@ class ThermalController : public ExtendedControllerBase {
ThermalController(object_id_t objectId, object_id_t parentId); ThermalController(object_id_t objectId, object_id_t parentId);
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
protected: protected:
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override; virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override;
@ -28,9 +28,11 @@ class ThermalController : public ExtendedControllerBase {
private: private:
thermalControllerDefinitions::SensorTemperatures sensorTemperatures; thermalControllerDefinitions::SensorTemperatures sensorTemperatures;
thermalControllerDefinitions::SusTemperatures susTemperatures;
thermalControllerDefinitions::DeviceTemperatures deviceTemperatures; thermalControllerDefinitions::DeviceTemperatures deviceTemperatures;
thermalControllerDefinitions::ComponentTemperatures componentTemperatures; thermalControllerDefinitions::ComponentTemperatures componentTemperatures;
// Temperature Sensors
Max31865Definitions::Max31865Set max31865Set0; Max31865Definitions::Max31865Set max31865Set0;
Max31865Definitions::Max31865Set max31865Set1; Max31865Definitions::Max31865Set max31865Set1;
Max31865Definitions::Max31865Set max31865Set2; Max31865Definitions::Max31865Set max31865Set2;
@ -50,8 +52,22 @@ class ThermalController : public ExtendedControllerBase {
TMP1075::Tmp1075Dataset tmp1075Set1; TMP1075::Tmp1075Dataset tmp1075Set1;
TMP1075::Tmp1075Dataset tmp1075Set2; TMP1075::Tmp1075Dataset tmp1075Set2;
void copySensors(); // SUS
SUS::SusDataset susSet0;
SUS::SusDataset susSet1;
SUS::SusDataset susSet2;
SUS::SusDataset susSet3;
SUS::SusDataset susSet4;
SUS::SusDataset susSet5;
SUS::SusDataset susSet6;
SUS::SusDataset susSet7;
SUS::SusDataset susSet8;
SUS::SusDataset susSet9;
SUS::SusDataset susSet10;
SUS::SusDataset susSet11;
void copySensors();
void copySus();
void copyDevices(); void copyDevices();
}; };

View File

@ -6,7 +6,12 @@
namespace thermalControllerDefinitions { namespace thermalControllerDefinitions {
enum SetIds : uint32_t { SENSOR_TEMPERATURES, DEVICE_TEMPERATURES, COMPONENT_TEMPERATURES }; enum SetIds : uint32_t {
SENSOR_TEMPERATURES,
DEVICE_TEMPERATURES,
SUS_TEMPERATURES,
COMPONENT_TEMPERATURES
};
enum PoolIds : lp_id_t { enum PoolIds : lp_id_t {
SENSOR_PLOC_HEATSPREADER, SENSOR_PLOC_HEATSPREADER,
@ -28,6 +33,19 @@ enum PoolIds : lp_id_t {
SENSOR_TMP1075_1, SENSOR_TMP1075_1,
SENSOR_TMP1075_2, SENSOR_TMP1075_2,
SUS_0_N_LOC_XFYFZM_PT_XF,
SUS_6_R_LOC_XFYBZM_PT_XF,
SUS_1_N_LOC_XBYFZM_PT_XB,
SUS_7_R_LOC_XBYBZM_PT_XB,
SUS_2_N_LOC_XFYBZB_PT_YB,
SUS_8_R_LOC_XBYBZB_PT_YB,
SUS_3_N_LOC_XFYBZF_PT_YF,
SUS_9_R_LOC_XBYBZB_PT_YF,
SUS_4_N_LOC_XMYFZF_PT_ZF,
SUS_10_N_LOC_XMYBZF_PT_ZF,
SUS_5_N_LOC_XFYMZB_PT_ZB,
SUS_11_R_LOC_XBYMZB_PT_ZB,
COMPONENT_RW COMPONENT_RW
}; };
@ -41,11 +59,15 @@ class SensorTemperatures : public StaticLocalDataSet<18> {
SensorTemperatures(object_id_t objectId) SensorTemperatures(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, SENSOR_TEMPERATURES)) {} : StaticLocalDataSet(sid_t(objectId, SENSOR_TEMPERATURES)) {}
lp_var_t<float> sensor_ploc_heatspreader = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_PLOC_HEATSPREADER, this); lp_var_t<float> sensor_ploc_heatspreader =
lp_var_t<float> sensor_ploc_missionboard = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_PLOC_MISSIONBOARD, this); lp_var_t<float>(sid.objectId, PoolIds::SENSOR_PLOC_HEATSPREADER, this);
lp_var_t<float> sensor_ploc_missionboard =
lp_var_t<float>(sid.objectId, PoolIds::SENSOR_PLOC_MISSIONBOARD, this);
lp_var_t<float> sensor_4k_camera = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_4K_CAMERA, this); lp_var_t<float> sensor_4k_camera = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_4K_CAMERA, this);
lp_var_t<float> sensor_dac_heatspreader = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_DAC_HEATSPREADER, this); lp_var_t<float> sensor_dac_heatspreader =
lp_var_t<float> sensor_startracker = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_STARTRACKER, this); lp_var_t<float>(sid.objectId, PoolIds::SENSOR_DAC_HEATSPREADER, this);
lp_var_t<float> sensor_startracker =
lp_var_t<float>(sid.objectId, PoolIds::SENSOR_STARTRACKER, this);
lp_var_t<float> sensor_rw1 = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_RW1, this); lp_var_t<float> sensor_rw1 = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_RW1, this);
lp_var_t<float> sensor_dro = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_DRO, this); lp_var_t<float> sensor_dro = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_DRO, this);
lp_var_t<float> sensor_scex = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_SCEX, this); lp_var_t<float> sensor_scex = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_SCEX, this);
@ -54,17 +76,20 @@ class SensorTemperatures : public StaticLocalDataSet<18> {
lp_var_t<float> sensor_tx_modul = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_TX_MODUL, this); lp_var_t<float> sensor_tx_modul = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_TX_MODUL, this);
lp_var_t<float> sensor_mpa = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_MPA, this); lp_var_t<float> sensor_mpa = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_MPA, this);
lp_var_t<float> sensor_acu = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_ACU, this); lp_var_t<float> sensor_acu = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_ACU, this);
lp_var_t<float> sensor_plpcdu_heatspreader = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_PLPCDU_HEATSPREADER, this); 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_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_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_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); 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 * @brief This dataset can be used to store the collected temperatures of all device temperature
* sensors
*/ */
class DeviceTemperatures : public StaticLocalDataSet<18> { class DeviceTemperatures : public StaticLocalDataSet<1> {
public: public:
DeviceTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SENSOR_TEMPERATURES) {} DeviceTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SENSOR_TEMPERATURES) {}
@ -73,14 +98,40 @@ class DeviceTemperatures : public StaticLocalDataSet<18> {
}; };
/** /**
* @brief This dataset can be used to store the collected temperatures of all SUS temperature sensors * @brief This dataset can be used to store the collected temperatures of all SUS temperature
* sensors
*/ */
class SusTemperatures : public StaticLocalDataSet<18> { class SusTemperatures : public StaticLocalDataSet<12> {
public: public:
SusTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SENSOR_TEMPERATURES) {} SusTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SUS_TEMPERATURES) {}
SusTemperatures(object_id_t objectId) SusTemperatures(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, DEVICE_TEMPERATURES)) {} : StaticLocalDataSet(sid_t(objectId, DEVICE_TEMPERATURES)) {}
lp_var_t<float> sus_0_n_loc_xfyfzm_pt_xf =
lp_var_t<float>(sid.objectId, PoolIds::SUS_0_N_LOC_XFYFZM_PT_XF, this);
lp_var_t<float> sus_6_r_loc_xfybzm_pt_xf =
lp_var_t<float>(sid.objectId, PoolIds::SUS_6_R_LOC_XFYBZM_PT_XF, this);
lp_var_t<float> sus_1_n_loc_xbyfzm_pt_xb =
lp_var_t<float>(sid.objectId, PoolIds::SUS_1_N_LOC_XBYFZM_PT_XB, this);
lp_var_t<float> sus_7_r_loc_xbybzm_pt_xb =
lp_var_t<float>(sid.objectId, PoolIds::SUS_7_R_LOC_XBYBZM_PT_XB, this);
lp_var_t<float> sus_2_n_loc_xfybzb_pt_yb =
lp_var_t<float>(sid.objectId, PoolIds::SUS_2_N_LOC_XFYBZB_PT_YB, this);
lp_var_t<float> sus_8_r_loc_xbybzb_pt_yb =
lp_var_t<float>(sid.objectId, PoolIds::SUS_8_R_LOC_XBYBZB_PT_YB, this);
lp_var_t<float> sus_3_n_loc_xfybzf_pt_yf =
lp_var_t<float>(sid.objectId, PoolIds::SUS_3_N_LOC_XFYBZF_PT_YF, this);
lp_var_t<float> sus_9_r_loc_xbybzb_pt_yf =
lp_var_t<float>(sid.objectId, PoolIds::SUS_9_R_LOC_XBYBZB_PT_YF, this);
lp_var_t<float> sus_4_n_loc_xmyfzf_pt_zf =
lp_var_t<float>(sid.objectId, PoolIds::SUS_4_N_LOC_XMYFZF_PT_ZF, this);
lp_var_t<float> sus_10_n_loc_xmybzf_pt_zf =
lp_var_t<float>(sid.objectId, PoolIds::SUS_10_N_LOC_XMYBZF_PT_ZF, this);
lp_var_t<float> sus_5_n_loc_xfymzb_pt_zb =
lp_var_t<float>(sid.objectId, PoolIds::SUS_5_N_LOC_XFYMZB_PT_ZB, this);
lp_var_t<float> sus_11_r_loc_xbymzb_pt_zb =
lp_var_t<float>(sid.objectId, PoolIds::SUS_11_R_LOC_XBYMZB_PT_ZB, this);
}; };
/** /**

View File

@ -61,7 +61,7 @@ static const uint8_t MAX_CMD_SIZE = 32;
static const uint8_t POOL_ENTRIES = 7; static const uint8_t POOL_ENTRIES = 7;
enum Max1227PoolIds : lp_id_t { TEMPERATURE_C, CHANNEL_VEC }; enum SusPoolIds : lp_id_t { TEMPERATURE_C, CHANNEL_VEC };
class SusDataset : public StaticLocalDataSet<POOL_ENTRIES> { class SusDataset : public StaticLocalDataSet<POOL_ENTRIES> {
public: public: