Generate timeseries for eTraGo and pypsa-eur-sec

Call order
  • generate_model_data_eGon2035() / generate_model_data_eGon100RE() * generate_model_data()

    • generate_model_data_grid_district() * load_evs_trips() * data_preprocessing() * generate_load_time_series() * write_model_data_to_db()


# TODO REWORK Share of EV with access to private charging infrastructure (flex_share) for use cases work and home are not supported by simBEV v0.1.2 and are applied here (after simulation). Applying those fixed shares post-simulation introduces small errors compared to application during simBEV’s trip generation.

Values (cf. flex_share in scenario parameters were linearly extrapolated based upon (p.92): * eGon2035: home=0.8, work=1.0 * eGon100RE: home=1.0, work=1.0

data_preprocessing(scenario_data: pandas.core.frame.DataFrame, ev_data_df: pandas.core.frame.DataFrame) → pandas.core.frame.DataFrame[source]

Filter SimBEV data to match region requirements. Duplicates profiles if necessary. Pre-calculates necessary parameters for the load time series.

  • scenario_data (pd.Dataframe) – EV per grid district
  • ev_data_df (pd.Dataframe) – Trip data

pd.Dataframe – Trip data


Delete all eMob MIT data from eTraGo PF tables

generate_load_time_series(ev_data_df: pandas.core.frame.DataFrame, run_config: pandas.core.frame.DataFrame, scenario_data: pandas.core.frame.DataFrame) → pandas.core.frame.DataFrame[source]

Calculate the load time series from the given trip data. A dumb charging strategy is assumed where each EV starts charging immediately after plugging it in. Simultaneously the flexible charging capacity is calculated.

  • ev_data_df (pd.DataFrame) – Full trip data
  • run_config (pd.DataFrame) – simBEV metadata: run config
  • scenario_data (pd.Dataframe) – EV per grid district

pd.DataFrame – time series of the load and the flex potential

generate_model_data_bunch(scenario_name: str, bunch: range) → None[source]

Generates timeseries from simBEV trip data for a bunch of MV grid districts.

  • scenario_name (str) – Scenario name
  • bunch (list) – Bunch of grid districts to generate data for, e.g. [1,2,..,100]. Note: bunch is NOT a list of grid districts but is used for slicing the ordered list (by bus_id) of grid districts! This is used for parallelization. See

Generates timeseries for eGon100RE scenario for grid districts which has not been processed in the parallel tasks before.


Generates timeseries for eGon2035 scenario for grid districts which has not been processed in the parallel tasks before.

generate_model_data_grid_district(scenario_name: str, evs_grid_district: pandas.core.frame.DataFrame, bat_cap_dict: dict, run_config: pandas.core.frame.DataFrame) → tuple[source]

Generates timeseries from simBEV trip data for MV grid district

  • scenario_name (str) – Scenario name
  • evs_grid_district (pd.DataFrame) – EV data for grid district
  • bat_cap_dict (dict) – Battery capacity per EV type
  • run_config (pd.DataFrame) – simBEV metadata: run config

pd.DataFrame – Model data for grid district

generate_static_params(ev_data_df: pandas.core.frame.DataFrame, load_time_series_df: pandas.core.frame.DataFrame, evs_grid_district_df: pandas.core.frame.DataFrame) → dict[source]

Calculate static parameters from trip data.

  • cumulative initial SoC
  • cumulative battery capacity
  • simultaneous plugged in charging capacity
Parameters:ev_data_df (pd.DataFrame) – Fill trip data
Returns:dict – Static parameters
load_evs_trips(scenario_name: str, evs_ids: list, charging_events_only: bool = False, flex_only_at_charging_events: bool = True) → pandas.core.frame.DataFrame[source]

Load trips for EVs

  • scenario_name (str) – Scenario name
  • evs_ids (list of int) – IDs of EV to load the trips for
  • charging_events_only (bool) – Load only events where charging takes place
  • flex_only_at_charging_events (bool) – Flexibility only at charging events. If False, flexibility is provided by plugged-in EVs even if no charging takes place.

pd.DataFrame – Trip data

load_grid_district_ids() → pandas.core.series.Series[source]

Load bus IDs of all grid districts

write_model_data_to_db(static_params_dict: dict, load_time_series_df: pandas.core.frame.DataFrame, bus_id: int, scenario_name: str, run_config: pandas.core.frame.DataFrame, bat_cap: pandas.core.frame.DataFrame) → None[source]

Write all results for grid district to database

  • static_params_dict (dict) – Static model params
  • load_time_series_df (pd.DataFrame) – Load time series for grid district
  • bus_id (int) – ID of grid district
  • scenario_name (str) – Scenario name
  • run_config (pd.DataFrame) – simBEV metadata: run config
  • bat_cap (pd.DataFrame) – Battery capacities per EV type