:py:mod:`eelib.core.grid.pandapower.pandapower_model` ===================================================== .. py:module:: eelib.core.grid.pandapower.pandapower_model .. autoapi-nested-parse:: 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 ~~~~~~~ .. autoapisummary:: eelib.core.grid.pandapower.pandapower_model.Pandapower Attributes ~~~~~~~~~~ .. autoapisummary:: eelib.core.grid.pandapower.pandapower_model.OUTPUT_ATTRS eelib.core.grid.pandapower.pandapower_model.RENAMING_ATTRS .. py:data:: OUTPUT_ATTRS .. py:data:: RENAMING_ATTRS .. py:class:: Pandapower(ename: str, gridfile: str, sim_start: str) Bases: :py:obj:`object` An electrical grid model in pandapower style. .. py:attribute:: _VALID_PARAMETERS .. py:attribute:: LIM .. py:method:: get_valid_parameters() :classmethod: Returns dictionary containing valid parameter types and values. :returns: valid parameters for this model :rtype: dict .. py:method:: _load_case(path) Loads a pandapower grid. The grid should be ready in a json file or an example grid. :param path: file path to the grid file :type path: str :raises ValueError: if given grid directory/file cannot be opened .. py:method:: _get_slack() Create entity of the slack bus. :returns: zero with index of slack bus :rtype: tuple .. py:method:: _get_buses() Create entities of the buses. :returns: indices of busses with their nominal voltage in kV :rtype: list .. py:method:: _get_loads() Create load entities. :returns: list of load with tuples about bus index, active/reactive power, scaling factor and their status :rtype: list .. py:method:: _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 :rtype: list .. py:method:: _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 :rtype: list .. py:method:: set_inputs(etype, idx, data, static) Setting the input from the simulator. :param etype: entity type of element to be set :type etype: string :param idx: index of element in element list :type idx: int :param data: input data to be set, key (parameter) and corresponding value :type data: dict :param static: static values of this entity :type static: dict :raises ValueError: Error if no possible entity type was given .. py:method:: _powerflow() Conduct power flow for the saved grid with its options from pandapower. .. py:method:: step(time) Performs simulation step of eELib pandapower grid model. :param time: Current simulation time :type time: int .. py:method:: _store_power_flow_results() Retrieve the results of the power flow and store them. .. py:method:: _get_powerflow_result_component(eid) Retrieve the results of the power flow for a specific component. :param eid: Entity ID of the component to be searched for :type eid: str :returns: dict with the results from the power flow for the component :rtype: (dict) .. py:method:: _get_grid_status() Analyse the status of the grid and its component at the current step in time. .. py:method:: _get_status_bus(comp_idx: int) -> dict Analyse the status of a grid bus at the current step in time. :param comp_idx: index of the (bus) component in the corresponding grid.bus table :type comp_idx: int :returns: Status for the bus including limits and congestion status :rtype: dict .. py:method:: _get_status_line(comp_idx: int, comp_type: str) -> dict Analyse the status of a grid line at the current step in time. :param comp_idx: index of the (line) component in the grid.line/.trafo table :type comp_idx: int :param comp_type: whether it is a trafo or a line :type comp_type: str :returns: _description_ :rtype: dict .. py:method:: _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]]. .. py:method:: _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]].