oemof.core package¶
Subpackages¶
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 existingEntities
that should be part of the energy system. Stored in theentities
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 ofGrouping
. These groupings are then used to aggregate the entities added to this energy system intogroups
. By default, there’ll always be one group for eachuid
containing exactly the entity with the givenuid
. See the examples for more information.
-
entities
¶ list of
Entity
A list containing the
Entities
that comprise the energy system. If thisEnergySystem
is set as theregistry
attribute, which is done automatically onEnergySystem
construction, newly createdEntities
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.
-
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 ofom.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 theiruid
:>>> 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 ofentity
stored under the returned keys, like in this example, whereentities
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
-
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
-
optimize
(om=None)[source]¶ Start optimizing the energy system using solph.
Parameters: om ( OptimizationModel
, optional) – The optimization model used to optimize theEnergySystem
. If not given, anOptimizationModel
instance local to this method is created using the currentEnergySystem
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
- entities (list of
-
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 anenergy system
intogroups
.
-
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.
- entities (list of core.network objects) – List of all objects of the energy system. All class descriptions can
be found in the
-
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!)