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

Hydraulic simulation of circulation pump in combination with other circulation pumps or ext_grids #527

Open
dlohmeier opened this issue Mar 27, 2023 · 0 comments

Comments

@dlohmeier
Copy link
Collaborator

I built a test for running a simulation of a district heating grid model with a circulation pump and an external grid:

net = pandapipes.create_empty_network("net", add_stdtypes=False)

j1, j2, j3, j4, j5, j6, j7 = pandapipes.create_junctions(net, 7, pn_bar=5, tfluid_k=283.15)

pandapipes.create_pipes_from_parameters(net, [j1, j2, j4, j5], [j2, j3, j5, j6], k_mm=1.,
                                        length_km=[0.4338, 0.2637, 0.2894, 0.427],
                                        diameter_m=0.1022)

pandapipes.create_heat_exchanger(net, j3, j4, diameter_m=0.1022, qext_w=200000)
pandapipes.create_heat_exchanger(net, j2, j5, diameter_m=0.1022, qext_w=200000)

pandapipes.create_fluid_from_lib(net, "water", overwrite=True)

pandapipes.create_pipes_from_parameters(
    net, [0, j7], [j7, 1], k_mm=1., length_km=0.213, diameter_m=0.1022
)
pandapipes.create_ext_grid(net, j4, p_bar=4, type="p")
pandapipes.create_source(net, j7, mdot_kg_per_s=1)

net_cpm = copy.deepcopy(net)
net_eg = copy.deepcopy(net)

pandapipes.create_circ_pump_const_mass_flow(net_cpm, 6, 0, p_flow_bar=5, mdot_flow_kg_per_s=5,
                                            t_flow_k=300, type='pt')

pandapipes.create_ext_grid(net_eg, 0, p_bar=5, t_k=300, type="pt")
pandapipes.create_sink(net_eg, 6, mdot_kg_per_s=5)

for nt in [net_cpm, net_eg]:
    pandapipes.pipeflow(nt, stop_condition="tol", iter=10, friction_model="nikuradse",
                        mode="all", transient=False, nonlinear_method="automatic",
                        tol_p=1e-4, tol_v=1e-4, use_numba=use_numba)

assert np.allclose(net_cpm.res_junction.values, net_eg.res_junction.values)
assert np.allclose(net_cpm.res_pipe.values, net_eg.res_pipe.values)
assert np.allclose(net_cpm.res_heat_exchanger.values, net_eg.res_heat_exchanger.values)
assert np.allclose(net_cpm.res_flow_control.values, net_eg.res_flow_control.values)
assert np.allclose(net_cpm.res_ext_grid.values[:1], net_eg.res_ext_grid.values[:1])

# this last test currently fails!
cp_junc = net_cpm.circ_pump_mass.flow_junction.values[0]
cp_mdot = net_cpm.circ_pump_mass.mdot_flow_kg_per_s.values[0]
assert np.isclose(net_cpm.res_pipe.loc[
                      (net_cpm.pipe.from_junction == cp_junc)
                      | (net_cpm.pipe.to_junction == cp_junc)].mdot_from_kg_per_s.sum(),
                  cp_mdot)

The last assertion fails as we cannot ensure that the mass flow through fed in by the circulation pump is the same as the one that enters it. In order to do so, we need to change the way we model the circulation pump. We need the following equations:

  1. At the outlet node: p = p_flow_bar
  2. At the outlet node: sum(mdot)_in = sum(mdot)_out
  3. At the inlet node: sum(mdot)_in = sum(mdot)_out
  4. Through the pump: mdot = mdot_flow_kg_per_s (or the same as v)

These equations are valid for the circulation pump with constant mass flow. For the other one, I am not sure yet. Currently, this seems to me like 4 equations for 3 elements (2 nodes, 1 branch). But maybe there still is a way to get this done within the current structure. One possibility would be to add an internal auxiliary node, so that the circulation pump could internally be seen as a flow controller and a pressure controller in series. Otherwise, it would be important to be able to make such changes inside the model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant