thermal module replacements
This commit is contained in:
parent
4bb9dd816e
commit
f581b37fcf
@ -4,9 +4,6 @@
|
|||||||
#include "PowerComponentIF.h"
|
#include "PowerComponentIF.h"
|
||||||
#include "PowerSwitchIF.h"
|
#include "PowerSwitchIF.h"
|
||||||
|
|
||||||
#include "../datapoolglob/GlobalDataSet.h"
|
|
||||||
#include "../datapoolglob/GlobalPoolVariable.h"
|
|
||||||
#include "../datapoolglob/PIDReader.h"
|
|
||||||
#include "../devicehandlers/HealthDevice.h"
|
#include "../devicehandlers/HealthDevice.h"
|
||||||
#include "../monitoring/AbsLimitMonitor.h"
|
#include "../monitoring/AbsLimitMonitor.h"
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
#ifndef FSFW_POWER_POWERSENSOR_H_
|
#ifndef FSFW_POWER_POWERSENSOR_H_
|
||||||
#define FSFW_POWER_POWERSENSOR_H_
|
#define FSFW_POWER_POWERSENSOR_H_
|
||||||
|
|
||||||
#include "../datapoolglob/GlobalDataSet.h"
|
|
||||||
#include "../datapoolglob/GlobalPoolVariable.h"
|
|
||||||
#include "../datapoolglob/PIDReader.h"
|
|
||||||
#include "../datapoollocal/StaticLocalDataSet.h"
|
#include "../datapoollocal/StaticLocalDataSet.h"
|
||||||
#include "../devicehandlers/HealthDevice.h"
|
#include "../devicehandlers/HealthDevice.h"
|
||||||
#include "../monitoring/LimitMonitor.h"
|
#include "../monitoring/LimitMonitor.h"
|
||||||
|
@ -22,22 +22,23 @@ ThermalComponent::~ThermalComponent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ThermalComponent::setTargetState(int8_t newState) {
|
ReturnValue_t ThermalComponent::setTargetState(int8_t newState) {
|
||||||
GlobDataSet mySet;
|
// GlobDataSet mySet;
|
||||||
gp_int8_t writableTargetState(targetState.getDataPoolId(),
|
// gp_int8_t writableTargetState(targetState.getDataPoolId(),
|
||||||
&mySet, PoolVariableIF::VAR_READ_WRITE);
|
// &mySet, PoolVariableIF::VAR_READ_WRITE);
|
||||||
mySet.read();
|
// mySet.read();
|
||||||
if ((writableTargetState == STATE_REQUEST_OPERATIONAL)
|
// if ((writableTargetState == STATE_REQUEST_OPERATIONAL)
|
||||||
&& (newState != STATE_REQUEST_IGNORE)) {
|
// && (newState != STATE_REQUEST_IGNORE)) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
// return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
// }
|
||||||
switch (newState) {
|
// switch (newState) {
|
||||||
case STATE_REQUEST_NON_OPERATIONAL:
|
// case STATE_REQUEST_NON_OPERATIONAL:
|
||||||
writableTargetState = newState;
|
// writableTargetState = newState;
|
||||||
mySet.commit(PoolVariableIF::VALID);
|
// mySet.commit(PoolVariableIF::VALID);
|
||||||
|
// return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
// default:
|
||||||
|
// return ThermalComponentCore::setTargetState(newState);
|
||||||
|
// }
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
default:
|
|
||||||
return ThermalComponentCore::setTargetState(newState);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ThermalComponent::setLimits(const uint8_t* data, size_t size) {
|
ReturnValue_t ThermalComponent::setLimits(const uint8_t* data, size_t size) {
|
||||||
|
@ -96,25 +96,26 @@ float ThermalComponentCore::getLowerOpLimit() {
|
|||||||
|
|
||||||
|
|
||||||
ReturnValue_t ThermalComponentCore::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);
|
||||||
mySet.read();
|
// mySet.read();
|
||||||
if ((writableTargetState == STATE_REQUEST_OPERATIONAL)
|
// if ((writableTargetState == STATE_REQUEST_OPERATIONAL)
|
||||||
&& (newState != STATE_REQUEST_IGNORE)) {
|
// && (newState != STATE_REQUEST_IGNORE)) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
// return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
// }
|
||||||
switch (newState) {
|
// switch (newState) {
|
||||||
case STATE_REQUEST_HEATING:
|
// case STATE_REQUEST_HEATING:
|
||||||
case STATE_REQUEST_IGNORE:
|
// case STATE_REQUEST_IGNORE:
|
||||||
case STATE_REQUEST_OPERATIONAL:
|
// case STATE_REQUEST_OPERATIONAL:
|
||||||
writableTargetState = newState;
|
// writableTargetState = newState;
|
||||||
break;
|
// break;
|
||||||
case STATE_REQUEST_NON_OPERATIONAL:
|
// case STATE_REQUEST_NON_OPERATIONAL:
|
||||||
default:
|
// default:
|
||||||
return INVALID_TARGET_STATE;
|
// return INVALID_TARGET_STATE;
|
||||||
}
|
// }
|
||||||
mySet.commit(PoolVariableIF::VALID);
|
// mySet.commit(PoolVariableIF::VALID);
|
||||||
|
// return HasReturnvaluesIF::RETURN_OK;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#include "AbstractTemperatureSensor.h"
|
#include "AbstractTemperatureSensor.h"
|
||||||
#include "ThermalModule.h"
|
#include "ThermalModule.h"
|
||||||
|
|
||||||
//#include "../datapoolglob/GlobalDataSet.h"
|
|
||||||
//#include "../datapoolglob/GlobalPoolVariable.h"
|
|
||||||
#include "../datapoollocal/LocalPoolVariable.h"
|
#include "../datapoollocal/LocalPoolVariable.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,28 +1,31 @@
|
|||||||
#include "../monitoring/LimitViolationReporter.h"
|
|
||||||
#include "../monitoring/MonitoringMessageContent.h"
|
|
||||||
#include "ThermalModule.h"
|
#include "ThermalModule.h"
|
||||||
|
|
||||||
#include "AbstractTemperatureSensor.h"
|
#include "AbstractTemperatureSensor.h"
|
||||||
|
|
||||||
ThermalModule::ThermalModule(uint32_t moduleTemperaturePoolId,
|
#include "../monitoring/LimitViolationReporter.h"
|
||||||
uint32_t currentStatePoolId, uint32_t targetStatePoolId,
|
#include "../monitoring/MonitoringMessageContent.h"
|
||||||
GlobDataSet *dataSet, Parameters parameters,
|
|
||||||
|
|
||||||
|
ThermalModule::ThermalModule(gp_id_t moduleTemperaturePoolId,
|
||||||
|
gp_id_t currentStatePoolId, gp_id_t targetStatePoolId,
|
||||||
|
LocalPoolDataSetBase *dataSet, Parameters parameters,
|
||||||
RedundantHeater::Parameters heaterParameters) :
|
RedundantHeater::Parameters heaterParameters) :
|
||||||
oldStrategy(ACTIVE_SINGLE), survivalTargetTemp(0), targetTemp(0), heating(
|
oldStrategy(ACTIVE_SINGLE), parameters(parameters),
|
||||||
false), parameters(parameters), moduleTemperature(
|
moduleTemperature(moduleTemperaturePoolId, dataSet,
|
||||||
moduleTemperaturePoolId, dataSet, PoolVariableIF::VAR_WRITE), currentState(
|
PoolVariableIF::VAR_WRITE),
|
||||||
currentStatePoolId, dataSet, PoolVariableIF::VAR_WRITE), targetState(
|
currentState(currentStatePoolId, dataSet, PoolVariableIF::VAR_WRITE),
|
||||||
targetStatePoolId, dataSet, PoolVariableIF::VAR_READ) {
|
targetState(targetStatePoolId, dataSet, PoolVariableIF::VAR_READ) {
|
||||||
heater = new RedundantHeater(heaterParameters);
|
heater = new RedundantHeater(heaterParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThermalModule::ThermalModule(uint32_t moduleTemperaturePoolId, GlobDataSet* dataSet) :
|
ThermalModule::ThermalModule(gp_id_t moduleTemperaturePoolId,
|
||||||
oldStrategy(ACTIVE_SINGLE), survivalTargetTemp(0), targetTemp(0), heating(
|
LocalPoolDataSetBase* dataSet) :
|
||||||
false), parameters( { 0, 0 }), moduleTemperature(
|
oldStrategy(ACTIVE_SINGLE), parameters( { 0, 0 }),
|
||||||
moduleTemperaturePoolId, dataSet, PoolVariableIF::VAR_WRITE), heater(
|
moduleTemperature(moduleTemperaturePoolId, dataSet,
|
||||||
NULL), currentState(PoolVariableIF::INVALID, dataSet,
|
PoolVariableIF::VAR_WRITE),
|
||||||
PoolVariableIF::VAR_WRITE), targetState(PoolVariableIF::INVALID,
|
currentState(gp_id_t(), dataSet,
|
||||||
dataSet, PoolVariableIF::VAR_READ) {
|
PoolVariableIF::VAR_WRITE),
|
||||||
|
targetState(gp_id_t(), dataSet,
|
||||||
|
PoolVariableIF::VAR_READ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ThermalModule::~ThermalModule() {
|
ThermalModule::~ThermalModule() {
|
||||||
@ -30,7 +33,7 @@ ThermalModule::~ThermalModule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThermalModule::performOperation(uint8_t opCode) {
|
void ThermalModule::performOperation(uint8_t opCode) {
|
||||||
if (heater != NULL) {
|
if (heater != nullptr) {
|
||||||
heater->performOperation(0);
|
heater->performOperation(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,7 +45,7 @@ void ThermalModule::performMode(Strategy strategy) {
|
|||||||
ThermalComponentIF::HeaterRequest componentHeaterRequest =
|
ThermalComponentIF::HeaterRequest componentHeaterRequest =
|
||||||
letComponentsPerformAndDeciceIfWeNeedToHeat(safeOnly);
|
letComponentsPerformAndDeciceIfWeNeedToHeat(safeOnly);
|
||||||
|
|
||||||
if (heater == NULL) {
|
if (heater == nullptr) {
|
||||||
informComponentsAboutHeaterState(false, NONE);
|
informComponentsAboutHeaterState(false, NONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -53,7 +56,7 @@ void ThermalModule::performMode(Strategy strategy) {
|
|||||||
//Components overwrite the module request.
|
//Components overwrite the module request.
|
||||||
heating = ((componentHeaterRequest
|
heating = ((componentHeaterRequest
|
||||||
== ThermalComponentIF::HEATER_REQUEST_ON)
|
== ThermalComponentIF::HEATER_REQUEST_ON)
|
||||||
|| (componentHeaterRequest
|
or (componentHeaterRequest
|
||||||
== ThermalComponentIF::HEATER_REQUEST_EMERGENCY_ON));
|
== ThermalComponentIF::HEATER_REQUEST_EMERGENCY_ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +79,7 @@ void ThermalModule::performMode(Strategy strategy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float ThermalModule::getTemperature() {
|
float ThermalModule::getTemperature() {
|
||||||
return moduleTemperature;
|
return moduleTemperature.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermalModule::registerSensor(AbstractTemperatureSensor * sensor) {
|
void ThermalModule::registerSensor(AbstractTemperatureSensor * sensor) {
|
||||||
@ -85,7 +88,8 @@ void ThermalModule::registerSensor(AbstractTemperatureSensor * sensor) {
|
|||||||
|
|
||||||
void ThermalModule::registerComponent(ThermalComponentIF* component,
|
void ThermalModule::registerComponent(ThermalComponentIF* component,
|
||||||
ThermalComponentIF::Priority priority) {
|
ThermalComponentIF::Priority priority) {
|
||||||
components.push_back(ComponentData( { component, priority, ThermalComponentIF::HEATER_DONT_CARE }));
|
components.push_back(ComponentData( { component, priority,
|
||||||
|
ThermalComponentIF::HEATER_DONT_CARE }));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermalModule::calculateTemperature() {
|
void ThermalModule::calculateTemperature() {
|
||||||
@ -94,12 +98,13 @@ void ThermalModule::calculateTemperature() {
|
|||||||
std::list<AbstractTemperatureSensor *>::iterator iter = sensors.begin();
|
std::list<AbstractTemperatureSensor *>::iterator iter = sensors.begin();
|
||||||
for (; iter != sensors.end(); iter++) {
|
for (; iter != sensors.end(); iter++) {
|
||||||
if ((*iter)->isValid()) {
|
if ((*iter)->isValid()) {
|
||||||
moduleTemperature = moduleTemperature + (*iter)->getTemperature();
|
moduleTemperature = moduleTemperature.value +
|
||||||
|
(*iter)->getTemperature();
|
||||||
numberOfValidSensors++;
|
numberOfValidSensors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (numberOfValidSensors != 0) {
|
if (numberOfValidSensors != 0) {
|
||||||
moduleTemperature = moduleTemperature / numberOfValidSensors;
|
moduleTemperature = moduleTemperature.value / numberOfValidSensors;
|
||||||
moduleTemperature.setValid(PoolVariableIF::VALID);
|
moduleTemperature.setValid(PoolVariableIF::VALID);
|
||||||
} else {
|
} else {
|
||||||
moduleTemperature = INVALID_TEMPERATURE;
|
moduleTemperature = INVALID_TEMPERATURE;
|
||||||
@ -117,9 +122,10 @@ ThermalComponentIF* ThermalModule::findComponent(object_id_t objectId) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThermalComponentIF::HeaterRequest ThermalModule::letComponentsPerformAndDeciceIfWeNeedToHeat(
|
ThermalComponentIF::HeaterRequest
|
||||||
bool safeOnly) {
|
ThermalModule::letComponentsPerformAndDeciceIfWeNeedToHeat(bool safeOnly) {
|
||||||
ThermalComponentIF::HeaterRequest heaterRequests[ThermalComponentIF::NUMBER_OF_PRIORITIES];
|
ThermalComponentIF::HeaterRequest
|
||||||
|
heaterRequests[ThermalComponentIF::NUMBER_OF_PRIORITIES];
|
||||||
|
|
||||||
survivalTargetTemp = -999;
|
survivalTargetTemp = -999;
|
||||||
targetTemp = -999;
|
targetTemp = -999;
|
||||||
@ -224,7 +230,7 @@ bool ThermalModule::calculateModuleHeaterRequestAndSetModuleStatus(
|
|||||||
limit = survivalTargetTemp;
|
limit = survivalTargetTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moduleTemperature >= limit) {
|
if (moduleTemperature.value >= limit) {
|
||||||
currentState = OPERATIONAL;
|
currentState = OPERATIONAL;
|
||||||
} else {
|
} else {
|
||||||
currentState = NON_OPERATIONAL;
|
currentState = NON_OPERATIONAL;
|
||||||
@ -250,15 +256,15 @@ bool ThermalModule::calculateModuleHeaterRequestAndSetModuleStatus(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThermalModule::setHeating(bool on) {
|
void ThermalModule::setHeating(bool on) {
|
||||||
GlobDataSet mySet;
|
// GlobDataSet mySet;
|
||||||
gp_int8_t writableTargetState(targetState.getDataPoolId(),
|
// gp_int8_t writableTargetState(targetState.getDataPoolId(),
|
||||||
&mySet, PoolVariableIF::VAR_WRITE);
|
// &mySet, PoolVariableIF::VAR_WRITE);
|
||||||
if (on) {
|
// if (on) {
|
||||||
writableTargetState = STATE_REQUEST_HEATING;
|
// writableTargetState = STATE_REQUEST_HEATING;
|
||||||
} else {
|
// } else {
|
||||||
writableTargetState = STATE_REQUEST_PASSIVE;
|
// writableTargetState = STATE_REQUEST_PASSIVE;
|
||||||
}
|
// }
|
||||||
mySet.commit(PoolVariableIF::VALID);
|
// mySet.commit(PoolVariableIF::VALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermalModule::updateTargetTemperatures(ThermalComponentIF* component,
|
void ThermalModule::updateTargetTemperatures(ThermalComponentIF* component,
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
#ifndef THERMALMODULE_H_
|
#ifndef FSFW_THERMAL_THERMALMODULE_H_
|
||||||
#define THERMALMODULE_H_
|
#define FSFW_THERMAL_THERMALMODULE_H_
|
||||||
|
|
||||||
#include "../datapoolglob/GlobalDataSet.h"
|
|
||||||
#include "../datapoolglob/GlobalPoolVariable.h"
|
|
||||||
#include "../devicehandlers/HealthDevice.h"
|
|
||||||
#include "../events/EventReportingProxyIF.h"
|
|
||||||
#include "ThermalModuleIF.h"
|
#include "ThermalModuleIF.h"
|
||||||
#include <list>
|
|
||||||
#include "tcsDefinitions.h"
|
#include "tcsDefinitions.h"
|
||||||
#include "RedundantHeater.h"
|
#include "RedundantHeater.h"
|
||||||
|
|
||||||
|
//#include "../datapoolglob/GlobalDataSet.h"
|
||||||
|
//#include "../datapoolglob/GlobalPoolVariable.h"
|
||||||
|
#include "../datapoollocal/LocalPoolDataSetBase.h"
|
||||||
|
#include "../datapoollocal/LocalPoolVariable.h"
|
||||||
|
#include "../devicehandlers/HealthDevice.h"
|
||||||
|
#include "../events/EventReportingProxyIF.h"
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
|
||||||
class PowerSwitchIF;
|
class PowerSwitchIF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,11 +28,12 @@ public:
|
|||||||
float hysteresis;
|
float hysteresis;
|
||||||
};
|
};
|
||||||
|
|
||||||
ThermalModule(uint32_t moduleTemperaturePoolId, uint32_t currentStatePoolId,
|
ThermalModule(gp_id_t moduleTemperaturePoolId, gp_id_t currentStatePoolId,
|
||||||
uint32_t targetStatePoolId, GlobDataSet *dataSet, Parameters parameters,
|
gp_id_t targetStatePoolId, LocalPoolDataSetBase *dataSet,
|
||||||
RedundantHeater::Parameters heaterParameters);
|
Parameters parameters, RedundantHeater::Parameters heaterParameters);
|
||||||
|
|
||||||
ThermalModule(uint32_t moduleTemperaturePoolId, GlobDataSet *dataSet);
|
ThermalModule(gp_id_t moduleTemperaturePoolId,
|
||||||
|
LocalPoolDataSetBase *dataSet);
|
||||||
|
|
||||||
virtual ~ThermalModule();
|
virtual ~ThermalModule();
|
||||||
|
|
||||||
@ -62,20 +69,21 @@ protected:
|
|||||||
|
|
||||||
Strategy oldStrategy;
|
Strategy oldStrategy;
|
||||||
|
|
||||||
float survivalTargetTemp;
|
float survivalTargetTemp = 0.0;
|
||||||
|
|
||||||
float targetTemp;
|
float targetTemp = 0.0;
|
||||||
|
|
||||||
bool heating;
|
bool heating = false;
|
||||||
|
|
||||||
Parameters parameters;
|
Parameters parameters;
|
||||||
|
|
||||||
gp_float_t moduleTemperature;
|
lp_var_t<float> moduleTemperature;
|
||||||
|
//gp_float_t moduleTemperature;
|
||||||
|
|
||||||
RedundantHeater *heater;
|
RedundantHeater *heater = nullptr;
|
||||||
|
|
||||||
gp_int8_t currentState;
|
lp_var_t<int8_t> currentState;
|
||||||
gp_int8_t targetState;
|
lp_var_t<int8_t> targetState;
|
||||||
|
|
||||||
std::list<AbstractTemperatureSensor *> sensors;
|
std::list<AbstractTemperatureSensor *> sensors;
|
||||||
std::list<ComponentData> components;
|
std::list<ComponentData> components;
|
||||||
@ -92,4 +100,4 @@ protected:
|
|||||||
void updateTargetTemperatures(ThermalComponentIF *component, bool isSafe);
|
void updateTargetTemperatures(ThermalComponentIF *component, bool isSafe);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* THERMALMODULE_H_ */
|
#endif /* FSFW_THERMAL_THERMALMODULE_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user