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,16 +1,16 @@
#ifndef FUSE_H_
#define FUSE_H_
#ifndef FSFW_POWER_FUSE_H_
#define FSFW_POWER_FUSE_H_
#include "../datapool/DataSet.h"
#include "../datapool/PIDReader.h"
#include "../devicehandlers/HealthDevice.h"
#include "../monitoring/AbsLimitMonitor.h"
#include "PowerComponentIF.h"
#include "PowerSwitchIF.h"
#include "../devicehandlers/HealthDevice.h"
#include "../monitoring/AbsLimitMonitor.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../parameters/ParameterHelper.h"
#include <list>
#include "../datapoollocal/StaticLocalDataSet.h"
namespace Factory {
void setStaticFrameworkObjectIds();
}
@ -25,10 +25,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;
@ -38,8 +38,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<PowerComponentIF*> 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();
@ -69,12 +69,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<float> currentLimit;
class PowerMonitor: public MonitorReporter<float> {
public:
template<typename ... Args>
PowerMonitor(Args ... args) :
PowerMonitor(Args ... args):
MonitorReporter<float>(std::forward<Args>(args)...) {
}
ReturnValue_t checkPower(float sample, float lowerLimit,
@ -84,12 +84,17 @@ private:
};
PowerMonitor powerMonitor;
DataSet set;
PIDReader<float> voltage;
PIDReader<float> current;
PIDReader<uint8_t> state;
db_float_t power;
MessageQueueIF *commandQueue;
StaticLocalDataSet<3> set;
//LocalPoolDataSetBase* set = nullptr;
//PIDReader<float> voltage;
//PIDReader<float> current;
//PIDReader<uint8_t> state;
lp_var_t<float> voltage;
lp_var_t<float> current;
lp_var_t<uint8_t> state;
lp_var_t<float> power;
MessageQueueIF* commandQueue = nullptr;
ParameterHelper parameterHelper;
HealthHelper healthHelper;
static object_id_t powerSwitchId;
@ -102,4 +107,4 @@ private:
bool areSwitchesOfComponentOn(DeviceList::iterator iter);
};
#endif /* FUSE_H_ */
#endif /* FSFW_POWER_FUSE_H_ */