1
|
|
# Copyright (c) 2020 by Fraunhofer Institute for Energy Economics
|
2
|
|
# and Energy System Technology (IEE), Kassel. All rights reserved.
|
3
|
|
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
4
|
|
|
5
|
1
|
import numpy as np
|
6
|
1
|
from numpy import dtype
|
7
|
1
|
from pandapipes.component_models.abstract_models import CirculationPump
|
8
|
1
|
from pandapipes.idx_node import LOAD
|
9
|
1
|
from pandapipes.internals_toolbox import _sum_by_group
|
10
|
1
|
from pandapipes.pipeflow_setup import get_lookup
|
11
|
|
|
12
|
1
|
try:
|
13
|
1
|
import pplog as logging
|
14
|
1
|
except ImportError:
|
15
|
1
|
import logging
|
16
|
|
|
17
|
1
|
logger = logging.getLogger(__name__)
|
18
|
|
|
19
|
|
|
20
|
1
|
class CirculationPumpMass(CirculationPump):
|
21
|
|
|
22
|
1
|
@classmethod
|
23
|
|
def table_name(cls):
|
24
|
1
|
return "circ_pump_mass"
|
25
|
|
|
26
|
1
|
@classmethod
|
27
|
|
def create_pit_node_entries(cls, net, node_pit, node_name):
|
28
|
|
"""
|
29
|
|
Function which creates pit node entries.
|
30
|
|
|
31
|
|
:param net: The pandapipes network
|
32
|
|
:type net: pandapipesNet
|
33
|
|
:param node_pit:
|
34
|
|
:type node_pit:
|
35
|
|
:param node_name:
|
36
|
|
:type node_name:
|
37
|
|
:return: No Output.
|
38
|
|
"""
|
39
|
1
|
circ_pump, _ = super().create_pit_node_entries(net, node_pit, node_name)
|
40
|
|
|
41
|
1
|
mf = np.nan_to_num(circ_pump.mdot_kg_per_s.values)
|
42
|
1
|
mass_flow_loads = mf * circ_pump.in_service.values
|
43
|
1
|
juncts, loads_sum = _sum_by_group(circ_pump.to_junction.values, mass_flow_loads)
|
44
|
1
|
junction_idx_lookups = get_lookup(net, "node", "index")[node_name]
|
45
|
1
|
index = junction_idx_lookups[juncts]
|
46
|
1
|
node_pit[index, LOAD] += loads_sum
|
47
|
|
|
48
|
1
|
@classmethod
|
49
|
|
def get_component_input(cls):
|
50
|
|
"""
|
51
|
|
|
52
|
|
:return:
|
53
|
|
:rtype:
|
54
|
|
"""
|
55
|
1
|
return [("name", dtype(object)),
|
56
|
|
("from_junction", "u4"),
|
57
|
|
("to_junction", "u4"),
|
58
|
|
("p_bar", "f8"),
|
59
|
|
("t_k", "f8"),
|
60
|
|
("mdot_kg_per_s", "f8"),
|
61
|
|
("in_service", 'bool'),
|
62
|
|
("type", dtype(object))]
|