ConversionPartLoad class¶
ConversionPartLoad components are Conversion components that are additionally able to capture partload behaviour. For that, the module is using piecewise linear functions and special ordered sets (SOS) constraints.
ConversionPartLoad class description:
Last edited: February 20, 2020
@author: FINE Developer Team (FZJ IEK3)

class
conversionPartLoad.
ConversionPartLoad
(esM, name, physicalUnit, commodityConversionFactors, commodityConversionFactorsPartLoad, nSegments=None, **kwargs)[source]¶ A ConversionPartLoad component maps the (nonlinear) partload behavior of a Conversion component. It uses the open source module PWLF to generate piecewise linear functions upon a continuous function or discrete data points. The formulation of the optimization is done by using special ordered sets (SOS) constraints. When using ConversionPartLoad it is recommended to check the piecewise linearization visually to verify that the accuracy meets the desired requirements. The ConversionPartLoad class inherits from the Conversion class.

__init__
(esM, name, physicalUnit, commodityConversionFactors, commodityConversionFactorsPartLoad, nSegments=None, **kwargs)[source]¶ Constructor for creating an ConversionPartLoad class instance. Capacities are given in the physical unit of the plants. The ConversionPartLoad component specific input arguments are described below. Other specific input arguments are described in the Conversion class and the general component input arguments are described in the Component class.
Required arguments:
Parameters: commodityConversionFactorsPartLoad (Lambda function or Pandas DataFrame with two columns for the xaxis and the yaxis.) – Function or data set describing (nonlinear) part load behavior. Default arguments:
Parameters:  nSegments (None or integer or string) – Number of line segments used for piecewise linearization and generation of point variable (nSegment+1) and
segment (nSegment) variable sets.
By default, the nSegments is None. For this case, the number of line segments is set to 5.
The user can set nSegments by choosing an integer (>=0). It is recommended to choose values between 3 and 7 since
the computational cost rises dramatically with increasing nSegments.
When specifying nSegements=’optimizeSegmentNumbers’, an optimal number of line segments is automatically chosen by a
bayesian optimization algorithm.
* the default value is None  **kwargs –
All other keyword arguments of the conversion class can be defined as well.
 nSegments (None or integer or string) – Number of line segments used for piecewise linearization and generation of point variable (nSegment+1) and
segment (nSegment) variable sets.
By default, the nSegments is None. For this case, the number of line segments is set to 5.
The user can set nSegments by choosing an integer (>=0). It is recommended to choose values between 3 and 7 since
the computational cost rises dramatically with increasing nSegments.
When specifying nSegements=’optimizeSegmentNumbers’, an optimal number of line segments is automatically chosen by a
bayesian optimization algorithm.

Inheritance diagram:
ConversionPartLoadModel class description:

class
conversionPartLoad.
ConversionPartLoadModel
[source]¶ A ConversionPartLoad class instance will be instantly created if a ConversionPartLoad class instance is initialized. It is used for the declaration of the sets, variables and constraints which are valid for the Conversion class instance. These declarations are necessary for the modeling and optimization of the energy system model. The ConversionPartLoad class inherits from the ConversionModel class.

initDiscretizationPointVarSet
(pyM)[source]¶ Declare discretization variable set of type 1 in the pyomo object for for each node. Type 1 represents every start, end, and intermediate point in the piecewise linear function.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

initDiscretizationSegmentVarSet
(pyM)[source]¶ Declare discretization variable set of type 2 in the pyomo object for for each node. Type 2 represents every segment in the piecewise linear function.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareSets
(esM, pyM)[source]¶ Declare sets and dictionaries: design variable sets, operation variable sets, operation mode sets and linked components dictionary.
Parameters:  esM (EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.
 pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareDiscretizationPointVariables
(pyM)[source]¶ Declare discretization point variables.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareDiscretizationSegmentBinVariables
(pyM)[source]¶ Declare discretization segment variables.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareDiscretizationSegmentConVariables
(pyM)[source]¶ Declare discretization segment variables.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareVariables
(esM, pyM, relaxIsBuiltBinary)[source]¶ Declare design and operation variables.
Parameters:  esM (EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.
 pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

segmentSOS1
(pyM)[source]¶ Ensure that the binary segment variables are in sum equal to 1. Enforce that only one binary is set to 1, while all other are fixed 0.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

segmentBigM
(pyM)[source]¶ Ensure that the continuous segment variables are zero if the respective binary variable is zero and unlimited otherwise.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

segmentCapacityConstraint
(pyM, esM)[source]¶ Ensure that the continuous segment variables are in sum equal to the installed capacity of the component.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

pointCapacityConstraint
(pyM, esM)[source]¶ Ensure that the continuous point variables are in sum equal to the installed capacity of the component.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareOpConstrSetMinPartLoad
(pyM, constrSetName)[source]¶ Declare set of locations and components for which partLoadMin is not None.

pointSOS2
(pyM)[source]¶ Ensure that only two consecutive point variables are nonzero while all other point variables are fixed to zero.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

partLoadOperationOutput
(pyM)[source]¶ Set the required input of a conversion process dependent on the part load efficency.
Parameters: pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareComponentConstraints
(esM, pyM)[source]¶ Declare time independent and dependent constraints.
Parameters:  esM (EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.
 pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.
Get contributions to shared location potential.

hasOpVariablesForLocationCommodity
(esM, loc, commod)[source]¶ Check if the commodity´s transfer between a given location and the other locations of the energy system model is eligible.
Parameters:  esM (esM  EnergySystemModel class instance) – EnergySystemModel in which the LinearOptimalPowerFlow components have been added to.
 loc (string) – Name of the regarded location (locations are defined in the EnergySystemModel instance)
 commod – Name of the regarded commodity (commodities are defined in the EnergySystemModel instance)
 commod – string

getCommodityBalanceContribution
(pyM, commod, loc, p, t)[source]¶ Get contribution to a commodity balance.

getObjectiveFunctionContribution
(esM, pyM)[source]¶ Get contribution to the objective function.
Parameters:  esM (EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.
 pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

setOptimalValues
(esM, pyM)[source]¶ Set the optimal values of the components.
Parameters:  esM (EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.
 pyM (pyomo Concrete Model) – pyomo ConcreteModel which stores the mathematical formulation of the model.

getOptimalValues
(name='all')[source]¶ Return optimal values of the components.
Parameters: name – name of the variables of which the optimal values should be returned:  ‘capacityVariables’,
 ‘isBuiltVariables’,
 ‘operationVariablesOptimum’,
 ‘all’ or another input: all variables are returned.
* the default value is ‘all’ :type name: stringReturns: a dictionary with the optimal values of the components Return type: dict

Inheritance diagram: