Skip to content

Commit

Permalink
Fix: Huawei PSU: enforce BatterySoC Limit < 100 in UI (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
eu-gh committed May 30, 2024
1 parent 27f264e commit 90eb25f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Huawei_can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,10 @@ void HuaweiCanClass::loop()
MessageOutput.printf("[HuaweiCanClass::loop] newPowerLimit: %f, output_power: %f \r\n", newPowerLimit, _rp.output_power);
}

// Check whether the battery SoC limit setting is enabled
if (config.Battery.Enabled && config.Huawei.Auto_Power_BatterySoC_Limits_Enabled) {
uint8_t _batterySoC = Battery.getStats()->getSoC();
// Sets power limit to 0 if the BMS reported SoC reaches or exceeds the user configured value
if (_batterySoC >= config.Huawei.Auto_Power_Stop_BatterySoC_Threshold) {
newPowerLimit = 0;
if (verboseLogging) {
Expand Down Expand Up @@ -427,7 +429,7 @@ void HuaweiCanClass::loop()
float calculatedCurrent = efficiency * (newPowerLimit / _rp.output_voltage);

// Limit output current to value requested by BMS
float permissableCurrent = stats->getChargeCurrentLimitation() - (stats->getChargeCurrent() - _rp.output_current); // BMS current limit - current from other sources
float permissableCurrent = stats->getChargeCurrentLimitation() - (stats->getChargeCurrent() - _rp.output_current); // BMS current limit - current from other sources, e.g. Victron MPPT charger
float outputCurrent = std::min(calculatedCurrent, permissableCurrent);
outputCurrent= outputCurrent > 0 ? outputCurrent : 0;

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/views/AcChargerAdminView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<div class="input-group">
<input type="number" class="form-control" id="stopBatterySoCThreshold"
placeholder="95" v-model="acChargerConfigList.stop_batterysoc_threshold"
aria-describedby="stopBatterySoCThresholdDescription" min="2" max="100" required/>
aria-describedby="stopBatterySoCThresholdDescription" min="2" max="99" required/>
<span class="input-group-text" id="stopBatterySoCThresholdDescription">%</span>
</div>
</div>
Expand Down

0 comments on commit 90eb25f

Please sign in to comment.