compiling again
This commit is contained in:
parent
f70ee7696a
commit
4bb9dd816e
@ -67,3 +67,7 @@ void LocalPoolObjectBase::setChanged(bool changed) {
|
||||
bool LocalPoolObjectBase::hasChanged() const {
|
||||
return changed;
|
||||
}
|
||||
|
||||
void LocalPoolObjectBase::setReadWriteMode(pool_rwm_t newReadWriteMode) {
|
||||
this->readWriteMode = newReadWriteMode;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ public:
|
||||
DataSetIF* dataSet = nullptr,
|
||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
|
||||
|
||||
void setReadWriteMode(pool_rwm_t newReadWriteMode);
|
||||
pool_rwm_t getReadWriteMode() const;
|
||||
|
||||
bool isValid() const override;
|
||||
|
@ -118,8 +118,21 @@ public:
|
||||
ReturnValue_t commit(dur_millis_t lockTimeout = MutexIF::BLOCKING) override;
|
||||
|
||||
|
||||
LocalPoolVar<T> &operator=(T newValue);
|
||||
LocalPoolVar<T> &operator=(LocalPoolVar<T> newPoolVariable);
|
||||
LocalPoolVar<T> &operator=(const T& newValue);
|
||||
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:
|
||||
/**
|
||||
* @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_double_t = LocalPoolVar<double>;
|
||||
|
||||
|
||||
#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_ */
|
||||
|
@ -81,14 +81,14 @@ inline ReturnValue_t LocalPoolVar<T>::commitWithoutLock() {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline LocalPoolVar<T> & LocalPoolVar<T>::operator=(T newValue) {
|
||||
inline LocalPoolVar<T> & LocalPoolVar<T>::operator=(const T& newValue) {
|
||||
value = newValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline LocalPoolVar<T>& LocalPoolVar<T>::operator =(
|
||||
LocalPoolVar<T> newPoolVariable) {
|
||||
const LocalPoolVar<T>& newPoolVariable) {
|
||||
value = newPoolVariable.value;
|
||||
return *this;
|
||||
}
|
||||
@ -119,4 +119,47 @@ inline std::ostream& operator<< (std::ostream &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_ */
|
||||
|
@ -66,8 +66,8 @@ protected:
|
||||
switch (state) {
|
||||
case MonitoringIF::OUT_OF_RANGE:
|
||||
EventManagerIF::triggerEvent(this->reportingId,
|
||||
violationEvent, this->parameterId.objectId,
|
||||
this->parameterId.localPoolId);
|
||||
violationEvent, this->globalPoolId.objectId,
|
||||
this->globalPoolId.localPoolId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -80,11 +80,11 @@ protected:
|
||||
switch (state) {
|
||||
case MonitoringIF::BELOW_LOW_LIMIT:
|
||||
EventManagerIF::triggerEvent(this->reportingId, belowLowEvent,
|
||||
this->parameterId.objectId, this->parameterId.localPoolId);
|
||||
this->globalPoolId.objectId, this->globalPoolId.localPoolId);
|
||||
break;
|
||||
case MonitoringIF::ABOVE_HIGH_LIMIT:
|
||||
EventManagerIF::triggerEvent(this->reportingId, aboveHighEvent,
|
||||
this->parameterId.objectId, this->parameterId.localPoolId);
|
||||
this->globalPoolId.objectId, this->globalPoolId.localPoolId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
MonitorReporter(object_id_t reportingId, uint8_t monitorId,
|
||||
gp_id_t globalPoolId, uint16_t confirmationLimit) :
|
||||
monitorId(monitorId), parameterId(parameterId),
|
||||
monitorId(monitorId), globalPoolId(globalPoolId),
|
||||
reportingId(reportingId), oldState(MonitoringIF::UNCHECKED),
|
||||
reportingEnabled(ENABLED), eventEnabled(ENABLED), currentCounter(0),
|
||||
confirmationLimit(confirmationLimit) {
|
||||
@ -96,7 +96,7 @@ public:
|
||||
|
||||
protected:
|
||||
const uint8_t monitorId;
|
||||
const gp_id_t parameterId;
|
||||
const gp_id_t globalPoolId;
|
||||
object_id_t reportingId;
|
||||
ReturnValue_t oldState;
|
||||
|
||||
@ -167,13 +167,13 @@ protected:
|
||||
*/
|
||||
virtual void sendTransitionReport(T parameterValue, T crossedLimit,
|
||||
ReturnValue_t state) {
|
||||
MonitoringReportContent<T> report(parameterId,
|
||||
MonitoringReportContent<T> report(globalPoolId,
|
||||
parameterValue, crossedLimit, oldState, state);
|
||||
LimitViolationReporter::sendLimitViolationReport(&report);
|
||||
}
|
||||
ReturnValue_t setToState(ReturnValue_t state) {
|
||||
if (oldState != state && reportingEnabled) {
|
||||
MonitoringReportContent<T> report(parameterId, 0, 0, oldState,
|
||||
MonitoringReportContent<T> report(globalPoolId, 0, 0, oldState,
|
||||
state);
|
||||
LimitViolationReporter::sendLimitViolationReport(&report);
|
||||
oldState = state;
|
||||
|
@ -72,19 +72,19 @@ ReturnValue_t Fuse::check() {
|
||||
checkFuseState();
|
||||
calculateFusePower();
|
||||
//Check if power is valid and if fuse state is off or invalid.
|
||||
// if (!power.isValid() || (state == 0) || !state.isValid()) {
|
||||
// result = powerMonitor.setToInvalid();
|
||||
// } else {
|
||||
// float lowLimit = 0.0;
|
||||
// float highLimit = RESIDUAL_POWER;
|
||||
// calculatePowerLimits(&lowLimit, &highLimit);
|
||||
// result = powerMonitor.checkPower(power, lowLimit, highLimit);
|
||||
// if (result == MonitoringIF::BELOW_LOW_LIMIT) {
|
||||
// reportEvents(POWER_BELOW_LOW_LIMIT);
|
||||
// } else if (result == MonitoringIF::ABOVE_HIGH_LIMIT) {
|
||||
// reportEvents(POWER_ABOVE_HIGH_LIMIT);
|
||||
// }
|
||||
// }
|
||||
if (!power.isValid() || (state == 0) || !state.isValid()) {
|
||||
result = powerMonitor.setToInvalid();
|
||||
} else {
|
||||
float lowLimit = 0.0;
|
||||
float highLimit = RESIDUAL_POWER;
|
||||
calculatePowerLimits(&lowLimit, &highLimit);
|
||||
result = powerMonitor.checkPower(power.value, lowLimit, highLimit);
|
||||
if (result == MonitoringIF::BELOW_LOW_LIMIT) {
|
||||
reportEvents(POWER_BELOW_LOW_LIMIT);
|
||||
} else if (result == MonitoringIF::ABOVE_HIGH_LIMIT) {
|
||||
reportEvents(POWER_ABOVE_HIGH_LIMIT);
|
||||
}
|
||||
}
|
||||
set.commit();
|
||||
return result;
|
||||
}
|
||||
@ -135,7 +135,7 @@ void Fuse::calculateFusePower() {
|
||||
return;
|
||||
}
|
||||
//Calculate fuse power.
|
||||
//power = current * voltage;
|
||||
power.value = current.value * voltage.value;
|
||||
power.setValid(PoolVariableIF::VALID);
|
||||
}
|
||||
|
||||
@ -188,20 +188,20 @@ void Fuse::checkFuseState() {
|
||||
oldFuseState = 0;
|
||||
return;
|
||||
}
|
||||
// if (state == 0) {
|
||||
// if (oldFuseState != 0) {
|
||||
// reportEvents(FUSE_WENT_OFF);
|
||||
// }
|
||||
// }
|
||||
// oldFuseState = state;
|
||||
if (state == 0) {
|
||||
if (oldFuseState != 0) {
|
||||
reportEvents(FUSE_WENT_OFF);
|
||||
}
|
||||
}
|
||||
oldFuseState = state.value;
|
||||
}
|
||||
|
||||
float Fuse::getPower() {
|
||||
// if (power.isValid()) {
|
||||
// return power;
|
||||
// } else {
|
||||
// return 0.0;
|
||||
// }
|
||||
if (power.isValid()) {
|
||||
return power.value;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void Fuse::setDataPoolEntriesInvalid() {
|
||||
|
@ -26,24 +26,24 @@ ReturnValue_t PowerSensor::calculatePower() {
|
||||
powerSensorSet.read();
|
||||
ReturnValue_t result1 = HasReturnvaluesIF::RETURN_FAILED;
|
||||
ReturnValue_t result2 = HasReturnvaluesIF::RETURN_FAILED;
|
||||
// if (healthHelper.healthTable->isHealthy(getObjectId()) && voltage.isValid()
|
||||
// && current.isValid()) {
|
||||
// result1 = voltageLimit.doCheck(voltage);
|
||||
// result2 = currentLimit.doCheck(current);
|
||||
// } else {
|
||||
// voltageLimit.setToInvalid();
|
||||
// currentLimit.setToInvalid();
|
||||
// result1 = OBJECT_NOT_HEALTHY;
|
||||
// }
|
||||
// if (result1 != HasReturnvaluesIF::RETURN_OK
|
||||
// || result2 != HasReturnvaluesIF::RETURN_OK) {
|
||||
// result1 = MonitoringIF::INVALID;
|
||||
// power.setValid(PoolVariableIF::INVALID);
|
||||
// } else {
|
||||
// power.setValid(PoolVariableIF::VALID);
|
||||
// power = current * voltage;
|
||||
// }
|
||||
// powerSensorSet.commit();
|
||||
if (healthHelper.healthTable->isHealthy(getObjectId()) && voltage.isValid()
|
||||
&& current.isValid()) {
|
||||
result1 = voltageLimit.doCheck(voltage.value);
|
||||
result2 = currentLimit.doCheck(current.value);
|
||||
} else {
|
||||
voltageLimit.setToInvalid();
|
||||
currentLimit.setToInvalid();
|
||||
result1 = OBJECT_NOT_HEALTHY;
|
||||
}
|
||||
if (result1 != HasReturnvaluesIF::RETURN_OK
|
||||
|| result2 != HasReturnvaluesIF::RETURN_OK) {
|
||||
result1 = MonitoringIF::INVALID;
|
||||
power.setValid(PoolVariableIF::INVALID);
|
||||
} else {
|
||||
power.setValid(PoolVariableIF::VALID);
|
||||
power.value = current.value * voltage.value;
|
||||
}
|
||||
powerSensorSet.commit();
|
||||
return result1;
|
||||
}
|
||||
|
||||
|
@ -9,16 +9,18 @@ ThermalComponentCore::ThermalComponentCore(object_id_t reportingObjectId,
|
||||
targetState(targetStatePoolId, dataSet, PoolVariableIF::VAR_READ),
|
||||
currentState(currentStatePoolId, dataSet, PoolVariableIF::VAR_WRITE),
|
||||
heaterRequest(requestPoolId, dataSet, PoolVariableIF::VAR_WRITE),
|
||||
parameters(parameters), domainId(domainId) {
|
||||
//temperatureMonitor(reportingObjectId, domainId + 1,
|
||||
// GlobalDataPool::poolIdAndPositionToPid(temperaturePoolId, 0),
|
||||
// COMPONENT_TEMP_CONFIRMATION), domainId(domainId) {
|
||||
parameters(parameters), domainId(domainId),
|
||||
temperatureMonitor(reportingObjectId, domainId + 1,temperaturePoolId,
|
||||
COMPONENT_TEMP_CONFIRMATION) {
|
||||
//Set thermal state once, then leave to operator.
|
||||
//GlobDataSet mySet;
|
||||
//gp_uint8_t writableTargetState(targetStatePoolId, &mySet,
|
||||
// PoolVariableIF::VAR_WRITE);
|
||||
//writableTargetState = initialTargetState;
|
||||
//mySet.commit(PoolVariableIF::VALID);
|
||||
targetState.setReadWriteMode(PoolVariableIF::VAR_WRITE);
|
||||
ReturnValue_t result = targetState.read();
|
||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||
targetState = initialTargetState;
|
||||
targetState.setValid(true);
|
||||
targetState.commit();
|
||||
}
|
||||
targetState.setReadWriteMode(PoolVariableIF::VAR_READ);
|
||||
}
|
||||
|
||||
void ThermalComponentCore::addSensor(AbstractTemperatureSensor* sensor) {
|
||||
@ -57,19 +59,21 @@ ThermalComponentIF::HeaterRequest ThermalComponentCore::performOperation(
|
||||
HeaterRequest request = HEATER_DONT_CARE;
|
||||
//SHOULDDO: Better pass db_float_t* to getTemperature and set it invalid if invalid.
|
||||
temperature = getTemperature();
|
||||
//updateMinMaxTemp();
|
||||
//if ((temperature != INVALID_TEMPERATURE)) {
|
||||
//temperature.setValid(PoolVariableIF::VALID);
|
||||
//State state = getState(temperature, getParameters(), targetState);
|
||||
//currentState = state;
|
||||
//checkLimits(state);
|
||||
//request = getHeaterRequest(targetState, temperature, getParameters());
|
||||
//} else {
|
||||
// temperatureMonitor.setToInvalid();
|
||||
// temperature.setValid(PoolVariableIF::INVALID);
|
||||
// currentState = UNKNOWN;
|
||||
// request = HEATER_DONT_CARE;
|
||||
//}
|
||||
updateMinMaxTemp();
|
||||
if ((temperature != INVALID_TEMPERATURE)) {
|
||||
temperature.setValid(PoolVariableIF::VALID);
|
||||
State state = getState(temperature.value, getParameters(),
|
||||
targetState.value);
|
||||
currentState = state;
|
||||
checkLimits(state);
|
||||
request = getHeaterRequest(targetState.value, temperature.value,
|
||||
getParameters());
|
||||
} else {
|
||||
temperatureMonitor.setToInvalid();
|
||||
temperature.setValid(PoolVariableIF::INVALID);
|
||||
currentState = UNKNOWN;
|
||||
request = HEATER_DONT_CARE;
|
||||
}
|
||||
currentState.setValid(PoolVariableIF::VALID);
|
||||
heaterRequest = request;
|
||||
heaterRequest.setValid(PoolVariableIF::VALID);
|
||||
@ -77,11 +81,11 @@ ThermalComponentIF::HeaterRequest ThermalComponentCore::performOperation(
|
||||
}
|
||||
|
||||
void ThermalComponentCore::markStateIgnored() {
|
||||
//currentState = getIgnoredState(currentState);
|
||||
currentState = getIgnoredState(currentState.value);
|
||||
}
|
||||
|
||||
object_id_t ThermalComponentCore::getObjectId() {
|
||||
//return temperatureMonitor.getReporterId();
|
||||
return temperatureMonitor.getReporterId();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -120,7 +124,7 @@ void ThermalComponentCore::setOutputInvalid() {
|
||||
currentState.setValid(PoolVariableIF::INVALID);
|
||||
heaterRequest = HEATER_DONT_CARE;
|
||||
heaterRequest.setValid(PoolVariableIF::INVALID);
|
||||
//temperatureMonitor.setToUnchecked();
|
||||
temperatureMonitor.setToUnchecked();
|
||||
}
|
||||
|
||||
float ThermalComponentCore::getTemperature() {
|
||||
@ -170,8 +174,8 @@ ThermalComponentIF::State ThermalComponentCore::getState(float temperature,
|
||||
|
||||
void ThermalComponentCore::checkLimits(ThermalComponentIF::State state) {
|
||||
//Checks operational limits only.
|
||||
//temperatureMonitor.translateState(state, temperature.value,
|
||||
// getParameters().lowerOpLimit, getParameters().upperOpLimit);
|
||||
temperatureMonitor.translateState(state, temperature.value,
|
||||
getParameters().lowerOpLimit, getParameters().upperOpLimit);
|
||||
|
||||
}
|
||||
|
||||
@ -221,17 +225,17 @@ ThermalComponentIF::State ThermalComponentCore::getIgnoredState(int8_t state) {
|
||||
}
|
||||
}
|
||||
|
||||
//void ThermalComponentCore::updateMinMaxTemp() {
|
||||
// if (temperature == INVALID_TEMPERATURE) {
|
||||
// return;
|
||||
// }
|
||||
// if (temperature < minTemp) {
|
||||
// minTemp = temperature;
|
||||
// }
|
||||
// if (temperature > maxTemp) {
|
||||
// maxTemp = temperature;
|
||||
// }
|
||||
//}
|
||||
void ThermalComponentCore::updateMinMaxTemp() {
|
||||
if (temperature == INVALID_TEMPERATURE) {
|
||||
return;
|
||||
}
|
||||
if (temperature < minTemp) {
|
||||
minTemp = temperature.value;
|
||||
}
|
||||
if (temperature > maxTemp) {
|
||||
maxTemp = temperature.value;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t ThermalComponentCore::getDomainId() const {
|
||||
return domainId;
|
||||
@ -244,38 +248,38 @@ ThermalComponentCore::Parameters ThermalComponentCore::getParameters() {
|
||||
ReturnValue_t ThermalComponentCore::getParameter(uint8_t domainId,
|
||||
uint16_t parameterId, ParameterWrapper* parameterWrapper,
|
||||
const ParameterWrapper* newValues, uint16_t startAtIndex) {
|
||||
//ReturnValue_t result = temperatureMonitor.getParameter(domainId,
|
||||
// parameterId, parameterWrapper, newValues, startAtIndex);
|
||||
// if (result != INVALID_DOMAIN_ID) {
|
||||
// return result;
|
||||
// }
|
||||
// if (domainId != this->domainId) {
|
||||
// return INVALID_DOMAIN_ID;
|
||||
// }
|
||||
// switch (parameterId) {
|
||||
// case 0:
|
||||
// parameterWrapper->set(parameters.heaterOn);
|
||||
// break;
|
||||
// case 1:
|
||||
// parameterWrapper->set(parameters.hysteresis);
|
||||
// break;
|
||||
// case 2:
|
||||
// parameterWrapper->set(parameters.heaterSwitchoff);
|
||||
// break;
|
||||
// case 3:
|
||||
// parameterWrapper->set(minTemp);
|
||||
// break;
|
||||
// case 4:
|
||||
// parameterWrapper->set(maxTemp);
|
||||
// break;
|
||||
// case 10:
|
||||
// parameterWrapper->set(parameters.lowerOpLimit);
|
||||
// break;
|
||||
// case 11:
|
||||
// parameterWrapper->set(parameters.upperOpLimit);
|
||||
// break;
|
||||
// default:
|
||||
// return INVALID_IDENTIFIER_ID;
|
||||
// }
|
||||
ReturnValue_t result = temperatureMonitor.getParameter(domainId,
|
||||
parameterId, parameterWrapper, newValues, startAtIndex);
|
||||
if (result != INVALID_DOMAIN_ID) {
|
||||
return result;
|
||||
}
|
||||
if (domainId != this->domainId) {
|
||||
return INVALID_DOMAIN_ID;
|
||||
}
|
||||
switch (parameterId) {
|
||||
case 0:
|
||||
parameterWrapper->set(parameters.heaterOn);
|
||||
break;
|
||||
case 1:
|
||||
parameterWrapper->set(parameters.hysteresis);
|
||||
break;
|
||||
case 2:
|
||||
parameterWrapper->set(parameters.heaterSwitchoff);
|
||||
break;
|
||||
case 3:
|
||||
parameterWrapper->set(minTemp);
|
||||
break;
|
||||
case 4:
|
||||
parameterWrapper->set(maxTemp);
|
||||
break;
|
||||
case 10:
|
||||
parameterWrapper->set(parameters.lowerOpLimit);
|
||||
break;
|
||||
case 11:
|
||||
parameterWrapper->set(parameters.upperOpLimit);
|
||||
break;
|
||||
default:
|
||||
return INVALID_IDENTIFIER_ID;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
@ -96,10 +96,10 @@ protected:
|
||||
|
||||
Parameters parameters;
|
||||
|
||||
//ThermalMonitorReporter temperatureMonitor;
|
||||
|
||||
const uint8_t domainId;
|
||||
|
||||
ThermalMonitorReporter temperatureMonitor;
|
||||
|
||||
virtual float getTemperature();
|
||||
virtual State getState(float temperature, Parameters parameters,
|
||||
int8_t targetState);
|
||||
@ -111,7 +111,7 @@ protected:
|
||||
|
||||
virtual State getIgnoredState(int8_t state);
|
||||
|
||||
//void updateMinMaxTemp();
|
||||
void updateMinMaxTemp();
|
||||
|
||||
virtual Parameters getParameters();
|
||||
};
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define TCSDEFINITIONS_H_
|
||||
|
||||
|
||||
static const uint32_t INVALID_TEMPERATURE = 999;
|
||||
static const float INVALID_TEMPERATURE = 999;
|
||||
|
||||
|
||||
#endif /* TCSDEFINITIONS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user