SoC Calculator #754
@ -11,7 +11,6 @@ ReturnValue_t PowerController::initialize() {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
|
||||
}
|
||||
sif::debug << "Rush B, no stop" << std::endl;
|
||||
return ExtendedControllerBase::initialize();
|
||||
}
|
||||
|
||||
@ -92,7 +91,6 @@ void PowerController::performControlOperation() {
|
||||
}
|
||||
case InternalState::READY: {
|
||||
if (mode != MODE_OFF) {
|
||||
sif::debug << "oh shit, now i gotta do something" << std::endl;
|
||||
calculateStateOfCharge();
|
||||
if (mode == MODE_NORMAL) {
|
||||
watchStateOfCharge();
|
||||
@ -127,7 +125,7 @@ LocalPoolDataSetBase *PowerController::getDataSetHandle(sid_t sid) {
|
||||
|
||||
ReturnValue_t PowerController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t *msToReachTheMode) {
|
||||
if (mode == MODE_OFF) {
|
||||
if (mode == MODE_OFF or mode == MODE_ON or mode == MODE_NORMAL) {
|
||||
if (submode == SUBMODE_NONE) {
|
||||
return returnvalue::OK;
|
||||
} else {
|
||||
@ -251,8 +249,9 @@ ReturnValue_t PowerController::calculateOpenCircuitVoltageCharge() {
|
||||
ReturnValue_t PowerController::calculateCoulombCounterCharge() {
|
||||
double timeDiff = timevalOperations::toDouble(now - oldTime);
|
||||
if (timeDiff > maxAllowedTimeDiff) {
|
||||
triggerEvent(power::TIMEDELTA_OUT_OF_BOUNDS);
|
||||
sif::error << "Power Controller::Time delta too large for Coulomb Counter" << std::endl;
|
||||
triggerEvent(power::TIMEDELTA_OUT_OF_BOUNDS, static_cast<uint32_t>(timeDiff * 10));
|
||||
sif::error << "Power Controller::Time delta too large for Coulomb Counter: " << timeDiff
|
||||
<< std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
if (not pwrCtrlCoreHk.coulombCounterCharge.isValid()) {
|
||||
@ -298,12 +297,12 @@ float PowerController::linearInterpolation(float x, float x0, float x1, float y0
|
||||
|
||||
ReturnValue_t PowerController::lookUpTableOcvIdxFinder(float voltage, uint8_t &idx) {
|
||||
if (voltage >= lookUpTableOcv[1][99]) {
|
||||
triggerEvent(power::VOLTAGE_OUT_OF_BOUNDS, 0);
|
||||
sif::error << "Power Controller::Voltage is too high" << std::endl;
|
||||
triggerEvent(power::VOLTAGE_OUT_OF_BOUNDS, 0, static_cast<uint32_t>(voltage * 10));
|
||||
sif::error << "Power Controller::Voltage is too high: " << voltage << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
} else if (voltage <= lookUpTableOcv[1][0]) {
|
||||
triggerEvent(power::VOLTAGE_OUT_OF_BOUNDS, 1);
|
||||
sif::error << "Power Controller::Voltage is too low" << std::endl;
|
||||
triggerEvent(power::VOLTAGE_OUT_OF_BOUNDS, 1, static_cast<uint32_t>(voltage * 10));
|
||||
sif::error << "Power Controller::Voltage is too low: " << voltage << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
while (lookUpTableOcv[1][idx] > voltage) {
|
||||
|
@ -55,7 +55,7 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
|
||||
// Parameters
|
||||
float batteryInternalResistance = 70.0 / 2.0 / 1000.0; // [Ohm]
|
||||
float batteryMaximumCapacity = 2.6 * 2; // [Ah]
|
||||
float coulombCounterVoltageUpperThreshold = 16.2e3; // [mV]
|
||||
float coulombCounterVoltageUpperThreshold = 16.2; // [V]
|
||||
double maxAllowedTimeDiff = 0.5; // [s]
|
||||
float payloadLimit = 0.75; // [%]
|
||||
float higherModesLimit = 0.6; // [%]
|
||||
|
@ -52,8 +52,10 @@ static constexpr Event DATASET_READ_FAILED = event::makeEvent(SUBSYSTEM_ID, 4, s
|
||||
//! [EXPORT] : [COMMENT] The battery voltage read is out of the bounds in which it is supposed to
|
||||
//! be.
|
||||
//! P1: 1 too high, 0 too low
|
||||
//! P2: voltage in V * 10
|
||||
static constexpr Event VOLTAGE_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 5, severity::HIGH);
|
||||
//! [EXPORT] : [COMMENT] Time difference for Coulomb Counter was too large.
|
||||
//! P1: time in s * 10
|
||||
static constexpr Event TIMEDELTA_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 6, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] The State of Charge is below the limit for payload use. Setting Payload to
|
||||
//! faulty.
|
||||
|
Loading…
Reference in New Issue
Block a user
thats not nice :D
https://media.giphy.com/media/XHr6LfW6SmFa0/giphy-downsized-large.gif