Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Relying tests in pandapower #676

Open
vogt31337 opened this issue Dec 11, 2024 · 0 comments
Open

Error in Relying tests in pandapower #676

vogt31337 opened this issue Dec 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@vogt31337
Copy link
Contributor

Describe the bug
In pandapower a lot of tests fail, here is one of many. If you want more information please look in the pandapower test pipeline.

To Reproduce
Steps to reproduce the behavior. Please try to provide a minimal example code.

Error message
____________________________ test_include_branches _____________________________

def test_include_branches():
    net = nw.gas_versatility()
  mg = top.create_nxgraph(net, include_pipes=False, include_valves=False, include_pumps=False)

.venv/lib/python3.10/site-packages/pandapipes/test/topology/test_nxgraph.py:12:


net = {'_class': 'pandapipesNet', '_module': 'pandapipes.pandapipes_net'}
include_pipes = False, respect_status_pipes = True
weighting_pipes = (<function get_col_value at 0x7ffb5e0d8f70>, ('pipe', 'length_km'))
include_valves = False, respect_status_valves = True, weighting_valves = None
include_compressors = True, respect_status_compressors = True
weighting_compressors = None, include_mass_circ_pumps = True
respect_status_mass_circ_pumps = True, weighting_mass_circ_pumps = None
include_pressure_circ_pumps = True, respect_status_pressure_circ_pumps = True
weighting_pressure_circ_pumps = None, include_press_controls = True
respect_status_press_controls = True, weighting_press_controls = None
include_pumps = False, respect_status_pumps = True, weighting_pumps = None
include_flow_controls = True, respect_status_flow_controls = True
weighting_flow_controls = None, respect_status_junctions = True
nogojunctions = None, notravjunctions = None, multi = True
respect_status_branches_all = None, kwargs = {}
mg = <networkx.classes.multigraph.MultiGraph object at 0x7ffb566346d0>
branch_params = {'include_flow_controls': True, 'include_mass_circ_pumps': True, 'include_pipes': False, 'include_press_controls': True, ...}

def create_nxgraph(net, include_pipes=True, respect_status_pipes=True,
                   weighting_pipes=(get_col_value, ("pipe", "length_km")),
                   include_valves=True, respect_status_valves=True,
                   weighting_valves=None,
                   include_compressors=True, respect_status_compressors=True,
                   weighting_compressors=None,
                   include_mass_circ_pumps=True, respect_status_mass_circ_pumps=True,
                   weighting_mass_circ_pumps=None,
                   include_pressure_circ_pumps=True, respect_status_pressure_circ_pumps=True,
                   weighting_pressure_circ_pumps=None,
                   include_press_controls=True, respect_status_press_controls=True,
                   weighting_press_controls=None,
                   include_pumps=True, respect_status_pumps=True,
                   weighting_pumps=None,
                   include_flow_controls=True, respect_status_flow_controls=True,
                   weighting_flow_controls=None,
                   respect_status_junctions=True, nogojunctions=None, notravjunctions=None, multi=True,
                   respect_status_branches_all=None, **kwargs):
    """
    Converts a pandapipes network into a NetworkX graph, which is a simplified representation of a
    network's topology, reduced to nodes and edges. Junctions are being represented by nodes, edges
    represent physical connections between junctions (typically pipes or pumps).

    :param net: The pandapipes network to be converted
    :type net: pandapipesNet
    :param include_pipes: Flag whether pipes should be included in the graph, OR: list of pipes to\
        be included explicitly.
    :type include_pipes: bool, iterable, default True
    :param respect_status_pipes: Flag whether the "in_service" column shall be considered and out\
        of service pipes neglected.
    :type respect_status_pipes: bool, default True
    :param weighting_pipes: Function that defines how the weighting of the pipes is defined. \
        Parameter of shape (function, (list of arguments)). If None, weight is set to 0.
    :type weighting_pipes: list, tuple, default (:func:`get_col_value`, ("pipe", "length_km"))
    :param include_valves: Flag whether valves should be included in the graph, OR: list of valves\
        to be included explicitly.
    :type include_valves: bool, iterable, default True
    :param respect_status_valves: Flag whether the "opened" column shall be considered and out\
        of service valves neglected.
    :type respect_status_valves: bool, default True
    :param weighting_valves: Function that defines how the weighting of the valves is defined. \
        Parameter of shape (function, (list of arguments)). If None, weight is set to 0.
    :type weighting_valves: list, tuple, default None
    :param include_pumps: Flag whether pumps should be included in the graph, OR: list of pumps to\
        be included explicitly.
    :type include_pumps: bool, iterable, default True
    :param respect_status_pumps: Flag whether the "in_service" column shall be considered and out\
        of service pumps neglected.
    :type respect_status_pumps: bool, default True
    :param weighting_pumps: Function that defines how the weighting of the pumps is defined. \
        Parameter of shape (function, (list of arguments)). If None, weight is set to 0.
    :type weighting_pumps: list, tuple, default None
    :param respect_status_junctions: Flag whether the "in_service" column shall be considered and\
        out of service junctions neglected.
    :type respect_status_junctions: bool, default True
    :param nogojunctions: nogojunctions are not being considered in the graph
    :type nogojunctions: iterable, default None
    :param notravjunctions: edges connected to these junctions are not being considered in the graph
    :type notravjunctions: iterable, default None
    :param multi: True: The function generates a NetworkX MultiGraph, which allows multiple \
        parallel edges between nodes
        False: NetworkX Graph (no multiple parallel edges)
    :type multi: bool, default True
    :param respect_status_branches_all: Flag for overriding the status consideration for all branch\
        elements (pipes, valves, pumps etc.). If None, will not be considered.
    :type respect_status_branches_all: bool, default None
    :param kwargs: Additional keyword arguments, especially useful to address inclusion of branch\
        components that are not in the default components (pipes, valves, pumps). It is always \
        possible to add "include_xy", "respect_status_xy" or "weighting_xy" arguments for \
        additional components
    :return: mg - the required NetworkX graph

    ..note: By default, all branch components are represented as edges in the graph. I.e. tables of\
            every branch component will be included if not stated otherwise. The status\
            (in_service) will always be considered, unless stated explicitly. The weighting by \
            default is 0, but can be changed with the help of a function, as it is done with pipes.
    """
    if multi:
        mg = nx.MultiGraph()
    else:
        mg = nx.Graph()

    branch_kw = ["include", "respect_status", "weighting"]
    branch_params = {k: v for k, v in kwargs.items() if any(k.startswith(par) for par in branch_kw)}
    loc = locals()
    branch_params.update({"%s_%s" % (par, bc): loc.get("%s_%s" % (par, bc)) for par in branch_kw
                          for bc in ["pipes", "valves", "pumps", "press_controls",
                                     "mass_circ_pumps", "pressure_circ_pumps", "valve_pipes",
                                     "flow_controls"]})
  for comp in net.component_list:

E AttributeError: 'dict' object has no attribute 'component_list'

.venv/lib/python3.10/site-packages/pandapipes/topology/create_graph.py:119: AttributeError

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Python environment (please complete the following information):

  • OS: [e.g. Windows 10]
  • pandapipes version [e.g., the version tag if you use the master version (from pip) or branch/commit ID)
  • list of dependencies incl. version numbers[result from pip list]

Additional context
Add any other context about the problem here. Also, please add related issues if there are any.

@vogt31337 vogt31337 added the bug Something isn't working label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant