CIM CGMES to pandapower

Converts CIM CGMES 2.4.15 or 3.0 networks to pandapower.

Developed and tested on Python 3.11.

A tutorial as a Jupyter notebook introduces the converter with an example.

Setup

In order to use this converter the following import is all that ist needed.

from pandapower.converter import from_cim as cim2pp

For a speed increase it is advisable to install numba into the used python environment.

pip install numba

Using the Converter

In order to start the converter the following method is used. At least the location of the CGMES-files that are to be converted must be specified.

pandapower.converter.cim.cim2pp.from_cim.from_cim(file_list: List[str] = None, encoding: str = 'utf-8', convert_line_to_switch: bool = False, line_r_limit: float = 0.1, line_x_limit: float = 0.1, repair_cim: str | CIMRepair = None, repair_cim_class: Type[CIMRepair] = None, repair_pp: str | PandapowerRepair = None, repair_pp_class: Type[PandapowerRepair] = None, custom_converter_classes: Dict = None, cgmes_version: str = '2.4.15', **kwargs) pandapowerNet

Convert a CIM net to a pandapower net from XML files. Additional parameters for kwargs: - create_measurements (str): Set this parameter to ‘SV’ to create measurements for the pandapower net from the SV profile. Set it to ‘Analog’ to create measurements from Analogs. If the parameter is not set or is set to None, no measurements will be created. - diagram_name (str): The name from the Diagram from the DL profile for the diagram coordinates. Default: The first diagram sorted ascending by name. Set the parameter to “all” to use available diagrams for creating the coordinates. - create_tap_controller (bool): If True, create pandapower controllers for transformer tap changers. If False, skip creating them. Default: True - sn_mva (float): Set the sn_mva from the pandapower net to a specific value. This value is not given in CGMES. Default: None (pandapower default will be chosen) - run_powerflow (bool): Option to run to powerflow inside the converter to create res tables directly. Default: False. - ignore_errors (bool): Option to disable raising of internal errors. Useful if you need to get a network not matter if there are errors in the conversion. Default: True.

Parameters:
  • file_list – The path to the CGMES files as a list.

  • encoding – The encoding from the files. Optional, default: utf-8

  • convert_line_to_switch – Set this parameter to True to enable line -> switch conversion. All lines with a resistance lower or equal than line_r_limit or a reactance lower or equal than line_x_limit will become a switch. Optional, default: False

  • line_r_limit – The limit from resistance. Optional, default: 0.1

  • line_x_limit – The limit from reactance. Optional, default: 0.1

  • repair_cim – The CIMRepair object or a path to its serialized object. Optional, default: None

  • repair_cim_class – The CIMRepair class. Optional, default: None

  • repair_pp – The PandapowerRepair object or a path to its serialized object. Optional, default: None

  • repair_pp_class – The PandapowerRepair class. Optional, default: None

  • custom_converter_classes – Dict to inject classes for different functionality. Optional, default: None

  • cgmes_version – The CGMES version of the files, can be 3.0 or 2.4.15. Optional, default: 2.4.15

Returns:

The pandapower net.

The recommended way to select the CGMES-files is via the “file_list” parameter. It accepts a folder of xml- or zip-files, a single zip-file or several zip-files as a list. For example:

Example of a single zip file

cgmes_files = r'example_cim\CGMES_v2.4.15_RealGridTestConfiguration_v2.zip'

Example of several zip files

cgmes_files = [r'example_cim\CGMES_v2.4.15_SmallGridTestConfiguration_Boundary_v3.0.0.zip',
               r'example_cim\CGMES_v2.4.15_SmallGridTestConfiguration_BaseCase_Complete_v3.0.0.zip']

Folder of xml or zip files

import os
curr_xml_dir = 'example_cim\\test'
cgmes_files = [curr_xml_dir + os.sep + x for x in os.listdir(curr_xml_dir)]

To start the converter, the following line is used. As cgmes_version also ‘3.0’ can be used for cgmes version 3. As a result it returns a pandapower network.

net = cim2pp.from_cim(file_list=cgmes_files, cgmes_version='2.4.15')
In the resulting pandapower-network, the following should be noted:
  • Each component-table (bus, line, trafo, etc.) will get an “origin_id” column which points to the original CIM CGMES UUIDs.

  • If the CGMES model is bus-branch, the pandapower buses will be created from the TopologicalNodes.

  • If the CGMES model is node-breaker, the pandapower buses will be created from the ConnectivityNodes.

  • If the CGMES model has geo-coordinates (in the GL profile) they will be translated to bus.geo and line.geo respectively.

  • If the CGMES model has diagram coordinates (in the DL profile) they will be translated to bus.diagram and line.diagram respectively.

  • If the CGMES model includes measurements, they will be written to the pandapower measurement-table.

Supported components from CIM CGMES:

eq profile
  • ControlArea

  • TieFlow

  • ConnectivityNode

  • Bay

  • Substation

  • GeographicalRegion

  • SubGeographicalRegion

  • VoltageLevel

  • BaseVoltage

  • ExternalNetworkInjection

  • ACLineSegment

  • Terminal

  • OperationalLimitSet

  • OperationalLimitType

  • CurrentLimit

  • VoltageLimit

  • DCNode

  • DCEquipmentContainer

  • DCConverterUnit

  • DCLineSegment

  • CsConverter

  • VsConverter

  • DCTerminal

  • ACDCConverterDCTerminal

  • Breaker

  • Disconnector

  • Switch

  • LoadBreakSwitch

  • EnergyConsumer

  • ConformLoad

  • NonConformLoad

  • StationSupply

  • GeneratingUnit

  • WindGeneratingUnit

  • HydroGeneratingUnit

  • SolarGeneratingUnit

  • ThermalGeneratingUnit

  • NuclearGeneratingUnit

  • RegulatingControl

  • SynchronousMachine

  • AsynchronousMachine

  • EnergySource

  • EnergySchedulingType

  • StaticVarCompensator

  • PowerTransformer

  • PowerTransformerEnd

  • TapChangerControl

  • RatioTapChanger

  • PhaseTapChangerLinear

  • PhaseTapChangerAsymmetrical

  • PhaseTapChangerSymmetrical

  • PhaseTapChangerTabular

  • PhaseTapChangerTablePoint

  • RatioTapChangerTable

  • RatioTapChangerTablePoint

  • LinearShuntCompensator

  • NonlinearShuntCompensator

  • NonlinearShuntCompensatorPoint

  • EquivalentBranch

  • EquivalentInjection

  • SeriesCompensator

  • Analog

  • AnalogValue

  • MeasurementValueSource

eq_bd profile
  • ConnectivityNode

  • BaseVoltage

  • Terminal

  • EnergySource

  • EnergySchedulingType

ssh profile
  • ControlArea

  • ExternalNetworkInjection

  • Terminal

  • DCTerminal

  • ACDCConverterDCTerminal

  • CsConverter

  • VsConverter

  • Breaker

  • Disconnector

  • Switch

  • LoadBreakSwitch

  • EnergyConsumer

  • ConformLoad

  • NonConformLoad

  • StationSupply

  • RegulatingControl

  • SynchronousMachine

  • AsynchronousMachine

  • EnergySource

  • StaticVarCompensator

  • TapChangerControl

  • RatioTapChanger

  • PhaseTapChangerLinear

  • PhaseTapChangerAsymmetrical

  • PhaseTapChangerSymmetrical

  • PhaseTapChangerTabular

  • LinearShuntCompensator

  • NonlinearShuntCompensator

  • EquivalentInjection

sv profile
  • SvVoltage

  • SvPowerFlow

  • SvShuntCompensatorSections

  • SvTapStep

tp profile
  • TopologicalNode

  • DCTopologicalNode

  • ConnectivityNode

  • Terminal

  • DCTerminal

  • ACDCConverterDCTerminal

tp_bd profile
  • TopologicalNode

  • ConnectivityNode

dl profile
  • Diagram

  • DiagramObject

  • DiagramObjectPoint

gl profile
  • CoordinateSystem

  • Location

  • PositionPoint