dispaset.postprocessing package

Submodules

dispaset.postprocessing.postprocessing module

Set of functions useful to analyse to DispaSET output data.

@author: Sylvain Quoilin, JRC

dispaset.postprocessing.postprocessing.CostExPost(inputs, results)[source]

Ex post computation of the operational costs with plotting. This allows breaking down the cost into its different components and check that it matches with the objective function from the optimization.

The cost objective function is the following:
SystemCost(i) =E= sum(u,CostFixed(u)*Committed(u,i)) +sum(u,CostStartUpH(u,i) + CostShutDownH(u,i)) +sum(u,CostRampUpH(u,i) + CostRampDownH(u,i)) +sum(u,CostVariable(u,i) * Power(u,i)) +sum(l,PriceTransmission(l,i)*Flow(l,i)) +sum(n,CostLoadShedding(n,i)*ShedLoad(n,i)) +sum(chp, CostHeatSlack(chp,i) * HeatSlack(chp,i)) +sum(chp, CostVariable(chp,i) * CHPPowerLossFactor(chp) * Heat(chp,i)) +Config(“ValueOfLostLoad”,”val”)*(sum(n,LL_MaxPower(n,i)+LL_MinPower(n,i))) +0.8*Config(“ValueOfLostLoad”,”val”)*(sum(n,LL_2U(n,i)+LL_2D(n,i)+LL_3U(n,i))) +0.7*Config(“ValueOfLostLoad”,”val”)*sum(u,LL_RampUp(u,i)+LL_RampDown(u,i)) +Config(“CostOfSpillage”,”val”)*sum(s,spillage(s,i));
Returns:tuple with the cost components and their cumulative sums in two dataframes.
dispaset.postprocessing.postprocessing.GAMSstatus(statustype, num)[source]

Function that returns the model status or the solve status from gams

Parameters:
  • statustype – String with the type of status to retrieve (“solver” or “model”)
  • num – Indicated termination condition (Integer)
Returns:

String with the status

dispaset.postprocessing.postprocessing.aggregate_by_fuel(PowerOutput, Inputs, SpecifyFuels=None)[source]

This function sorts the power generation curves of the different units by technology

Parameters:
  • PowerOutput – Dataframe of power generationwith units as columns and time as index
  • Inputs – Dispaset inputs version 2.1.1
  • SpecifyFuels – If not all fuels should be considered, list containing the relevant ones
Returns PowerByFuel:
 

Dataframe with power generation by fuel

dispaset.postprocessing.postprocessing.ds_to_df(inputs)[source]

Function that converts the dispaset data format into a dictionary of dataframes

Parameters:inputs – input file
Returns:dictionary of dataframes
dispaset.postprocessing.postprocessing.filter_by_country(PowerOutput, inputs, c)[source]

This function filters the dispaset Output Power dataframe by country

Parameters:
  • PowerOutput – Dataframe of power generationwith units as columns and time as index
  • Inputs – Dispaset inputs version 2.1.1
  • c – Selected country (e.g. ‘BE’)
Returns Power:

Dataframe with power generation by country

dispaset.postprocessing.postprocessing.get_imports(flows, c)[source]

Function that computes the balance of the imports/exports of a given zone

Parameters:
  • flows – Pandas dataframe with the timeseries of the exchanges
  • c – Country (zone) to consider
Returns NetImports:
 

Scalar with the net balance over the whole time period

dispaset.postprocessing.postprocessing.get_indicators_powerplant(inputs, results)[source]

Function that analyses the dispa-set results at the power plant level Computes the number of startups, the capacity factor, etc

Parameters:
  • inputs – DispaSET inputs
  • results – DispaSET results
Returns out:

Dataframe with the main power plants characteristics and the computed indicators

dispaset.postprocessing.postprocessing.get_load_data(inputs, c)[source]

Get the load curve, the residual load curve, and the net residual load curve of a specific country

Parameters:
  • inputs – DispaSET inputs (output of the get_sim_results function)
  • c – Country to consider (e.g. ‘BE’)
Return out:

Dataframe with the following columns: Load: Load curve of the specified country ResidualLoad: Load minus the production of variable renewable sources NetResidualLoad: Residual netted from the interconnections with neightbouring countries

dispaset.postprocessing.postprocessing.get_plot_data(inputs, results, c)[source]

Function that reads the results dataframe of a DispaSET simulation and extract the dispatch data spedific to one country

Parameters:
  • results – Pandas dataframe with the results (output of the GdxToDataframe function)
  • c – Country to be considered (e.g. ‘BE’)
Returns plotdata:
 

Dataframe with the dispatch data storage and outflows are negative

dispaset.postprocessing.postprocessing.get_result_analysis(inputs, results)[source]

Reads the DispaSET results and provides useful general information to stdout

Parameters:
  • inputs – DispaSET inputs
  • results – DispaSET results
dispaset.postprocessing.postprocessing.get_sim_results(path='.', gams_dir=None, cache=False, temp_path='.pickle')[source]

This function reads the simulation environment folder once it has been solved and loads the input variables together with the results.

Parameters:
  • path – Relative path to the simulation environment folder (current path by default)
  • cache – If true, caches the simulation results in a pickle file for faster loading the next time
  • temp_path – Temporary path to store the cache file
Returns inputs,results:
 

Two dictionaries with all the input and outputs

dispaset.postprocessing.postprocessing.get_units_operation_cost(inputs, results)[source]

Function that computes the operation cost for each power unit at each instant of time from the DispaSET results Operation cost includes: CostFixed + CostStartUp + CostShutDown + CostRampUp + CostRampDown + CostVariable

Parameters:
  • inputs – DispaSET inputs
  • results – DispaSET results
Returns out:

Dataframe with the the power units in columns and the operatopn cost at each instant in rows

Main Author: @AbdullahAlawad

dispaset.postprocessing.postprocessing.plot_country(inputs, results, c='', rng=None, rug_plot=True)[source]

Generates plots from the dispa-SET results for one specific country

Parameters:
  • inputs – DispaSET inputs
  • results – DispaSET results
  • c – Considered country (e.g. ‘BE’)
dispaset.postprocessing.postprocessing.plot_country_capacities(inputs, plot=True)[source]

Plots the installed capacity for each country, disaggregated by fuel type

Parameters:inputs – Dictionnary with the inputs of the model (output of the function GetResults)
dispaset.postprocessing.postprocessing.plot_dispatch(demand, plotdata, level=None, curtailment=None, rng=None, alpha=None, figsize=(13, 6))[source]

Function that plots the dispatch data and the reservoir level as a cumulative sum

Parameters:
  • demand – Pandas Series with the demand curve
  • plotdata – Pandas Dataframe with the data to be plotted. Negative columns should be at the beginning. Output of the function GetPlotData
  • level – Optional pandas series with an aggregated reservoir level for the considered zone.
  • curtailment – Optional pandas series with the value of the curtailment
  • rng – Indexes of the values to be plotted. If undefined, the first week is plotted
dispaset.postprocessing.postprocessing.plot_energy_country_fuel(inputs, results, PPindicators)[source]

Plots the generation for each country, disaggregated by fuel type

Parameters:
  • results – Dictionnary with the outputs of the model (output of the function GetResults)
  • PPindicators – Por powerplant statistics (output of the function get_indicators_powerplant)
dispaset.postprocessing.postprocessing.plot_rug(df_series, on_off=False, cmap='Greys', fig_title='', normalized=False)[source]

Create multiaxis rug plot from pandas Dataframe

Arguments:
df_series (pd.DataFrame): 2D pandas with timed index on_off (bool): if True all points that are above 0 will be plotted as one color. If False all values will be colored based on their value. cmap (str): palette name (from colorbrewer, matplotlib etc.) fig_title (str): Figure title normalized (bool): if True, all series colormaps will be normalized based on the maximum value of the dataframe
Returns:
plot

Function copied from enlopy v0.1 www.github.com/kavvkon/enlopy. Install with pip install enlopy for latest version.

dispaset.postprocessing.postprocessing.storage_levels(inputs, results)[source]

Reads the DispaSET results and provides the difference between the minimum storage profile and the computed storage profile

Parameters:
  • inputs – DispaSET inputs
  • results – DispaSET results

Module contents