further fixes
Some checks failed
EIVE/eive-obsw/pipeline/pr-main There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-main There was a failure building this commit
This commit is contained in:
parent
6b9e191988
commit
0ad3f508a9
@ -212,7 +212,7 @@ void PowerController::watchStateOfCharge() {
|
|||||||
|
|
||||||
ReturnValue_t PowerController::calculateOpenCircuitVoltageCharge() {
|
ReturnValue_t PowerController::calculateOpenCircuitVoltageCharge() {
|
||||||
float vBatCorrected =
|
float vBatCorrected =
|
||||||
(bpxBatteryHk.battVoltage.value - iBat * batteryInternalResistance) * MILLIVOLT2VOLT;
|
(bpxBatteryHk.battVoltage.value - iBat * batteryInternalResistance) * CONVERT_FROM_MILLI;
|
||||||
uint8_t lookUpTableIdx = LOOK_UP_TABLE_MAX_IDX;
|
uint8_t lookUpTableIdx = LOOK_UP_TABLE_MAX_IDX;
|
||||||
ReturnValue_t result = lookUpTableOcvIdxFinder(vBatCorrected, lookUpTableIdx);
|
ReturnValue_t result = lookUpTableOcvIdxFinder(vBatCorrected, lookUpTableIdx);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
@ -236,7 +236,8 @@ ReturnValue_t PowerController::calculateCoulombCounterCharge() {
|
|||||||
pwrCtrlCoreHk.coulombCounterCharge.value >= coulombCounterChargeUpperThreshold)) {
|
pwrCtrlCoreHk.coulombCounterCharge.value >= coulombCounterChargeUpperThreshold)) {
|
||||||
coulombCounterCharge = openCircuitVoltageCharge;
|
coulombCounterCharge = openCircuitVoltageCharge;
|
||||||
} else {
|
} else {
|
||||||
coulombCounterCharge = pwrCtrlCoreHk.coulombCounterCharge.value + iBat * timeDiff;
|
coulombCounterCharge =
|
||||||
|
coulombCounterCharge + iBat * CONVERT_FROM_MILLI * timeDiff * SECONDS_TO_HOURS;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
|
|||||||
float coulombCounterVoltageUpperThreshold = 16.2e3; // [mV]
|
float coulombCounterVoltageUpperThreshold = 16.2e3; // [mV]
|
||||||
double maxAllowedTimeDiff = 0.5; // [s]
|
double maxAllowedTimeDiff = 0.5; // [s]
|
||||||
|
|
||||||
// OCV Look-up-Table
|
// OCV Look-up-Table {[Ah],[V]}
|
||||||
static constexpr uint8_t LOOK_UP_TABLE_MAX_IDX = 99;
|
static constexpr uint8_t LOOK_UP_TABLE_MAX_IDX = 99;
|
||||||
float lookUpTableOcv[2][100] = {
|
float lookUpTableOcv[2][100] = {
|
||||||
{0.00000000e+00, 3.16227766e-04, 4.52809661e-04, 6.48382625e-04, 9.28425483e-04,
|
{0.00000000e+00, 3.16227766e-04, 4.52809661e-04, 6.48382625e-04, 9.28425483e-04,
|
||||||
@ -100,12 +100,13 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
|
|||||||
// Variables
|
// Variables
|
||||||
timeval now;
|
timeval now;
|
||||||
timeval oldTime;
|
timeval oldTime;
|
||||||
int16_t iBat = 0.0; // [mA]
|
int16_t iBat = 0; // [mA]
|
||||||
float openCircuitVoltageCharge = 0.0; // [mC]
|
float openCircuitVoltageCharge = 0.0; // [Ah]
|
||||||
float coulombCounterCharge = 0; // [mC]
|
float coulombCounterCharge = 0.0; // [Ah]
|
||||||
float coulombCounterChargeUpperThreshold = 0.0; // [mC]
|
float coulombCounterChargeUpperThreshold = 0.0; // [Ah]
|
||||||
|
|
||||||
static constexpr float MILLIVOLT2VOLT = 1e-3;
|
static constexpr float CONVERT_FROM_MILLI = 1e-3;
|
||||||
|
static constexpr float SECONDS_TO_HOURS = 1. / (60. * 60.);
|
||||||
|
|
||||||
static constexpr int16_t INVALID_TOTAL_BATTERY_CURRENT = 0;
|
static constexpr int16_t INVALID_TOTAL_BATTERY_CURRENT = 0;
|
||||||
static constexpr float INVALID_SOC = -1;
|
static constexpr float INVALID_SOC = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user