2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

76_SolarForecast.pm: contrib 0.1.0

git-svn-id: https://svn.fhem.de/fhem/trunk@23427 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2020-12-27 20:04:17 +00:00
parent 80a8f5f128
commit 9e23558261

View File

@ -187,17 +187,18 @@ sub Initialize {
"headerDetail:all,co,pv,pvco,statusLink ".
"hourCount:slider,4,1,24 ".
"hourStyle ".
"maxPV ".
"htmlStart ".
"htmlEnd ".
"interval ".
"layoutType:pv,co,pvco,diff ".
"maxVariancePerDay ".
"maxPV ".
"showDiff:no,top,bottom ".
"showHeader:1,0 ".
"showLink:1,0 ".
"showNight:1,0 ".
"showWeather:1,0 ".
"spaceSize ".
"layoutType:pv,co,pvco,diff ".
"Wh/kWh:Wh,kWh ".
"weatherColor:colorpicker,RGB ".
$readingFnAttributes;
@ -403,6 +404,8 @@ sub _setreset { ## no critic "not used"
deleteReadingspec ($hash, ".*_PVreal" );
}
createNotifyDev ($hash);
return;
}
@ -583,6 +586,10 @@ sub Attr {
unless ($aVal =~ /^[0-9]+$/x) {return "The value for $aName is not valid. Use only figures 0-9 !";}
InternalTimer(gettimeofday()+1.0, "FHEM::SolarForecast::centralTask", $hash, 0);
}
if ($aName eq "maxVariancePerDay") {
unless ($aVal =~ /^[0-9.]+$/x) {return "The value for $aName is not valid. Use only numbers with optional decimal places !";}
}
}
return;
@ -1955,6 +1962,8 @@ sub calcVariance {
readingsSingleUpdate($hash, "pvCorrectionFactor_Auto", "on", 0);
}
my $maxvar = AttrVal($name, "maxVariancePerDay", $defmaxvar); # max. Korrekturvarianz
my @da;
for my $h (1..23) {
next if(!$chour || $h >= $chour);
@ -1977,8 +1986,8 @@ sub calcVariance {
Log3($name, 5, "$name - Hour: ".sprintf("%02d",$h).", Today PVreal: $pvval, PVforecast: $fcnum");
if(abs($factor - $oldfac) > $defmaxvar) {
$factor = sprintf "%.2f", ($factor > $oldfac ? $oldfac + $defmaxvar : $oldfac - $defmaxvar);
if(abs($factor - $oldfac) > $maxvar) {
$factor = sprintf "%.2f", ($factor > $oldfac ? $oldfac + $maxvar : $oldfac - $maxvar);
Log3($name, 3, "$name - new limited Variance factor: $factor for hour: $h");
}
else {
@ -2464,6 +2473,13 @@ Um eine Anpassung an die persönliche Anlage zu ermöglichen, können Korrekturf
</li>
<br>
<a name="maxVariancePerDay"></a>
<li><b>maxVariancePerDay &lt;Zahl&gt; </b><br>
Maximale Änderungsgröße des PV Vorhersagefaktors (Reading pvCorrectionFactor_XX) pro Tag. <br>
(default: 0.5)
</li>
<br>
<a name="htmlStart"></a>
<li><b>htmlStart &lt;HTML-String&gt; </b><br>
Angabe eines beliebigen HTML-Strings der vor dem Grafik-Code ausgeführt wird.