e2nIEE / pandapipes

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

Heat Transfer Solver does not converge in simple one-directional network #253

Open cvTHM opened 3 years ago

cvTHM commented 3 years ago

It seems that the heat transfer solver in pandapipes has problems with one-directional flows inside a network when the slack node for temperature values is downstream "at the end" of the flow and there is more than one branch. The following example can illustrate and reproduce the case where convergence fails, regardless of iteration steps specified:

import pandapipes as ppi
import pandapipes.plotting as ppplot

net=ppi.create_empty_network(name='net',fluid='water')

ppi.create_junctions(net,4,pn_bar=3,tfluid_k=330,geodata=[(0,0),(1,0),(2,1),(2,-1)])
ppi.create_pipes_from_parameters(net,from_junctions=[0,1,1],to_junctions=[1,2,3],length_km=[0.1,0.3,0.1],diameter_m=[0.05]*3)#,k_mm=[0.049]*3,loss_coefficient=[0.15]*3,alpha_w_per_m2k=[0]*3,sections=[5]*3)
ppi.create_sources(net,junctions=[2,3],mdot_kg_per_s=[0.02]*2)
ppi.create_ext_grid(net,junction=0,p_bar=2.5,t_k=323,type='pt')

ppplot.simple_plot(net)

ppi.pipeflow(net,mode='all')

This topology is, however, useful in many cases where e.g. district heating networks are separated for calculation purposes in feed line and reflux line (this case above representing the reflux line) and it shall be solved for a specific reflux temperature back at the heating plant (@ junction 0). Consumers wouldb e represented by sources in this case.

Whenn additional external grids as slack nodes are addes to the junctions connected to the sources and the external grid at junction 0 (heating plant) is changed to type='t' the desired result can be attained.

net=ppi.create_empty_network(name='net',fluid='water')

ppi.create_junctions(net,4,pn_bar=3,tfluid_k=330,geodata=[(0,0),(1,0),(2,1),(2,-1)])
ppi.create_pipes_from_parameters(net,from_junctions=[0,1,1],to_junctions=[1,2,3],length_km=[0.1,0.3,0.1],diameter_m=[0.05]*3)#,k_mm=[0.049]*3,loss_coefficient=[0.15]*3,alpha_w_per_m2k=[0]*3,sections=[5]*3)
ppi.create_sources(net,junctions=[2,3],mdot_kg_per_s=[0.02]*2)
ppi.create_ext_grid(net,junction=2,p_bar=3,t_k=330,type='t')
ppi.create_ext_grid(net,junction=3,p_bar=3,t_k=330,type='t')
ppi.create_ext_grid(net,junction=0,p_bar=2.5,t_k=323,type='p')

ppplot.simple_plot(net)

ppi.pipeflow(net,iter=100,mode='all')
dcronbach commented 3 years ago

Hallo,

I will try to have a look at this issue as soon as possible. Because of limited resources, this may take a while.

dlohmeier commented 1 year ago

Hello @cvTHM , I am currently trying to review issues related to heating grid simulation, as I am working on further development. The separation of flow and return system is indeed an important topic, which as far as I can see, has been addressed through the implementation of flow controllers which could before only be modeled the way you did, by splitting a connection with the help of sink and source. However, this creates a setup that cannot be solved, as there is no way to resolve the temperature levels for two sources with unknown temperature whose flow is united at some point before moving to an external grid with known temperature level (the resulting system of equations is underdetermined). I hope that with the help of flow controllers, this problem is properly addressed. The case you are describing could however be added to the documentation as caveat, or to the new diagnostic function. Thanks for your insights!