datafev.routines.scenario_generation package

Submodules

datafev.routines.scenario_generation.sceneration module

src.datafev.routines.scenario_generation.sceneration.generate_fleet_from_conditional_pdfs(times_dict, times_prob_dict, soc_dict, soc_prob_dict, ev_dict, number_of_evs, endtime, timedelta_in_min=15, diff_arr_dep_in_min=0)[source]

This function is executed to generate a simulation scenario with given statistical EV fleet data, which has dependent arrival and departure times and SoCs. The relationships between arrival and departure times and SoCs are assumed to be predefined in that provided input.

Parameters:
  • times_dict (dict, optional) – Arrival-departure time combinations nested dictionary. keys: Arrival-departure time combination identifier, values: time upper and lower bounds. The default is None.

  • times_prob_dict (dict, optional) – Arrival-departure time combinations’ probabilities nested dictionary. keys: Arrival-departure time combination identifier, values: their probabilities. The default is None.

  • soc_dict (dict) – Arrival-departure SoC combinations nested dictionary. keys: SoC Identifier, values: SoC upper and lower bounds.

  • soc_prob_dict (dict) – Arrival-departure SoC combinations’ probabilities nested dictionary. keys: Arrival-departure SoC combination identifier, values: their probabilities.

  • ev_dict (dict) – EV nested dictionary. keys: EV models, values: their data and probability.

  • number_of_evs (int) –

    This parameter has different description for the two situations:
    • If user is using independent arrival and departure times: Number of desired EVs per day for the simulation.

    • If the user is using dependent arrival and departure times: Number of desired EVs for the simulation.

  • endtime (datetime.datetime) – The last timestamp of the simulation.

  • timedelta_in_min (int) – Resolution of the simulation in minutes. The default is 15.

  • diff_arr_dep_in_min (int, optional) – Minimum time between arrival and departure for each EV in minutes. The default is 0.

Returns:

gen_ev_df – Generated EV dataset for future use in any simulation.

Return type:

pandas.core.frame.DataFrame

src.datafev.routines.scenario_generation.sceneration.generate_fleet_from_simple_pdfs(arr_times_dict, dep_times_dict, arr_soc_dict, dep_soc_dict, ev_dict, number_of_evs_per_day, startdate, enddate, timedelta_in_min=15, diff_arr_dep_in_min=0)[source]

This function is executed to generate a simulation scenario with given statistical EV fleet data, which has independent arrival and departure times and SoCs. The user must provide two different independent statistical distribution inputs for both arrival and departure times and SoCs.

Parameters:
  • arr_times_dict (dict) – Arrival times nested dictionary. keys: weekend or weekday, values: {keys: time identifier, values: time lower bound, time upper bounds and arrival probabilities}. The default is None.

  • dep_times_dict (dict) – Departure times nested dictionary. keys: weekend or weekday, values: {keys: time identifier, values: time lower bound, time upper bounds and departure probabilities}. The default is None.

  • arr_soc_dict (dict) – SoC nested dictionaries for arrival. keys: SoC Identifier, values: SoC Lower Bounds, SOC Upper Bounds and their probabilities.

  • dep_soc_dict (dict) – SoC nested dictionaries for departure. keys: SoC Identifier, values: SoC Lower Bounds, SOC Upper Bounds and their probabilities.

  • ev_dict (dict) – EV nested dictionary. keys: EV models, values: their data and probability.

  • number_of_evs_per_day (int) – Number of desired EVs per day for the simulation.

  • startdate (datetime.date, optional) – The start date of the simulation.

  • enddate (datetime.date, optional) – The end date of the simulation.

  • timedelta_in_min (int) – Resolution of the simulation in minutes. The default is 15.

  • diff_arr_dep_in_min (int, optional) – Minimum time between arrival and departure for each EV in minutes. The default is 0.

Returns:

gen_ev_df – Generated EV dataset for future use in any simulation.

Return type:

pandas.core.frame.DataFrame

datafev.routines.scenario_generation.utils module

src.datafev.routines.scenario_generation.utils.drange(x, y, jump)[source]

Generate a range from x to y with jump spaces.

Parameters:
  • x (numpy.float64) – Start point.

  • y (float) – End point.

  • jump (str) – Space between generated jumps.

Yields:

decimal.Decimal – Parts in the equal range of the jump between x and y.

src.datafev.routines.scenario_generation.utils.excel_to_sceneration_input_conditional_pdfs(file_path)[source]

This method converts the excel inputs into inputs suitable for the generate_fleet_from_conditional_pdfs function under sceneration.py.

Excel file structure, especially Sheet and Column names should be as it’s in the ‘tutorials/scenario_generation/input_generator_conditional_pdfs.xlsx’.

Parameters:

file_path (str) – File path of the Excel input file.

Returns:

  • times_dict (dict) – Arrival-departure time combinations nested dictionary. keys: Arrival-departure time combination identifier, values: time upper and lower bounds.

  • times_prob_dict (dict) – Arrival-departure time combinations’ probabilities nested dictionary. keys: Arrival-departure time combination identifier, values: their probabilities.

  • soc_dict (dict) – Arrival-departure SoC combinations nested dictionary. keys: SoC Identifier, values: SoC upper and lower bounds.

  • soc_prob_dict (dict) – Arrival-departure SoC combinations’ probabilities nested dictionary. keys: Arrival-departure SoC combination identifier, values: their probabilities.

  • ev_dict (dict) – EV nested dictionary. keys: EV models, values: their data and probability.

src.datafev.routines.scenario_generation.utils.excel_to_sceneration_input_simple_pdfs(file_path)[source]

This method converts the excel inputs into inputs suitable for the generate_fleet_from_simple_pdfs function under sceneration.py.

Excel file structure, especially Sheet and Column names should be as it’s in the ‘tutorials/scenario_generation/input_generator_simple_pdfs.xlsx’.

Parameters:

file_path (str) – File path of the Excel input file.

Returns:

  • arr_times_dict (dict) – Arrival times nested dictionary. keys: weekend or weekday, values: {keys: time identifier, values: time lower bound, time upper bounds and arrival probabilities}.

  • dep_times_dict (dict) – Departure times nested dictionary. keys: weekend or weekday, values: {keys: time identifier, values: time lower bound, time upper bounds and departure probabilities}.

  • arr_soc_dict (dict) – SoC nested dictionaries for arrival. keys: SoC Identifier, values: SoC Lower Bounds, SOC Upper Bounds and their probabilities.

  • dep_soc_dict (dict) – SoC nested dictionaries for departure. keys: SoC Identifier, values: SoC Lower Bounds, SOC Upper Bounds and their probabilities.

  • ev_dict (dict) – EV nested dictionary. keys: EV models, values: their data and probability.

src.datafev.routines.scenario_generation.utils.generate_datetime_list(sdate, edate, timedelta_in_min)[source]

Generates a datetime list with the given resolution.

Parameters:
  • sdate (TYPE) – Start datetime.

  • edate (TYPE) – End datetime.

  • timedelta_in_min (int) – Resolution in minutes.

Returns:

datetime_lst – Datetime list.

Return type:

TYPE

src.datafev.routines.scenario_generation.utils.generate_time_list(time_lowerb, time_upperb, timedelta_in_min, date)[source]

Generates a datetime list with the given resolution and given date.

Parameters:
  • time_lowerb (datetime.datetime) – Start datetime.

  • time_upperb (datetime.datetime) – End datetime.

  • timedelta_in_min (int) – Resolution in minutes.

  • date (datetime.datetime) – Date of the datetimes to be returned.

Returns:

times – Datetime list.

Return type:

list

src.datafev.routines.scenario_generation.utils.output_to_sim_input(sce_output_df, xlfile, dc_power=False)[source]

This function converts the fleet behavior (generated from statistical data) to the format that could be simulated in this simulation framework.

Parameters:
  • sce_output_df (pandas.core.frame.DataFrame) – Output data frame from generate_fleet_data function.

  • xlfile (str) – Desired name of the output excel file.

  • dc_power (bool, optional) – This parameter indicates whether dc or ac will be used as charging power in the simulation. The default is False.

Return type:

None.

src.datafev.routines.scenario_generation.utils.visualize_statistical_generation(file_path, gen_ev_df, timedelta_in_min=15)[source]

This method visualizes generated distribution of arrival and departure times and SoCs of the generated fleet behavior.

Parameters:
  • file_path (str) – The file path for image files to be saved.

  • gen_ev_df (pandas.core.frame.DataFrame) – Output data frame from generate_fleet_data function.

  • timedelta_in_min (int) – Resolution of the simulation in minutes. The default is 15. Note: The resolution must be equal to the resolution of the scenario generator!

Return type:

None.