mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-12-14 07:46:18 +00:00
Apply isort and ruff code style
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import numpy as np
|
||||
|
||||
|
||||
class Haushaltsgeraet:
|
||||
def __init__(self, hours=None, verbrauch_kwh=None, dauer_h=None):
|
||||
self.hours = hours # Total duration for which the planning is done
|
||||
self.verbrauch_kwh = verbrauch_kwh # Total energy consumption of the device in kWh
|
||||
self.verbrauch_kwh = (
|
||||
verbrauch_kwh # Total energy consumption of the device in kWh
|
||||
)
|
||||
self.dauer_h = dauer_h # Duration of use in hours
|
||||
self.lastkurve = np.zeros(self.hours) # Initialize the load curve with zeros
|
||||
|
||||
@@ -13,18 +16,18 @@ class Haushaltsgeraet:
|
||||
:param start_hour: The hour at which the device should start.
|
||||
"""
|
||||
self.reset()
|
||||
|
||||
|
||||
# Check if the duration of use is within the available time frame
|
||||
if start_hour + self.dauer_h > self.hours:
|
||||
raise ValueError("The duration of use exceeds the available time frame.")
|
||||
if start_hour < global_start_hour:
|
||||
raise ValueError("The start time is earlier than the available time frame.")
|
||||
|
||||
|
||||
# Calculate power per hour based on total consumption and duration
|
||||
leistung_pro_stunde = (self.verbrauch_kwh / self.dauer_h) # Convert to watt-hours
|
||||
|
||||
leistung_pro_stunde = self.verbrauch_kwh / self.dauer_h # Convert to watt-hours
|
||||
|
||||
# Set the power for the duration of use in the load curve array
|
||||
self.lastkurve[start_hour:start_hour + self.dauer_h] = leistung_pro_stunde
|
||||
self.lastkurve[start_hour : start_hour + self.dauer_h] = leistung_pro_stunde
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
@@ -46,7 +49,7 @@ class Haushaltsgeraet:
|
||||
"""
|
||||
if hour < 0 or hour >= self.hours:
|
||||
raise ValueError("The specified hour is outside the available time frame.")
|
||||
|
||||
|
||||
return self.lastkurve[hour]
|
||||
|
||||
def spaetestmoeglicher_startzeitpunkt(self):
|
||||
|
||||
Reference in New Issue
Block a user