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.