dynamic_impact

Main Calculation Functions

ecodynelec.dynamic_impact.dynamic_impact(prod_imp: dict, mix_imp: dict, flows: ~pandas.core.frame.DataFrame, prod_mix: dict, mix_dict: dict, impact_matrix: ~pandas.core.frame.DataFrame, network_impact: dict, step_imp_memory: dict, parameter, is_verbose=False) -> (<class 'dict'>, <class 'dict'>)[source]

Computes the dynamic environmental impacts of storage for given production and mix data within a time series. Adjusts the impact values dynamically based on storage factors such as natural inflow and pumpage inflow percentages, and applies this computation across specified countries and a global scope.

Parameters:
  • prod_imp (dict) – A dictionary containing production impact data with hierarchical structures per country and by energy technology types.

  • mix_imp (dict) – A dictionary containing environmental mix impact data with hierarchical structures per country and by energy technology types.

  • flows (pd.DataFrame) – A DataFrame containing raw production and consumption data for each technologies in country.

  • prod_mix (dict) – A dictionary that provides data regarding production mixes for energy technologies per country.

  • mix_dict (dict) – A dictionary containing mix-related data used for adjusting mix impacts per country.

  • impact_matrix (pd.DataFrame) – A DataFrame representing the initial impact values per technology type for dynamic computation adjustments.

  • step_imp_memory (dict) – Dictionnary containing the last STEP impact of the last year

  • parameter (class) – Class encapsulating various settings, including parameters for interpolated storage, start and end times, and storage path configuration.

  • is_verbose (bool, optional) – A flag indicating whether detailed information should be logged during the computation process. Default is False.

Returns:

  • prod_imp (dict) – Updated dictionary for production impacts after applying the dynamic storage impact computation.

  • mix_imp (dict) – Updated dictionary for mix environmental impacts after applying the dynamic storage impact computation.

  • step_imp (dict) – Dictionnary containing the last STEP impact of the last year

ecodynelec.dynamic_impact.dynamic_storage_shares(storage: DataFrame, flows: DataFrame, storage_mode: str, is_verbose: bool) DataFrame[source]

Calculate dynamic storage shares based on provided storage data, flows, and production mix.

This function computes the dynamic shares of storage considering turbine production, turbine consumption, natural pumping, and overflow mechanisms depending on the specified storage mode. It also tracks the losses and categorizes storage into natural and pumped categories over each time step. The computation begins with initial conditions and iteratively updates the shares for each subsequent time step.

Parameters:
  • storage (pd.DataFrame) – DataFrame containing information about storage levels and maxima. If None, the index will be derived from the production mix.

  • flows (pd.DataFrame) – A DataFrame containing raw production and consumption data for each technologies in country.

  • storage_mode (str) – Mode of storage calculation. It supports two values: - ‘interpolated’: Storage levels are calculated with respect to maximum storage values. - ‘flow-based’: Assumes no overflow, with constant storage levels.

  • is_verbose (bool) – Flag to enable or disable detailed verbosity during the computation process.

Returns:

DataFrame containing time-series of computed storage shares. Columns include: - ‘sj’: Current storage level - ‘sjj’: Previous storage level - ‘turbine production’: Turbine outflow (production from storage) - ‘turbine consumption’: Turbine inflow (consumption into storage) - ‘overflow’: Overflow due to exceeding maxima - ‘natural pumping’: Residual balance of natural pumping - ‘losses’: Total losses including turbine production and overflow - ‘SN’: Share of natural inflows - ‘SP’: Share of pumping inflows

Return type:

pd.DataFrame

Data Loading and Processing

ecodynelec.dynamic_impact.load_concat_files(folder_path, is_verbose=False)[source]

Concatenates all CSV files found in the specified folder.

Parameters:
  • folder_path (str) – Path to the directory containing the yearly CSV files.

  • is_verbose (bool, optional) – If True, prints each file being read and raises errors when files are missing. Default is False.

Returns:

df

Return type:

DataFrame with DatetimeIndex

ecodynelec.dynamic_impact.interpolate_storage_hourly(df)[source]

Interpolates storage data to obtain hourly values.

Parameters:

df (DataFrame with DatetimeIndex and numeric columns)

Return type:

DataFrame with hourly frequency and interpolated values