Channel for AC must always be CH0 (#472)

This commit is contained in:
helgeerbe 2023-10-02 11:44:00 +02:00 committed by GitHub
parent b1164d6c69
commit 7fb26e1e81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -343,7 +343,7 @@ int32_t PowerLimiterClass::inverterPowerDcToAc(std::shared_ptr<InverterAbstract>
CONFIG_T& config = Configuration.get(); CONFIG_T& config = Configuration.get();
float inverterEfficiencyPercent = inverter->Statistics()->getChannelFieldValue( float inverterEfficiencyPercent = inverter->Statistics()->getChannelFieldValue(
TYPE_AC, static_cast<ChannelNum_t>(config.PowerLimiter_InverterChannelId), FLD_EFF); TYPE_AC, CH0, FLD_EFF);
// fall back to hoymiles peak efficiency as per datasheet if inverter // fall back to hoymiles peak efficiency as per datasheet if inverter
// is currently not producing (efficiency is zero in that case) // is currently not producing (efficiency is zero in that case)
@ -440,7 +440,7 @@ int32_t PowerLimiterClass::calcPowerLimit(std::shared_ptr<InverterAbstract> inve
// the produced power of this inverter has also to be taken into account. // the produced power of this inverter has also to be taken into account.
// We don't use FLD_PAC from the statistics, because that // We don't use FLD_PAC from the statistics, because that
// data might be too old and unreliable. // data might be too old and unreliable.
acPower = static_cast<int>(inverter->Statistics()->getChannelFieldValue(TYPE_AC, (ChannelNum_t) config.PowerLimiter_InverterChannelId, FLD_PAC)); acPower = static_cast<int>(inverter->Statistics()->getChannelFieldValue(TYPE_AC, CH0, FLD_PAC));
newPowerLimit += acPower; newPowerLimit += acPower;
} }
@ -583,7 +583,7 @@ float PowerLimiterClass::getLoadCorrectedVoltage()
CONFIG_T& config = Configuration.get(); CONFIG_T& config = Configuration.get();
auto channel = static_cast<ChannelNum_t>(config.PowerLimiter_InverterChannelId); auto channel = static_cast<ChannelNum_t>(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); float dcVoltage = _inverter->Statistics()->getChannelFieldValue(TYPE_DC, channel, FLD_UDC);
if (dcVoltage <= 0.0) { if (dcVoltage <= 0.0) {