Results

class pomato.data.Results(data, grid, result_folder)

Results of POMATO makes market results available to the user.

The Results module provides an interface between the market result and the data itself. All result variables are set as an attribute in a long DataFrame with its sets as columns which can be easily accessed with result.VAR.

Parameters:
dataDataManagement

An instance of the DataManagement class with the processed input data that is the basis of the loaded results.

gridGridTopology,

An instance of the GridTopology class, to provide its functionality to the results.

result_folderpathlib.Path

Folder with the results of the market model in .csv files.

Attributes:
dataDataManagement

An instance of the DataManagement class with the processed input data that is the basis of the loaded results.

gridGridTopology

An instance of the GridTopology class, to provide its functionality to the results.

result_folderpathlib.Path

The data is initialized from a folder containing the result. The Results can be initialized after a model run or from stored data.

result_attributesdict,

result_attributes covers all variables from the market model, along with dual and infeasibility/slack variables and other market model specific information which are relevant to the results itself.

Methods

load_results_from_folder(folder)

Load results from folder.

save(folder)

Save Result to folder

create_result_data()

n_0_flow([force_recalc])

Calculate N-0 Flows.

n_1_flow([sensitivity, force_recalc])

N-1 power flows on lines (cb) under outages (co).

overloaded_lines_n_0([force_recalc])

Calculate overloaded lines (N-0) power.

overloaded_lines_n_1([sensitivity, force_recalc])

Overloaded lines under contingencies (N-1).

generation([force_recalc])

Return generation variable merged to input data.

redispatch([force_recalc])

Return Redispatch.

infeasibility([force_recalc])

Return electricity infeasibilities.

net_position()

Calculate net position for each zone and timestep.

price([force_recalc])

Return electricity prices.

storage_generation([force_recalc])

Return storage generation schedules.

demand([force_recalc])

Process total nodal demand composed of load and market results of storage/heatpump usage.

infeasibility([force_recalc])

Return electricity infeasibilities.

curtailment([force_recalc])

Return Curtailment merge to input data.

full_load_hours()

Returns plant data including full load hours.

absolute_max_n_1_flow(sensitivity=0.05, force_recalc=False)

Calculate the absolute max of N-1 Flows.

This method essentially proviedes a n_1_flow.groupby(“cb”) yielding the absolute maximum flow, maintaining the directionality of the flow. Thanks @https://stackoverflow.com/a/64559655

Parameters:
sensitivityfloat, optional

The sensitivity defines the threshold from which outages are considered critical. An outage that can impact the line flow, relative to its maximum capacity, more than the sensitivity is considered critical. Defaults to 5%.

cache_to_disk(df, name)

Cache processed results as feather format to relieve memory.

curtailment(force_recalc=False)

Return Curtailment merge to input data.

Parameters:
force_recalcbool, optional

Generation is cached automatically. To enforce recalc, e.g. when explicitly changing data set this force_recalc to True. Defaults to False.

Returns:
CurtailmentDataFrame

Returns DataFrame with columns [node, plant_type, g_max, zone, t, p, CURT]

delete_temporary_files()

Delete temporary files.

demand(force_recalc=False)

Process total nodal demand composed of load and market results of storage/heatpump usage.

full_load_hours()

Returns plant data including full load hours.

generation(force_recalc=False)

Return generation variable merged to input data.

Parameters:
force_recalcbool, optional

Generation is cached automatically. To enforce recalc, e.g. when explicitly changing data set this force_recalc to True. Defaults to False.

Returns:
generationDataFrame

Returns DataFrame with columns [node, plant_type, g_max, zone, t, p, G]

infeasibility(force_recalc=False)

Return electricity infeasibilities.

Infeasibilities occur when the electricity energy balances cannot be satisfied in the model due to other constraints, like capacity or network constraints. Nodal infeasibilities represent dropped load (positive) or dumped energy (negative).

Parameters:
force_recalcbool, optional

Infeasibility is cached automatically. To enforce recalc, e.g. when explicitly changing data set this force_recalc to True. Defaults to False.

Returns:
DataFrame

DataFrame of nodal infeasibilities with columns [t, n, pos, neg].

load_results_from_folder(folder)

Load results from folder.

Results are loaded as csv files from results folder with additional information inform of the options file that was used to get the results as well as the model horizon which is extracted from the INJ variable.

All variables are set as an attribute of this instance of ResultProcessing.

Parameters:
folderpathlib.Path

Folder with the results of the market model.

n_0_flow(force_recalc=False)

Calculate N-0 Flows.

Calculates the N-0 power flows on all lines. Optionally just calculate for a list/subset of timesteps.

Parameters:
force_recalcbool, optional

Power flow results are automatically cached to avoid recalculation. This argument forces recalculation e.g. when parameters have been altered.

Returns:
n_0_flowsDataFrame

N-0 power flows for each line.

n_1_flow(sensitivity=0.05, force_recalc=False)

N-1 power flows on lines (cb) under outages (co).

Calculates the power flows on all lines under the outages with significant impact. This is calculated with create_filtered_n_1_ptdf() where this is described in greater detail.

Parameters:
force_recalcbool, optional

Power flow results are automatically cached to avoid recalculation. This argument forces recalculation e.g. when parameters have been altered.

sensitivityfloat, optional

The sensitivity defines the threshold from which outages are considered critical. An outage that can impact the line flow, relative to its maximum capacity, more than the sensitivity is considered critical. Defaults to 5%.

Returns:
n_1_flowsDataFrame

Returns Dataframe of N-1 power flows with lines and contingencies specified.

net_position()

Calculate net position for each zone and timestep.

Returns:
net_positionDataFrame

DataFrame with the timesteps as index and zones as columns.

overloaded_lines_n_0(force_recalc=False)

Calculate overloaded lines (N-0) power.

Calculates what lines are overloaded, without taking into account contingencies. This uses the method n_0_flow() and compares the absolute flows to the maximum capacity.

Parameters:
timestepslist like, optional

Subset of model horizon. Defaults to the full model horizon.

Returns:
agg_infoDataFrame

DataFrame that provides the information which line is overloaded, how often an overload occurs over the specified timesteps and the average loading of the line. Returns an empty DataFrame when no line is overloaded.

n_0_loadDataFrame

Line loadings for the overloaded lines and considered timesteps.

overloaded_lines_n_1(sensitivity=0.05, force_recalc=False)

Overloaded lines under contingencies (N-1).

Uses method n_1_flow() to obtain N-1 power flows under contingencies. Compiles additional information for overloaded lines. How often are lines overloaded and under which contingencies its average load and whether or not an overload already occurs in the base case, meaning the N-0 loading.

Parameters:
timestepslist like, optional

Subset of model horizon. Defaults to the full model horizon.

sensitivityfloat, optional

The sensitivity defines the threshold from which outages are considered critical. Am outage that can impact the line flow, relative to its maximum capacity, more than the sensitivity is considered critical. Defaults to 5%.

Returns:
agg_infoDataFrame

DataFrame that provides the information which line is overloaded, how often an overload occurs over the specified timesteps and contingencies, average loading of the line. Returns an empty DataFrame when no line is overloaded.

n_1_overloadDataFrame

Line loadings for the overloaded cbco’s and considered timesteps.

price(force_recalc=False)

Return electricity prices.

Returns the dual of the energy balances (nodal and zonal). Since the model can be cleared with constraints on both simultaneously, the resulting nodal price is the sum of the zonal and nodal components. The dual is obtained from Julia/JuMP with the dual function and therefore multiplied with -1.

Parameters:
force_recalcbool, optional

Price is cached automatically. To enforce recalc, e.g. when explicitly changing data set this force_recalc to True. Defaults to False.

Returns:
priceDataFrame

Price DataFrame with columns timestep (t), node (n), zone (z) and price (marginal).

read_cached_result(name)

Read cached processed from disk.

redispatch(force_recalc=False)

Return Redispatch. Calculates a delta between redispatch,- and market result. Positive delta represents a higher generation after redispatch i.e. positive and negative vice versa.

Parameters:
force_recalcbool, optional

Price is cached automatically. To enforce recalc, e.g. when explicitly changing data set this force_recalc to True. Defaults to False.

Returns:
redispatchDataFrame

Returns DataFrame with columns [node, plant_type, g_max, zone, t, p, G, delta, delta_abs]

redispatch_infeasibility(force_recalc=False)

Chances in infeasibility variable usage between market and redispatch.

save(folder)

Save Result to folder

storage_generation(force_recalc=False)

Return storage generation schedules.

Returns DataFrame with columns [node, plant_type, zone, t, p, G, D_es, L_es]

zonal_generation(force_recalc=False)

Return generation variable merged to input data.

Parameters:
force_recalcbool, optional

Generation is cached automatically. To enforce recalc, e.g. when explicitly changing data set this force_recalc to True. Defaults to False.

Returns:
generationDataFrame

Returns DataFrame with columns [‘zone’, ‘fuel’,’technology’, ‘node’, ‘G’]

zonal_redispatch(force_recalc=False)

Return Redispatch. Calculates a delta between redispatch,- and market result. Positive delta represents a higher generation after redispatch i.e. positive and negative vice versa.

Parameters:
force_recalcbool, optional

Price is cached automatically. To enforce recalc, e.g. when explicitly changing data set this force_recalc to True. Defaults to False.

Returns:
redispatchDataFrame

Returns DataFrame with columns [zone, plant_type, g_max, zone, t, G, delta, delta_abs]