From eb9bfd1ac62efcb28a542ce7708c0f063df48dfe Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Sun, 21 Apr 2024 20:59:28 +0200 Subject: [PATCH] Fix: DPL mode 2 for solar-powered inverters for solar-powered inverters, the unconditional full solar-passthrough implementation now sets the upper limit configured in the DPL settings. --- src/PowerLimiter.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/PowerLimiter.cpp b/src/PowerLimiter.cpp index 6c2c44337..6ebbf3096 100644 --- a/src/PowerLimiter.cpp +++ b/src/PowerLimiter.cpp @@ -363,15 +363,30 @@ int32_t PowerLimiterClass::inverterPowerDcToAc(std::shared_ptr * can currently only be set using MQTT. in this mode of operation, the * inverter shall behave as if it was connected to the solar panels directly, * i.e., all solar power (and only solar power) is fed to the AC side, - * independent from the power meter reading. + * independent from the power meter reading. if the inverter is actually + * already connected to solar modules rather than a battery, the upper power + * limit is set as the inverter limit. */ void PowerLimiterClass::unconditionalSolarPassthrough(std::shared_ptr inverter) { + if ((millis() - _lastCalculation) < _calculationBackoffMs) { return; } + _lastCalculation = millis(); + + auto const& config = Configuration.get(); + + if (config.PowerLimiter.IsInverterSolarPowered) { + _calculationBackoffMs = 10 * 1000; + setNewPowerLimit(inverter, config.PowerLimiter.UpperPowerLimit); + announceStatus(Status::UnconditionalSolarPassthrough); + return; + } + if (!VictronMppt.isDataValid()) { shutdown(Status::NoVeDirect); return; } + _calculationBackoffMs = 1 * 1000; int32_t solarPower = VictronMppt.getPowerOutputWatts(); setNewPowerLimit(inverter, inverterPowerDcToAc(inverter, solarPower)); announceStatus(Status::UnconditionalSolarPassthrough);