Skip to content

Commit

Permalink
Merge pull request #2315 from mfranz13/feature/lv_schutterwald
Browse files Browse the repository at this point in the history
added LV Schutterwald with test to pandapower
  • Loading branch information
mfranz13 authored Jul 4, 2024
2 parents 6f1113d + 7755d51 commit 5b15c72
Show file tree
Hide file tree
Showing 5 changed files with 2,167 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Change Log

[upcoming release] - 2024-..-..
-------------------------------
- [ADDED] low voltage grid Schutterwald
- [FIXED] trafo3w with tap changer at star point corrected
- [FIXED] namespace changes from numpy 2.0 release
- [CHANGED] inf to np.full(...) with value inf for array operations in pypower folder
Expand Down
1 change: 1 addition & 0 deletions pandapower/networks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
from pandapower.networks.power_system_test_cases import *
from pandapower.networks.simple_pandapower_test_networks import *
from pandapower.networks.ieee_europen_lv_asymmetric import *
from pandapower.networks.lv_schutterwald import *
2,048 changes: 2,048 additions & 0 deletions pandapower/networks/lv_schutterwald.json

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions pandapower/networks/lv_schutterwald.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2016-2024 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.


import os

import pandapower as pp
import pandapower.topology as top
import pandapower.plotting.geo as geo
from pandapower import pp_dir


def lv_schutterwald(separation_by_sub=False, include_heat_pumps=False, **kwargs):
"""
Loads the Schutterwald network, a generic 0.4 kV network serviced by 14 MV/LV transformer
stations of the Oberrhein network.
The network supplies 1506 customers with the option of including 1251 heat pumps.
The network also includes geographical information of lines and buses for plotting.
Source: https://doi.org/10.3390/en13164052
OPTIONAL:
**separation_by_sub** - (bool, False): if True, the network gets separated into 14
sections, referring to their substations
**include_heat_pumps** - (bool, False): if True, the heat pumps from the study are
included in the network
OUTPUT:
**net** - pandapower network
**subnets** (list) - all sections of the pandapower network
EXAMPLE:
``import pandapower.networks``
``net = pandapower.networks.lv_schutterwald()``
or with separation
``net_list = pandapower.networks.lv_schutterwald(separation_by_sub=True)``
"""

net = pp.from_json(os.path.join(pp_dir, "networks", "lv_schutterwald.json"), **kwargs)

# modifications on the original file
# geo.convert_crs(net, epsg_out=4326, epsg_in=31467)
# geo.convert_geodata_to_geojson(net, lonlat=False)
# pp.drop_inactive_elements(net)
# net.load.replace({"type": "WP"}, "HP", inplace=True)
# net.load.replace({"type": "HA"}, "HH", inplace=True)
# net.load.name = net.load.name.str.replace("H", "HH", regex=False)
# net.load.name = net.load.name.str.replace("WP", "HP", regex=False)

if not include_heat_pumps:
pp.drop_elements(net, "load", net.load.loc[net.load.type == "HP"].index)

subnets = list()
if separation_by_sub:
# creating multigraph
mg = top.create_nxgraph(net)
# clustering connected buses
zones = [list(area) for area in top.connected_components(mg)]
for i, zone in enumerate(zones):
net1 = pp.select_subnet(net, buses=zone, include_switch_buses=False,
include_results=True, keep_everything_else=True)
pp.runpp(net1)
net1.name = f'LV Schutterwald {i}'
subnets.append(net1)
return subnets

pp.runpp(net)
net.name = 'LV Schutterwald'
return net
39 changes: 39 additions & 0 deletions pandapower/test/networks/test_lv_schutterwald.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2016-2024 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.


import pytest

import pandapower as pp
import pandapower.networks as pn


def test_lv_schutterwald():
include_heat_pumps = [False, True]
separation_by_sub = [False, True]

for j in include_heat_pumps:
for k in separation_by_sub:
net = pn.lv_schutterwald(include_heat_pumps=j)
pp.runpp(net)

if j is False:
assert len(net.load.bus) == 1506
elif j is True:
assert len(net.load.bus) == 2757

assert len(net.line) == 3000
assert len(net.switch) == 378
assert net.converged

if k is True:
subnets = pn.lv_schutterwald(include_heat_pumps=j, separation_by_sub=k)
assert all(len(subnets[0].keys()) == len(subnet.keys()) for subnet in subnets[1:])
assert len(net.bus) == sum(len(subnet.bus) for subnet in subnets)
assert all(subnet.converged for subnet in subnets)


if __name__ == '__main__':
pytest.main([__file__, "-xs"])

0 comments on commit 5b15c72

Please sign in to comment.