Skip to content

Commit

Permalink
make BasicModel consider all constraint groups
Browse files Browse the repository at this point in the history
  • Loading branch information
lensum committed Oct 20, 2023
1 parent 119e9cb commit f73e7db
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/oemof/solph/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f73e7db

Please sign in to comment.