From bcbfa8dc5217345f71f376801349e2af57188387 Mon Sep 17 00:00:00 2001 From: "F.N. Claessen" Date: Mon, 12 Jun 2023 22:31:00 +0200 Subject: [PATCH] flake8 Signed-off-by: F.N. Claessen --- flexmeasures/utils/calculations.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flexmeasures/utils/calculations.py b/flexmeasures/utils/calculations.py index b8f905ed6..e1dee05ad 100644 --- a/flexmeasures/utils/calculations.py +++ b/flexmeasures/utils/calculations.py @@ -45,32 +45,32 @@ def apply_stock_changes_and_losses( how: str = "linear", decimal_precision: int | None = None, ) -> list[float]: - """Assign stock changes and determine losses from storage efficiency. + r"""Assign stock changes and determine losses from storage efficiency. The initial stock is exponentially decayed, as with each consecutive (constant-resolution) time step, some constant percentage of the previous stock remains. For example: .. math:: - 100 \\rightarrow 90 \\rightarrow 81 \\rightarrow 72.9 \\rightarrow ... + 100 \rightarrow 90 \rightarrow 81 \rightarrow 72.9 \rightarrow ... For computing the decay of the changes, we make an assumption on how a delta :math:`d` is distributed within a given time step. In case it happens at a constant rate, this leads to a linear stock change from one time step to the next. An :math:`e` is introduced when we apply exponential decay to that. - To see that, imagine we cut one time step in :math:`n` pieces (each with a stock change :math:`\\frac{d}{n}` ), + To see that, imagine we cut one time step in :math:`n` pieces (each with a stock change :math:`\frac{d}{n}` ), apply the efficiency to each piece :math:`k` (for the corresponding fraction of the time step :math:`k/n`), - and then take the limit :math:`n \\rightarrow \infty`: + and then take the limit :math:`n \rightarrow \infty`: .. math:: - \lim_{n \\rightarrow \infty} \sum_{k=0}^{n}{\\frac{d}{n} \eta^{k/n}} + \lim_{n \rightarrow \infty} \sum_{k=0}^{n}{\frac{d}{n} \eta^{k/n}} `which is `_: .. math:: - d \cdot \\frac{\eta - 1}{e^{\eta}} + d \cdot \frac{\eta - 1}{e^{\eta}} :param initial: initial stock :param changes: stock change for each step