we need a dummy heater handler
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
parent
17a336ba0a
commit
f932c4c2c5
@ -45,8 +45,8 @@
|
||||
#include <dummies/StarTrackerDummy.h>
|
||||
#include <dummies/SusDummy.h>
|
||||
#include <dummies/SyrlinksDummy.h>
|
||||
#include <dummies/TemperatureSensorsDummy.h>
|
||||
|
||||
#include "../dummies/TemperatureSensorInserter.h"
|
||||
#include "dummies/helpers.h"
|
||||
#include "mission/utility/GlobalConfigHandler.h"
|
||||
|
||||
|
@ -24,7 +24,8 @@ enum sourceObjects : uint32_t {
|
||||
/* 0x49 ('I') for Communication Interfaces **/
|
||||
ARDUINO_COM_IF = 0x49000001,
|
||||
|
||||
DUMMY_COM_IF = 0x49000002
|
||||
DUMMY_COM_IF = 0x49000002,
|
||||
THERMAL_TEMP_INSERTER = 0x49000003,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
target_sources(
|
||||
${LIB_DUMMIES}
|
||||
PUBLIC TemperatureSensorsDummy.cpp
|
||||
PUBLIC TemperatureSensorInserter.cpp
|
||||
SusDummy.cpp
|
||||
BpxDummy.cpp
|
||||
ComIFDummy.cpp
|
||||
|
37
dummies/TemperatureSensorInserter.cpp
Normal file
37
dummies/TemperatureSensorInserter.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "TemperatureSensorInserter.h"
|
||||
|
||||
#include <objects/systemObjectList.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
TemperatureSensorInserter::TemperatureSensorInserter(object_id_t objectId)
|
||||
: SystemObject(objects::THERMAL_CONTROLLER),
|
||||
max31865PlocHeatspreaderSet(objects::RTD_0_IC3_PLOC_HEATSPREADER, MAX31865::MAX31865_SET_ID),
|
||||
max31865PlocMissionboardSet(objects::RTD_1_IC4_PLOC_MISSIONBOARD, MAX31865::MAX31865_SET_ID) {
|
||||
}
|
||||
|
||||
ReturnValue_t TemperatureSensorInserter::initialize() {
|
||||
max31865PlocHeatspreaderSet.temperatureCelcius = 20.0;
|
||||
max31865PlocMissionboardSet.temperatureCelcius = 20.0;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t TemperatureSensorInserter::performOperation(uint8_t opCode) {
|
||||
iteration++;
|
||||
value = sin(iteration / 80. * M_PI) * 10;
|
||||
|
||||
ReturnValue_t result = max31865PlocHeatspreaderSet.read();
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "Failed to read temperature from MAX31865 dataset" << std::endl;
|
||||
}
|
||||
max31865PlocHeatspreaderSet.rtdValue = value - 5;
|
||||
max31865PlocHeatspreaderSet.temperatureCelcius = value;
|
||||
if ((iteration % 100) < 20) {
|
||||
max31865PlocHeatspreaderSet.setValidity(false, true);
|
||||
} else {
|
||||
max31865PlocHeatspreaderSet.setValidity(true, true);
|
||||
}
|
||||
max31865PlocHeatspreaderSet.commit();
|
||||
return returnvalue::OK;
|
||||
}
|
22
dummies/TemperatureSensorInserter.h
Normal file
22
dummies/TemperatureSensorInserter.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
|
||||
|
||||
class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject {
|
||||
public:
|
||||
TemperatureSensorInserter(object_id_t objectId);
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
protected:
|
||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||
|
||||
private:
|
||||
int iteration = 0;
|
||||
float value = 0;
|
||||
MAX31865::Max31865Set max31865PlocHeatspreaderSet;
|
||||
MAX31865::Max31865Set max31865PlocMissionboardSet;
|
||||
|
||||
void noise();
|
||||
};
|
@ -1,106 +0,0 @@
|
||||
#include "TemperatureSensorsDummy.h"
|
||||
|
||||
#include <objects/systemObjectList.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
TemperatureSensorsDummy::TemperatureSensorsDummy()
|
||||
: ExtendedControllerBase(objects::RTD_0_IC3_PLOC_HEATSPREADER),
|
||||
max31865PlocHeatspreaderSet(objects::RTD_0_IC3_PLOC_HEATSPREADER, MAX31865::MAX31865_SET_ID),
|
||||
max31865PlocMissionboardSet(objects::RTD_1_IC4_PLOC_MISSIONBOARD, MAX31865::MAX31865_SET_ID) {
|
||||
ObjectManager::instance()->insert(objects::RTD_1_IC4_PLOC_MISSIONBOARD, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_2_IC5_4K_CAMERA, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_3_IC6_DAC_HEATSPREADER, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_4_IC7_STARTRACKER, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_5_IC8_RW1_MX_MY, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_6_IC9_DRO, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_7_IC10_SCEX, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_8_IC11_X8, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_9_IC12_HPA, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_10_IC13_PL_TX, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_11_IC14_MPA, this);
|
||||
ObjectManager::instance()->insert(objects::RTD_12_IC15_ACU, this);
|
||||
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_TCS_0, this);
|
||||
ObjectManager::instance()->insert(objects::TMP1075_HANDLER_TCS_1, this);
|
||||
|
||||
ObjectManager::instance()->insert(objects::TMP1075_HANDLER_PLPCDU_0, this);
|
||||
ObjectManager::instance()->insert(objects::TMP1075_HANDLER_PLPCDU_1, this);
|
||||
ObjectManager::instance()->insert(objects::TMP1075_HANDLER_IF_BOARD, this);
|
||||
}
|
||||
|
||||
ReturnValue_t TemperatureSensorsDummy::initialize() {
|
||||
static bool done = false;
|
||||
if (not done) {
|
||||
done = true;
|
||||
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
max31865PlocHeatspreaderSet.temperatureCelcius = 20.0;
|
||||
max31865PlocMissionboardSet.temperatureCelcius = 20.0;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t TemperatureSensorsDummy::handleCommandMessage(CommandMessage* message) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
void TemperatureSensorsDummy::performControlOperation() {
|
||||
iteration++;
|
||||
value = sin(iteration / 80. * M_PI) * 10;
|
||||
|
||||
ReturnValue_t result = max31865PlocHeatspreaderSet.read();
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "Failed to read temperature from MAX31865 dataset" << std::endl;
|
||||
}
|
||||
max31865PlocHeatspreaderSet.rtdValue = value - 5;
|
||||
max31865PlocHeatspreaderSet.temperatureCelcius = value;
|
||||
if ((iteration % 100) < 20) {
|
||||
max31865PlocHeatspreaderSet.setValidity(false, true);
|
||||
} else {
|
||||
max31865PlocHeatspreaderSet.setValidity(true, true);
|
||||
}
|
||||
max31865PlocHeatspreaderSet.commit();
|
||||
}
|
||||
|
||||
ReturnValue_t TemperatureSensorsDummy::initializeLocalDataPool(
|
||||
localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) {
|
||||
localDataPoolMap.emplace(static_cast<lp_id_t>(MAX31865::PoolIds::RTD_VALUE),
|
||||
new PoolEntry<float>({0}));
|
||||
localDataPoolMap.emplace(static_cast<lp_id_t>(MAX31865::PoolIds::TEMPERATURE_C),
|
||||
new PoolEntry<float>({0}));
|
||||
localDataPoolMap.emplace(static_cast<lp_id_t>(MAX31865::PoolIds::LAST_FAULT_BYTE),
|
||||
new PoolEntry<uint8_t>({0}));
|
||||
localDataPoolMap.emplace(static_cast<lp_id_t>(MAX31865::PoolIds::FAULT_BYTE),
|
||||
new PoolEntry<uint8_t>({0}));
|
||||
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase* TemperatureSensorsDummy::getDataSetHandle(sid_t sid) {
|
||||
sif::debug << "getHandle" << std::endl;
|
||||
if (sid.objectId == objects::RTD_0_IC3_PLOC_HEATSPREADER) {
|
||||
return &max31865PlocHeatspreaderSet;
|
||||
} else if (sid.objectId == objects::RTD_1_IC4_PLOC_MISSIONBOARD) {
|
||||
return &max31865PlocMissionboardSet;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t TemperatureSensorsDummy::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 returnvalue::OK;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
|
||||
|
||||
class TemperatureSensorsDummy : public ExtendedControllerBase {
|
||||
public:
|
||||
TemperatureSensorsDummy();
|
||||
|
||||
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;
|
||||
MAX31865::Max31865Set max31865PlocHeatspreaderSet;
|
||||
MAX31865::Max31865Set max31865PlocMissionboardSet;
|
||||
|
||||
void noise();
|
||||
};
|
@ -18,9 +18,10 @@
|
||||
#include <dummies/StarTrackerDummy.h>
|
||||
#include <dummies/SusDummy.h>
|
||||
#include <dummies/SyrlinksDummy.h>
|
||||
#include <dummies/TemperatureSensorsDummy.h>
|
||||
#include <mission/system/objects/CamSwitcher.h>
|
||||
|
||||
#include "TemperatureSensorInserter.h"
|
||||
|
||||
using namespace dummy;
|
||||
|
||||
void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
|
||||
@ -66,7 +67,7 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
|
||||
}
|
||||
|
||||
if (cfg.addTempSensorDummies) {
|
||||
new TemperatureSensorsDummy();
|
||||
new TemperatureSensorInserter(objects::THERMAL_TEMP_INSERTER);
|
||||
}
|
||||
new CamSwitcher(objects::CAM_SWITCHER, pwrSwitch, power::NO_SWITCH);
|
||||
new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
ThermalController::ThermalController(object_id_t objectId, HeaterHandler& heater)
|
||||
: ExtendedControllerBase(objectId),
|
||||
heater(heater),
|
||||
heaterHandler(heater),
|
||||
sensorTemperatures(this),
|
||||
susTemperatures(this),
|
||||
deviceTemperatures(this),
|
||||
|
@ -8,20 +8,25 @@
|
||||
#include <mission/devices/devicedefinitions/SusDefinitions.h>
|
||||
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
|
||||
|
||||
#include "../devices/HeaterHandler.h"
|
||||
|
||||
/**
|
||||
* NOP Limit: Hard limit for device, usually from datasheet. Device damage is possible lif NOP limit
|
||||
* is exceeded.
|
||||
* OP Limit: Soft limit. Device should be switched off or TCS controller should take action if the limit
|
||||
* is exceeded to avoid reaching NOP limit
|
||||
* OP Limit: Soft limit. Device should be switched off or TCS controller should take action if the
|
||||
* limit is exceeded to avoid reaching NOP limit
|
||||
*/
|
||||
struct TempLimits {
|
||||
TempLimits(float nopLowerLimit, float opLowerLimit, float opUpperLimit, float nopUpperLimit) : opLowerLimit(opLowerLimit), opUpperLimit(opUpperLimit), nopLowerLimit(nopLowerLimit), nopUpperLimit(nopUpperLimit) {}
|
||||
TempLimits(float nopLowerLimit, float opLowerLimit, float opUpperLimit, float nopUpperLimit)
|
||||
: opLowerLimit(opLowerLimit),
|
||||
opUpperLimit(opUpperLimit),
|
||||
nopLowerLimit(nopLowerLimit),
|
||||
nopUpperLimit(nopUpperLimit) {}
|
||||
float opLowerLimit;
|
||||
float opUpperLimit;
|
||||
float nopLowerLimit;
|
||||
float nopUpperLimit;
|
||||
//TODO define limits
|
||||
|
||||
// TODO define limits
|
||||
};
|
||||
|
||||
class ThermalController : public ExtendedControllerBase {
|
||||
@ -50,6 +55,8 @@ class ThermalController : public ExtendedControllerBase {
|
||||
|
||||
InternalState internalState = InternalState::STARTUP;
|
||||
|
||||
HeaterHandler& heaterHandler;
|
||||
|
||||
thermalControllerDefinitions::SensorTemperatures sensorTemperatures;
|
||||
thermalControllerDefinitions::SusTemperatures susTemperatures;
|
||||
thermalControllerDefinitions::DeviceTemperatures deviceTemperatures;
|
||||
@ -91,24 +98,23 @@ class ThermalController : public ExtendedControllerBase {
|
||||
SUS::SusDataset susSet10;
|
||||
SUS::SusDataset susSet11;
|
||||
|
||||
//TempLimits
|
||||
//TempLimits plocHeatspreaderLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
//TempLimits plocMissionBoardLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
// TempLimits
|
||||
// TempLimits plocHeatspreaderLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
// TempLimits plocMissionBoardLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
TempLimits cameraLimits = TempLimits(-40.0, -30.0, 65.0, 85.0);
|
||||
TempLimits dacHeatspreaderLimits = TempLimits(-65.0, -40.0, 118.0, 150.0);
|
||||
TempLimits strLimits = TempLimits(-30.0, -20.0, 70.0, 80.0);
|
||||
TempLimits rw1Limits = TempLimits(-40.0, -40.0, 85.0, 85.0);
|
||||
//TempLimits droLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
// TempLimits droLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
TempLimits scexLimits = TempLimits(-60.0, -40.0, 85.0, 150.0);
|
||||
//TempLimits x8Limits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
//TempLimits hpaLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
//TempLimits txModuleLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
//TempLimits mpaLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
TempLimits acuLimits = TempLimits(-55.0, -35.0, 85.0, 150.0); //TODO nopLimits
|
||||
TempLimits plpcduHeatspreaderLimits = TempLimits(-65.0, -40.0, 85.0, 125.0); //TODO check
|
||||
// TempLimits x8Limits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
// TempLimits hpaLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
// TempLimits txModuleLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
// TempLimits mpaLimits = TempLimits(-20.0, 70.0, -30.0, 80.0);
|
||||
TempLimits acuLimits = TempLimits(-55.0, -35.0, 85.0, 150.0); // TODO nopLimits
|
||||
TempLimits plpcduHeatspreaderLimits = TempLimits(-65.0, -40.0, 85.0, 125.0); // TODO check
|
||||
TempLimits tcsBoardLimits = TempLimits(-60.0, -40.0, 85.0, 130.0);
|
||||
TempLimits magnettorquerLimits = TempLimits(-40.0, -30.0, 70.0, 80.0); //TODO nopLimits
|
||||
|
||||
TempLimits magnettorquerLimits = TempLimits(-40.0, -30.0, 70.0, 80.0); // TODO nopLimits
|
||||
|
||||
// Initial delay to make sure all pool variables have been initialized their owners
|
||||
Countdown initialCountdown = Countdown(DELAY);
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <dummies/SusDummy.h>
|
||||
#include <dummies/TemperatureSensorsDummy.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
@ -7,12 +6,15 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "../../dummies/TemperatureSensorInserter.h"
|
||||
#include "../testEnvironment.h"
|
||||
|
||||
TEST_CASE("Thermal Controller", "[ThermalController]") {
|
||||
const object_id_t THERMAL_CONTROLLER_ID = 0x123;
|
||||
|
||||
new TemperatureSensorsDummy();
|
||||
new TemperatureSensorInserter(objects::THERMAL_TEMP_INSERTER);
|
||||
// TODO: Create dummy heater handler
|
||||
// new HeaterHandler()
|
||||
new SusDummy();
|
||||
|
||||
// testEnvironment::initialize();
|
||||
|
Loading…
Reference in New Issue
Block a user