rws_py package

Submodules

rws_py.analysis_universal module

New residual analysis unifying for weather data and ESM residuals.

Created on Sat Jan 25 11:21:18 2025

@author: atakan

rws_py.analysis_universal.generate_test_data(duration_hours=48, resolution_minutes=60)[source]

Generate test data with datetime index

rws_py.analysis_universal.plot_analysis_b(evaluation_df, thresh_n='default', file=None, label=None, y_max=None)[source]

Scatterplot of periods with neg. residuals vs. the following pos. residual

Parameters:
  • evaluation_df (dictionary withpandas dataFrame) – period lengths and integgrals for negative residuals and th directly following positive residuals.

  • thresh_n (float, optional) –

    threshold-dictionary name (part, typically “basic”, “direct” or

    ”default”. The default is “default”.

  • file (string, optional) – filename without ending for storing the plot. The default is None.

  • label (string, optional) – title of the plot. The default is None.

Return type:

None.

rws_py.analysis_universal.plot_histo_analysis(results, select=None, en_t='title', name_file='histo', bins=[0, 1, 2, 4, 8, 16, 32, 64, 128, 200], integral=False, n_bins_middle=10)[source]

Create visualizations for the analysis results with improved period distribution plots

rws_py.analysis_universal.plot_histo_int_analysis(results, select=None, en_t='title', name_file='histo', bins=[0, 1, 2, 4, 8, 16, 32, 64, 128, 200], integral=False, n_bins_middle=5, dict_dict=True)[source]

Create visualizations for the analysis results with improved period distribution plots

rws_py.analysis_universal.plot_res(dat_in, file=None, label=None)[source]

Plot time dependent residuals with and w/o storage, loads and power

in case of ESM residual analysis, without öoad and power

Parameters:
  • dat_in (DataFrame) – all data, index is datetime.

  • file (string, optional) – filename without ending for storing the plot. The default is None.

  • label (string, optional) – plot title. The default is None.

Return type:

None.

rws_py.analysis_universal.posterior_analysis_residual(actual_df, storage_capacity=1.0, verbose=True)[source]

Evaluate the residual load with energy storage DataFrame after its calculation

The number of full charging/discharging cycles (“charging”), the level of autonomy, and the times the storag changed its state either from empty or from full(“storage_states are evaluated.

Parameters:
  • actual_df (panda DataFrame) – the data timeseries with the residuals, storage states.

  • storage_capacity (Float, optional) – max. storage capacity, needed to calculate the equivalent full charging /discharging cycles. The default is 1..

  • verbose (Boolean, optional) – for getting some printings. The default is True.

Returns:

  • storage_states (Dictionary) – DESCRIPTION.

  • level_of_autonomy (Dictionary) – DESCRIPTION.

  • charging (Dictionary) – DESCRIPTION.

rws_py.analysis_universal.print_dict(my_dict, filename=None)[source]

print the dictionary and optional: store it to the json file

Parameters:
  • my_dict (dictionary) – DESCRIPTION.

  • filename (string, optional) – DESCRIPTION. The default is None.

Returns:

output – DESCRIPTION.

Return type:

TYPE

rws_py.analysis_universal.rename_count_columns(df)[source]

Replace Column names in pandas dataFrame

from count to period and from sum to integral, should help understanding/ readability.

Parameters:

df (pandas DataFrame) – DtaFrame with the columns to replace.

Returns:

column names changed.

Return type:

pandas DataFrame

rws_py.analysis_universal.residual_analyse(data, column, thresholds={'direct': 0.0}, verbose=False, time_base_e=1.0)[source]

Comprehensive analysis of time series data with threshold-based period analysis

Parameters:
  • data (pd.DataFrame) – DataFrame containing the data to be analyzed

  • column (str) – Name of the column to analyze

  • thresholds (dict or None, optional) – Dictionary of thresholds for different analyses (example {“name”:0.0}). Default is {‘direct’: 0.}.

  • verbose (bool, optional) – If True, print additional information (default is False)

  • time_base_e (float) – units in hours for determination of periods etc. default is 1.0

Return type:

dict of analysis results

rws_py.analyze_weather_load_storage module

Created on Mon Jan 20 13:24:40 2025

@author: atakan

rws_py.analyze_weather_load_storage.calc_residuals(power_df, load_df, gamma=1.0, columns={'in-load': 'load', 'in-power': 'power', 'out-residual': 'residual-no-storage', 'out-unchanged': 'residual-not-normalized'}, normalize=True)[source]

Calculate residual load from load and power dataframes

Parameters:
  • power_df (pandas.DataFrame) – datframe with the power column.

  • load_df (pandas.DataFrame) – dataframe with the load column.

  • gamma (Float, optional) – the load is multiplied by this factor, before the residual is calculated. A measure of how much residuals are available. The default is 1.0.

  • columns (Dictionary, optional) –

    where to find the input columns and in which column to write the output. The default is {“in-power”: ‘power’, “in_load”: ‘load’,

    ”out-residual”: ‘residual-no-storage’, “out-unchanged” : ‘residual-not-normalized’}.

  • normalize (Boolean, optional) – the residuals will be divided by the absolute mean of the negative residuals. The default is True.

Returns:

power_df – dataframe with the load and the residual included.

Return type:

pandas.DataFrame

rws_py.analyze_weather_load_storage.print_summary_stats(result_df, energy_df)[source]
rws_py.analyze_weather_load_storage.test_weather_load_storage(verbose=False, hours=48)[source]
rws_py.analyze_weather_load_storage.weather_load_storage(energy_in_df, load_df=None, storage_size=None, pow_index='power', eff=0.75, residual=False)[source]

Calculate the remaining load and storage charging as a function of energy.

Parameters:
  • energy_in_df (pandas DataFrame) – The given index values are analyzed as time and energy.

  • load_df (pandas DataFrame, optional) – If not None, a DataFrame with the date as index and load values in column ‘load’. The default is None.

  • storage_size (float, optional) – Size in the units of “power” times hours. If None, the maximum value of “power” will be multiplied by 2. The default is None.

  • pow_index (string, optional) – Index of energy_df with ‘power’ values. The default is “power”.

  • eff (float, optional) – Storage efficiency (energy out / energy in). The default is 0.75.

  • residual (Boolean, optional) – True, when residuals are already included in energy_df. Default: False.

Returns:

energy_df – All input data frames, residuals, with and without storage, SOC (state of charge) of the storage.

Return type:

pandas DataFrame

rws_py.dwd_analyze_store_second_threshold module

Created on Thu Jan 16 11:16:16 2025

@author: atakan

rws_py.dwd_analyze_store_second_threshold.analyze_weather(data, column, threshold, time_per_point=1)[source]

Analyze weather data based on periods above and below a threshold.

rws_py.dwd_analyze_store_second_threshold.load_data(bse_url_in, filename_in, exp_col, directory='/tmp/data', energy_column=2, wind_bounds=(3.3, 11.0, 25), normalize=True, resample=None)[source]

Load weatherdata from a directory if it already exists, and only download and save if it does not exist.

Parameters:
  • bse_url_in (string) – url from websiteN.

  • filename_in (string) – DESCRIPTION.

  • exp_col (List) – Which column (names) are expected at least in the file.

  • directory (string, optional) – folder to look for data first and store them after downloading, when they do not exist. The default is DATA_SOURCE.

  • energy_column (Integer, optional) – position of thecolumn within expected_columns, where the solar energy density or wind velocity is to be found. The default is 2.

  • wind_bounds (list or tuple of length 3, optional) – Minimum, nominal and maximum wind speed of turbine in m/s . The default is (3.3, 11.0, 25).

  • normalize (Boolean, optional) – for normalizing the “power” column by its mean value, The default value is True.

  • resample (String/None, optional) – if ‘h’ the data will be resampled to hourly, taken the mean(other resampling would also be ok, check the panadas resample manual). If it is None, no resampling will be performed. The default is None.

Raises:
  • IOError – DESCRIPTION.

  • KeyError – DESCRIPTION.

Returns:

df – The data with the important values in the power column and the datime as index.

Return type:

Pandas DataFrame

rws_py.dwd_analyze_store_second_threshold.plot_analysis(data, results, column, threshold, en_t, year, fil_name, period_pause, bins=[0, 1, 2, 4, 8, 16, 32, 64, 128, 200])[source]

Create visualizations for the analysis results with improved period distribution plots

rws_py.dwd_analyze_store_second_threshold.plot_enhanced_analysis(data, results, column, threshold, en_t, year, fil_name)[source]

Create enhanced visualizations for the analysis results with improved period distribution plots

rws_py.dwd_analyze_store_second_threshold.resample_to_hourly(data_in, energy)[source]

Resample 10-minute data to hourly data by taking the mean.

rws_py.hm_plot module

rws_py.load_curve_simple module

Generate simple energy load curves for analysis of weather data

Either as step function or as sine, differences for weekdays and weekends included.

  1. Atakan, Uni Duisburg-Essen, Germany

SPP2403

2025-01-20

rws_py.load_curve_simple.generate_load_curve(time_index, step=True, load_parameters=None)[source]

Generate simple load curves either step function or sine, with an additional seasonal modulation.

Parameters:
  • time_index (pandas DateTimeIndex) – The period for which values are generated.

  • step (Boolean, optional) – If True, it is a step function, else a sine. Default is True.

  • load_parameters (dictionary, optional) – Values for min/max and weekend/workdays and intermediate values.

Returns:

With the load values.

Return type:

pandas dataframe

rws_py.load_curve_simple.generate_seasonal_modulation(time_index, amplitude=0.05)[source]

Generate a seasonal modulation function using a cosine wave.

Parameters:
  • time_index (pandas DateTimeIndex) – The period for which values are generated.

  • amplitude (float, optional) – The amplitude of the seasonal variation. Default is 0.05.

Returns:

Seasonal modulation factor for each timestamp.

Return type:

pandas Series

rws_py.residual_analyse module

Analyse the rsidual loads from different countries statistically

with respect to the correlation of periods with positive and negative residual loads. sum: integral (Energy) mean: measure for Power count: period (in h) and further values are also calculated like the 25%, 75% etc.

Context: SPP2403 Cooperation Atakan / Bertsch

Created on Thu Dec 5 10:00:37 2024

@author: atakan

rws_py.residual_analyse.analyze_residual(data, column, verbose=False)[source]

Analyze Residual load data for periods of negative residuals followed by positive

with respect to time (length), integral(sum)=energy and the mean values of each period.

Parameters:
  • data (pd.DataFrame) – to be analyzed.

  • column (string) – the column with the data to be analyzed.

  • verbose (Boolean, optional) – if you want some printing. The default is False.

Raises:

KeyError – DESCRIPTION.

Returns:

  • results (dictionary with three entries, as follows) – -“”

  • df_period (pd.DataFrame) – all periods ith the folowing one of opposite sign .

  • df_pos_neg (pd.DataFrame) – positive residual load periods with the folowing one of opposite sign .

  • df_neg_pos (pd.DataFrame) – negative residual load periods with the folowing one of opposite sign .

rws_py.residual_analyse.calc_capacity_dependence(in_ser, m_cap, EFF_STOR=0.75, make_df=False, verbose=False, file_name='cap_res-', title=None)[source]

Calculate a storage (dis-)charging as a function of residual loads

Parameters:
  • in_ser (pd.Series) – hourly Residual loads (neg->entering).

  • m_cap (array of floats) – storage capacities for which the behaviour is calculated.

  • EFF_STOR (Float, optional) – discharging efficiency of the storage. The default is 0.75.

  • make_df (Boolean, optional) – shall all results be returned as pd.DataFrame or as some numpy.arrays. The default is False.

  • verbose (Boolean, optional) – if printing is wanted. The default is False.

  • file_name (string, optional) – place to store the results, the name will be extended. The default is ‘cap_res-‘.

Returns:

  • Dataframe – assessment as function of the residual loads time series.

  • or numpy arrays – if make_df=False, cap_dep_res, st_state, la, cap_change.

rws_py.residual_analyse.create_filenames(value, base=None)[source]
rws_py.residual_analyse.esm_residual_to_df(country=None, file_in=None, col_name='residual-no-storage', first_day=None, save_csv=True, verbose=False, get_countries=False, normalize=True)[source]

Reads ESM residual load data from a CSV or Excel file, extracts the data for a specific country, sets the date as the index, and optionally normalizes the data.

Parameters:

countrystr, optional

The country for which the residual load data should be extracted. Defaults to “DE0 Tot” if not specified.

file_instr, optional

The filename (without extension) containing the residual load data. If None, defaults to ‘2024_Bertsch_residual_Load’.

col_namestr, optional

The name of the column to store the extracted residual load data. Default is “residual-no-storage”.

first_daystr, optional

Not used in the current function.

save_csvbool, optional

If True, saves the extracted and transposed data to a CSV file for future use. Default is True.

verbosebool, optional

If True, prints the first few rows of the dataset and the index for debugging purposes. Default is False.

get_countriesbool, optional

If True, returns a list of available country names from the dataset instead of extracting data. Default is False.

normalizebool, optional

If True, normalizes the extracted residual load data by computing the absolute mean of the negative values (=> positive!). The original values are then divided by this value. Default is True.

Returns:

pd.DataFrame or list
  • If get_countries is True: Returns a list of available country names.

  • Otherwise: Returns a DataFrame with extracted residual load data for the specified country.

Raises:

ValueError

If the specified file cannot be loaded.

FileNotFoundError

If neither the CSV nor the Excel file is found.

Notes:

  • The function first attempts to read data from a CSV file. If the CSV is missing, it tries to read from an Excel file.

  • If an Excel file is used, the dataset is transposed, and a datetime index is generated starting from ‘2050-01-01 00:00:00’ with hourly frequency.

  • Normalization is performed only if the normalization factor (difference between mean positive and mean negative values) is nonzero.

rws_py.residual_analyse.eval_df_pos_neg(df, col, time=1, verbose=False)[source]
rws_py.residual_analyse.storage(power, actual_capacity, full_capacity, efficiency=1, time_step=1, sp_names=None)[source]

Simple storage model without power restriction but max. capacity.

Parameters:
  • power (Float) –

    power entering the storage (=positive) or wanted(=negative), if possible

    with the actual state of charge.

  • actual_capacity (Float) – what is the actual charge (energy).

  • full_capacity (Float) – what is the full capacity.

  • efficiency (Float, optional) – discharging efficiency. The default is 1.

  • time_step (Float, optional) – time step relative to the next value in hours. The default is 1.

  • sp_names (list of strings, optional) – the names of the three values calculated. The default is None.

Returns:

result_dict

  • “act_st_cap” actual loading/energy after the time step

  • ”power_st_in”: the real power entering/exiting the storage

  • ”SOC”: state of charge.

Return type:

Dictionary

rws_py.run_residual_store module

Run script to analyse ESM residual data together with a storage

DFG SPP 2403

Created on Sun Jan 26 10:16:56 2025

@author: atakan

rws_py.run_weather_load_store module

Read weather data, estimated load, calculate residuals, analyze pause etc.

Created on Wed Jan 22 12:43:27 2025

@author: atakan

rws_py.rws_py module

rws_py.tasks module

rws_py.test_wind_load_power module

test wind data load and conversion to power

Created on Mon Jan 27 11:01:47 2025

@author: atakan

rws_py.test_wind_load_power.create_test_data(num_hours=30)[source]
rws_py.test_wind_load_power.create_test_zip(data, zip_filename='testdata.zip', csv_filename='testdata.csv')[source]
rws_py.test_wind_load_power.test_load_and_plot()[source]

Module contents

Top-level package for residuals_weather_storage.

rws_py package.

DFG - SPP2403

B.Atakan, Univ. Duisburg-Essen 2025-02-07

rws_py.analyze_residual(data, column, verbose=False)[source]

Analyze Residual load data for periods of negative residuals followed by positive

with respect to time (length), integral(sum)=energy and the mean values of each period.

Parameters:
  • data (pd.DataFrame) – to be analyzed.

  • column (string) – the column with the data to be analyzed.

  • verbose (Boolean, optional) – if you want some printing. The default is False.

Raises:

KeyError – DESCRIPTION.

Returns:

  • results (dictionary with three entries, as follows) – -“”

  • df_period (pd.DataFrame) – all periods ith the folowing one of opposite sign .

  • df_pos_neg (pd.DataFrame) – positive residual load periods with the folowing one of opposite sign .

  • df_neg_pos (pd.DataFrame) – negative residual load periods with the folowing one of opposite sign .

rws_py.analyze_weather(data, column, threshold, time_per_point=1)[source]

Analyze weather data based on periods above and below a threshold.

rws_py.app_suf(base_path: Path, suffix: str, new_extension: str = None) Path

Fügt einen Suffix zu einem Basispfad hinzu und optional eine neue Erweiterung.

Parameters:
  • base_path (Path) – Der ursprüngliche Dateipfad.

  • suffix (str) – Der Suffix, der dem Dateinamen hinzugefügt werden soll (z.B. “-akt”).

  • new_extension (str, optional) – Die neue Dateierweiterung inklusive Punkt (z.B. “.csv”). Wenn None, bleibt die ursprüngliche Erweiterung erhalten.

Returns:

Der neue Dateipfad mit hinzugefügtem Suffix und optionaler neuer Erweiterung.

Return type:

Path

rws_py.calc_residuals(power_df, load_df, gamma=1.0, columns={'in-load': 'load', 'in-power': 'power', 'out-residual': 'residual-no-storage', 'out-unchanged': 'residual-not-normalized'}, normalize=True)[source]

Calculate residual load from load and power dataframes

Parameters:
  • power_df (pandas.DataFrame) – datframe with the power column.

  • load_df (pandas.DataFrame) – dataframe with the load column.

  • gamma (Float, optional) – the load is multiplied by this factor, before the residual is calculated. A measure of how much residuals are available. The default is 1.0.

  • columns (Dictionary, optional) –

    where to find the input columns and in which column to write the output. The default is {“in-power”: ‘power’, “in_load”: ‘load’,

    ”out-residual”: ‘residual-no-storage’, “out-unchanged” : ‘residual-not-normalized’}.

  • normalize (Boolean, optional) – the residuals will be divided by the absolute mean of the negative residuals. The default is True.

Returns:

power_df – dataframe with the load and the residual included.

Return type:

pandas.DataFrame

rws_py.esm_residual_to_df(country=None, file_in=None, col_name='residual-no-storage', first_day=None, save_csv=True, verbose=False, get_countries=False, normalize=True)[source]

Reads ESM residual load data from a CSV or Excel file, extracts the data for a specific country, sets the date as the index, and optionally normalizes the data.

Parameters:

countrystr, optional

The country for which the residual load data should be extracted. Defaults to “DE0 Tot” if not specified.

file_instr, optional

The filename (without extension) containing the residual load data. If None, defaults to ‘2024_Bertsch_residual_Load’.

col_namestr, optional

The name of the column to store the extracted residual load data. Default is “residual-no-storage”.

first_daystr, optional

Not used in the current function.

save_csvbool, optional

If True, saves the extracted and transposed data to a CSV file for future use. Default is True.

verbosebool, optional

If True, prints the first few rows of the dataset and the index for debugging purposes. Default is False.

get_countriesbool, optional

If True, returns a list of available country names from the dataset instead of extracting data. Default is False.

normalizebool, optional

If True, normalizes the extracted residual load data by computing the absolute mean of the negative values (=> positive!). The original values are then divided by this value. Default is True.

Returns:

pd.DataFrame or list
  • If get_countries is True: Returns a list of available country names.

  • Otherwise: Returns a DataFrame with extracted residual load data for the specified country.

Raises:

ValueError

If the specified file cannot be loaded.

FileNotFoundError

If neither the CSV nor the Excel file is found.

Notes:

  • The function first attempts to read data from a CSV file. If the CSV is missing, it tries to read from an Excel file.

  • If an Excel file is used, the dataset is transposed, and a datetime index is generated starting from ‘2050-01-01 00:00:00’ with hourly frequency.

  • Normalization is performed only if the normalization factor (difference between mean positive and mean negative values) is nonzero.

rws_py.generate_load_curve(time_index, step=True, load_parameters=None)[source]

Generate simple load curves either step function or sine, with an additional seasonal modulation.

Parameters:
  • time_index (pandas DateTimeIndex) – The period for which values are generated.

  • step (Boolean, optional) – If True, it is a step function, else a sine. Default is True.

  • load_parameters (dictionary, optional) – Values for min/max and weekend/workdays and intermediate values.

Returns:

With the load values.

Return type:

pandas dataframe

rws_py.load_data(bse_url_in, filename_in, exp_col, directory='/tmp/data', energy_column=2, wind_bounds=(3.3, 11.0, 25), normalize=True, resample=None)[source]

Load weatherdata from a directory if it already exists, and only download and save if it does not exist.

Parameters:
  • bse_url_in (string) – url from websiteN.

  • filename_in (string) – DESCRIPTION.

  • exp_col (List) – Which column (names) are expected at least in the file.

  • directory (string, optional) – folder to look for data first and store them after downloading, when they do not exist. The default is DATA_SOURCE.

  • energy_column (Integer, optional) – position of thecolumn within expected_columns, where the solar energy density or wind velocity is to be found. The default is 2.

  • wind_bounds (list or tuple of length 3, optional) – Minimum, nominal and maximum wind speed of turbine in m/s . The default is (3.3, 11.0, 25).

  • normalize (Boolean, optional) – for normalizing the “power” column by its mean value, The default value is True.

  • resample (String/None, optional) – if ‘h’ the data will be resampled to hourly, taken the mean(other resampling would also be ok, check the panadas resample manual). If it is None, no resampling will be performed. The default is None.

Raises:
  • IOError – DESCRIPTION.

  • KeyError – DESCRIPTION.

Returns:

df – The data with the important values in the power column and the datime as index.

Return type:

Pandas DataFrame

rws_py.plot_analysis(data, results, column, threshold, en_t, year, fil_name, period_pause, bins=[0, 1, 2, 4, 8, 16, 32, 64, 128, 200])[source]

Create visualizations for the analysis results with improved period distribution plots

rws_py.plot_analysis_b(evaluation_df, thresh_n='default', file=None, label=None, y_max=None)[source]

Scatterplot of periods with neg. residuals vs. the following pos. residual

Parameters:
  • evaluation_df (dictionary withpandas dataFrame) – period lengths and integgrals for negative residuals and th directly following positive residuals.

  • thresh_n (float, optional) –

    threshold-dictionary name (part, typically “basic”, “direct” or

    ”default”. The default is “default”.

  • file (string, optional) – filename without ending for storing the plot. The default is None.

  • label (string, optional) – title of the plot. The default is None.

Return type:

None.

rws_py.plot_enhanced_analysis(data, results, column, threshold, en_t, year, fil_name)[source]

Create enhanced visualizations for the analysis results with improved period distribution plots

rws_py.plot_histo_analysis(results, select=None, en_t='title', name_file='histo', bins=[0, 1, 2, 4, 8, 16, 32, 64, 128, 200], integral=False, n_bins_middle=10)[source]

Create visualizations for the analysis results with improved period distribution plots

rws_py.plot_histo_int_analysis(results, select=None, en_t='title', name_file='histo', bins=[0, 1, 2, 4, 8, 16, 32, 64, 128, 200], integral=False, n_bins_middle=5, dict_dict=True)[source]

Create visualizations for the analysis results with improved period distribution plots

rws_py.plot_res(dat_in, file=None, label=None)[source]

Plot time dependent residuals with and w/o storage, loads and power

in case of ESM residual analysis, without öoad and power

Parameters:
  • dat_in (DataFrame) – all data, index is datetime.

  • file (string, optional) – filename without ending for storing the plot. The default is None.

  • label (string, optional) – plot title. The default is None.

Return type:

None.

rws_py.posterior_analysis_residual(actual_df, storage_capacity=1.0, verbose=True)[source]

Evaluate the residual load with energy storage DataFrame after its calculation

The number of full charging/discharging cycles (“charging”), the level of autonomy, and the times the storag changed its state either from empty or from full(“storage_states are evaluated.

Parameters:
  • actual_df (panda DataFrame) – the data timeseries with the residuals, storage states.

  • storage_capacity (Float, optional) – max. storage capacity, needed to calculate the equivalent full charging /discharging cycles. The default is 1..

  • verbose (Boolean, optional) – for getting some printings. The default is True.

Returns:

  • storage_states (Dictionary) – DESCRIPTION.

  • level_of_autonomy (Dictionary) – DESCRIPTION.

  • charging (Dictionary) – DESCRIPTION.

rws_py.print_dict(my_dict, filename=None)[source]

print the dictionary and optional: store it to the json file

Parameters:
  • my_dict (dictionary) – DESCRIPTION.

  • filename (string, optional) – DESCRIPTION. The default is None.

Returns:

output – DESCRIPTION.

Return type:

TYPE

rws_py.resample_to_hourly(data_in, energy)[source]

Resample 10-minute data to hourly data by taking the mean.

rws_py.residual_analyse(data, column, thresholds={'direct': 0.0}, verbose=False, time_base_e=1.0)[source]

Comprehensive analysis of time series data with threshold-based period analysis

Parameters:
  • data (pd.DataFrame) – DataFrame containing the data to be analyzed

  • column (str) – Name of the column to analyze

  • thresholds (dict or None, optional) – Dictionary of thresholds for different analyses (example {“name”:0.0}). Default is {‘direct’: 0.}.

  • verbose (bool, optional) – If True, print additional information (default is False)

  • time_base_e (float) – units in hours for determination of periods etc. default is 1.0

Return type:

dict of analysis results

rws_py.storage(power, actual_capacity, full_capacity, efficiency=1, time_step=1, sp_names=None)[source]

Simple storage model without power restriction but max. capacity.

Parameters:
  • power (Float) –

    power entering the storage (=positive) or wanted(=negative), if possible

    with the actual state of charge.

  • actual_capacity (Float) – what is the actual charge (energy).

  • full_capacity (Float) – what is the full capacity.

  • efficiency (Float, optional) – discharging efficiency. The default is 1.

  • time_step (Float, optional) – time step relative to the next value in hours. The default is 1.

  • sp_names (list of strings, optional) – the names of the three values calculated. The default is None.

Returns:

result_dict

  • “act_st_cap” actual loading/energy after the time step

  • ”power_st_in”: the real power entering/exiting the storage

  • ”SOC”: state of charge.

Return type:

Dictionary

rws_py.weather_load_storage(energy_in_df, load_df=None, storage_size=None, pow_index='power', eff=0.75, residual=False)[source]

Calculate the remaining load and storage charging as a function of energy.

Parameters:
  • energy_in_df (pandas DataFrame) – The given index values are analyzed as time and energy.

  • load_df (pandas DataFrame, optional) – If not None, a DataFrame with the date as index and load values in column ‘load’. The default is None.

  • storage_size (float, optional) – Size in the units of “power” times hours. If None, the maximum value of “power” will be multiplied by 2. The default is None.

  • pow_index (string, optional) – Index of energy_df with ‘power’ values. The default is “power”.

  • eff (float, optional) – Storage efficiency (energy out / energy in). The default is 0.75.

  • residual (Boolean, optional) – True, when residuals are already included in energy_df. Default: False.

Returns:

energy_df – All input data frames, residuals, with and without storage, SOC (state of charge) of the storage.

Return type:

pandas DataFrame

rws_py.utils module

rws_py.utils.convert_folder_to_hdf5(source_folder, output_hdf5)[source]

Konvertiert einen gesamten Ordner rekursiv in eine HDF5-Datei.

rws_py.utils.folder_to_hdf5 module

Create a HDF5 File out of a folder with subfolders

Created on Mon Feb 10 21:45:58 2025

@author: atakan Universität Duisburg-Essen, Germany

In the framework of the Priority Programme: “Carnot Batteries: Inverse Design from Markets to Molecules” (SPP 2403) https://www.uni-due.de/spp2403/ https://git.uni-due.de/spp-2403/residuals_weather_storage

rws_py.utils.folder_to_hdf5.add_metadata(hdf5_obj, metadata)[source]

Fügt Metadaten als Attribute zu einem HDF5-Objekt hinzu.

rws_py.utils.folder_to_hdf5.convert_folder_to_hdf5(source_folder, output_hdf5)[source]

Konvertiert einen gesamten Ordner rekursiv in eine HDF5-Datei.

rws_py.utils.folder_to_hdf5.load_yaml(file_path)[source]

Lädt eine YAML-Datei und gibt sie als Dictionary zurück.

rws_py.utils.folder_to_hdf5.store_data_in_hdf5(hdf5_file, base_path, current_path)[source]

Rekursives Speichern von Dateien und Metadaten in HDF5.