Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making available required standard type parameters #2479

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Change Log
- [ADDED] converter for European EHV grid data from JAO, the "Single Allocation Platform (SAP) for all European Transmission System Operators (TSOs) that operate in accordance to EU legislation"
- [ADDED] Add GeographicalRegion and SubGeographicalRegion names and ids to bus df in cim converter
- [CHANGED] Capitalize first letter of columns busbar_id, busbar_name and substation_id in bus df for cim converter
- [CHANGED] required standard type parameters are made available by function :code:`required_std_type_parameters()`
- [FIXED] Do not modify pandas options when importing pandapower
- [FIXED] fixed copy-paste error in contingency results "max_limit_nminus1" and "min_limit_nminus1"
- [ADDED] improved lightsim2grid documentation including compatibitliy issues
Expand Down
42 changes: 23 additions & 19 deletions pandapower/std_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@
logger = logging.getLogger(__name__)


def required_std_type_parameters(element="line"):
if element == "line":
required = ["c_nf_per_km", "r_ohm_per_km", "x_ohm_per_km", "max_i_ka"]
elif element == "line_dc":
required = ["r_ohm_per_km","max_i_ka"]
elif element == "trafo":
required = ["sn_mva", "vn_hv_kv", "vn_lv_kv", "vk_percent", "vkr_percent",
"pfe_kw", "i0_percent", "shift_degree"]
elif element == "trafo3w":
required = ["sn_hv_mva", "sn_mv_mva", "sn_lv_mva", "vn_hv_kv", "vn_mv_kv", "vn_lv_kv",
"vk_hv_percent", "vk_mv_percent", "vk_lv_percent", "vkr_hv_percent",
"vkr_mv_percent", "vkr_lv_percent", "pfe_kw", "i0_percent", "shift_mv_degree",
"shift_lv_degree"]
elif element == "fuse":
required = ["fuse_type", "i_rated_a"]
else:
raise ValueError("Unkown element type %s" % element)
return required


def create_std_type(net, data, name, element="line", overwrite=True, check_required=True):
"""
Creates type data in the type database. The parameters that are used for
Expand Down Expand Up @@ -79,25 +99,9 @@ def create_std_type(net, data, name, element="line", overwrite=True, check_requi
raise UserWarning("type data has to be given as a dictionary of parameters")

if check_required:
if element == "line":
required = ["c_nf_per_km", "r_ohm_per_km", "x_ohm_per_km", "max_i_ka"]
elif element == "line_dc":
required = ["r_ohm_per_km","max_i_ka"]
elif element == "trafo":
required = ["sn_mva", "vn_hv_kv", "vn_lv_kv", "vk_percent", "vkr_percent",
"pfe_kw", "i0_percent", "shift_degree"]
elif element == "trafo3w":
required = ["sn_hv_mva", "sn_mv_mva", "sn_lv_mva", "vn_hv_kv", "vn_mv_kv", "vn_lv_kv",
"vk_hv_percent", "vk_mv_percent", "vk_lv_percent", "vkr_hv_percent",
"vkr_mv_percent", "vkr_lv_percent", "pfe_kw", "i0_percent", "shift_mv_degree",
"shift_lv_degree"]
elif element == "fuse":
required = ["fuse_type", "i_rated_a"]
else:
raise ValueError("Unkown element type %s" % element)
for par in required:
if par not in data:
raise UserWarning("%s is required as %s type parameter" % (par, element))
missing = [par for par in required_std_type_parameters(element) if par not in data]
if len(missing):
raise UserWarning("%s are required as %s type parameters." % (missing, element))
library = net.std_types[element]
if overwrite or not (name in library):
library.update({name: data})
Expand Down
Loading