- Home Appliances fixed

- Unittest with Home Appliances
This commit is contained in:
Andreas
2024-10-06 14:29:23 +02:00
committed by Andreas
parent 584ab225f1
commit cc270e71bc
6 changed files with 34 additions and 27 deletions

View File

@@ -96,9 +96,11 @@ class EnergieManagementSystem:
# Accumulate loads and PV generation
verbrauch = self.gesamtlast[stunde]
if self.haushaltsgeraet:
verbrauch += self.haushaltsgeraet.get_last_fuer_stunde(stunde)
haushaltsgeraet_wh_pro_stunde[stunde_since_now] = verbrauch
ha_load = self.haushaltsgeraet.get_last_fuer_stunde(stunde)
verbrauch += ha_load
haushaltsgeraet_wh_pro_stunde[stunde_since_now] = ha_load
# E-Auto handling
if self.eauto:

View File

@@ -2,10 +2,10 @@ import numpy as np
class Haushaltsgeraet:
def __init__(self, hours=None, verbrauch_kwh=None, dauer_h=None):
def __init__(self, hours=None, verbrauch_wh=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_wh = (
verbrauch_wh # 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
@@ -24,7 +24,7 @@ class Haushaltsgeraet:
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_wh / 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

View File

@@ -288,9 +288,9 @@ class optimization_problem:
spuelmaschine = (
Haushaltsgeraet(
hours=self.prediction_hours,
verbrauch_kwh=parameter["haushaltsgeraet_wh"],
verbrauch_wh=parameter["haushaltsgeraet_wh"],
dauer_h=parameter["haushaltsgeraet_dauer"],
).set_startzeitpunkt(start_hour)
)
if parameter["haushaltsgeraet_dauer"] > 0
else None
)