mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 08:55:15 +00:00
Pre Commit
This commit is contained in:
parent
9b7817e3dc
commit
e61a89cff6
@ -361,7 +361,9 @@ parameter = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Initialize the optimization problem
|
# Initialize the optimization problem
|
||||||
opt_class = optimization_problem(prediction_hours=48, strafe=10, optimization_hours=24, verbose=True)
|
opt_class = optimization_problem(
|
||||||
|
prediction_hours=48, strafe=10, optimization_hours=24, verbose=True
|
||||||
|
)
|
||||||
|
|
||||||
# Perform the optimisation based on the provided parameters and start hour
|
# Perform the optimisation based on the provided parameters and start hour
|
||||||
ergebnis = opt_class.optimierung_ems(parameter=parameter, start_hour=start_hour)
|
ergebnis = opt_class.optimierung_ems(parameter=parameter, start_hour=start_hour)
|
||||||
|
@ -2,12 +2,14 @@ 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_haushaltsgeraet import Haushaltsgeraet
|
from modules.class_haushaltsgeraet import Haushaltsgeraet
|
||||||
|
from modules.class_inverter import Wechselrichter # Example import
|
||||||
|
|
||||||
prediction_hours = 48
|
prediction_hours = 48
|
||||||
optimization_hours = 24
|
optimization_hours = 24
|
||||||
start_hour = 1
|
start_hour = 1
|
||||||
|
|
||||||
|
|
||||||
# Example initialization of necessary components
|
# Example initialization of necessary components
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def create_ems_instance():
|
def create_ems_instance():
|
||||||
@ -21,10 +23,10 @@ def create_ems_instance():
|
|||||||
|
|
||||||
# Household device (currently not used, set to None)
|
# Household device (currently not used, set to None)
|
||||||
home_appliance = Haushaltsgeraet(
|
home_appliance = Haushaltsgeraet(
|
||||||
hours=prediction_hours,
|
hours=prediction_hours,
|
||||||
verbrauch_wh=2000,
|
verbrauch_wh=2000,
|
||||||
dauer_h=2,
|
dauer_h=2,
|
||||||
)
|
)
|
||||||
home_appliance.set_startzeitpunkt(2)
|
home_appliance.set_startzeitpunkt(2)
|
||||||
|
|
||||||
# Example initialization of electric car battery
|
# Example initialization of electric car battery
|
||||||
@ -297,7 +299,7 @@ def test_simulation(create_ems_instance):
|
|||||||
abs(result["Gesamteinnahmen_Euro"] - 1.237432954545454) < 1e-5
|
abs(result["Gesamteinnahmen_Euro"] - 1.237432954545454) < 1e-5
|
||||||
), "Total revenue should be 1.237432954545454."
|
), "Total revenue should be 1.237432954545454."
|
||||||
assert (
|
assert (
|
||||||
abs(result["Gesamtkosten_Euro"] - 10.329075084000001 ) < 1e-5
|
abs(result["Gesamtkosten_Euro"] - 10.329075084000001) < 1e-5
|
||||||
), "Total costs should be 10.329075084000001 ."
|
), "Total costs should be 10.329075084000001 ."
|
||||||
|
|
||||||
# Check the losses
|
# Check the losses
|
||||||
@ -322,5 +324,4 @@ def test_simulation(create_ems_instance):
|
|||||||
sum(result["Haushaltsgeraet_wh_pro_stunde"]) == 2000
|
sum(result["Haushaltsgeraet_wh_pro_stunde"]) == 2000
|
||||||
), "The sum of 'Haushaltsgeraet_wh_pro_stunde' should be 2000."
|
), "The sum of 'Haushaltsgeraet_wh_pro_stunde' should be 2000."
|
||||||
|
|
||||||
|
|
||||||
print("All tests passed successfully.")
|
print("All tests passed successfully.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user