eelib.core.grid.pandapower.pandapower_model

eElib pandapower grid model (oriented at mosaik_pandapower). Grid import could happen through Json files, and the file should exist in the working directory.

In pandapower library there exist a list of standard grids for direct import and simulation: https://pandapower.readthedocs.io/en/v2.1.0/networks.html

Copyright (c) 2018 by University of Kassel and Fraunhofer Institute for Fraunhofer Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual contributors

Author: elenia@TUBS
Copyright 2024 elenia
This file is part of eELib, which is free software under the terms of the GNU GPL Version 3.

Module Contents

Classes

Pandapower

An electrical grid model in pandapower style.

Attributes

OUTPUT_ATTRS

RENAMING_ATTRS

OUTPUT_ATTRS
RENAMING_ATTRS
class Pandapower(ename: str, gridfile: str, sim_start: str)

Bases: object

An electrical grid model in pandapower style.

_VALID_PARAMETERS
LIM
classmethod get_valid_parameters()

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

_load_case(path)

Loads a pandapower grid. The grid should be ready in a json file or an example grid.

Parameters:

path (str) – file path to the grid file

Raises:

ValueError – if given grid directory/file cannot be opened

_get_slack()

Create entity of the slack bus.

Returns:

zero with index of slack bus

Return type:

tuple

_get_buses()

Create entities of the buses.

Returns:

indices of busses with their nominal voltage in kV

Return type:

list

_get_loads()

Create load entities.

Returns:

list of load with tuples about bus index, active/reactive power, scaling factor and their status

Return type:

list

_get_lines()

Create branches entities.

Returns:

list of grid lines with tuples about bus indices, their length, impedance/reactance/capacitance, maximum current and their status

Return type:

list

_get_trafos()

Create trafo entities.

Returns:

list of trafos with tuples about bus indices, max. power, nominal voltages, short circuit voltages, iron losses, open-loop current, phase shift, tap status and their status

Return type:

list

set_inputs(etype, idx, data, static)

Setting the input from the simulator.

Parameters:
  • etype (string) – entity type of element to be set

  • idx (int) – index of element in element list

  • data (dict) – input data to be set, key (parameter) and corresponding value

  • static (dict) – static values of this entity

Raises:

ValueError – Error if no possible entity type was given

_powerflow()

Conduct power flow for the saved grid with its options from pandapower.

step(time)

Performs simulation step of eELib pandapower grid model.

Parameters:

time (int) – Current simulation time

_store_power_flow_results()

Retrieve the results of the power flow and store them.

_get_powerflow_result_component(eid)

Retrieve the results of the power flow for a specific component.

Parameters:

eid (str) – Entity ID of the component to be searched for

Returns:

dict with the results from the power flow for the component

Return type:

(dict)

_get_grid_status()

Analyse the status of the grid and its component at the current step in time.

_get_status_bus(comp_idx: int) dict

Analyse the status of a grid bus at the current step in time.

Parameters:

comp_idx (int) – index of the (bus) component in the corresponding grid.bus table

Returns:

Status for the bus including limits and congestion status

Return type:

dict

_get_status_line(comp_idx: int, comp_type: str) dict

Analyse the status of a grid line at the current step in time.

Parameters:
  • comp_idx (int) – index of the (line) component in the grid.line/.trafo table

  • comp_type (str) – whether it is a trafo or a line

Returns:

_description_

Return type:

dict

_calc_ptdf()

Calculate the DC Power Transfer Distribution Matrix of the Grid. Using function from pandapower.pypower. Only works after the calculation of a powerflow, as the “_ppc” matrix is calculated there. Orientation is as follows: One list for every branch (consequence), one element in each list for every bus (cause). E.g. for a 3-Bus radial grid the matrix will look like this: [[0, -1, -1], [0, 0, -1], [0, 0, 0]].

_calc_vpif()

Calculate the AC Voltage Power Impact Factor Matrix of the (current) Grid. The jacobian matrix is calculated in every iteration of pandapower powerflow calculation. The matrix of the last iteration is stored and will be accessed here as a sensitivity of adaptions. Only works after the calculation of a powerflow, as the “_ppc” matrix is calculated there. Direction corresponds to PSC (power consumption decreases voltage magnitude). Orientation is as follows: One list for every bus (consequence, adjustment of vm_pu), one element in each list for every bus times two (cause, first adaption of active power P afterwards adaption of reactive power Q). E.g. for a 2-bus grid the matrix will look like this: [[B1dP->B1dVm, B2dP->B1dVm, B1dQ->B1dVm, B2dQ->B1dVm], … … [B1dP->B2dVm, B2dP->B2dVm, B1dQ->B2dVm, B2dQ->B2dVm]].