2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

76_SolarForecast.pm: contrib 0.3.0

git-svn-id: https://svn.fhem.de/fhem/trunk@23603 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2021-01-24 08:35:16 +00:00
parent d4c6f518fb
commit 764bc0f747

View File

@ -959,7 +959,7 @@ sub centralTask {
createReadingsFromArray ($hash, \@da, 1); createReadingsFromArray ($hash, \@da, 1);
} }
sumNextHours ($hash, $chour, \@da); # Zusammenfassung nächste 4 Stunden erstellen collectSummaries ($hash, $chour, \@da); # Zusammenfassung nächste 4 Stunden u.a. erstellen
calcVariance ($params); # Autokorrektur berechnen calcVariance ($params); # Autokorrektur berechnen
readingsSingleUpdate($hash, "state", "updated", 1); # Abschluß state readingsSingleUpdate($hash, "state", "updated", 1); # Abschluß state
@ -1024,7 +1024,7 @@ sub writeHistoryToFile {
} }
else { else {
my $lw = gettimeofday(); my $lw = gettimeofday();
$hash->{HISTFILE} = "last write time: ".FmtTime($lw); $hash->{HISTFILE} = "last write time: ".FmtTime($lw)." File: $file";
} }
} }
@ -2488,7 +2488,7 @@ return $sq;
################################################################ ################################################################
# Zusammenfassungen erstellen # Zusammenfassungen erstellen
################################################################ ################################################################
sub sumNextHours { sub collectSummaries {
my $hash = shift; my $hash = shift;
my $chour = shift; # aktuelle Stunde my $chour = shift; # aktuelle Stunde
my $daref = shift; my $daref = shift;
@ -2498,6 +2498,7 @@ sub sumNextHours {
my $next4HoursSum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 }; my $next4HoursSum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 };
my $restOfDaySum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 }; my $restOfDaySum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 };
my $tomorrowSum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 }; my $tomorrowSum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 };
my $todaySum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 };
my $rdh = 24 - $chour - 1; # verbleibende Anzahl Stunden am Tag beginnend mit 00 (abzüglich aktuelle Stunde) my $rdh = 24 - $chour - 1; # verbleibende Anzahl Stunden am Tag beginnend mit 00 (abzüglich aktuelle Stunde)
my $thforecast = ReadingsNum ($name, "ThisHour_PVforecast", 0); my $thforecast = ReadingsNum ($name, "ThisHour_PVforecast", 0);
@ -2505,14 +2506,16 @@ sub sumNextHours {
$restOfDaySum->{PV} = $thforecast; $restOfDaySum->{PV} = $thforecast;
for my $h (1..47) { for my $h (1..47) {
$next4HoursSum->{PV} += ReadingsNum ($name, "NextHour".(sprintf "%02d", $h)."_PVforecast", 0) if($h <= 3); $next4HoursSum->{PV} += ReadingsNum ($name, "NextHour". (sprintf "%02d", $h)."_PVforecast", 0) if($h <= 3);
$restOfDaySum->{PV} += ReadingsNum ($name, "NextHour".(sprintf "%02d", $h)."_PVforecast", 0) if($h <= $rdh); $restOfDaySum->{PV} += ReadingsNum ($name, "NextHour". (sprintf "%02d", $h)."_PVforecast", 0) if($h <= $rdh);
$tomorrowSum->{PV} += ReadingsNum ($name, "NextHour".(sprintf "%02d", $h)."_PVforecast", 0) if($h > $rdh); $tomorrowSum->{PV} += ReadingsNum ($name, "NextHour". (sprintf "%02d", $h)."_PVforecast", 0) if($h > $rdh);
$todaySum->{PV} += ReadingsNum ($name, "Today_Hour".(sprintf "%02d", $h)."_PVforecast", 0) if($h <= 23);
} }
push @$daref, "Next04Hours_PV:". (int $next4HoursSum->{PV})." Wh"; push @$daref, "Next04Hours_PV:". (int $next4HoursSum->{PV})." Wh";
push @$daref, "RestOfDay_PV:". (int $restOfDaySum->{PV}). " Wh"; push @$daref, "RestOfDay_PV:". (int $restOfDaySum->{PV}). " Wh";
push @$daref, "Tomorrow_PV:". (int $tomorrowSum->{PV}). " Wh"; push @$daref, "Tomorrow_PV:". (int $tomorrowSum->{PV}). " Wh";
push @$daref, "Today_PV:". (int $todaySum->{PV}). " Wh";
createReadingsFromArray ($hash, $daref, 1); createReadingsFromArray ($hash, $daref, 1);
@ -2808,8 +2811,9 @@ verfügbare Globalstrahlung ganz spezifisch in elektrische Energie umgewandelt.
<ul> <ul>
<a name="writeHistory"></a> <a name="writeHistory"></a>
<li><b>writeHistory </b> <br> <li><b>writeHistory </b> <br>
Die vom Device gesammelten historischen PV Daten werden in eine File geschrieben. Dieser Vorgang wird per default Die vom Device gesammelten historischen PV Daten werden in ein File geschrieben. Dieser Vorgang wird per default
regelmäßig im Hintergrund ausgeführt. Im Internal "HISTFILE" wird der Zeitpunkt der letzten Speicherung angezeigt. <br> regelmäßig im Hintergrund ausgeführt. Im Internal "HISTFILE" wird der Filename und der Zeitpunkt der letzten
Speicherung dokumentiert. <br>
</li> </li>
</ul> </ul>
<br> <br>