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

added "for_name" parameter to net.line; name all "for_name" parameter… #2150

Merged
merged 3 commits into from
Oct 20, 2023
Merged
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 @@ -29,6 +29,7 @@ Change Log
- [FIXED] powerfactory2pandapower-converter error if a line has two identical coordinates
- [ADDED] logger messages about the probabilistic load flow calculation (simultaneities) in the powerfactory2pandapower-converter for low voltage loads
- [ADDED] matplotlib v3.8.0 support (fixed :code:`plotting_colormaps.ipynb`)
- [CHANGED] PowerFactory converter - name :code:`for_name` as :code:`equipment` for all elements; also add to line
- [ADDED] option to use a second tap changer for the trafo element


Expand Down
31 changes: 17 additions & 14 deletions pandapower/converter/powerfactory/pp_import_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@
net.bus.at[bid, "substat"] = substat_descr
net.bus.at[bid, "folder_id"] = item.fold_id.loc_name

add_additional_attributes(item, net, "bus", bid,
attr_list=["sernum", "for_name", "chr_name", "cpSite.loc_name"])
add_additional_attributes(item, net, "bus", bid, attr_dict={"for_name": "equipment"},

Check warning on line 369 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L369

Added line #L369 was not covered by tests
attr_list=["sernum", "chr_name", "cpSite.loc_name"])

# add geo data
if flag_graphics == 'GPS':
Expand Down Expand Up @@ -682,6 +682,7 @@

net.line.loc[sid_list, "line_idx"] = n
net.line.loc[sid_list, "folder_id"] = item.fold_id.loc_name
net.line.loc[sid_list, "equipment"] = item.for_name

Check warning on line 685 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L685

Added line #L685 was not covered by tests
create_connection_switches(net, item, 2, 'l', (params['bus1'], params['bus2']),
(sid_list[0], sid_list[-1]))

Expand Down Expand Up @@ -1265,7 +1266,8 @@
if pf_variable_p_loads == 'plini' else 1
if item.HasAttribute('zonefact'):
params.scaling *= item.zonefact
return params

return params

Check warning on line 1270 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L1270

Added line #L1270 was not covered by tests


def find_section(load, sections):
Expand Down Expand Up @@ -1590,10 +1592,10 @@
load_type = "load"

net[load_type].loc[ld, 'description'] = ' \n '.join(item.desc) if len(item.desc) > 0 else ''
attr_list = ["sernum", "for_name", "chr_name", 'cpSite.loc_name']
attr_list = ["sernum", "chr_name", 'cpSite.loc_name']

Check warning on line 1595 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L1595

Added line #L1595 was not covered by tests
if load_class == 'ElmLodlv':
attr_list.extend(['pnight', 'cNrCust', 'cPrCust', 'UtilFactor', 'cSmax', 'cSav', 'ccosphi'])
add_additional_attributes(item, net, load_type, ld, attr_list=attr_list)
add_additional_attributes(item, net, load_type, ld, attr_dict={"for_name": "equipment"}, attr_list=attr_list)

Check warning on line 1598 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L1598

Added line #L1598 was not covered by tests
get_pf_load_results(net, item, ld, is_unbalanced)
# if not is_unbalanced:
# if item.HasResults(0): # 'm' results...
Expand Down Expand Up @@ -1756,8 +1758,8 @@
logger.debug('created sgen at index <%d>' % sg)

net[element].at[sg, 'description'] = ' \n '.join(item.desc) if len(item.desc) > 0 else ''
add_additional_attributes(item, net, element, sg,
attr_list=["sernum", "for_name", "chr_name", "cpSite.loc_name"])
add_additional_attributes(item, net, element, sg, attr_dict={"for_name": "equipment"},

Check warning on line 1761 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L1761

Added line #L1761 was not covered by tests
attr_list=["sernum", "chr_name", "cpSite.loc_name"])
net[element].at[sg, 'scaling'] = dict_net['global_parameters']['global_generation_scaling'] * item.scale0
get_pf_sgen_results(net, item, sg, is_unbalanced, element=element)

Expand Down Expand Up @@ -1877,8 +1879,8 @@
sg = pp.create_sgen(net, **params)

net.sgen.loc[sg, 'description'] = ' \n '.join(item.desc) if len(item.desc) > 0 else ''
add_additional_attributes(item, net, "sgen", sg,
attr_list=["sernum", "for_name", "chr_name", "cpSite.loc_name"])
add_additional_attributes(item, net, "sgen", sg, attr_dict={"for_name": "equipment"},

Check warning on line 1882 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L1882

Added line #L1882 was not covered by tests
attr_list=["sernum", "chr_name", "cpSite.loc_name"])

if item.HasResults(0): # 'm' results...
logger.debug('<%s> has results' % params.name)
Expand Down Expand Up @@ -1957,8 +1959,8 @@
logger.debug('created sgen at index <%s>' % sid)

net[element].loc[sid, 'description'] = ' \n '.join(item.desc) if len(item.desc) > 0 else ''
add_additional_attributes(item, net, element, sid,
attr_list=["sernum", "for_name", "chr_name", "cpSite.loc_name"])
add_additional_attributes(item, net, element, sid, attr_dict={"for_name": "equipment"},

Check warning on line 1962 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L1962

Added line #L1962 was not covered by tests
attr_list=["sernum", "chr_name", "cpSite.loc_name"])

if item.HasResults(0): # 'm' results...
logger.debug('<%s> has results' % name)
Expand Down Expand Up @@ -2005,8 +2007,8 @@
sid = pp.create_sgen(net, **params)

net.sgen.loc[sid, 'description'] = ' \n '.join(item.desc) if len(item.desc) > 0 else ''
add_additional_attributes(item, net, "sgen", sid,
attr_list=["sernum", "for_name", "chr_name", "cpSite.loc_name"])
add_additional_attributes(item, net, "sgen", sid, attr_dict={"for_name": "equipment"},

Check warning on line 2010 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L2010

Added line #L2010 was not covered by tests
attr_list=["sernum", "chr_name", "cpSite.loc_name"])

if item.HasResults(0):
net.res_sgen.at[sid, 'pf_p'] = ga(item, 'm:P:bus1') * multiplier
Expand Down Expand Up @@ -2362,7 +2364,8 @@
# create_connection_switches(net, item, 3, 't3', (bus1, bus2, bus3), (tid, tid, tid))
# logger.debug('created connection switches for trafo 3w successfully')
add_additional_attributes(item, net, element='trafo3w', element_id=tid,
attr_dict={'cpSite.loc_name': 'site', 'for_name': 'equipment', 'typ_id.loc_name': 'std_type', 'usetp': 'vm_set_pu'})
attr_dict={'cpSite.loc_name': 'site', 'for_name': 'equipment',
'typ_id.loc_name': 'std_type', 'usetp': 'vm_set_pu'})

# assign loading from power factory results
if item.HasResults(-1): # -1 for 'c' results (whatever that is...)
Expand Down
Loading