Skip to content

Commit

Permalink
producing DC channel aware artificial increase of applied power limit…
Browse files Browse the repository at this point in the history
… to mitigate fixed distribution of applied power limit across all channels
  • Loading branch information
qubeck committed Apr 2, 2023
1 parent 20bb7fc commit a1da3f9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/PowerLimiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,18 @@ void PowerLimiterClass::setNewPowerLimit(std::shared_ptr<InverterAbstract> inver
_lastCommandSent = millis();
}
MessageOutput.printf("[PowerLimiterClass::loop] Limit Non-Persistent: %d W\r\n", newPowerLimit);
inverter->sendActivePowerControlRequest(Hoymiles.getRadio(), newPowerLimit, PowerLimitControlType::AbsolutNonPersistent);

std::list<ChannelNum_t> dcChnls = inverter->Statistics()->getChannelsByType(TYPE_DC);
int dcProdChnls = 0, dcTotalChnls = dcChnls.size();
for (auto& c : dcChnls){
if (inverter->Statistics()->getChannelFieldValue(TYPE_DC, c, FLD_PDC) > 0)
dcProdChnls++;
}
int32_t effPowerLimit = round(newPowerLimit * (float)dcTotalChnls / dcProdChnls);
if (effPowerLimit > config.PowerLimiter_UpperPowerLimit)
effPowerLimit = config.PowerLimiter_UpperPowerLimit;

inverter->sendActivePowerControlRequest(Hoymiles.getRadio(), effPowerLimit, PowerLimitControlType::AbsolutNonPersistent);
_lastRequestedPowerLimit = newPowerLimit;
}
}
Expand Down

0 comments on commit a1da3f9

Please sign in to comment.