From 6eec8f606fc1019e0c5d72c209df99a4b8377317 Mon Sep 17 00:00:00 2001 From: DS_Starter Date: Sun, 9 Nov 2025 08:00:32 +0000 Subject: [PATCH] 76_SolarForecast: contrib Version 1.60.4 git-svn-id: https://svn.fhem.de/fhem/trunk@30505 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 38 ++++++++++++++------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index b0bb32d4d..8cb7e85af 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -162,7 +162,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "1.60.4" => "08.11.2025 smoothValue as OOP implemantation, battery efficiency rework ", + "1.60.4" => "09.11.2025 smoothValue as OOP implemantation, battery efficiency rework, edit comref ", "1.60.3" => "06.11.2025 more preparation for barrierSoC, ___batFindMinPhWh: code change, new parameter ctrlBatSocManagementXX->barrierSoC ", "1.60.2" => "03.11.2025 fix lowSoC comparison, ___batAdjustPowerByMargin: more preparation for barrierSoC ", "1.60.1" => "02.11.2025 ___batAdjustPowerByMargin: minor code change, preparation for barrierSoC ", @@ -7539,7 +7539,7 @@ sub _attrBatteryDev { ## no critic "not used" show => { comp => '(?:[0-3](?::(?:top|bottom))?)', must => 0, act => 0 }, label => { comp => '(none|below|beside)', must => 0, act => 0 }, asynchron => { comp => '(0|1)', must => 0, act => 0 }, - efficiency => { comp => '(100|[1-9]?[0-9])', must => 0, act => 0 }, + efficiency => { comp => '(?:100|[1-9][0-9]?)', must => 0, act => 0 }, }; if ($paref->{cmd} eq 'set') { @@ -12438,10 +12438,10 @@ sub __batChargeOptTargetPower { } ); - $pneedmin = $pneedmin / $befficiency; # neu! - $pneedmin = min ($pneedmin, $bpinmax); # Begrenzung auf max. mögliche Batterieladeleistung - $pneedmin = max ($pneedmin, 0); - $pneedmin = sprintf "%.0f", $pneedmin; + #$pneedmin = min ($pneedmin, $bpinmax); # Begrenzung auf max. mögliche Batterieladeleistung + #$pneedmin = max ($pneedmin, 0); + #$pneedmin = sprintf "%.0f", $pneedmin; + $pneedmin = ___batAdjustEfficiencyAndLimits ($pneedmin, $befficiency, $bpinmax, 0); # Apply Bat Effizienz und Ladeleistungsbegrenzungen $hsurp->{$hod}{$sbn}{pneedmin} = $pneedmin; @@ -12487,10 +12487,10 @@ sub __batChargeOptTargetPower { } ); - $target = $target / $befficiency; # neu! - $target = min ($target, $bpinmax); # Begrenzung auf max. mögliche Batterieladeleistung - $target = max ($target, $bpinreduced); - $target = sprintf "%.0f", $target; + #$target = min ($target, $bpinmax); # Begrenzung auf max. mögliche Batterieladeleistung + #$target = max ($target, $bpinreduced); + #$target = sprintf "%.0f", $target; + $target = ___batAdjustEfficiencyAndLimits ($target, $befficiency, $bpinmax, $bpinreduced); # Apply Bat Effizienz und Ladeleistungsbegrenzungen $otp->{$sbn}{target} = $target; } @@ -12602,6 +12602,20 @@ sub ___batApplySocAreas { return $ph; } +################################################################ +# Endbehandlung einer Leistungsvorgabe für Batterieladung +################################################################ +sub ___batAdjustEfficiencyAndLimits { + my ($ph, $eff, $max, $min) = @_; + + $ph /= $eff; + $ph = min ($ph, $max); # Begrenzung auf max. mögliche Batterieladeleistung + $ph = max ($ph, $min); # Begrenzung auf min. gewünschte Batterieladeleistung + $ph = sprintf "%.0f", $ph; + +return $ph; +} + ################################################################ # Aktionen im Bereich lowSoC <= SoC < barrierSoC ################################################################ @@ -28691,7 +28705,7 @@ to ensure that the system configuration is correct. efficiency Optional specification of the energy storage efficiency in %. This efficiency describes not only the battery itself, but also the chain of effects, including the inverters involved. Depending on the type of coupling and other factors, the typical efficiency is between 75 and 90%. - Value: 0..100 default: 87 + Value: 1..100 default: 87 icon Icon and/or (only) color of the battery in the bar graph according to the status (optional). The identifier (e.g. blue), HEX value (e.g. #d9d9d9) or 'dyn' can be specified as the color. @@ -31469,7 +31483,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden. efficiency Optionale Angabe des Wirkungsgrades der Energiespeicherung in %. Dieser Wirkungsgrad beschreibt nicht nur die Batterie selbst, sondern die Wirkkette inkl. der betroffenen Wechselrichter. Je nach Koppelart und anderen Faktoren liegt der typische Wirkungsgrad zwischen 75 - 90 %. - Wert: 0..100 default: 87 + Wert: 1..100 default: 87 icon Icon und/oder (nur) Farbe der Batterie in der Balkengrafik entsprechend des Status (optional). Als Farbe kann der Bezeichner (z.B. blue), HEX-Wert (z.B. #d9d9d9) oder 'dyn' angegeben werden.