better naming.. hopefully..
This commit is contained in:
parent
0d79d4ab03
commit
03fad1cfcd
@ -1,96 +0,0 @@
|
||||
#ifndef MISSION_CONTROLLERS_TCS_CORECOMPONENT_H_
|
||||
#define MISSION_CONTROLLERS_TCS_CORECOMPONENT_H_
|
||||
|
||||
#include "../datapoolglob/GlobalDataSet.h"
|
||||
#include "../datapoolglob/GlobalPoolVariable.h"
|
||||
#include "../thermal/ThermalComponentIF.h"
|
||||
#include "../thermal/AbstractTemperatureSensor.h"
|
||||
#include "../thermal/ThermalModule.h"
|
||||
#include "../thermal/ThermalMonitor.h"
|
||||
|
||||
// TODO: Documentaiton, how to use this? only use Thermal Component, which inherits core component?
|
||||
class CoreComponent: public ThermalComponentIF {
|
||||
public:
|
||||
struct Parameters {
|
||||
float lowerOpLimit;
|
||||
float upperOpLimit;
|
||||
float heaterOn;
|
||||
float hysteresis;
|
||||
float heaterSwitchoff;
|
||||
};
|
||||
|
||||
static const uint16_t COMPONENT_TEMP_CONFIRMATION = 5;
|
||||
|
||||
CoreComponent(object_id_t reportingObjectId, uint8_t domainId, uint32_t temperaturePoolId,
|
||||
uint32_t targetStatePoolId, uint32_t currentStatePoolId,
|
||||
uint32_t requestPoolId, GlobDataSet *dataSet,
|
||||
AbstractTemperatureSensor *sensor,
|
||||
AbstractTemperatureSensor *firstRedundantSensor,
|
||||
AbstractTemperatureSensor *secondRedundantSensor,
|
||||
ThermalModuleIF *thermalModule, Parameters parameters,
|
||||
Priority priority, StateRequest initialTargetState =
|
||||
ThermalComponentIF::STATE_REQUEST_OPERATIONAL);
|
||||
|
||||
virtual ~CoreComponent();
|
||||
|
||||
virtual HeaterRequest performOperation(uint8_t opCode);
|
||||
|
||||
void markStateIgnored();
|
||||
|
||||
object_id_t getObjectId();
|
||||
|
||||
uint8_t getDomainId() const;
|
||||
|
||||
virtual float getLowerOpLimit();
|
||||
|
||||
ReturnValue_t setTargetState(int8_t newState);
|
||||
|
||||
virtual void setOutputInvalid();
|
||||
|
||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
||||
ParameterWrapper *parameterWrapper,
|
||||
const ParameterWrapper *newValues, uint16_t startAtIndex);
|
||||
|
||||
protected:
|
||||
|
||||
AbstractTemperatureSensor *sensor;
|
||||
AbstractTemperatureSensor *firstRedundantSensor;
|
||||
AbstractTemperatureSensor *secondRedundantSensor;
|
||||
ThermalModuleIF *thermalModule;
|
||||
|
||||
gp_float_t temperature;
|
||||
gp_int8_t targetState;
|
||||
gp_int8_t currentState;
|
||||
gp_uint8_t heaterRequest;
|
||||
|
||||
bool isHeating;
|
||||
|
||||
bool isSafeComponent;
|
||||
|
||||
float minTemp;
|
||||
|
||||
float maxTemp;
|
||||
|
||||
Parameters parameters;
|
||||
|
||||
ThermalMonitor temperatureMonitor;
|
||||
|
||||
const uint8_t domainId;
|
||||
|
||||
virtual float getTemperature();
|
||||
virtual State getState(float temperature, Parameters parameters,
|
||||
int8_t targetState);
|
||||
|
||||
virtual void checkLimits(State state);
|
||||
|
||||
virtual HeaterRequest getHeaterRequest(int8_t targetState,
|
||||
float temperature, Parameters parameters);
|
||||
|
||||
virtual State getIgnoredState(int8_t state);
|
||||
|
||||
void updateMinMaxTemp();
|
||||
|
||||
virtual Parameters getParameters();
|
||||
};
|
||||
|
||||
#endif /* MISSION_CONTROLLERS_TCS_CORECOMPONENT_H_ */
|
@ -9,12 +9,12 @@ ThermalComponent::ThermalComponent(object_id_t reportingObjectId,
|
||||
AbstractTemperatureSensor* secondRedundantSensor,
|
||||
ThermalModuleIF* thermalModule, Parameters parameters,
|
||||
Priority priority) :
|
||||
CoreComponent(reportingObjectId, domainId, temperaturePoolId,
|
||||
ThermalComponentCore(reportingObjectId, domainId, temperaturePoolId,
|
||||
targetStatePoolId, currentStatePoolId, requestPoolId, dataSet,
|
||||
sensor, firstRedundantSensor, secondRedundantSensor,
|
||||
thermalModule,{ parameters.lowerOpLimit, parameters.upperOpLimit,
|
||||
parameters.heaterOn, parameters.hysteresis, parameters.heaterSwitchoff },
|
||||
priority, ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL),
|
||||
{ parameters.lowerOpLimit, parameters.upperOpLimit,
|
||||
parameters.heaterOn, parameters.hysteresis,
|
||||
parameters.heaterSwitchoff },
|
||||
ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL),
|
||||
nopParameters({ parameters.lowerNopLimit, parameters.upperNopLimit }) {
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ ReturnValue_t ThermalComponent::setTargetState(int8_t newState) {
|
||||
mySet.commit(PoolVariableIF::VALID);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
default:
|
||||
return CoreComponent::setTargetState(newState);
|
||||
return ThermalComponentCore::setTargetState(newState);
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,11 +57,11 @@ ReturnValue_t ThermalComponent::setLimits(const uint8_t* data, size_t size) {
|
||||
}
|
||||
|
||||
ThermalComponentIF::State ThermalComponent::getState(float temperature,
|
||||
CoreComponent::Parameters parameters, int8_t targetState) {
|
||||
ThermalComponentCore::Parameters parameters, int8_t targetState) {
|
||||
if (temperature < nopParameters.lowerNopLimit) {
|
||||
return OUT_OF_RANGE_LOW;
|
||||
} else {
|
||||
State state = CoreComponent::getState(temperature, parameters,
|
||||
State state = ThermalComponentCore::getState(temperature, parameters,
|
||||
targetState);
|
||||
if (state != NON_OPERATIONAL_HIGH
|
||||
&& state != NON_OPERATIONAL_HIGH_IGNORED) {
|
||||
@ -79,7 +79,7 @@ ThermalComponentIF::State ThermalComponent::getState(float temperature,
|
||||
|
||||
void ThermalComponent::checkLimits(ThermalComponentIF::State state) {
|
||||
if (targetState == STATE_REQUEST_OPERATIONAL || targetState == STATE_REQUEST_IGNORE) {
|
||||
CoreComponent::checkLimits(state);
|
||||
ThermalComponentCore::checkLimits(state);
|
||||
return;
|
||||
}
|
||||
//If component is not operational, it checks the NOP limits.
|
||||
@ -89,7 +89,7 @@ void ThermalComponent::checkLimits(ThermalComponentIF::State state) {
|
||||
|
||||
ThermalComponentIF::HeaterRequest ThermalComponent::getHeaterRequest(
|
||||
int8_t targetState, float temperature,
|
||||
CoreComponent::Parameters parameters) {
|
||||
ThermalComponentCore::Parameters parameters) {
|
||||
if (targetState == STATE_REQUEST_IGNORE) {
|
||||
isHeating = false;
|
||||
return HEATER_DONT_CARE;
|
||||
@ -142,14 +142,14 @@ ThermalComponentIF::State ThermalComponent::getIgnoredState(int8_t state) {
|
||||
case OUT_OF_RANGE_HIGH_IGNORED:
|
||||
return OUT_OF_RANGE_HIGH_IGNORED;
|
||||
default:
|
||||
return CoreComponent::getIgnoredState(state);
|
||||
return ThermalComponentCore::getIgnoredState(state);
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t ThermalComponent::getParameter(uint8_t domainId,
|
||||
uint16_t parameterId, ParameterWrapper* parameterWrapper,
|
||||
const ParameterWrapper* newValues, uint16_t startAtIndex) {
|
||||
ReturnValue_t result = CoreComponent::getParameter(domainId, parameterId,
|
||||
ReturnValue_t result = ThermalComponentCore::getParameter(domainId, parameterId,
|
||||
parameterWrapper, newValues, startAtIndex);
|
||||
if (result != INVALID_IDENTIFIER_ID) {
|
||||
return result;
|
||||
|
@ -1,12 +1,14 @@
|
||||
#ifndef THERMALCOMPONENT_H_
|
||||
#define THERMALCOMPONENT_H_
|
||||
#ifndef FSFW_THERMAL_THERMALCOMPONENT_H_
|
||||
#define FSFW_THERMAL_THERMALCOMPONENT_H_
|
||||
|
||||
#include "CoreComponent.h"
|
||||
#include "ThermalComponentCore.h"
|
||||
|
||||
/**
|
||||
* What is it. How to use
|
||||
* @brief
|
||||
* @details
|
||||
* Some more documentation.
|
||||
*/
|
||||
class ThermalComponent: public CoreComponent {
|
||||
class ThermalComponent: public ThermalComponentCore {
|
||||
public:
|
||||
struct Parameters {
|
||||
float lowerNopLimit;
|
||||
@ -42,8 +44,9 @@ public:
|
||||
* @param parameters
|
||||
* @param priority
|
||||
*/
|
||||
ThermalComponent(object_id_t reportingObjectId, uint8_t domainId, uint32_t temperaturePoolId,
|
||||
uint32_t targetStatePoolId, uint32_t currentStatePoolId, uint32_t requestPoolId,
|
||||
ThermalComponent(object_id_t reportingObjectId, uint8_t domainId,
|
||||
uint32_t temperaturePoolId, uint32_t targetStatePoolId,
|
||||
uint32_t currentStatePoolId, uint32_t requestPoolId,
|
||||
GlobDataSet *dataSet, AbstractTemperatureSensor *sensor,
|
||||
AbstractTemperatureSensor *firstRedundantSensor,
|
||||
AbstractTemperatureSensor *secondRedundantSensor,
|
||||
@ -63,15 +66,15 @@ protected:
|
||||
|
||||
NopParameters nopParameters;
|
||||
|
||||
State getState(float temperature, CoreComponent::Parameters parameters,
|
||||
State getState(float temperature, ThermalComponentCore::Parameters parameters,
|
||||
int8_t targetState);
|
||||
|
||||
virtual void checkLimits(State state);
|
||||
|
||||
virtual HeaterRequest getHeaterRequest(int8_t targetState, float temperature,
|
||||
CoreComponent::Parameters parameters);
|
||||
ThermalComponentCore::Parameters parameters);
|
||||
|
||||
State getIgnoredState(int8_t state);
|
||||
};
|
||||
|
||||
#endif /* THERMALCOMPONENT_H_ */
|
||||
#endif /* FSFW_THERMAL_THERMALCOMPONENT_H_ */
|
||||
|
@ -1,28 +1,19 @@
|
||||
#include "CoreComponent.h"
|
||||
#include "ThermalComponentCore.h"
|
||||
|
||||
CoreComponent::CoreComponent(object_id_t reportingObjectId, uint8_t domainId,
|
||||
uint32_t temperaturePoolId, uint32_t targetStatePoolId,
|
||||
uint32_t currentStatePoolId, uint32_t requestPoolId, GlobDataSet* dataSet,
|
||||
AbstractTemperatureSensor* sensor,
|
||||
AbstractTemperatureSensor* firstRedundantSensor,
|
||||
AbstractTemperatureSensor* secondRedundantSensor,
|
||||
ThermalModuleIF* thermalModule, Parameters parameters,
|
||||
Priority priority, StateRequest initialTargetState) :
|
||||
sensor(sensor), firstRedundantSensor(firstRedundantSensor), secondRedundantSensor(
|
||||
secondRedundantSensor), thermalModule(thermalModule), temperature(
|
||||
temperaturePoolId, dataSet, PoolVariableIF::VAR_WRITE), targetState(
|
||||
targetStatePoolId, dataSet, PoolVariableIF::VAR_READ), currentState(
|
||||
currentStatePoolId, dataSet, PoolVariableIF::VAR_WRITE), heaterRequest(
|
||||
requestPoolId, dataSet, PoolVariableIF::VAR_WRITE), isHeating(
|
||||
false), isSafeComponent(priority == SAFE), minTemp(999), maxTemp(
|
||||
AbstractTemperatureSensor::ZERO_KELVIN_C), parameters(
|
||||
parameters), temperatureMonitor(reportingObjectId,
|
||||
domainId + 1,
|
||||
GlobalDataPool::poolIdAndPositionToPid(temperaturePoolId, 0),
|
||||
ThermalComponentCore::ThermalComponentCore(object_id_t reportingObjectId,
|
||||
uint8_t domainId, uint32_t temperaturePoolId,
|
||||
uint32_t targetStatePoolId,
|
||||
uint32_t currentStatePoolId, uint32_t requestPoolId,
|
||||
GlobDataSet* dataSet, Parameters parameters,
|
||||
StateRequest initialTargetState) :
|
||||
temperature(temperaturePoolId, dataSet, PoolVariableIF::VAR_WRITE),
|
||||
targetState(targetStatePoolId, dataSet, PoolVariableIF::VAR_READ),
|
||||
currentState(currentStatePoolId, dataSet, PoolVariableIF::VAR_WRITE),
|
||||
heaterRequest(requestPoolId, dataSet, PoolVariableIF::VAR_WRITE),
|
||||
parameters(parameters),
|
||||
temperatureMonitor(reportingObjectId, domainId + 1,
|
||||
GlobalDataPool::poolIdAndPositionToPid(temperaturePoolId, 0),
|
||||
COMPONENT_TEMP_CONFIRMATION), domainId(domainId) {
|
||||
if (thermalModule != NULL) {
|
||||
thermalModule->registerComponent(this, priority);
|
||||
}
|
||||
//Set thermal state once, then leave to operator.
|
||||
GlobDataSet mySet;
|
||||
gp_uint8_t writableTargetState(targetStatePoolId, &mySet,
|
||||
@ -31,10 +22,39 @@ CoreComponent::CoreComponent(object_id_t reportingObjectId, uint8_t domainId,
|
||||
mySet.commit(PoolVariableIF::VALID);
|
||||
}
|
||||
|
||||
CoreComponent::~CoreComponent() {
|
||||
void ThermalComponentCore::addSensor(AbstractTemperatureSensor* sensor) {
|
||||
this->sensor = sensor;
|
||||
}
|
||||
|
||||
ThermalComponentIF::HeaterRequest CoreComponent::performOperation(uint8_t opCode) {
|
||||
void ThermalComponentCore::addFirstRedundantSensor(
|
||||
AbstractTemperatureSensor *firstRedundantSensor) {
|
||||
this->firstRedundantSensor = firstRedundantSensor;
|
||||
}
|
||||
|
||||
void ThermalComponentCore::addSecondRedundantSensor(
|
||||
AbstractTemperatureSensor *secondRedundantSensor) {
|
||||
this->secondRedundantSensor = secondRedundantSensor;
|
||||
}
|
||||
|
||||
void ThermalComponentCore::addThermalModule(ThermalModule *thermalModule,
|
||||
Priority priority) {
|
||||
this->thermalModule = thermalModule;
|
||||
if(thermalModule != nullptr) {
|
||||
thermalModule->registerComponent(this, priority);
|
||||
}
|
||||
}
|
||||
|
||||
void ThermalComponentCore::setPriority(Priority priority) {
|
||||
if(priority == SAFE) {
|
||||
this->isSafeComponent = true;
|
||||
}
|
||||
}
|
||||
|
||||
ThermalComponentCore::~ThermalComponentCore() {
|
||||
}
|
||||
|
||||
ThermalComponentIF::HeaterRequest ThermalComponentCore::performOperation(
|
||||
uint8_t opCode) {
|
||||
HeaterRequest request = HEATER_DONT_CARE;
|
||||
//SHOULDDO: Better pass db_float_t* to getTemperature and set it invalid if invalid.
|
||||
temperature = getTemperature();
|
||||
@ -57,19 +77,21 @@ ThermalComponentIF::HeaterRequest CoreComponent::performOperation(uint8_t opCode
|
||||
return request;
|
||||
}
|
||||
|
||||
void CoreComponent::markStateIgnored() {
|
||||
void ThermalComponentCore::markStateIgnored() {
|
||||
currentState = getIgnoredState(currentState);
|
||||
}
|
||||
|
||||
object_id_t CoreComponent::getObjectId() {
|
||||
object_id_t ThermalComponentCore::getObjectId() {
|
||||
return temperatureMonitor.getReporterId();
|
||||
}
|
||||
|
||||
float CoreComponent::getLowerOpLimit() {
|
||||
float ThermalComponentCore::getLowerOpLimit() {
|
||||
return parameters.lowerOpLimit;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreComponent::setTargetState(int8_t newState) {
|
||||
|
||||
|
||||
ReturnValue_t ThermalComponentCore::setTargetState(int8_t newState) {
|
||||
GlobDataSet mySet;
|
||||
gp_uint8_t writableTargetState(targetState.getDataPoolId(),
|
||||
&mySet, PoolVariableIF::VAR_READ_WRITE);
|
||||
@ -92,7 +114,7 @@ ReturnValue_t CoreComponent::setTargetState(int8_t newState) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void CoreComponent::setOutputInvalid() {
|
||||
void ThermalComponentCore::setOutputInvalid() {
|
||||
temperature = INVALID_TEMPERATURE;
|
||||
temperature.setValid(PoolVariableIF::INVALID);
|
||||
currentState.setValid(PoolVariableIF::INVALID);
|
||||
@ -101,20 +123,22 @@ void CoreComponent::setOutputInvalid() {
|
||||
temperatureMonitor.setToUnchecked();
|
||||
}
|
||||
|
||||
float CoreComponent::getTemperature() {
|
||||
if ((sensor != NULL) && (sensor->isValid())) {
|
||||
float ThermalComponentCore::getTemperature() {
|
||||
if ((sensor != nullptr) && (sensor->isValid())) {
|
||||
return sensor->getTemperature();
|
||||
}
|
||||
|
||||
if ((firstRedundantSensor != NULL) && (firstRedundantSensor->isValid())) {
|
||||
if ((firstRedundantSensor != nullptr) &&
|
||||
(firstRedundantSensor->isValid())) {
|
||||
return firstRedundantSensor->getTemperature();
|
||||
}
|
||||
|
||||
if ((secondRedundantSensor != NULL) && (secondRedundantSensor->isValid())) {
|
||||
if ((secondRedundantSensor != nullptr) &&
|
||||
(secondRedundantSensor->isValid())) {
|
||||
return secondRedundantSensor->getTemperature();
|
||||
}
|
||||
|
||||
if (thermalModule != NULL) {
|
||||
if (thermalModule != nullptr) {
|
||||
float temperature = thermalModule->getTemperature();
|
||||
if (temperature != ThermalModuleIF::INVALID_TEMPERATURE) {
|
||||
return temperature;
|
||||
@ -126,7 +150,7 @@ float CoreComponent::getTemperature() {
|
||||
}
|
||||
}
|
||||
|
||||
ThermalComponentIF::State CoreComponent::getState(float temperature,
|
||||
ThermalComponentIF::State ThermalComponentCore::getState(float temperature,
|
||||
Parameters parameters, int8_t targetState) {
|
||||
ThermalComponentIF::State state;
|
||||
|
||||
@ -144,14 +168,14 @@ ThermalComponentIF::State CoreComponent::getState(float temperature,
|
||||
return state;
|
||||
}
|
||||
|
||||
void CoreComponent::checkLimits(ThermalComponentIF::State state) {
|
||||
void ThermalComponentCore::checkLimits(ThermalComponentIF::State state) {
|
||||
//Checks operational limits only.
|
||||
temperatureMonitor.translateState(state, temperature.value,
|
||||
getParameters().lowerOpLimit, getParameters().upperOpLimit);
|
||||
|
||||
}
|
||||
|
||||
ThermalComponentIF::HeaterRequest CoreComponent::getHeaterRequest(
|
||||
ThermalComponentIF::HeaterRequest ThermalComponentCore::getHeaterRequest(
|
||||
int8_t targetState, float temperature, Parameters parameters) {
|
||||
if (targetState == STATE_REQUEST_IGNORE) {
|
||||
isHeating = false;
|
||||
@ -177,7 +201,7 @@ ThermalComponentIF::HeaterRequest CoreComponent::getHeaterRequest(
|
||||
return HEATER_DONT_CARE;
|
||||
}
|
||||
|
||||
ThermalComponentIF::State CoreComponent::getIgnoredState(int8_t state) {
|
||||
ThermalComponentIF::State ThermalComponentCore::getIgnoredState(int8_t state) {
|
||||
switch (state) {
|
||||
case NON_OPERATIONAL_LOW:
|
||||
return NON_OPERATIONAL_LOW_IGNORED;
|
||||
@ -197,7 +221,7 @@ ThermalComponentIF::State CoreComponent::getIgnoredState(int8_t state) {
|
||||
}
|
||||
}
|
||||
|
||||
void CoreComponent::updateMinMaxTemp() {
|
||||
void ThermalComponentCore::updateMinMaxTemp() {
|
||||
if (temperature == INVALID_TEMPERATURE) {
|
||||
return;
|
||||
}
|
||||
@ -209,15 +233,15 @@ void CoreComponent::updateMinMaxTemp() {
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t CoreComponent::getDomainId() const {
|
||||
uint8_t ThermalComponentCore::getDomainId() const {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
CoreComponent::Parameters CoreComponent::getParameters() {
|
||||
ThermalComponentCore::Parameters ThermalComponentCore::getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreComponent::getParameter(uint8_t domainId,
|
||||
ReturnValue_t ThermalComponentCore::getParameter(uint8_t domainId,
|
||||
uint16_t parameterId, ParameterWrapper* parameterWrapper,
|
||||
const ParameterWrapper* newValues, uint16_t startAtIndex) {
|
||||
ReturnValue_t result = temperatureMonitor.getParameter(domainId,
|
118
thermal/ThermalComponentCore.h
Normal file
118
thermal/ThermalComponentCore.h
Normal file
@ -0,0 +1,118 @@
|
||||
#ifndef FSFW_THERMAL_THERMALCOMPONENTCORE_H_
|
||||
#define FSFW_THERMAL_THERMALCOMPONENTCORE_H_
|
||||
|
||||
#include "ThermalMonitorReporter.h"
|
||||
#include "ThermalComponentIF.h"
|
||||
#include "AbstractTemperatureSensor.h"
|
||||
#include "ThermalModule.h"
|
||||
|
||||
#include "../datapoolglob/GlobalDataSet.h"
|
||||
#include "../datapoolglob/GlobalPoolVariable.h"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @details
|
||||
*/
|
||||
class ThermalComponentCore: public ThermalComponentIF {
|
||||
public:
|
||||
struct Parameters {
|
||||
float lowerOpLimit;
|
||||
float upperOpLimit;
|
||||
float heaterOn;
|
||||
float hysteresis;
|
||||
float heaterSwitchoff;
|
||||
};
|
||||
|
||||
static const uint16_t COMPONENT_TEMP_CONFIRMATION = 5;
|
||||
|
||||
/**
|
||||
* Some documentation
|
||||
* @param reportingObjectId
|
||||
* @param domainId
|
||||
* @param temperaturePoolId
|
||||
* @param targetStatePoolId
|
||||
* @param currentStatePoolId
|
||||
* @param requestPoolId
|
||||
* @param dataSet
|
||||
* @param parameters
|
||||
* @param initialTargetState
|
||||
*/
|
||||
ThermalComponentCore(object_id_t reportingObjectId, uint8_t domainId,
|
||||
uint32_t temperaturePoolId, uint32_t targetStatePoolId,
|
||||
uint32_t currentStatePoolId, uint32_t requestPoolId,
|
||||
GlobDataSet *dataSet, Parameters parameters,
|
||||
StateRequest initialTargetState =
|
||||
ThermalComponentIF::STATE_REQUEST_OPERATIONAL);
|
||||
|
||||
void addSensor(AbstractTemperatureSensor* firstRedundantSensor);
|
||||
void addFirstRedundantSensor(
|
||||
AbstractTemperatureSensor* firstRedundantSensor);
|
||||
void addSecondRedundantSensor(
|
||||
AbstractTemperatureSensor* secondRedundantSensor);
|
||||
void addThermalModule(ThermalModule* thermalModule, Priority priority);
|
||||
|
||||
void setPriority(Priority priority);
|
||||
|
||||
virtual ~ThermalComponentCore();
|
||||
|
||||
virtual HeaterRequest performOperation(uint8_t opCode);
|
||||
|
||||
void markStateIgnored();
|
||||
|
||||
object_id_t getObjectId();
|
||||
|
||||
uint8_t getDomainId() const;
|
||||
|
||||
virtual float getLowerOpLimit();
|
||||
|
||||
ReturnValue_t setTargetState(int8_t newState);
|
||||
|
||||
virtual void setOutputInvalid();
|
||||
|
||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
||||
ParameterWrapper *parameterWrapper,
|
||||
const ParameterWrapper *newValues, uint16_t startAtIndex);
|
||||
|
||||
protected:
|
||||
|
||||
AbstractTemperatureSensor *sensor = nullptr;
|
||||
AbstractTemperatureSensor *firstRedundantSensor = nullptr;
|
||||
AbstractTemperatureSensor *secondRedundantSensor = nullptr;
|
||||
ThermalModuleIF *thermalModule = nullptr;
|
||||
|
||||
gp_float_t temperature;
|
||||
gp_int8_t targetState;
|
||||
gp_int8_t currentState;
|
||||
gp_uint8_t heaterRequest;
|
||||
|
||||
bool isHeating = false;
|
||||
|
||||
bool isSafeComponent = false;
|
||||
|
||||
float minTemp = 999;
|
||||
|
||||
float maxTemp = AbstractTemperatureSensor::ZERO_KELVIN_C;
|
||||
|
||||
Parameters parameters;
|
||||
|
||||
ThermalMonitorReporter temperatureMonitor;
|
||||
|
||||
const uint8_t domainId;
|
||||
|
||||
virtual float getTemperature();
|
||||
virtual State getState(float temperature, Parameters parameters,
|
||||
int8_t targetState);
|
||||
|
||||
virtual void checkLimits(State state);
|
||||
|
||||
virtual HeaterRequest getHeaterRequest(int8_t targetState,
|
||||
float temperature, Parameters parameters);
|
||||
|
||||
virtual State getIgnoredState(int8_t state);
|
||||
|
||||
void updateMinMaxTemp();
|
||||
|
||||
virtual Parameters getParameters();
|
||||
};
|
||||
|
||||
#endif /* FSFW_THERMAL_THERMALCOMPONENT_CORE_H_ */
|
@ -49,18 +49,18 @@ public:
|
||||
SAFE = 0, //!< SAFE
|
||||
IDLE, //!< IDLE
|
||||
PAYLOAD, //!< PAYLOAD
|
||||
NUMBER_OF_PRIORITIES //!< MAX_PRIORITY
|
||||
NUMBER_OF_PRIORITIES //!< MAX_PRIORITY
|
||||
};
|
||||
|
||||
/**
|
||||
* The elements are ordered by priority, lowest have highest priority
|
||||
*/
|
||||
enum HeaterRequest {
|
||||
HEATER_REQUEST_EMERGENCY_OFF = 0, //!< REQUEST_EMERGENCY_OFF
|
||||
HEATER_REQUEST_EMERGENCY_ON, //!< REQUEST_EMERGENCY_ON
|
||||
HEATER_REQUEST_OFF, //!< REQUEST_OFF
|
||||
HEATER_REQUEST_ON, //!< REQUEST_ON
|
||||
HEATER_DONT_CARE //!< DONT_CARE
|
||||
HEATER_REQUEST_EMERGENCY_OFF = 0, //!< REQUEST_EMERGENCY_OFF
|
||||
HEATER_REQUEST_EMERGENCY_ON, //!< REQUEST_EMERGENCY_ON
|
||||
HEATER_REQUEST_OFF, //!< REQUEST_OFF
|
||||
HEATER_REQUEST_ON, //!< REQUEST_ON
|
||||
HEATER_DONT_CARE //!< DONT_CARE
|
||||
};
|
||||
|
||||
virtual ~ThermalComponentIF() {
|
||||
|
@ -1,26 +0,0 @@
|
||||
#ifndef FRAMEWORK_THERMAL_THERMALMONITOR_H_
|
||||
#define FRAMEWORK_THERMAL_THERMALMONITOR_H_
|
||||
|
||||
#include "../monitoring/MonitorReporter.h"
|
||||
#include "../thermal/ThermalComponentIF.h"
|
||||
|
||||
/**
|
||||
* What does it do. How to use it.
|
||||
*/
|
||||
class ThermalMonitor: public MonitorReporter<float> {
|
||||
public:
|
||||
template<typename ... Args>
|
||||
ThermalMonitor(Args ... args) :
|
||||
MonitorReporter<float>(std::forward<Args>(args)...) {
|
||||
}
|
||||
~ThermalMonitor();
|
||||
ReturnValue_t translateState(ThermalComponentIF::State state, float sample,
|
||||
float lowerLimit, float upperLimit, bool componentIsOperational = true);
|
||||
|
||||
bool isAboveHighLimit();
|
||||
protected:
|
||||
virtual void sendTransitionEvent(float currentValue, ReturnValue_t state);
|
||||
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_THERMAL_THERMALMONITOR_H_ */
|
@ -1,10 +1,12 @@
|
||||
#include "../thermal/ThermalMonitor.h"
|
||||
#include "../thermal/ThermalComponentIF.h"
|
||||
#include "ThermalMonitorReporter.h"
|
||||
#include "ThermalComponentIF.h"
|
||||
|
||||
#include "../monitoring/MonitoringIF.h"
|
||||
ThermalMonitor::~ThermalMonitor() {
|
||||
|
||||
ThermalMonitorReporter::~ThermalMonitorReporter() {
|
||||
}
|
||||
|
||||
void ThermalMonitor::sendTransitionEvent(float currentValue,
|
||||
void ThermalMonitorReporter::sendTransitionEvent(float currentValue,
|
||||
ReturnValue_t state) {
|
||||
switch (state) {
|
||||
case MonitoringIF::BELOW_LOW_LIMIT:
|
||||
@ -28,7 +30,7 @@ void ThermalMonitor::sendTransitionEvent(float currentValue,
|
||||
}
|
||||
}
|
||||
|
||||
bool ThermalMonitor::isAboveHighLimit() {
|
||||
bool ThermalMonitorReporter::isAboveHighLimit() {
|
||||
if (oldState == ThermalComponentIF::ABOVE_OPERATIONAL_LIMIT) {
|
||||
return true;
|
||||
} else {
|
||||
@ -36,7 +38,7 @@ bool ThermalMonitor::isAboveHighLimit() {
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t ThermalMonitor::translateState(ThermalComponentIF::State state, float sample, float lowerLimit,
|
||||
ReturnValue_t ThermalMonitorReporter::translateState(ThermalComponentIF::State state, float sample, float lowerLimit,
|
||||
float upperLimit, bool componentIsOperational) {
|
||||
if (ThermalComponentIF::isIgnoredState(state)) {
|
||||
setToUnchecked();
|
28
thermal/ThermalMonitorReporter.h
Normal file
28
thermal/ThermalMonitorReporter.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef FSFW_THERMAL_THERMALMONITORREPORTER_H_
|
||||
#define FSFW_THERMAL_THERMALMONITORREPORTER_H_
|
||||
|
||||
#include "ThermalComponentIF.h"
|
||||
#include "../monitoring/MonitorReporter.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief Monitor Reporter implementation for thermal components.
|
||||
*/
|
||||
class ThermalMonitorReporter: public MonitorReporter<float> {
|
||||
public:
|
||||
template<typename ... Args>
|
||||
ThermalMonitorReporter(Args ... args) :
|
||||
MonitorReporter<float>(std::forward<Args>(args)...) {
|
||||
}
|
||||
~ThermalMonitorReporter();
|
||||
ReturnValue_t translateState(ThermalComponentIF::State state, float sample,
|
||||
float lowerLimit, float upperLimit,
|
||||
bool componentIsOperational = true);
|
||||
|
||||
bool isAboveHighLimit();
|
||||
protected:
|
||||
virtual void sendTransitionEvent(float currentValue, ReturnValue_t state);
|
||||
|
||||
};
|
||||
|
||||
#endif /* FSFW_THERMAL_THERMALMONITORREPORTERREPORTER_H_ */
|
Loading…
Reference in New Issue
Block a user