oemof.solph.Results

Modules for providing a convenient data structure for solph results.

class oemof.solph._results.Results(model: ConcreteModel)[source]

Bases: object

provides functionality for results processing

Takes pyomo results and uses keys to access different types of results. Some of these keys are related to meta_results of the solver, and some of the variables are related to the oemof.solph model. Examples are ‘flow’, ‘storage_content’, and ‘invest’.

Example

>>> from oemof import solph
>>> energysystem = solph.EnergySystem(timeindex=[1,2,3])
>>> energysystem_model = solph.Model(energysystem)
>>> _ = energysystem_model.solve()
>>> results = solph.Results(energysystem_model)
>>> results.get("flow")  # with the equivalent `results["flow"]`
get(key: str, default: any = None) DataFrame | Series[source]

Return a DataFrame view of the model’s variable.

The function signature mimics the function get of a dict, similarly, you can also replace e.g. results.get(“flow”) with the equivalent results[“flow”].

Parameters:
  • key (string) – name of a result (e.g. pyomo variable or derived quantity)

  • default (any) – value to return if key is not found

Returns:

pd.DataFrame or pd.Series (Result including corresponding time axis)

keys()[source]

Method returning keys of the result object

Returns:

set – keys that can be used to access results

property timeindex

Returns timeindex of energy system

Returns:

float – time index of the model

to_df(variable: str) DataFrame | Series[source]

Compatibility wrapper for Results.get.