Skip to content

Commit

Permalink
SoC based threshold detection fix (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
MalteSchm authored Jul 24, 2023
1 parent 8b01fa0 commit 18c464e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/PowerLimiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,8 @@ bool PowerLimiterClass::isStartThresholdReached(std::shared_ptr<InverterAbstract
// Check if the Battery interface is enabled and the SOC start threshold is reached
if (config.Battery_Enabled
&& config.PowerLimiter_BatterySocStartThreshold > 0.0
&& (millis() - Battery.stateOfChargeLastUpdate) < 60000
&& Battery.stateOfCharge >= config.PowerLimiter_BatterySocStartThreshold) {
return true;
&& (millis() - Battery.stateOfChargeLastUpdate) < 60000) {
return Battery.stateOfCharge >= config.PowerLimiter_BatterySocStartThreshold;
}

// Otherwise we use the voltage threshold
Expand All @@ -608,9 +607,8 @@ bool PowerLimiterClass::isStopThresholdReached(std::shared_ptr<InverterAbstract>
// Check if the Battery interface is enabled and the SOC stop threshold is reached
if (config.Battery_Enabled
&& config.PowerLimiter_BatterySocStopThreshold > 0.0
&& (millis() - Battery.stateOfChargeLastUpdate) < 60000
&& Battery.stateOfCharge <= config.PowerLimiter_BatterySocStopThreshold) {
return true;
&& (millis() - Battery.stateOfChargeLastUpdate) < 60000) {
return Battery.stateOfCharge <= config.PowerLimiter_BatterySocStopThreshold;
}

// Otherwise we use the voltage threshold
Expand Down Expand Up @@ -674,9 +672,8 @@ bool PowerLimiterClass::useFullSolarPassthrough(std::shared_ptr<InverterAbstract
// Check if the Battery interface is enabled and the SOC stop threshold is reached
if (config.Battery_Enabled
&& config.PowerLimiter_FullSolarPassThroughSoc > 0.0
&& (millis() - Battery.stateOfChargeLastUpdate) < 60000
&& Battery.stateOfCharge >= config.PowerLimiter_FullSolarPassThroughSoc) {
return true;
&& (millis() - Battery.stateOfChargeLastUpdate) < 60000) {
return Battery.stateOfCharge >= config.PowerLimiter_FullSolarPassThroughSoc;
}

// Otherwise we use the voltage threshold
Expand Down

0 comments on commit 18c464e

Please sign in to comment.