2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

76_SolarForecast: fix interruptable key and some minor fixes

git-svn-id: https://svn.fhem.de/fhem/trunk@29511 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2025-01-11 13:25:00 +00:00
parent 4a368f5b0f
commit efa5b14309
2 changed files with 40 additions and 16 deletions

View File

@ -158,7 +158,8 @@ BEGIN {
# Versions History intern # Versions History intern
my %vNotesIntern = ( my %vNotesIntern = (
"1.43.1" => "11.01.2025 _batChargeRecmd: bugfix PV daily surplus update, _collectAllRegConsumers: fix interruptable hysteresis ". "1.43.1" => "11.01.2025 _batChargeRecmd: bugfix PV daily surplus update, _collectAllRegConsumers: fix interruptable hysteresis ".
"__batRcmdOnBeam: show soc forecast for hour 00 and fix english translation ", "__batRcmdOnBeam: show soc forecast for hour 00 and fix english translation ".
"_batChargeRecmd: consider battery capacity as part of total capacity ",
"1.43.0" => "10.01.2025 graphicShowNight: add possible Time Sync of chart bar level 1 and the other ". "1.43.0" => "10.01.2025 graphicShowNight: add possible Time Sync of chart bar level 1 and the other ".
"_addDynAttr: minor fix for graphicBeamXContent, new attr ctrlNextHoursSoCForecastReadings ", "_addDynAttr: minor fix for graphicBeamXContent, new attr ctrlNextHoursSoCForecastReadings ",
"1.42.0" => "07.01.2025 change socslidereg to batsocslidereg, _batChargeRecmd: add value to nexthours ". "1.42.0" => "07.01.2025 change socslidereg to batsocslidereg, _batChargeRecmd: add value to nexthours ".
@ -9884,23 +9885,25 @@ sub _batChargeRecmd {
next if($err); next if($err);
my $batinstcap = BatteryVal ($hash, $bn, 'binstcap', 0); # installierte Batteriekapazität Wh my $batinstcap = BatteryVal ($hash, $bn, 'binstcap', 0); # installierte Batteriekapazität Wh
my $csoc = BatteryVal ($hash, $bn, 'bcharge', 0); # aktuelle Ladung in %
my $batoptsoc = ReadingsNum ($name, 'Battery_OptimumTargetSoC_'.$bn, 0); # aktueller optimierter SoC
if (!$inplim || !$batinstcap) { if (!$inplim || !$batinstcap) {
debugLog ($paref, 'batteryManagement', "WARNING - The requirements for dynamic battery charge recommendation are not met. Exit."); debugLog ($paref, 'batteryManagement', "WARNING - The requirements for dynamic battery charge recommendation are not met. Exit.");
return; return;
} }
my $cgbt = AttrVal ($name, 'ctrlBatSocManagement'.$bn, undef); my $csoc = BatteryVal ($hash, $bn, 'bcharge', 0); # aktuelle Ladung in %
my $lowSoc = 0; my $batoptsoc = ReadingsNum ($name, 'Battery_OptimumTargetSoC_'.$bn, 0); # aktueller optimierter SoC
my $cgbt = AttrVal ($name, 'ctrlBatSocManagement'.$bn, undef);
my $sf = __batCapShareFactor ($hash, $bn); # Anteilsfaktor der Batterie XX Kapazität an Gesamtkapazität
my $lowSoc = 0;
if ($cgbt) { if ($cgbt) {
($lowSoc) = __parseAttrBatSoc ($name, $cgbt); ($lowSoc) = __parseAttrBatSoc ($name, $cgbt);
} }
debugLog ($paref, 'batteryManagement', "Bat $bn Charge Rcmd - Installed Battery capacity: $batinstcap Wh"); debugLog ($paref, 'batteryManagement', "Bat $bn Charge Rcmd - Installed Battery capacity: $batinstcap Wh, Percentage of total capacity: ".(sprintf "%.1f", $sf*100)." %");
debugLog ($paref, 'batteryManagement', "Bat $bn Charge Rcmd - The PV generation, consumption and surplus listed below are based on the battery's share of the total capacity!");
my $socwh = sprintf "%.0f", ($batinstcap * $csoc / 100); # aktueller SoC in Wh my $socwh = sprintf "%.0f", ($batinstcap * $csoc / 100); # aktueller SoC in Wh
## Auswertung für jede kommende Stunde ## Auswertung für jede kommende Stunde
@ -9919,6 +9922,15 @@ sub _batChargeRecmd {
my $rcmd = 0; # Ladeempfehlung 0 per Default my $rcmd = 0; # Ladeempfehlung 0 per Default
my $spday = 0; my $spday = 0;
## Aufteilung Energie auf Batterie XX im Verhältnis aller Bat
###############################################################
$pvfc = sprintf "%.0f", $sf * $pvfc;
$confcss = sprintf "%.0f", $sf * $confcss;
$confc = sprintf "%.0f", $sf * $confc;
$rodpvfc = sprintf "%.0f", $sf * $rodpvfc;
$tomconfc = sprintf "%.0f", $sf * $tomconfc;
$tompvfc = sprintf "%.0f", $sf * $tompvfc;
## (Rest) PV-Überschuß für den Tag ## (Rest) PV-Überschuß für den Tag
#################################### ####################################
if ($pvfc) { if ($pvfc) {

View File

@ -158,7 +158,8 @@ BEGIN {
# Versions History intern # Versions History intern
my %vNotesIntern = ( my %vNotesIntern = (
"1.43.1" => "11.01.2025 _batChargeRecmd: bugfix PV daily surplus update, _collectAllRegConsumers: fix interruptable hysteresis ". "1.43.1" => "11.01.2025 _batChargeRecmd: bugfix PV daily surplus update, _collectAllRegConsumers: fix interruptable hysteresis ".
"__batRcmdOnBeam: show soc forecast for hour 00 and fix english translation ", "__batRcmdOnBeam: show soc forecast for hour 00 and fix english translation ".
"_batChargeRecmd: consider battery capacity as part of total capacity ",
"1.43.0" => "10.01.2025 graphicShowNight: add possible Time Sync of chart bar level 1 and the other ". "1.43.0" => "10.01.2025 graphicShowNight: add possible Time Sync of chart bar level 1 and the other ".
"_addDynAttr: minor fix for graphicBeamXContent, new attr ctrlNextHoursSoCForecastReadings ", "_addDynAttr: minor fix for graphicBeamXContent, new attr ctrlNextHoursSoCForecastReadings ",
"1.42.0" => "07.01.2025 change socslidereg to batsocslidereg, _batChargeRecmd: add value to nexthours ". "1.42.0" => "07.01.2025 change socslidereg to batsocslidereg, _batChargeRecmd: add value to nexthours ".
@ -9884,23 +9885,25 @@ sub _batChargeRecmd {
next if($err); next if($err);
my $batinstcap = BatteryVal ($hash, $bn, 'binstcap', 0); # installierte Batteriekapazität Wh my $batinstcap = BatteryVal ($hash, $bn, 'binstcap', 0); # installierte Batteriekapazität Wh
my $csoc = BatteryVal ($hash, $bn, 'bcharge', 0); # aktuelle Ladung in %
my $batoptsoc = ReadingsNum ($name, 'Battery_OptimumTargetSoC_'.$bn, 0); # aktueller optimierter SoC
if (!$inplim || !$batinstcap) { if (!$inplim || !$batinstcap) {
debugLog ($paref, 'batteryManagement', "WARNING - The requirements for dynamic battery charge recommendation are not met. Exit."); debugLog ($paref, 'batteryManagement', "WARNING - The requirements for dynamic battery charge recommendation are not met. Exit.");
return; return;
} }
my $cgbt = AttrVal ($name, 'ctrlBatSocManagement'.$bn, undef); my $csoc = BatteryVal ($hash, $bn, 'bcharge', 0); # aktuelle Ladung in %
my $lowSoc = 0; my $batoptsoc = ReadingsNum ($name, 'Battery_OptimumTargetSoC_'.$bn, 0); # aktueller optimierter SoC
my $cgbt = AttrVal ($name, 'ctrlBatSocManagement'.$bn, undef);
my $sf = __batCapShareFactor ($hash, $bn); # Anteilsfaktor der Batterie XX Kapazität an Gesamtkapazität
my $lowSoc = 0;
if ($cgbt) { if ($cgbt) {
($lowSoc) = __parseAttrBatSoc ($name, $cgbt); ($lowSoc) = __parseAttrBatSoc ($name, $cgbt);
} }
debugLog ($paref, 'batteryManagement', "Bat $bn Charge Rcmd - Installed Battery capacity: $batinstcap Wh"); debugLog ($paref, 'batteryManagement', "Bat $bn Charge Rcmd - Installed Battery capacity: $batinstcap Wh, Percentage of total capacity: ".(sprintf "%.1f", $sf*100)." %");
debugLog ($paref, 'batteryManagement', "Bat $bn Charge Rcmd - The PV generation, consumption and surplus listed below are based on the battery's share of the total capacity!");
my $socwh = sprintf "%.0f", ($batinstcap * $csoc / 100); # aktueller SoC in Wh my $socwh = sprintf "%.0f", ($batinstcap * $csoc / 100); # aktueller SoC in Wh
## Auswertung für jede kommende Stunde ## Auswertung für jede kommende Stunde
@ -9919,6 +9922,15 @@ sub _batChargeRecmd {
my $rcmd = 0; # Ladeempfehlung 0 per Default my $rcmd = 0; # Ladeempfehlung 0 per Default
my $spday = 0; my $spday = 0;
## Aufteilung Energie auf Batterie XX im Verhältnis aller Bat
###############################################################
$pvfc = sprintf "%.0f", $sf * $pvfc;
$confcss = sprintf "%.0f", $sf * $confcss;
$confc = sprintf "%.0f", $sf * $confc;
$rodpvfc = sprintf "%.0f", $sf * $rodpvfc;
$tomconfc = sprintf "%.0f", $sf * $tomconfc;
$tompvfc = sprintf "%.0f", $sf * $tompvfc;
## (Rest) PV-Überschuß für den Tag ## (Rest) PV-Überschuß für den Tag
#################################### ####################################
if ($pvfc) { if ($pvfc) {