some thermal controller code to test TM chain
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Ulrich Mohr 2022-05-19 00:40:42 +02:00
parent ee99c3312e
commit 90a92feee1
8 changed files with 153 additions and 32 deletions

View File

@ -89,9 +89,13 @@ void initmission::initTasks() {
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
PeriodicTaskIF* eventHandling = factory->createPeriodicTask(
"EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = eventHandling->addComponent(objects::EVENT_MANAGER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("EVENT_MNGR", objects::EVENT_MANAGER);
}
result = eventHandling->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
@ -106,6 +110,10 @@ void initmission::initTasks() {
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
@ -129,9 +137,12 @@ void initmission::initTasks() {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
PeriodicTaskIF* testTask = factory->createPeriodicTask(
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
static_cast<void>(testTask);
PeriodicTaskIF* thermalControllerTask = factory->createPeriodicTask(
"THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = thermalControllerTask->addComponent(objects::THERMAL_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
}
#if OBSW_ADD_TEST_CODE == 1
result = testTask->addComponent(objects::TEST_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
@ -145,11 +156,13 @@ void initmission::initTasks() {
tmtcPollingTask->startTask();
pusVerification->startTask();
pusEvents->startTask();
eventHandling->startTask();
pusHighPrio->startTask();
pusMedPrio->startTask();
pusLowPrio->startTask();
thermalControllerTask->startTask();
#if OBSW_ADD_TEST_CODE == 1
testTask->startTask();
#endif /* OBSW_ADD_TEST_CODE == 1 */

View File

@ -4,6 +4,7 @@
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <mission/core/GenericFactory.h>
#include <mission/utility/TmFunnel.h>
#include <mission/controller/ThermalController.h>
#include <objects/systemObjectList.h>
#include <tmtc/apid.h>
#include <tmtc/pusIds.h>
@ -44,5 +45,7 @@ void ObjectFactory::produce(void* args) {
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
new TestTask(objects::TEST_TASK);
new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT);
//new TestTask(objects::TEST_TASK);
}

View File

@ -7,41 +7,41 @@
//! Used to determine whether C++ ostreams are used which can increase
//! the binary size significantly. If this is disabled,
//! the C stdio functions can be used alternatively
#define FSFW_CPP_OSTREAM_ENABLED 1
#define FSFW_CPP_OSTREAM_ENABLED 1
//! More FSFW related printouts depending on level. Useful for development.
#define FSFW_VERBOSE_LEVEL 1
#define FSFW_VERBOSE_LEVEL 1
//! Can be used to completely disable printouts, even the C stdio ones.
#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0
#define FSFW_DISABLE_PRINTOUT 0
#define FSFW_DISABLE_PRINTOUT 0
#endif
#define FSFW_USE_PUS_C_TELEMETRY 1
#define FSFW_USE_PUS_C_TELEMETRY 1
#define FSFW_USE_PUS_C_TELECOMMANDS 1
//! Can be used to disable the ANSI color sequences for C stdio.
#define FSFW_COLORED_OUTPUT 1
#define FSFW_COLORED_OUTPUT 1
//! If FSFW_OBJ_EVENT_TRANSLATION is set to one,
//! additional output which requires the translation files translateObjects
//! and translateEvents (and their compiled source files)
#define FSFW_OBJ_EVENT_TRANSLATION 1
#define FSFW_OBJ_EVENT_TRANSLATION 1
#if FSFW_OBJ_EVENT_TRANSLATION == 1
//! Specify whether info events are printed too.
#define FSFW_DEBUG_INFO 1
#include "objects/translateObjects.h"
#define FSFW_DEBUG_INFO 1
#include "events/translateEvents.h"
#include "objects/translateObjects.h"
#else
#endif
//! When using the newlib nano library, C99 support for stdio facilities
//! will not be provided. This define should be set to 1 if this is the case.
#define FSFW_NO_C99_IO 1
#define FSFW_NO_C99_IO 1
//! Specify whether a special mode store is used for Subsystem components.
#define FSFW_USE_MODESTORE 0
#define FSFW_USE_MODESTORE 0
//! Defines if the real time scheduler for linux should be used.
//! If set to 0, this will also disable priority settings for linux
@ -58,7 +58,7 @@ static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7;
//! Configure the allocated pool sizes for the event manager.
static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240;
static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120;
static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
//! Defines the FIFO depth of each commanding service base which
//! also determines how many commands a CSB service can handle in one cycle
@ -70,6 +70,6 @@ static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
}
} // namespace fsfwconfig
#endif /* CONFIG_FSFWCONFIG_H_ */

View File

@ -5,6 +5,7 @@
* Generated on: 2021-05-17 19:12:49
*/
#include "translateObjects.h"
#include "systemObjectList.h"
const char *TEST_TASK_STRING = "TEST_TASK";
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
@ -36,6 +37,7 @@ const char *IPC_STORE_STRING = "IPC_STORE";
const char *TIME_STAMPER_STRING = "TIME_STAMPER";
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
const char *NO_OBJECT_STRING = "NO_OBJECT";
const char *translateObject(object_id_t object) {
@ -100,6 +102,8 @@ const char *translateObject(object_id_t object) {
return FSFW_OBJECTS_END_STRING;
case 0xCAFECAFE:
return DUMMY_INTERFACE_STRING;
case objects::THERMAL_CONTROLLER:
return THERMAL_CONTROLLER_STRING;
case 0xFFFFFFFF:
return NO_OBJECT_STRING;
default:

View File

@ -1,9 +1,17 @@
#include <objects/systemObjectList.h>
#include <iostream>
#include "InitMission.h"
#include "commonConfig.h"
#include "fsfw/FSFWVersion.h"
#include "fsfw/controller/ControllerBase.h"
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/modes/HasModesIF.h"
#include "fsfw/modes/ModeMessage.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/tasks/TaskFactory.h"
#ifdef WIN32
static const char* COMPILE_PRINTOUT = "Windows";
#elif LINUX

View File

@ -5,7 +5,11 @@ ThermalController::ThermalController(object_id_t objectId, object_id_t parentId)
sensorTemperatures(this),
componentTemperatures(this) {}
ReturnValue_t ThermalController::initialize() { return ControllerBase::initialize(); }
ReturnValue_t ThermalController::initialize() {
auto result = ExtendedControllerBase::initialize();
return result;
}
ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) {
return RETURN_FAILED;
@ -20,7 +24,28 @@ void ThermalController::performControlOperation() {
return;
}
componentTemperatures.rw = (sensorTemperatures.rw.value + sensorTemperatures.gps.value) / 2;
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();
@ -28,13 +53,49 @@ void ThermalController::performControlOperation() {
ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_RW, new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_GPS, new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_PLOC_HEATSPREADER,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_PLOC_MISSIONBOARD,
new PoolEntry<float>({1.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_4K_CAMERA,
new PoolEntry<float>({2.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_DAC_HEATSPREADER,
new PoolEntry<float>({3.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_STARTRACKER,
new PoolEntry<float>({4.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_RW1, new PoolEntry<float>({5.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_DRO, new PoolEntry<float>({6.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_SCEX, new PoolEntry<float>({7.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_X8, new PoolEntry<float>({8.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_HPA, new PoolEntry<float>({9.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TX_MODUL,
new PoolEntry<float>({10.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MPA, new PoolEntry<float>({11.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_ACU, new PoolEntry<float>({12.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_PLPCDU_HEATSPREADER,
new PoolEntry<float>({13.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TCS_BOARD,
new PoolEntry<float>({14.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MAGNETTORQUER,
new PoolEntry<float>({15.0}));
localDataPoolMap.emplace(thermalControllerDefinitions::COMPONENT_RW, new PoolEntry<float>({0.0}));
poolManager.subscribeForPeriodicPacket(sensorTemperatures.getSid(), true, 1.0, false);
return RETURN_OK;
}
LocalPoolDataSetBase* ThermalController::getDataSetHandle(sid_t sid) { return nullptr; }
LocalPoolDataSetBase* ThermalController::getDataSetHandle(sid_t sid) {
switch (sid.ownerSetId) {
case thermalControllerDefinitions::SENSOR_TEMPERATURES:
return &sensorTemperatures;
case thermalControllerDefinitions::COMPONENT_TEMPERATURES:
return &componentTemperatures;
default:
return nullptr;
}
}
ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) {

View File

@ -21,7 +21,7 @@ class ThermalController : public ExtendedControllerBase {
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override;
private:
private:
thermalControllerDefinitions::SensorTemperatures sensorTemperatures;
thermalControllerDefinitions::ComponentTemperatures componentTemperatures;
};

View File

@ -8,20 +8,52 @@ namespace thermalControllerDefinitions {
enum SetIds : uint32_t { SENSOR_TEMPERATURES, COMPONENT_TEMPERATURES };
enum PoolIds : lp_id_t { SENSOR_RW, SENSOR_GPS, COMPONENT_RW };
enum PoolIds : lp_id_t {
SENSOR_PLOC_HEATSPREADER,
SENSOR_PLOC_MISSIONBOARD,
SENSOR_4K_CAMERA,
SENSOR_DAC_HEATSPREADER,
SENSOR_STARTRACKER,
SENSOR_RW1,
SENSOR_DRO,
SENSOR_SCEX,
SENSOR_X8,
SENSOR_HPA,
SENSOR_TX_MODUL,
SENSOR_MPA,
SENSOR_ACU,
SENSOR_PLPCDU_HEATSPREADER,
SENSOR_TCS_BOARD,
SENSOR_MAGNETTORQUER,
COMPONENT_RW
};
/**
* @brief This dataset can be used to store the collected temperatures of all temperature sensors
*/
class SensorTemperatures : public StaticLocalDataSet<2> {
class SensorTemperatures : public StaticLocalDataSet<16> {
public:
SensorTemperatures(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SENSOR_TEMPERATURES) {}
SensorTemperatures(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, SENSOR_TEMPERATURES)) {}
lp_var_t<float> rw = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_RW, this);
lp_var_t<float> gps = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_GPS, this);
lp_var_t<float> sensor_ploc_heatspreader = 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_dac_heatspreader = 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_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_x8 = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_X8, this);
lp_var_t<float> sensor_hpa = lp_var_t<float>(sid.objectId, PoolIds::SENSOR_HPA, 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_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_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);
};
/**
@ -30,10 +62,10 @@ class SensorTemperatures : public StaticLocalDataSet<2> {
class ComponentTemperatures : public StaticLocalDataSet<2> {
public:
ComponentTemperatures(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, SENSOR_TEMPERATURES) {}
: StaticLocalDataSet(owner, COMPONENT_TEMPERATURES) {}
ComponentTemperatures(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, SENSOR_TEMPERATURES)) {}
: StaticLocalDataSet(sid_t(objectId, COMPONENT_TEMPERATURES)) {}
lp_var_t<float> rw = lp_var_t<float>(sid.objectId, PoolIds::COMPONENT_RW, this);
};