cimpy.cimimport module

cimpy.cimimport.cim_import(xml_files, cgmes_version, start_dict=None)[source]

Function to read cimgen files and instantiate the classes

This function parses xml files containing a cgmes topology and instantiates these classes with their attributes. The instantiation is done in two steps. In the first step all classes are instantiated with default values and in a second step the attributes contained in the xml files are set. The origin of all classes and attributes are stored in the class attribute serializationProfile.

Parameters
  • xml_files – CIM RDF/XML file.

  • cgmes_version – cgmes version, e.g. “cgmes_v2_4_15”

  • start_dict – a list of classes which indicates which classes will be read e.g. elements=[“BaseVoltage”, “ACLineSegment”] * If start_dict=None the complete file will be read

Returns

import_result: a dictionary containing the topology and meta information. The topology can be extracted via import_result[‘topology’]. The topology dictionary contains all objects accessible via their mRID. The meta information can be extracted via import_result[‘meta_info’]. The meta_info dictionary contains a new dictionary with the keys: ‘author’, ‘namespaces’ and ‘urls’. The last two are also dictionaries. ‘urls’ contains a mapping between references to URLs and the extracted value of the URL, e.g. ‘absoluteValue’: ‘http://iec.ch/TC57/2012/CIM-schema-cim16#OperationalLimitDirectionKind.absoluteValue’ These mappings are accessible via the name of the attribute, e.g. import_result[‘meta_info’][‘urls’}[attr_name] = {mapping like example above}. ‘namespaces’ is a dictionary containing all RDF namespaces used in the imported xml files.

Inheritance Diagram: