omegalpes.general.utils package

Submodules

omegalpes.general.utils.input_data module

This module includes the following utils for input data management

It contains the following methods:
  • select_csv_file_between_dates() : select data in a .csv file between two dates

  • read_enedis_data_csv_file() : select and rearrange the data in a .csv file of Enedis (the French Distribion System Operator company), possibly between two dates

omegalpes.general.utils.input_data.read_enedis_data_csv_file(file_path=None, start=None, end=None)[source]

Rearrange the Enedis data in cvs file in oder to have a Dataframe of the following form

DD MM YYYY HH:00 ; a DD MM YYYY HH:30 ; b …

Parameters:
  • file_path – path of the file to rearrange

  • start – DD MM YYYY HH:00 : first date which should be considered

  • end – DD MM YYYY HH:00 : last date which should be considered

Returns:

df_list: the data as a list

omegalpes.general.utils.input_data.resample_data(input_list=None, dt_origin=1.0, dt_final=1.0, fill_config='ffill', pick_config='mean')[source]

Changing data set in a dt_origin time step into data set in a dt_final time step :param input_list: list to be resample (list or dict) :param dt_origin: the time step of the input dataset (in hours) :param dt_final: the wanted time step for the output dataset (in hours) :param fill_config: choose the configuration of filling when dt_origin > dt_final by default: ffil, keeping the same data over the time steps other way: interpolate, taking into account the time steps) :param pick_config: choose the configuration of picking when dt_origin < dt_final by default: “mean” which determines the mean value of the time steps to be reduced :return: output_list: resampled list (pandas Series)

omegalpes.general.utils.input_data.select_csv_file_between_dates(file_path=None, start='DD/MM/YYYY HH:MM', end='DD/MM/YYYY HH:MM', v_cols=[], sep=';')[source]

Select data in a .csv file between two dates

Parameters:
  • file_path – path of the file to rearrange

  • start – DD MM YYYY HH:00 : first date which should be considered

  • end – DD MM YYYY HH:00 : last date which should be considered

  • v_cols – columns which should be considered

Returns:

df: a dataframe considering the dates

omegalpes.general.utils.maths module

This module includes the following maths utils

It contains the following methods:
  • def_abs_value() : Define easily absolute value for quantity

omegalpes.general.utils.maths.def_abs_value(quantity, q_min, q_max)[source]
Parameters:
  • quantity – Quantity whose absolute value is wanted

  • q_min – Minimal value of the quantity (negative value)

  • q_max – Maximal value of the quantity (positive value)

Returns:

A new Quantity whose values equal absolute values of the initial Quantity

omegalpes.general.utils.output_data module

This module includes the following utils for output data management

It contains the following methods:
  • save_energy_flows() : Save the optimisation results in a .csv file

omegalpes.general.utils.output_data.save_energy_flows(*nodes, file_name=None, sep='\t', decimal_sep='.')[source]

Save the optimisation results in a .csv file

Parameters:
  • nodes – one or several nodes from which should be collected the data

  • file_name – name of the file to save the data

  • sep – separator for the data

  • decimal_sep – separator dor the decimals of the data

omegalpes.general.utils.plots module

This module includes the following display utils:

  • plot_node_energetic_flows() : enables one to plot the energy flows through an EnergyNode

  • plot_energy_mix() : enables one to plot the energy flows connected to a node

  • plot_pareto2D() : enables one to plot a pareto front based on two quantities

  • plot_quantity() : enables one to plot easily a Quantity

  • plot_quantity_bar() : enables one to plot easily a Quantity as a bar

  • sum_quantities_in_quantity() : enables one to to plot several quantities in one once the optimisation is done

omegalpes.general.utils.plots.plot_energy_mix(node)[source]
omegalpes.general.utils.plots.plot_node_energetic_flows(node)[source]

Description

This function allows to plot the energy flows through an EnergyNode

The display is realized :

  • with histograms for production and storage flow

  • with dashed curve for consumption flow

Parameters:

node – EnergyNode

omegalpes.general.utils.plots.plot_pareto2D(model, quantity_1, quantity_2, title=None, legend_on=True)[source]

Description

Plot a Pareto front for two quantities. Before using it, you should have added in your model two objectives with the pareto parameter activated (pareto=True)

Parameters

Parameters:
  • model

  • quantity_1 – the first quantity for the pareto front

  • quantity_2 – the second quantity for the pareto front

  • title

omegalpes.general.utils.plots.plot_quantity(time, quantity, fig=None, ax=None, color=None, label=None, title=None)[source]

Description

Function that plots a OMEGAlpes.general.optimisation.elements.Quantity

Parameters

  • time: TimeUnit for the studied horizon as defined in general.time

  • quantity: OMEGAlpes.general.optimisation.elements.Quantity

  • fig: Figure as defined in matplotlib.pyplot.Figure

  • ax: axes as defined in matplotlib.pyplot.Axes

  • color: color of the plot

  • label: label for the quantity

  • title: title of the plot

Returns

  • arg1 the matplotlib.pyplot.Figure handle object

  • arg2 the matplotlib.pyplot.Axes handle object

  • arg3 the matplotlib.pyplot.Line2D handle object

omegalpes.general.utils.plots.plot_quantity_bar(time, quantity, fig=None, ax=None, color=None, label=None, title=None)[source]

Description

Function that plots a OMEGALPES.general.optimisation.elements.Quantity as a bar

Attributes

  • quantity is the OMEGALPES.general.optimisation.elements.Quantity

  • fig could be None, a matplotlib.pyplot.Figure or Axes for multiple plots

Returns

  • arg1 the matplotlib.pyplot.Figure handle object

  • arg2 the matplotlib.pyplot.Axes handle object

  • arg3 the matplotlib.pyplot.Line2D handle object

omegalpes.general.utils.plots.sum_quantities_in_quantity(quantities_list=[], tot_quantity_name='sum_quantity')[source]

Description

Function that creates a new quantity gathering several values of quantities Should be used in order to plot several quantities in one once the optimisation is done

Attributes

  • quantities : a list of Quantities (OMEGALPES.general.optimisation.elements.Quantity)

  • tot_quantity_name : string : name of the new quantity

Returns

  • tot_quantity : the new quantity created and filled

Module contents