compiling again

This commit is contained in:
Robin Müller 2020-11-30 16:06:59 +01:00
parent f70ee7696a
commit 4bb9dd816e
12 changed files with 196 additions and 132 deletions

View File

@ -67,3 +67,7 @@ void LocalPoolObjectBase::setChanged(bool changed) {
bool LocalPoolObjectBase::hasChanged() const { bool LocalPoolObjectBase::hasChanged() const {
return changed; return changed;
} }
void LocalPoolObjectBase::setReadWriteMode(pool_rwm_t newReadWriteMode) {
this->readWriteMode = newReadWriteMode;
}

View File

@ -18,6 +18,7 @@ public:
DataSetIF* dataSet = nullptr, DataSetIF* dataSet = nullptr,
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE); pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
void setReadWriteMode(pool_rwm_t newReadWriteMode);
pool_rwm_t getReadWriteMode() const; pool_rwm_t getReadWriteMode() const;
bool isValid() const override; bool isValid() const override;

View File

@ -118,8 +118,21 @@ public:
ReturnValue_t commit(dur_millis_t lockTimeout = MutexIF::BLOCKING) override; ReturnValue_t commit(dur_millis_t lockTimeout = MutexIF::BLOCKING) override;
LocalPoolVar<T> &operator=(T newValue); LocalPoolVar<T> &operator=(const T& newValue);
LocalPoolVar<T> &operator=(LocalPoolVar<T> newPoolVariable); LocalPoolVar<T> &operator=(const LocalPoolVar<T>& newPoolVariable);
bool operator==(const LocalPoolVar<T>& other) const;
bool operator==(const T& other) const;
bool operator!=(const LocalPoolVar<T>& other) const;
bool operator!=(const T& other) const;
bool operator<(const LocalPoolVar<T>& other) const;
bool operator<(const T& other) const;
bool operator>(const LocalPoolVar<T>& other) const;
bool operator>(const T& other) const;
protected: protected:
/** /**
* @brief Like #read, but without a lock protection of the global pool. * @brief Like #read, but without a lock protection of the global pool.
@ -165,5 +178,4 @@ using lp_int64_t = LocalPoolVar<int64_t>;
using lp_float_t = LocalPoolVar<float>; using lp_float_t = LocalPoolVar<float>;
using lp_double_t = LocalPoolVar<double>; using lp_double_t = LocalPoolVar<double>;
#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_ */ #endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_ */

View File

@ -81,14 +81,14 @@ inline ReturnValue_t LocalPoolVar<T>::commitWithoutLock() {
} }
template<typename T> template<typename T>
inline LocalPoolVar<T> & LocalPoolVar<T>::operator=(T newValue) { inline LocalPoolVar<T> & LocalPoolVar<T>::operator=(const T& newValue) {
value = newValue; value = newValue;
return *this; return *this;
} }
template<typename T> template<typename T>
inline LocalPoolVar<T>& LocalPoolVar<T>::operator =( inline LocalPoolVar<T>& LocalPoolVar<T>::operator =(
LocalPoolVar<T> newPoolVariable) { const LocalPoolVar<T>& newPoolVariable) {
value = newPoolVariable.value; value = newPoolVariable.value;
return *this; return *this;
} }
@ -119,4 +119,47 @@ inline std::ostream& operator<< (std::ostream &out,
return out; return out;
} }
#endif template<typename T>
inline bool LocalPoolVar<T>::operator ==(const LocalPoolVar<T> &other) const {
return this->value == other.value;
}
template<typename T>
inline bool LocalPoolVar<T>::operator ==(const T &other) const {
return this->value == other;
}
template<typename T>
inline bool LocalPoolVar<T>::operator !=(const LocalPoolVar<T> &other) const {
return not (*this == other);
}
template<typename T>
inline bool LocalPoolVar<T>::operator !=(const T &other) const {
return not (*this == other);
}
template<typename T>
inline bool LocalPoolVar<T>::operator <(const LocalPoolVar<T> &other) const {
return this->value < other.value;
}
template<typename T>
inline bool LocalPoolVar<T>::operator <(const T &other) const {
return this->value < other;
}
template<typename T>
inline bool LocalPoolVar<T>::operator >(const LocalPoolVar<T> &other) const {
return not (*this < other);
}
template<typename T>
inline bool LocalPoolVar<T>::operator >(const T &other) const {
return not (*this < other);
}
#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_TPP_ */

View File

@ -66,8 +66,8 @@ protected:
switch (state) { switch (state) {
case MonitoringIF::OUT_OF_RANGE: case MonitoringIF::OUT_OF_RANGE:
EventManagerIF::triggerEvent(this->reportingId, EventManagerIF::triggerEvent(this->reportingId,
violationEvent, this->parameterId.objectId, violationEvent, this->globalPoolId.objectId,
this->parameterId.localPoolId); this->globalPoolId.localPoolId);
break; break;
default: default:
break; break;

View File

@ -80,11 +80,11 @@ protected:
switch (state) { switch (state) {
case MonitoringIF::BELOW_LOW_LIMIT: case MonitoringIF::BELOW_LOW_LIMIT:
EventManagerIF::triggerEvent(this->reportingId, belowLowEvent, EventManagerIF::triggerEvent(this->reportingId, belowLowEvent,
this->parameterId.objectId, this->parameterId.localPoolId); this->globalPoolId.objectId, this->globalPoolId.localPoolId);
break; break;
case MonitoringIF::ABOVE_HIGH_LIMIT: case MonitoringIF::ABOVE_HIGH_LIMIT:
EventManagerIF::triggerEvent(this->reportingId, aboveHighEvent, EventManagerIF::triggerEvent(this->reportingId, aboveHighEvent,
this->parameterId.objectId, this->parameterId.localPoolId); this->globalPoolId.objectId, this->globalPoolId.localPoolId);
break; break;
default: default:
break; break;

View File

@ -20,7 +20,7 @@ public:
MonitorReporter(object_id_t reportingId, uint8_t monitorId, MonitorReporter(object_id_t reportingId, uint8_t monitorId,
gp_id_t globalPoolId, uint16_t confirmationLimit) : gp_id_t globalPoolId, uint16_t confirmationLimit) :
monitorId(monitorId), parameterId(parameterId), monitorId(monitorId), globalPoolId(globalPoolId),
reportingId(reportingId), oldState(MonitoringIF::UNCHECKED), reportingId(reportingId), oldState(MonitoringIF::UNCHECKED),
reportingEnabled(ENABLED), eventEnabled(ENABLED), currentCounter(0), reportingEnabled(ENABLED), eventEnabled(ENABLED), currentCounter(0),
confirmationLimit(confirmationLimit) { confirmationLimit(confirmationLimit) {
@ -96,7 +96,7 @@ public:
protected: protected:
const uint8_t monitorId; const uint8_t monitorId;
const gp_id_t parameterId; const gp_id_t globalPoolId;
object_id_t reportingId; object_id_t reportingId;
ReturnValue_t oldState; ReturnValue_t oldState;
@ -167,13 +167,13 @@ protected:
*/ */
virtual void sendTransitionReport(T parameterValue, T crossedLimit, virtual void sendTransitionReport(T parameterValue, T crossedLimit,
ReturnValue_t state) { ReturnValue_t state) {
MonitoringReportContent<T> report(parameterId, MonitoringReportContent<T> report(globalPoolId,
parameterValue, crossedLimit, oldState, state); parameterValue, crossedLimit, oldState, state);
LimitViolationReporter::sendLimitViolationReport(&report); LimitViolationReporter::sendLimitViolationReport(&report);
} }
ReturnValue_t setToState(ReturnValue_t state) { ReturnValue_t setToState(ReturnValue_t state) {
if (oldState != state && reportingEnabled) { if (oldState != state && reportingEnabled) {
MonitoringReportContent<T> report(parameterId, 0, 0, oldState, MonitoringReportContent<T> report(globalPoolId, 0, 0, oldState,
state); state);
LimitViolationReporter::sendLimitViolationReport(&report); LimitViolationReporter::sendLimitViolationReport(&report);
oldState = state; oldState = state;

View File

@ -72,19 +72,19 @@ ReturnValue_t Fuse::check() {
checkFuseState(); checkFuseState();
calculateFusePower(); calculateFusePower();
//Check if power is valid and if fuse state is off or invalid. //Check if power is valid and if fuse state is off or invalid.
// if (!power.isValid() || (state == 0) || !state.isValid()) { if (!power.isValid() || (state == 0) || !state.isValid()) {
// result = powerMonitor.setToInvalid(); result = powerMonitor.setToInvalid();
// } else { } else {
// float lowLimit = 0.0; float lowLimit = 0.0;
// float highLimit = RESIDUAL_POWER; float highLimit = RESIDUAL_POWER;
// calculatePowerLimits(&lowLimit, &highLimit); calculatePowerLimits(&lowLimit, &highLimit);
// result = powerMonitor.checkPower(power, lowLimit, highLimit); result = powerMonitor.checkPower(power.value, lowLimit, highLimit);
// if (result == MonitoringIF::BELOW_LOW_LIMIT) { if (result == MonitoringIF::BELOW_LOW_LIMIT) {
// reportEvents(POWER_BELOW_LOW_LIMIT); reportEvents(POWER_BELOW_LOW_LIMIT);
// } else if (result == MonitoringIF::ABOVE_HIGH_LIMIT) { } else if (result == MonitoringIF::ABOVE_HIGH_LIMIT) {
// reportEvents(POWER_ABOVE_HIGH_LIMIT); reportEvents(POWER_ABOVE_HIGH_LIMIT);
// } }
// } }
set.commit(); set.commit();
return result; return result;
} }
@ -135,7 +135,7 @@ void Fuse::calculateFusePower() {
return; return;
} }
//Calculate fuse power. //Calculate fuse power.
//power = current * voltage; power.value = current.value * voltage.value;
power.setValid(PoolVariableIF::VALID); power.setValid(PoolVariableIF::VALID);
} }
@ -188,20 +188,20 @@ void Fuse::checkFuseState() {
oldFuseState = 0; oldFuseState = 0;
return; return;
} }
// if (state == 0) { if (state == 0) {
// if (oldFuseState != 0) { if (oldFuseState != 0) {
// reportEvents(FUSE_WENT_OFF); reportEvents(FUSE_WENT_OFF);
// } }
// } }
// oldFuseState = state; oldFuseState = state.value;
} }
float Fuse::getPower() { float Fuse::getPower() {
// if (power.isValid()) { if (power.isValid()) {
// return power; return power.value;
// } else { } else {
// return 0.0; return 0.0;
// } }
} }
void Fuse::setDataPoolEntriesInvalid() { void Fuse::setDataPoolEntriesInvalid() {

View File

@ -26,24 +26,24 @@ ReturnValue_t PowerSensor::calculatePower() {
powerSensorSet.read(); powerSensorSet.read();
ReturnValue_t result1 = HasReturnvaluesIF::RETURN_FAILED; ReturnValue_t result1 = HasReturnvaluesIF::RETURN_FAILED;
ReturnValue_t result2 = HasReturnvaluesIF::RETURN_FAILED; ReturnValue_t result2 = HasReturnvaluesIF::RETURN_FAILED;
// if (healthHelper.healthTable->isHealthy(getObjectId()) && voltage.isValid() if (healthHelper.healthTable->isHealthy(getObjectId()) && voltage.isValid()
// && current.isValid()) { && current.isValid()) {
// result1 = voltageLimit.doCheck(voltage); result1 = voltageLimit.doCheck(voltage.value);
// result2 = currentLimit.doCheck(current); result2 = currentLimit.doCheck(current.value);
// } else { } else {
// voltageLimit.setToInvalid(); voltageLimit.setToInvalid();
// currentLimit.setToInvalid(); currentLimit.setToInvalid();
// result1 = OBJECT_NOT_HEALTHY; result1 = OBJECT_NOT_HEALTHY;
// } }
// if (result1 != HasReturnvaluesIF::RETURN_OK if (result1 != HasReturnvaluesIF::RETURN_OK
// || result2 != HasReturnvaluesIF::RETURN_OK) { || result2 != HasReturnvaluesIF::RETURN_OK) {
// result1 = MonitoringIF::INVALID; result1 = MonitoringIF::INVALID;
// power.setValid(PoolVariableIF::INVALID); power.setValid(PoolVariableIF::INVALID);
// } else { } else {
// power.setValid(PoolVariableIF::VALID); power.setValid(PoolVariableIF::VALID);
// power = current * voltage; power.value = current.value * voltage.value;
// } }
// powerSensorSet.commit(); powerSensorSet.commit();
return result1; return result1;
} }

View File

@ -9,16 +9,18 @@ ThermalComponentCore::ThermalComponentCore(object_id_t reportingObjectId,
targetState(targetStatePoolId, dataSet, PoolVariableIF::VAR_READ), targetState(targetStatePoolId, dataSet, PoolVariableIF::VAR_READ),
currentState(currentStatePoolId, dataSet, PoolVariableIF::VAR_WRITE), currentState(currentStatePoolId, dataSet, PoolVariableIF::VAR_WRITE),
heaterRequest(requestPoolId, dataSet, PoolVariableIF::VAR_WRITE), heaterRequest(requestPoolId, dataSet, PoolVariableIF::VAR_WRITE),
parameters(parameters), domainId(domainId) { parameters(parameters), domainId(domainId),
//temperatureMonitor(reportingObjectId, domainId + 1, temperatureMonitor(reportingObjectId, domainId + 1,temperaturePoolId,
// GlobalDataPool::poolIdAndPositionToPid(temperaturePoolId, 0), COMPONENT_TEMP_CONFIRMATION) {
// COMPONENT_TEMP_CONFIRMATION), domainId(domainId) {
//Set thermal state once, then leave to operator. //Set thermal state once, then leave to operator.
//GlobDataSet mySet; targetState.setReadWriteMode(PoolVariableIF::VAR_WRITE);
//gp_uint8_t writableTargetState(targetStatePoolId, &mySet, ReturnValue_t result = targetState.read();
// PoolVariableIF::VAR_WRITE); if(result == HasReturnvaluesIF::RETURN_OK) {
//writableTargetState = initialTargetState; targetState = initialTargetState;
//mySet.commit(PoolVariableIF::VALID); targetState.setValid(true);
targetState.commit();
}
targetState.setReadWriteMode(PoolVariableIF::VAR_READ);
} }
void ThermalComponentCore::addSensor(AbstractTemperatureSensor* sensor) { void ThermalComponentCore::addSensor(AbstractTemperatureSensor* sensor) {
@ -57,19 +59,21 @@ ThermalComponentIF::HeaterRequest ThermalComponentCore::performOperation(
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();
//updateMinMaxTemp(); updateMinMaxTemp();
//if ((temperature != INVALID_TEMPERATURE)) { if ((temperature != INVALID_TEMPERATURE)) {
//temperature.setValid(PoolVariableIF::VALID); temperature.setValid(PoolVariableIF::VALID);
//State state = getState(temperature, getParameters(), targetState); State state = getState(temperature.value, getParameters(),
//currentState = state; targetState.value);
//checkLimits(state); currentState = state;
//request = getHeaterRequest(targetState, temperature, getParameters()); checkLimits(state);
//} else { request = getHeaterRequest(targetState.value, temperature.value,
// temperatureMonitor.setToInvalid(); getParameters());
// temperature.setValid(PoolVariableIF::INVALID); } else {
// currentState = UNKNOWN; temperatureMonitor.setToInvalid();
// request = HEATER_DONT_CARE; temperature.setValid(PoolVariableIF::INVALID);
//} currentState = UNKNOWN;
request = HEATER_DONT_CARE;
}
currentState.setValid(PoolVariableIF::VALID); currentState.setValid(PoolVariableIF::VALID);
heaterRequest = request; heaterRequest = request;
heaterRequest.setValid(PoolVariableIF::VALID); heaterRequest.setValid(PoolVariableIF::VALID);
@ -77,11 +81,11 @@ ThermalComponentIF::HeaterRequest ThermalComponentCore::performOperation(
} }
void ThermalComponentCore::markStateIgnored() { void ThermalComponentCore::markStateIgnored() {
//currentState = getIgnoredState(currentState); currentState = getIgnoredState(currentState.value);
} }
object_id_t ThermalComponentCore::getObjectId() { object_id_t ThermalComponentCore::getObjectId() {
//return temperatureMonitor.getReporterId(); return temperatureMonitor.getReporterId();
return 0; return 0;
} }
@ -120,7 +124,7 @@ void ThermalComponentCore::setOutputInvalid() {
currentState.setValid(PoolVariableIF::INVALID); currentState.setValid(PoolVariableIF::INVALID);
heaterRequest = HEATER_DONT_CARE; heaterRequest = HEATER_DONT_CARE;
heaterRequest.setValid(PoolVariableIF::INVALID); heaterRequest.setValid(PoolVariableIF::INVALID);
//temperatureMonitor.setToUnchecked(); temperatureMonitor.setToUnchecked();
} }
float ThermalComponentCore::getTemperature() { float ThermalComponentCore::getTemperature() {
@ -170,8 +174,8 @@ ThermalComponentIF::State ThermalComponentCore::getState(float temperature,
void ThermalComponentCore::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);
} }
@ -221,17 +225,17 @@ ThermalComponentIF::State ThermalComponentCore::getIgnoredState(int8_t state) {
} }
} }
//void ThermalComponentCore::updateMinMaxTemp() { void ThermalComponentCore::updateMinMaxTemp() {
// if (temperature == INVALID_TEMPERATURE) { if (temperature == INVALID_TEMPERATURE) {
// return; return;
// } }
// if (temperature < minTemp) { if (temperature < minTemp) {
// minTemp = temperature; minTemp = temperature.value;
// } }
// if (temperature > maxTemp) { if (temperature > maxTemp) {
// maxTemp = temperature; maxTemp = temperature.value;
// } }
//} }
uint8_t ThermalComponentCore::getDomainId() const { uint8_t ThermalComponentCore::getDomainId() const {
return domainId; return domainId;
@ -244,38 +248,38 @@ ThermalComponentCore::Parameters ThermalComponentCore::getParameters() {
ReturnValue_t ThermalComponentCore::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,
// parameterId, parameterWrapper, newValues, startAtIndex); parameterId, parameterWrapper, newValues, startAtIndex);
// if (result != INVALID_DOMAIN_ID) { if (result != INVALID_DOMAIN_ID) {
// return result; return result;
// } }
// if (domainId != this->domainId) { if (domainId != this->domainId) {
// return INVALID_DOMAIN_ID; return INVALID_DOMAIN_ID;
// } }
// switch (parameterId) { switch (parameterId) {
// case 0: case 0:
// parameterWrapper->set(parameters.heaterOn); parameterWrapper->set(parameters.heaterOn);
// break; break;
// case 1: case 1:
// parameterWrapper->set(parameters.hysteresis); parameterWrapper->set(parameters.hysteresis);
// break; break;
// case 2: case 2:
// parameterWrapper->set(parameters.heaterSwitchoff); parameterWrapper->set(parameters.heaterSwitchoff);
// break; break;
// case 3: case 3:
// parameterWrapper->set(minTemp); parameterWrapper->set(minTemp);
// break; break;
// case 4: case 4:
// parameterWrapper->set(maxTemp); parameterWrapper->set(maxTemp);
// break; break;
// case 10: case 10:
// parameterWrapper->set(parameters.lowerOpLimit); parameterWrapper->set(parameters.lowerOpLimit);
// break; break;
// case 11: case 11:
// parameterWrapper->set(parameters.upperOpLimit); parameterWrapper->set(parameters.upperOpLimit);
// break; break;
// default: default:
// return INVALID_IDENTIFIER_ID; return INVALID_IDENTIFIER_ID;
// } }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -96,10 +96,10 @@ protected:
Parameters parameters; Parameters parameters;
//ThermalMonitorReporter temperatureMonitor;
const uint8_t domainId; const uint8_t domainId;
ThermalMonitorReporter temperatureMonitor;
virtual float getTemperature(); virtual float getTemperature();
virtual State getState(float temperature, Parameters parameters, virtual State getState(float temperature, Parameters parameters,
int8_t targetState); int8_t targetState);
@ -111,7 +111,7 @@ protected:
virtual State getIgnoredState(int8_t state); virtual State getIgnoredState(int8_t state);
//void updateMinMaxTemp(); void updateMinMaxTemp();
virtual Parameters getParameters(); virtual Parameters getParameters();
}; };

View File

@ -2,7 +2,7 @@
#define TCSDEFINITIONS_H_ #define TCSDEFINITIONS_H_
static const uint32_t INVALID_TEMPERATURE = 999; static const float INVALID_TEMPERATURE = 999;
#endif /* TCSDEFINITIONS_H_ */ #endif /* TCSDEFINITIONS_H_ */