mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 00:45:22 +00:00
PreCommit Fixed
This commit is contained in:
parent
c47f071f55
commit
cfbe7130e7
@ -5,7 +5,6 @@ from akkudoktoreos.class_akku import PVAkku
|
||||
from akkudoktoreos.class_ems import EnergieManagementSystem
|
||||
from akkudoktoreos.class_haushaltsgeraet import Haushaltsgeraet
|
||||
from akkudoktoreos.class_inverter import Wechselrichter # Example import
|
||||
from akkudoktoreos.visualize import *
|
||||
|
||||
prediction_hours = 48
|
||||
optimization_hours = 24
|
||||
@ -33,7 +32,7 @@ def create_ems_instance():
|
||||
|
||||
# Example initialization of electric car battery
|
||||
eauto = PVAkku(kapazitaet_wh=26400, start_soc_prozent=10, hours=48, min_soc_prozent=10)
|
||||
eauto.set_charge_per_hour(np.full(48,1))
|
||||
eauto.set_charge_per_hour(np.full(48, 1))
|
||||
# Parameters based on previous example data
|
||||
pv_prognose_wh = [
|
||||
0,
|
||||
@ -201,8 +200,6 @@ def create_ems_instance():
|
||||
wechselrichter=wechselrichter,
|
||||
)
|
||||
|
||||
|
||||
|
||||
return ems
|
||||
|
||||
|
||||
@ -314,7 +311,7 @@ def test_simulation(create_ems_instance):
|
||||
|
||||
# Check the losses
|
||||
assert (
|
||||
abs(result["Gesamt_Verluste"] - 2615.222727272727 ) < 1e-5
|
||||
abs(result["Gesamt_Verluste"] - 2615.222727272727) < 1e-5
|
||||
), "Total losses should be 2615.222727272727 ."
|
||||
|
||||
# Check the values in 'akku_soc_pro_stunde'
|
||||
|
@ -1,6 +1,5 @@
|
||||
import numpy as np
|
||||
import pytest
|
||||
from akkudoktoreos.visualize import *
|
||||
|
||||
from akkudoktoreos.class_akku import PVAkku
|
||||
from akkudoktoreos.class_ems import EnergieManagementSystem
|
||||
@ -38,12 +37,11 @@ def create_ems_instance():
|
||||
pv_prognose_wh = np.full(prediction_hours, 0)
|
||||
pv_prognose_wh[10] = 5000.0
|
||||
pv_prognose_wh[11] = 5000.0
|
||||
|
||||
|
||||
strompreis_euro_pro_wh = np.full(48, 0.001)
|
||||
strompreis_euro_pro_wh [0:10] = 0.00001
|
||||
strompreis_euro_pro_wh [11:15] = 0.00005
|
||||
strompreis_euro_pro_wh [20] = 0.00001
|
||||
strompreis_euro_pro_wh[0:10] = 0.00001
|
||||
strompreis_euro_pro_wh[11:15] = 0.00005
|
||||
strompreis_euro_pro_wh[20] = 0.00001
|
||||
|
||||
einspeiseverguetung_euro_pro_wh = [0.00007] * len(strompreis_euro_pro_wh)
|
||||
|
||||
@ -109,11 +107,10 @@ def create_ems_instance():
|
||||
wechselrichter=wechselrichter,
|
||||
)
|
||||
|
||||
|
||||
ac= np.full(prediction_hours,0)
|
||||
ac = np.full(prediction_hours, 0)
|
||||
ac[20] = 1
|
||||
ems.set_akku_ac_charge_hours(ac)
|
||||
dc= np.full(prediction_hours,0)
|
||||
dc = np.full(prediction_hours, 0)
|
||||
dc[11] = 1
|
||||
ems.set_akku_dc_charge_hours(dc)
|
||||
|
||||
@ -196,29 +193,27 @@ def test_simulation(create_ems_instance):
|
||||
len(result["akku_soc_pro_stunde"]) == 48
|
||||
), "The length of 'akku_soc_pro_stunde' should be 48."
|
||||
|
||||
# Verfify DC and AC Charge Bins
|
||||
# Verfify DC and AC Charge Bins
|
||||
assert (
|
||||
abs(result["akku_soc_pro_stunde"][10] - 10.0) < 1e-5
|
||||
), "'akku_soc_pro_stunde[10]' should be 10."
|
||||
), "'akku_soc_pro_stunde[10]' should be 10."
|
||||
assert (
|
||||
abs(result["akku_soc_pro_stunde"][11] -79.275184) < 1e-5
|
||||
), "'akku_soc_pro_stunde[11]' should be 79.275184."
|
||||
abs(result["akku_soc_pro_stunde"][11] - 79.275184) < 1e-5
|
||||
), "'akku_soc_pro_stunde[11]' should be 79.275184."
|
||||
|
||||
assert (
|
||||
abs(result["Netzeinspeisung_Wh_pro_Stunde"][10] - 3946.93) < 1e-3
|
||||
), "'Netzeinspeisung_Wh_pro_Stunde[11]' should be 4000."
|
||||
), "'Netzeinspeisung_Wh_pro_Stunde[11]' should be 4000."
|
||||
|
||||
assert (
|
||||
abs(result["Netzeinspeisung_Wh_pro_Stunde"][11] - 0.0) < 1e-3
|
||||
), "'Netzeinspeisung_Wh_pro_Stunde[11]' should be 0.0."
|
||||
), "'Netzeinspeisung_Wh_pro_Stunde[11]' should be 0.0."
|
||||
|
||||
assert (
|
||||
abs(result["akku_soc_pro_stunde"][20] - 98
|
||||
) < 1e-5
|
||||
), "'akku_soc_pro_stunde[11]' should be 98."
|
||||
abs(result["akku_soc_pro_stunde"][20] - 98) < 1e-5
|
||||
), "'akku_soc_pro_stunde[11]' should be 98."
|
||||
assert (
|
||||
abs(result["Last_Wh_pro_Stunde"][20] - 5450.98) < 1e-3
|
||||
), "'Netzeinspeisung_Wh_pro_Stunde[11]' should be 0.0."
|
||||
|
||||
), "'Netzeinspeisung_Wh_pro_Stunde[11]' should be 0.0."
|
||||
|
||||
print("All tests passed successfully.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user