diff --git a/datapoollocal/LocalPoolDataSetBase.cpp b/datapoollocal/LocalPoolDataSetBase.cpp index 6e237c48..640956db 100644 --- a/datapoollocal/LocalPoolDataSetBase.cpp +++ b/datapoollocal/LocalPoolDataSetBase.cpp @@ -31,7 +31,7 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner, LocalPoolDataSetBase::LocalPoolDataSetBase(sid_t sid, PoolVariableIF** registeredVariablesArray, const size_t maxNumberOfVariables): - PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) { + PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) { HasLocalDataPoolIF* hkOwner = objectManager->get( sid.objectId); if(hkOwner == nullptr) { diff --git a/datapoollocal/LocalPoolVariable.h b/datapoollocal/LocalPoolVariable.h index 75cf570e..173c2035 100644 --- a/datapoollocal/LocalPoolVariable.h +++ b/datapoollocal/LocalPoolVariable.h @@ -119,6 +119,7 @@ public: LocalPoolVar &operator=(T newValue); + LocalPoolVar &operator=(LocalPoolVar newPoolVariable); protected: /** * @brief Like #read, but without a lock protection of the global pool. @@ -164,4 +165,5 @@ using lp_int64_t = LocalPoolVar; using lp_float_t = LocalPoolVar; using lp_double_t = LocalPoolVar; + #endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_ */ diff --git a/datapoollocal/LocalPoolVariable.tpp b/datapoollocal/LocalPoolVariable.tpp index 26500e3b..8aa164d1 100644 --- a/datapoollocal/LocalPoolVariable.tpp +++ b/datapoollocal/LocalPoolVariable.tpp @@ -81,11 +81,18 @@ inline ReturnValue_t LocalPoolVar::commitWithoutLock() { } template -inline LocalPoolVar & LocalPoolVar::operator =(T newValue) { +inline LocalPoolVar & LocalPoolVar::operator=(T newValue) { value = newValue; return *this; } +template +inline LocalPoolVar& LocalPoolVar::operator =( + LocalPoolVar newPoolVariable) { + value = newPoolVariable.value; + return *this; +} + template inline ReturnValue_t LocalPoolVar::serialize(uint8_t** buffer, size_t* size, diff --git a/datapoollocal/LocalPoolVector.h b/datapoollocal/LocalPoolVector.h index 4644b748..58face3c 100644 --- a/datapoollocal/LocalPoolVector.h +++ b/datapoollocal/LocalPoolVector.h @@ -47,7 +47,7 @@ public: * @param dataSet The data set in which the variable shall register itself. * If nullptr, the variable is not registered. */ - LocalPoolVector(lp_id_t poolId, HasLocalDataPoolIF* hkOwner, + LocalPoolVector(HasLocalDataPoolIF* hkOwner, lp_id_t poolId, DataSetIF* dataSet = nullptr, pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE); diff --git a/datapoollocal/LocalPoolVector.tpp b/datapoollocal/LocalPoolVector.tpp index fc3c0a2e..46123ccc 100644 --- a/datapoollocal/LocalPoolVector.tpp +++ b/datapoollocal/LocalPoolVector.tpp @@ -6,8 +6,8 @@ #endif template -inline LocalPoolVector::LocalPoolVector(lp_id_t poolId, - HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet, +inline LocalPoolVector::LocalPoolVector( + HasLocalDataPoolIF* hkOwner, lp_id_t poolId, DataSetIF* dataSet, pool_rwm_t setReadWriteMode): LocalPoolObjectBase(poolId, hkOwner, dataSet, setReadWriteMode) {} diff --git a/datapoollocal/locPoolDefinitions.h b/datapoollocal/locPoolDefinitions.h index 1115a336..6e74d349 100644 --- a/datapoollocal/locPoolDefinitions.h +++ b/datapoollocal/locPoolDefinitions.h @@ -66,7 +66,7 @@ union gp_id_t { gp_id_t(): raw(INVALID_GPID) {} - gp_id_t(object_id_t objectID, lp_id_t localPoolId): + gp_id_t(object_id_t objectId, lp_id_t localPoolId): objectId(objectId), localPoolId(localPoolId) {} diff --git a/monitoring/AbsLimitMonitor.h b/monitoring/AbsLimitMonitor.h index d85d5b61..1206dbf6 100644 --- a/monitoring/AbsLimitMonitor.h +++ b/monitoring/AbsLimitMonitor.h @@ -8,12 +8,11 @@ template class AbsLimitMonitor: public MonitorBase { public: AbsLimitMonitor(object_id_t reporterId, uint8_t monitorId, - object_id_t dataCreatorId, lp_id_t localPoolId, - uint16_t confirmationLimit, T limit, + gp_id_t globalPoolId, uint16_t confirmationLimit, T limit, Event violationEvent = MonitoringIF::VALUE_OUT_OF_RANGE, bool aboveIsViolation = true) : - MonitorBase(reporterId, monitorId, dataCreatorId, localPoolId, - confirmationLimit), + MonitorBase(reporterId, monitorId, globalPoolId, + confirmationLimit), limit(limit), violationEvent(violationEvent), aboveIsViolation(aboveIsViolation) { } @@ -67,7 +66,8 @@ protected: switch (state) { case MonitoringIF::OUT_OF_RANGE: EventManagerIF::triggerEvent(this->reportingId, - violationEvent, this->parameterId); + violationEvent, this->parameterId.objectId, + this->parameterId.localPoolId); break; default: break; diff --git a/monitoring/LimitMonitor.h b/monitoring/LimitMonitor.h index fdb05018..27e35aa7 100644 --- a/monitoring/LimitMonitor.h +++ b/monitoring/LimitMonitor.h @@ -13,11 +13,11 @@ template class LimitMonitor: public MonitorBase { public: LimitMonitor(object_id_t reporterId, uint8_t monitorId, - object_id_t creatorId, lp_id_t localPoolId, - uint16_t confirmationLimit, T lowerLimit, T upperLimit, - Event belowLowEvent = MonitoringIF::VALUE_BELOW_LOW_LIMIT, + gp_id_t globalPoolId, uint16_t confirmationLimit, T lowerLimit, + T upperLimit, Event belowLowEvent = + MonitoringIF::VALUE_BELOW_LOW_LIMIT, Event aboveHighEvent = MonitoringIF::VALUE_ABOVE_HIGH_LIMIT) : - MonitorBase(reporterId, monitorId, creatorId, localPoolId, + MonitorBase(reporterId, monitorId, globalPoolId, confirmationLimit), lowerLimit(lowerLimit), upperLimit(upperLimit), belowLowEvent(belowLowEvent), aboveHighEvent(aboveHighEvent) { @@ -80,11 +80,11 @@ protected: switch (state) { case MonitoringIF::BELOW_LOW_LIMIT: EventManagerIF::triggerEvent(this->reportingId, belowLowEvent, - this->parameterId); + this->parameterId.objectId, this->parameterId.localPoolId); break; case MonitoringIF::ABOVE_HIGH_LIMIT: EventManagerIF::triggerEvent(this->reportingId, aboveHighEvent, - this->parameterId); + this->parameterId.objectId, this->parameterId.localPoolId); break; default: break; diff --git a/monitoring/MonitorBase.h b/monitoring/MonitorBase.h index df6f1af8..530a3840 100644 --- a/monitoring/MonitorBase.h +++ b/monitoring/MonitorBase.h @@ -25,11 +25,10 @@ class MonitorBase: public MonitorReporter { public: MonitorBase(object_id_t reporterId, uint8_t monitorId, - object_id_t dataCreatorId, lp_id_t localPoolId, - uint16_t confirmationLimit): - MonitorReporter(reporterId, monitorId, dataCreatorId, + gp_id_t globalPoolId, uint16_t confirmationLimit): + MonitorReporter(reporterId, monitorId, globalPoolId, confirmationLimit), - poolVariable(dataCreatorId, localPoolId) { + poolVariable(globalPoolId) { } virtual ~MonitorBase() { diff --git a/monitoring/MonitorReporter.h b/monitoring/MonitorReporter.h index d33f34d5..d6d8c8ed 100644 --- a/monitoring/MonitorReporter.h +++ b/monitoring/MonitorReporter.h @@ -5,6 +5,7 @@ #include "MonitoringIF.h" #include "MonitoringMessageContent.h" +#include "../datapoollocal/locPoolDefinitions.h" #include "../events/EventManagerIF.h" #include "../parameters/HasParametersIF.h" @@ -18,7 +19,7 @@ public: // TODO: Adapt to use SID instead of parameter ID. MonitorReporter(object_id_t reportingId, uint8_t monitorId, - uint32_t parameterId, uint16_t confirmationLimit) : + gp_id_t globalPoolId, uint16_t confirmationLimit) : monitorId(monitorId), parameterId(parameterId), reportingId(reportingId), oldState(MonitoringIF::UNCHECKED), reportingEnabled(ENABLED), eventEnabled(ENABLED), currentCounter(0), @@ -95,7 +96,7 @@ public: protected: const uint8_t monitorId; - const uint32_t parameterId; + const gp_id_t parameterId; object_id_t reportingId; ReturnValue_t oldState; diff --git a/monitoring/MonitoringMessageContent.h b/monitoring/MonitoringMessageContent.h index c82506f3..44d32656 100644 --- a/monitoring/MonitoringMessageContent.h +++ b/monitoring/MonitoringMessageContent.h @@ -3,6 +3,7 @@ #include "HasMonitorsIF.h" #include "MonitoringIF.h" +#include "../datapoollocal/locPoolDefinitions.h" #include "../objectmanager/ObjectManagerIF.h" #include "../serialize/SerialBufferAdapter.h" #include "../serialize/SerialFixedArrayListAdapter.h" @@ -16,12 +17,17 @@ void setStaticFrameworkObjectIds(); } //PID(uint32_t), TYPE, LIMIT_ID, value,limitValue, previous, later, timestamp +/** + * @brief Does magic. + * @tparam T + */ template class MonitoringReportContent: public SerialLinkedListAdapter { friend void (Factory::setStaticFrameworkObjectIds)(); public: SerializeElement monitorId; - SerializeElement parameterId; + SerializeElement parameterObjectId; + SerializeElement localPoolId; SerializeElement parameterValue; SerializeElement limitValue; SerializeElement oldState; @@ -30,20 +36,23 @@ public: SerializeElement> timestampSerializer; TimeStamperIF* timeStamper; MonitoringReportContent() : - SerialLinkedListAdapter( - LinkedElement::Iterator(¶meterId)), monitorId(0), parameterId( - 0), parameterValue(0), limitValue(0), oldState(0), newState( - 0), rawTimestamp( { 0 }), timestampSerializer(rawTimestamp, + SerialLinkedListAdapter(¶meterObjectId), + monitorId(0), parameterObjectId(0), + localPoolId(0), parameterValue(0), + limitValue(0), oldState(0), newState(0), + rawTimestamp( { 0 }), timestampSerializer(rawTimestamp, sizeof(rawTimestamp)), timeStamper(NULL) { setAllNext(); } - MonitoringReportContent(uint32_t setPID, T value, T limitValue, + MonitoringReportContent(gp_id_t globalPoolId, T value, T limitValue, ReturnValue_t oldState, ReturnValue_t newState) : - SerialLinkedListAdapter( - LinkedElement::Iterator(¶meterId)), monitorId(0), parameterId( - setPID), parameterValue(value), limitValue(limitValue), oldState( - oldState), newState(newState), timestampSerializer(rawTimestamp, - sizeof(rawTimestamp)), timeStamper(NULL) { + SerialLinkedListAdapter(¶meterObjectId), + monitorId(0), parameterObjectId(globalPoolId.objectId), + localPoolId(globalPoolId.localPoolId), + parameterValue(value), limitValue(limitValue), + oldState(oldState), newState(newState), + timestampSerializer(rawTimestamp, sizeof(rawTimestamp)), + timeStamper(NULL) { setAllNext(); if (checkAndSetStamper()) { timeStamper->addTimeStamp(rawTimestamp, sizeof(rawTimestamp)); @@ -53,16 +62,16 @@ private: static object_id_t timeStamperId; void setAllNext() { - parameterId.setNext(¶meterValue); + parameterObjectId.setNext(¶meterValue); parameterValue.setNext(&limitValue); limitValue.setNext(&oldState); oldState.setNext(&newState); newState.setNext(×tampSerializer); } bool checkAndSetStamper() { - if (timeStamper == NULL) { + if (timeStamper == nullptr) { timeStamper = objectManager->get( timeStamperId ); - if ( timeStamper == NULL ) { + if ( timeStamper == nullptr ) { sif::error << "MonitoringReportContent::checkAndSetStamper: " "Stamper not found!" << std::endl; return false; diff --git a/power/Fuse.cpp b/power/Fuse.cpp index ace625bf..ff9c7b3c 100644 --- a/power/Fuse.cpp +++ b/power/Fuse.cpp @@ -8,17 +8,16 @@ object_id_t Fuse::powerSwitchId = 0; -Fuse::Fuse(object_id_t fuseObjectId, uint8_t fuseId, VariableIds ids, +Fuse::Fuse(object_id_t fuseObjectId, uint8_t fuseId, + sid_t variableSet, VariableIds ids, float maxCurrent, uint16_t confirmationCount) : - SystemObject(fuseObjectId), oldFuseState(0), fuseId(fuseId), powerIF( - NULL), + SystemObject(fuseObjectId), oldFuseState(0), fuseId(fuseId), currentLimit(fuseObjectId, 1, ids.pidCurrent, confirmationCount, maxCurrent, FUSE_CURRENT_HIGH), - powerMonitor(fuseObjectId, 2, - GlobalDataPool::poolIdAndPositionToPid(ids.poolIdPower, 0), + powerMonitor(fuseObjectId, 2, ids.poolIdPower, confirmationCount), - set(), voltage(ids.pidVoltage, &set), current(ids.pidCurrent, &set), - state(ids.pidState, &set), + set(variableSet), voltage(ids.pidVoltage, &set), + current(ids.pidCurrent, &set), state(ids.pidState, &set), power(ids.poolIdPower, &set, PoolVariableIF::VAR_READ_WRITE), parameterHelper(this), healthHelper(this, fuseObjectId) { commandQueue = QueueFactory::instance()->createMessageQueue(); @@ -73,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, 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; } @@ -136,7 +135,7 @@ void Fuse::calculateFusePower() { return; } //Calculate fuse power. - power = current * voltage; + //power = current * voltage; power.setValid(PoolVariableIF::VALID); } @@ -189,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; } float Fuse::getPower() { - if (power.isValid()) { - return power; - } else { - return 0.0; - } +// if (power.isValid()) { +// return power; +// } else { +// return 0.0; +// } } void Fuse::setDataPoolEntriesInvalid() { diff --git a/power/Fuse.h b/power/Fuse.h index 13a0eb7c..5e54d294 100644 --- a/power/Fuse.h +++ b/power/Fuse.h @@ -13,6 +13,7 @@ #include "../parameters/ParameterHelper.h" #include +#include "../datapoollocal/StaticLocalDataSet.h" namespace Factory { void setStaticFrameworkObjectIds(); } @@ -27,10 +28,10 @@ private: static constexpr float RESIDUAL_POWER = 0.005 * 28.5; //!< This is the upper limit of residual power lost by fuses and switches. Worst case is Fuse and one of two switches on. See PCDU ICD 1.9 p29 bottom public: struct VariableIds { - uint32_t pidVoltage; - uint32_t pidCurrent; - uint32_t pidState; - uint32_t poolIdPower; + gp_id_t pidVoltage; + gp_id_t pidCurrent; + gp_id_t pidState; + gp_id_t poolIdPower; }; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PCDU_1; @@ -40,8 +41,8 @@ public: static const Event POWER_BELOW_LOW_LIMIT = MAKE_EVENT(5, SEVERITY::LOW); //!< PSS detected a fuse that violates its limits. typedef std::list DeviceList; - Fuse(object_id_t fuseObjectId, uint8_t fuseId, VariableIds ids, - float maxCurrent, uint16_t confirmationCount = 2); + Fuse(object_id_t fuseObjectId, uint8_t fuseId, sid_t variableSet, + VariableIds ids, float maxCurrent, uint16_t confirmationCount = 2); virtual ~Fuse(); void addDevice(PowerComponentIF *set); float getPower(); @@ -71,12 +72,12 @@ public: private: uint8_t oldFuseState; uint8_t fuseId; - PowerSwitchIF *powerIF; //could be static in our case. + PowerSwitchIF *powerIF = nullptr; //could be static in our case. AbsLimitMonitor currentLimit; class PowerMonitor: public MonitorReporter { public: template - PowerMonitor(Args ... args) : + PowerMonitor(Args ... args): MonitorReporter(std::forward(args)...) { } ReturnValue_t checkPower(float sample, float lowerLimit, @@ -86,11 +87,16 @@ private: }; PowerMonitor powerMonitor; - GlobDataSet set; - PIDReader voltage; - PIDReader current; - PIDReader state; - gp_float_t power; + StaticLocalDataSet<3> set; + //LocalPoolDataSetBase* set = nullptr; + //PIDReader voltage; + //PIDReader current; + //PIDReader state; + lp_var_t voltage; + lp_var_t current; + lp_var_t state; + + lp_var_t power; MessageQueueIF* commandQueue = nullptr; ParameterHelper parameterHelper; HealthHelper healthHelper; diff --git a/power/PowerSensor.cpp b/power/PowerSensor.cpp index 739d02f2..8fe3cf3a 100644 --- a/power/PowerSensor.cpp +++ b/power/PowerSensor.cpp @@ -2,15 +2,17 @@ #include "../ipc/QueueFactory.h" -PowerSensor::PowerSensor(object_id_t setId, VariableIds ids, +PowerSensor::PowerSensor(object_id_t objectId, sid_t setId, VariableIds ids, DefaultLimits limits, SensorEvents events, uint16_t confirmationCount) : - SystemObject(setId), parameterHelper(this), healthHelper(this, setId), - set(), current(ids.pidCurrent, &set), voltage(ids.pidVoltage, &set), - power(ids.poolIdPower, &set, PoolVariableIF::VAR_WRITE), - currentLimit(setId, MODULE_ID_CURRENT, ids.pidCurrent, confirmationCount, + SystemObject(objectId), parameterHelper(this), + healthHelper(this, objectId), + powerSensorSet(setId), current(ids.pidCurrent, &powerSensorSet), + voltage(ids.pidVoltage, &powerSensorSet), + power(ids.poolIdPower, &powerSensorSet, PoolVariableIF::VAR_WRITE), + currentLimit(objectId, MODULE_ID_CURRENT, ids.pidCurrent, confirmationCount, limits.currentMin, limits.currentMax, events.currentLow, events.currentHigh), - voltageLimit(setId, MODULE_ID_VOLTAGE, + voltageLimit(objectId, MODULE_ID_VOLTAGE, ids.pidVoltage, confirmationCount, limits.voltageMin, limits.voltageMax, events.voltageLow, events.voltageHigh) { commandQueue = QueueFactory::instance()->createMessageQueue(); @@ -21,27 +23,27 @@ PowerSensor::~PowerSensor() { } ReturnValue_t PowerSensor::calculatePower() { - set.read(); + 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; - } - set.commit(); +// 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(); return result1; } @@ -94,8 +96,8 @@ void PowerSensor::checkCommandQueue() { } void PowerSensor::setDataPoolEntriesInvalid() { - set.read(); - set.commit(PoolVariableIF::INVALID); + powerSensorSet.read(); + powerSensorSet.commit(PoolVariableIF::INVALID); } float PowerSensor::getPower() { diff --git a/power/PowerSensor.h b/power/PowerSensor.h index 20ebff39..bb409f3e 100644 --- a/power/PowerSensor.h +++ b/power/PowerSensor.h @@ -4,6 +4,7 @@ #include "../datapoolglob/GlobalDataSet.h" #include "../datapoolglob/GlobalPoolVariable.h" #include "../datapoolglob/PIDReader.h" +#include "../datapoollocal/StaticLocalDataSet.h" #include "../devicehandlers/HealthDevice.h" #include "../monitoring/LimitMonitor.h" #include "../parameters/ParameterHelper.h" @@ -12,15 +13,18 @@ class PowerController; +/** + * @brief Does magic. + */ class PowerSensor: public SystemObject, public ReceivesParameterMessagesIF, public HasHealthIF { friend class PowerController; public: struct VariableIds { - uint32_t pidCurrent; - uint32_t pidVoltage; - uint32_t poolIdPower; + gp_id_t pidCurrent; + gp_id_t pidVoltage; + gp_id_t poolIdPower; }; struct DefaultLimits { float currentMin; @@ -34,8 +38,9 @@ public: Event voltageLow; Event voltageHigh; }; - PowerSensor(object_id_t setId, VariableIds setIds, DefaultLimits limits, - SensorEvents events, uint16_t confirmationCount = 0); + PowerSensor(object_id_t objectId, sid_t sid, VariableIds setIds, + DefaultLimits limits, SensorEvents events, + uint16_t confirmationCount = 0); virtual ~PowerSensor(); ReturnValue_t calculatePower(); ReturnValue_t performOperation(uint8_t opCode); @@ -53,12 +58,16 @@ private: MessageQueueIF* commandQueue = nullptr; ParameterHelper parameterHelper; HealthHelper healthHelper; - GlobDataSet set; + //GlobDataSet set; + StaticLocalDataSet<3> powerSensorSet; //Variables in - PIDReader current; - PIDReader voltage; + lp_var_t current; + lp_var_t voltage; + //PIDReader current; + //PIDReader voltage; //Variables out - gp_float_t power; + lp_var_t power; + //gp_float_t power; static const uint8_t MODULE_ID_CURRENT = 1; static const uint8_t MODULE_ID_VOLTAGE = 2; diff --git a/thermal/ThermalMonitorReporter.cpp b/thermal/ThermalMonitorReporter.cpp index 766ea1cb..cefc6110 100644 --- a/thermal/ThermalMonitorReporter.cpp +++ b/thermal/ThermalMonitorReporter.cpp @@ -38,7 +38,8 @@ bool ThermalMonitorReporter::isAboveHighLimit() { } } -ReturnValue_t ThermalMonitorReporter::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(); @@ -46,10 +47,12 @@ ReturnValue_t ThermalMonitorReporter::translateState(ThermalComponentIF::State s } switch (state) { case ThermalComponentIF::OUT_OF_RANGE_LOW: - return monitorStateIs(MonitoringIF::BELOW_LOW_LIMIT, sample, lowerLimit); + return monitorStateIs(MonitoringIF::BELOW_LOW_LIMIT, sample, + lowerLimit); case ThermalComponentIF::NON_OPERATIONAL_LOW: if (componentIsOperational) { - return monitorStateIs(ThermalComponentIF::BELOW_OPERATIONAL_LIMIT, sample, lowerLimit); + return monitorStateIs(ThermalComponentIF::BELOW_OPERATIONAL_LIMIT, + sample, lowerLimit); } else { return monitorStateIs(HasReturnvaluesIF::RETURN_OK, sample, 0.0); } @@ -57,12 +60,14 @@ ReturnValue_t ThermalMonitorReporter::translateState(ThermalComponentIF::State s return monitorStateIs(HasReturnvaluesIF::RETURN_OK, sample, 0.0); case ThermalComponentIF::NON_OPERATIONAL_HIGH: if (componentIsOperational) { - return monitorStateIs(ThermalComponentIF::ABOVE_OPERATIONAL_LIMIT, sample, upperLimit); + return monitorStateIs(ThermalComponentIF::ABOVE_OPERATIONAL_LIMIT, + sample, upperLimit); } else { return monitorStateIs(HasReturnvaluesIF::RETURN_OK, sample, 0.0); } case ThermalComponentIF::OUT_OF_RANGE_HIGH: - return monitorStateIs(MonitoringIF::ABOVE_HIGH_LIMIT, sample, upperLimit); + return monitorStateIs(MonitoringIF::ABOVE_HIGH_LIMIT, sample, + upperLimit); default: //Never reached, all states covered. return HasReturnvaluesIF::RETURN_FAILED;