From df576ff5d4aea4c49e9e550dbdd231b9258eaa0b Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Wed, 4 Jun 2025 17:52:48 +0200 Subject: [PATCH 1/2] Fix storage losses per hour --- flixopt/components.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flixopt/components.py b/flixopt/components.py index bdac6d2fb..1f5fe5ece 100644 --- a/flixopt/components.py +++ b/flixopt/components.py @@ -491,7 +491,7 @@ def do_modeling(self): self.add( self._model.add_constraints( charge_state.isel(time=slice(1, None)) - == charge_state.isel(time=slice(None, -1)) * (1 - rel_loss * hours_per_step) + == charge_state.isel(time=slice(None, -1)) * ((1 - rel_loss) ** hours_per_step) + charge_rate * eff_charge * hours_per_step - discharge_rate * eff_discharge * hours_per_step, name=f'{self.label_full}|charge_state', From 96e1846a3fc45be8b198ce57321a370a805755d9 Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Sat, 14 Jun 2025 10:07:15 +0200 Subject: [PATCH 2/2] Update storage test --- tests/test_storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_storage.py b/tests/test_storage.py index b88defaf6..a3b453c2b 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -165,7 +165,7 @@ def test_lossy_storage(self, basic_flow_system_linopy): assert_conequal( model.constraints['TestStorage|charge_state'], charge_state.isel(time=slice(1, None)) - == charge_state.isel(time=slice(None, -1)) * (1 - rel_loss * hours_per_step) + == charge_state.isel(time=slice(None, -1)) * (1 - rel_loss) ** hours_per_step + charge_rate * eff_charge * hours_per_step - discharge_rate * eff_discharge * hours_per_step, )