From 7fb26e1e815b28ec623a460aab87149b6d67fd78 Mon Sep 17 00:00:00 2001 From: helgeerbe <59169507+helgeerbe@users.noreply.github.com> Date: Mon, 2 Oct 2023 11:44:00 +0200 Subject: [PATCH] Channel for AC must always be CH0 (#472) --- src/PowerLimiter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PowerLimiter.cpp b/src/PowerLimiter.cpp index 25add8d66..d12d10ac3 100644 --- a/src/PowerLimiter.cpp +++ b/src/PowerLimiter.cpp @@ -343,7 +343,7 @@ int32_t PowerLimiterClass::inverterPowerDcToAc(std::shared_ptr CONFIG_T& config = Configuration.get(); float inverterEfficiencyPercent = inverter->Statistics()->getChannelFieldValue( - TYPE_AC, static_cast(config.PowerLimiter_InverterChannelId), FLD_EFF); + TYPE_AC, CH0, FLD_EFF); // fall back to hoymiles peak efficiency as per datasheet if inverter // is currently not producing (efficiency is zero in that case) @@ -440,7 +440,7 @@ int32_t PowerLimiterClass::calcPowerLimit(std::shared_ptr inve // 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 unreliable. - acPower = static_cast(inverter->Statistics()->getChannelFieldValue(TYPE_AC, (ChannelNum_t) config.PowerLimiter_InverterChannelId, FLD_PAC)); + acPower = static_cast(inverter->Statistics()->getChannelFieldValue(TYPE_AC, CH0, FLD_PAC)); newPowerLimit += acPower; } @@ -583,7 +583,7 @@ float PowerLimiterClass::getLoadCorrectedVoltage() CONFIG_T& config = Configuration.get(); auto channel = static_cast(config.PowerLimiter_InverterChannelId); - float acPower = _inverter->Statistics()->getChannelFieldValue(TYPE_AC, channel, FLD_PAC); + float acPower = _inverter->Statistics()->getChannelFieldValue(TYPE_AC, CH0, FLD_PAC); float dcVoltage = _inverter->Statistics()->getChannelFieldValue(TYPE_DC, channel, FLD_UDC); if (dcVoltage <= 0.0) {