-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2315 from mfranz13/feature/lv_schutterwald
added LV Schutterwald with test to pandapower
- Loading branch information
Showing
5 changed files
with
2,167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]) |