From a7daf64d9091afa86c6b28d5eb583305956173eb Mon Sep 17 00:00:00 2001 From: DS_Starter Date: Sun, 5 Oct 2025 07:13:29 +0000 Subject: [PATCH] 76_SolarForecast: negative SoC forecast when using optPower git-svn-id: https://svn.fhem.de/fhem/trunk@30352 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/76_SolarForecast.pm | 3 ++- fhem/contrib/DS_Starter/76_SolarForecast.pm | 7 ++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index fcaa6390d..2e47aa593 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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 + - bugfix: 76_SolarForecast: negative SoC forecast when using optPower - feature: 76_SolarForecast: Version 1.58.6 - bugfix: 72_FRITZBOX: Fehler bei rename von Devices - bugfix: 76_SolarForecast: opt load if battery load control is deactivated diff --git a/fhem/FHEM/76_SolarForecast.pm b/fhem/FHEM/76_SolarForecast.pm index ed68cf896..c419e1440 100644 --- a/fhem/FHEM/76_SolarForecast.pm +++ b/fhem/FHEM/76_SolarForecast.pm @@ -160,6 +160,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "1.58.7" => "05.10.2025 fix negative SoC forecast when using optPower Forum: https://forum.fhem.de/index.php?msg=1348954 ", "1.58.6" => "03.10.2025 __batChargeMgmt code changed, new sub ___batChargeSaveResults, remove reading Battery_ChargeRecommended_XX ". "_calcReadingsTomorrowPVFc: bugfix generating readings of tomorrow ". "__batChargeOptTargetPower: complete rework, Attr ctrlBatSocManagementXX new keys 'loadStrategy', 'weightOwnUse' ". @@ -12049,7 +12050,7 @@ sub __batChargeOptTargetPower { $hsurp->{$hod}{$sbn}{pneedmin} = $bpinmax; $runwh += $hsurp->{$hod}{speff} / $befficiency; # um Verbrauch reduzieren - $hsurp->{$hod}{$sbn}{fcendwh} = sprintf "%.0f", $runwh; + $hsurp->{$hod}{$sbn}{fcendwh} = sprintf "%.0f", max (0, $runwh); if ($nhr eq '00') { $otp->{$sbn}{target} = $csocwh <= $lowSocwh ? $bpinreduced : $bpinmax; diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 269f5f909..c419e1440 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -160,6 +160,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "1.58.7" => "05.10.2025 fix negative SoC forecast when using optPower Forum: https://forum.fhem.de/index.php?msg=1348954 ", "1.58.6" => "03.10.2025 __batChargeMgmt code changed, new sub ___batChargeSaveResults, remove reading Battery_ChargeRecommended_XX ". "_calcReadingsTomorrowPVFc: bugfix generating readings of tomorrow ". "__batChargeOptTargetPower: complete rework, Attr ctrlBatSocManagementXX new keys 'loadStrategy', 'weightOwnUse' ". @@ -12049,7 +12050,7 @@ sub __batChargeOptTargetPower { $hsurp->{$hod}{$sbn}{pneedmin} = $bpinmax; $runwh += $hsurp->{$hod}{speff} / $befficiency; # um Verbrauch reduzieren - $hsurp->{$hod}{$sbn}{fcendwh} = sprintf "%.0f", $runwh; + $hsurp->{$hod}{$sbn}{fcendwh} = sprintf "%.0f", max (0, $runwh); if ($nhr eq '00') { $otp->{$sbn}{target} = $csocwh <= $lowSocwh ? $bpinreduced : $bpinmax; @@ -27849,7 +27850,7 @@ to ensure that the system configuration is correct. pinmax the maximum possible charging power in watts (optional) pinreducedThe reduced charging power in watts (optional). The value is set in Reading Battery_ChargeOptTargetPower_XX - if there is no PV surplus or if the calculated charging power falls below this value. + if the calculated charging power falls below this value or the SoC <= lowSoC. This means that the value can also be applied in the case of demand charging from the public grid. poutmax the maximum possible discharge power in watts (optional) @@ -30544,7 +30545,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden. pinmax die maximal mögliche Ladeleistung in Watt (optional) pinreducedDie reduzierte Ladeleistung in Watt (optional). Der Wert wird im Reading Battery_ChargeOptTargetPower_XX - gesetzt wenn kein PV-Überschuß vorhanden ist oder die kalkulierte Ladeleistung unter diesen Wert fällt. + gesetzt wenn die kalkulierte Ladeleistung unter diesen Wert fällt oder der SoC <= lowSoC beträgt. Somit kann der Wert auch im Fall der Anforderungsladung aus dem öffentlichen Netz zur Anwendung kommen. poutmax die maximal mögliche Entladeleistung in Watt (optional)