diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index e277b8fca..ab791669a 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -156,7 +156,8 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "1.36.0" => "11.10.2024 new Getter valInverter, preparation for multiple inverters ", + "1.36.0" => "11.10.2024 new Getter valInverter, preparation for multiple inverters, rename setupInverterDev to setupInverterDev01 ". + "Model DWD: dayAfterTomorrowPVforecast now available ", "1.35.0" => "09.10.2024 _flowGraphic: replace inverter icon by FHEM SVG-Icon (sun/moon), sun or icon of moon phases according ". "day/night new optional key 'icon' in attr setupInverterDev, resize all flowgraphic icons to a standard ". "scaling, __switchConsumer: run ___setConsumerSwitchingState before switch subs ". @@ -3399,6 +3400,7 @@ sub __getDWDSolarData { my $raname = AttrVal ($name, 'setupRadiationAPI', ''); # Radiation Forecast API return if(!$raname || !$defs{$raname}); + my $fcdays = AttrVal ($raname, 'forecastDays', 1); # Anzahl Forecast Days in DWD Device my $cafd = AttrVal ($name, 'ctrlAreaFactorUsage', 'fix'); # Art der Flächenfaktor Berechnung my $stime = $date.' 00:00:00'; # Startzeit Soll Übernahmedaten my $sts = timestringToTimestamp ($stime); @@ -3416,7 +3418,9 @@ sub __getDWDSolarData { debugLog ($paref, "apiCall", "DWD API - collect DWD Radiation data with start >$stime<- device: $raname =>"); - for my $num (0..47) { + my $end = (24 + $fcdays * 24) - 1; # default 47 + + for my $num (0..$end) { # V 1.36.0 my ($fd,$fh) = calcDayHourMove (0, $num); next if($fh == 24); @@ -4541,6 +4545,8 @@ sub _getlistPVHistory { my $hash = $defs{$name}; my $ret = listDataPool ($hash, 'pvhist', $arg); + return if(!$ret); + $ret .= lineFromSpaces ($ret, 20); $ret =~ s/\n/
/g; @@ -15553,6 +15559,8 @@ sub setPVhistory { } my ($r1, $r2, $r3, $r4, $r5, $r6, $r7, $r8) = (0,0,0,0,0,0,0,0); + my $ien = {}; # Hashref Inverter energy + my $pen = {}; # Hashref Producer energy for my $k (keys %{$data{$type}{$name}{pvhist}{$reorgday}}) { next if($k eq "99"); @@ -15565,6 +15573,22 @@ sub setPVhistory { $r6 += HistoryVal ($hash, $reorgday, $k, 'gcons', 0); $r7 += HistoryVal ($hash, $reorgday, $k, 'gfeedin', 0); $r8 += HistoryVal ($hash, $reorgday, $k, 'con', 0); + + ## Reorg Inverter + ################## + for my $in (1..$maxinverter) { + $in = sprintf "%02d", $in; + my $e = HistoryVal ($hash, $reorgday, $k, 'pvrl'.$in, undef); + $ien->{$in} += $e if(defined $e); + } + + ## Reorg Producer + ################## + for my $pn (1..$maxproducer) { + $pn = sprintf "%02d", $pn; + my $e = HistoryVal ($hash, $reorgday, $k, 'pprl'.$pn, undef); + $pen->{$pn} += $e if(defined $e); + } } $data{$type}{$name}{pvhist}{$reorgday}{99}{batin} = $r1; @@ -15575,8 +15599,16 @@ sub setPVhistory { $data{$type}{$name}{pvhist}{$reorgday}{99}{gcons} = $r6; $data{$type}{$name}{pvhist}{$reorgday}{99}{gfeedin} = $r7; $data{$type}{$name}{pvhist}{$reorgday}{99}{con} = $r8; + + for my $in (keys %{$ien}) { + $data{$type}{$name}{pvhist}{$reorgday}{99}{'pvrl'.$in} = $ien->{$in}; + } + + for my $pn (keys %{$pen}) { + $data{$type}{$name}{pvhist}{$reorgday}{99}{'pprl'.$pn} = $pen->{$pn}; + } - debugLog ($paref, 'saveData2Cache', "setPVhistory -> Day >$reorgday< reorganized keys: batin, batout, pvrl, pvfc, con, confc, gcons, gfeedin"); + debugLog ($paref, 'saveData2Cache', "setPVhistory -> Day >$reorgday< reorganized keys: batin, batout, pvrl, pvfc, con, confc, gcons, gfeedin, pvrlXX, pprlXX"); } if ($histname) { @@ -15976,9 +16008,6 @@ sub listDataPool { my $fsaitr = CircularVal ($hash, $idx, 'aitrainLastFinishTs', '-'); my $airn = CircularVal ($hash, $idx, 'aiRulesNumber', '-'); my $aicts = CircularVal ($hash, $idx, 'attrInvChangedTs', '-'); - my $pprl01 = CircularVal ($hash, $idx, 'pprl01', '-'); - my $pprl02 = CircularVal ($hash, $idx, 'pprl02', '-'); - my $pprl03 = CircularVal ($hash, $idx, 'pprl03', '-'); my $pvcf = _ldchash2val ( {pool => $h, idx => $idx, key => 'pvcorrf', cval => $pvcorrf} ); my $cfq = _ldchash2val ( {pool => $h, idx => $idx, key => 'quality', cval => $quality} ); @@ -15992,7 +16021,20 @@ sub listDataPool { $sq .= $idx." => pvapifc: $pvapifc, pvaifc: $pvaifc, pvfc: $pvfc, aihit: $aihit, pvrl: $pvrl\n"; $sq .= " batin: $batin, batout: $batout, confc: $confc, gcon: $gcons, gfeedin: $gfeedin, wcc: $wccv, rr1c: $rr1c\n"; $sq .= " temp: $temp, wid: $wid, wtxt: $wtxt\n"; - $sq .= " pprl01: $pprl01, pprl02: $pprl02, pprl03: $pprl03\n"; + + my $prdl; + for my $pn (1..$maxproducer) { # + alle Producer + $pn = sprintf "%02d", $pn; + my $pprl = CircularVal ($hash, $idx, 'pprl'.$pn, '-'); + + if (defined $pprl) { + $prdl .= ', ' if($prdl); + $prdl .= "pprl${pn}: $pprl"; + } + } + + $sq .= " $prdl\n" if($prdl); + $sq .= " pvcorrf: $pvcf\n"; $sq .= " quality: $cfq\n"; $sq .= " pvrlsum: $pvrs\n"; @@ -19882,7 +19924,7 @@ to ensure that the system configuration is correct. csmeXX Energy consumption of ConsumerXX in the hour of the day (hour 99 = daily energy consumption) cyclescsmXX Number of active cycles of ConsumerXX of the day DoN Sunrise and sunset status (0 - night, 1 - day) - etotal PV meter reading “Total energy yield” (Wh) at the beginning of the hour + etotaliXX PV meter reading “Total energy yield” (Wh) of inverter XX at the beginning of the hour etotalpXX Meter reading “Total energy yield” (Wh) of producer XX at the beginning of the hour gcons real power consumption (Wh) from the electricity grid gfeedin real feed-in (Wh) into the electricity grid @@ -19891,7 +19933,8 @@ to ensure that the system configuration is correct. minutescsmXX total active minutes in the hour of ConsumerXX pprlXX Energy generation of producer XX (see attribute setupOtherProducerXX) in the hour (Wh) pvfc the predicted PV yield (Wh) - pvrl real PV generation (Wh) + pvrlXX real PV generation (Wh) of inverter XX + pvrl Sum real PV generation (Wh) of all inverters pvrlvd 1-'pvrl' is valid and is taken into account in the learning process, 0-'pvrl' is assessed as abnormal pvcorrf Autocorrection factor used / forecast quality achieved rad1h global radiation (kJ/m2) @@ -21359,7 +21402,7 @@ to ensure that the system configuration is correct.
@@ -22233,7 +22276,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden. conprice Preis für den Bezug einer kWh. Die Einheit des Preises ist im setupMeterDev definiert. cyclescsmXX Anzahl aktive Zyklen von ConsumerXX des Tages DoN Sonnenauf- und untergangsstatus (0 - Nacht, 1 - Tag) - etotal PV Zählerstand "Energieertrag total" (Wh) zu Beginn der Stunde + etotaliXX PV Zählerstand "Energieertrag total" (Wh) von Inverter XX zu Beginn der Stunde etotalpXX Zählerstand "Energieertrag total" (Wh) des Produzenten XX zu Beginn der Stunde gcons realer Leistungsbezug (Wh) aus dem Stromnetz gfeedin reale Einspeisung (Wh) in das Stromnetz @@ -22243,7 +22286,8 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden. minutescsmXX Summe Aktivminuten in der Stunde von ConsumerXX pprlXX Energieerzeugung des Produzenten XX (siehe Attribut setupOtherProducerXX) in der Stunde (Wh) pvfc der prognostizierte PV Ertrag (Wh) - pvrl reale PV Erzeugung (Wh) + pvrlXX reale PV Erzeugung (Wh) von Inverter XX + pvrl Summe reale PV Erzeugung (Wh) aller Inverter pvrlvd 1-'pvrl' ist gültig und wird im Lernprozess berücksichtigt, 0-'pvrl' ist als abnormal bewertet pvcorrf verwendeter Autokorrekturfaktor / erreichte Prognosequalität rad1h Globalstrahlung (kJ/m2) @@ -23712,7 +23756,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.