Unittest includes Home Appliances

This commit is contained in:
Andreas 2024-10-06 14:04:26 +02:00 committed by Andreas
parent fc0ee64521
commit 584ab225f1
2 changed files with 14 additions and 4 deletions

View File

@ -3,7 +3,7 @@ import pytest
from modules.class_akku import PVAkku from modules.class_akku import PVAkku
from modules.class_ems import EnergieManagementSystem from modules.class_ems import EnergieManagementSystem
from modules.class_inverter import Wechselrichter # Example import from modules.class_inverter import Wechselrichter # Example import
from modules.class_haushaltsgeraet import Haushaltsgeraet
prediction_hours = 48 prediction_hours = 48
optimization_hours = 24 optimization_hours = 24
@ -20,7 +20,12 @@ def create_ems_instance():
wechselrichter = Wechselrichter(10000, akku) wechselrichter = Wechselrichter(10000, akku)
# Household device (currently not used, set to None) # Household device (currently not used, set to None)
haushaltsgeraet = None home_appliance = Haushaltsgeraet(
hours=prediction_hours,
verbrauch_kwh=2000,
dauer_h=2,
).set_startzeitpunkt(2)
# Example initialization of electric car battery # Example initialization of electric car battery
eauto = PVAkku(kapazitaet_wh=26400, start_soc_prozent=10, hours=48) eauto = PVAkku(kapazitaet_wh=26400, start_soc_prozent=10, hours=48)
@ -188,7 +193,7 @@ def create_ems_instance():
einspeiseverguetung_euro_pro_wh=einspeiseverguetung_euro_pro_wh, einspeiseverguetung_euro_pro_wh=einspeiseverguetung_euro_pro_wh,
eauto=eauto, eauto=eauto,
gesamtlast=gesamtlast, gesamtlast=gesamtlast,
haushaltsgeraet=haushaltsgeraet, haushaltsgeraet=home_appliance,
wechselrichter=wechselrichter, wechselrichter=wechselrichter,
) )
return ems return ems
@ -308,4 +313,9 @@ def test_simulation(create_ems_instance):
result["akku_soc_pro_stunde"][1] == 0.0 result["akku_soc_pro_stunde"][1] == 0.0
), "The value at index 1 of 'akku_soc_pro_stunde' should be 0.0." ), "The value at index 1 of 'akku_soc_pro_stunde' should be 0.0."
# Check home appliances
assert (
sum(result["Haushaltsgeraet_wh_pro_stunde"]) == 2000
), "The value at index -1 of 'Haushaltsgeraet_wh_pro_stunde' should be 2000."
print("All tests passed successfully.") print("All tests passed successfully.")

BIN
visualization_results.pdf Normal file

Binary file not shown.