oemof.core package

Submodules

oemof.core.energy_system module

Created on Mon Jul 20 15:53:14 2015

@author: uwe

class oemof.core.energy_system.EnergySystem(**kwargs)[source]

Bases: object

Defining an energy supply system to use oemof’s solver libraries.

Note

The list of regions is not necessary to use the energy system with solph.

Parameters:
  • entities (list of Entity, optional) – A list containing the already existing Entities that should be part of the energy system. Stored in the entities attribute. Defaults to [] if not supplied.
  • simulation (core.energy_system.Simulation object) – Simulation object that contains all necessary attributes to start the solver library. Defined in the Simulation class.
  • regions (list of core.energy_system.Region objects) – List of regions defined in the Region class.
  • time_idx (pandas.index, optional) – Define the time range and increment for the energy system. This is an optional parameter but might be import for other functions/methods that use the EnergySystem class as an input parameter.
  • groupings (list) – The elements of this list are used to construct Groupings or they are used directly if they are instances of Grouping. These groupings are then used to aggregate the entities added to this energy system into groups. By default, there’ll always be one group for each uid containing exactly the entity with the given uid. See the examples for more information.
entities

list of Entity

A list containing the Entities that comprise the energy system. If this EnergySystem is set as the registry attribute, which is done automatically on EnergySystem construction, newly created Entities are automatically added to this list on construction.

groups

dict

simulation

core.energy_system.Simulation object

Simulation object that contains all necessary attributes to start the solver library. Defined in the Simulation class.

regions

list of core.energy_system.Region objects

List of regions defined in the Region class.

results

dictionary

A dictionary holding the results produced by the energy system. Is None while no results are produced. Currently only set after a call to optimize() after which it holds the return value of om.results(). See the documentation of that method for a detailed description of the structure of the results dictionary.

time_idx

pandas.index, optional

Define the time range and increment for the energy system. This is an optional atribute but might be import for other functions/methods that use the EnergySystem class as an input parameter.

Examples

Regardles of additional groupings, entities will always be grouped by their uid:

>>> from oemof.core.network import Entity
>>> from oemof.core.network.entities import Bus, Component
>>> es = EnergySystem()
>>> bus = Bus(uid='electricity')
>>> bus is es.groups['electricity']
True

For simple user defined groupings, you can just supply a function that computes a key from an entity and the resulting groups will be lists of entity stored under the returned keys, like in this example, where entities are grouped by their type:

>>> es = EnergySystem(groupings=[type])
>>> buses = [Bus(uid="Bus {}".format(i)) for i in range(9)]
>>> components = [Component(uid="Component {}".format(i)) for i in range(9)]
>>> buses == es.groups[Bus]
True
>>> components == es.groups[Component]
True
add(entity)[source]

Add an entity to this energy system.

connect(bus1, bus2, in_max, out_max, eta, transport_class)[source]

Create two transport objects to connect two buses of the same type in both directions.

Parameters:
  • bus2 (bus1,) – Two buses to be connected.
  • eta (float) – Constant efficiency of the transport.
  • in_max (float) – Maximum input the transport can handle, in $MW$.
  • out_max (float) – Maximum output which can possibly be obtained when using the transport, in $MW$.
  • class (transport_class) – Transport class to use for the connection
dump(dpath=None, filename=None, keep_weather=True)[source]

Dump an EnergySystem instance.

optimize(om=None)[source]

Start optimizing the energy system using solph.

Parameters:om (OptimizationModel, optional) – The optimization model used to optimize the EnergySystem. If not given, an OptimizationModel instance local to this method is created using the current EnergySystem instance as an argument. You only need to supply this if you want to observe any side effects that solving has on the om.
Returns:self
Return type:EnergySystem
restore(dpath=None, filename=None)[source]

Restore an EnergySystem instance.

class oemof.core.energy_system.Grouping(key, value=<function Grouping.<lambda>>, collide=<function Grouping.<lambda>>, insert=None)[source]

Bases: object

Used to aggregate entities in an energy system into groups.

UID = <oemof.core.energy_system.Grouping object>

The default grouping, which is always present in addition to user defined ones. Stores every entity in a group of its own under its uid and raises an error if another entity with the same uid get’s added to the energy system.

static create(argument)[source]
class oemof.core.energy_system.Region(**kwargs)[source]

Bases: object

Defining a region within an energy supply system.

Note

The list of regions is not necessary to use the energy system with solph.

Parameters:
  • entities (list of core.network objects) – List of all objects of the energy system. All class descriptions can be found in the oemof.core.network package.
  • name (string) – A unique name to identify the region. If possible use typical names for regions and english names for countries.
  • code (string) – A short unique name to identify the region.
  • geom (shapely.geometry object) – The geometry representing the region must be a polygon or a multi polygon.
entities

list of core.network objects

List of all objects of the energy system. All class descriptions can be found in the oemof.core.network package.

name

string

A unique name to identify the region. If possible use typical names for regions and english names for countries.

geom

shapely.geometry object

The geometry representing the region must be a polygon or a multi polygon.

add_entities(entities)[source]

Add a list of entities to the existing list of entities.

For every entity added to a region the region attribute of the entity is set

Parameters:entities (list of core.network objects) – List of all objects of the energy system that belongs to area covered by the polygon of the region. All class descriptions can be found in the oemof.core.network package.
code

Creating a short code based on the region name if no code is set.

class oemof.core.energy_system.Simulation(**kwargs)[source]

Bases: object

Defining the simulation related parameters according to the solver lib.

Parameters:
  • solver (string) – Name of the solver supported by the used solver library. (e.g. ‘glpk’, ‘gurobi’)
  • debug (boolean) – Set the chosen solver to debug (verbose) mode to get more information.
  • verbose (boolean) – If True, solver output etc. is streamed in python console
  • duals (boolean) – If True, results of dual variables and reduced costs will be saved
  • objective_options (dictionary) –
    ‘function’: function to use from
    oemof.solph.predefined_objectives
    ‘cost_objects’: list of str(class) elements. Objects of type class
    are include in cost terms of objective function.
    ‘revenue_objects’: list of str(class) elements. . Objects of type
    class are include in revenue terms of objective function.
  • timesteps (list or sequence object) – Timesteps to be simulated or optimized in the used library
  • relaxed (boolean) – If True, integer variables will be relaxed (only relevant for milp-problems)
  • fast_build (boolean) – If True, the standard way of pyomo constraint building is skipped and a different function is used. (Warning: No guarantee that all expected ‘standard’ pyomo model functionalities work for the constructed model!)

Module contents