76_SolarForecast: contrib version 1.59.1

git-svn-id: https://svn.fhem.de/fhem/trunk@30361 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
DS_Starter
2025-10-07 11:10:03 +00:00
parent 5a7056cb94
commit 5c301333b5

View File

@@ -160,7 +160,8 @@ BEGIN {
# Versions History intern # Versions History intern
my %vNotesIntern = ( my %vNotesIntern = (
"1.59.0" => "06.10.2025 new sub __normIconBoxScale to fix problem with chromium engine > 140.x, Forum: https://forum.fhem.de/index.php?msg=1349058 ", "1.59.1" => "07.10.2025 ",
"1.59.0" => "06.10.2025 new sub __normIconInnerScale to fix problem with chromium engine > 140.x, Forum: https://forum.fhem.de/index.php?msg=1349058 ",
"1.58.8" => "06.10.2025 __batChargeOptTargetPower: minor Code change ", "1.58.8" => "06.10.2025 __batChargeOptTargetPower: minor Code change ",
"1.58.7" => "05.10.2025 fix negative SoC forecast when using optPower Forum: https://forum.fhem.de/index.php?msg=1348954 ", "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 ". "1.58.6" => "03.10.2025 __batChargeMgmt code changed, new sub ___batChargeSaveResults, remove reading Battery_ChargeRecommended_XX ".
@@ -11921,6 +11922,7 @@ sub _batChargeMgmt {
my @batteries = grep { !/^(?:fd|speff|surplswh|nhr)$/xs } keys %{$hopt->{24}}; my @batteries = grep { !/^(?:fd|speff|surplswh|nhr)$/xs } keys %{$hopt->{24}};
for my $bat (sort @batteries) { for my $bat (sort @batteries) {
next if(!defined $hopt->{$shod}{$bat}{batinstcap});
my $ssocwh = $hopt->{$shod}{$bat}{runwh} // '-'; my $ssocwh = $hopt->{$shod}{$bat}{runwh} // '-';
## SOC-Prognose OTP ## SOC-Prognose OTP
@@ -12025,9 +12027,10 @@ sub __batChargeOptTargetPower {
my $otp; my $otp;
for my $hod (sort { $a <=> $b } keys %{$hsurp}) { for my $hod (sort { $a <=> $b } keys %{$hsurp}) {
my $spls = int $hsurp->{$hod}{surplswh};
my $newshod = sprintf "%02d", (int $hod + 1);
my $nhr = $hsurp->{$hod}{nhr}; my $nhr = $hsurp->{$hod}{nhr};
my $spls = int ($hsurp->{$hod}{surplswh} // 0);
my $nexthod = sprintf "%02d", (int $hod + 1);
my $nextnhr = $hsurp->{$nexthod}{nhr};
my @remaining_hods = grep { int $_ >= int $hod } @sortedhods; my @remaining_hods = grep { int $_ >= int $hod } @sortedhods;
@@ -12070,6 +12073,7 @@ sub __batChargeOptTargetPower {
$runwh += $hsurp->{$hod}{speff} / $befficiency; # um Verbrauch reduzieren $runwh += $hsurp->{$hod}{speff} / $befficiency; # um Verbrauch reduzieren
$hsurp->{$hod}{$sbn}{fcendwh} = sprintf "%.0f", max ($lowSocwh, $runwh); # untere Begrenzung auf lowSoC $hsurp->{$hod}{$sbn}{fcendwh} = sprintf "%.0f", max ($lowSocwh, $runwh); # untere Begrenzung auf lowSoC
$hsurp->{$nexthod}{$sbn}{fcnextwh} = $hsurp->{$hod}{$sbn}{fcendwh} if(defined $nextnhr); # Startwert kommende Stunde
if ($nhr eq '00') { if ($nhr eq '00') {
$otp->{$sbn}{target} = $csocwh <= $lowSocwh ? $bpinreduced : $bpinmax; $otp->{$sbn}{target} = $csocwh <= $lowSocwh ? $bpinreduced : $bpinmax;
@@ -12126,7 +12130,7 @@ sub __batChargeOptTargetPower {
) )
); );
$hsurp->{$newshod}{$sbn}{fcnextwh} = $hsurp->{$hod}{$sbn}{fcendwh}; # Startwert kommende Stunde $hsurp->{$nexthod}{$sbn}{fcnextwh} = $hsurp->{$hod}{$sbn}{fcendwh} if(defined $nextnhr); # Startwert kommende Stunde
} }
} }
@@ -18726,7 +18730,7 @@ END0
); );
$cicon = FW_makeImage ($cicon, ''); $cicon = FW_makeImage ($cicon, '');
$cicon = __normIconBoxScale ($cicon); $cicon = __normIconInnerScale ($cicon);
$ret .= qq{<g id="consumer_${c}_$stna" transform="translate($cons_left $y_pos)">}; $ret .= qq{<g id="consumer_${c}_$stna" transform="translate($cons_left $y_pos)">};
$ret .= "<title>$calias</title>".$cicon; $ret .= "<title>$calias</title>".$cicon;
@@ -18767,7 +18771,7 @@ END1
} }
$hicon = FW_makeImage ($hicon, ''); $hicon = FW_makeImage ($hicon, '');
$hicon = __normIconBoxScale ($hicon); $hicon = __normIconInnerScale ($hicon);
$ret .= qq{<g id="home_$stna" transform="translate(368 360)">}; # translate(X-Koordinate,Y-Koordinate) $ret .= qq{<g id="home_$stna" transform="translate(368 360)">}; # translate(X-Koordinate,Y-Koordinate)
$ret .= "<title>$hmtxt</title>".$hicon; $ret .= "<title>$hmtxt</title>".$hicon;
@@ -18789,7 +18793,7 @@ END1
$dicon = FW_makeImage ($dicon, ''); $dicon = FW_makeImage ($dicon, '');
$dicon = __normIconBoxScale ($dicon); $dicon = __normIconInnerScale ($dicon);
$ret .= qq{<g id="dummy_$stna" transform="translate(660 360)">}; $ret .= qq{<g id="dummy_$stna" transform="translate(660 360)">};
$ret .= "<title>$dumtxt</title>".$dicon; $ret .= "<title>$dumtxt</title>".$dicon;
@@ -19269,7 +19273,7 @@ sub __addInputProducerIcon {
); );
$genericon = FW_makeImage ($genericon, ''); $genericon = FW_makeImage ($genericon, '');
$genericon = __normIconBoxScale ($genericon); $genericon = __normIconInnerScale ($genericon);
$ret .= qq{<g id="generator_${pn}_$stna" fill="grey" transform="translate($xstart $ystart)">}; $ret .= qq{<g id="generator_${pn}_$stna" fill="grey" transform="translate($xstart $ystart)">};
$ret .= "<title>$genertxt</title>".$genericon; $ret .= "<title>$genertxt</title>".$genericon;
@@ -19288,7 +19292,7 @@ sub __addInputProducerIcon {
); );
$picon = FW_makeImage ($picon, ''); $picon = FW_makeImage ($picon, '');
$picon = __normIconBoxScale ($picon); $picon = __normIconInnerScale ($picon);
$ret .= qq{<g id="producer_${pn}_$stna" fill="grey" transform="translate($xstart $y_coord)">}; $ret .= qq{<g id="producer_${pn}_$stna" fill="grey" transform="translate($xstart $y_coord)">};
$ret .= "<title>$ptxt</title>".$picon; $ret .= "<title>$ptxt</title>".$picon;
@@ -19324,7 +19328,7 @@ sub __addNodeIcon {
); );
$nicon = FW_makeImage ($nicon, ''); $nicon = FW_makeImage ($nicon, '');
$nicon = __normIconBoxScale ($nicon); $nicon = __normIconInnerScale ($nicon);
my $ret = qq{<g id="node_$stna" transform="translate($x_coord $y_coord)">}; # translate(X-Koordinate,Y-Koordinate) my $ret = qq{<g id="node_$stna" transform="translate($x_coord $y_coord)">}; # translate(X-Koordinate,Y-Koordinate)
$ret .= "<title>$ntxt</title>".$nicon; $ret .= "<title>$ntxt</title>".$nicon;
@@ -19569,9 +19573,9 @@ return $p;
################################################################ ################################################################
# liefere skaliertes Icon in einer normierten Viewbox # liefere skaliertes Icon in einer normierten Viewbox
################################################################ ################################################################
sub __normIconBoxScale { sub __normIconInnerScale {
my $icon = shift; my $icon = shift;
my $size = shift // 72; my $size = shift // 70;
my $pad = shift // 0; my $pad = shift // 0;
return $icon unless $icon =~ m{<svg\b([^>]*)>(.*?)</svg>}si; return $icon unless $icon =~ m{<svg\b([^>]*)>(.*?)</svg>}si;