Skip to content

Commit 992ad81

Browse files
committed
fix: DPL solar: use fixed 20W check to determine if power can be increased
1 parent 023f03f commit 992ad81

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

src/PowerLimiterOverscalingInverter.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ uint16_t PowerLimiterOverscalingInverter::scaleLimit(uint16_t expectedOutputWatt
3838
// unreasonable scaling.
3939
if (!isProducing()) { return expectedOutputWatts; }
4040

41+
// TODO(andreasboehm): disallow overscaling for solar inverters until
42+
// the new solution to detect shading in getMaxIncreaseWatts() is verified
43+
if(_config.PowerSource == PowerLimiterInverterConfig::InverterPowerSource::Solar) {
44+
return expectedOutputWatts;
45+
}
46+
4147
auto pStats = _spInverter->Statistics();
4248
std::vector<ChannelNum_t> dcChnls = _spInverter->getChannelsDC();
4349
std::vector<MpptNum_t> dcMppts = _spInverter->getMppts();

src/PowerLimiterSolarInverter.cpp

+18-20
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,30 @@ uint16_t PowerLimiterSolarInverter::getMaxIncreaseWatts() const
2424
return getConfiguredMaxPowerWatts();
2525
}
2626

27+
// if the inverter is producing only 20W less than the limit, we can increase the power
28+
if (getCurrentOutputAcWatts() >= getCurrentLimitWatts() - 20) {
29+
return getConfiguredMaxPowerWatts() - getCurrentLimitWatts();
30+
}
31+
32+
// if we reached this point and can't use overscaling, we can't increase the power
33+
if (!_config.UseOverscaling || _spInverter->supportsPowerDistributionLogic()) {
34+
return 0;
35+
}
36+
37+
// TODO(andreasboehm): disallow overscaling until the above solution is verified
38+
return 0;
39+
2740
// the maximum increase possible for this inverter
2841
int16_t maxTotalIncrease = getConfiguredMaxPowerWatts() - getCurrentOutputAcWatts();
2942

43+
auto expectedPowerPercentage = static_cast<float>(_config.ScalingThreshold) / 100.0;
44+
3045
auto pStats = _spInverter->Statistics();
3146
std::vector<MpptNum_t> dcMppts = _spInverter->getMppts();
3247
size_t dcTotalMppts = dcMppts.size();
3348

3449
float inverterEfficiencyFactor = pStats->getChannelFieldValue(TYPE_INV, CH0, FLD_EFF) / 100;
3550

36-
// with 97% we are a bit less strict than when we scale the limit
37-
auto expectedPowerPercentage = 0.97;
38-
39-
// use the scaling threshold as the expected power percentage if lower,
40-
// but only when overscaling is enabled and the inverter does not support PDL
41-
if (_config.UseOverscaling && !_spInverter->supportsPowerDistributionLogic()) {
42-
expectedPowerPercentage = std::min(expectedPowerPercentage, static_cast<float>(_config.ScalingThreshold) / 100.0);
43-
}
44-
45-
// x% of the expected power is good enough
4651
auto expectedAcPowerPerMppt = (getCurrentLimitWatts() / dcTotalMppts) * expectedPowerPercentage;
4752

4853
size_t dcNonShadedMppts = 0;
@@ -72,23 +77,16 @@ uint16_t PowerLimiterSolarInverter::getMaxIncreaseWatts() const
7277
return maxTotalIncrease;
7378
}
7479

75-
// for inverters without PDL we use the configured max power, because the limit will be divided equally across the MPPTs by the inverter.
76-
int16_t inverterMaxPower = getConfiguredMaxPowerWatts();
77-
78-
// 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.
79-
if (_spInverter->supportsPowerDistributionLogic() || _config.UseOverscaling) {
80-
inverterMaxPower = getInverterMaxPowerWatts();
81-
}
80+
// we use the inverter's max power, because each MPPT can deliver its max power individually
81+
int16_t inverterMaxPower = getInverterMaxPowerWatts();
8282

8383
int16_t maxPowerPerMppt = inverterMaxPower / dcTotalMppts;
8484

8585
int16_t currentPowerPerNonShadedMppt = nonShadedMpptACPowerSum / dcNonShadedMppts;
8686

8787
int16_t maxIncreasePerNonShadedMppt = maxPowerPerMppt - currentPowerPerNonShadedMppt;
8888

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

9492
// maximum increase should not exceed the max total increase

0 commit comments

Comments
 (0)