From 34bcd4869aea226ccef2a9081bcccc059543a8e9 Mon Sep 17 00:00:00 2001
From: Normann <github@koldrack.com>
Date: Wed, 15 Jan 2025 22:02:20 +0100
Subject: [PATCH] Propability->Probability

---
 src/akkudoktoreos/devices/devices.py         |   4 +-
 src/akkudoktoreos/optimization/genetic.py    |   4 +-
 src/akkudoktoreos/prediction/interpolator.py |   2 +-
 tests/test_class_ems.py                      | 100 +++++++++----------
 tests/test_class_ems_2.py                    |  76 +++++++-------
 5 files changed, 93 insertions(+), 93 deletions(-)

diff --git a/src/akkudoktoreos/devices/devices.py b/src/akkudoktoreos/devices/devices.py
index 3dc619bf..19b4f7b5 100644
--- a/src/akkudoktoreos/devices/devices.py
+++ b/src/akkudoktoreos/devices/devices.py
@@ -11,7 +11,7 @@
 from akkudoktoreos.devices.devicesabc import DevicesBase
 from akkudoktoreos.devices.generic import HomeAppliance
 from akkudoktoreos.devices.inverter import Inverter
-from akkudoktoreos.prediction.interpolator import SelfConsumptionPropabilityInterpolator
+from akkudoktoreos.prediction.interpolator import SelfConsumptionProbabilityInterpolator
 from akkudoktoreos.utils.datetimeutil import to_duration
 
 logger = get_logger(__name__)
@@ -164,7 +164,7 @@ def total_losses_wh(self) -> float:
     ev: ClassVar[Battery] = Battery(provider_id="GenericBEV")
     home_appliance: ClassVar[HomeAppliance] = HomeAppliance(provider_id="GenericDishWasher")
     inverter: ClassVar[Inverter] = Inverter(
-        self_consumption_predictor=SelfConsumptionPropabilityInterpolator,
+        self_consumption_predictor=SelfConsumptionProbabilityInterpolator,
         battery=battery,
         provider_id="GenericInverter",
     )
diff --git a/src/akkudoktoreos/optimization/genetic.py b/src/akkudoktoreos/optimization/genetic.py
index 0e43c10a..aedf8284 100644
--- a/src/akkudoktoreos/optimization/genetic.py
+++ b/src/akkudoktoreos/optimization/genetic.py
@@ -25,7 +25,7 @@
 )
 from akkudoktoreos.devices.generic import HomeAppliance, HomeApplianceParameters
 from akkudoktoreos.devices.inverter import Inverter, InverterParameters
-from akkudoktoreos.prediction.interpolator import SelfConsumptionPropabilityInterpolator
+from akkudoktoreos.prediction.interpolator import SelfConsumptionProbabilityInterpolator
 from akkudoktoreos.utils.utils import NumpyEncoder
 
 logger = get_logger(__name__)
@@ -573,7 +573,7 @@ def optimierung_ems(
         )
 
         # 1h Load to Sub 1h Load Distribution -> SelfConsumptionRate
-        sc = SelfConsumptionPropabilityInterpolator(
+        sc = SelfConsumptionProbabilityInterpolator(
             Path(__file__).parent.resolve() / ".." / "data" / "regular_grid_interpolator.pkl"
         )
 
diff --git a/src/akkudoktoreos/prediction/interpolator.py b/src/akkudoktoreos/prediction/interpolator.py
index b2d460b0..a881e68f 100644
--- a/src/akkudoktoreos/prediction/interpolator.py
+++ b/src/akkudoktoreos/prediction/interpolator.py
@@ -7,7 +7,7 @@
 from scipy.interpolate import RegularGridInterpolator
 
 
-class SelfConsumptionPropabilityInterpolator:
+class SelfConsumptionProbabilityInterpolator:
     def __init__(self, filepath: str | Path):
         self.filepath = filepath
         # Load the RegularGridInterpolator
diff --git a/tests/test_class_ems.py b/tests/test_class_ems.py
index 1a32d4ca..04a12906 100644
--- a/tests/test_class_ems.py
+++ b/tests/test_class_ems.py
@@ -16,7 +16,7 @@
 )
 from akkudoktoreos.devices.generic import HomeAppliance, HomeApplianceParameters
 from akkudoktoreos.devices.inverter import Inverter, InverterParameters
-from akkudoktoreos.prediction.interpolator import SelfConsumptionPropabilityInterpolator
+from akkudoktoreos.prediction.interpolator import SelfConsumptionProbabilityInterpolator
 
 start_hour = 1
 
@@ -38,7 +38,7 @@ def create_ems_instance(config_eos) -> EnergieManagementSystem:
     )
 
     # 1h Load to Sub 1h Load Distribution -> SelfConsumptionRate
-    sc = SelfConsumptionPropabilityInterpolator(
+    sc = SelfConsumptionProbabilityInterpolator(
         Path(__file__).parent.resolve()
         / ".."
         / "src"
@@ -283,69 +283,69 @@ def test_simulation(create_ems_instance):
     assert SimulationResult(**result) is not None
 
     # Check the length of the main arrays
-    assert (
-        len(result["Last_Wh_pro_Stunde"]) == 47
-    ), "The length of 'Last_Wh_pro_Stunde' should be 48."
-    assert (
-        len(result["Netzeinspeisung_Wh_pro_Stunde"]) == 47
-    ), "The length of 'Netzeinspeisung_Wh_pro_Stunde' should be 48."
-    assert (
-        len(result["Netzbezug_Wh_pro_Stunde"]) == 47
-    ), "The length of 'Netzbezug_Wh_pro_Stunde' should be 48."
-    assert (
-        len(result["Kosten_Euro_pro_Stunde"]) == 47
-    ), "The length of 'Kosten_Euro_pro_Stunde' should be 48."
-    assert (
-        len(result["akku_soc_pro_stunde"]) == 47
-    ), "The length of 'akku_soc_pro_stunde' should be 48."
+    assert len(result["Last_Wh_pro_Stunde"]) == 47, (
+        "The length of 'Last_Wh_pro_Stunde' should be 48."
+    )
+    assert len(result["Netzeinspeisung_Wh_pro_Stunde"]) == 47, (
+        "The length of 'Netzeinspeisung_Wh_pro_Stunde' should be 48."
+    )
+    assert len(result["Netzbezug_Wh_pro_Stunde"]) == 47, (
+        "The length of 'Netzbezug_Wh_pro_Stunde' should be 48."
+    )
+    assert len(result["Kosten_Euro_pro_Stunde"]) == 47, (
+        "The length of 'Kosten_Euro_pro_Stunde' should be 48."
+    )
+    assert len(result["akku_soc_pro_stunde"]) == 47, (
+        "The length of 'akku_soc_pro_stunde' should be 48."
+    )
 
     # Verify specific values in the 'Last_Wh_pro_Stunde' array
-    assert (
-        result["Last_Wh_pro_Stunde"][1] == 1527.13
-    ), "The value at index 1 of 'Last_Wh_pro_Stunde' should be 1527.13."
-    assert (
-        result["Last_Wh_pro_Stunde"][2] == 1468.88
-    ), "The value at index 2 of 'Last_Wh_pro_Stunde' should be 1468.88."
-    assert (
-        result["Last_Wh_pro_Stunde"][12] == 1132.03
-    ), "The value at index 12 of 'Last_Wh_pro_Stunde' should be 1132.03."
+    assert result["Last_Wh_pro_Stunde"][1] == 1527.13, (
+        "The value at index 1 of 'Last_Wh_pro_Stunde' should be 1527.13."
+    )
+    assert result["Last_Wh_pro_Stunde"][2] == 1468.88, (
+        "The value at index 2 of 'Last_Wh_pro_Stunde' should be 1468.88."
+    )
+    assert result["Last_Wh_pro_Stunde"][12] == 1132.03, (
+        "The value at index 12 of 'Last_Wh_pro_Stunde' should be 1132.03."
+    )
 
     # Verify that the value at index 0 is 'None'
     # Check that 'Netzeinspeisung_Wh_pro_Stunde' and 'Netzbezug_Wh_pro_Stunde' are consistent
-    assert (
-        result["Netzbezug_Wh_pro_Stunde"][1] == 0
-    ), "The value at index 1 of 'Netzbezug_Wh_pro_Stunde' should be 0."
+    assert result["Netzbezug_Wh_pro_Stunde"][1] == 0, (
+        "The value at index 1 of 'Netzbezug_Wh_pro_Stunde' should be 0."
+    )
 
     # Verify the total balance
-    assert (
-        abs(result["Gesamtbilanz_Euro"] - 1.958185274567674) < 1e-5
-    ), "Total balance should be 1.958185274567674."
+    assert abs(result["Gesamtbilanz_Euro"] - 1.958185274567674) < 1e-5, (
+        "Total balance should be 1.958185274567674."
+    )
 
     # Check total revenue and total costs
-    assert (
-        abs(result["Gesamteinnahmen_Euro"] - 1.168863124510214) < 1e-5
-    ), "Total revenue should be 1.168863124510214."
-    assert (
-        abs(result["Gesamtkosten_Euro"] - 3.127048399077888) < 1e-5
-    ), "Total costs should be 3.127048399077888 ."
+    assert abs(result["Gesamteinnahmen_Euro"] - 1.168863124510214) < 1e-5, (
+        "Total revenue should be 1.168863124510214."
+    )
+    assert abs(result["Gesamtkosten_Euro"] - 3.127048399077888) < 1e-5, (
+        "Total costs should be 3.127048399077888 ."
+    )
 
     # Check the losses
-    assert (
-        abs(result["Gesamt_Verluste"] - 2871.5330639359036) < 1e-5
-    ), "Total losses should be 2871.5330639359036 ."
+    assert abs(result["Gesamt_Verluste"] - 2871.5330639359036) < 1e-5, (
+        "Total losses should be 2871.5330639359036 ."
+    )
 
     # Check the values in 'akku_soc_pro_stunde'
-    assert (
-        result["akku_soc_pro_stunde"][-1] == 42.151590909090906
-    ), "The value at index -1 of 'akku_soc_pro_stunde' should be 42.151590909090906."
-    assert (
-        result["akku_soc_pro_stunde"][1] == 60.08659090909091
-    ), "The value at index 1 of 'akku_soc_pro_stunde' should be 60.08659090909091."
+    assert result["akku_soc_pro_stunde"][-1] == 42.151590909090906, (
+        "The value at index -1 of 'akku_soc_pro_stunde' should be 42.151590909090906."
+    )
+    assert result["akku_soc_pro_stunde"][1] == 60.08659090909091, (
+        "The value at index 1 of 'akku_soc_pro_stunde' should be 60.08659090909091."
+    )
 
     # Check home appliances
-    assert (
-        sum(ems.home_appliance.get_load_curve()) == 2000
-    ), "The sum of 'ems.home_appliance.get_load_curve()' should be 2000."
+    assert sum(ems.home_appliance.get_load_curve()) == 2000, (
+        "The sum of 'ems.home_appliance.get_load_curve()' should be 2000."
+    )
 
     assert (
         np.nansum(
diff --git a/tests/test_class_ems_2.py b/tests/test_class_ems_2.py
index eda16ce7..fc463fa0 100644
--- a/tests/test_class_ems_2.py
+++ b/tests/test_class_ems_2.py
@@ -15,7 +15,7 @@
 )
 from akkudoktoreos.devices.generic import HomeAppliance, HomeApplianceParameters
 from akkudoktoreos.devices.inverter import Inverter, InverterParameters
-from akkudoktoreos.prediction.interpolator import SelfConsumptionPropabilityInterpolator
+from akkudoktoreos.prediction.interpolator import SelfConsumptionProbabilityInterpolator
 
 start_hour = 0
 
@@ -37,7 +37,7 @@ def create_ems_instance(config_eos) -> EnergieManagementSystem:
     )
 
     # 1h Load to Sub 1h Load Distribution -> SelfConsumptionRate
-    sc = SelfConsumptionPropabilityInterpolator(
+    sc = SelfConsumptionProbabilityInterpolator(
         Path(__file__).parent.resolve()
         / ".."
         / "src"
@@ -214,43 +214,43 @@ def test_simulation(create_ems_instance):
         assert key in result, f"The key '{key}' should be present in the result."
 
     # Check the length of the main arrays
-    assert (
-        len(result["Last_Wh_pro_Stunde"]) == 48
-    ), "The length of 'Last_Wh_pro_Stunde' should be 48."
-    assert (
-        len(result["Netzeinspeisung_Wh_pro_Stunde"]) == 48
-    ), "The length of 'Netzeinspeisung_Wh_pro_Stunde' should be 48."
-    assert (
-        len(result["Netzbezug_Wh_pro_Stunde"]) == 48
-    ), "The length of 'Netzbezug_Wh_pro_Stunde' should be 48."
-    assert (
-        len(result["Kosten_Euro_pro_Stunde"]) == 48
-    ), "The length of 'Kosten_Euro_pro_Stunde' should be 48."
-    assert (
-        len(result["akku_soc_pro_stunde"]) == 48
-    ), "The length of 'akku_soc_pro_stunde' should be 48."
+    assert len(result["Last_Wh_pro_Stunde"]) == 48, (
+        "The length of 'Last_Wh_pro_Stunde' should be 48."
+    )
+    assert len(result["Netzeinspeisung_Wh_pro_Stunde"]) == 48, (
+        "The length of 'Netzeinspeisung_Wh_pro_Stunde' should be 48."
+    )
+    assert len(result["Netzbezug_Wh_pro_Stunde"]) == 48, (
+        "The length of 'Netzbezug_Wh_pro_Stunde' should be 48."
+    )
+    assert len(result["Kosten_Euro_pro_Stunde"]) == 48, (
+        "The length of 'Kosten_Euro_pro_Stunde' should be 48."
+    )
+    assert len(result["akku_soc_pro_stunde"]) == 48, (
+        "The length of 'akku_soc_pro_stunde' should be 48."
+    )
 
     # Verfify DC and AC Charge Bins
-    assert (
-        abs(result["akku_soc_pro_stunde"][2] - 44.70681818181818) < 1e-5
-    ), "'akku_soc_pro_stunde[2]' should be 44.70681818181818."
-    assert (
-        abs(result["akku_soc_pro_stunde"][10] - 10.0) < 1e-5
-    ), "'akku_soc_pro_stunde[10]' should be 10."
-
-    assert (
-        abs(result["Netzeinspeisung_Wh_pro_Stunde"][10] - 3946.93) < 1e-3
-    ), "'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."
-
-    assert (
-        abs(result["akku_soc_pro_stunde"][20] - 10) < 1e-5
-    ), "'akku_soc_pro_stunde[20]' should be 10."
-    assert (
-        abs(result["Last_Wh_pro_Stunde"][20] - 6050.98) < 1e-3
-    ), "'Netzeinspeisung_Wh_pro_Stunde[11]' should be 0.0."
+    assert abs(result["akku_soc_pro_stunde"][2] - 44.70681818181818) < 1e-5, (
+        "'akku_soc_pro_stunde[2]' should be 44.70681818181818."
+    )
+    assert abs(result["akku_soc_pro_stunde"][10] - 10.0) < 1e-5, (
+        "'akku_soc_pro_stunde[10]' should be 10."
+    )
+
+    assert abs(result["Netzeinspeisung_Wh_pro_Stunde"][10] - 3946.93) < 1e-3, (
+        "'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."
+    )
+
+    assert abs(result["akku_soc_pro_stunde"][20] - 10) < 1e-5, (
+        "'akku_soc_pro_stunde[20]' should be 10."
+    )
+    assert abs(result["Last_Wh_pro_Stunde"][20] - 6050.98) < 1e-3, (
+        "'Netzeinspeisung_Wh_pro_Stunde[11]' should be 0.0."
+    )
 
     print("All tests passed successfully.")