Fix _consumeSolarPowerOnly sometimes being set to false when it shouldn't
This commit is contained in:
parent
b70407d7fe
commit
804f225908
@ -40,7 +40,7 @@ void PowerLimiterClass::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
_consumeSolarPowerOnly = true;
|
_consumeSolarPowerOnly = true;
|
||||||
_lastCommandSent = 0;
|
_lastCommandSent = 0;
|
||||||
_lastLoop = 0;
|
_lastLoop = 0;
|
||||||
_lastPowerMeterUpdate = 0;
|
_lastPowerMeterUpdate = 0;
|
||||||
_lastRequestedPowerLimit = 0;
|
_lastRequestedPowerLimit = 0;
|
||||||
@ -109,8 +109,7 @@ void PowerLimiterClass::loop()
|
|||||||
float acPower = inverter->Statistics()->getChannelFieldValue(TYPE_AC, (ChannelNum_t) config.PowerLimiter_InverterChannelId, FLD_PAC);
|
float acPower = inverter->Statistics()->getChannelFieldValue(TYPE_AC, (ChannelNum_t) config.PowerLimiter_InverterChannelId, FLD_PAC);
|
||||||
float correctedDcVoltage = dcVoltage + (acPower * config.PowerLimiter_VoltageLoadCorrectionFactor);
|
float correctedDcVoltage = dcVoltage + (acPower * config.PowerLimiter_VoltageLoadCorrectionFactor);
|
||||||
|
|
||||||
if ((_consumeSolarPowerOnly && isStartThresholdReached(inverter))
|
if ((_consumeSolarPowerOnly && isStartThresholdReached(inverter))) {
|
||||||
|| !canUseDirectSolarPower()) {
|
|
||||||
// The battery is full enough again, use the full battery power from now on.
|
// The battery is full enough again, use the full battery power from now on.
|
||||||
_consumeSolarPowerOnly = false;
|
_consumeSolarPowerOnly = false;
|
||||||
} else if (!_consumeSolarPowerOnly && !isStopThresholdReached(inverter) && canUseDirectSolarPower()) {
|
} else if (!_consumeSolarPowerOnly && !isStopThresholdReached(inverter) && canUseDirectSolarPower()) {
|
||||||
@ -224,7 +223,7 @@ bool PowerLimiterClass::canUseDirectSolarPower()
|
|||||||
|
|
||||||
uint16_t PowerLimiterClass::getDirectSolarPower()
|
uint16_t PowerLimiterClass::getDirectSolarPower()
|
||||||
{
|
{
|
||||||
if (!this->canUseDirectSolarPower()) {
|
if (!canUseDirectSolarPower()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +248,7 @@ bool PowerLimiterClass::isStartThresholdReached(std::shared_ptr<InverterAbstract
|
|||||||
{
|
{
|
||||||
CONFIG_T& config = Configuration.get();
|
CONFIG_T& config = Configuration.get();
|
||||||
|
|
||||||
// If the Battery interface is enabled, use the SOC value
|
// Check if the Battery interface is enabled and the SOC start threshold is reached
|
||||||
if (config.Battery_Enabled
|
if (config.Battery_Enabled
|
||||||
&& config.PowerLimiter_BatterySocStartThreshold > 0.0
|
&& config.PowerLimiter_BatterySocStartThreshold > 0.0
|
||||||
&& (millis() - Battery.stateOfChargeLastUpdate) < 60000
|
&& (millis() - Battery.stateOfChargeLastUpdate) < 60000
|
||||||
@ -270,7 +269,7 @@ bool PowerLimiterClass::isStopThresholdReached(std::shared_ptr<InverterAbstract>
|
|||||||
{
|
{
|
||||||
CONFIG_T& config = Configuration.get();
|
CONFIG_T& config = Configuration.get();
|
||||||
|
|
||||||
// If the Battery interface is enabled, use the SOC value
|
// Check if the Battery interface is enabled and the SOC stop threshold is reached
|
||||||
if (config.Battery_Enabled
|
if (config.Battery_Enabled
|
||||||
&& config.PowerLimiter_BatterySocStopThreshold > 0.0
|
&& config.PowerLimiter_BatterySocStopThreshold > 0.0
|
||||||
&& (millis() - Battery.stateOfChargeLastUpdate) < 60000
|
&& (millis() - Battery.stateOfChargeLastUpdate) < 60000
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user