resolving merge conflict

adding missing statement from merge

fixing a bug introduced in merge
This commit is contained in:
MalteSchm 2023-04-13 09:37:35 +02:00
parent fc5089e70b
commit 9efe076cc2

View File

@ -174,8 +174,10 @@ int32_t PowerLimiterClass::calcPowerLimit(std::shared_ptr<InverterAbstract> inve
int32_t newPowerLimit = round(PowerMeter.getPowerTotal());
// Safety check, return on too old power meter values
if ((millis() - PowerMeter.getLastPowerMeterUpdate()) > (30 * 1000)) {
// If the power meter values are older than 30 seconds,
if (millis() - PowerMeter.getLastPowerMeterUpdate() > (30 * 1000)
&& (millis() - inverter->Statistics()->getLastUpdate()) > (config.Dtu_PollInterval * 3 * 1000)) {
// If the power meter values are older than 30 seconds,
// and the Inverter Stats are older then 3x the poll interval
// set the limit to config.PowerLimiter_LowerPowerLimit for safety reasons.
MessageOutput.println("[PowerLimiterClass::loop] Power Meter values too old. Using lower limit");
return config.PowerLimiter_LowerPowerLimit;
@ -193,8 +195,9 @@ int32_t PowerLimiterClass::calcPowerLimit(std::shared_ptr<InverterAbstract> inve
// If the inverter the behind the power meter (part of measurement),
// the produced power of this inverter has also to be taken into account.
// We don't use FLD_PAC from the statistics, because that
// data might be too old and unrelieable.
newPowerLimit += _lastRequestedPowerLimit;
// data might be too old and unreliable.
float acPower = inverter->Statistics()->getChannelFieldValue(TYPE_AC, (ChannelNum_t) config.PowerLimiter_InverterChannelId, FLD_PAC);
newPowerLimit += static_cast<int>(acPower);
}
float efficency = inverter->Statistics()->getChannelFieldValue(TYPE_AC, (ChannelNum_t) config.PowerLimiter_InverterChannelId, FLD_EFF);
@ -217,7 +220,7 @@ int32_t PowerLimiterClass::calcPowerLimit(std::shared_ptr<InverterAbstract> inve
int32_t upperPowerLimit = config.PowerLimiter_UpperPowerLimit;
if (consumeSolarPowerOnly && (upperPowerLimit > adjustedVictronChargePower)) {
// Battery voltage too low, use Victron solar power (corrected by efficency factor) only
// Battery voltage too low, use Victron solar power (corrected by efficiency factor) only
upperPowerLimit = adjustedVictronChargePower;
}