deflex.DeflexScenario

class deflex.DeflexScenario(meta=None, input_data=None, es=None, results=None)[source]

The Deflex Scenario is the center of a deflex energy model. It can store the needed input data and the results after a successful optimisation. a inherits from the Scenario class and extends the Scenario class with valid nodes creation. Additionally one can define an extra_regions attribute to create an extra commodity source for these regions. This makes it possible to create a source balance for these regions.

Parameters:
  • meta (dict) – Meta information of the DeflexScenario (optional).
  • input_data (dict) – A dictionary of tables in the deflex scenario style (optional).
  • es (oemof.solph.EnergySystem) – An Energy system (optional).
  • results (dict) – A valid Deflex results dictionary (optional).
input_data

The input data is organised in a dictionary of pandas.DataFrame/ pandas.Series. The keys are the data names (string) and the values are the data tables.

Type:dict
results

There are different sub-sections of the results. The dictionary has got the following keys:

  • main – Results of all variables (result dictionary from oemof.solph)
  • param – Input parameter
  • meta – Meta information and tags of the scenario
  • problem – Information about the linear problem such as lower bound, upper bound etc.
  • solver – Solver results
  • solution – Information about the found solution and the objective value

The model results are stored in the main section. It contains another dictionary with tuples as keys and the results of the variables as values (nested dictionary with pandas.DataFrame). The tuples contain the node object in the following form: (from_node, to_node) for flows and (node, None) for components. See the solph documentation for more details.

Type:dict
meta

Meta information that can be used to search for in stored scenarios. The dictionary keys can be used like tags or categories.

Type:dict
es

This attribute will hold the oemof.solph.EnergySystem.

Type:oemof.solph.EnergySystem
__init__(meta=None, input_data=None, es=None, results=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([meta, input_data, es, results]) Initialize self.
add_nodes_to_es(nodes) Add nodes to an existing solph.EnergySystem.
check_input_data() Check the input data for NaN values.
compute([solver, with_duals]) Create a solph.Model from the input data and optimise it using an external solver.
create_model() Create a solph model from an EnergySystem object.
create_nodes() Creates solph components and buses from the input data and store them in a dictionary with unique IDs as keys.
dump(filename) Store a solved scenario class into the binary pickle format.
initialise_energy_system() Create a solph.EnergySystem and store it in the es attribute.
read_csv(path) Load scenario from a csv-collection.
read_xlsx(filename) Load scenario data from an xlsx file.
solve(model[, solver, with_duals]) Solve the solph.Model.
store_graph(filename, **kwargs) Store the EnergySystem graph into a .graphml file.
table2es() Create a populated solph.EnergySystem from the input data.
to_csv(path) Store the input data as a csv-collection.
to_xlsx(filename) Store the input data into an xlsx-file.