Time series

Before a power flow can be run, every load, generator and storage unit needs an active- and reactive-power time series. eDisGo offers several ways to set them.

Note

Set the time index before setting any time series — either via the timeindex argument of the EDisGo constructor or with set_timeindex(). And remember the ordering rules: reactive power is always set last.

Reference year

All time series of an EDisGo object are indexed in one calendar year, the reference year. It defaults to 2011, the weather year of the model data, and is set in section timeindex of config_timeseries.cfg (see config_timeseries):

[timeindex]
reference_year = 2011

It can also be changed on an existing object before any time series is set:

edisgo.config["timeindex"]["reference_year"] = 2013

A time index or time series in another year, e.g. one passed to set_timeindex() or to an import, is relabelled to the reference year with a warning. The data is only relabelled, not changed: each time step keeps its date and time, so 1 March stays 1 March. The scenario of a database import only selects which data is loaded, it does not set the year.

29 February is always left out, also if the reference year is a leap year, so a year always has 365 days. A time index across the year boundary, e.g. from 31 December to 1 January, raises a ValueError. The worst-case time index starting 1970-01-01 (see Worst-case) is not changed.

The relabelling is done by the import and set_* methods, e.g. set_time_series_manual(), set_cop() or from_etrago(). Data assigned directly to an attribute, e.g. edisgo.dsm.p_min, edisgo.heat_pump.cop_df or an attribute of edisgo.overlying_grid, or passed to set_active_power_manual(), is stored as given and must already be indexed in the reference year.

Active power

There are five ways to set active-power series:

Manual

Provide your own series with set_time_series_manual(). Pass a pandas DataFrame per component category, indexed by the time index and with one column per component:

import pandas as pd

edisgo.set_time_series_manual(
    loads_p=pd.DataFrame(
        {"Load_1": [0.5, 0.6]}, index=edisgo.timeseries.timeindex
    ),
)

The arguments are generators_p, loads_p, storage_units_p for active power and generators_q, loads_q, storage_units_q for reactive power. Values are in MW (active) and Mvar (reactive); the DataFrame index must contain the time index set on the object.

Worst-case

Set feed-in and load for the two classic grid-planning situations — heavy load (load_case) and reverse power flow (feed-in_case) — using simultaneity factors from the configuration files. This sets both active and reactive power (reactive power with fixed cos φ from the config), so no separate reactive-power step is needed afterwards.

edisgo.set_time_series_worst_case_analysis()

A fictitious time index starting 1970-01-01 00:00 is set automatically (PyPSA needs a time index). Each case is set up once for the MV and once for the LV level, so there are four time steps in total; edisgo.timeseries.timeindex_worst_cases tells you which time step maps to which case. Note that this overwrites any previously set (non-worst-case) time series. The definition of load and feed-in case is explained in Load case and feed-in case.

Predefined

Set series by component type, either from your own data or from public sources. Each component group has its own argument; a call with no arguments sets no time series at all, so you have to specify the desired source explicitly, e.g.:

edisgo.set_time_series_active_power_predefined(
    fluctuating_generators_ts="oedb",
    conventional_loads_ts="demandlib",
)
  • Fluctuating generators (fluctuating_generators_ts) — wind and solar feed-in from the oedb (OpenEnergy DataBase), or your own normalised profiles per technology (optionally per technology and weather cell) passed as a DataFrame.

  • Dispatchable generators (dispatchable_generators_ts) — your own normalised profiles per technology, where a column "other" acts as catch-all for all technologies not listed explicitly.

  • Conventional loads (conventional_loads_ts) — standard load profiles per sector via demandlib, scenario-specific per-building profiles from the oedb (requires an engine and a scenario), or your own sector profiles as a DataFrame (see Data sources).

  • Charging points (charging_points_ts) — pass normalised profiles per use case (there is no oedb source for charging points, and only the use cases you supply are set). If you omit it, charging points — including public ones — are left without a series. To set them automatically instead, use apply_charging_strategy() (see Charging strategies (heuristic)), which covers all charging points (public/hpc charged “dumb”).

See set_time_series_active_power_predefined() for all options. If no time index has been set, a full-year index in the reference year is set automatically.

Optimised

Optimise the operation of flexibilities (EV charging, heat pumps with thermal storage, DSM, storage) with a multi-period optimal power flow, so that grid expansion is minimised. This is pm_optimize(); it is documented in detail in Multi-period optimal power flow.

Heuristic

Apply rule-based operation strategies. For electric vehicles use a charging strategy:

edisgo.apply_charging_strategy(strategy="dumb")  # "dumb", "reduced" or "residual"

For heat pumps, the (currently uncontrolled) operating strategy serves the heat demand directly from the heat pump:

edisgo.apply_heat_pump_operating_strategy()

See Heat pumps for details.

Reactive power

Two options exist for setting reactive power explicitly (note that set_time_series_worst_case_analysis() already sets fixed-cos-φ reactive power itself, so neither is needed after a worst-case setup).

Manual

Provide your own series, as for active power above.

Fixed cos φ

Derive reactive power from active power with a fixed power factor:

edisgo.set_time_series_reactive_power_control()

By default ("default") the power factors and inductive/capacitive mode are taken from the configuration files. You can override them per component group via the generators_parametrisation / loads_parametrisation / storage_units_parametrisation arguments (a DataFrame with columns components, mode and power_factor), or set a group to None to leave it untouched — all three default to "default". Make sure the active-power series are set first. The sign conventions and the formula Q = P · tan(arccos(cos φ)) are explained in Reactive power.

Scaling existing series

Already-set series can be scaled up or down (e.g. for a sensitivity study) with scale_timeseries(), applied in place to all generators, loads and storage units:

edisgo.timeseries.scale_timeseries(p_scaling_factor=1.1, q_scaling_factor=1.0)