Quickstart

Installation

Install latest eDisGo version through pip. Therefore, we highly recommend using a virtual environment and use its pip.

pip3 install edisgo

In order to create plots with background maps you additionally need to install the python package contextily.

Consider to install a developer version as detailed in Notes to developers.

Prerequisites

Beyond a running and up-to-date installation of eDisGo you need grid topology data. Currently synthetic grid data generated with the python project Ding0 is the only supported data source. You can retrieve data from Zenodo (make sure you choose latest data) or check out the ding0 documentation on how to generate grids yourself.

A minimum working example

Following you find short examples on how to use eDisGo. Further examples and details are provided in Usage details.

All following examples assume you have a ding0 grid topology file named “ding0_grids__42.pkl” in current working directory.

Aside from grid topology data you may eventually need a dataset on future installation of power plants. You may therefore use the scenarios developed in the open_eGo project that are available in the OpenEnergy DataBase (oedb) hosted on the OpenEnergy Platform (OEP). eDisGo provides an interface to the oedb using the package ego.io. ego.io gives you a python SQL-Alchemy representations of the oedb and access to it by using the oedialect, an SQL-Alchemy dialect used by the OEP.

You can run a worst-case scenario as follows:

Using package included command-line script

edisgo_run -f ding0_grids__42.pkl -wc

Or coding the script yourself with finer control of details

from edisgo import EDisGo

# Set up the EDisGo object that will import the grid topology, set up
# feed-in and load time series (here for a worst case analysis)
# and other relevant data
edisgo = EDisGo(ding0_grid="ding0_grids__42.pkl",
                worst_case_analysis='worst-case')

# Import scenario for future generators from the oedb
edisgo.import_generators(generator_scenario='nep2035')

# Conduct grid analysis (non-linear power flow)
edisgo.analyze()

# Do grid reinforcement
edisgo.reinforce()

# Determine costs for each line/transformer that was reinforced
costs = edisgo.network.results.grid_expansion_costs

Instead of conducting a worst-case analysis you can also provide specific time series:

import pandas as pd
from edisgo import EDisGo

# Set up the EDisGo object with your own time series
# (these are dummy time series!)
# timeindex specifies which time steps to consider in power flow
timeindex = pd.date_range('1/1/2011', periods=4, freq='H')
# load time series (scaled by annual demand)
timeseries_load = pd.DataFrame({'residential': [0.0001] * len(timeindex),
                                'commercial': [0.0002] * len(timeindex),
                                'industrial': [0.0015] * len(timeindex),
                                'agricultural': [0.00005] * len(timeindex)},
                               index=timeindex)
# feed-in time series of fluctuating generators (scaled by nominal power)
timeseries_generation_fluctuating = \
    pd.DataFrame({'solar': [0.2] * len(timeindex),
                  'wind': [0.3] * len(timeindex)},
                 index=timeindex)
# feed-in time series of dispatchable generators (scaled by nominal power)
timeseries_generation_dispatchable = \
    pd.DataFrame({'biomass': [1] * len(timeindex),
                  'coal': [1] * len(timeindex),
                  'other': [1] * len(timeindex)},
                 index=timeindex)

# Set up the EDisGo object with your own time series and generator scenario
# NEP2035
edisgo = EDisGo(
    ding0_grid="ding0_grids__42.pkl",
    generator_scenario='nep2035',
    timeseries_load=timeseries_load,
    timeseries_generation_fluctuating=timeseries_generation_fluctuating,
    timeseries_generation_dispatchable=timeseries_generation_dispatchable,
    timeindex=timeindex)

# Do grid reinforcement
edisgo.reinforce()

# Determine cost for each line/transformer that was reinforced
costs = edisgo.network.results.grid_expansion_costs

Time series for load and fluctuating generators can also be automatically generated using the provided API for the oemof demandlib and the OpenEnergy DataBase:

import pandas as pd
from edisgo import EDisGo

# Set up the EDisGo object using the OpenEnergy DataBase and the oemof
# demandlib to set up time series for loads and fluctuating generators
# (time series for dispatchable generators need to be provided)
timeindex = pd.date_range('1/1/2011', periods=4, freq='H')
timeseries_generation_dispatchable = \
    pd.DataFrame({'other': [1] * len(timeindex)},
                 index=timeindex)
edisgo = EDisGo(
    ding0_grid="ding0_grids__42.pkl",
    generator_scenario='ego100',
    timeseries_load='demandlib',
    timeseries_generation_fluctuating='oedb',
    timeseries_generation_dispatchable=timeseries_generation_dispatchable,
    timeindex=timeindex)

# Do grid reinforcement
edisgo.reinforce()

# Determine cost for each line/transformer that was reinforced
costs = edisgo.network.results.grid_expansion_costs

Parallelization

Try run_edisgo_pool_flexible() for parallelization of your custom function.