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 pandapipes.component_models.ext_grid_component import ExtGrid
7 1
from pandapipes.idx_node import PINIT
8 1
from pandapipes.pipeflow_setup import get_lookup
9

10 1
try:
11 1
    import pplog as logging
12 1
except ImportError:
13 1
    import logging
14

15 1
logger = logging.getLogger(__name__)
16

17

18 1
class CirculationPump(ExtGrid):
19

20 1
    @classmethod
21
    def sign(cls):
22 1
        return -1.
23

24 1
    @classmethod
25
    def extract_results(cls, net, options, node_name):
26
        """
27
        Function that extracts certain results.
28

29
        :param net: The pandapipes network
30
        :type net: pandapipesNet
31
        :param options:
32
        :type options:
33
        :param node_name:
34
        :type node_name:
35
        :return: No Output.
36
        """
37 1
        res_table, circ_pump, index_nodes_from, node_pit, _ = \
38
            super().extract_results(net, options, node_name)
39

40 1
        index_juncts_to = circ_pump.to_junction.values
41 1
        junct_uni_to = np.array(list(set(index_juncts_to)))
42 1
        index_nodes_to = get_lookup(net, "node", "index")[node_name][junct_uni_to]
43

44 1
        deltap_bar = node_pit[index_nodes_from, PINIT] - node_pit[index_nodes_to, PINIT]
45 1
        res_table["deltap_bar"].values[:] = deltap_bar
46

47 1
    @classmethod
48
    def get_connected_junction(cls, net):
49 1
        junction = net[cls.table_name()].from_junction
50 1
        return junction
51

52 1
    @classmethod
53
    def get_result_table(cls, net):
54
        """
55

56
        :param net: The pandapipes network
57
        :type net: pandapipesNet
58
        :return: (columns, all_float) - the column names and whether they are all float type. Only
59
                if False, returns columns as tuples also specifying the dtypes
60
        :rtype: (list, bool)
61
        """
62 1
        return ["mdot_kg_per_s", "deltap_bar"], True

Read our documentation on viewing source code .

Loading