:py:mod:`eelib.utils.simulation_setup.helper_create_grid` ========================================================= .. py:module:: eelib.utils.simulation_setup.helper_create_grid .. autoapi-nested-parse:: Helper functions for the generation of new simulations. | 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 --------------- Functions ~~~~~~~~~ .. autoapisummary:: eelib.utils.simulation_setup.helper_create_grid.format_grid eelib.utils.simulation_setup.helper_create_grid.create_grid eelib.utils.simulation_setup.helper_create_grid.create_grid_pp_code eelib.utils.simulation_setup.helper_create_grid.create_grid_sb_code eelib.utils.simulation_setup.helper_create_grid.create_grid_radial_lv eelib.utils.simulation_setup.helper_create_grid.rename_elements eelib.utils.simulation_setup.helper_create_grid.rename_buses_of_feeder Attributes ~~~~~~~~~~ .. autoapisummary:: eelib.utils.simulation_setup.helper_create_grid.bus_fields eelib.utils.simulation_setup.helper_create_grid.load_fields eelib.utils.simulation_setup.helper_create_grid.ext_grid_fields eelib.utils.simulation_setup.helper_create_grid.trafo_fields eelib.utils.simulation_setup.helper_create_grid.line_fields eelib.utils.simulation_setup.helper_create_grid.grid .. py:data:: bus_fields :value: "['index', 'vn_kv', 'name', 'in_service', 'geodata']" .. py:data:: load_fields :value: "['bus', 'name', 'scaling']" .. py:data:: ext_grid_fields :value: "['bus', 'name', 'in_service']" .. py:data:: trafo_fields :value: "['hv_bus', 'lv_bus', 'std_type', 'name', 'in_service', 'parallel']" .. py:data:: line_fields :value: "['from_bus', 'to_bus', 'name', 'in_service', 'length_km', 'std_type', 'parallel']" .. py:data:: grid .. py:function:: format_grid(grid: pandapower.auxiliary.pandapowerNet, keep_profiles: bool = False) -> pandapower.auxiliary.pandapowerNet Applies some general formatting to an existing grid, e.g. setting predefined values, removing attributes not used in eElib, ... :param grid: The unformatted grid. :type grid: pandapowerNet :param keep_profiles: Some grids ship with profiles, especially load profiles. The assignment is done via ``grid.load.profile`` column, while the whole profiles are stored in ``grid.profiles``. This bool drops all profiles from the grid file. :type keep_profiles: bool :returns: The formatted grid. :rtype: pandapowerNet .. py:function:: create_grid(pp_code: str | None = None, sb_code: str | None = None, loads_at_branches: list | None = None, do_rename_elements: bool = True, plot_grid: bool = True, save_as_json_file: bool = False, keep_profiles: bool = False) -> pandapower.auxiliary.pandapowerNet | None Unified generation method to create a grid in different ways. Choose one way of creation: Pandapower: Fill a ``pp_code``. SimBench: Fill an ``sb_code``. Custom radial: Fill ``loads_at_branches`` list. :param pp_code: Name of method for pre-defined pandapower grid. (see [method library](https://pandapower.readthedocs.io/en/latest/networks.html)) :type pp_code: str | None, optional :param sb_code: Code for pre-defined SimBench grid (see [grid code library](https://simbench.de/de/datensaetze/)). :type sb_code: str | None, optional :param loads_at_branches: Listing of the number of nodes at each radial string in the grid, so the length of the list defines the number of strings. :type loads_at_branches: list | None, optional :param do_rename_elements: Whether grid elements should be adequately renamed. Watch out: This will not work for multi-voltage-level grids and those with circular structure, as we go by each feeder for renaming. Defaults to True. :type do_rename_elements: bool :param plot_grid: whether to create simple plot of grid. Defaults to False. :type plot_grid: bool, optional :param save_as_json_file: Whether to save the grid as a file additionaly to returning it. :type save_as_json_file: bool, optional :param keep_profiles: Some grids ship with profiles, especially load profiles. The assignment is done via ``grid.load.profile`` column, while the whole profiles are stored in ``grid.profiles``. This bool drops all profiles from the grid file. :type keep_profiles: bool, optional :raises ValueError: If not supplied with input for exactly one way of grid generation: ``pp_code``, ``sb_code``, or ``loads_at_branches``. :returns: The grid from the specified source, formatted to eElib standards. Might be None at first execution when going fully custom. :rtype: pandapowerNet | None .. py:function:: create_grid_pp_code(pp_code: str = 'create_kerber_landnetz_kabel_1', adjust_comp_names: bool = True) -> tuple[str, pandapower.auxiliary.pandapowerNet] Create pandapower grid including saved json file from information about pandapower template. :param pp_code: Name of method for pre-defined pandapower grid. (see [method library](https://pandapower.readthedocs.io/en/latest/networks.html)) :type pp_code: str, optional :param adjust_comp_names: whether to adjust component names if None. Defaults to True. :type adjust_comp_names: bool :returns: Name and the grid from the predefined Pandapower code. :rtype: tuple[str, pandapowerNet] .. py:function:: create_grid_sb_code(sb_code: str = '1-LV-rural1--0-sw') -> tuple[str, pandapower.auxiliary.pandapowerNet] Create pandapower grid file from am predefined simbench grid including saved json file from information about grid components. :param sb_code: Code for pre-defined SimBench grid (see [grid code library](https://simbench.de/de/datensaetze/)). :type sb_code: str, optional :raises KeyError: If ``sb_code`` is not a valid SimBenchCode. :returns: Name and the grid from the SimBench code. :rtype: tuple[str, pandapowerNet] .. py:function:: create_grid_radial_lv(loads_at_branches: list = [6, 2]) -> tuple[str, pandapower.auxiliary.pandapowerNet] Create pandapower grid file for a radial grid based on the number of loads for each string. :param loads_at_branches: Listing of the number of nodes at each radial string in the grid, so the length of the list defines the number of strings. :type loads_at_branches: list :returns: Name and the radial low voltage grid. :rtype: tuple[str, pandapowerNet] .. py:function:: rename_elements(grid: pandapower.auxiliary.pandapowerNet) Renames the busses, loads, lines and transformers in the grid. :param grid: A pandapower grid. :type grid: pandapowerNet .. py:function:: rename_buses_of_feeder(grid: pandapower.auxiliary.pandapowerNet, feeder_num: int, starting_bus_idx: int, bus_idx_stop: list[int], counter_feeder: int = 1) -> int Rename all buses in one feeder according to the feeder number and starting from one bus. :param grid: The corresponding pandapower grid :type grid: pandapowerNet :param feeder_num: the assigned number for this feeder (to name the buses to) :type feeder_num: int :param starting_bus_idx: The index of the bus that this naming should start with (before going to the next bus etc.) :type starting_bus_idx: int :param bus_idx_stop: list of bus indices that should not be considered, i.e. the busbar that represents the "limit" for this feeder :type bus_idx_stop: list[int] :param counter_feeder: Number to assign for the naming of the next bus (if some already set). Defaults to 1. :type counter_feeder: int, optional :returns: The last number that was assigned for this (sub-)feeder :rtype: int