浏览代码

more documentation efforts

Lucas Gautheron 1 年之前
父节点
当前提交
3916a5aa30
共有 3 个文件被更改,包括 27 次插入6 次删除
  1. 22 2
      mix_simul/consumption.py
  2. 4 3
      mix_simul/scenarios.py
  3. 1 1
      mix_simul/storage.py

+ 22 - 2
mix_simul/consumption.py

@@ -38,7 +38,7 @@ class FittedConsumptionModel(ConsumptionModel):
     def get(self, times: Union[pd.Series, np.ndarray]) -> np.ndarray:
         """Retrieve the consumption for each timestamp from the input array.
 
-        :param times: 1D array containing the input timestamps 
+        :param times: 1D array containing the input timestamps
         :type times: Union[pd.Series, np.ndarray]
         :return: 1D array of floats (consumption in GW) with the same length as the input.
         :rtype: np.ndarray
@@ -105,10 +105,30 @@ class FittedConsumptionModel(ConsumptionModel):
 
 class ConsumptionFlexibilityModel:
     def __init__(self, flexibility_power: float, flexibility_time: int):
+        """Consumption flexibility model.
+
+        Adapts consumption to supply under constraints.
+
+        :param flexibility_power: Maximum power that can be postponed at any time, in GW
+        :type flexibility_power: float
+        :param flexibility_time: Maximum consumption delay in hours
+        :type flexibility_time: int
+        """
         self.flexibility_power = flexibility_power
         self.flexibility_time = flexibility_time
 
-    def run(self, load: np.ndarray, supply: np.ndarray):
+    def run(self, load: np.ndarray, supply: np.ndarray) -> np.ndarray:
+        """Runs the model.
+
+        Given initial load and supply, the model returns an adjusted load optimized under constraints.
+
+        :param load: 1D array containing the initial load at each timestep, in GW
+        :type load: np.ndarray
+        :param supply: 1D array containing the power supply at each timestep, in GW
+        :type supply: np.ndarray
+        :return: 1D array containing the adjusted load at each timestep, in GW
+        :rtype: np.ndarray
+        """
         from functools import reduce
 
         T = len(supply)

+ 4 - 3
mix_simul/scenarios.py

@@ -8,7 +8,7 @@ from typing import Tuple
 class Scenario:
     def __init__(
         self,
-        yearly_total: float=None,
+        yearly_total: float = None,
         sources: dict = {},
         multistorage: dict = {},
         flexibility_power=0,
@@ -26,7 +26,7 @@ class Scenario:
         :type flexibility_power: int, optional
         :param flexibility_time: _description_, defaults to 8
         :type flexibility_time: int, optional
-        :return: Performance of the scenario. 
+        :return: Performance of the scenario.
         :rtype: Tuple[float, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]
         """
         self.yearly_total = yearly_total
@@ -57,7 +57,8 @@ class Scenario:
 
         # adjust power to load with storage
         storage_model = MultiStorageModel(
-            self.multistorage["capacity"],
+            np.array(self.multistorage["capacity"])
+            * np.array(self.multistorage["power"]),
             self.multistorage["power"],
             self.multistorage["power"],
             self.multistorage["efficiency"],

+ 1 - 1
mix_simul/storage.py

@@ -46,7 +46,7 @@ class MultiStorageModel(StorageModel):
 
         self.storage_max_loads = np.array(storage_max_loads)
         self.storage_max_deliveries = np.array(storage_max_deliveries)
-        self.storage_capacities = np.array(storage_capacities) * self.storage_max_loads
+        self.storage_capacities = np.array(storage_capacities)
         self.storage_efficiencies = np.array(storage_efficiencies)
 
         self.n_storages = len(self.storage_capacities)