CIM CGMES to pandapower

Converts CIM CGMES 2.4.15 networks to pandapower.

Developed and tested on Python 3.8.

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

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 = 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 = None, repair_cim_class: Type[CIMRepair] | None = None, repair_pp: str | PandapowerRepair | None = None, repair_pp_class: Type[PandapowerRepair] | None = None, **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. update_assets_from_sv (bool): Set this parameter to True to update the assets (sgens, loads, wards, …) with values from the SV profile. Default: False. use_GL_or_DL_profile (str): Choose the profile to use for converting coordinates. Set it to ‘GL’ to use the GL profile (Usually lat and long coordinates). Set it to ‘DL’ to use the DL profile (Usually x, y coordinates for displaying control room schema). Set it to ‘both’ to let the converter choose the profile. The converter will choose the GL profile first if available, otherwise the DL profile. Optional, default: both. diagram_name (str): The name from the Diagram from the diagram layout profile for the geo 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)

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

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:

Folder of xml or zip files

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

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']

To start the converter, the following line is used. As a result it returns a pandapower network.

net = from_cim.from_cim(file_list=cgmes_files)
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_geodata and line_geodata 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