CIM2Matpower module

This module contains the core functionality of the CIM to Matpower import tool.

Date:2016-05-10
Authors:Konstantin Gerasimov
e-mail:kkgerasimov@gmail.com
Credits:This function is created for KU-Leuven as part of the GARPUR project http://www.garpur-project.eu
class CIM2Matpower.CIM2Matpower(cim_files)[source]

The CIM2Matpower transforms a CIM topology in cim_file into a bus/branch topology.

cim_file is the path to an XML/RDF encoded CIM topology.

_create_bb_topology(BasePower_MVA, tnodes)[source]

Creates the Topology_BusBranch.Case

_create_branches(lines, p_transformers, BasePower_MVA, buses)[source]

Creates list of Topology_BusBranch.Branch -es

Create list of Topology_NodeBreaker.Branch, Topology_NodeBreaker.PhaseTapChanger and Topology_NodeBreaker.RatioTapChanger -s

_create_buses_and_gens(tnodes)[source]

Creates dictionary of Topology_BusBranch.Bus -es and list of Topology_BusBranch.Generator -s

Create lists of PowerTransformer -s and ACLineSegment -s CIM objects

Create lists of Topology_NodeBreaker.Node, Topology_NodeBreaker.Substation, Topology_NodeBreaker.Generator, Topology_NodeBreaker.Load and Topology_NodeBreaker.Shunt -s

_find_tnode(terminal)[source]
_get_acline_mva_lim(acline)[source]
_get_base_voltage(tnode)[source]

Tries to get a base voltage from tnode (TopologicalNode) to from its connectivity nodes.

Raises a ValueError if no base voltage can be found or if the base voltages of the connectivity nodes differ from each other.

_get_cls(name)[source]

Imports and returns the class object for name.

_get_equipment_cls(names)[source]

Returns a touple containing the class objects for names.

_get_position_points(equipment)[source]

Returns the set of position points (Topology_BusBranch.Point) for equipment.

_iterate_prim_eq(cim_objects)[source]

Iterates over all cim_objects and creates ``TopologicalNode`-s (if they were not present). Find the self.biggest_tnode_island and imports ``TopologicalNode`-s only from it. Create a list of the control Areas and the load Zones.

_primary_one_t = ['TransformerWinding', 'EnergySource', 'EnergyConsumer', 'Connector', 'RegulatingCondEq']
_primary_two_t = ['Conductor', 'SeriesCompensator', 'PowerTransformer']
_process_cnode(tnode, src_terminal, processed)[source]

Recursively processes the connectivity node connected to src_terminal and adds it to terminals.

You need to pass the terminal and not the connectivity node, because we need the terminal to keep track where we are coming from and to not to visit the same terminal again.

_secondary_one_t = ['Ground']
_secondary_two_t = ['RectifierInverter', 'Switch']
import_cim()[source]

Actually parses the CIM file and transforms its contents. A Topology_BusBranch.Case object is returned.

CIM2Matpower.cim_to_mpc(cimfiles, boundary_profiles=[], log_filename='')[source]

The main function transforming the CIM XML files into Matpower case structure (mpc) in BusBranch topology, together with an additional structure for the NodeBreaker topology data which cannot be fit in the mpc.

Warning

The cimfiles and boundary_profiles must not contain Unidoce characters! Otherwise the PyCIM module fails!

Parameters:cimfiles (list of strings) – the filenames of the CIM files to be imported (preferably with full path)

Warning

The cimfiles usually come in three files: _EQ, _TP and _SV. If so, they need to be provided in the specified order!

Parameters:boundary_profiles (list of strings) – (optional) the filenames of the boundary files to be imported (preferably with full path)

Warning

The boundary_profiles usually come in two files: _EQ and _TP. If so, they need to be provided in the specified order!

Parameters:log_filename (string) – (optional) the filename in which a log should be saved (preferably with full path)
Return mpc:Matpower case, together with information about the NodeBreaker topology

Warning

In order to be used in Matlab, it still needs to be transformed from Python dictionaries and array to Matlab structure and matrices.