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

Simulation with timeseries function - always initial values als result #560

Closed Hoppe-J closed 1 year ago

Hoppe-J commented 1 year ago

Hello, i want to simulate a very simple heatwater net with dynamic timeseries. The net has 4 junctions, one circulation pump with const. mass, one heatexchanger and two pipes:

grafik

I implement a loadprofile for heat demand at the heat exchanger. When i simulate, the temperatures at the junctions are always the initial temperatur (5°C) although, the pipes external temperatures and pump output where at 35°C. The loadprofile is written in the run_timeseries fuction correctly, i checked it. Maybe you could help me, to find the mistake and why the temperature simulation don't work. Thanks you. I attached some graphs and my code:

grafik

grafik

CODE:

import pandapipes as pp import pandas as pd import pandapower.control as control from pandapower.timeseries import DFData from pandapower.timeseries import OutputWriter from pandapipes.timeseries import run_timeseries

create empty net

net = pp.create_empty_network(fluid ="water")

j_vorPumpe = pp.create_junction(net, pn_bar=3, tfluid_k=5+273.15, name="junction nachHaus",geodata=(-10,-10)) j_nachPumpe = pp.create_junction(net, pn_bar=3, tfluid_k=5+273.15, name="junction nachPumpe",geodata=(-10,10)) j_haus1_in = pp.create_junction(net, pn_bar=3, tfluid_k=5+273.15, name="junction haus1_in",geodata=(10,10)) j_haus1_out = pp.create_junction(net, pn_bar=3, tfluid_k=5+273.15, name="junction haus1_out",geodata=(10,-10))

Nahwärmenetz Pump

pp.create_circ_pump_const_mass_flow(net, return_junction=j_vorPumpe, flow_junction=j_nachPumpe, p_flow_bar=5, mdot_flow_kg_per_s=5,t_flow_k=35+273.15)

Modellierung Geb als Wärmeübetrrager

pp.create_heat_exchanger(net, from_junction=j_haus1_in, to_junction=j_haus1_out, diameter_m=200e-3, qext_w = 1000000,loss_coefficient=0,name="heat_exchanger")

Pipes zwischen Knoten vorlauf

pipe_vorlauf_haus=pp.create_pipe_from_parameters(net, from_junction=j_nachPumpe, to_junction=j_haus1_in, length_km=1,diameter_m=200e-3, k_mm=.1, alpha_w_per_m2k=10, sections = 10, text_k=35+273.15)

Pipes zwischen Knoten Rücklauf

pipe_rucklauf_haus=pp.create_pipe_from_parameters(net, from_junction=j_haus1_out, to_junction=j_vorPumpe, length_km=1,diameter_m=200e-3, k_mm=.1, alpha_w_per_m2k=10, sections = 10, text_k=35+273.15)

timesteps

profiles = pd.DataFrame() loadprofile = r"......." profiles["load"] = pd.read_csv(loadprofile, index_col=0) print(profiles) ds_heatpump = DFData(profiles)

print("elements") print(net.heat_exchanger.index) const_heatpump = control.ConstControl(net,element="heat_exchanger",variable="qext_w", element_index=[0], data_source=ds_heatpump,profile_name=["load"])

time_steps=range(50000)

log_variables = [('res_junction', 'p_bar'),('res_junction', "t_k"), ('res_pipe', 'mdot_to_kg_per_s'), ('res_pipe', 'reynolds'), ('res_pipe', 'lambda'), ("heat_exchanger", "qext_w"),("res_heat_exchanger", "t_from_k"),("res_heat_exchanger", "t_to_k")]

ow = OutputWriter(net, time_steps, output_path=None, log_variables=log_variables)

run_timeseries(net, time_steps)

dlohmeier commented 1 year ago

Hi @H0ooo , what you would do when performing the pipeflow with heat simulation is:

pandapipes.pipeflow(net, mode="all")

I guess that the "mode" option is just missing in your call to run_timeseries. It should be passed down to the pipeflow function. Could you try that?

Hoppe-J commented 1 year ago

Hi, thank you so much, now it's working. I thought the "mode=all" is only for the stationary simulation., but with this in the run_timeseries every thing is fine. Thanks for your quick response!

dlohmeier commented 1 year ago

Glad that worked. Please keep in mind that you are still performing a stationary simulation, i.e. the temperature at your flow's end point at a certain time step after injecting a temperature step could be far away from reality, as it displays the steady-state value and the potentially slow propagation of fluid through your pipes is neglected.

dlohmeier commented 1 year ago

If you want to perform real transient simulations, please refer to the transient_heat_transfer branch. But be aware that this is work in progress and not stable yet (cf. #534 )

Hoppe-J commented 1 year ago

Ah okay thank you for the hint. Then I'll take a look at the branch