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

76_SolarForecast: possible Illegal division by zero if Attr ctrlGenPVdeviation is set to continuously

git-svn-id: https://svn.fhem.de/fhem/trunk@28808 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2024-04-19 08:06:05 +00:00
parent 0598ce8e76
commit bb747d70c6
3 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it # Do not insert empty lines here, update check depends on it
- bugfix: 76_SolarForecast: possible Illegal division by zero if Attr
ctrlGenPVdeviation is set to continuously
- feature: 74_AutomowerConnect.pm: new attribute mowerPanel - feature: 74_AutomowerConnect.pm: new attribute mowerPanel
- bugfix: 76_SolarForecast: possible Illegal division by zero if Battery SOC - bugfix: 76_SolarForecast: possible Illegal division by zero if Battery SOC
management is activated management is activated

View File

@ -158,6 +158,7 @@ BEGIN {
# Versions History intern # Versions History intern
my %vNotesIntern = ( my %vNotesIntern = (
"1.17.10"=> "19.04.2024 calcTodayPVdeviation: avoid Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1311121 ",
"1.17.9" => "17.04.2024 _batSocTarget: fix Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1310930 ", "1.17.9" => "17.04.2024 _batSocTarget: fix Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1310930 ",
"1.17.8" => "16.04.2024 calcTodayPVdeviation: change of calculation ", "1.17.8" => "16.04.2024 calcTodayPVdeviation: change of calculation ",
"1.17.7" => "09.04.2024 export pvHistory to CSV, making attr affectMaxDayVariance obsolete ", "1.17.7" => "09.04.2024 export pvHistory to CSV, making attr affectMaxDayVariance obsolete ",
@ -10215,9 +10216,10 @@ sub calcTodayPVdeviation {
$dp = sprintf "%.2f", (100 - (100 * $pvfc / $pvre)); $dp = sprintf "%.2f", (100 - (100 * $pvfc / $pvre));
} }
else { else {
my $rodfc = ReadingsNum ($name, 'RestOfDayPVforecast', 0); my $rodfc = ReadingsNum ($name, 'RestOfDayPVforecast', 0); # PV Forecast für den Rest des Tages
my $fcun = $pvfc - $rodfc; # laufende PV Prognose aus Tagesprognose - Prognose Resttag my $cufc = $pvfc - $rodfc; # laufende PV Prognose aus Tagesprognose - Prognose Resttag
$dp = sprintf "%.2f", (100 - (100 * $pvre / $fcun)); return if(!$cufc); # Illegal division by zero verhindern Forum:
$dp = sprintf "%.2f", (100 - (100 * $pvre / $cufc));
} }
$data{$type}{$name}{circular}{99}{tdayDvtn} = $dp; $data{$type}{$name}{circular}{99}{tdayDvtn} = $dp;

View File

@ -158,6 +158,7 @@ BEGIN {
# Versions History intern # Versions History intern
my %vNotesIntern = ( my %vNotesIntern = (
"1.17.10"=> "19.04.2024 calcTodayPVdeviation: avoid Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1311121 ",
"1.17.9" => "17.04.2024 _batSocTarget: fix Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1310930 ", "1.17.9" => "17.04.2024 _batSocTarget: fix Illegal division by zero, Forum: https://forum.fhem.de/index.php?msg=1310930 ",
"1.17.8" => "16.04.2024 calcTodayPVdeviation: change of calculation ", "1.17.8" => "16.04.2024 calcTodayPVdeviation: change of calculation ",
"1.17.7" => "09.04.2024 export pvHistory to CSV, making attr affectMaxDayVariance obsolete ", "1.17.7" => "09.04.2024 export pvHistory to CSV, making attr affectMaxDayVariance obsolete ",
@ -10215,9 +10216,10 @@ sub calcTodayPVdeviation {
$dp = sprintf "%.2f", (100 - (100 * $pvfc / $pvre)); $dp = sprintf "%.2f", (100 - (100 * $pvfc / $pvre));
} }
else { else {
my $rodfc = ReadingsNum ($name, 'RestOfDayPVforecast', 0); my $rodfc = ReadingsNum ($name, 'RestOfDayPVforecast', 0); # PV Forecast für den Rest des Tages
my $fcun = $pvfc - $rodfc; # laufende PV Prognose aus Tagesprognose - Prognose Resttag my $cufc = $pvfc - $rodfc; # laufende PV Prognose aus Tagesprognose - Prognose Resttag
$dp = sprintf "%.2f", (100 - (100 * $pvre / $fcun)); return if(!$cufc); # Illegal division by zero verhindern Forum:
$dp = sprintf "%.2f", (100 - (100 * $pvre / $cufc));
} }
$data{$type}{$name}{circular}{99}{tdayDvtn} = $dp; $data{$type}{$name}{circular}{99}{tdayDvtn} = $dp;