edisgo.io.electromobility_import

Module Contents

Functions

import_electromobility_from_dir(edisgo_obj, ...)

Import electromobility data from

read_csvs_charging_processes(csv_path[, mode, csv_dir])

Reads all CSVs in a given path and returns a DataFrame with all

read_simbev_config_df(path, edisgo_obj[, ...])

Get SimBEV config data.

read_gpkg_potential_charging_parks(path, edisgo_obj)

Get GeoDataFrame with all

assure_minimum_potential_charging_parks(edisgo_obj, ...)

distribute_charging_demand(edisgo_obj, **kwargs)

Distribute charging demand from SimBEV onto potential charging parks from TracBEV.

get_weights_df(edisgo_obj, ...)

Get weights per potential charging point for a given set of grid connection indices.

normalize(weights_df)

Normalize a given DataFrame so that its sum equals 1 and return a

combine_weights(potential_charging_park_indices, ...)

Add designated charging capacity weights into the initial weights and

weighted_random_choice(edisgo_obj, ...[, rng])

Weighted random choice of a potential charging park. Setting the chosen

distribute_private_charging_demand(edisgo_obj)

Distributes all private charging processes. Each car gets its own

distribute_public_charging_demand(edisgo_obj, **kwargs)

Distributes all public charging processes. For each process it is

determine_grid_connection_capacity(...[, lower_limit, ...])

integrate_charging_parks(edisgo_obj)

Integrates all designated charging parks into the grid.

import_electromobility_from_oedb(edisgo_obj, scenario, ...)

Gets electromobility data for specified scenario from oedb.

simbev_config_from_oedb(scenario, engine)

Gets simbev_config_df

potential_charging_parks_from_oedb(edisgo_obj, engine)

Gets potential_charging_parks_gdf

charging_processes_from_oedb(edisgo_obj, engine, ...)

Gets charging_processes_df data

edisgo.io.electromobility_import.import_electromobility_from_dir(edisgo_obj: edisgo.EDisGo, simbev_directory: pathlib.PurePath | str, tracbev_directory: pathlib.PurePath | str, **kwargs)[source]

Import electromobility data from SimBEV and TracBEV from directory.

Parameters:
  • edisgo_obj (EDisGo) –

  • simbev_directory (str or pathlib.PurePath) – SimBEV directory holding SimBEV data.

  • tracbev_directory (str or pathlib.PurePath) – TracBEV directory holding TracBEV data.

  • kwargs

    Kwargs may contain any further attributes you want to specify.

    gc_to_car_rate_homefloat

    Specifies the minimum rate between potential charging parks points for the use case “home” and the total number of cars. Default 0.5 .

    gc_to_car_rate_workfloat

    Specifies the minimum rate between potential charging parks points for the use case “work” and the total number of cars. Default 0.25 .

    gc_to_car_rate_publicfloat

    Specifies the minimum rate between potential charging parks points for the use case “public” and the total number of cars. Default 0.1 .

    gc_to_car_rate_hpcfloat

    Specifies the minimum rate between potential charging parks points for the use case “hpc” and the total number of cars. Default 0.005 .

    mode_parking_timesstr

    If the mode_parking_times is set to “frugal” only parking times with any charging demand are imported. Default “frugal”.

    charging_processes_dirstr

    Charging processes sub-directory. Default None.

    simbev_config_filestr

    Name of the simbev config file. Default “metadata_simbev_run.json”.

edisgo.io.electromobility_import.read_csvs_charging_processes(csv_path, mode='frugal', csv_dir=None)[source]

Reads all CSVs in a given path and returns a DataFrame with all SimBEV charging processes.

Parameters:
  • csv_path (str) – Main path holding SimBEV output data

  • mode (str) – Returns all information if None. Returns only rows with charging demand greater than 0 if “frugal”. Default: “frugal”.

  • csv_dir (str) – Optional sub-directory holding charging processes CSVs under path. Default: None.

Returns:

DataFrame with AGS, car ID, trip destination, charging use case (private or public), netto charging capacity, charging demand, charge start, charge end, potential charging park ID and charging point ID.

Return type:

pandas.DataFrame

edisgo.io.electromobility_import.read_simbev_config_df(path, edisgo_obj, simbev_config_file='metadata_simbev_run.json')[source]

Get SimBEV config data.

Parameters:
  • path (str) – Main path holding SimBEV output data.

  • edisgo_obj (EDisGo) –

  • simbev_config_file (str) – SimBEV config file name. Default: “metadata_simbev_run.json”.

Returns:

DataFrame with used random seed, used threads, stepsize in minutes, year, scenarette, simulated days, maximum number of cars per AGS, completed standing times and time series per AGS and used ramp up data CSV.

Return type:

pandas.DataFrame

edisgo.io.electromobility_import.read_gpkg_potential_charging_parks(path, edisgo_obj)[source]

Get GeoDataFrame with all TracBEV potential charging parks.

Parameters:
  • path (str) – Main path holding TracBEV data.

  • edisgo_obj (EDisGo) –

Returns:

GeoDataFrame with AGS, charging use case (home, work, public or hpc), user-centric weight and geometry.

Return type:

geopandas.GeoDataFrame

edisgo.io.electromobility_import.assure_minimum_potential_charging_parks(edisgo_obj: edisgo.EDisGo, potential_charging_parks_gdf: geopandas.GeoDataFrame, **kwargs)[source]
edisgo.io.electromobility_import.distribute_charging_demand(edisgo_obj, **kwargs)[source]

Distribute charging demand from SimBEV onto potential charging parks from TracBEV.

Parameters:
  • edisgo_obj (EDisGo) –

  • kwargs

    Kwargs may contain any further attributes you want to specify.

    modestr

    Distribution mode. If the mode is set to “user_friendly” only the simbev weights are used for the distribution. If the mode is “grid_friendly” also grid conditions are respected. Default “user_friendly”.

    generators_weight_factorfloat

    Weighting factor of the generators weight within an LV grid in comparison to the loads weight. Default 0.5.

    distance_weightfloat

    Weighting factor for the distance between a potential charging park and its nearest substation in comparison to the combination of the generators and load factors of the LV grids. Default 1 / 3.

    user_friendly_weightfloat

    Weighting factor of the user friendly weight in comparison to the grid friendly weight. Default 0.5.

edisgo.io.electromobility_import.get_weights_df(edisgo_obj, potential_charging_park_indices, **kwargs)[source]

Get weights per potential charging point for a given set of grid connection indices.

Parameters:
  • edisgo_obj (EDisGo) –

  • potential_charging_park_indices (list) – List of potential charging parks indices

  • mode (str) – Only use user friendly weights (“user_friendly”) or combine with grid friendly weights (“grid_friendly”). Default: “user_friendly”.

  • user_friendly_weight (float) – Weight of user friendly weight if mode “grid_friendly”. Default: 0.5.

  • distance_weight (float) – Grid friendly weight is a combination of the installed capacity of generators and loads within a LV grid and the distance towards the nearest substation. This parameter sets the weight for the distance parameter. Default: 1/3.

Returns:

DataFrame with numeric weights

Return type:

pandas.DataFrame

edisgo.io.electromobility_import.normalize(weights_df)[source]

Normalize a given DataFrame so that its sum equals 1 and return a flattened Array.

Parameters:

weights_df (pandas.DataFrame) – DataFrame with single numeric column

Returns:

Array with normalized weights

Return type:

Numpy 1-D array

edisgo.io.electromobility_import.combine_weights(potential_charging_park_indices, designated_charging_point_capacity_df, weights_df)[source]

Add designated charging capacity weights into the initial weights and normalize weights

Parameters:
  • potential_charging_park_indices (list) – List of potential charging parks indices

  • designated_charging_point_capacity_dfpandas.DataFrame DataFrame with designated charging point capacity per potential charging park

  • weights_df (pandas.DataFrame) – DataFrame with initial user or combined weights

Returns:

Array with normalized weights

Return type:

Numpy 1-D array

edisgo.io.electromobility_import.weighted_random_choice(edisgo_obj, potential_charging_park_indices, car_id, destination, charging_point_id, normalized_weights, rng=None)[source]

Weighted random choice of a potential charging park. Setting the chosen values into charging_processes_df

Parameters:
  • edisgo_obj (EDisGo) –

  • potential_charging_park_indices (list) – List of potential charging parks indices

  • car_id (int) – Car ID

  • destination (str) – Trip destination

  • charging_point_id (int) – Charging Point ID

  • normalized_weights (Numpy 1-D array) – Array with normalized weights

  • rng (Numpy random generator) – If None a random generator with seed=charging_point_id is initialized

Returns:

Chosen Charging Park ID

Return type:

int

edisgo.io.electromobility_import.distribute_private_charging_demand(edisgo_obj)[source]

Distributes all private charging processes. Each car gets its own private charging point if a charging process takes place.

Parameters:

edisgo_obj (EDisGo) –

edisgo.io.electromobility_import.distribute_public_charging_demand(edisgo_obj, **kwargs)[source]

Distributes all public charging processes. For each process it is checked if a matching charging point exists to minimize the number of charging points.

Parameters:

edisgo_obj (EDisGo) –

edisgo.io.electromobility_import.determine_grid_connection_capacity(total_charging_point_capacity, lower_limit=0.3, upper_limit=1.0, minimum_factor=0.45)[source]
edisgo.io.electromobility_import.integrate_charging_parks(edisgo_obj)[source]

Integrates all designated charging parks into the grid.

The charging time series at each charging park are not set in this function.

Parameters:

edisgo_obj (EDisGo) –

edisgo.io.electromobility_import.import_electromobility_from_oedb(edisgo_obj: edisgo.EDisGo, scenario: str, engine: sqlalchemy.engine.base.Engine, **kwargs)[source]

Gets electromobility data for specified scenario from oedb.

Electromobility data includes data on standing times, charging demand, etc. per vehicle, as well as information on potential charging point locations.

Parameters:
  • edisgo_obj (EDisGo) –

  • scenario (str) – Scenario for which to retrieve electromobility data. Possible options are ‘eGon2035’ and ‘eGon100RE’.

  • engine (sqlalchemy.Engine) – Database engine.

  • kwargs – Possible options are gc_to_car_rate_home, gc_to_car_rate_work, gc_to_car_rate_public, gc_to_car_rate_hpc, and mode_parking_times. See parameter documentation of import_electromobility_data_kwds parameter in import_electromobility for more information.

edisgo.io.electromobility_import.simbev_config_from_oedb(scenario: str, engine: sqlalchemy.engine.base.Engine)[source]

Gets simbev_config_df for specified scenario from oedb.

Parameters:
  • scenario (str) – Scenario for which to retrieve electromobility data. Possible options are ‘eGon2035’ and ‘eGon100RE’.

  • engine (sqlalchemy.Engine) – Database engine.

Returns:

See simbev_config_df for more information.

Return type:

pandas.DataFrame

edisgo.io.electromobility_import.potential_charging_parks_from_oedb(edisgo_obj: edisgo.EDisGo, engine: sqlalchemy.engine.base.Engine)[source]

Gets potential_charging_parks_gdf data from oedb.

Parameters:
Returns:

See potential_charging_parks_gdf for more information.

Return type:

geopandas.GeoDataFrame

edisgo.io.electromobility_import.charging_processes_from_oedb(edisgo_obj: edisgo.EDisGo, engine: sqlalchemy.engine.base.Engine, scenario: str, **kwargs)[source]

Gets charging_processes_df data for specified scenario from oedb.

Parameters:
  • edisgo_obj (EDisGo) –

  • engine (sqlalchemy.Engine) – Database engine.

  • scenario (str) – Scenario for which to retrieve data. Possible options are ‘eGon2035’ and ‘eGon100RE’.

  • kwargs – Possible option is mode_parking_times. See parameter documentation of import_electromobility_data_kwds parameter in import_electromobility for more information.

Returns:

See charging_processes_df for more information.

Return type:

pandas.DataFrame