Skip to content

Commit

Permalink
Fix: DPL mode 2 for solar-powered inverters
Browse files Browse the repository at this point in the history
for solar-powered inverters, the unconditional full solar-passthrough
implementation now sets the upper limit configured in the DPL settings.
  • Loading branch information
schlimmchen committed Apr 22, 2024
1 parent 1d4bea2 commit eb9bfd1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/PowerLimiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,30 @@ int32_t PowerLimiterClass::inverterPowerDcToAc(std::shared_ptr<InverterAbstract>
* 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<InverterAbstract> 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);
Expand Down

0 comments on commit eb9bfd1

Please sign in to comment.