diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 3ed1454c7..4d596858f 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -435,7 +435,7 @@ sub Initialize { # "consumerAdviceIcon ". "cloudFactorDamping:slider,0,1,100 ". "disable:1,0 ". - "follow70percentRule:1,0 ". + "follow70percentRule:1,dynamic,0 ". "forcePageRefresh:1,0 ". "headerAlignment:center,left,right ". "headerDetail:all,co,pv,pvco,statusLink ". @@ -3703,23 +3703,47 @@ sub calcPVforecast { $pvsum += $pv; $peaksum += $peak * 1000; # kWp in Wp umrechnen } - - my $logao = qq{}; - if (AttrVal ($name, "follow70percentRule", 0)) { - my $max70 = $peaksum/100 * 70; - if($pvsum > $max70) { - $pvsum = $max70; - $logao = qq{(reduced by 70 percent rule)}; - } - } - - $pvsum = int $pvsum; + + my $logao = qq{}; + $paref->{pvsum} = $pvsum; + $paref->{peaksum} = $peaksum; + ($pvsum, $logao) = _70percentRule ($paref); Log3($name, 4, "$name - PV forecast calc for $reld Hour ".sprintf("%02d",$chour+1)." summary: $pvsum ".$logao); return $pvsum; } +################################################################ +# 70% Regel kalkulieren +################################################################ +sub _70percentRule { + my $paref = shift; + my $hash = $paref->{hash}; + my $name = $paref->{name}; + my $pvsum = $paref->{pvsum}; + my $peaksum = $paref->{peaksum}; + my $num = $paref->{num}; # Nexthour + + my $logao = qq{}; + my $confc = NexthoursVal ($hash, "NextHour".sprintf("%02d",$num), "confc", 0); + my $max70 = $peaksum/100 * 70; + + if(AttrVal ($name, "follow70percentRule", "0") eq "1" && $pvsum > $max70) { + $pvsum = $max70; + $logao = qq{(reduced by 70 percent rule)}; + } + + if(AttrVal ($name, "follow70percentRule", "0") eq "dynamic" && $pvsum > $max70 + $confc) { + $pvsum = $max70 + $confc; + $logao = qq{(reduced by 70 percent dynamic rule)}; + } + + $pvsum = int $pvsum; + +return ($pvsum, $logao); +} + ################################################################ # Abweichung PVreal / PVforecast berechnen # bei eingeschalteter automat. Korrektur @@ -4123,7 +4147,7 @@ sub listDataPool { $sq .= "\n" if($sq); $sq .= $idx." => pvfc: $pvfc, pvrl: $pvrl, gcon: $gcons, gfeedin: $gfeedin, wcc: $wccv, wrp: $wrprb, temp=$temp, wid: $wid, wtxt: $wtxt\n"; $sq .= " corr: $pvcf\n"; - $sq .= " quality:$cfq"; + $sq .= " quality: $cfq"; } } @@ -5172,7 +5196,17 @@ verfügbare Globalstrahlung ganz spezifisch in elektrische Energie umgewandelt.
0 | keine Begrenzung der prognostizierten PV-Erzeugung (default) |
1 | die prognostizierte PV-Erzeugung wird auf 70% der installierten Stringleistung begrenzt |
dynamic | die prognostizierte PV-Erzeugung wird begrenzt wenn 70% der installierten |
Stringleistung zzgl. des prognostizierten Verbrauchs überschritten wird |