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.
This commit is contained in:
Bernhard Kirchen 2024-04-21 20:59:28 +02:00 committed by Bernhard Kirchen
parent 1d4bea24ff
commit eb9bfd1ac6

View File

@ -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);