From f73e7db6f50ce1e8fc9971c4b6636679099a2b3b Mon Sep 17 00:00:00 2001 From: lensum <80690396+lensum@users.noreply.github.com> Date: Fri, 20 Oct 2023 16:54:55 +0200 Subject: [PATCH] make BasicModel consider all constraint groups --- src/oemof/solph/_models.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/oemof/solph/_models.py b/src/oemof/solph/_models.py index 65c23c8eb..b9ba79e8b 100644 --- a/src/oemof/solph/_models.py +++ b/src/oemof/solph/_models.py @@ -132,12 +132,21 @@ def __init__(self, energysystem, **kwargs): "constraint_groups", [] ) - self._constraint_groups += [ - i - for i in self.es.groups - if hasattr(i, "CONSTRAINT_GROUP") - and i not in self._constraint_groups - ] + if self.is_cellular: + for es in energysystem: + self._constraint_groups += [ + i + for i in es.groups + if hasattr(i, "CONSTRAINT_GROUP") + and i not in self._constraint_groups + ] + else: + self._constraint_groups += [ + i + for i in self.es.groups + if hasattr(i, "CONSTRAINT_GROUP") + and i not in self._constraint_groups + ] self.flows = self.es.flows() if self.is_cellular: