Skip to content

Commit

Permalink
Refactor parse source file method in cim parser (e2nIEE#2300)
Browse files Browse the repository at this point in the history
* add reading inService attribute from cim100 ssh profiles

* adapt handling of inService attribute

* Add std_dev values for all components

* Delete line for current that is already included in the added code

* bugfix inService handling

* fix merging approach for asynchronous machines and generating units

* add handling of op and sc profiles in cgmes converter for v3

* add source, origin_class and origin_id columns to measurement dataframe

* add description to measurement dataframe

* put Analog and AnalogValue ids into measurement dataframe

* adapt eq, ssh and sc profiles of cim converter

* update cim 100 schema

* remove unused elements from cim100 data structure

* fix usage of MeasurementValueSource

* set default value of power transformer end grounded to True

* fix handling of kind/limitType of OperationalLimitType

* add changelog entry for convert cgmes v3.0

* adapt converter documentation for cgmes v3.0

* add basic test for converting cgmes v3.0

* fix type hint error in python 3.8

* refactor parse source file in cim converter

---------

Co-authored-by: AzureAD\DimitriosZografos <[email protected]>
  • Loading branch information
JakobKirschner and AzureAD\DimitriosZografos committed Jun 4, 2024
1 parent 4c73c49 commit 99ffdb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ 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
- [CHANGED] cim converter: Avoid huge logging output when ignore_errors = True
- [CHANGED] cim parser: Refactor parse source file method
- [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
- [FIXED] minor issues in geojson exporter
Expand Down
7 changes: 6 additions & 1 deletion pandapower/converter/cim/cim_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,16 @@ def _parse_source_file(self, file: str, output: dict, encoding: str, profile_nam
else:
prf = profile_name
self.file_names[prf] = file
self._parse_xml_tree(xml_tree, prf, output)

def _parse_xml_tree(self, xml_tree: xmlET, profile_name: str, output: Dict | None = None):
output = self.cim if output is None else output
# get all CIM elements to parse
element_types = pd.Series([ele.tag for ele in list(xml_tree)])
element_types.drop_duplicates(inplace=True)
prf_content: Dict[str, pd.DataFrame] = dict()
ns_dict = dict()
prf = profile_name
if prf not in ns_dict.keys():
ns_dict[prf] = dict()
for _, element_type in element_types.items():
Expand All @@ -513,7 +518,7 @@ def _parse_source_file(self, file: str, output: dict, encoding: str, profile_nam
if col_new.endswith('-resource'):
col_new = col_new[:-9]
# remove the first character of each value if col_new is a CGMES class, e.g. Terminal
# other wise remove the namespace from the literals (e.g. col_new is unitMultiplier, then the
# otherwise remove the namespace from the literals (e.g. col_new is unitMultiplier, then the
# value is like http://iec.ch/TC57/2013/CIM-schema-cim16#UnitMultiplier.M
if col_new[0].isupper():
prf_content[element_type_c][col] = prf_content[element_type_c][col].str[1:]
Expand Down

0 comments on commit 99ffdb4

Please sign in to comment.