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', 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, )