edisgo.io package

edisgo.io.ding0_import module

edisgo.io.ding0_import.import_ding0_grid(path, edisgo_obj)[source]

Import an eDisGo network topology from Ding0 data.

This import method is specifically designed to load network topology data in the format as Ding0 provides it via csv files.

Parameters:
  • path (str) – Path to ding0 network csv files.
  • edisgo_obj (EDisGo) – The eDisGo data container object.

edisgo.io.generators_import module

edisgo.io.generators_import.oedb(edisgo_object, generator_scenario, **kwargs)[source]

Gets generator park for specified scenario from oedb and integrates them into the grid.

The importer uses SQLAlchemy ORM objects. These are defined in ego.io.

For further information see also import_generators.

Parameters:
  • edisgo_object (EDisGo) –
  • generator_scenario (str) – Scenario for which to retrieve generator data. Possible options are ‘nep2035’ and ‘ego100’.
Other Parameters:
 
  • remove_decommissioned (bool) – If True, removes generators from network that are not included in the imported dataset (=decommissioned). Default: True.
  • update_existing (bool) – If True, updates capacity of already existing generators to capacity specified in the imported dataset. Default: True.
  • p_target (dict or None) – Per default, no target capacity is specified and generators are expanded as specified in the respective scenario. However, you may want to use one of the scenarios but have slightly more or less generation capacity than given in the respective scenario. In that case you can specify the desired target capacity per technology type using this input parameter. The target capacity dictionary must have technology types (e.g. ‘wind’ or ‘solar’) as keys and corresponding target capacities in MW as values. If a target capacity is given that is smaller than the total capacity of all generators of that type in the future scenario, only some of the generators in the future scenario generator park are installed, until the target capacity is reached. If the given target capacity is greater than that of all generators of that type in the future scenario, then each generator capacity is scaled up to reach the target capacity. Be careful to not have much greater target capacities as this will lead to unplausible generation capacities being connected to the different voltage levels. Also be aware that only technologies specified in the dictionary are expanded. Other technologies are kept the same. Default: None.
  • allowed_number_of_comp_per_lv_bus (int) – Specifies, how many generators are at most allowed to be placed at the same LV bus. Default: 2.

edisgo.io.pypsa_io module

This module provides tools to convert graph based representation of the network topology to PyPSA data model. Call to_pypsa() to retrieve the PyPSA network container.

edisgo.io.pypsa_io.to_pypsa(grid_object, timesteps, **kwargs)[source]

Export edisgo object to PyPSA Network

For details from a user perspective see API documentation of analyze() of the API class EDisGo.

Translating eDisGo’s network topology to PyPSA representation is structured into translating the topology and adding time series for components of the network. In both cases translation of MV network only (mode=’mv’, mode=’mvlv’), LV network only(mode=’lv’), MV and LV (mode=None) share some code. The code is organized as follows:

  • Medium-voltage only (mode=’mv’): All medium-voltage network components are exported including the medium voltage side of LV station. Transformers are not exported in this mode. LV network load and generation is considered using append_lv_components(). Time series are collected and imported to PyPSA network.
  • Medium-voltage including transformers (mode=’mvlv’). Works similar as the first mode, only attaching LV components to the LV side of the LVStation and therefore also adding the transformers to the PyPSA network.
  • Low-voltage only (mode=’lv’): LV network topology including the MV-LV transformer is exported. The slack is defind at primary side of the MV-LV transformer.
  • Both level MV+LV (mode=None): The entire network topology is translated to PyPSA in order to perform a complete power flow analysis in both levels together. First, both network levels are translated seperately and then merged. Time series are obtained at once for both network levels.

This PyPSA interface is aware of translation errors and performs so checks on integrity of data converted to PyPSA network representation

  • Sub-graphs/ Sub-networks: It is ensured the network has no islanded parts
  • Completeness of time series: It is ensured each component has a time series
  • Buses available: Each component (load, generator, line, transformer) is connected to a bus. The PyPSA representation is check for completeness of buses.
  • Duplicate labels in components DataFrames and components’ time series DataFrames
Parameters:
  • grid_object (EDisGo or Grid) – EDisGo or grid object
  • mode (str) –

    Determines network levels that are translated to PyPSA network representation. Specify

    • None to export MV and LV network levels. None is the default.
    • ’mv’ to export MV network level only. This includes cumulative load and generation from underlying LV network aggregated at respective LV station’s primary side.
    • ’mvlv’ to export MV network level only. This includes cumulative load and generation from underlying LV network aggregated at respective LV station’s secondary side. #ToDo change name of this mode or use kwarg to define where to aggregate lv loads and generation
    • ’lv’ to export specified LV network only.
  • timesteps (pandas.DatetimeIndex or pandas.Timestamp) – Timesteps specifies which time steps to export to pypsa representation and use in power flow analysis.
Other Parameters:
 

use_seed (bool) – Use a seed for the initial guess for the Newton-Raphson algorithm. Only available when MV level is included in the power flow analysis. If True, uses voltage magnitude results of previous power flow analyses as initial guess in case of PQ buses. PV buses currently do not occur and are therefore currently not supported. Default: False.

Returns:

The PyPSA network container.

Return type:

pypsa.Network

edisgo.io.pypsa_io.set_seed(edisgo_obj, pypsa_network)[source]

Set initial guess for the Newton-Raphson algorithm.

In PyPSA an initial guess for the Newton-Raphson algorithm used in the power flow analysis can be provided to speed up calculations. For PQ buses, which besides the slack bus, is the only bus type in edisgo, voltage magnitude and angle need to be guessed. If the power flow was already conducted for the required time steps and buses, the voltage magnitude and angle results from previously conducted power flows stored in pfa_v_mag_pu_seed and pfa_v_ang_seed are used as the initial guess. Always the latest power flow calculation is used and only results from power flow analyses including the MV level are considered, as analysing single LV grids is currently not in the focus of edisgo and does not require as much speeding up, as analysing single LV grids is usually already quite quick. If for some buses or time steps no power flow results are available, default values are used. For the voltage magnitude the default value is 1 and for the voltage angle 0.

Parameters:
  • edisgo_obj (EDisGo) –
  • pypsa_network (pypsa.Network) – Pypsa network in which seed is set.
edisgo.io.pypsa_io.process_pfa_results(edisgo, pypsa, timesteps)[source]

Passing power flow results from PyPSA to Results.

Parameters:

Notes

P and Q are returned from the line ending/transformer side with highest apparent power S, exemplary written as

S_{max} = max(\sqrt{P_0^2 + Q_0^2}, \sqrt{P_1^2 + Q_1^2}) \
P = P_0 P_1(S_{max}) \
Q = Q_0 Q_1(S_{max})

See also

Results to understand how results of power flow analysis are structured in eDisGo.

edisgo.io.timeseries_import module

edisgo.io.timeseries_import.import_feedin_timeseries(config_data, weather_cell_ids, timeindex)[source]

Import RES feed-in time series data and process

ToDo: Update docstring.

Parameters:
  • config_data (dict) – Dictionary containing config data from config files.
  • weather_cell_ids (list) – List of weather cell id’s (integers) to obtain feed-in data for.
Returns:

DataFrame with time series for active power feed-in, normalized to a capacity of 1 MW.

Return type:

pandas.DataFrame