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

solph._facades   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 13
dl 0
loc 34
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A Facade._sub_component_labelling() 0 3 1
A Facade.add_subnode() 0 5 2
A Facade.__init__() 0 2 1
A Facade.build_subnetwork() 0 3 1
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