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

Disregard disconnected flow controllers #601

Open
dlohmeier opened this issue Apr 4, 2024 · 1 comment
Open

Disregard disconnected flow controllers #601

dlohmeier opened this issue Apr 4, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@dlohmeier
Copy link
Collaborator

dlohmeier commented Apr 4, 2024

Describe the bug
In case the connectivity check sets parts of the network out of service, flow controllers (and heat consumers) might prevail in the pit structure, even though connected to junctions removed by the connectivity check. This could probably be easily avoided.

To Reproduce
I will try to provide a good example soon. I am not yet sure which types of disconnection (only one-sided, while still connected to an in service junction on the other side, or also for both oos junctions, only in connectivity check or also when given oos junctions in the net model, ...) lead to this error, and I will try to analyze this in the example.

Error message
hp.pandapipes.pf.pipeflow_setup - INFO: Setting the following nodes out of service for hydraulics calculation in connectivity check:
In table junction: [21, 25, 98, 100, 254, 255, 256, 257, 259, 261, 263, 264, 265, 266, 269, 272, 274, 276, 278, 279, 280, 281, 282, 284, 286, 288, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 997, 999, 1058, 1060, 1083, 1087, 1122, 1124, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1188, 1190, 1192, 1194, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1232, 1234, 1237, 1239, 1245, 1247, 1264, 1266, 1268, 1270, 1276, 1278, 1280, 1282, 1359, 1363, 1400, 1402, 1404, 1406, 1409, 1411, 1472, 1474, 1476, 1478, 1481, 1483, 1484, 1486, 1716, 1717, 1722, 1723, 1724, 1726, 1987, 1989, 1991, 1993, 1995, 1997, 1999, 2001, 2011, 2010, 2009, 2008, 2080, 2079, 2016, 2017, 2037, 2036, 2032, 2033, 2047, 2046, 2013, 2004, 2012, 2005, 2140, 2141, 2102, 2103, 2159, 2160, 2181, 2182, 2123, 2121, 2130, 2131, 2165, 2167, 2169, 2170, 2173, 2174, 2175, 2176]
/home/daniel/workspace/pandapipes/src/pandapipes/pipeflow.py:231: MatrixRankWarning: Matrix is exactly singular
x = spsolve(jacobian, epsilon)
dgstrf info 2013
dgstrf info 2
dgstrf info 2
dgstrf info 2
dgstrf info 2
dgstrf info 2
dgstrf info 2
dgstrf info 2
dgstrf info 2
dgstrf info 2
dgstrf info 2
Traceback (most recent call last):
File "", line 1, in
pandapipes.pipeflow(net)
File "/home/daniel/workspace/pandapipes/src/pandapipes/pipeflow.py", line 98, in pipeflow
raise PipeflowNotConverged("The hydraulic calculation did not converge to a solution.")
pandapipes.pf.pipeflow_setup.PipeflowNotConverged: The hydraulic calculation did not converge to a solution.

Expected behavior
The incorrectly connected flow controllers should be set out of service, so that they don't induce any flow.

Python environment (please complete the following information):

  • OS: Ubuntu 20.04.6 LTS
  • pandapipes version 0.8.4
@dlohmeier dlohmeier added the bug Something isn't working label Apr 4, 2024
@dlohmeier
Copy link
Collaborator Author

I think I need to make some corrections. It seems that the problem is not with the connectivity check. Here is the code I used for testing:

    import pandapipes
    import pandas as pd


    def create_test_net():
        """
        Create a test network with flow and return, connected through one circ pump pressure
        on the infeeder side and 5 heat consumers on the consumer side, which consist of a flow
        control valve and a heat exchanger each.
        Returns
        -------

        """
        net = pandapipes.create_empty_network("district_heating")
        pandapipes.create_junctions(
            net, 17, 10, 400, name=[f"Junction {i + 1}" for i in range(17)], index=list(range(1, 18))
        )
        pandapipes.create_pipes_from_parameters(
            net, [1, 3, 3, 3, 3, 8, 11, 14, 17, 5], [3, 6, 9, 12, 15, 5, 5, 5, 5, 2],
            0.2, 0.1, name=[f"Pipe {i + 1}" for i in range(10)], alpha_w_per_m2k=1
        )
        pandapipes.create_circ_pump_const_pressure(
            net, 2, 1, name="Circ Pump", p_flow_bar=10, plift_bar=7, t_flow_k=400
        )
        pandapipes.create_flow_controls(
            net, [3, 6, 9, 12, 15], [4, 7, 10, 13, 16], 0.5, 0.1, name=[f"Flow Control {i + 1}" for i in range(5)]
        )
        pandapipes.create_heat_exchangers(
            net, [4, 7, 10, 13, 16], [5, 8, 11, 14, 17], 0.2, 20000, name=[f"Heat Exchanger {i + 1}" for i in range(5)]
        )
        pandapipes.create_fluid_from_lib(net, "water", overwrite=True)
        return net


    def check_connectivity():
        net = create_test_net()
        oos_junctions = [6, 15, 16, 17]
        net.junction.loc[oos_junctions, "in_service"] = False
        # oos_pipes_junctions = [(3, 9), (3, 12), (14, 5)]
        oos_pipes_junctions = [(3, 12), (14, 5)]
        for from_junction, to_junction in oos_pipes_junctions:
            net.pipe.loc[(net.pipe.from_junction == from_junction)
                         & (net.pipe.to_junction == to_junction), "in_service"] = False
        pandapipes.pipeflow(net, mode="all")

If we use the first oos_pipes_junctions definition including the pipe between junctions 3 and 9 and set it out of service, the pipeflow fails in the hydraulic calculation. The problem here should be that a flow control is not being supplied by any upstream source or slack (slack also including circulation pumps). All other cases seem to be working, i.e. if junctions 15, 16 and 17 are just set out of service, they will be set in service again by the connectivity check, as they area connected to in service branches. That's just fine. And since all branches between junctions 12 and 14 are set out of service by the connectivity check, the flow control does not induce any flow there.
So what we really need here is a toolbox function that can find flow controllers without any upstream source or slack. I will try to provide an example for this.

@dlohmeier dlohmeier added enhancement New feature or request and removed bug Something isn't working labels Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant