Conversion class

Conversion components convert commodities into each other.

Conversion class description:

class conversion.Conversion(esM, name, physicalUnit, commodityConversionFactors, hasCapacityVariable=True, capacityVariableDomain='continuous', capacityPerPlantUnit=1, linkedConversionCapacityID=None, hasIsBuiltBinaryVariable=False, bigM=None, operationRateMin=None, operationRateMax=None, operationRateFix=None, tsaWeight=1, locationalEligibility=None, capacityMin=None, capacityMax=None, partLoadMin=None, sharedPotentialID=None, linkedQuantityID=None, capacityFix=None, commissioningMin=None, commissioningMax=None, commissioningFix=None, isBuiltFix=None, investPerCapacity=0, investIfBuilt=0, opexPerOperation=0, opexPerCapacity=0, opexIfBuilt=0, QPcostScale=0, interestRate=0.08, economicLifetime=10, technicalLifetime=None, yearlyFullLoadHoursMin=None, yearlyFullLoadHoursMax=None, stockCommissioning=None, floorTechnicalLifetime=True)[source]

A Conversion component converts commodities into each other.

__init__(esM, name, physicalUnit, commodityConversionFactors, hasCapacityVariable=True, capacityVariableDomain='continuous', capacityPerPlantUnit=1, linkedConversionCapacityID=None, hasIsBuiltBinaryVariable=False, bigM=None, operationRateMin=None, operationRateMax=None, operationRateFix=None, tsaWeight=1, locationalEligibility=None, capacityMin=None, capacityMax=None, partLoadMin=None, sharedPotentialID=None, linkedQuantityID=None, capacityFix=None, commissioningMin=None, commissioningMax=None, commissioningFix=None, isBuiltFix=None, investPerCapacity=0, investIfBuilt=0, opexPerOperation=0, opexPerCapacity=0, opexIfBuilt=0, QPcostScale=0, interestRate=0.08, economicLifetime=10, technicalLifetime=None, yearlyFullLoadHoursMin=None, yearlyFullLoadHoursMax=None, stockCommissioning=None, floorTechnicalLifetime=True)[source]

Constructor for creating an Conversion class instance. Capacities are given in the physical unit of the plants. The Conversion component specific input arguments are described below. The general component input arguments are described in the Component class.

Required arguments:

Parameters:
  • physicalUnit (string) – reference physical unit of the plants to which maximum capacity limitations, cost parameters and the operation time series refer to.

  • commodityConversionFactors

    conversion factors with which commodities are converted into each other with one unit of operation (dictionary). Each commodity which is converted in this component is indicated by a string in this dictionary. The conversion factor related to this commodity is given as a float (constant), pandas.Series or pandas.DataFrame (time-variable). A negative value indicates that the commodity is consumed. A positive value indicates that the commodity is produced. Check unit consistency when specifying this parameter!

    Examples:

    • An electrolyzer converts, simply put, electricity into hydrogen with an electrical efficiency

      of 70%. The physicalUnit is given as GW_electric, the unit for the ‘electricity’ commodity is given in GW_electric and the ‘hydrogen’ commodity is given in GW_hydrogen_lowerHeatingValue -> the commodityConversionFactors are defined as {‘electricity’:-1,’hydrogen’:0.7}.

    • A fuel cell converts, simply put, hydrogen into electricity with an efficiency of 60%.

      The physicalUnit is given as GW_electric, the unit for the ‘electricity’ commodity is given in GW_electric and the ‘hydrogen’ commodity is given in GW_hydrogen_lowerHeatingValue -> the commodityConversionFactors are defined as {‘electricity’:1,’hydrogen’:-1/0.6}.

    If a transformation pathway analysis is performed the conversion factors can also be variated over the transformation pathway. Therefore two different options are available:

    1. Variation with operation year (for example to incorporate weather changes for a heat pump). Example: {2020: {‘electricity’:-1,’heat’:pd.Series(data=[2.5, 2.8, 2.5, …])}, 2025: {‘electricity’:-1,’heat’:pd.Series(data=[2.7, 2.4, 2.9, …])}, … }

    2. Variation with commissioning and operation year (for example to incorporate efficiency changes dependent on the installation year). Please note that this implementation massively increases the complexity of the optimization problem. Example: {(2020, 2020): {‘electricity’:-1,’heat’:pd.Series(data=[2.5, 2.8, 2.5, …])}, (2020, 2025): {‘electricity’:-1,’heat’:pd.Series(data=[2.7, 2.4, 2.9, …])}, (2025, 2025): {‘electricity’:-1,’heat’:pd.Series(data=[3.7, 3.4, 3.9, …])}, … }

Default arguments:

Parameters:
  • linkedConversionCapacityID (string) – if specifies, indicates that all conversion components with the same ID have to have the same capacity.
    * the default value is None

  • operationRateMin – if specified, indicates a minimum operation rate for each location and each time step, if required also for each investment period, by a positive float. If hasCapacityVariable is set to True, the values are given relative to the installed capacities (i.e. a value of 1 indicates a utilization of 100% of the capacity). If hasCapacityVariable is set to False, the values are given as absolute values in form of the physicalUnit of the plant for each time step.
    * the default value is None

  • operationRateMax – if specified, indicates a maximum operation rate for each location and each time step, if required also for each investment period, by a positive float. If hasCapacityVariable is set to True, the values are given relative to the installed capacities (i.e. a value of 1 indicates a utilization of 100% of the capacity). If hasCapacityVariable is set to False, the values are given as absolute values in form of the physicalUnit of the plant for each time step.
    * the default value is None

  • operationRateFix – if specified, indicates a fixed operation rate for each location and each time step, if required also for each investment period, by a positive float. If hasCapacityVariable is set to True, the values are given relative to the installed capacities (i.e. a value of 1 indicates a utilization of 100% of the capacity). If hasCapacityVariable is set to False, the values are given as absolute values in form of the physicalUnit of the plant for each time step.
    * the default value is None

  • tsaWeight (positive (>= 0) float) – weight with which the time series of the component should be considered when applying time series aggregation.
    * the default value is 1

  • opexPerOperation – describes the cost for one unit of the operation. The cost which is directly proportional to the operation of the component is obtained by multiplying the opexPerOperation parameter with the annual sum of the operational time series of the components. The opexPerOperation can either be given as a float or a Pandas Series with location specific values. The cost unit in which the parameter is given has to match the one specified in the energy system model (e.g. Euro, Dollar, 1e6 Euro).
    * the default value is 0

setTimeSeriesData(hasTSA)[source]

Function for setting the maximum operation rate and fixed operation rate depending on whether a time series analysis is requested or not.

Parameters:

hasTSA (boolean) – states whether a time series aggregation is requested (True) or not (False).

getDataForTimeSeriesAggregation(ip)[source]

Function for getting the required data if a time series aggregation is requested.

Parameters:

ip (int) – investment period of transformation path analysis.

setAggregatedTimeSeriesData(data, ip)[source]

Function for determining the aggregated maximum rate and the aggregated fixed operation rate.

Parameters:
  • data (Pandas DataFrame) – Pandas DataFrame with the clustered time series data of the conversion component

  • ip (int) – investment period of transformation path analysis.

checkProcessedDataSets()[source]

Check processed time series data after applying time series aggregation. If all entries of dictionary are None the parameter itself is set to None.

Inheritance diagram:

Inheritance diagram of Conversion

ConversionModel class description:

class conversion.ConversionModel[source]

A ConversionModel class instance will be instantly created if a Conversion 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 ConversionModel class inherits from the ComponentModel class.

declareLinkedCapacityDict(pyM)[source]

Declare conversion components with linked capacities and check if the linked components have the same locational eligibility.

Parameters:

pyM (pyomo ConcreteModel) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareOpCommisVarSet(esM, pyM)[source]

Declare operation set for components, which commodity conversion factors are depending on the commissioning year in the pyomo object for amodeling class.

Parameters:
  • esM (EnergySystemModel instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.

  • pyM (pyomo ConcreteModel) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareOpCommisConstrSet1(pyM, constrSetName, rateMax, rateFix, rateMin)[source]

Declare set of locations and components for which hasCapacityVariable is set to True and neither the maximum nor the fixed operation rate is given.

declareOpCommisConstrSet2(pyM, constrSetName, rateFix)[source]

Declare set of locations and components for which hasCapacityVariable is set to True and a fixed operation rate is given.

declareOpCommisConstrSet3(pyM, constrSetName, rateMax)[source]

Declare set of locations and components for which hasCapacityVariable is set to True and a maximum operation rate is given.

declareOpCommisConstrSet4(pyM, constrSetName, rateMin)[source]

Declare set of locations and components for which hasCapacityVariable is set to True and a minimum operation rate is given.

declareOpCommisConstrSetMinPartLoad(pyM, constrSetName)[source]

Declare set of locations and components for which partLoadMin is not None.

declareYearlyFullLoadHoursCommisMinSet(pyM)[source]

Declare set of locations and components for which minimum yearly full load hours are given.

declareYearlyFullLoadHoursCommisMaxSet(pyM)[source]

Declare set of locations and components for which maximum yearly full load hours are given.

declareOperationModeSets(pyM, constrSetName, rateMax, rateFix, rateMin)[source]

Declare operating mode sets.

Parameters:
  • pyM (pyomo ConcreteModel) – pyomo ConcreteModel which stores the mathematical formulation of the model.

  • constrSetName (string) – name of the constraint set.

  • rateMax (string) – attribute of the considered component which stores the maximum operation rate data.

  • rateMax – attribute of the considered component which stores the minimum operation rate data.

  • rateFix (string) – attribute of the considered component which stores the fixed operation rate data.

declareSets(esM, pyM)[source]

Declare sets and dictionaries: design variable sets, operation variable set, operation mode sets and linked components dictionary.

Parameters:
  • esM (esM - EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.

  • pyM (pyomo ConcreteModel) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareVariables(esM, pyM, relaxIsBuiltBinary, relevanceThreshold)[source]

Declare design and operation variables

Parameters:
  • esM (esM - EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.

  • pyM (pyomo ConcreteModel) – pyomo ConcreteModel which stores the mathematical formulation of the model.

  • relaxIsBuiltBinary – states if the optimization problem should be solved as a relaxed LP to get the lower bound of the problem.
    * the default value is False

  • relevanceThreshold (float (>=0) or None) – Force operation parameters to be 0 if values are below the relevance threshold.
    * the default value is None

linkedCapacity(pyM)[source]

Ensure that all Conversion components with the same linkedConversionCapacityID have the same capacity

Parameters:

pyM (pyomo ConcreteModel) – pyomo ConcreteModel which stores the mathematical formulation of the model.

declareComponentConstraints(esM, pyM)[source]

Declare time independent and dependent constraints

Parameters:
  • esM (esM - EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.

  • pyM (pyomo ConcreteModel) – pyomo ConcreteModel which stores the mathematical formulation of the model.

getTotalOperationIfDifferentCommodityConversionFactors(pyM, esM)[source]

# TODO formula # TODO new name of function

hasOpVariablesForLocationCommodity(esM, loc, commod)[source]

Check if operation variables exist in the modeling class at a location which are connected to a commodity.

Parameters:
  • esM (esM - EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.

  • 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, ip, p, t)[source]

Get contribution to a commodity balance.

\text{C}^{comp,comm}_{loc,ip,p,t} =  \text{conversionFactor}^{comp}_{comm} \cdot op_{loc,ip,p,t}^{comp,op}

getObjectiveFunctionContribution(esM, pyM)[source]

Get contribution to the objective function.

Parameters:
  • esM (esM - EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.

  • pyM (pyomo ConcreteModel) – pyomo ConcreteModel which stores the mathematical formulation of the model.

setOptimalValues(esM, pyM)[source]

Set the optimal values of the components.

Parameters:
  • esM (esM - EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.

  • pyM (pyomo ConcreteModel) – pyomo ConcreteModel which stores the mathematical formulation of the model.

getOptimalValues(name='all', ip=0)[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: string

Parameters:

ip (int) – investment period
* the default value is 0

Returns:

a dictionary with the optimal values of the components

Return type:

dict

Inheritance diagram:

Inheritance diagram of ConversionModel