Skip to content

Commit

Permalink
Require a label for Facades
Browse files Browse the repository at this point in the history
This works around the problem that labels might be set inconsistently
because of multi-inheritence.
  • Loading branch information
p-snft committed Oct 10, 2024
1 parent 2acef73 commit ab59cfc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/oemof/thermal/facades.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Facade(Node):
raises an error if he doesn't find them.
"""

def __init__(self, *_, **kwargs):
def __init__(self, label, **kwargs):
""" """

self.mapped_type = type(self)
Expand All @@ -72,7 +72,7 @@ def __init__(self, *_, **kwargs):

required = kwargs.pop("_facade_requires_", [])

super().__init__(label=kwargs.get("label"))
super().__init__(label=label)

self.subnodes = []
EnergySystem.signals[EnergySystem.add].connect(
Expand Down Expand Up @@ -249,6 +249,7 @@ def __init__(
)
Facade.__init__(
self,
label=label,
**kwargs,
)
with warnings.catch_warnings():
Expand Down Expand Up @@ -469,7 +470,7 @@ def __init__(self, **kwargs):

kwargs.update({"_facade_requires_": ["longitude"]})
Facade.__init__(self, **kwargs)
Transformer.__init__(self)
Transformer.__init__(self, label=kwargs.get("label"))

self.heat_bus = kwargs.get("heat_bus")

Expand Down Expand Up @@ -661,7 +662,7 @@ def __init__(self, **kwargs):

kwargs.update({"_facade_requires_": ["longitude"]})
Facade.__init__(self, **kwargs)
Transformer.__init__(self)
Transformer.__init__(self, label=kwargs.get("label"))

self.heat_out_bus = kwargs.get("heat_out_bus")

Expand Down

0 comments on commit ab59cfc

Please sign in to comment.