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.
oedb(edisgo_object, generator_scenario, **kwargs)¶
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
Parameters: 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.
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
to_pypsa(grid_object, timesteps, **kwargs)¶
Export edisgo object to PyPSA Network
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
- grid_object (
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.
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.
The PyPSA network container.
- 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
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_ang_seedare 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.
process_pfa_results(edisgo, pypsa, timesteps)¶
Passing power flow results from PyPSA to
P and Q are returned from the line ending/transformer side with highest apparent power S, exemplary written as
Resultsto understand how results of power flow analysis are structured in eDisGo.
import_feedin_timeseries(config_data, weather_cell_ids, timeindex)¶
Import RES feed-in time series data and process
ToDo: Update docstring.
DataFrame with time series for active power feed-in, normalized to a capacity of 1 MW.