Passed
Pull Request — dev (#1193)
by Uwe
01:38
created

solph._facades.Facade._sub_component_labelling()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nop 2
1
# -*- coding: utf-8 -*-
2
3
"""
4
Solph Facade based on oemof.network.SubNetwork
5
6
SPDX-FileCopyrightText: Uwe Krien <[email protected]>
7
SPDX-FileCopyrightText: Pierre-François Duc
8
9
SPDX-License-Identifier: MIT
10
11
"""
12
13
from oemof.network import SubNetwork
14
15
16
class Facade(SubNetwork):
17
    # attributes
18
    def __init__(self,*args,**kwargs):
19
        self.facade_type = None
20
21
    def add_subnode(self,*args):
22
        """Add a subnode to the subnetwork"""
23
        for sub_component in args:
24
            sub_component.label = self._sub_component_labelling(sub_component.label)
25
            super(self).add_subnode(sub_component)
26
27
    def build_subnetwork(self):
28
        """Instanciate and add Node instance to the sub network"""
29
        pass
30
31
    def _sub_component_labelling(self, sub_component_label):
32
        """Method to always keep the Facade instance label in its subcomponents"""
33
        return f"{self.label}_{sub_component_label}"
34