e2nIEE / pandapipes

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

Small correction in heat consumer for mode MF_TR #652

Closed dlohmeier closed 1 month ago

dlohmeier commented 1 month ago

the return temperature of the heat consumer is not fixed for the solver anymore, but calculated based on an exact estimate of qext from inlet and controlled return temperature

JonasPfeiffer123 commented 35 minutes ago

Dear @dlohmeier,

I'm currently exploring the new return temperature control feature for heat_consumer, introduced in v0.11. Previously, I utilized a custom controller to adjust the controlled_mass_flow in heat_consumer based on a given output temperature. Now, I’m transitioning to the new approach, but my calculations fail under certain configurations.

I examined the provided functionality and corresponding tests in src/pandapipes/test/api/test_components/test_heat_consumer.py. While experimenting, I observed the following:

  1. The original example works as expected, where one heat consumer is assigned treturn_kand the other controlled_mdot_kg_per_s.
  2. Both heat consumers specifying controlled_mdot_kg_per_s(as in previous versions) also works fine.
  3. However, when both heat consumers are assigned only treturn_k, the bidirectional calculation fails. Using the sequential mode also does not work. For clarity, qext_wis defined for both heat consumers.

Below is a minimal example demonstrating the issue:

def test_heat_consumer_result_extraction
    net = pp.create_empty_network("net", add_stdtypes=False, fluid="water")

    juncs = pp.create_junctions(
        net,
        nr_junctions=6,
        pn_bar=5,
        tfluid_k=286,
        system=["flow"] * 3 + ["return"] * 3,
        geodata=[
            (0, 0),    # Junction 0 (Startpunkt)
            (10, 0),   # Junction 1 (Vorlauf)
            (20, 0),   # Junction 2 (Vorlauf)
            (20, -10), # Junction 3 (Rücklauf)
            (10, -10), # Junction 4 (Rücklauf)
            (0, -10),  # Junction 5 (Endpunkt Rücklauf)
        ],
        name=[
            "Junction 0", # Junction 0
            "Junction 1", # Junction 1
            "Junction 2", # Junction 2
            "Junction 3", # Junction 3
            "Junction 4", # Junction 4
            "Junction 5" # Junction 5
        ]
    )
    pp.create_pipes_from_parameters(net, juncs[[0, 1, 3, 4]], juncs[[1, 2, 4, 5]], k_mm=0.1, length_km=1,
                                            diameter_m=0.1022, system=["flow"] * 2 + ["return"] * 2, alpha_w_per_m2k=0.4,
                                            text_k=273.15, name=[
            "Flow Pipe 1",  # Pipe von Source zu Flow Node 1
            "Flow Pipe 2",  # Pipe von Flow Node 1 zu Flow Node 2
            "Return Pipe 1", # Pipe von Return Node 1 zu Return Node 2
            "Return Pipe 2"  # Pipe von Return Node 2 zu Sink
        ])
    pp.create_circ_pump_const_pressure(net, juncs[-1], juncs[0], 5, 2, 85+273.15, type='auto', name="Pump 1")
    pp.create_heat_consumer(net, juncs[1], juncs[4], treturn_k=60+273.15, qext_w=7500, name="Heat Consumer 1")
    pp.create_heat_consumer(net, juncs[2], juncs[3], treturn_k=75+273.15, qext_w=7500, name="Heat Consumer 2")

    #hydraulics only to check for lookup heat transfer error
    pp.pipeflow(net, iter=3)

    pp.pipeflow(net, mode="bidirectional", iter=50) # played around with iter

    return net

Observations:

When both HeatConsumers are set to treturn_kwith a defined qext_w, the bidirectional calculation fails. From my understanding of the new implementation, it should be possible to define output temperatures for all HeatConsumers without needing to set controlled_mdot_kg_per_s. Is my assumption correct? Or is at least one heat consumer with a set mass flow (controlled_mdot_kg_per_s) required?

Thank you in advance for your clarification and any advice you can provide!