1
0
forked from fsfw/fsfw

power update

This commit is contained in:
2020-12-03 18:29:28 +01:00
parent f0f7388c0d
commit 9ba8ef1ae2
10 changed files with 156 additions and 129 deletions

View File

@ -1,9 +1,7 @@
#ifndef POWERSENSOR_H_
#define POWERSENSOR_H_
#ifndef FSFW_POWER_POWERSENSOR_H_
#define FSFW_POWER_POWERSENSOR_H_
#include "../datapool/DataSet.h"
#include "../datapool/PIDReader.h"
#include "../datapool/PoolVariable.h"
#include "../datapoollocal/StaticLocalDataSet.h"
#include "../devicehandlers/HealthDevice.h"
#include "../monitoring/LimitMonitor.h"
#include "../parameters/ParameterHelper.h"
@ -12,15 +10,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 +35,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);
@ -50,15 +52,19 @@ public:
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex);
private:
MessageQueueIF* commandQueue;
MessageQueueIF* commandQueue = nullptr;
ParameterHelper parameterHelper;
HealthHelper healthHelper;
DataSet set;
//GlobDataSet set;
StaticLocalDataSet<3> powerSensorSet;
//Variables in
PIDReader<float> current;
PIDReader<float> voltage;
lp_var_t<float> current;
lp_var_t<float> voltage;
//PIDReader<float> current;
//PIDReader<float> voltage;
//Variables out
db_float_t power;
lp_var_t<float> power;
//gp_float_t power;
static const uint8_t MODULE_ID_CURRENT = 1;
static const uint8_t MODULE_ID_VOLTAGE = 2;
@ -68,4 +74,4 @@ protected:
LimitMonitor<float> voltageLimit;
};
#endif /* POWERSENSOR_H_ */
#endif /* FSFW_POWER_POWERSENSOR_H_ */