Data processing
Submodules
Data processing
- class fleetrl.utils.data_processing.data_processing.DataLoader(path_name, schedule_name, spot_name, tariff_name, building_name, pv_name, time_conf, ev_conf, target_soc, building_flag, pv_flag, real_time)[source]
Bases:
object
The DataLoader class handles the csv import and pre-processing of the timeseries information. Optimized pandas functions such as merge_asof are used to significantly speed up processing compared to loops. Cython could further improve this initial processing step. It only happens once when instantiating env objects.
- compute_from_schedule(ev_conf, time_conf, target_soc)[source]
This function pre-processes the input data and adds additional rows to the file. There flag, time left at charger, soc on return, consumption, etc.
Use merge_asof and vectorized operations for performance gains
- Returns:
None
- load_building_load(path_name, file_name, date_range)[source]
Load building load from csv :type path_name: :param path_name: Parent directory string :type file_name: :param file_name: file name with .csv ending :type date_range: :param date_range: pd.date_range which was defined from the “date” column in the EV schedules. Note that the EV schedule dates therefore dictate the model’s timeframe. :return: load dataframe
- load_feed_in(path_name, tariff_name, date_range)[source]
Load feed-in from csv :type path_name: :param path_name: Parent directory string :type tariff_name: :param tariff_name: file name with .csv ending :type date_range: :param date_range: pd.date_range which was defined from the “date” column in the EV schedules. Note that the EV schedule dates therefore dictate the model’s timeframe. :return: tariff dataframe
- load_prices(path_name, spot_name, date_range)[source]
Load prices from csv :type path_name: :param path_name: Parent directory string :type spot_name: :param spot_name: file name with .csv ending :type date_range: :param date_range: pd.date_range which was defined from the “date” column in the EV schedules. Note that the EV schedule dates therefore dictate the model’s timeframe. :return: spot price dataframe
- load_prices_original(path_name, spot_name, date_range)[source]
Load prices from csv :type path_name: :param path_name: Parent directory string :type spot_name: :param spot_name: file name with .csv ending :type date_range: :param date_range: pd.date_range which was defined from the “date” column in the EV schedules. Note that the EV schedule dates therefore dictate the model’s timeframe. :return: spot price dataframe
- load_pv(path_name, pv_name, date_range)[source]
Load pv from csv :type path_name: :param path_name: Parent directory string :type pv_name: :param pv_name: file name with .csv ending :type date_range: :param date_range: pd.date_range which was defined from the “date” column in the EV schedules. Note that the EV schedule dates therefore dictate the model’s timeframe. :return: pv dataframe
- static shape_price_reward(db, ev_conf)[source]
de-trend prices, so they can be used as a reward function
agent should not be penalised more if the general price level is higher
instead, the agent should just focus on price fluctuations and exploit them
computing average for whole year, split data into monthly chunks
offset monthly chunks, such that the monthly average = annual average
this corrects for absolute price increases, but leaves fluctuations intact
- Parameters:
db (
DataFrame
) – database with schedules, pv, prices, load, dataframeev_conf (
EvConfig
) – ev config object
- Returns:
db with updated, de-trended prices