e2nIEE / pandapipes

Compare dae7bce ... +0 ... 5be2e0f

Coverage Reach
pandapipes/component_models/abstract_models/branch_models.py pandapipes/component_models/abstract_models/branch_w_internals_models.py pandapipes/component_models/abstract_models/branch_wo_internals_models.py pandapipes/component_models/abstract_models/const_flow_models.py pandapipes/component_models/abstract_models/base_component.py pandapipes/component_models/abstract_models/branch_wzerolength_models.py pandapipes/component_models/abstract_models/circulation_pump.py pandapipes/component_models/abstract_models/node_models.py pandapipes/component_models/abstract_models/node_element_models.py pandapipes/component_models/abstract_models/__init__.py pandapipes/component_models/auxiliaries/build_system_matrix.py pandapipes/component_models/auxiliaries/derivative_toolbox.py pandapipes/component_models/auxiliaries/component_toolbox.py pandapipes/component_models/auxiliaries/__init__.py pandapipes/component_models/pipe_component.py pandapipes/component_models/ext_grid_component.py pandapipes/component_models/junction_component.py pandapipes/component_models/pump_component.py pandapipes/component_models/heat_exchanger_component.py pandapipes/component_models/valve_component.py pandapipes/component_models/circulation_pump_pressure_component.py pandapipes/component_models/circulation_pump_mass_component.py pandapipes/component_models/__init__.py pandapipes/component_models/sink_component.py pandapipes/component_models/source_component.py pandapipes/plotting/collections.py pandapipes/plotting/patch_makers.py pandapipes/plotting/simple_plot.py pandapipes/plotting/generic_geodata.py pandapipes/plotting/__init__.py pandapipes/plotting/pipeflow_results.py pandapipes/plotting/plotting_toolbox.py pandapipes/multinet/control/controller/multinet_control.py pandapipes/multinet/control/controller/__init__.py pandapipes/multinet/control/run_control_multinet.py pandapipes/multinet/control/__init__.py pandapipes/multinet/timeseries/run_time_series_multinet.py pandapipes/multinet/timeseries/__init__.py pandapipes/multinet/multinet.py pandapipes/multinet/create_multinet.py pandapipes/multinet/__init__.py pandapipes/networks/simple_water_networks.py pandapipes/networks/simple_gas_networks.py pandapipes/networks/simple_heat_transfer_networks.py pandapipes/networks/nw_aux.py pandapipes/networks/__init__.py pandapipes/properties/fluids.py pandapipes/properties/properties_toolbox.py pandapipes/properties/__init__.py pandapipes/create.py pandapipes/pipeflow_setup.py pandapipes/pipeflow.py pandapipes/toolbox.py pandapipes/io/io_utils.py pandapipes/io/file_io.py pandapipes/io/convert_format.py pandapipes/io/__init__.py pandapipes/std_types/std_type.py pandapipes/std_types/std_type_toolbox.py pandapipes/std_types/__init__.py pandapipes/topology/create_graph.py pandapipes/topology/graph_searches.py pandapipes/topology/__init__.py pandapipes/timeseries/run_time_series.py pandapipes/timeseries/__init__.py pandapipes/idx_branch.py pandapipes/pandapipes_net.py pandapipes/internals_toolbox.py pandapipes/idx_node.py pandapipes/control/run_control.py pandapipes/control/__init__.py pandapipes/__init__.py pandapipes/constants.py setup.py

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -315,8 +315,7 @@
Loading
315 315
    net["_internal_results"].update(kwargs)
316 316
317 317
318 -
def initialize_pit(net, node_name, NodeComponent, NodeElementComponent, BranchComponent,
319 -
                   BranchWInternalsComponent):
318 +
def initialize_pit(net, node_name):
320 319
    """
321 320
    Initializes and fills the internal structure which is called pit (pandapipes internal tables).
322 321
    The structure is a dictionary which should contain one array for all nodes and one array for all
@@ -331,12 +330,8 @@
Loading
331 330
    pit = create_empty_pit(net)
332 331
333 332
    for comp in net['component_list']:
334 -
        if issubclass(comp, NodeComponent) | \
335 -
                issubclass(comp, BranchWInternalsComponent) | \
336 -
                issubclass(comp, NodeElementComponent):
337 -
            comp.create_pit_node_entries(net, pit["node"], node_name)
338 -
        if issubclass(comp, BranchComponent):
339 -
            comp.create_pit_branch_entries(net, pit["branch"], node_name)
333 +
        comp.create_pit_node_entries(net, pit["node"], node_name)
334 +
        comp.create_pit_branch_entries(net, pit["branch"], node_name)
340 335
    return pit["node"], pit["branch"]
341 336
342 337
@@ -378,7 +373,7 @@
Loading
378 373
        comp.extract_results(net, net["_options"], node_name)
379 374
380 375
381 -
def create_lookups(net, NodeComponent, BranchComponent, BranchWInternalsComponent):
376 +
def create_lookups(net):
382 377
    """
383 378
    Create all lookups necessary for the pipeflow of the given net.
384 379
    The lookups are usually:
@@ -408,14 +403,10 @@
Loading
408 403
    internal_nodes_lookup = dict()
409 404
410 405
    for comp in net['component_list']:
411 -
        if issubclass(comp, BranchComponent):
412 -
            branch_from, branch_table_nr = comp.create_branch_lookups(
413 -
                net, branch_ft_lookups, branch_table_lookups, branch_idx_lookups, branch_table_nr,
414 -
                branch_from)
415 -
        if issubclass(comp, NodeComponent) | issubclass(comp, BranchWInternalsComponent):
416 -
            node_from, node_table_nr = comp.create_node_lookups(
417 -
                net, node_ft_lookups, node_table_lookups, node_idx_lookups, node_from,
418 -
                node_table_nr, internal_nodes_lookup)
406 +
        branch_from, branch_table_nr = comp.create_branch_lookups(
407 +
            net, branch_ft_lookups, branch_table_lookups, branch_idx_lookups, branch_table_nr, branch_from)
408 +
        node_from, node_table_nr = comp.create_node_lookups(
409 +
            net, node_ft_lookups, node_table_lookups, node_idx_lookups, node_from, node_table_nr, internal_nodes_lookup)
419 410
420 411
    net["_lookups"] = {"node_from_to": node_ft_lookups, "branch_from_to": branch_ft_lookups,
421 412
                       "node_table": node_table_lookups, "branch_table": branch_table_lookups,

@@ -56,3 +56,115 @@
Loading
56 56
        :rtype:
57 57
        """
58 58
        raise NotImplementedError
59 +
60 +
    @classmethod
61 +
    def create_node_lookups(cls, net, ft_lookups, table_lookup, idx_lookups, current_start,
62 +
                            current_table, internal_nodes_lookup):
63 +
        """
64 +
        Function which creates node lookups.
65 +
66 +
        :param net: The pandapipes network
67 +
        :type net: pandapipesNet
68 +
        :param ft_lookups:
69 +
        :type ft_lookups:
70 +
        :param table_lookup:
71 +
        :type table_lookup:
72 +
        :param idx_lookups:
73 +
        :type idx_lookups:
74 +
        :param current_start:
75 +
        :type current_start:
76 +
        :param current_table:
77 +
        :type current_table:
78 +
        :param internal_nodes_lookup:
79 +
        :type internal_nodes_lookup:
80 +
        :return:
81 +
        :rtype:
82 +
        """
83 +
        return current_start, current_table
84 +
85 +
    @classmethod
86 +
    def create_branch_lookups(cls, net, ft_lookups, table_lookup, idx_lookups, current_table, current_start):
87 +
        """
88 +
        Function which creates branch lookups.
89 +
90 +
        :param net: The pandapipes network
91 +
        :type net: pandapipesNet
92 +
        :param ft_lookups:
93 +
        :type ft_lookups:
94 +
        :param table_lookup:
95 +
        :type table_lookup:
96 +
        :param idx_lookups:
97 +
        :type idx_lookups:
98 +
        :param current_table:
99 +
        :type current_table:
100 +
        :param current_start:
101 +
        :type current_start:
102 +
        :return: No Output.
103 +
        """
104 +
        return current_start, current_table
105 +
106 +
    @classmethod
107 +
    def create_pit_node_entries(cls, net, node_pit, node_name):
108 +
        """
109 +
        Function which creates pit branch entries.
110 +
111 +
        :param net: The pandapipes network
112 +
        :type net: pandapipesNet
113 +
        :param branch_pit:
114 +
        :type branch_pit:
115 +
        :return: No Output.
116 +
        """
117 +
118 +
        pass
119 +
120 +
    @classmethod
121 +
    def create_pit_branch_entries(cls, net, branch_pit, node_name):
122 +
        """
123 +
        Function which creates pit branch entries.
124 +
125 +
        :param net: The pandapipes network
126 +
        :type net: pandapipesNet
127 +
        :param node_pit:
128 +
        :type node_pit:
129 +
        :return: No Output.
130 +
        """
131 +
132 +
        pass
133 +
134 +
    @classmethod
135 +
    def calculate_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_lookups, options):
136 +
        """
137 +
        Function which creates derivatives.
138 +
139 +
        :param net: The pandapipes network
140 +
        :type net: pandapipesNet
141 +
        :param branch_component_pit:
142 +
        :type branch_component_pit:
143 +
        :param node_pit:
144 +
        :type node_pit:
145 +
        :param idx_lookups:
146 +
        :type idx_lookups:
147 +
        :param options:
148 +
        :type options:
149 +
        :return: No Output.
150 +
        """
151 +
        pass
152 +
153 +
    @classmethod
154 +
    def calculate_derivatives_thermal(cls, net, branch_pit, node_pit, idx_lookups, options):
155 +
        """
156 +
        Function which creates derivatives.
157 +
158 +
        :param net: The pandapipes network
159 +
        :type net: pandapipesNet
160 +
        :param branch_component_pit:
161 +
        :type branch_component_pit:
162 +
        :param node_pit:
163 +
        :type node_pit:
164 +
        :param idx_lookups:
165 +
        :type idx_lookups:
166 +
        :param options:
167 +
        :type options:
168 +
        :return: No Output.
169 +
        """
170 +
        pass

@@ -3,6 +3,7 @@
Loading
3 3
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4 4
5 5
import numpy as np
6 +
6 7
from pandapipes.component_models.abstract_models import Component
7 8
from pandapipes.component_models.auxiliaries.derivative_toolbox import calc_der_lambda, calc_lambda
8 9
from pandapipes.constants import NORMAL_PRESSURE, GRAVITATION_CONSTANT, NORMAL_TEMPERATURE, \
@@ -15,7 +16,7 @@
Loading
15 16
    LOAD_VEC_BRANCHES, LOAD_VEC_BRANCHES_T, LOAD_VEC_NODES_T, ELEMENT_IDX
16 17
from pandapipes.idx_node import PINIT, HEIGHT, TINIT as TINIT_NODE, PAMB
17 18
from pandapipes.internals_toolbox import _sum_by_group, select_from_pit
18 -
from pandapipes.pipeflow_setup import get_table_number, get_lookup, get_net_option
19 +
from pandapipes.pipeflow_setup import get_table_number, get_lookup
19 20
from pandapipes.properties.fluids import get_fluid
20 21
21 22
try:
@@ -277,7 +278,6 @@
Loading
277 278
        """
278 279
        raise NotImplementedError
279 280
280 -
281 281
    @classmethod
282 282
    def prepare_result_tables(cls, net, options, node_name):
283 283
        res_table = super().extract_results(net, options, node_name)
@@ -294,7 +294,6 @@
Loading
294 294
        branch_pit = net["_active_pit"]["branch"][fa:ta, :]
295 295
        return placement_table, branch_pit, res_table
296 296
297 -
298 297
    @classmethod
299 298
    def extract_results(cls, net, options, node_name):
300 299
        placement_table, branch_pit, res_table = cls.prepare_result_tables(net, options, node_name)

@@ -4,9 +4,9 @@
Loading
4 4
5 5
import numpy as np
6 6
from numpy import linalg
7 +
from scipy.sparse.linalg import spsolve
8 +
7 9
from pandapipes.component_models import Junction
8 -
from pandapipes.component_models.abstract_models import NodeComponent, NodeElementComponent, \
9 -
    BranchComponent, BranchWInternalsComponent
10 10
from pandapipes.component_models.auxiliaries import build_system_matrix
11 11
from pandapipes.idx_branch import ACTIVE as ACTIVE_BR, FROM_NODE, TO_NODE, FROM_NODE_T, \
12 12
    TO_NODE_T, VINIT, T_OUT, VINIT_T
@@ -16,7 +16,6 @@
Loading
16 16
    get_lookup, create_lookups, initialize_pit, check_connectivity, reduce_pit, \
17 17
    extract_results_active_pit, set_user_pf_options
18 18
from pandapower.auxiliary import ppException
19 -
from scipy.sparse.linalg import spsolve
20 19
21 20
try:
22 21
    import pplog as logging
@@ -65,10 +64,8 @@
Loading
65 64
    # Init physical constants and options
66 65
    init_options(net, local_params)
67 66
68 -
    create_lookups(net, NodeComponent, BranchComponent, BranchWInternalsComponent)
69 -
    node_pit, branch_pit = initialize_pit(net, Junction.table_name(),
70 -
                                          NodeComponent, NodeElementComponent,
71 -
                                          BranchComponent, BranchWInternalsComponent)
67 +
    create_lookups(net)
68 +
    node_pit, branch_pit = initialize_pit(net, Junction.table_name())
72 69
    if (len(node_pit) == 0) & (len(branch_pit) == 0):
73 70
        logger.warning("There are no node and branch entries defined. This might mean that your net"
74 71
                       " is empty")
@@ -274,8 +271,7 @@
Loading
274 271
275 272
    branch_lookups = get_lookup(net, "branch", "from_to_active")
276 273
    for comp in net['component_list']:
277 -
        if issubclass(comp, BranchComponent):
278 -
            comp.calculate_derivatives_hydraulic(net, branch_pit, node_pit, branch_lookups, options)
274 +
        comp.calculate_derivatives_hydraulic(net, branch_pit, node_pit, branch_lookups, options)
279 275
    jacobian, epsilon = build_system_matrix(net, branch_pit, node_pit, False)
280 276
281 277
    v_init_old = branch_pit[:, VINIT].copy()
@@ -317,8 +313,7 @@
Loading
317 313
    branch_pit[mask, TO_NODE_T] = branch_pit[mask, FROM_NODE]
318 314
319 315
    for comp in net['component_list']:
320 -
        if issubclass(comp, BranchComponent):
321 -
            comp.calculate_derivatives_thermal(net, branch_pit, node_pit, branch_lookups, options)
316 +
        comp.calculate_derivatives_thermal(net, branch_pit, node_pit, branch_lookups, options)
322 317
    jacobian, epsilon = build_system_matrix(net, branch_pit, node_pit, True)
323 318
324 319
    t_init_old = node_pit[:, TINIT].copy()

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
component_models 0.10% 93.40%
control 78.57%
io 83.33%
multinet 86.47%
networks 97.54%
plotting 87.75%
properties 93.85%
std_types 80.95%
timeseries 88.64%
topology 83.33%
__init__.py 100.00%
constants.py 100.00%
create.py 99.02%
idx_branch.py 100.00%
idx_node.py 100.00%
internals_toolbox.py 100.00%
pandapipes_net.py 87.50%
pipeflow.py -0.16% 90.27%
pipeflow_setup.py -0.17% 91.54%
toolbox.py 81.60%
Folder Totals (20 files) 90.99%
Project Totals (74 files) 90.65%
Loading