Skip to content

Commit

Permalink
Merge pull request #165 from jkisse/paper_kisse_net
Browse files Browse the repository at this point in the history
Add Schutterwald gas net
  • Loading branch information
jkisse authored Dec 8, 2020
2 parents 085b96f + e17823e commit c6e90a7
Show file tree
Hide file tree
Showing 109 changed files with 1,775 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ exclude_paths:
- '**/__init__.py'
- 'doc/**'
- 'tutorials/**'
- 'pandapipes/networks/simple_test_networks/**'
- 'pandapipes/networks/network_files/**'
- '**.yml'
- '**.rst'
1,701 changes: 1,701 additions & 0 deletions pandapipes/networks/network_files/gas_net_schutterwald_1bar.json

Large diffs are not rendered by default.

41 changes: 39 additions & 2 deletions pandapipes/networks/simple_gas_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import os
from pandapipes.io.file_io import from_json
from pandapipes import pp_dir
from pandapipes import pp_dir, drop_junctions
from pandapipes.networks.nw_aux import log_result_upon_loading

try:
Expand All @@ -13,7 +13,7 @@
import logging

logger = logging.getLogger(__name__)
gas_stanet_path = os.path.join(pp_dir, "networks", "simple_test_networks", "stanet_test_networks",
gas_stanet_path = os.path.join(pp_dir, "networks", "network_files", "stanet_test_networks",
"gas_cases")


Expand Down Expand Up @@ -231,3 +231,40 @@ def gas_2eg_hnet(method="nikuradse"):
log_result_upon_loading(logger, method=method, converter="stanet")
net_name = "H_net_N.json" if method.lower() in ["nikuradse", "n"] else "H_net_PC.json"
return from_json(os.path.join(gas_stanet_path, "two_pressure_junctions", net_name))


# -------------- Schutterwald network --------------
def schutterwald(include_houses=True, max_length_house_conn_m=None):
"""
Load natural gas distribution network for a town in the MV Oberrhein region (cf. pandapower).
The default pressure is set to 1 bar. Geodata is provided.
Around 1500 houses are connected with theoretical house connection pipes. It is recommended
to set a reasonable maximum length for the house connection pipes, e.g. 50 m.
The corresponding publication in which the net has been provided in the supplementary
material and more information on building ages etc. is given can be found here:
Kisse, J.M.; Braun, M.; Letzgus, S.; Kneiske, T.M. "A GIS-Based Planning Approach for Urban
Power and Natural Gas Distribution Grids with Different Heat Pump Scenarios".
Energies 2020, 13, 4052 https://doi.org/10.3390/en13164052
:param include_houses: Include 1506 houses as sinks. If False, all sinks and respective
junctions and connection pipes are dropped.
:type include_houses: bool, default 'True'
:param max_length_house_conn_m: Limit the maximum linear distance between houses and
distribution grid. All house connection pipes that are longer
than the given limit are set out of service.
If None, linear connections for all houses are assumed.
:type max_length_house_conn_m: float, default 'None'
:return: gas distribution net
:rtype: pandapipesNet
"""
net = from_json(os.path.join(pp_dir, 'networks', 'network_files',
'gas_net_schutterwald_1bar.json'))
if not include_houses:
drop_junctions(net, net.sink.junction.values)

if max_length_house_conn_m is not None:
net.pipe.in_service.loc[(net.pipe.type=="house_connection") &
(net.pipe.length_km > max_length_house_conn_m / 1000)] = False
return net
2 changes: 1 addition & 1 deletion pandapipes/networks/simple_heat_transfer_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

logger = logging.getLogger(__name__)

heat_tranfer_modelica_path = os.path.join(pp_dir, "networks", "simple_test_networks",
heat_tranfer_modelica_path = os.path.join(pp_dir, "networks", "network_files",
"openmodelica_test_networks", "heat_transfer_cases")

def heat_transfer_delta():
Expand Down
6 changes: 3 additions & 3 deletions pandapipes/networks/simple_water_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
import logging

logger = logging.getLogger(__name__)
water_stanet_path = os.path.join(pp_dir, "networks", "simple_test_networks", "stanet_test_networks",
water_stanet_path = os.path.join(pp_dir, "networks", "network_files", "stanet_test_networks",
"water_cases")
water_modelica_colebrook_path = os.path.join(pp_dir, "networks", "simple_test_networks",
water_modelica_colebrook_path = os.path.join(pp_dir, "networks", "network_files",
"openmodelica_test_networks", "water_cases_colebrook")

water_modelica_swamee_path = os.path.join(pp_dir, "networks", "simple_test_networks",
water_modelica_swamee_path = os.path.join(pp_dir, "networks", "network_files",
"openmodelica_test_networks", "water_cases_swamee-jain")


Expand Down
Empty file.
30 changes: 30 additions & 0 deletions pandapipes/test/networks/test_networks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2020 by Fraunhofer Institute for Energy Economics and University of Kassel
# and Energy System Technology (IEE), Kassel. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

import pandapipes as pp
import pytest
from pandapipes import networks


def test_schutterwald():
net = networks.schutterwald(True, None)
pp.pipeflow(net)
assert net.converged

net2 = networks.schutterwald(False, None)
assert net2.sink.empty
assert len(net2.pipe.loc[net2.pipe.type == "house_connection"]) == 0
pp.pipeflow(net2)
assert net2.converged

net3 = networks.schutterwald(True, 30)
assert len(net3.sink) == 1506
assert net3.pipe.loc[net3.pipe.in_service & (net3.pipe.type == "house_connection"),
"length_km"].max() <= 0.03
pp.pipeflow(net3)
assert net3.converged


if __name__ == '__main__':
n = pytest.main(["test_networks.py"])

0 comments on commit c6e90a7

Please sign in to comment.