Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare Release 2025.01.10 #1516

Merged
merged 3 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions src/PowerLimiterSolarInverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ uint16_t PowerLimiterSolarInverter::getMaxIncreaseWatts() const
{
if (isEligible() != Eligibility::Eligible) { return 0; }

// the maximum increase possible for this inverter
int16_t maxTotalIncrease = getConfiguredMaxPowerWatts() - getCurrentOutputAcWatts();

if (!isProducing()) {
// the inverter is not producing, we don't know how much we can increase
// the power, so we return the maximum possible increase
return maxTotalIncrease;
return getConfiguredMaxPowerWatts();
}

// the maximum increase possible for this inverter
int16_t maxTotalIncrease = getConfiguredMaxPowerWatts() - getCurrentOutputAcWatts();

// when the current limit is less than 15% of the max power of the inverter
// the output will not match the limit as the inverters are not able to work
// with those low limits. In this case we assume that the inverter is able to
Expand Down Expand Up @@ -82,14 +82,27 @@ uint16_t PowerLimiterSolarInverter::getMaxIncreaseWatts() const
return maxTotalIncrease;
}

int16_t maxPowerPerMppt = getConfiguredMaxPowerWatts() / dcTotalMppts;
// for inverters without PDL we use the configured max power, because the limit will be divided equally across the MPPTs by the inverter.
int16_t inverterMaxPower = getConfiguredMaxPowerWatts();

// for inverter with PDL or when overscaling is enabled we use the max power of the inverter because each MPPT can deliver its max power.
if (_spInverter->supportsPowerDistributionLogic() || _config.UseOverscaling) {
inverterMaxPower = getInverterMaxPowerWatts();
}

int16_t maxPowerPerMppt = inverterMaxPower / dcTotalMppts;

int16_t currentPowerPerNonShadedMppt = nonShadedMpptACPowerSum / dcNonShadedMppts;

int16_t maxIncreasePerNonShadedMppt = maxPowerPerMppt - currentPowerPerNonShadedMppt;

// maximum increase based on the non-shaded mppts
return maxIncreasePerNonShadedMppt * dcNonShadedMppts;
// maximum increase based on the non-shaded mppts, can be higher than maxTotalIncrease for inverters
// with PDL when getConfiguredMaxPowerWatts() is less than getInverterMaxPowerWatts() divided by
// the number of used/unshaded MPPTs.
int16_t maxIncreaseNonShadedMppts = maxIncreasePerNonShadedMppt * dcNonShadedMppts;

// maximum increase should not exceed the max total increase
return std::min(maxTotalIncrease, maxIncreaseNonShadedMppts);
}

uint16_t PowerLimiterSolarInverter::applyReduction(uint16_t reduction, bool)
Expand Down
4 changes: 3 additions & 1 deletion src/gridcharger/huawei/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ void Controller::loop()

void Controller::setParameter(float val, HardwareInterface::Setting setting)
{
std::lock_guard<std::mutex> lock(_mutex);

if (_mode == HUAWEI_MODE_AUTO_INT &&
setting != HardwareInterface::Setting::OfflineVoltage &&
setting != HardwareInterface::Setting::OfflineCurrent) { return; }
Expand All @@ -296,7 +298,7 @@ void Controller::setParameter(float val, HardwareInterface::Setting setting)

void Controller::_setParameter(float val, HardwareInterface::Setting setting)
{
std::lock_guard<std::mutex> lock(_mutex);
// NOTE: the mutex is locked by any method calling this private method

if (!_upHardwareInterface) { return; }

Expand Down
Loading