added dataset for flag for pl usage
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
This commit is contained in:
parent
1abc503614
commit
69f5529ade
@ -4,7 +4,8 @@ PowerController::PowerController(object_id_t objectId, bool enableHkSets)
|
|||||||
: ExtendedControllerBase(objectId),
|
: ExtendedControllerBase(objectId),
|
||||||
enableHkSets(enableHkSets),
|
enableHkSets(enableHkSets),
|
||||||
parameterHelper(this),
|
parameterHelper(this),
|
||||||
pwrCtrlCoreHk(this) {}
|
pwrCtrlCoreHk(this),
|
||||||
|
enablePl(this) {}
|
||||||
|
|
||||||
ReturnValue_t PowerController::initialize() {
|
ReturnValue_t PowerController::initialize() {
|
||||||
ReturnValue_t result = parameterHelper.initialize();
|
ReturnValue_t result = parameterHelper.initialize();
|
||||||
@ -54,9 +55,12 @@ ReturnValue_t PowerController::getParameter(uint8_t domainId, uint8_t parameterI
|
|||||||
parameterWrapper->set(maxAllowedTimeDiff);
|
parameterWrapper->set(maxAllowedTimeDiff);
|
||||||
break;
|
break;
|
||||||
case 0x4:
|
case 0x4:
|
||||||
parameterWrapper->set(payloadLimit);
|
parameterWrapper->set(payloadOpLimitOn);
|
||||||
break;
|
break;
|
||||||
case 0x5:
|
case 0x5:
|
||||||
|
parameterWrapper->set(payloadOpLimitLow);
|
||||||
|
break;
|
||||||
|
case 0x6:
|
||||||
parameterWrapper->set(higherModesLimit);
|
parameterWrapper->set(higherModesLimit);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -110,6 +114,8 @@ ReturnValue_t PowerController::initializeLocalDataPool(localpool::DataPool &loca
|
|||||||
new PoolEntry<float>({0.0}));
|
new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(pwrctrl::PoolIds::COULOMB_COUNTER_CHARGE, new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(pwrctrl::PoolIds::COULOMB_COUNTER_CHARGE, new PoolEntry<float>({0.0}));
|
||||||
poolManager.subscribeForRegularPeriodicPacket({pwrCtrlCoreHk.getSid(), enableHkSets, 60.0});
|
poolManager.subscribeForRegularPeriodicPacket({pwrCtrlCoreHk.getSid(), enableHkSets, 60.0});
|
||||||
|
localDataPoolMap.emplace(pwrctrl::PoolIds::PAYLOAD_FLAG, new PoolEntry<uint8_t>({false}));
|
||||||
|
poolManager.subscribeForRegularPeriodicPacket({enablePl.getSid(), false, 60.0});
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +123,8 @@ LocalPoolDataSetBase *PowerController::getDataSetHandle(sid_t sid) {
|
|||||||
switch (sid.ownerSetId) {
|
switch (sid.ownerSetId) {
|
||||||
case pwrctrl::CORE_HK:
|
case pwrctrl::CORE_HK:
|
||||||
return &pwrCtrlCoreHk;
|
return &pwrCtrlCoreHk;
|
||||||
|
case pwrctrl::ENABLE_PL:
|
||||||
|
return &enablePl;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -217,7 +225,20 @@ void PowerController::calculateStateOfCharge() {
|
|||||||
|
|
||||||
void PowerController::watchStateOfCharge() {
|
void PowerController::watchStateOfCharge() {
|
||||||
if (pwrCtrlCoreHk.coulombCounterCharge.isValid()) {
|
if (pwrCtrlCoreHk.coulombCounterCharge.isValid()) {
|
||||||
if (not pwrLvlLowFlag and pwrCtrlCoreHk.coulombCounterCharge.value < payloadLimit) {
|
if (pwrCtrlCoreHk.coulombCounterCharge.value < payloadOpLimitOn) {
|
||||||
|
PoolReadGuard pg(&enablePl);
|
||||||
|
if (pg.getReadResult() == returnvalue::OK) {
|
||||||
|
enablePl.plUseAllowed.value = false;
|
||||||
|
enablePl.plUseAllowed.setValid(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PoolReadGuard pg(&enablePl);
|
||||||
|
if (pg.getReadResult() == returnvalue::OK) {
|
||||||
|
enablePl.plUseAllowed.value = true;
|
||||||
|
enablePl.plUseAllowed.setValid(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (not pwrLvlLowFlag and pwrCtrlCoreHk.coulombCounterCharge.value < payloadOpLimitLow) {
|
||||||
triggerEvent(power::POWER_LEVEL_LOW);
|
triggerEvent(power::POWER_LEVEL_LOW);
|
||||||
pwrLvlLowFlag = true;
|
pwrLvlLowFlag = true;
|
||||||
} else {
|
} else {
|
||||||
@ -229,6 +250,12 @@ void PowerController::watchStateOfCharge() {
|
|||||||
} else {
|
} else {
|
||||||
pwrLvlCriticalFlag = false;
|
pwrLvlCriticalFlag = false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
PoolReadGuard pg(&enablePl);
|
||||||
|
if (pg.getReadResult() == returnvalue::OK) {
|
||||||
|
enablePl.plUseAllowed.value = false;
|
||||||
|
enablePl.plUseAllowed.setValid(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,8 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
|
|||||||
float batteryMaximumCapacity = 2.6 * 2; // [Ah]
|
float batteryMaximumCapacity = 2.6 * 2; // [Ah]
|
||||||
float coulombCounterVoltageUpperThreshold = 16.2; // [V]
|
float coulombCounterVoltageUpperThreshold = 16.2; // [V]
|
||||||
double maxAllowedTimeDiff = 0.5; // [s]
|
double maxAllowedTimeDiff = 0.5; // [s]
|
||||||
float payloadLimit = 0.75; // [%]
|
float payloadOpLimitOn = 0.90; // [%]
|
||||||
|
float payloadOpLimitLow = 0.75; // [%]
|
||||||
float higherModesLimit = 0.6; // [%]
|
float higherModesLimit = 0.6; // [%]
|
||||||
|
|
||||||
// OCV Look-up-Table {[Ah],[V]}
|
// OCV Look-up-Table {[Ah],[V]}
|
||||||
@ -121,6 +122,8 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
|
|||||||
P60Dock::CoreHkSet p60CoreHk = P60Dock::CoreHkSet(objects::P60DOCK_HANDLER);
|
P60Dock::CoreHkSet p60CoreHk = P60Dock::CoreHkSet(objects::P60DOCK_HANDLER);
|
||||||
// Output Dataset
|
// Output Dataset
|
||||||
pwrctrl::CoreHk pwrCtrlCoreHk;
|
pwrctrl::CoreHk pwrCtrlCoreHk;
|
||||||
|
// Dataset for PL Flag
|
||||||
|
pwrctrl::EnablePl enablePl;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_CONTROLLER_POWERCONTROLLER_H_ */
|
#endif /* MISSION_CONTROLLER_POWERCONTROLLER_H_ */
|
||||||
|
@ -10,15 +10,17 @@
|
|||||||
|
|
||||||
namespace pwrctrl {
|
namespace pwrctrl {
|
||||||
|
|
||||||
enum SetIds : uint32_t { CORE_HK };
|
enum SetIds : uint32_t { CORE_HK, ENABLE_PL };
|
||||||
|
|
||||||
enum PoolIds : lp_id_t {
|
enum PoolIds : lp_id_t {
|
||||||
TOTAL_BATTERY_CURRENT,
|
TOTAL_BATTERY_CURRENT,
|
||||||
OPEN_CIRCUIT_VOLTAGE_CHARGE,
|
OPEN_CIRCUIT_VOLTAGE_CHARGE,
|
||||||
COULOMB_COUNTER_CHARGE,
|
COULOMB_COUNTER_CHARGE,
|
||||||
|
PAYLOAD_FLAG
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr uint8_t CORE_HK_ENTRIES = 3;
|
static constexpr uint8_t CORE_HK_ENTRIES = 3;
|
||||||
|
static constexpr uint8_t ENABLE_PL_ENTRIES = 1;
|
||||||
|
|
||||||
class CoreHk : public StaticLocalDataSet<CORE_HK_ENTRIES> {
|
class CoreHk : public StaticLocalDataSet<CORE_HK_ENTRIES> {
|
||||||
public:
|
public:
|
||||||
@ -34,6 +36,15 @@ class CoreHk : public StaticLocalDataSet<CORE_HK_ENTRIES> {
|
|||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class EnablePl : public StaticLocalDataSet<ENABLE_PL_ENTRIES> {
|
||||||
|
public:
|
||||||
|
EnablePl(HasLocalDataPoolIF* hkOwner) : StaticLocalDataSet(hkOwner, ENABLE_PL) {}
|
||||||
|
|
||||||
|
lp_var_t<uint8_t> plUseAllowed = lp_var_t<uint8_t>(sid.objectId, PAYLOAD_FLAG, this);
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace pwrctrl
|
} // namespace pwrctrl
|
||||||
|
|
||||||
#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_POWERCTRLDEFINITIONS_H_ */
|
#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_POWERCTRLDEFINITIONS_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user