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,
|
AbstractTemperatureSensor* secondRedundantSensor,
|
||||||
ThermalModuleIF* thermalModule, Parameters parameters,
|
ThermalModuleIF* thermalModule, Parameters parameters,
|
||||||
Priority priority) :
|
Priority priority) :
|
||||||
CoreComponent(reportingObjectId, domainId, temperaturePoolId,
|
ThermalComponentCore(reportingObjectId, domainId, temperaturePoolId,
|
||||||
targetStatePoolId, currentStatePoolId, requestPoolId, dataSet,
|
targetStatePoolId, currentStatePoolId, requestPoolId, dataSet,
|
||||||
sensor, firstRedundantSensor, secondRedundantSensor,
|
{ parameters.lowerOpLimit, parameters.upperOpLimit,
|
||||||
thermalModule,{ parameters.lowerOpLimit, parameters.upperOpLimit,
|
parameters.heaterOn, parameters.hysteresis,
|
||||||
parameters.heaterOn, parameters.hysteresis, parameters.heaterSwitchoff },
|
parameters.heaterSwitchoff },
|
||||||
priority, ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL),
|
ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL),
|
||||||
nopParameters({ parameters.lowerNopLimit, parameters.upperNopLimit }) {
|
nopParameters({ parameters.lowerNopLimit, parameters.upperNopLimit }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ ReturnValue_t ThermalComponent::setTargetState(int8_t newState) {
|
|||||||
mySet.commit(PoolVariableIF::VALID);
|
mySet.commit(PoolVariableIF::VALID);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
default:
|
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,
|
ThermalComponentIF::State ThermalComponent::getState(float temperature,
|
||||||
CoreComponent::Parameters parameters, int8_t targetState) {
|
ThermalComponentCore::Parameters parameters, int8_t targetState) {
|
||||||
if (temperature < nopParameters.lowerNopLimit) {
|
if (temperature < nopParameters.lowerNopLimit) {
|
||||||
return OUT_OF_RANGE_LOW;
|
return OUT_OF_RANGE_LOW;
|
||||||
} else {
|
} else {
|
||||||
State state = CoreComponent::getState(temperature, parameters,
|
State state = ThermalComponentCore::getState(temperature, parameters,
|
||||||
targetState);
|
targetState);
|
||||||
if (state != NON_OPERATIONAL_HIGH
|
if (state != NON_OPERATIONAL_HIGH
|
||||||
&& state != NON_OPERATIONAL_HIGH_IGNORED) {
|
&& state != NON_OPERATIONAL_HIGH_IGNORED) {
|
||||||
@ -79,7 +79,7 @@ ThermalComponentIF::State ThermalComponent::getState(float temperature,
|
|||||||
|
|
||||||
void ThermalComponent::checkLimits(ThermalComponentIF::State state) {
|
void ThermalComponent::checkLimits(ThermalComponentIF::State state) {
|
||||||
if (targetState == STATE_REQUEST_OPERATIONAL || targetState == STATE_REQUEST_IGNORE) {
|
if (targetState == STATE_REQUEST_OPERATIONAL || targetState == STATE_REQUEST_IGNORE) {
|
||||||
CoreComponent::checkLimits(state);
|
ThermalComponentCore::checkLimits(state);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//If component is not operational, it checks the NOP limits.
|
//If component is not operational, it checks the NOP limits.
|
||||||
@ -89,7 +89,7 @@ void ThermalComponent::checkLimits(ThermalComponentIF::State state) {
|
|||||||
|
|
||||||
ThermalComponentIF::HeaterRequest ThermalComponent::getHeaterRequest(
|
ThermalComponentIF::HeaterRequest ThermalComponent::getHeaterRequest(
|
||||||
int8_t targetState, float temperature,
|
int8_t targetState, float temperature,
|
||||||
CoreComponent::Parameters parameters) {
|
ThermalComponentCore::Parameters parameters) {
|
||||||
if (targetState == STATE_REQUEST_IGNORE) {
|
if (targetState == STATE_REQUEST_IGNORE) {
|
||||||
isHeating = false;
|
isHeating = false;
|
||||||
return HEATER_DONT_CARE;
|
return HEATER_DONT_CARE;
|
||||||
@ -142,14 +142,14 @@ ThermalComponentIF::State ThermalComponent::getIgnoredState(int8_t state) {
|
|||||||
case OUT_OF_RANGE_HIGH_IGNORED:
|
case OUT_OF_RANGE_HIGH_IGNORED:
|
||||||
return OUT_OF_RANGE_HIGH_IGNORED;
|
return OUT_OF_RANGE_HIGH_IGNORED;
|
||||||
default:
|
default:
|
||||||
return CoreComponent::getIgnoredState(state);
|
return ThermalComponentCore::getIgnoredState(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ThermalComponent::getParameter(uint8_t domainId,
|
ReturnValue_t ThermalComponent::getParameter(uint8_t domainId,
|
||||||
uint16_t parameterId, ParameterWrapper* parameterWrapper,
|
uint16_t parameterId, ParameterWrapper* parameterWrapper,
|
||||||
const ParameterWrapper* newValues, uint16_t startAtIndex) {
|
const ParameterWrapper* newValues, uint16_t startAtIndex) {
|
||||||
ReturnValue_t result = CoreComponent::getParameter(domainId, parameterId,
|
ReturnValue_t result = ThermalComponentCore::getParameter(domainId, parameterId,
|
||||||
parameterWrapper, newValues, startAtIndex);
|
parameterWrapper, newValues, startAtIndex);
|
||||||
if (result != INVALID_IDENTIFIER_ID) {
|
if (result != INVALID_IDENTIFIER_ID) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
#ifndef THERMALCOMPONENT_H_
|
#ifndef FSFW_THERMAL_THERMALCOMPONENT_H_
|
||||||
#define 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:
|
public:
|
||||||
struct Parameters {
|
struct Parameters {
|
||||||
float lowerNopLimit;
|
float lowerNopLimit;
|
||||||
@ -42,8 +44,9 @@ public:
|
|||||||
* @param parameters
|
* @param parameters
|
||||||
* @param priority
|
* @param priority
|
||||||
*/
|
*/
|
||||||
ThermalComponent(object_id_t reportingObjectId, uint8_t domainId, uint32_t temperaturePoolId,
|
ThermalComponent(object_id_t reportingObjectId, uint8_t domainId,
|
||||||
uint32_t targetStatePoolId, uint32_t currentStatePoolId, uint32_t requestPoolId,
|
uint32_t temperaturePoolId, uint32_t targetStatePoolId,
|
||||||
|
uint32_t currentStatePoolId, uint32_t requestPoolId,
|
||||||
GlobDataSet *dataSet, AbstractTemperatureSensor *sensor,
|
GlobDataSet *dataSet, AbstractTemperatureSensor *sensor,
|
||||||
AbstractTemperatureSensor *firstRedundantSensor,
|
AbstractTemperatureSensor *firstRedundantSensor,
|
||||||
AbstractTemperatureSensor *secondRedundantSensor,
|
AbstractTemperatureSensor *secondRedundantSensor,
|
||||||
@ -63,15 +66,15 @@ protected:
|
|||||||
|
|
||||||
NopParameters nopParameters;
|
NopParameters nopParameters;
|
||||||
|
|
||||||
State getState(float temperature, CoreComponent::Parameters parameters,
|
State getState(float temperature, ThermalComponentCore::Parameters parameters,
|
||||||
int8_t targetState);
|
int8_t targetState);
|
||||||
|
|
||||||
virtual void checkLimits(State state);
|
virtual void checkLimits(State state);
|
||||||
|
|
||||||
virtual HeaterRequest getHeaterRequest(int8_t targetState, float temperature,
|
virtual HeaterRequest getHeaterRequest(int8_t targetState, float temperature,
|
||||||
CoreComponent::Parameters parameters);
|
ThermalComponentCore::Parameters parameters);
|
||||||
|
|
||||||
State getIgnoredState(int8_t state);
|
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,
|
ThermalComponentCore::ThermalComponentCore(object_id_t reportingObjectId,
|
||||||
uint32_t temperaturePoolId, uint32_t targetStatePoolId,
|
uint8_t domainId, uint32_t temperaturePoolId,
|
||||||
uint32_t currentStatePoolId, uint32_t requestPoolId, GlobDataSet* dataSet,
|
uint32_t targetStatePoolId,
|
||||||
AbstractTemperatureSensor* sensor,
|
uint32_t currentStatePoolId, uint32_t requestPoolId,
|
||||||
AbstractTemperatureSensor* firstRedundantSensor,
|
GlobDataSet* dataSet, Parameters parameters,
|
||||||
AbstractTemperatureSensor* secondRedundantSensor,
|
StateRequest initialTargetState) :
|
||||||
ThermalModuleIF* thermalModule, Parameters parameters,
|
temperature(temperaturePoolId, dataSet, PoolVariableIF::VAR_WRITE),
|
||||||
Priority priority, StateRequest initialTargetState) :
|
targetState(targetStatePoolId, dataSet, PoolVariableIF::VAR_READ),
|
||||||
sensor(sensor), firstRedundantSensor(firstRedundantSensor), secondRedundantSensor(
|
currentState(currentStatePoolId, dataSet, PoolVariableIF::VAR_WRITE),
|
||||||
secondRedundantSensor), thermalModule(thermalModule), temperature(
|
heaterRequest(requestPoolId, dataSet, PoolVariableIF::VAR_WRITE),
|
||||||
temperaturePoolId, dataSet, PoolVariableIF::VAR_WRITE), targetState(
|
parameters(parameters),
|
||||||
targetStatePoolId, dataSet, PoolVariableIF::VAR_READ), currentState(
|
temperatureMonitor(reportingObjectId, domainId + 1,
|
||||||
currentStatePoolId, dataSet, PoolVariableIF::VAR_WRITE), heaterRequest(
|
GlobalDataPool::poolIdAndPositionToPid(temperaturePoolId, 0),
|
||||||
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),
|
|
||||||
COMPONENT_TEMP_CONFIRMATION), domainId(domainId) {
|
COMPONENT_TEMP_CONFIRMATION), domainId(domainId) {
|
||||||
if (thermalModule != NULL) {
|
|
||||||
thermalModule->registerComponent(this, priority);
|
|
||||||
}
|
|
||||||
//Set thermal state once, then leave to operator.
|
//Set thermal state once, then leave to operator.
|
||||||
GlobDataSet mySet;
|
GlobDataSet mySet;
|
||||||
gp_uint8_t writableTargetState(targetStatePoolId, &mySet,
|
gp_uint8_t writableTargetState(targetStatePoolId, &mySet,
|
||||||
@ -31,10 +22,39 @@ CoreComponent::CoreComponent(object_id_t reportingObjectId, uint8_t domainId,
|
|||||||
mySet.commit(PoolVariableIF::VALID);
|
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;
|
HeaterRequest request = HEATER_DONT_CARE;
|
||||||
//SHOULDDO: Better pass db_float_t* to getTemperature and set it invalid if invalid.
|
//SHOULDDO: Better pass db_float_t* to getTemperature and set it invalid if invalid.
|
||||||
temperature = getTemperature();
|
temperature = getTemperature();
|
||||||
@ -57,19 +77,21 @@ ThermalComponentIF::HeaterRequest CoreComponent::performOperation(uint8_t opCode
|
|||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreComponent::markStateIgnored() {
|
void ThermalComponentCore::markStateIgnored() {
|
||||||
currentState = getIgnoredState(currentState);
|
currentState = getIgnoredState(currentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
object_id_t CoreComponent::getObjectId() {
|
object_id_t ThermalComponentCore::getObjectId() {
|
||||||
return temperatureMonitor.getReporterId();
|
return temperatureMonitor.getReporterId();
|
||||||
}
|
}
|
||||||
|
|
||||||
float CoreComponent::getLowerOpLimit() {
|
float ThermalComponentCore::getLowerOpLimit() {
|
||||||
return parameters.lowerOpLimit;
|
return parameters.lowerOpLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreComponent::setTargetState(int8_t newState) {
|
|
||||||
|
|
||||||
|
ReturnValue_t ThermalComponentCore::setTargetState(int8_t newState) {
|
||||||
GlobDataSet mySet;
|
GlobDataSet mySet;
|
||||||
gp_uint8_t writableTargetState(targetState.getDataPoolId(),
|
gp_uint8_t writableTargetState(targetState.getDataPoolId(),
|
||||||
&mySet, PoolVariableIF::VAR_READ_WRITE);
|
&mySet, PoolVariableIF::VAR_READ_WRITE);
|
||||||
@ -92,7 +114,7 @@ ReturnValue_t CoreComponent::setTargetState(int8_t newState) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreComponent::setOutputInvalid() {
|
void ThermalComponentCore::setOutputInvalid() {
|
||||||
temperature = INVALID_TEMPERATURE;
|
temperature = INVALID_TEMPERATURE;
|
||||||
temperature.setValid(PoolVariableIF::INVALID);
|
temperature.setValid(PoolVariableIF::INVALID);
|
||||||
currentState.setValid(PoolVariableIF::INVALID);
|
currentState.setValid(PoolVariableIF::INVALID);
|
||||||
@ -101,20 +123,22 @@ void CoreComponent::setOutputInvalid() {
|
|||||||
temperatureMonitor.setToUnchecked();
|
temperatureMonitor.setToUnchecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
float CoreComponent::getTemperature() {
|
float ThermalComponentCore::getTemperature() {
|
||||||
if ((sensor != NULL) && (sensor->isValid())) {
|
if ((sensor != nullptr) && (sensor->isValid())) {
|
||||||
return sensor->getTemperature();
|
return sensor->getTemperature();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((firstRedundantSensor != NULL) && (firstRedundantSensor->isValid())) {
|
if ((firstRedundantSensor != nullptr) &&
|
||||||
|
(firstRedundantSensor->isValid())) {
|
||||||
return firstRedundantSensor->getTemperature();
|
return firstRedundantSensor->getTemperature();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((secondRedundantSensor != NULL) && (secondRedundantSensor->isValid())) {
|
if ((secondRedundantSensor != nullptr) &&
|
||||||
|
(secondRedundantSensor->isValid())) {
|
||||||
return secondRedundantSensor->getTemperature();
|
return secondRedundantSensor->getTemperature();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thermalModule != NULL) {
|
if (thermalModule != nullptr) {
|
||||||
float temperature = thermalModule->getTemperature();
|
float temperature = thermalModule->getTemperature();
|
||||||
if (temperature != ThermalModuleIF::INVALID_TEMPERATURE) {
|
if (temperature != ThermalModuleIF::INVALID_TEMPERATURE) {
|
||||||
return 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) {
|
Parameters parameters, int8_t targetState) {
|
||||||
ThermalComponentIF::State state;
|
ThermalComponentIF::State state;
|
||||||
|
|
||||||
@ -144,14 +168,14 @@ ThermalComponentIF::State CoreComponent::getState(float temperature,
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreComponent::checkLimits(ThermalComponentIF::State state) {
|
void ThermalComponentCore::checkLimits(ThermalComponentIF::State state) {
|
||||||
//Checks operational limits only.
|
//Checks operational limits only.
|
||||||
temperatureMonitor.translateState(state, temperature.value,
|
temperatureMonitor.translateState(state, temperature.value,
|
||||||
getParameters().lowerOpLimit, getParameters().upperOpLimit);
|
getParameters().lowerOpLimit, getParameters().upperOpLimit);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ThermalComponentIF::HeaterRequest CoreComponent::getHeaterRequest(
|
ThermalComponentIF::HeaterRequest ThermalComponentCore::getHeaterRequest(
|
||||||
int8_t targetState, float temperature, Parameters parameters) {
|
int8_t targetState, float temperature, Parameters parameters) {
|
||||||
if (targetState == STATE_REQUEST_IGNORE) {
|
if (targetState == STATE_REQUEST_IGNORE) {
|
||||||
isHeating = false;
|
isHeating = false;
|
||||||
@ -177,7 +201,7 @@ ThermalComponentIF::HeaterRequest CoreComponent::getHeaterRequest(
|
|||||||
return HEATER_DONT_CARE;
|
return HEATER_DONT_CARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThermalComponentIF::State CoreComponent::getIgnoredState(int8_t state) {
|
ThermalComponentIF::State ThermalComponentCore::getIgnoredState(int8_t state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case NON_OPERATIONAL_LOW:
|
case NON_OPERATIONAL_LOW:
|
||||||
return NON_OPERATIONAL_LOW_IGNORED;
|
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) {
|
if (temperature == INVALID_TEMPERATURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -209,15 +233,15 @@ void CoreComponent::updateMinMaxTemp() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t CoreComponent::getDomainId() const {
|
uint8_t ThermalComponentCore::getDomainId() const {
|
||||||
return domainId;
|
return domainId;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreComponent::Parameters CoreComponent::getParameters() {
|
ThermalComponentCore::Parameters ThermalComponentCore::getParameters() {
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreComponent::getParameter(uint8_t domainId,
|
ReturnValue_t ThermalComponentCore::getParameter(uint8_t domainId,
|
||||||
uint16_t parameterId, ParameterWrapper* parameterWrapper,
|
uint16_t parameterId, ParameterWrapper* parameterWrapper,
|
||||||
const ParameterWrapper* newValues, uint16_t startAtIndex) {
|
const ParameterWrapper* newValues, uint16_t startAtIndex) {
|
||||||
ReturnValue_t result = temperatureMonitor.getParameter(domainId,
|
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
|
SAFE = 0, //!< SAFE
|
||||||
IDLE, //!< IDLE
|
IDLE, //!< IDLE
|
||||||
PAYLOAD, //!< PAYLOAD
|
PAYLOAD, //!< PAYLOAD
|
||||||
NUMBER_OF_PRIORITIES //!< MAX_PRIORITY
|
NUMBER_OF_PRIORITIES //!< MAX_PRIORITY
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The elements are ordered by priority, lowest have highest priority
|
* The elements are ordered by priority, lowest have highest priority
|
||||||
*/
|
*/
|
||||||
enum HeaterRequest {
|
enum HeaterRequest {
|
||||||
HEATER_REQUEST_EMERGENCY_OFF = 0, //!< REQUEST_EMERGENCY_OFF
|
HEATER_REQUEST_EMERGENCY_OFF = 0, //!< REQUEST_EMERGENCY_OFF
|
||||||
HEATER_REQUEST_EMERGENCY_ON, //!< REQUEST_EMERGENCY_ON
|
HEATER_REQUEST_EMERGENCY_ON, //!< REQUEST_EMERGENCY_ON
|
||||||
HEATER_REQUEST_OFF, //!< REQUEST_OFF
|
HEATER_REQUEST_OFF, //!< REQUEST_OFF
|
||||||
HEATER_REQUEST_ON, //!< REQUEST_ON
|
HEATER_REQUEST_ON, //!< REQUEST_ON
|
||||||
HEATER_DONT_CARE //!< DONT_CARE
|
HEATER_DONT_CARE //!< DONT_CARE
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~ThermalComponentIF() {
|
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 "ThermalMonitorReporter.h"
|
||||||
#include "../thermal/ThermalComponentIF.h"
|
#include "ThermalComponentIF.h"
|
||||||
|
|
||||||
#include "../monitoring/MonitoringIF.h"
|
#include "../monitoring/MonitoringIF.h"
|
||||||
ThermalMonitor::~ThermalMonitor() {
|
|
||||||
|
ThermalMonitorReporter::~ThermalMonitorReporter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermalMonitor::sendTransitionEvent(float currentValue,
|
void ThermalMonitorReporter::sendTransitionEvent(float currentValue,
|
||||||
ReturnValue_t state) {
|
ReturnValue_t state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case MonitoringIF::BELOW_LOW_LIMIT:
|
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) {
|
if (oldState == ThermalComponentIF::ABOVE_OPERATIONAL_LIMIT) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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) {
|
float upperLimit, bool componentIsOperational) {
|
||||||
if (ThermalComponentIF::isIgnoredState(state)) {
|
if (ThermalComponentIF::isIgnoredState(state)) {
|
||||||
setToUnchecked();
|
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