Skip to content

Commit ccb1bce

Browse files
committed
fix: DPL solar: use 1,5% check to determine if power can be increased
1 parent 023f03f commit ccb1bce

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-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

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

27+
// 1.5% of the inverter's max power can be missing
28+
auto maxPowerMissing = getInverterMaxPowerWatts() * 0.015;
29+
auto diff = getCurrentLimitWatts() - maxPowerMissing;
30+
31+
// if the inverter's output is within the limit, we can increase the power
32+
if (getCurrentOutputAcWatts() >= diff) {
33+
return getConfiguredMaxPowerWatts() - getCurrentLimitWatts();
34+
}
35+
36+
// if we reached this point and can't use overscaling, we can't increase the power
37+
if (!_config.UseOverscaling || _spInverter->supportsPowerDistributionLogic()) {
38+
return 0;
39+
}
40+
41+
// TODO(andreasboehm): disallow overscaling until the above solution is verified
42+
return 0;
43+
2744
// the maximum increase possible for this inverter
2845
int16_t maxTotalIncrease = getConfiguredMaxPowerWatts() - getCurrentOutputAcWatts();
2946

47+
auto expectedPowerPercentage = static_cast<float>(_config.ScalingThreshold) / 100.0;
48+
3049
auto pStats = _spInverter->Statistics();
3150
std::vector<MpptNum_t> dcMppts = _spInverter->getMppts();
3251
size_t dcTotalMppts = dcMppts.size();
3352

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

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
4655
auto expectedAcPowerPerMppt = (getCurrentLimitWatts() / dcTotalMppts) * expectedPowerPercentage;
4756

4857
size_t dcNonShadedMppts = 0;
@@ -72,23 +81,16 @@ uint16_t PowerLimiterSolarInverter::getMaxIncreaseWatts() const
7281
return maxTotalIncrease;
7382
}
7483

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-
}
84+
// we use the inverter's max power, because each MPPT can deliver its max power individually
85+
int16_t inverterMaxPower = getInverterMaxPowerWatts();
8286

8387
int16_t maxPowerPerMppt = inverterMaxPower / dcTotalMppts;
8488

8589
int16_t currentPowerPerNonShadedMppt = nonShadedMpptACPowerSum / dcNonShadedMppts;
8690

8791
int16_t maxIncreasePerNonShadedMppt = maxPowerPerMppt - currentPowerPerNonShadedMppt;
8892

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.
93+
// maximum increase based on the non-shaded mppts
9294
int16_t maxIncreaseNonShadedMppts = maxIncreasePerNonShadedMppt * dcNonShadedMppts;
9395

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

0 commit comments

Comments
 (0)