mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
76_SolarForecast: optimize battery management once more
git-svn-id: https://svn.fhem.de/fhem/trunk@28353 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
53e312a28e
commit
638eb1bd55
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- change: 76_SolarForecast: optimize battery management once more
|
||||||
- change: 76_SolarForecast: optimize batterymanagement
|
- change: 76_SolarForecast: optimize batterymanagement
|
||||||
- change: 93_DbLog: minor change of configCheck
|
- change: 93_DbLog: minor change of configCheck
|
||||||
- feature: 76_SolarForecast: externally caused switching of consumers is
|
- feature: 76_SolarForecast: externally caused switching of consumers is
|
||||||
|
@ -155,6 +155,7 @@ BEGIN {
|
|||||||
|
|
||||||
# Versions History intern
|
# Versions History intern
|
||||||
my %vNotesIntern = (
|
my %vNotesIntern = (
|
||||||
|
"1.6.3" => "08.01.2024 optimize battery management once more ",
|
||||||
"1.6.2" => "07.01.2024 optimize battery management ",
|
"1.6.2" => "07.01.2024 optimize battery management ",
|
||||||
"1.6.1" => "04.01.2024 new sub __setPhysSwState, edit ___setConsumerPlanningState, boost performance of collectAllRegConsumers ".
|
"1.6.1" => "04.01.2024 new sub __setPhysSwState, edit ___setConsumerPlanningState, boost performance of collectAllRegConsumers ".
|
||||||
"CurrentVal ctrunning - Central Task running Statusbit, edit comref ",
|
"CurrentVal ctrunning - Central Task running Statusbit, edit comref ",
|
||||||
@ -6301,6 +6302,31 @@ sub _batSocTarget {
|
|||||||
|
|
||||||
debugLog ($paref, 'batteryManagement', "SoC calc Step1 - compare with SoC history -> Target: $target %");
|
debugLog ($paref, 'batteryManagement', "SoC calc Step1 - compare with SoC history -> Target: $target %");
|
||||||
|
|
||||||
|
## Pflege-SoC (Soll SoC $maxSoCdef bei $batSocChgDay % Steigerung p. Tag)
|
||||||
|
###########################################################################
|
||||||
|
my $sunset = CurrentVal ($hash, 'sunsetTodayTs', $t);
|
||||||
|
my $delayts = $sunset - 5400; # Pflege-SoC/Erhöhung SoC erst ab 1,5 h vor Sonnenuntergang berechnen/anwenden
|
||||||
|
my $la = '';
|
||||||
|
|
||||||
|
if ($t > $delayts) {
|
||||||
|
my $ntsmsc = CircularVal ($hash, 99, 'nextTsMaxSocChge', $t);
|
||||||
|
my $days2care = ceil (($ntsmsc - $t) / 86400); # verbleibende Tage bis der Batterie Pflege-SoC (default 95%) erreicht sein soll
|
||||||
|
|
||||||
|
$paref->{days2care} = $days2care;
|
||||||
|
__batSaveSocKeyFigures ($paref);
|
||||||
|
delete $paref->{days2care};
|
||||||
|
|
||||||
|
my $careSoc = $maxsoc - ($days2care * $batSocChgDay); # Pflege-SoC um rechtzeitig den $maxsoc zu erreichen bei 5% Steigerung pro Tag
|
||||||
|
$target = $careSoc < $target ? $target : $careSoc; # resultierender Target-SoC unter Berücksichtigung $caresoc
|
||||||
|
$la = "note remaining days until care SoC ($days2care days) -> Target: $target %";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$nt = (timestampToTimestring ($delayts, $paref->{lang}))[0];
|
||||||
|
$la = "note remaining days until care SoC -> calculation & activation postponed to after $nt";
|
||||||
|
}
|
||||||
|
|
||||||
|
debugLog ($paref, 'batteryManagement', "SoC calc Step2 - $la");
|
||||||
|
|
||||||
## Aufladewahrscheinlichkeit beachten
|
## Aufladewahrscheinlichkeit beachten
|
||||||
#######################################
|
#######################################
|
||||||
my $pvfctm = ReadingsNum ($name, 'Tomorrow_PVforecast', 0); # PV Prognose morgen
|
my $pvfctm = ReadingsNum ($name, 'Tomorrow_PVforecast', 0); # PV Prognose morgen
|
||||||
@ -6311,12 +6337,10 @@ sub _batSocTarget {
|
|||||||
my $batinstcap = CurrentVal ($hash, 'batinstcap', 0); # installierte Batteriekapazität Wh
|
my $batinstcap = CurrentVal ($hash, 'batinstcap', 0); # installierte Batteriekapazität Wh
|
||||||
my $needcharge = $batinstcap - ($batinstcap / 100 * $batcharge); # vorläufige benötigte Ladeenergie (Wh) bis 100% SOC
|
my $needcharge = $batinstcap - ($batinstcap / 100 * $batcharge); # vorläufige benötigte Ladeenergie (Wh) bis 100% SOC
|
||||||
my $cancharge = $pvexpect > $needcharge ? $pvexpect : $needcharge; # resultierende benötigte Ladeenergie (Wh)
|
my $cancharge = $pvexpect > $needcharge ? $pvexpect : $needcharge; # resultierende benötigte Ladeenergie (Wh)
|
||||||
my $cantarget = 100 - ($cancharge / ($batinstcap / 100)); # berechneter möglicher Min SOC nach Berücksichtigung Ladewahrscheinlichkeit
|
my $cantarget = 100 - (100 / $batinstcap) * $cancharge; # berechneter möglicher Min SOC nach Berücksichtigung Ladewahrscheinlichkeit
|
||||||
|
|
||||||
my $newtarget = $cantarget < $target ? $cantarget : $target; # Abgleich möglicher Min SOC gg. berechneten Min SOC
|
my $newtarget = sprintf "%.0f", ($cantarget < $target ? $cantarget : $target); # Abgleich möglicher Min SOC gg. berechneten Min SOC
|
||||||
my $logadd = '';
|
my $logadd = '';
|
||||||
my $sunset = CurrentVal ($hash, 'sunsetTodayTs', $t);
|
|
||||||
my $delayts = $sunset - 5400; # Pflege-SoC/Erhöhung SoC erst ab 1,5 h vor Sonnenuntergang berechnen/anwenden
|
|
||||||
|
|
||||||
if ($newtarget > $csopt && $t > $delayts) { # Erhöhung des SoC erst ab Sonnenuntergang anwenden
|
if ($newtarget > $csopt && $t > $delayts) { # Erhöhung des SoC erst ab Sonnenuntergang anwenden
|
||||||
$target = $newtarget;
|
$target = $newtarget;
|
||||||
@ -6329,14 +6353,14 @@ sub _batSocTarget {
|
|||||||
}
|
}
|
||||||
elsif ($newtarget < $csopt) { # Targetminderung sofort umsetzen -> Freiplatz für Ladeprognose
|
elsif ($newtarget < $csopt) { # Targetminderung sofort umsetzen -> Freiplatz für Ladeprognose
|
||||||
$target = $newtarget;
|
$target = $newtarget;
|
||||||
$logadd = "(new target < $csopt)";
|
$logadd = "(new target < current Target SoC $csopt)";
|
||||||
}
|
}
|
||||||
else { # bisheriges Optimum bleibt
|
else { # bisheriges Optimum bleibt
|
||||||
$target = $newtarget;
|
$target = $newtarget;
|
||||||
$logadd = "(no change)";
|
$logadd = "(no change)";
|
||||||
}
|
}
|
||||||
|
|
||||||
debugLog ($paref, 'batteryManagement', "SoC calc Step2 - note charging probability -> Target: $target % ".$logadd);
|
debugLog ($paref, 'batteryManagement', "SoC calc Step3 - note charging probability -> Target: $target % ".$logadd);
|
||||||
|
|
||||||
## low/up-Grenzen beachten
|
## low/up-Grenzen beachten
|
||||||
############################
|
############################
|
||||||
@ -6344,27 +6368,7 @@ sub _batSocTarget {
|
|||||||
$target < $lowSoc ? $lowSoc :
|
$target < $lowSoc ? $lowSoc :
|
||||||
$target;
|
$target;
|
||||||
|
|
||||||
debugLog ($paref, 'batteryManagement', "SoC calc Step3 - observe low/up limits -> Target: $target %");
|
debugLog ($paref, 'batteryManagement', "SoC calc Step4 - observe low/up limits -> Target: $target %");
|
||||||
|
|
||||||
## Pflege-SoC (Soll SoC $maxSoCdef bei $batSocChgDay % Steigerung p. Tag)
|
|
||||||
###########################################################################
|
|
||||||
if ($t > $delayts) {
|
|
||||||
my $ntsmsc = CircularVal ($hash, 99, 'nextTsMaxSocChge', $t);
|
|
||||||
my $days2care = ceil (($ntsmsc - $t) / 86400); # verbleibende Tage bis der Batterie Pflege-SoC (default 95%) erreicht sein soll
|
|
||||||
|
|
||||||
$paref->{days2care} = $days2care;
|
|
||||||
__batSaveSocKeyFigures ($paref);
|
|
||||||
delete $paref->{days2care};
|
|
||||||
|
|
||||||
my $careSoc = $maxsoc - ($days2care * $batSocChgDay); # Pflege-SoC um rechtzeitig den $maxsoc zu erreichen bei 5% Steigerung pro Tag
|
|
||||||
$target = $careSoc < $target ? $target : $careSoc; # resultierender Target-SoC unter Berücksichtigung $caresoc
|
|
||||||
|
|
||||||
debugLog ($paref, 'batteryManagement', "SoC calc Step4 - note remaining days >$days2care< until care SoC -> Target: $target %");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$nt = (timestampToTimestring ($delayts, $paref->{lang}))[0];
|
|
||||||
debugLog ($paref, 'batteryManagement', "SoC calc Step4 - calculation & activation of the care SoC postponed to after $nt");
|
|
||||||
}
|
|
||||||
|
|
||||||
## auf 5er Schritte anpassen (40,45,50,...)
|
## auf 5er Schritte anpassen (40,45,50,...)
|
||||||
#############################################
|
#############################################
|
||||||
@ -6381,7 +6385,7 @@ sub _batSocTarget {
|
|||||||
$chargereq = 1;
|
$chargereq = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
debugLog ($paref, 'batteryManagement', "SoC calc Step6 - (final step) forced charging request: ".
|
debugLog ($paref, 'batteryManagement', "SoC calc Step6 - force charging request: ".
|
||||||
($chargereq ? 'yes (battery charge is below minimum SoC)' : 'no (sufficient battery charge)'));
|
($chargereq ? 'yes (battery charge is below minimum SoC)' : 'no (sufficient battery charge)'));
|
||||||
|
|
||||||
## pvHistory/Readings schreiben
|
## pvHistory/Readings schreiben
|
||||||
|
Loading…
x
Reference in New Issue
Block a user