e2nIEE / pandapipes

A pipeflow calculation tool that complements pandapower in the simulation of multi energy grids
https://www.pandapipes.org
Other
147 stars 62 forks source link

Hydraulic calculation doesn't converge when the network has two parallel pumps for a gas #545

Open oporras opened 1 year ago

oporras commented 1 year ago

Describe the bug A simple network for a gas with two parallel pumps doesn't converge while the same network with compressors works well.

To Reproduce The attached code allows selecting between standard pumps or compressors and shows a simple case where the problem can be reproduced. simpleNetworkTwoParallelStdPump.py.zip

Error message The following Error message occurred (incl. traceback) File "/Users/orlandoporrasrey/Documents/Proyectos/Simulmax/Clientes/Biogas-Dona-Juana/Modelos/simpleNetworkTwoParallelStdPump.py", line 72, in pp.pipeflow(net) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandapipes/pipeflow.py", line 101, in pipeflowraise PipeflowNotConverged("The hydraulic calculation did not converge to a solution.") pandapipes.pipeflow.PipeflowNotConverged: The hydraulic calculation did not converge to a solution.

Expected behavior A symmetric solution with a different pressure increase through pumps (according to the P2 standard type pump).

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

image

Python environment (please complete the following information):

dlohmeier commented 1 year ago

Dear @oporras , thanks for your question, which took a while to figure out, as our pump expert is currently not available. We usually use pumps with liquid transporting networks, which is why such an error has not occurred previously. The pump standard types were also mainly defined with a focus on liquids, which is why the three pre-defined standard types probably wouldn't suite your problem. So, in order to make the simulation converge, we need to define a pump for which the given simulation conditions (volume flow and pressure) are in the allowed range. A configuration that worked for me:

st_p4 = pp.std_type_class.PumpStdType.from_list(name="P4", x_values=[0., 2., 5.],
                                                y_values=[2, 1.8, 1.2], degree=2)
net.std_types["pump"]["P4"] = st_p4
pump0 = pp.create_pump(net, from_junction=j1, to_junction=j3, std_type="P4", name="Pump 0")
pump1 = pp.create_pump(net, from_junction=j2, to_junction=j4, std_type="P4", name="Pump 1")

Unfortunately, I also found that the method PumpStdType.from_list does not return anything. I will try to fix that asap on the hotfix branch. For the time being, you could just add a return statement (return reg_st) at the end of this method inside your own code.

Probably your pump would look a little different than the one I created, so please feel free to find a suitable pressure curve for yourself. Does that help you solve your problem?

dlohmeier commented 1 year ago

I managed to update the hotfix_0.8.5 branch, so that you can pull the changes now. I think, this issue is related to #544 and it would be very helpful to differentiate pumps between liquids and gases. However, it might make more sense to get a better differentiation into the whole component model. So, we would like to have components that depend on a curve (currently pumps) and such that create a constant pressure ratio (currently compressors), and differentiate them between liquids and gases. I am not yet sure which way is the perfect to go, but we will need some restructuring here. I think it is less confusing to take the following approach:

Would that make sense to you?