e2nIEE / pandapipes

@@ -69,12 +69,11 @@
Loading
69 69
        area = pump_pit[:, AREA]
70 70
        idx = pump_pit[:, STD_TYPE].astype(int)
71 71
        std_types = np.array(list(net.std_type['pump'].keys()))[idx]
72 -
        p_scale = get_net_option(net, "p_scale")
73 72
        from_nodes = pump_pit[:, FROM_NODE].astype(np.int32)
74 73
        # to_nodes = pump_pit[:, TO_NODE].astype(np.int32)
75 74
        fluid = get_fluid(net)
76 -
        p_from = node_pit[from_nodes, PAMB] + node_pit[from_nodes, PINIT] * p_scale
77 -
        # p_to = node_pit[to_nodes, PAMB] + node_pit[to_nodes, PINIT] * p_scale
75 +
        p_from = node_pit[from_nodes, PAMB] + node_pit[from_nodes, PINIT]
76 +
        # p_to = node_pit[to_nodes, PAMB] + node_pit[to_nodes, PINIT]
78 77
        numerator = NORMAL_PRESSURE * pump_pit[:, TINIT]
79 78
        v_mps = pump_pit[:, VINIT]
80 79
        if fluid.is_gas:

@@ -22,7 +22,7 @@
Loading
22 22
    :rtype: pandapipesNet
23 23
24 24
    :Example:
25 -
        >>> pandapipes.networks.simple_water_networks.heat_transfer_delta()
25 +
        >>> pandapipes.networks.simple_heat_transfer_networks.heat_transfer_delta()
26 26
27 27
    """
28 28
    return from_json(os.path.join(heat_tranfer_modelica_path, "delta.json"))
@@ -35,7 +35,7 @@
Loading
35 35
    :rtype: pandapipesNet
36 36
37 37
    :Example:
38 -
        >>> pandapipes.networks.simple_water_networks.heat_transfer_delta_2sinks()
38 +
        >>> pandapipes.networks.simple_heat_transfer_networks.heat_transfer_delta_2sinks()
39 39
40 40
    """
41 41
    return from_json(os.path.join(heat_tranfer_modelica_path, "delta_2sinks.json"))
@@ -48,7 +48,7 @@
Loading
48 48
    :rtype: pandapipesNet
49 49
50 50
    :Example:
51 -
        >>> pandapipes.networks.simple_water_networks.heat_transfer_heights()
51 +
        >>> pandapipes.networks.simple_heat_transfer_networks.heat_transfer_heights()
52 52
53 53
    """
54 54
    return from_json(os.path.join(heat_tranfer_modelica_path, "heights.json"))
@@ -61,7 +61,7 @@
Loading
61 61
    :rtype: pandapipesNet
62 62
63 63
    :Example:
64 -
        >>> pandapipes.networks.simple_water_networks.heat_transfer_one_pipe()
64 +
        >>> pandapipes.networks.simple_heat_transfer_networks.heat_transfer_one_pipe()
65 65
66 66
    """
67 67
    return from_json(os.path.join(heat_tranfer_modelica_path, "one_pipe.json"))
@@ -74,7 +74,7 @@
Loading
74 74
    :rtype: pandapipesNet
75 75
76 76
    :Example:
77 -
        >>> pandapipes.networks.simple_water_networks.heat_transfer_one_source()
77 +
        >>> pandapipes.networks.simple_heat_transfer_networks.heat_transfer_one_source()
78 78
79 79
    """
80 80
    return from_json(os.path.join(heat_tranfer_modelica_path, "one_source.json"))
@@ -87,7 +87,7 @@
Loading
87 87
    :rtype: pandapipesNet
88 88
89 89
    :Example:
90 -
        >>> pandapipes.networks.simple_water_networks.heat_transfer_section_variation()
90 +
        >>> pandapipes.networks.simple_heat_transfer_networks.heat_transfer_section_variation()
91 91
92 92
    """
93 93
    return from_json(os.path.join(heat_tranfer_modelica_path, "section_variation.json"))
@@ -100,7 +100,7 @@
Loading
100 100
    :rtype: pandapipesNet
101 101
102 102
    :Example:
103 -
        >>> pandapipes.networks.simple_water_networks.heat_transfer_t_cross()
103 +
        >>> pandapipes.networks.simple_heat_transfer_networks.heat_transfer_t_cross()
104 104
105 105
    """
106 106
    return from_json(os.path.join(heat_tranfer_modelica_path, "t_cross.json"))
@@ -113,7 +113,7 @@
Loading
113 113
    :rtype: pandapipesNet
114 114
115 115
    :Example:
116 -
        >>> pandapipes.networks.simple_water_networks.heat_transfer_two_pipes()
116 +
        >>> pandapipes.networks.simple_heat_transfer_networks.heat_transfer_two_pipes()
117 117
118 118
    """
119 -
    return from_json(os.path.join(heat_tranfer_modelica_path, "two_pipes.json"))

@@ -227,12 +227,10 @@
Loading
227 227
            gas_mode = fluid.is_gas
228 228
229 229
            if gas_mode:
230 -
                p_scale = get_net_option(net, "p_scale")
231 -
232 230
                from_nodes = pipe_pit[v_nodes, FROM_NODE].astype(np.int32)
233 231
                to_nodes = pipe_pit[v_nodes, TO_NODE].astype(np.int32)
234 -
                p_from = node_pit[from_nodes, PAMB] + node_pit[from_nodes, PINIT] * p_scale
235 -
                p_to = node_pit[to_nodes, PAMB] + node_pit[to_nodes, PINIT] * p_scale
232 +
                p_from = node_pit[from_nodes, PAMB] + node_pit[from_nodes, PINIT]
233 +
                p_to = node_pit[to_nodes, PAMB] + node_pit[to_nodes, PINIT]
236 234
                p_mean = np.where(p_from == p_to, p_from,
237 235
                                  2 / 3 * (p_from ** 3 - p_to ** 3) / (p_from ** 2 - p_to ** 2))
238 236
                numerator = NORMAL_PRESSURE * node_pit[v_nodes, TINIT_NODE]

@@ -149,21 +149,21 @@
Loading
149 149
150 150
        return self.get_property("molar_mass")
151 151
152 -
    def get_compressibility(self, temperature):
152 +
    def get_compressibility(self, p_bar):
153 153
        """
154 -
        This function returns the compressibility at a certain temperature.
154 +
        This function returns the compressibility at a certain pressure.
155 155
156 -
        :param temperature: Temperature at which the compressibility is queried
157 -
        :type temperature: float
158 -
        :return: compressibility at the required temperature
156 +
        :param p_bar: pressure at which the compressibility is queried
157 +
        :type p_bar: float or array of floats
158 +
        :return: compressibility at the required pressure
159 159
160 160
        """
161 161
162 -
        return self.get_property("compressibility", temperature)
162 +
        return self.get_property("compressibility", p_bar)
163 163
164 164
    def get_der_compressibility(self):
165 165
        """
166 -
        This function returns the derivative of the compressibility.
166 +
        This function returns the derivative of the compressibility with respect to pressure.
167 167
168 168
        :return: derivative of the compressibility
169 169

@@ -33,7 +33,7 @@
Loading
33 33
34 34
setup(
35 35
    name='pandapipes',
36 -
    version='0.4.0',
36 +
    version='0.5.0',
37 37
    author='Dennis Cronbach, Daniel Lohmeier, Simon Ruben Drauz, Jolando Marius Kisse',
38 38
    author_email='dennis.cronbach@iee.fraunhofer.de, daniel.lohmeier@iee.fraunhofer.de, '
39 39
                 'simon.ruben.drauz@iee.fraunhofer.de, jolando.kisse@uni-kassel.de',
@@ -42,7 +42,7 @@
Loading
42 42
	long_description_content_type='text/x-rst',
43 43
    url='http://www.pandapipes.org',
44 44
    license='BSD',
45 -
    install_requires=["pandapower>=2.6.0", "matplotlib"],
45 +
    install_requires=["pandapower>=2.7.0", "matplotlib"],
46 46
    extras_require={"docs": ["numpydoc", "sphinx", "sphinx_rtd_theme", "sphinxcontrib.bibtex"],
47 47
                    "plotting": ["plotly", "python-igraph"],
48 48
                    "test": ["pytest", "pytest-xdist"]},

@@ -129,8 +129,7 @@
Loading
129 129
           - run (funct, e.g. pandapower.runpp, pandapipes.pipeflow): function to be used to
130 130
             conduct a loadflow/pipeflow \n
131 131
           - initial_run (boolean): Is a initial_run for a net required or not\n
132 -
           - continue_on_divergence (boolean): What to do if loadflow/pipeflow is not converging,
133 -
         fires control_repair
132 +
           - continue_on_divergence (boolean): What to do if loadflow/pipeflow is not converging, fires control_repair
134 133
    :type ctrl_variables: dict, default: None
135 134
    :param max_iter: number of iterations for each controller to converge
136 135
    :type max_iter: int, default: 30

@@ -162,9 +162,6 @@
Loading
162 162
            branch_component_pit[:, JAC_DERIV_DP] = -1
163 163
            branch_component_pit[:, JAC_DERIV_DP1] = 1
164 164
        else:
165 -
            # Formulas for gas pressure loss according to laminar version described in STANET 10
166 -
            # manual, page 1623
167 -
168 165
            # compressibility settings
169 166
            p_m = np.empty_like(p_init_i_abs)
170 167
            mask = p_init_i_abs != p_init_i1_abs
@@ -312,7 +309,6 @@
Loading
312 309
313 310
        from_nodes = branch_pit[:, FROM_NODE].astype(np.int32)
314 311
        to_nodes = branch_pit[:, TO_NODE].astype(np.int32)
315 -
        p_scale = get_net_option(net, "p_scale")
316 312
        fluid = get_fluid(net)
317 313
318 314
        v_mps = branch_pit[:, VINIT]
@@ -328,8 +324,8 @@
Loading
328 324
329 325
        if fluid.is_gas:
330 326
            # derived from the ideal gas law
331 -
            p_from = node_pit[from_nodes, PAMB] + node_pit[from_nodes, PINIT] * p_scale
332 -
            p_to = node_pit[to_nodes, PAMB] + node_pit[to_nodes, PINIT] * p_scale
327 +
            p_from = node_pit[from_nodes, PAMB] + node_pit[from_nodes, PINIT]
328 +
            p_to = node_pit[to_nodes, PAMB] + node_pit[to_nodes, PINIT]
333 329
            numerator = NORMAL_PRESSURE * branch_pit[:, TINIT]
334 330
            normfactor_from = numerator * fluid.get_property("compressibility", p_from) \
335 331
                              / (p_from * NORMAL_TEMPERATURE)

@@ -9,7 +9,7 @@
Loading
9 9
10 10
from pandapower.io_utils import PPJSONEncoder, to_dict_with_coord_transform, \
11 11
    get_raw_data_from_pickle, transform_net_with_df_and_geo, PPJSONDecoder
12 -
from pandapower.io_utils import pp_hook
12 +
from pandapower.io_utils import pp_hook, encrypt_string, decrypt_string
13 13
14 14
from pandapipes.io.convert_format import convert_format
15 15
from pandapipes.io.io_utils import isinstance_partial, FromSerializableRegistryPpipe
@@ -42,7 +42,7 @@
Loading
42 42
        pickle.dump(save_net, f, protocol=2)  # use protocol 2 for py2 / py3 compatibility
43 43
44 44
45 -
def to_json(net, filename=None):
45 +
def to_json(net, filename=None, encryption_key=None):
46 46
    """
47 47
    Saves a pandapipes Network in JSON format. The index columns of all pandas DataFrames will be
48 48
    saved in ascending order. net elements which name begins with "_" (internal elements) will not
@@ -53,6 +53,8 @@
Loading
53 53
    :param filename: The absolute or relative path to the output file or a writable file-like \
54 54
            object. If None, a JSON string is returned.
55 55
    :type filename: str, file-object, default None
56 +
    :param encryption_key: If given, the pandapipes network is stored as an encrypted json string
57 +
    :type encryption_key: str, default None
56 58
    :return: JSON string of the Network (only if filename is None)
57 59
58 60
    :Example:
@@ -60,13 +62,16 @@
Loading
60 62
        >>> pandapipes.to_json(net, "example.json")
61 63
62 64
    """
65 +
    json_string = json.dumps(net, cls=PPJSONEncoder, indent=2, isinstance_func=isinstance_partial)
66 +
    if encryption_key is not None:
67 +
        json_string = encrypt_string(json_string, encryption_key)
63 68
    if filename is None:
64 -
        return json.dumps(net, cls=PPJSONEncoder, indent=2, isinstance_func=isinstance_partial)
69 +
        return json_string
65 70
    if hasattr(filename, 'write'):
66 -
        json.dump(net, fp=filename, cls=PPJSONEncoder, indent=2, isinstance_func=isinstance_partial)
71 +
        filename.write(json_string)
67 72
    else:
68 73
        with open(filename, "w") as fp:
69 -
            json.dump(net, fp=fp, cls=PPJSONEncoder, indent=2, isinstance_func=isinstance_partial)
74 +
            fp.write(json_string)
70 75
71 76
72 77
def from_pickle(filename):
@@ -89,7 +94,7 @@
Loading
89 94
    return net
90 95
91 96
92 -
def from_json(filename, convert=True):
97 +
def from_json(filename, convert=True, encryption_key=None):
93 98
    """
94 99
    Load a pandapipes network from a JSON file or string.
95 100
    The index of the returned network is not necessarily in the same order as the original network.
@@ -99,6 +104,8 @@
Loading
99 104
    :type filename: str, file-object
100 105
    :param convert: whether or not to convert the format from earlier versions
101 106
    :type convert: bool
107 +
    :param encryption_key: if given, key to decrypt an encrypted pandapower network
108 +
    :type encryption_key: str
102 109
    :return: net - The pandapipes network that was saved as JSON
103 110
    :rtype: pandapipesNet
104 111
@@ -114,10 +121,10 @@
Loading
114 121
    else:
115 122
        with open(filename) as fp:
116 123
            json_string = fp.read()
117 -
    return from_json_string(json_string, convert=convert)
124 +
    return from_json_string(json_string, convert=convert, encryption_key=encryption_key)
118 125
119 126
120 -
def from_json_string(json_string, convert=False):
127 +
def from_json_string(json_string, convert=False, encryption_key=None):
121 128
    """
122 129
    Load a pandapipes network from a JSON string.
123 130
    The index of the returned network is not necessarily in the same order as the original network.
@@ -127,6 +134,8 @@
Loading
127 134
    :type json_string: str
128 135
    :param convert: whether or not to convert the format from earlier versions
129 136
    :type convert: bool
137 +
    :param encryption_key: if given, key to decrypt an encrypted pandapower network
138 +
    :type encryption_key: str
130 139
    :return: net - The pandapipes network that was contained in the JSON string
131 140
    :rtype: pandapipesNet
132 141
@@ -135,6 +144,9 @@
Loading
135 144
        >>> net = pandapipes.from_json_string(json_str)
136 145
137 146
    """
147 +
    if encryption_key is not None:
148 +
        json_string = decrypt_string(json_string, encryption_key)
149 +
138 150
    net = json.loads(json_string, cls=PPJSONDecoder, object_hook=partial(pp_hook,
139 151
                                                                         registry_class=FromSerializableRegistryPpipe))
140 152

@@ -271,7 +271,7 @@
Loading
271 271
    :type diameter_m: float
272 272
    :param qext_w: External heat flux in [W]. If positive, heat is derived from the network. If
273 273
            negative, heat is being fed into the network from a heat source.
274 -
    :type qext_w: float, default 0.0
274 +
    :type qext_w: float
275 275
    :param loss_coefficient: An additional pressure loss coefficient, introduced by e.g. bends
276 276
    :type loss_coefficient: float
277 277
    :param name: The name of the heat exchanger

@@ -23,7 +23,7 @@
Loading
23 23
24 24
default_options = {"friction_model": "nikuradse", "converged": False, "tol_p": 1e-4, "tol_v": 1e-4,
25 25
                   "tol_T": 1e-3, "tol_res": 1e-3, "iter": 10, "error_flag": False, "alpha": 1,
26 -
                   "nonlinear_method": "constant", "p_scale": 1, "mode": "hydraulics",
26 +
                   "nonlinear_method": "constant", "mode": "hydraulics",
27 27
                   "ambient_temperature": 293, "check_connectivity": True,
28 28
                   "max_iter_colebrook": 100, "only_update_hydraulic_matrix": False,
29 29
                   "reuse_internal_data": False,
@@ -229,12 +229,8 @@
Loading
229 229
                 same in each iteration) or "automatic", in which case **alpha** is adapted \
230 230
                 automatically with respect to the convergence behaviour.
231 231
232 -
        - **gas_impl** (str): "pandapipes" - Implementation of the gas model. It can be set to\
233 -
                "pandapipes" with calculations according to  "Handbuch der Gasversorgungstechnik"\
234 -
                 or to "STANET" with calculations according to the STANET reference.
235 -
236 -
        - **heat_transfer** (bool): False - Flag to determine if the heat transfer shall be\
237 -
                calculated.
232 +
        - **mode** (str): "hydraulics" - Define the calculation mode: what shall be calculated -
233 +
                solely hydraulics ('hydraulic'), solely heat transfer('heat') or both combined ('all').
238 234
239 235
        - **only_update_hydraulic_matrix** (bool): False - If True, the system matrix is not \
240 236
                created in every iteration, but only the data is updated according to a lookup that\

@@ -4,3 +4,4 @@
Loading
4 4
5 5
from pandapipes.networks.simple_gas_networks import *
6 6
from pandapipes.networks.simple_water_networks import *
7 +
from pandapipes.networks.simple_heat_transfer_networks import *

@@ -2,7 +2,7 @@
Loading
2 2
# and Energy System Technology (IEE), Kassel, and University of Kassel. All rights reserved.
3 3
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4 4
5 -
__version__ = '0.4.0'
5 +
__version__ = '0.5.0'
6 6
7 7
import pandas as pd
8 8
import os
Files Coverage
pandapipes 90.96%
setup.py 0.00%
Project Totals (74 files) 90.62%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading