edisgo.network.topology.Topology ================================ .. py:class:: edisgo.network.topology.Topology(**kwargs) Container for all grid topology data of a single MV grid. Data may as well include grid topology data of underlying LV grids. :param config: Provide your configurations if you want to load self-provided equipment data. Path to csv files containing the technical data is set in `config_system.cfg` in sections `system_dirs` and `equipment`. The default is None in which case the equipment data provided by eDisGo is used. :type config: None or :class:`~.tools.config.Config` .. py:property:: loads_df Dataframe with all loads in MV network and underlying LV grids. :param df: Dataframe with all loads (incl. charging points, heat pumps, etc.) in MV network and underlying LV grids. Index of the dataframe are load names as string. Columns of the dataframe are: bus : str Identifier of bus load is connected to. p_set : float Peak load or nominal capacity in MW. type : str Type of load, e.g. 'conventional_load', 'charging_point' or 'heat_pump' (resistive heaters are as well treated as heat pumps with a COP smaller than 1). This information is for example currently necessary when setting up a worst case analysis, as different types of loads are treated differently. sector : str Further specifies type of load. In case of conventional loads this attribute is used if demandlib is used to generate sector-specific time series (see function :attr:`~.network.timeseries.TimeSeries. predefined_conventional_loads_by_sector`). It is further used when new generators are integrated into the grid in case the LV is not geo-referenced, as e.g. smaller PV rooftop generators are most likely to be located in a household (see function :attr:`~.network.topology.Topology.connect_to_lv`). The sector needs to either be 'industrial', 'residential' or 'cts'. In case of charging points this attribute is used to define the charging point use case ('home', 'work', 'public' or 'hpc') to determine whether a charging process can be flexibilised, as it is assumed that only charging processes at private charging points ('home' and 'work') can be flexibilised (see function :attr:`~.flex_opt.charging_strategies.charging_strategy`). It is further used when charging points are integrated into the grid, as e.g. 'home' charging points are allocated to a household (see function :attr:`~.network.topology.Topology.connect_to_lv`). In case of heat pumps it is used when heat pumps are integrated into the grid, as e.g. heat pumps for individual heating are allocated to an existing load (see function :attr:`~.network.topology.Topology.connect_to_lv`). It is further used to specify, if component is a resistive heater, as resistive heaters are treated as heat pumps. The sector needs to either be 'individual_heating', 'district_heating', 'individual_heating_resistive_heater' or 'district_heating_resistive_heater'. building_id : int ID of the building the load is associated with. This is e.g. used to get electricity and heat demand time series as well as information on existing heat pumps and PV rooftop plants for scenarios developed in the eGo^n research project. annual_consumption : float Annual consumption in MWh. number_households : int Number of households in the building. This information is currently not used in eDisGo. :type df: :pandas:`pandas.DataFrame` :returns: Dataframe with all loads in MV network and underlying LV grids. For more information on the dataframe see input parameter `df`. :rtype: :pandas:`pandas.DataFrame` .. py:property:: generators_df Dataframe with all generators in MV network and underlying LV grids. :param df: Dataframe with all generators in MV network and underlying LV grids. Index of the dataframe are generator names as string. Columns of the dataframe are: bus : str Identifier of bus generator is connected to. p_nom : float Nominal power in MW. type : str Type of generator, e.g. 'solar', 'run_of_river', etc. Is used in case generator type specific time series are provided. control : str Control type of generator used for power flow analysis. In MV and LV grids usually 'PQ'. weather_cell_id : int ID of weather cell, that identifies the weather data cell from the weather data set used in the research project `open_eGo `_ to determine feed-in profiles of wind and solar generators. Only required when time series of wind and solar generators are assigned using precalculated time series from the OpenEnergy DataBase. subtype : str Further specification of type, e.g. 'solar_roof_mounted'. Currently, not required for any functionality. :type df: :pandas:`pandas.DataFrame` :returns: Dataframe with all generators in MV network and underlying LV grids. For more information on the dataframe see input parameter `df`. :rtype: :pandas:`pandas.DataFrame` .. py:property:: storage_units_df Dataframe with all storage units in MV grid and underlying LV grids. :param df: Dataframe with all storage units in MV grid and underlying LV grids. Index of the dataframe are storage names as string. Columns of the dataframe are: bus : str Identifier of bus storage unit is connected to. control : str Control type of storage unit used for power flow analysis, usually 'PQ'. p_nom : float Nominal power in MW. max_hours : float Maximum state of charge capacity in terms of hours at full output capacity p_nom. efficiency_store : float Efficiency of storage system in case of charging. So far only used in :func:`~.edisgo.flex_opt.battery_storage_operation.apply_reference_operation.` efficiency_dispatch : float Efficiency of storage system in case of discharging. So far only used in :func:`~.edisgo.flex_opt.battery_storage_operation.apply_reference_operation.` :type df: :pandas:`pandas.DataFrame` :returns: Dataframe with all storage units in MV network and underlying LV grids. For more information on the dataframe see input parameter `df`. :rtype: :pandas:`pandas.DataFrame` .. py:property:: transformers_df Dataframe with all MV/LV transformers. :param df: Dataframe with all MV/LV transformers. Index of the dataframe are transformer names as string. Columns of the dataframe are: bus0 : str Identifier of bus at the transformer's primary (MV) side. bus1 : str Identifier of bus at the transformer's secondary (LV) side. x_pu : float Per unit series reactance. r_pu : float Per unit series resistance. s_nom : float Nominal apparent power in MW. type_info : str Type of transformer. :type df: :pandas:`pandas.DataFrame` :returns: Dataframe with all MV/LV transformers. For more information on the dataframe see input parameter `df`. :rtype: :pandas:`pandas.DataFrame` .. py:property:: transformers_hvmv_df Dataframe with all HV/MV transformers. :param df: Dataframe with all HV/MV transformers, with the same format as :py:attr:`~transformers_df`. :type df: :pandas:`pandas.DataFrame` :returns: Dataframe with all HV/MV transformers. For more information on format see :py:attr:`~transformers_df`. :rtype: :pandas:`pandas.DataFrame` .. py:property:: lines_df Dataframe with all lines in MV network and underlying LV grids. :param df: Dataframe with all lines in MV network and underlying LV grids. Index of the dataframe are line names as string. Columns of the dataframe are: bus0 : str Identifier of first bus to which line is attached. bus1 : str Identifier of second bus to which line is attached. length : float Line length in km. x : float Reactance of line (or in case of multiple parallel lines total reactance of lines) in Ohm. r : float Resistance of line (or in case of multiple parallel lines total resistance of lines) in Ohm. s_nom : float Apparent power which can pass through the line (or in case of multiple parallel lines total apparent power which can pass through the lines) in MVA. num_parallel : int Number of parallel lines. type_info : str Type of line as e.g. given in `equipment_data`. kind : str Specifies whether line is a cable ('cable') or overhead line ('line'). :type df: :pandas:`pandas.DataFrame` :returns: Dataframe with all lines in MV network and underlying LV grids. For more information on the dataframe see input parameter `df`. :rtype: :pandas:`pandas.DataFrame` .. py:property:: buses_df Dataframe with all buses in MV network and underlying LV grids. :param df: Dataframe with all buses in MV network and underlying LV grids. Index of the dataframe are bus names as strings. Columns of the dataframe are: v_nom : float Nominal voltage in kV. x : float x-coordinate (longitude) of geolocation. y : float y-coordinate (latitude) of geolocation. mv_grid_id : int ID of MV grid the bus is in. lv_grid_id : int ID of LV grid the bus is in. In case of MV buses this is NaN. in_building : bool Signifies whether a bus is inside a building, in which case only components belonging to this house connection can be connected to it. :type df: :pandas:`pandas.DataFrame` :returns: Dataframe with all buses in MV network and underlying LV grids. :rtype: :pandas:`pandas.DataFrame` .. py:property:: switches_df Dataframe with all switches in MV network and underlying LV grids. Switches are implemented as branches that, when they are closed, are connected to a bus (`bus_closed`) such that there is a closed ring, and when they are open, connected to a virtual bus (`bus_open`), such that there is no closed ring. Once the ring is closed, the virtual is a single bus that is not connected to the rest of the grid. :param df: Dataframe with all switches in MV network and underlying LV grids. Index of the dataframe are switch names as string. Columns of the dataframe are: bus_open : str Identifier of bus the switch branch is connected to when the switch is open. bus_closed : str Identifier of bus the switch branch is connected to when the switch is closed. branch : str Identifier of branch that represents the switch. type : str Type of switch, e.g. switch disconnector. :type df: :pandas:`pandas.DataFrame` :returns: Dataframe with all switches in MV network and underlying LV grids. For more information on the dataframe see input parameter `df`. :rtype: :pandas:`pandas.DataFrame` .. py:property:: charging_points_df Returns a subset of :py:attr:`~loads_df` containing only charging points. :param type: Load type. Default: "charging_point" :type type: str :returns: Pandas DataFrame with all loads of the given type. :rtype: :pandas:`pandas.DataFrame` .. py:property:: id MV network ID. :returns: MV network ID. :rtype: int .. py:property:: grids Gives a list with :class:`~.network.grids.MVGrid` object and all :class:`~.network.grids.LVGrid` objects. .. py:property:: mv_grid Medium voltage network. The medium voltage network object only contains components (lines, generators, etc.) that are in or connected to the MV grid and does not include any components of the underlying LV grids (also not MV/LV transformers). :param mv_grid: Medium voltage network. :type mv_grid: :class:`~.network.grids.MVGrid` :returns: Medium voltage network. :rtype: :class:`~.network.grids.MVGrid` .. py:property:: lv_grids Yields generator object with all low voltage grids in network. :returns: Yields generator object with :class:`~.network.grids.LVGrid` object. :rtype: :class:`~.network.grids.LVGrid` .. py:method:: get_lv_grid(name) Returns :class:`~.network.grids.LVGrid` object for given LV grid ID or name. :param name: LV grid ID as integer or LV grid name (string representation) as string of the LV grid object that should be returned. :type name: int or str :returns: LV grid object with the given LV grid ID or LV grid name (string representation). :rtype: :class:`~.network.grids.LVGrid` .. py:property:: grid_district Dictionary with MV grid district information. :param grid_district: Dictionary with the following MV grid district information: 'population' : int Number of inhabitants in grid district. 'geom' : :shapely:`shapely.MultiPolygon` Geometry of MV grid district as (Multi)Polygon. 'srid' : int SRID (spatial reference ID) of grid district geometry. :type grid_district: dict :returns: Dictionary with MV grid district information. For more information on the dictionary see input parameter `grid_district`. :rtype: dict .. py:property:: rings List of rings in the grid topology. A ring is represented by the names of buses within that ring. :returns: List of rings, where each ring is again represented by a list of buses within that ring. :rtype: list(list) .. py:property:: equipment_data Technical data of electrical equipment such as lines and transformers. :returns: Dictionary with :pandas:`pandas.DataFrame` containing equipment data. Keys of the dictionary are 'mv_transformers', 'mv_overhead_lines', 'mv_cables', 'lv_transformers', and 'lv_cables'. :rtype: dict .. py:method:: get_connected_lines_from_bus(bus_name) Returns all lines connected to specified bus. :param bus_name: Name of bus to get connected lines for. :type bus_name: str :returns: Dataframe with connected lines with the same format as :attr:`~.network.topology.Topology.lines_df`. :rtype: :pandas:`pandas.DataFrame` .. py:method:: get_line_connecting_buses(bus_1, bus_2) Returns information of line connecting bus_1 and bus_2. :param bus_1: Name of first bus. :type bus_1: str :param bus_2: Name of second bus. :type bus_2: str :returns: Dataframe with information of line connecting bus_1 and bus_2 in the same format as :attr:`~.network.topology.Topology.lines_df`. :rtype: :pandas:`pandas.DataFrame` .. py:method:: get_connected_components_from_bus(bus_name) Returns dictionary of components connected to specified bus. :param bus_name: Identifier of bus to get connected components for. :type bus_name: str :returns: dict of :pandas:`pandas.DataFrame` Dictionary of connected components with keys 'generators', 'loads', 'storage_units', 'lines', 'transformers', 'transformers_hvmv', 'switches'. Corresponding values are component dataframes containing only components that are connected to the given bus. .. py:method:: get_neighbours(bus_name) Returns a set of neighbour buses of specified bus. :param bus_name: Identifier of bus to get neighbouring buses for. :type bus_name: str :returns: Set of identifiers of neighbouring buses. :rtype: set(str) .. py:method:: add_load(bus, p_set, type='conventional_load', **kwargs) Adds load to topology. Load name is generated automatically. :param bus: See :py:attr:`~loads_df` for more information. :type bus: str :param p_set: See :py:attr:`~loads_df` for more information. :type p_set: float :param type: See :py:attr:`~loads_df` for more information. Default: "conventional_load" :type type: str :param kwargs: Kwargs may contain any further attributes you want to specify. See :py:attr:`~loads_df` for more information on additional attributes used for some functionalities in edisgo. Kwargs may also contain a load ID (provided through keyword argument `load_id` as string) used to generate a unique identifier for the newly added load. :returns: Unique identifier of added load. :rtype: str .. py:method:: add_generator(bus, p_nom, generator_type, control='PQ', **kwargs) Adds generator to topology. Generator name is generated automatically. :param bus: See :py:attr:`~generators_df` for more information. :type bus: str :param p_nom: See :py:attr:`~generators_df` for more information. :type p_nom: float :param generator_type: Type of generator, e.g. 'solar' or 'gas'. See 'type' in :py:attr:`~generators_df` for more information. :type generator_type: str :param control: See :py:attr:`~generators_df` for more information. Defaults to 'PQ'. :type control: str :param kwargs: Kwargs may contain any further attributes you want to specify. See :py:attr:`~generators_df` for more information on additional attributes used for some functionalities in edisgo. Kwargs may also contain a generator ID (provided through keyword argument `generator_id` as string) used to generate a unique identifier for the newly added generator. :returns: Unique identifier of added generator. :rtype: str .. py:method:: add_storage_unit(bus, p_nom, control='PQ', **kwargs) Adds storage unit to topology. Storage unit name is generated automatically. :param bus: See :py:attr:`~storage_units_df` for more information. :type bus: str :param p_nom: See :py:attr:`~storage_units_df` for more information. :type p_nom: float :param control: See :py:attr:`~storage_units_df` for more information. Defaults to 'PQ'. :type control: str, optional :param kwargs: Kwargs may contain any further attributes you want to specify, e.g. `max_hours`. .. py:method:: add_line(bus0, bus1, length, **kwargs) Adds line to topology. Line name is generated automatically. If `type_info` is provided, `x`, `r`, `b` and `s_nom` are calculated. :param bus0: Identifier of connected bus. :type bus0: str :param bus1: Identifier of connected bus. :type bus1: str :param length: See :py:attr:`~lines_df` for more information. :type length: float :param kwargs: Kwargs may contain any further attributes in :py:attr:`~lines_df`. It is necessary to either provide `type_info` to determine `x`, `r`, `b` and `s_nom` of the line, or to provide `x`, `r`, `b` and `s_nom` directly. .. py:method:: add_bus(bus_name, v_nom, **kwargs) Adds bus to topology. If provided bus name already exists, a unique name is created. :param bus_name: Name of new bus. :type bus_name: str :param v_nom: See :py:attr:`~buses_df` for more information. :type v_nom: float :param x: See :py:attr:`~buses_df` for more information. :type x: float :param y: See :py:attr:`~buses_df` for more information. :type y: float :param lv_grid_id: See :py:attr:`~buses_df` for more information. :type lv_grid_id: int :param in_building: See :py:attr:`~buses_df` for more information. :type in_building: bool :returns: Name of bus. If provided bus name already exists, a unique name is created. :rtype: str .. py:method:: remove_load(name) Removes load with given name from topology. If no other elements are connected, line and bus are removed as well. :param name: Identifier of load as specified in index of :py:attr:`~loads_df`. :type name: str .. py:method:: remove_generator(name) Removes generator with given name from topology. If no other elements are connected, line and bus are removed as well. :param name: Identifier of generator as specified in index of :py:attr:`~generators_df`. :type name: str .. py:method:: remove_storage_unit(name) Removes storage with given name from topology. If no other elements are connected, line and bus are removed as well. :param name: Identifier of storage as specified in index of :py:attr:`~storage_units_df`. :type name: str .. py:method:: remove_line(name) Removes line with given name from topology. Line is only removed, if it does not result in isolated buses. A warning is raised in that case. :param name: Identifier of line as specified in index of :py:attr:`~lines_df`. :type name: str .. py:method:: remove_bus(name) Removes bus with given name from topology. :param name: Identifier of bus as specified in index of :py:attr:`~buses_df`. :type name: str .. rubric:: Notes Only isolated buses can be deleted from topology. Use respective functions first to delete all connected components (e.g. lines, transformers, loads, etc.). Use function :func:`~.network.topology.Topology.get_connected_components_from_bus` to get all connected components. .. py:method:: update_number_of_parallel_lines(lines_num_parallel) Changes number of parallel lines and updates line attributes. When number of parallel lines changes, attributes x, r, b, and s_nom have to be adapted, which is done in this function. :param lines_num_parallel: Index contains identifiers of lines to update as in index of :py:attr:`~lines_df` and values of series contain corresponding new number of parallel lines. :type lines_num_parallel: :pandas:`pandas.Series` .. py:method:: change_line_type(lines, new_line_type) Changes line type of specified lines to given new line type. Be aware that this function replaces the lines by one line of the given line type. Lines must all be in the same voltage level and the new line type must be a cable with technical parameters given in equipment parameters. :param lines: List of line names of lines to be changed to new line type. :type lines: list(str) :param new_line_type: Specifies new line type of lines. Line type must be a cable with technical parameters given in "mv_cables" or "lv_cables" of equipment data. :type new_line_type: str .. py:method:: sort_buses() Sorts buses in :py:attr:`~lines_df` such that bus0 is always the upstream bus. The changes are directly written to :py:attr:`~lines_df` dataframe. .. py:method:: connect_to_mv(edisgo_object, comp_data, comp_type='generator') Add and connect new component. Currently, components can be generators, charging points, heat pumps and storage units. This function creates a new bus the new component is connected to. The new bus is then connected to the grid depending on the specified voltage level (given in `comp_data` parameter). Components of voltage level 4 are connected to the HV/MV station. Components of voltage level 5 are connected to the nearest MV bus or line. In case the component is connected to a line, the line is split at the point closest to the new component (using perpendicular projection) and a new branch tee is added to connect the new component to. :param edisgo_object: :type edisgo_object: :class:`~.EDisGo` :param comp_data: Dictionary with all information on component. The dictionary must contain all required arguments of method :attr:`~.network.topology.Topology.add_generator`, :attr:`~.network.topology.Topology.add_storage_unit` respectively :attr:`~.network.topology.Topology.add_load`, except the `bus` that is assigned in this function, and may contain all other parameters of those methods. Additionally, the dictionary must contain the voltage level to connect in key 'voltage_level' and the geolocation in key 'geom'. The voltage level must be provided as integer, with possible options being 4 (component is connected directly to the HV/MV station) or 5 (component is connected somewhere in the MV grid). The geolocation must be provided as :shapely:`Shapely Point object`. :type comp_data: dict :param comp_type: Type of added component. Can be 'generator', 'charging_point', 'heat_pump' or 'storage_unit'. Default: 'generator'. :type comp_type: str :returns: The identifier of the newly connected component. :rtype: str .. py:method:: connect_to_lv(edisgo_object, comp_data, comp_type='generator', allowed_number_of_comp_per_bus=2) Add and connect new component to LV grid topology. This function is used in case the LV grids are not geo-referenced. In case LV grids are geo-referenced function :attr:`~.network.topology.Topology.connect_to_lv_based_on_geolocation` is used. Currently, components can be generators, charging points, heat pumps and storage units. This function connects the new component depending on the voltage level, and information on the MV/LV substation ID, geometry and sector, all provided in the `comp_data` parameter. It connects * Components with specified voltage level 6 * to MV/LV substation (a new bus is created for the new component, unless no geometry data is available, in which case the new component is connected directly to the substation) * Generators and storage units with specified voltage level 7 * with a nominal capacity of <=30 kW to LV loads of sector residential, if available * with a nominal capacity of >30 kW to LV loads of sector cts, industrial or agricultural, if available * to random bus in the LV grid as fallback if no appropriate load is available * Charging points with specified voltage level 7 * with sector 'home' to LV loads of sector residential, if available * with sector 'work' to LV loads of sector cts, industrial or agricultural, if available, otherwise * with sector 'public' or 'hpc' to some bus in the grid that is not a house connection * to random bus in the LV grid that is not a house connection if no appropriate load is available (fallback) * Heat pumps with specified voltage level 7 * with sector 'individual_heating' or 'individual_heating_resistive_heater' to LV loads * with sector 'district_heating' or 'district_heating_resistive_heater' to some bus in the grid that is not a house connection * to random bus in the LV grid that if no appropriate load is available (fallback) In case no MV/LV substation ID is provided a random LV grid is chosen. In case the provided MV/LV substation ID does not exist (i.e. in case of components in an aggregated load area), the new component is directly connected to the HV/MV station (will be changed once generators in aggregated areas are treated differently in ding0). The number of components of the same type connected at one load is restricted by the parameter `allowed_number_of_comp_per_bus`. If every possible load already has more than the allowed number then the new component is directly connected to the MV/LV substation. :param edisgo_object: :type edisgo_object: :class:`~.EDisGo` :param comp_data: Dictionary with all information on component. The dictionary must contain all required arguments of method :attr:`~.network.topology.Topology.add_generator` respectively :attr:`~.network.topology.Topology.add_load`, except the `bus` that is assigned in this function, and may contain all other parameters of those methods. Additionally, the dictionary must contain the voltage level to connect in key 'voltage_level' and may contain the geolocation in key 'geom' and the LV grid ID to connect the component in key 'mvlv_subst_id'. The voltage level must be provided as integer, with possible options being 6 (component is connected directly to the MV/LV substation) or 7 (component is connected somewhere in the LV grid). The geolocation must be provided as :shapely:`Shapely Point object` and the LV grid ID as integer. :type comp_data: dict :param comp_type: Type of added component. Can be 'generator', 'charging_point' or 'heat_pump'. Default: 'generator'. :type comp_type: str :param allowed_number_of_comp_per_bus: Specifies, how many components of the same type are at most allowed to be placed at the same bus. Default: 2. :type allowed_number_of_comp_per_bus: int :returns: The identifier of the newly connected component. :rtype: str .. rubric:: Notes For the allocation, loads are selected randomly (sector-wise) using a predefined seed to ensure reproducibility. .. py:method:: connect_to_lv_based_on_geolocation(edisgo_object, comp_data, comp_type, max_distance_from_target_bus=0.02) Add and connect new component to LV grid topology based on its geolocation. This function is used in case the LV grids are geo-referenced. In case LV grids are not geo-referenced function :attr:`~.network.topology.Topology.connect_to_lv` is used. Currently, components can be generators, charging points, heat pumps and storage units. In case the component is integrated in voltage level 6 it is connected to the closest MV/LV substation; in case it is integrated in voltage level 7 it is connected to the closest LV bus. In contrast to the connection of components to the MV level splitting of a line to connect a new component is not conducted. A new bus for the new component is only created in case the closest existing bus is farther away than what is specified through parameter `max_distance_from_target_bus`. Otherwise, the new component is directly connected to the nearest bus. :param edisgo_object: :type edisgo_object: :class:`~.EDisGo` :param comp_data: Dictionary with all information on component. The dictionary must contain all required arguments of method :attr:`~.network.topology.Topology.add_generator`, :attr:`~.network.topology.Topology.add_storage_unit` respectively :attr:`~.network.topology.Topology.add_load`, except the `bus` that is assigned in this function, and may contain all other parameters of those methods. Additionally, the dictionary must contain the voltage level to connect to in key 'voltage_level' and the geolocation in key 'geom'. The voltage level must be provided as integer, with possible options being 6 (component is connected directly to the MV/LV substation) or 7 (component is connected somewhere in the LV grid). The geolocation must be provided as :shapely:`Shapely Point object`. :type comp_data: dict :param comp_type: Type of new component. Can be 'generator', 'charging_point', 'heat_pump' or 'storage_unit'. :type comp_type: str :param max_distance_from_target_bus: Specifies the maximum distance of the component to the target bus in km before a new bus is created. If the new component is closer to the target bus than the maximum specified distance, it is directly connected to that target bus. Default: 0.1. :type max_distance_from_target_bus: int :returns: The identifier of the newly connected component as in index of :attr:`~.network.topology.Topology.generators_df`, :attr:`~.network.topology.Topology.loads_df` or :attr:`~.network.topology.Topology.storage_units_df`, depending on component type. :rtype: str .. py:method:: to_graph() Returns graph representation of the grid. :returns: Graph representation of the grid as networkx Ordered Graph, where lines are represented by edges in the graph, and buses and transformers are represented by nodes. :rtype: :networkx:`networkx.Graph<>` .. py:method:: to_geopandas(mode = None, lv_grid_id = None) Returns components as :geopandas:`GeoDataFrame`\ s. Returns container with :geopandas:`GeoDataFrame`\ s containing all georeferenced components within the grid. :param mode: If `mode` is None, GeoDataFrames for the MV grid and underlying LV grids is returned. If `mode` is "mv", GeoDataFrames for only the MV grid are returned. If `mode` is "lv", GeoDataFrames for the LV grid specified through `lv_grid_id` are returned. Default: None. :type mode: str :param lv_grid_id: Only needs to be provided in case `mode` is "lv". In that case `lv_grid_id` gives the LV grid ID as integer of the LV grid for which to return the geodataframes. :type lv_grid_id: int :returns: Data container with GeoDataFrames containing all georeferenced components within the grid. :rtype: :class:`~.tools.geopandas_helper.GeoPandasGridContainer` .. py:method:: to_csv(directory) Exports topology to csv files. The following attributes are exported: * 'loads_df' : Attribute :py:attr:`~loads_df` is saved to `loads.csv`. * 'generators_df' : Attribute :py:attr:`~generators_df` is saved to `generators.csv`. * 'storage_units_df' : Attribute :py:attr:`~storage_units_df` is saved to `storage_units.csv`. * 'transformers_df' : Attribute :py:attr:`~transformers_df` is saved to `transformers.csv`. * 'transformers_hvmv_df' : Attribute :py:attr:`~transformers_df` is saved to `transformers.csv`. * 'lines_df' : Attribute :py:attr:`~lines_df` is saved to `lines.csv`. * 'buses_df' : Attribute :py:attr:`~buses_df` is saved to `buses.csv`. * 'switches_df' : Attribute :py:attr:`~switches_df` is saved to `switches.csv`. * 'grid_district' : Attribute :py:attr:`~grid_district` is saved to `network.csv`. Attributes are exported in a way that they can be directly imported to pypsa. :param directory: Path to save topology to. :type directory: str .. py:method:: from_csv(data_path, edisgo_obj, from_zip_archive=False) Restores topology from csv files. :param data_path: Path to topology csv files or zip archive. :type data_path: str :param edisgo_obj: :type edisgo_obj: :class:`~.EDisGo` :param from_zip_archive: Set to True if data is archived in a zip archive. Default: False. :type from_zip_archive: bool .. py:method:: check_integrity() Check data integrity. Checks for duplicated labels and isolated components. Further checks for very small impedances that can cause stability problems in the power flow calculation and large line lengths that might be implausible. .. py:method:: assign_feeders(mode = 'grid_feeder') Assigns MV or LV feeder to each bus and line, depending on the `mode`. The feeder name is written to a new column `mv_feeder` or `grid_feeder`, depending on the `mode`, in :class:`~.network.topology.Topology`'s :attr:`~.network.topology.Topology.buses_df` and :attr:`~.network.topology.Topology.lines_df`. The MV feeder name corresponds to the name of the neighboring node of the HV/MV station. The grid feeder name corresponds to the name of the neighboring node of the respective grid's station. The feeder name of the source node, i.e. the station, is set to "station_node". :param mode: Specifies whether to assign MV or grid feeder. If mode is "mv_feeder" the MV feeder the buses and lines are in are determined. If mode is "grid_feeder" LV buses and lines are assigned the LV feeder they are in and MV buses and lines are assigned the MV feeder they are in. Default: "grid_feeder". :type mode: str .. py:method:: aggregate_lv_grid_at_station(lv_grid_id) Aggregates all LV grid components to secondary side of the grid's station. All lines of the LV grid are dropped, as well as all buses except the station's secondary side bus. Buses, the loads, generators and storage units are connected to are changed to the station's secondary side bus. The changes are directly applied to the Topology object. :param lv_grid_id: ID of the LV grid to aggregate. :type lv_grid_id: int or str .. py:method:: find_meshes() Find all meshes in the grid. :param edisgo_obj: EDisGo object. :type edisgo_obj: EDisGo :returns: List of all meshes in the grid. Each mesh is represented as a list of node indices. If no meshes are found, None is returned. :rtype: Optional[List[List[int]]]