oemof.solph.models

Solph Optimization Models.

class oemof.solph._models.BaseModel(energysystem, **kwargs)[source]

Bases: pyomo.core.base.PyomoModel.ConcreteModel

The BaseModel for other solph-models (Model, MultiPeriodModel, etc.)

Parameters:
  • energysystem (EnergySystem object) – Object that holds the nodes of an oemof energy system graph
  • constraint_groups (list (optional)) – Solph looks for these groups in the given energy system and uses them to create the constraints of the optimization problem. Defaults to Model.CONSTRAINTS
  • objective_weighting (array like (optional)) – Weights used for temporal objective function expressions. If nothing is passed timeincrement will be used which is calculated from the freq length of the energy system timeindex .
  • auto_construct (boolean) – If this value is true, the set, variables, constraints, etc. are added, automatically when instantiating the model. For sequential model building process set this value to False and use methods _add_parent_block_sets, _add_parent_block_variables, _add_blocks, _add_objective
  • Attributes
  • ———–
  • timeincrement (sequence) – Time increments.
  • flows (dict) – Flows of the model.
  • name (str) – Name of the model.
  • es (solph.EnergySystem) – Energy system of the model.
  • meta (pyomo.opt.results.results_.SolverResults or None) – Solver results.
  • dual (… or None)
  • rc (… or None)
CONSTRAINT_GROUPS = []
receive_duals()[source]

Method sets solver suffix to extract information about dual variables from solver. Shadow prices (duals) and reduced costs (rc) are set as attributes of the model.

relax_problem()[source]

Relaxes integer variables to reals of optimization model self.

results()[source]

Returns a nested dictionary of the results of this optimization

solve(solver='cbc', solver_io='lp', **kwargs)[source]

Takes care of communication with solver to solve the model.

Parameters:
  • solver (string) – solver to be used e.g. “glpk”,”gurobi”,”cplex”
  • solver_io (string) – pyomo solver interface file format: “lp”,”python”,”nl”, etc.
  • **kwargs (keyword arguments) – Possible keys can be set see below:
Other Parameters:
 
  • solve_kwargs (dict) – Other arguments for the pyomo.opt.SolverFactory.solve() method Example : {“tee”:True}
  • cmdline_options (dict) – Dictionary with command line options for solver e.g. {“mipgap”:”0.01”} results in “–mipgap 0.01” {“interior”:” “} results in “–interior” Gurobi solver takes numeric parameter values such as {“method”: 2}
exception oemof.solph._models.LoggingError[source]

Bases: BaseException

Raised when the wrong logging level is used.

class oemof.solph._models.Model(energysystem, **kwargs)[source]

Bases: oemof.solph._models.BaseModel

An energy system model for operational and investment optimization.

Parameters:
  • energysystem (EnergySystem object) – Object that holds the nodes of an oemof energy system graph
  • constraint_groups (list) – Solph looks for these groups in the given energy system and uses them to create the constraints of the optimization problem. Defaults to Model.CONSTRAINTS
  • **The following basic sets are created**
  • NODES – A set with all nodes of the given energy system.
  • TIMESTEPS – A set with all timesteps of the given time horizon.
  • FLOWS – A 2 dimensional set with all flows. Index: (source, target)
  • **The following basic variables are created**
  • flow – Flow from source to target indexed by FLOWS, TIMESTEPS. Note: Bounds of this variable are set depending on attributes of the corresponding flow object.
CONSTRAINT_GROUPS = [<class 'oemof.solph.buses._bus.BusBlock'>, <class 'oemof.solph.components._transformer.TransformerBlock'>, <class 'oemof.solph.flows._investment_flow_block.InvestmentFlowBlock'>, <class 'oemof.solph.flows._simple_flow_block.SimpleFlowBlock'>, <class 'oemof.solph.flows._non_convex_flow_block.NonConvexFlowBlock'>, <class 'oemof.solph.flows._invest_non_convex_flow_block.InvestNonConvexFlowBlock'>]