Skip to content

Commit

Permalink
Revert "better performance self consumption Akkudoktor-EOS#272"
Browse files Browse the repository at this point in the history
This reverts commit bc1637c.
  • Loading branch information
redmoon2711 committed Jan 1, 2025
1 parent a6ad053 commit 06944a2
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/akkudoktoreos/devices/inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 06944a2

Please sign in to comment.