mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 08:55:15 +00:00
Unittest includes Home Appliances
This commit is contained in:
parent
fc0ee64521
commit
584ab225f1
@ -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
|
||||||
@ -203,7 +208,7 @@ def test_simulation(create_ems_instance):
|
|||||||
# Simulate starting from hour 1 (this value can be adjusted)
|
# Simulate starting from hour 1 (this value can be adjusted)
|
||||||
start_hour = 1
|
start_hour = 1
|
||||||
result = ems.simuliere(start_stunde=start_hour)
|
result = ems.simuliere(start_stunde=start_hour)
|
||||||
|
|
||||||
# Assertions to validate results
|
# Assertions to validate results
|
||||||
assert result is not None, "Result should not be None"
|
assert result is not None, "Result should not be None"
|
||||||
assert isinstance(result, dict), "Result should be a dictionary"
|
assert isinstance(result, dict), "Result should be a dictionary"
|
||||||
@ -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
BIN
visualization_results.pdf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user