cimpy.cimexport module

cimpy.cimexport.cim_export(import_result, file_name, version, activeProfileList)[source]

Function for serialization of cgmes classes

This function serializes cgmes classes with the template engine chevron. The classes are separated by their profile and one xml file for each profile is created. The package name is added after the file name. The set_attributes_or_reference function is a lamda function for chevron to decide whether the value of an attribute is a reference to another class object or not.

Parameters
  • import_result – a dictionary containing the topology and meta information. The topology can be extracted via cim_import(). 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.

  • file_name – a string with the name of the xml files which will be created

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

  • activeProfileList – a list containing the strings of all short names of the profiles used for serialization

cimpy.cimexport.generate_xml(cim_data, version, model_name, profile, available_profiles)[source]

Function for serialization of cgmes classes

This function serializes cgmes classes with the template engine chevron and returns them as a string.

Parameters
  • cim_data – a dictionary containing the topology and meta information. It can be created via cim_import()

  • version – cgmes version, e.g. version="cgmes_v2_4_15"

  • profile – The Profile for which the serialization should be generated.

  • model_name – a string with the name of the model.

  • available_profiles – a list of all Profile`s in `cim_data

Inheritance Diagram: