This commit is contained in:
parent
0ad3f508a9
commit
209e0c68fb
@ -150,6 +150,8 @@ void PowerController::calculateStateOfCharge() {
|
|||||||
pwrCtrlCoreHk.setValidity(false, true);
|
pwrCtrlCoreHk.setValidity(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// store time for next run
|
||||||
|
oldTime = now;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,12 +173,12 @@ void PowerController::calculateStateOfCharge() {
|
|||||||
pwrCtrlCoreHk.coulombCounterCharge.setValid(false);
|
pwrCtrlCoreHk.coulombCounterCharge.setValid(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// store time for next run
|
||||||
|
oldTime = now;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = calculateCoulombCounterCharge();
|
result = calculateCoulombCounterCharge();
|
||||||
// store time for next run
|
|
||||||
oldTime = now;
|
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
// notifying events have already been triggered
|
// notifying events have already been triggered
|
||||||
{
|
{
|
||||||
@ -191,6 +193,8 @@ void PowerController::calculateStateOfCharge() {
|
|||||||
pwrCtrlCoreHk.coulombCounterCharge.setValid(false);
|
pwrCtrlCoreHk.coulombCounterCharge.setValid(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// store time for next run
|
||||||
|
oldTime = now;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,6 +208,8 @@ void PowerController::calculateStateOfCharge() {
|
|||||||
pwrCtrlCoreHk.setValidity(true, true);
|
pwrCtrlCoreHk.setValidity(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// store time for next run
|
||||||
|
oldTime = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerController::watchStateOfCharge() {
|
void PowerController::watchStateOfCharge() {
|
||||||
@ -231,13 +237,14 @@ ReturnValue_t PowerController::calculateCoulombCounterCharge() {
|
|||||||
sif::error << "Power Controller::Time delta too large for Coulomb Counter" << std::endl;
|
sif::error << "Power Controller::Time delta too large for Coulomb Counter" << std::endl;
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if ((not pwrCtrlCoreHk.coulombCounterCharge.isValid()) or
|
if (not pwrCtrlCoreHk.coulombCounterCharge.isValid()) {
|
||||||
(bpxBatteryHk.battVoltage.value > coulombCounterVoltageUpperThreshold and
|
|
||||||
pwrCtrlCoreHk.coulombCounterCharge.value >= coulombCounterChargeUpperThreshold)) {
|
|
||||||
coulombCounterCharge = openCircuitVoltageCharge;
|
coulombCounterCharge = openCircuitVoltageCharge;
|
||||||
} else {
|
} else {
|
||||||
coulombCounterCharge =
|
coulombCounterCharge =
|
||||||
coulombCounterCharge + iBat * CONVERT_FROM_MILLI * timeDiff * SECONDS_TO_HOURS;
|
coulombCounterCharge + iBat * CONVERT_FROM_MILLI * timeDiff * SECONDS_TO_HOURS;
|
||||||
|
if (coulombCounterCharge >= coulombCounterChargeUpperThreshold) {
|
||||||
|
coulombCounterCharge = coulombCounterChargeUpperThreshold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -261,7 +268,7 @@ ReturnValue_t PowerController::updateEpsData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float PowerController::charge2stateOfCharge(float capacity) {
|
float PowerController::charge2stateOfCharge(float capacity) {
|
||||||
return capacity / batteryMaximumCapacity;
|
return capacity / coulombCounterChargeUpperThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
float PowerController::linearInterpolation(float x, float x0, float x1, float y0, float y1) {
|
float PowerController::linearInterpolation(float x, float x0, float x1, float y0, float y1) {
|
||||||
|
@ -54,8 +54,7 @@ static constexpr Event DATASET_READ_FAILED = event::makeEvent(SUBSYSTEM_ID, 4, s
|
|||||||
//! P1: 1 too high, 0 too low
|
//! P1: 1 too high, 0 too low
|
||||||
static constexpr Event VOLTAGE_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 5, severity::HIGH);
|
static constexpr Event VOLTAGE_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 5, severity::HIGH);
|
||||||
//! [EXPORT] : [COMMENT] Time difference for Coulomb Counter was too large.
|
//! [EXPORT] : [COMMENT] Time difference for Coulomb Counter was too large.
|
||||||
static constexpr Event TIMEDELTA_OUT_OF_BOUNDS =
|
static constexpr Event TIMEDELTA_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 6, severity::LOW);
|
||||||
event::makeEvent(SUBSYSTEM_ID, 6, severity::MEDIUM);
|
|
||||||
|
|
||||||
enum class States { IDLE, SWITCHING_POWER, CHECKING_POWER, MODE_COMMANDING };
|
enum class States { IDLE, SWITCHING_POWER, CHECKING_POWER, MODE_COMMANDING };
|
||||||
enum class OpCodes { NONE, TO_OFF_DONE, TO_NOT_OFF_DONE, TIMEOUT_OCCURED };
|
enum class OpCodes { NONE, TO_OFF_DONE, TO_NOT_OFF_DONE, TIMEOUT_OCCURED };
|
||||||
|
Loading…
Reference in New Issue
Block a user