SoC Calculator #754

Merged
muellerr merged 74 commits from soc-calculator into main 2023-10-11 10:50:48 +02:00
8 changed files with 22 additions and 33 deletions
Showing only changes of commit 2c30efa821 - Show all commits

View File

@ -49,12 +49,10 @@ ReturnValue_t PlPcduDummy::checkModeCommand(Mode_t commandedMode, Submode_t comm
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
if (enablePl.plUseAllowed.isValid() and enablePl.plUseAllowed.value) {
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}
}
if (enablePl.plUseAllowed.isValid() and not enablePl.plUseAllowed.value) {
return NON_OP_STATE_OF_CHARGE;
}
}
}
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
}

View File

@ -28,13 +28,11 @@ ReturnValue_t PlocMpsocDummy::checkModeCommand(Mode_t commandedMode, Submode_t c
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
if (enablePl.plUseAllowed.isValid() and enablePl.plUseAllowed.value) {
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}
}
if (enablePl.plUseAllowed.isValid() and not enablePl.plUseAllowed.value) {
return NON_OP_STATE_OF_CHARGE;
}
}
}
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
}

View File

@ -58,12 +58,10 @@ ReturnValue_t PlocSupervisorDummy::checkModeCommand(Mode_t commandedMode,
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
if (enablePl.plUseAllowed.isValid() and enablePl.plUseAllowed.value) {
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}
}
if (enablePl.plUseAllowed.isValid() and not enablePl.plUseAllowed.value) {
return NON_OP_STATE_OF_CHARGE;
}
}
}
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
}

View File

@ -1511,12 +1511,10 @@ ReturnValue_t PlocMpsocHandler::checkModeCommand(Mode_t commandedMode, Submode_t
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
if (enablePl.plUseAllowed.isValid() and enablePl.plUseAllowed.value) {
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}
}
if (enablePl.plUseAllowed.isValid() and not enablePl.plUseAllowed.value) {
return NON_OP_STATE_OF_CHARGE;
}
}
}
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
}

View File

@ -1999,13 +1999,11 @@ ReturnValue_t PlocSupervisorHandler::checkModeCommand(Mode_t commandedMode,
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
if (enablePl.plUseAllowed.isValid() and enablePl.plUseAllowed.value) {
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}
}
if (enablePl.plUseAllowed.isValid() and not enablePl.plUseAllowed.value) {
return NON_OP_STATE_OF_CHARGE;
}
}
}
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
}

View File

@ -24,6 +24,8 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
uint16_t startAtIndex) override;
private:
int test = 0;
bool enableHkSets = false;
ParameterHelper parameterHelper;
@ -48,7 +50,7 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
ReturnValue_t calculateCoulombCounterCharge();
ReturnValue_t updateEpsData();
float charge2stateOfCharge(float capacity, bool coulombCounter);
ReturnValue_t lookUpTableOcvIdxFinder(float voltage, uint8_t& idx);
ReturnValue_t lookUpTableOcvIdxFinder(float voltage, uint8_t& idx, bool paramCmd);
float linearInterpolation(float x, float x0, float x1, float y0, float y1);
ReturnValue_t calculateCoulombCounterChargeUpperThreshold();
@ -107,6 +109,7 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
float openCircuitVoltageCharge = 0.0; // [Ah]
float coulombCounterCharge = 0.0; // [Ah]
float coulombCounterChargeUpperThreshold = 0.0; // [Ah]
float oldCoulombCounterVoltageUpperThreshold = 0.0; // [V]
static constexpr float CONVERT_FROM_MILLI = 1e-3;
static constexpr float SECONDS_TO_HOURS = 1. / (60. * 60.);

View File

@ -569,13 +569,11 @@ ReturnValue_t PayloadPcduHandler::checkModeCommand(Mode_t commandedMode, Submode
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
if (enablePl.plUseAllowed.isValid() and enablePl.plUseAllowed.value) {
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}
}
if (enablePl.plUseAllowed.isValid() and not enablePl.plUseAllowed.value) {
return NON_OP_STATE_OF_CHARGE;
}
}
}
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
}

View File

@ -14,13 +14,11 @@ ReturnValue_t CamSwitcher::checkModeCommand(Mode_t commandedMode, Submode_t comm
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
if (enablePl.plUseAllowed.isValid() and enablePl.plUseAllowed.value) {
return PowerSwitcherComponent::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}
}
if (enablePl.plUseAllowed.isValid() and not enablePl.plUseAllowed.value) {
return TRANS_NOT_ALLOWED;
}
}
}
return PowerSwitcherComponent::checkModeCommand(commandedMode, commandedSubmode,
msToReachTheMode);
}