From 06944a21eca4ab19db2da32eee8fb0caee18a6bf Mon Sep 17 00:00:00 2001 From: redmoon2711 Date: Wed, 1 Jan 2025 23:08:48 +0100 Subject: [PATCH] Revert "better performance self consumption #272" This reverts commit bc1637c237cd97889d28117d52fcdc11d4d90592. --- src/akkudoktoreos/devices/inverter.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/akkudoktoreos/devices/inverter.py b/src/akkudoktoreos/devices/inverter.py index db2f5c93..eb0bf303 100644 --- a/src/akkudoktoreos/devices/inverter.py +++ b/src/akkudoktoreos/devices/inverter.py @@ -22,19 +22,6 @@ def __init__( ) self.akku = akku # Connection to a battery object self.self_consumption_predictor = self_consumption_predictor - self.scr_lookup: dict = {} - - def calculate_scr(self, erzeugung: float, verbrauch: float) -> float: - """Check if the consumption and production is in the lookup table. If not, calculate and store the value.""" - if verbrauch not in self.scr_lookup: - self.scr_lookup[verbrauch] = {} - - if erzeugung not in self.scr_lookup[verbrauch]: - scr = self.self_consumption_predictor.calculate_self_consumption(verbrauch, erzeugung) - self.scr_lookup[verbrauch][erzeugung] = scr - return scr - - return self.scr_lookup[verbrauch][erzeugung] def energie_verarbeiten( self, erzeugung: float, verbrauch: float, hour: int @@ -52,7 +39,9 @@ def energie_verarbeiten( netzbezug = -restleistung_nach_verbrauch # Negative indicates feeding into the grid eigenverbrauch = self.max_leistung_wh else: - scr = self.calculate_scr(erzeugung, verbrauch) + scr = self.self_consumption_predictor.calculate_self_consumption( + verbrauch, erzeugung + ) # Remaining power after consumption restleistung_nach_verbrauch = (erzeugung - verbrauch) * scr # EVQ