Source and Sink classes

Sources and sink transfer commodities into and out of the energy system.

Source class description:

class sourceSink.Source(esM, name, commodity, hasCapacityVariable, capacityVariableDomain='continuous', capacityPerPlantUnit=1, hasIsBuiltBinaryVariable=False, bigM=None, operationRateMax=None, operationRateFix=None, tsaWeight=1, commodityLimitID=None, yearlyLimit=None, locationalEligibility=None, capacityMin=None, capacityMax=None, partLoadMin=None, sharedPotentialID=None, linkedQuantityID=None, capacityFix=None, isBuiltFix=None, investPerCapacity=0, investIfBuilt=0, opexPerOperation=0, commodityCost=0, commodityRevenue=0, commodityCostTimeSeries=None, commodityRevenueTimeSeries=None, opexPerCapacity=0, opexIfBuilt=0, QPcostScale=0, interestRate=0.08, economicLifetime=10, technicalLifetime=None, yearlyFullLoadHoursMin=None, yearlyFullLoadHoursMax=None, balanceLimitID=None)[source]

A Source component can transfer a commodity over the energy system boundary into the system.

__init__(esM, name, commodity, hasCapacityVariable, capacityVariableDomain='continuous', capacityPerPlantUnit=1, hasIsBuiltBinaryVariable=False, bigM=None, operationRateMax=None, operationRateFix=None, tsaWeight=1, commodityLimitID=None, yearlyLimit=None, locationalEligibility=None, capacityMin=None, capacityMax=None, partLoadMin=None, sharedPotentialID=None, linkedQuantityID=None, capacityFix=None, isBuiltFix=None, investPerCapacity=0, investIfBuilt=0, opexPerOperation=0, commodityCost=0, commodityRevenue=0, commodityCostTimeSeries=None, commodityRevenueTimeSeries=None, opexPerCapacity=0, opexIfBuilt=0, QPcostScale=0, interestRate=0.08, economicLifetime=10, technicalLifetime=None, yearlyFullLoadHoursMin=None, yearlyFullLoadHoursMax=None, balanceLimitID=None)[source]

Constructor for creating an Source class instance. The Source component specific input arguments are described below. The general component input arguments are described in the Component class. Note: the Sink class inherits from the Source class and is initialized with the same parameter set.

Required arguments:

Parameters:
  • commodity (string) – to the component related commodity.
  • hasCapacityVariable (boolean) –

    specifies if the component should be modeled with a capacity or not. Examples:

    • A wind turbine has a capacity given in GW_electric -> hasCapacityVariable is True.
    • Emitting CO2 into the environment is not per se limited by a capacity -> hasCapaityVariable is False.

Default arguments:

Parameters:
  • operationRateMax (None or Pandas DataFrame with positive (>= 0) entries. The row indices have to match the in the energy system model specified time steps. The column indices have to equal the in the energy system model specified locations. The data in ineligible locations are set to zero.) – if specified, indicates a maximum operation rate for each location and each time step 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 commodityUnit for each time step.
    * the default value is None
  • operationRateFix (None or Pandas DataFrame with positive (>= 0) entries. The row indices have to match the in the energy system model specified time steps. The column indices have to equal the in the energy system model specified locations. The data in ineligible locations are set to zero.) – if specified, indicates a fixed operation rate for each location and each time step 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 commodityUnit for each time step.
    * the default value is None
  • commodityCostTimeSeries (None or Pandas DataFrame with positive (>= 0) entries. The row indices have to match the in the energy system model specified time steps. The column indices have to equal the in the energy system model specified locations. The data in ineligible locations are set to zero.) – if specified, indicates commodity cost rates for each location and each time step by a positive float. The values are given as specific values relative to the commodityUnit for each time step.
    * the default value is None
  • commodityRevenueTimeSeries (None or Pandas DataFrame with positive (>= 0) entries. The row indices have to match the in the energy system model specified time steps. The column indices have to equal the in the energy system model specified locations. The data in ineligible locations are set to zero.) – if specified, indicates commodity revenue rate for each location and each time step by a positive float. The values are given as specific values relative to the commodityUnit 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
  • commodityLimitID (string) – can be specified to limit an annual commodity import/export over the energySystemModel’s boundaries for one or multiple Source/Sink components. If the same ID is used in multiple components, the sum of all imports and exports is considered. If a commoditiyLimitID is specified, the yearlyLimit parameters has to be set as well.
    * the default value is None
  • yearlyLimit (float) –

    if specified, indicates a yearly import/export commodity limit for all components with the same commodityLimitID. If positive, the commodity flow leaving the energySystemModel is limited. If negative, the commodity flow entering the energySystemModel is limited. If a yearlyLimit is specified, the commoditiyLimitID parameters has to be set as well. Examples:

    • CO2 can be emitted in power plants by burning natural gas or coal. The CO2 which goes into the atmosphere over the energy system’s boundaries is modelled as a Sink. CO2 can also be a Source taken directly from the atmosphere (over the energy system’s boundaries) for a methanation process. The commodityUnit for CO2 is tonnes_CO2. Overall, +XY tonnes_CO2 are allowed to be emitted during the year. All Sources/Sinks producing or consuming CO2 over the energy system’s boundaries have the same commodityLimitID and the same yearlyLimit of +XY.
    • The maximum annual import of a certain chemical (commodityUnit tonnes_chem) is limited to XY tonnes_chem. The Source component modeling this import has a commodityLimitID “chemicalComponentLimitID” and a yearlyLimit of -XY.


    * the default value is None

  • opexPerOperation (positive (>=0) float or Pandas Series with positive (>=0) values. The indices of the series have to equal the in the energy system model specified locations.) – 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
  • commodityCost (positive (>=0) float or Pandas Series with positive (>=0) values. The indices of the series have to equal the in the energy system model specified locations.) –

    describes the cost value of one operation´s unit of the component. The cost which is directly proportional to the operation of the component is obtained by multiplying the commodityCost parameter with the annual sum of the time series of the components. The commodityCost 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). Example:

    • In a national energy system, natural gas could be purchased from another country with a certain cost.


    * the default value is 0

  • commodityRevenue (positive (>=0) float or Pandas Series with positive (>=0) values. The indices of the series have to equal the in the energy system model specified locations.) –

    describes the revenue of one operation´s unit of the component. The revenue which is directly proportional to the operation of the component is obtained by multiplying the commodityRevenue parameter with the annual sum of the time series of the components. The commodityRevenue 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). Example:

    • Modeling a PV electricity feed-in tariff for a household


    * the default value is 0

  • balanceLimitID (string) – ID for the respective balance limit (out of the balance limits introduced in the esM). Should be specified if the respective component of the SourceSinkModel is supposed to be included in the balance analysis. If the commodity is transported out of the region, it is counted as a negative, if it is imported into the region it is considered positive.
    * the default value is None
addToEnergySystemModel(esM)[source]

Function for adding a source component to the given energy system model.

Parameters:esM (EnergySystemModel class instance) – EnergySystemModel instance representing the energy system in which the component should be modeled.
setTimeSeriesData(hasTSA)[source]

Function for setting the maximum operation rate, fixed operation rate and cost or revenue time series 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()[source]

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

setAggregatedTimeSeriesData(data)[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 source component

Inheritance diagram:

Inheritance diagram of Source

Sink class description:

class sourceSink.Sink(esM, name, commodity, hasCapacityVariable, capacityVariableDomain='continuous', capacityPerPlantUnit=1, hasIsBuiltBinaryVariable=False, bigM=None, operationRateMax=None, operationRateFix=None, tsaWeight=1, commodityLimitID=None, yearlyLimit=None, locationalEligibility=None, capacityMin=None, capacityMax=None, partLoadMin=None, sharedPotentialID=None, linkedQuantityID=None, capacityFix=None, isBuiltFix=None, investPerCapacity=0, investIfBuilt=0, opexPerOperation=0, commodityCost=0, commodityRevenue=0, commodityCostTimeSeries=None, commodityRevenueTimeSeries=None, opexPerCapacity=0, opexIfBuilt=0, QPcostScale=0, interestRate=0.08, economicLifetime=10, technicalLifetime=None, balanceLimitID=None)[source]

A Sink component can transfer a commodity over the energy system boundary out of the system.

__init__(esM, name, commodity, hasCapacityVariable, capacityVariableDomain='continuous', capacityPerPlantUnit=1, hasIsBuiltBinaryVariable=False, bigM=None, operationRateMax=None, operationRateFix=None, tsaWeight=1, commodityLimitID=None, yearlyLimit=None, locationalEligibility=None, capacityMin=None, capacityMax=None, partLoadMin=None, sharedPotentialID=None, linkedQuantityID=None, capacityFix=None, isBuiltFix=None, investPerCapacity=0, investIfBuilt=0, opexPerOperation=0, commodityCost=0, commodityRevenue=0, commodityCostTimeSeries=None, commodityRevenueTimeSeries=None, opexPerCapacity=0, opexIfBuilt=0, QPcostScale=0, interestRate=0.08, economicLifetime=10, technicalLifetime=None, balanceLimitID=None)[source]

Constructor for creating an Sink class instance.

The Sink class inherits from the Source class. They coincide with the input parameters (see Source class for the parameter description) and differ in the sign parameter, which is equal to -1 for Sink objects and +1 for Source objects.

Inheritance diagram:

Inheritance diagram of Sink

ComponentModel class description:

class sourceSink.SourceSinkModel[source]

A SourceSinkModel class instance will be instantly created if a Source class instance or a Sink class instance is initialized. It is used for the declaration of the sets, variables and constraints which are valid for the Source/Sink class instance. These declarations are necessary for the modeling and optimization of the energy system model. The SourceSinkModel class inherits from the ComponentModel class.

declareYearlyCommodityLimitationDict(pyM)[source]

Declare source/sink components with linked commodity limits and check if the linked components have the same yearly upper limit.

Parameters:pyM (pyomo ConcreteModel) – pyomo ConcreteModel which stores the mathematical formulation of the model.
declareSets(esM, pyM)[source]

Declare sets and dictionaries: design variable sets, operation variable set, operation mode sets and linked commodity limitation 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)[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.
yearlyLimitationConstraint(pyM, esM)[source]

Limit annual commodity imports/exports over the energySystemModel’s boundaries for one or multiple Source/Sink 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.
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.
getSharedPotentialContribution(pyM, key, loc)[source]

Get contributions to shared location potential.

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
getBalanceLimitContribution(esM, pyM, ID, timeSeriesAggregation, loc=None)[source]

Get contribution to balanceLimitConstraint (Further read in EnergySystemModel). Sum of the operation time series of a SourceSink component is used as the balanceLimit contribution: - If component is a Source it contributes with a positive sign to the limit. Example: Electricity Purchase - A Sink contributes with a negative sign. Example: Sale of electricity

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.
  • ID – ID of the regarded balanceLimitConstraint
  • ID – string
  • timeSeriesAggregation (boolean) – states if the optimization of the energy system model should be done with (a) the full time series (False) or (b) clustered time series data (True).
  • loc (string) – Name of the regarded location (locations are defined in the EnergySystemModel instance)
getCommodityBalanceContribution(pyM, commod, loc, p, t)[source]

Get contribution to a commodity balance.

\text{C}^{comp,comm}_{loc,p,t} = - op_{loc,p,t}^{comp,op}  \text{Sink}

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

getObjectiveFunctionContribution(esM, pyM)[source]
Get contribution to the objective function.
param esM:EnergySystemModel instance representing the energy system in which the component should be modeled.
type esM:esM - EnergySystemModel class instance
param pym:pyomo ConcreteModel which stores the mathematical formulation of the model.
type pym:pyomo ConcreteModel
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')[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

Returns:a dictionary with the optimal values of the components
Return type:dict

Inheritance diagram:

Inheritance diagram of SourceSinkModel