Description
In a simple water grid setup with one external grid, one sink and two parallel pumps I had the problem that the pipeflow would not converge.
Minimal example:
#create empty net
net = pp.create_empty_network(fluid="water")
#create junctions
j1 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 1")
j2 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 2")
j3 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 3")
j4 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 4")
j5 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 5")
j6 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 6")
j7 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 7")
#create junction elements
ext_grid = pp.create_ext_grid(net, junction=j1, p_bar=3, t_k=293.15, name="Grid Connection")
sink = pp.create_sink(net, junction=j7, mdot_kg_per_s=44, name="Sink")
#create branch elements
pipe1 = pp.create_pipe_from_parameters(net, k_mm = 0.2, from_junction=j1, to_junction=j2, length_km=0.01, diameter_m=0.23, name="Pipe 1")
pipe2 = pp.create_pipe_from_parameters(net, k_mm = 0.2, from_junction=j2, to_junction=j3, length_km=0.10, diameter_m=0.23, name="Pipe 2")
pipe3 = pp.create_pipe_from_parameters(net, k_mm = 0.2, from_junction=j2, to_junction=j4, length_km=0.09, diameter_m=0.23, name="Pipe 3")
pipe4 = pp.create_pipe_from_parameters(net, k_mm = 0.2, from_junction=j5, to_junction=j7, length_km=0.03, diameter_m=0.23, name="Pipe 4")
pipe5 = pp.create_pipe_from_parameters(net, k_mm = 0.2, from_junction=j6, to_junction=j7, length_km=0.02, diameter_m=0.23, name="Pipe 5")
pump1 = pp.create_pump(net, from_junction=j3, to_junction=j5, std_type= "P2" , name="Pump 1")
pump2 = pp.create_pump(net, from_junction=j4, to_junction=j6, std_type= "P2" , name="Pump 2")
pp.set_user_pf_options(net, max_iter_hyd = 1000, alpha = 1)
pp.pipeflow(net)
If I would choose alpha to be very small for some setups it would converge for some it would't.
I did some experimenting and it seems like the derivative of the characteristic pump curve needed for the newton algorithm is not calculated, ie. JAC_DERIV_DM
for the pumps in the branch_pit
are always 0.
I wrote one function in the std_type_class.py for class PumpStdType(RegressionStdType)
to calculate the derivative from the regression polynomial and added the necessary adaption_after_derivatives_hydraulic()
function for the class Pump(BranchWZeroLengthComponent)
in pump_component.py and I got it to converge quickly and with
I dont have git installed at the moment so I cannot contribute directly but I wanted to know if it is true that the derivative for the characteristic curve does not get calculated but is actually needed for the algorithm. Thanks!