Disable debug mode, increasing power threshold for active channel detection (#301)

This commit is contained in:
MalteSchm 2023-07-12 13:19:24 +02:00 committed by GitHub
parent 1d559c1c40
commit 95d7ac7adf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -498,19 +498,18 @@ bool PowerLimiterClass::setNewPowerLimit(std::shared_ptr<InverterAbstract> inver
std::list<ChannelNum_t> dcChnls = inverter->Statistics()->getChannelsByType(TYPE_DC); std::list<ChannelNum_t> dcChnls = inverter->Statistics()->getChannelsByType(TYPE_DC);
int dcProdChnls = 0, dcTotalChnls = dcChnls.size(); int dcProdChnls = 0, dcTotalChnls = dcChnls.size();
for (auto& c : dcChnls) { for (auto& c : dcChnls) {
if (inverter->Statistics()->getChannelFieldValue(TYPE_DC, c, FLD_PDC) > 1.0) { if (inverter->Statistics()->getChannelFieldValue(TYPE_DC, c, FLD_PDC) > 2.0) {
dcProdChnls++; dcProdChnls++;
} }
} }
if (dcProdChnls > 0) { if ((dcProdChnls > 0) && (dcProdChnls != dcTotalChnls)) {
MessageOutput.printf("[PowerLimiterClass::setNewPowerLimit] %d channels total, %d producing channels, scaling power limit\r\n", MessageOutput.printf("[PowerLimiterClass::setNewPowerLimit] %d channels total, %d producing channels, scaling power limit\r\n",
dcTotalChnls, dcProdChnls); dcTotalChnls, dcProdChnls);
effPowerLimit = round(effPowerLimit * static_cast<float>(dcTotalChnls) / dcProdChnls); effPowerLimit = round(effPowerLimit * static_cast<float>(dcTotalChnls) / dcProdChnls);
if (effPowerLimit > inverter->DevInfo()->getMaxPower()) {
effPowerLimit = inverter->DevInfo()->getMaxPower();
}
} }
effPowerLimit = std::min<int32_t>(effPowerLimit, inverter->DevInfo()->getMaxPower());
// Check if the new value is within the limits of the hysteresis // Check if the new value is within the limits of the hysteresis
auto diff = std::abs(effPowerLimit - _lastRequestedPowerLimit); auto diff = std::abs(effPowerLimit - _lastRequestedPowerLimit);
if ( diff < config.PowerLimiter_TargetPowerConsumptionHysteresis) { if ( diff < config.PowerLimiter_TargetPowerConsumptionHysteresis) {