Skip to content

Commit

Permalink
cim converter: Avoid huge logging output when ignore_erros = True (#2270
Browse files Browse the repository at this point in the history
)

* - [FIXED] bug in :code:`cim2pp`: Changed zero prioritized generators with voltage controller to sgens (like PowerFactory does)
- [ADDED] cim2pp: added description fields for each asset and added BusbarSection information to nodes

* changed logging TopologicalNodes warning

* changed logging TopologicalNodes warning

* cim converter: Avoid huge logging output when ignore_erros = True
  • Loading branch information
mrifraunhofer authored Apr 18, 2024
1 parent 7fd9930 commit 95b41bf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Change Log
- [CHANGED] updated upload_release.py to install the uploadad package and print the version
- [CHANGED] updated MANIFEST.in to exclude the ci files from the wheel distribution
- [CHANGED] cim data structure method in cim converter changed to blueprint approach
- [CHANGED] cim converter: Avoid huge logging output when ignore_erros = True
- [FIXED] massive performance drag in large grids due to initializing Ybus for FACTS with np.zeros instead of using sparse matrix initialization
- [FIXED] further futurewarnings and deprecation warnings

Expand Down
2 changes: 1 addition & 1 deletion pandapower/converter/cim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# and Energy System Technology (IEE), Kassel. All rights reserved.
from .cim2pp import from_cim

__version__ = '3.6.9'
__version__ = '3.6.10'
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _prepare_connectivity_nodes_cim16(self) -> Tuple[pd.DataFrame, pd.DataFrame]
inplace=True)
connectivity_nodes = pd.merge(connectivity_nodes, eq_bd_cns, how='left', on='rdfId')
connectivity_nodes['BaseVoltage'].fillna(connectivity_nodes['BaseVoltage_2'], inplace=True)
connectivity_nodes = connectivity_nodes.drop(columns=['BaseVoltage_2'])
connectivity_nodes.drop(columns=['BaseVoltage_2'], inplace=True)
# check if there is a mix between BB and NB models
terminals_temp = \
self.cimConverter.cim['eq']['Terminal'].loc[
Expand Down Expand Up @@ -211,7 +211,8 @@ def _prepare_connectivity_nodes_cim16(self) -> Tuple[pd.DataFrame, pd.DataFrame]
if 'TopologicalNode_2' in connectivity_nodes.columns:
connectivity_nodes['TopologicalNode'].fillna(connectivity_nodes['TopologicalNode_2'], inplace=True)
connectivity_nodes = connectivity_nodes.drop(columns=['TopologicalNode_2'])
if connectivity_nodes.index.size != connectivity_nodes_size:
if connectivity_nodes.index.size != connectivity_nodes_size and not self.cimConverter.kwargs.get(
'ignore_errors', True):
self.logger.warning("There is a problem at the busses!")
self.cimConverter.report_container.add_log(Report(
level=LogLevel.WARNING, code=ReportCode.WARNING_CONVERTING,
Expand All @@ -225,9 +226,6 @@ def _prepare_connectivity_nodes_cim16(self) -> Tuple[pd.DataFrame, pd.DataFrame]
self.cimConverter.report_container.add_log(Report(
level=LogLevel.WARNING, code=ReportCode.WARNING_CONVERTING,
message="The ConnectivityNode with RDF ID %s has %s TopologicalNodes!" % (rdfId, count)))
# raise ValueError("The number of ConnectivityNodes increased after merging with Terminals, number of "
# "ConnectivityNodes before merge: %s, number of ConnectivityNodes after merge: %s" %
# (connectivity_nodes_size, connectivity_nodes.index.size))
connectivity_nodes = connectivity_nodes.drop_duplicates(subset=['rdfId'], keep='first')
# add the busbars
bb = self.cimConverter.cim['eq']['BusbarSection'][['rdfId', 'name']]
Expand All @@ -237,8 +235,8 @@ def _prepare_connectivity_nodes_cim16(self) -> Tuple[pd.DataFrame, pd.DataFrame]
bb = bb.drop_duplicates(subset=['rdfId'], keep='first')
connectivity_nodes = pd.merge(connectivity_nodes, bb, how='left', on='rdfId')

connectivity_nodes = connectivity_nodes.rename(columns={'rdfId': sc['o_id'], 'TopologicalNode': sc['ct'], 'nominalVoltage': 'vn_kv',
'name_substation': 'zone'})
connectivity_nodes = connectivity_nodes.rename(columns={'rdfId': sc['o_id'], 'TopologicalNode': sc['ct'],
'nominalVoltage': 'vn_kv', 'name_substation': 'zone'})
connectivity_nodes['in_service'] = True
connectivity_nodes['type'] = 'b'
return connectivity_nodes, eqssh_terminals
4 changes: 2 additions & 2 deletions pandapower/converter/cim/cim_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def extend_pp_net_cim(net: pandapowerNet, override: bool = True) -> pandapowerNe
fill_dict['gen'][np_float_type] = \
['min_p_mw', 'max_p_mw', 'min_q_mvar', 'max_q_mvar', 'vn_kv', 'rdss_ohm', 'xdss_pu', 'cos_phi', 'pg_percent']
fill_dict['sgen'] = dict()
fill_dict['sgen'][np_str_type] = [sc['t'], 'description']
fill_dict['sgen'][np_float_type] = ['k', 'rx', 'vn_kv', 'rdss_ohm', 'xdss_pu', 'lrc_pu', 'generator_type']
fill_dict['sgen'][np_str_type] = [sc['t'], 'description', 'generator_type']
fill_dict['sgen'][np_float_type] = ['k', 'rx', 'vn_kv', 'rdss_ohm', 'xdss_pu', 'lrc_pu']
fill_dict['motor'] = dict()
fill_dict['motor'][np_str_type] = [sc['t'], 'description']
fill_dict['storage'] = dict()
Expand Down

0 comments on commit 95b41bf

Please sign in to comment.