fine
¶
Modules:
-
IOManagement– -
aggregations– -
component– -
conversion– -
dictIO– -
energySystemModel– -
enums–Central definitions for string-based FINE options.
-
expansionModules– -
sourceSink– -
storage– -
subclasses– -
transmission– -
utils– -
utilsPWLCF– -
xarrayIO–
Classes:
-
Component–The Component class includes the general methods and arguments for the components which are add-able to
-
ComponentModel–The ComponentModel class provides the general methods used for modeling the components.
-
Conversion–A Conversion component converts commodities into each other.
-
ConversionDynamic–Extension of the conversion class with more specific ramping behavior.
-
ConversionPartLoad–A ConversionPartLoad component maps the (nonlinear) part-load behavior of a Conversion component.
-
EnergySystemModel–EnergySystemModel class.
-
ImplementedSolvers–Implemented solvers.
-
LinearOptimalPowerFlow–A LinearOptimalPowerFlow component shows the behavior of a Transmission component but additionally models a
-
Sink–A Sink component can transfer a commodity over the energy system boundary out of the system.
-
Source–A Source component can transfer a commodity over the energy system boundary into the system.
-
Storage–A Storage component can store a commodity and thus transfers it between time steps.
-
Transmission–A Transmission component can transmit a commodity between locations of the energy system.
Functions:
-
fixBinaryVariables–Search for the optimized binary variables and set them as fixed.
-
getShadowPrices–Get dual values of constraint ("shadow prices").
-
optimizeSimpleMyopic–Optimization function for myopic approach. For each optimization run, the newly installed capacities
-
optimizeTSAmultiStage–Call the optimize function for a temporally aggregated MILP (so the model has to include
-
plotLocationalColorMap–Plot the data of a component for each location.
-
plotLocations–Plot locations from a shape file.
-
plotOperation–Plot operation time series of a component at a location.
-
plotOperationColorMap–Plot operation time series of a component at a location.
-
plotPieChart–Plot pie charts on a map.
-
plotTransmission–Plot build transmission lines from a shape file.
Component
¶
Component(
esM,
name,
dimension,
hasCapacityVariable,
capacityVariableDomain="continuous",
capacityPerPlantUnit=1,
hasIsBuiltBinaryVariable=False,
bigM=None,
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,
opexPerCapacity=0,
opexIfBuilt=0,
QPcostScale=0,
interestRate=0.08,
economicLifetime=10,
technicalLifetime=None,
yearlyFullLoadHoursMin=None,
yearlyFullLoadHoursMax=None,
stockCommissioning=None,
floorTechnicalLifetime=True,
pwlcfParameters=None,
)
The Component class includes the general methods and arguments for the components which are add-able to the energy system model (e.g. storage component, source component, transmission component). Every of these components inherits from the Component class.
Create an instance of the Component class.
Required arguments:
:param esM: energy system model to which the component should be added. Used for unit checks. :type esM: EnergySystemModel instance from the FINE package
:param name: name of the component. Has to be unique (i.e. no other components with that name can already exist in the EnergySystemModel instance to which the component is added). :type name: string
:param hasCapacityVariable: specifies if the component should be modeled with a capacity or not. Examples:
* An electrolyzer has a capacity given in GW_electric -> hasCapacityVariable is True.
* In the energy system, biogas can, from a model perspective, be converted into methane (and then
used in conventional power plants which emit CO2) by getting CO2 from the environment. Thus,
using biogas in conventional power plants is, from a balance perspective, CO2 free. This
conversion is purely theoretical and does not require a capacity -> hasCapacityVariable
is False.
* A electricity cable has a capacity given in GW_electric -> hasCapacityVariable is True.
* If the transmission capacity of a component is unlimited -> hasCapacityVariable is False.
* 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 ->
hasCapacityVariable is False.
:type hasCapacityVariable: boolean
Default arguments:
:param capacityVariableDomain: describes the mathematical domain of the capacity variables, if they are specified. By default, the domain is specified as 'continuous' and thus declares the variables as positive (>=0) real values. The second input option that is available for this parameter is 'discrete', which declares the variables as positive (>=0) integer values. |br| * the default value is 'continuous' :type capacityVariableDomain: string ('continuous' or 'discrete')
:param capacityPerPlantUnit: capacity of one plant of the component (in the specified physicalUnit of the plant). The default is 1, thus the number of plants is equal to the installed capacity. This parameter should be specified when using a 'discrete' capacityVariableDomain. It can be specified when using a 'continuous' variable domain. |br| * the default value is 1 :type capacityPerPlantUnit: dict of strictly positive float or strictly positive float
:param hasIsBuiltBinaryVariable: specifies if binary decision variables should be declared for
* each eligible location of the component, which indicates if the component is built at that location or
not (dimension=1dim).
* each eligible connection of the transmission component, which indicates if the component is built
between two locations or not (dimension=2dim).
The binary variables can be used to enforce one-time investment cost or capacity-independent
annual operation cost. If a minimum capacity is specified and this parameter is set to True,
the minimum capacities are only considered if a component is built (i.e. if a component is built
at that location, it has to be built with a minimum capacity of XY GW, otherwise it is set to 0 GW).
|br| * the default value is False
:type hasIsBuiltBinaryVariable: boolean
:param bigM: the bigM parameter is only required when the hasIsBuiltBinaryVariable parameter is set to True. In that case, it is set as a strictly positive float, otherwise it can remain a None value. If not None and the ifBuiltBinaryVariables parameter is set to True, the parameter enforces an artificial upper bound on the maximum capacities which should, however, never be reached. The value should be chosen as small as possible but as large as necessary so that the optimal values of the designed capacities are well below this value after the optimization. |br| * the default value is None :type bigM: None or strictly positive float
:param locationalEligibility:
* Pandas Series that indicates if a component can be built at a location (=1) or not (=0)
(dimension=1dim) or
* Pandas Series or DataFrame that indicates if a component can be built between two
locations (=1) or not (=0) (dimension=2dim).
If not specified and a maximum or fixed capacity or time series is given, the parameter will be
set based on these inputs. If the parameter is specified, a consistency check is done to ensure
that the parameters indicate the same locational eligibility. If the parameter is not specified,
and also no other of the parameters is specified, it is assumed that the component is eligible in
each location and all values are set to 1.
This parameter is the key part for ensuring small built times of the optimization problem by avoiding the
declaration of unnecessary variables and constraints.
|br| * the default value is None
:type locationalEligibility:
* None or
* Pandas Series with values equal to 0 and 1. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with values equal to 0 and 1. The column and row indices of the DataFrame have
to equal the in the energy system model specified locations.
:param capacityMin: if specified, indicates the minimum capacities. The type of this parameter depends on the dimension of the component: If dimension=1dim, it has to be a Pandas Series. If dimension=2dim, it has to be a Pandas Series or DataFrame. If binary decision variables are declared, capacityMin is only used if the component is built. |br| * the default value is None :type capacityMin:
* None or
* float or
* int or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations. or
* Dict with investment periods as keys and one of the options above as values.
:param capacityMax: if specified, indicates the maximum capacities. The type of this parameter depends on the dimension of the component: If dimension=1dim, it has to be a Pandas Series. If dimension=2dim, it has to be a Pandas Series or DataFrame. |br| * the default value is None :type capacityMax:
* None or
* float or
* int or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations. or
* Dict with investment periods as keys and one of the options above as values.
:param partLoadMin: If specified, it defines the lowest relative operation rate a component must maintain during operation. To still allow the component to be completely turned off, a binary variable is introduced for each time step. This enables the model to choose between zero operation or operation at or above the specified minimum load. Note: Adding these binary variables turns the problem into a MILP, which can significantly increase computational time. |br| * the default value is None :type partLoadMin: * None or * Float value in range ]0;1] * Dict with keys of investment periods and float values in range ]0;1]
:param sharedPotentialID: if specified, indicates that the component has to share its maximum potential capacity with other components (e.g. due to space limitations). The shares of how much of the maximum potential is used have to add up to less than 100%. |br| * the default value is None :type sharedPotentialID: string
:param linkedQuantityID: if specified, indicates that the components with the same ID are built with the same number. (e.g. if a vehicle with an engine is built also a storage needs to be built) |br| * the default value is None :type linkedQuantityID: string
:param capacityFix: if specified, indicates the fixed capacities. The type of this parameter depends on the dimension of the component: * If dimension=1dim, it has to be a Pandas Series. * If dimension=2dim, it has to be a Pandas Series or DataFrame. |br| * the default value is None :type capacityFix: * None or * float or * int or * Pandas Series with positive (>=0) values. The indices of the series have to equal the in the energy system model specified locations (dimension=1dim) or connections between these locations in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or * Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have to equal the in the energy system model specified locations. or * Dict with investment periods as keys and one of the options above as values.
:param commissioningMin: if specified, indicates the minimum commissioning for the respective investment period. The type of this parameter depends on the dimension of the component: * If dimension=1dim, it has to be a Pandas Series. * If dimension=2dim, it has to be a Pandas Series or DataFrame. If binary decision variables are declared, commissioningMin is only used if the component is built. |br| * the default value is None :type commissioningMin:
* None or
* float or
* int or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations. or
* Dict with investment periods as keys and one of the options above as values.
:param commissioningMax: if specified, indicates the maximum commissioning for the respective investment period. The type of this parameter depends on the dimension of the component: * If dimension=1dim, it has to be a Pandas Series. * If dimension=2dim, it has to be a Pandas Series or DataFrame. |br| * the default value is None :type commissioningMax:
* None or
* float or
* int or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations. or
* Dict with investment periods as keys and one of the options above as values.
:param commissioningFix: if specified, indicates the fixed commissioning for the respective investment period. The type of this parameter depends on the dimension of the component: * If dimension=1dim, it has to be a Pandas Series. * If dimension=2dim, it has to be a Pandas Series or DataFrame. |br| * the default value is None :type commissioningFix: * None or * float or * int or * Pandas Series with positive (>=0) values. The indices of the series have to equal the in the energy system model specified locations (dimension=1dim) or connections between these locations in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or * Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have to equal the in the energy system model specified locations. or * Dict with investment periods as keys and one of the options above as values.
:param isBuiltFix: if specified, indicates fixed decisions in which or between which locations the component is built (i.e. sets the isBuilt binary variables). The type of this parameter depends on the dimension of the component: * If dimension=1dim, it has to be a Pandas Series. * If dimension=2dim, it has to be a Pandas Series or DataFrame. |br| * the default value is None :type isBuiltFix: * None or * Pandas Series with values equal to 0 and 1. The indices of the series have to equal the in the energy system model specified locations (dimension=1dim) or connections between these locations in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or * Pandas DataFrame with values equal to 0 and 1. The row and column indices of the DataFrame have to equal the in the energy system model specified locations.
:param investPerCapacity: describes the investment costs for one unit of the capacity. The invest of a component is obtained by multiplying the commissioned capacities of the component (in the physicalUnit of the component) with the investPerCapacity factor and is distributed over the components technical lifetime. The value has to match the unit costUnit/physicalUnit (e.g. Euro/kW). The investPerCapacity can either be given as
* a float or a Pandas Series with location specific values (dimension=1dim). 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 value has to match the unit
costUnit/physicalUnit (e.g. Euro/kW, 1e6 Euro/GW) or
* a float or a Pandas Series or DataFrame with location specific values (dimension=2dim). The cost unit
in which the parameter is given has to match the one specified in the energy system model divided by
the specified lengthUnit (e.g. Euro/m, Dollar/m, 1e6 Euro/km). The value has to match the unit
costUnit/(lengthUnit * physicalUnit) (e.g. Euro/(kW * m), 1e6 Euro/(GW * km))
* a dictionary with years as keys (past years which had stock commissioning and investment periods which
will be optimized) and one of the two options above as values.
e.g. {2020: 1000, 2025: 800, 2030: 750}
|br| * the default value is 0
:type investPerCapacity:
* None or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations.
* Dict with years as keys (past years with stock commissioning and investment periods which will be
optimized) and one of the two options above as values.
:param investIfBuilt: a capacity-independent invest which only arises in a location if a component is built at that location. The investIfBuilt can either be given as
* a float or a Pandas Series with location specific values (dimension=1dim). 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) or
* a float or a Pandas Series or DataFrame with location specific values (dimension=2dim). The cost unit
in which the parameter is given has to match the one specified in the energy system model divided by
the specified lengthUnit (e.g. Euro/m, Dollar/m, 1e6 Euro/km)
* a dictionary with years as keys (past years which had stock commissioning and investment periods which
will be optimized) and one of the two options above as values.
e.g. {2020: 1000, 2025: 800, 2030: 750}
|br| * the default value is 0
:type investIfBuilt:
* None or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations.
* Dict with years as keys (past years with stock commissioning and investment periods which will be
optimized) and one of the two options above as values.
:param opexPerCapacity: describes the operational cost for one unit of capacity. The annual operational cost, which are only a function of the capacity of the component (in the physicalUnit of the component) and not of the specific operation itself, are obtained by multiplying the commissioned capacity of the component at a location with the opexPerCapacity factor and is distributed over the components technical lifetime. The opexPerCapacity factor can either be given as
* a float or a Pandas Series with location specific values (dimension=1dim). 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 value has to match the unit
costUnit/physicalUnit (e.g. Euro/kW, 1e6 Euro/GW) or
* a float or a Pandas Series or DataFrame with location specific values (dimension=2dim). The cost unit
in which the parameter is given has to match the one specified in the energy system model divided by
the specified lengthUnit (e.g. Euro/m, Dollar/m, 1e6 Euro/km). The value has to match the unit
costUnit/(lengthUnit * physicalUnit) (e.g. Euro/(kW * m), 1e6 Euro/(GW * km))
* a dict with years as keys (past years which had stock commissioning and investment periods which
will be optimized) and one of the two options above as value.
e.g. {2020: 1000, 2025: 800, 2030: 750}
|br| * the default value is 0
:type opexPerCapacity:
* None or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations.
* Dict with years as keys (past years with stock commissioning and investment periods which will be
optimized) and one of the two options above as values.
:param opexIfBuilt: a capacity-independent annual operational cost which only arises in a location if a component is commissioned at that location. The costs are than distributed over the components technical lifetime.The opexIfBuilt can either be given as
* a float or a Pandas Series with location specific values (dimension=1dim) . 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) or
* a float or a Pandas Series or DataFrame with location specific values (dimension=2dim). The cost unit
in which the parameter is given has to match the one specified in the energy system model divided by
the specified lengthUnit (e.g. Euro/m, Dollar/m, 1e6 Euro/km).
* a dict with years as keys (past years which had stock commissioning and investment periods which
will be optimized) and one of the two options above as value.
e.g. {2020: 1000, 2025: 800, 2030: 750}
|br| * the default value is 0
:type opexIfBuilt:
* None or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations.
* Dict with years as keys (past years with stock commissioning and investment periods which will be
optimized) and one of the two options above as values.
:param QPcostScale: describes the absolute deviation of the minimum or maximum cost value from the average or weighted average cost value. For further information see Lopion et al. (2019): "Cost Uncertainties in Energy System Optimization Models: A Quadratic Programming Approach for Avoiding Penny Switching Effects". |br| * the default value is 0, i.e. the problem is not quadratic. :type QPcostScale:
* float between 0 and 1
* Pandas Series with positive (0 <= QPcostScale <= 1) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (0 <= QPcostScale <= 1) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations.
* Dict with years as keys (past years with stock commissioning and investment period which will be
optimized) and one of the options above as value
:param interestRate: interest rate which is considered for computing the annuities of the invest of the component (depreciates the invests over the economic lifetime). A value of 0.08 corresponds to an interest rate of 8%. The interest rate is currently constant for all investment periods. Warning: The interest must be greater than 0 if annuityPerpetuity is used in the energy system model. |br| * the default value is 0.08 :type interestRate:
* None or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations.
:param economicLifetime: economic lifetime of the component which is considered for computing the annuities of the invest of the component (aka depreciation time). The economic lifetime is currently constant over the pathway of investment periods. |br| * the default value is 10 :type economicLifetime:
* None or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations.
:param technicalLifetime: technical lifetime of the component which is considered for computing the stocks. The technical lifetime is currently constant over the pathway of investment periods. |br| * the default value is None :type technicalLifetime:
* None or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim) or
* Pandas DataFrame with positive (>=0) values. The row and column indices of the DataFrame have
to equal the in the energy system model specified locations.
:param yearlyFullLoadHoursMin: if specified, indicates the minimum yearly full load hours. |br| * the default value is None :type yearlyFullLoadHoursMin:
* None or
* Float with positive (>=0) value or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim).
* Dict with years as keys and one of the two options above as values.
:param yearlyFullLoadHoursMax: if specified, indicates the maximum yearly full load hours. |br| * the default value is None :type yearlyFullLoadHoursMax:
* None or
* Float with positive (>=0) value or
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the
energy system model specified locations (dimension=1dim) or connections between these locations
in the format of 'loc1' + '_' + 'loc2' (dimension=2dim).
* Dict with years as keys and one of the two options above as values.
:param stockCommissioning: if specified, indictates historical commissioned capacities. The parameter describes, how much capacity was commissioned per location in which past investment period. The past investment period is not part of the optimized investment periods.
* e.g. if startYear is 2020:
{2016:pandas.series(index=["loc1","loc2"],data=[4,3]).
2018: pandas.series(index=["loc1","loc2"],data=[1,2])}
* e.g. if startYear is 0:
{-4:pandas.series(index=["loc1","loc2"],data=[4,3]).
-2: pandas.series(index=["loc1","loc2"],data=[1,2])}
Warning: Commissioning years older than the technical lifetime from startYear will be ignored.
|br| * the default value is None
:type stockCommissioning:
* None or
* Dict with past years as keys and pandas.Series with index of locations as values
:param modelingClass: to the Component connected modeling class. |br| * the default value is ModelingClass :type modelingClass: a class inheriting from ComponentModeling
:param floorTechnicalLifetime: if a technical lifetime is not a multiple of the interval, this parameters decides if the technical lifetime is floored to the interval or ceiled to the next interval, by default True. The costs will then be applied to the corrected interval.
:param pwlcfParameters: parameters used for piecewise linear cost function module. Can be used to approximate non-linear cost functions for endogenous technology learning (etl) or economies of scale (eos). Enables a standardized endogenous technological learning approach with a fixed learning rate. In that case, the learning is conducted in each investment period and connected throughout. Alternatively enables an economies of scale approach. In that case, the cost scaling is indepent in each investment period.
Example: For etl, the cost reduce with the total cumulative installed capacity via a learning curve approach which is linearized.
pwlcfParameters = {
"etlParameters": {
"initCost": 1,
"learningRate": 0.18,
"initCapacity": 10,
"maxCapacity": 50,
"noSegments": 4,
}
Example: For eos, the cost of a specific component (at one location and in one investment period) decreases with increased plant size.
pwlcfParameters = {
"eosParameters": pd.DataFrame(data=np.array([[0,1,2,3],[0,1000, 1800, 2400],[0, 10, 18, 24]]).T, columns=["capacity", "totalInvest", "totalOpex"])
}
:type pwlcfParameters: dict
Methods:
-
addToEnergySystemModel–Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in
-
getDataForTimeSeriesAggregation–Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises). Get
-
getTSAOutput–Return a reformatted time series data after applying time series aggregation, if the original time series
-
prepareTSAInput–Format the time series data of a component to fit the requirements of the time series aggregation package and
-
setAggregatedTimeSeriesData–Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises). Set
-
setTimeSeriesData–Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises). Sets
Source code in fine/component.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | |
addToEnergySystemModel
¶
Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in the esM, it is added as well.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
Source code in fine/component.py
getDataForTimeSeriesAggregation
abstractmethod
¶
Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises). Get all time series data of a component for time series aggregation.
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/component.py
getTSAOutput
¶
Return a reformatted time series data after applying time series aggregation, if the original time series data is not None.
:param rate: Full (unclustered) time series data or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param data: Pandas DataFrame with the clustered time series data of all components in the energy system :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
:return: reformatted data or None :rtype: Pandas DataFrame
Source code in fine/component.py
prepareTSAInput
¶
Format the time series data of a component to fit the requirements of the time series aggregation package and return a list of formatted data.
:param rate: a fixed/maximum/minimum operation time series or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param rateWeight: weight of the time series in the clustering process :type rateWeight: positive float (>=0)
:param weightDict: dictionary to which the weight is added :type weightDict: dict
:param data: list to which the formatted data is added :type data: list of Pandas DataFrames
:param ip: investment period of transformation path analysis. :type ip: int
:return: data :rtype: Pandas DataFrame
Source code in fine/component.py
setAggregatedTimeSeriesData
abstractmethod
¶
Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises). Set aggregated time series data after applying time series aggregation.
:param data: time series data :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/component.py
setTimeSeriesData
abstractmethod
¶
Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises). Sets the time series data of a component (either the full time series if hasTSA is false or the aggregated time series if hasTSA is True).
:param hasTSA: indicates if time series aggregation should be considered for modeling :type hasTSA: boolean
Source code in fine/component.py
ComponentModel
¶
The ComponentModel class provides the general methods used for modeling the components. Every model class of the several component technologies inherits from the ComponentModel class. Within the ComponentModel class, general valid sets, variables and constraints are declared.
Create a ComponentModel class instance.
Methods:
-
additionalMinPartLoad–Set, if applicable, the minimal part load of a component.
-
bigM–Enforce the consideration of the binary design variables of a component.
-
binaryOperation–Create binary operation constraints for component operation.
-
capToNbInt–Determine the components' capacities from the number of installed units.
-
capToNbReal–Determine the components' capacities from the number of installed units.
-
capacityMinDec–Enforce the consideration of minimum capacities for components with design decision variables.
-
declareBinOpVarSet–Declare binary operation variables.
-
declareBinaryDesignDecisionVars–Declare binary variables [-] indicating if a component is considered at a location or not [-].
-
declareCapacityVars–Declare capacity variables.
-
declareCommissioningVarSet–Declare set for commissioning variables in the pyomo object for a modeling class.
-
declareCommissioningVars–Declare commissioning variable for capacity development of component.
-
declareComponentConstraints–Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises).
-
declareContinuousDesignVarSet–Declare set for continuous number of installed components in the pyomo object for a modeling class.
-
declareDecommissioningVars–Declare decommissioning variable for capacity development of component.
-
declareDesignDecisionVarSet–Declare set for design decision variables in the pyomo object for a modeling class.
-
declareDesignVarSet–Declare set for capacity variables in the pyomo object for a modeling class.
-
declareDiscreteDesignVarSet–Declare set for discrete number of installed components in the pyomo object for a modeling class.
-
declareIntNumbersVars–Declare variables representing the (discrete/integer) number of installed components [-].
-
declareLocationComponentSet–Declare set with location and component in the pyomo object for a modeling class.
-
declareOpConstrSet1–Declare set of locations and components for which hasCapacityVariable is set to True and neither the
-
declareOpConstrSet2–Declare set of locations and components for which hasCapacityVariable is set to True and a fixed
-
declareOpConstrSet3–Declare set of locations and components for which hasCapacityVariable is set to True and a maximum
-
declareOpConstrSet4–Declare set of locations and components for which hasCapacityVariable is set to True and a minimum
-
declareOpConstrSetMinPartLoad–Declare set of locations and components for which partLoadMin is not None.
-
declareOpVarSet–Declare operation related sets (operation variables and mapping sets) in the pyomo object for a
-
declareOperationBinaryVars–Declare binary operation variables.
-
declareOperationModeSets–Declare operating mode sets.
-
declareOperationVars–Declare operation variables.
-
declarePathwaySets–Declare set for capacity development in the pyomo object for a modeling class.
-
declareRealNumbersVars–Declare variables representing the (continuous) number of installed components [-].
-
declareSets–Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises).
-
declareVariables–Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises).
-
declareYearlyFullLoadHoursMaxSet–Declare set of locations and components for which maximum yearly full load hours are given.
-
declareYearlyFullLoadHoursMinSet–Declare set of locations and components for which minimum yearly full load hours are given.
-
decommissioningConstraint–Declase the decommissioning after the technical lifetime from investment
-
designBinFix–Set, if applicable, the installed capacities of a component.
-
designDevelopmentConstraint–Link the capacity development between investment periods.
-
getCommodityBalanceContribution–Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises).
-
getEconomicsDesign–Set design dependent cost equations for the individual components. The equations will be set
-
getEconomicsOperation–Set time-dependent equations for the individual components. The equations will be set for all components of a modeling class
-
getLocEconomicsDesign–Set time-independent equation specified for one component in one location in one investment period.
-
getLocEconomicsOperation–Set time-dependent cost functions for the individual components. The equations will be set for all components
-
getObjectiveFunctionContribution–Get contribution to the objective function.
-
getOptimalValues–Return optimal values of the components.
-
getSharedPotentialContribution–Get the share which the components of the modeling class have on a shared maximum potential at a location.
-
hasOpVariablesForLocationCommodity–Check if operation variables exist in the modeling class at a location which are connected to a commodity.
-
operationMode1–Define operation mode 1. The operation [commodityUnit*h] is limited by the installed capacity in:\n
-
operationMode2–Define operation mode 2.
-
operationMode3–Define operation mode 3.
-
operationMode4–Define operation mode 4.
-
setOptimalValues–Set the optimal values for the considered components and return a summary of them.
-
stockCapacityConstraint–Set the stock capacity constraint. The stock capacity is the sum of the stock
-
stockCommissioningConstraint–Set commissioning variable for past investment periods. For past investment periods,
-
yearlyFullLoadHoursMax–Limit the annual full load hours to a maximum value.
-
yearlyFullLoadHoursMin–Limit the annual full load hours to a minimum value.
Source code in fine/component.py
additionalMinPartLoad
¶
additionalMinPartLoad(
pyM,
esM,
constrName,
constrSetName,
opVarName,
opVarBinName,
capVarName,
isOperationCommisYearDepending=False,
)
Set, if applicable, the minimal part load of a component.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 | |
bigM
¶
Enforce the consideration of the binary design variables of a component.
.. math::
\\text{M}^{comp} \\cdot bin^{comp}_{loc,ip} \\geq commis^{comp}_{loc,ip}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
binaryOperation
¶
binaryOperation(
pyM,
constrName,
constrSetName,
binaryParameterName,
opVarName,
opVarBinName,
isOperationCommisYearDepending=False,
)
Create binary operation constraints for component operation.
Defines two constraints linking a continuous operation variable to its corresponding binary variable using the Big-M formulation. Handles both standard and commissioning year-dependent cases.
The binaryOperation1 constraint is used to force the binary variable to one if the continuous variable is greater than zero.
The binaryOperation2 constraint ensures that the continuous variable is greater than zero whenever the binary variable is one. This is used for the upTimeMin and downTimeMin feature.
Source code in fine/component.py
2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 | |
capToNbInt
¶
Determine the components' capacities from the number of installed units.
.. math::
cap^{comp}_{loc} = \\text{capPerUnit}^{comp} \\cdot nbInt^{comp}_{loc}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
capToNbReal
¶
Determine the components' capacities from the number of installed units.
.. math::
cap^{comp}_{loc} = \\text{capPerUnit}^{comp} \\cdot nbReal^{comp}_{loc}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
capacityMinDec
¶
Enforce the consideration of minimum capacities for components with design decision variables.
Minimal capacity which needs to be reached for every investment period with commissioning. As the commisBinVar is coupled with commissioning var, constraint only sets minimal Capacity if component is commissioned. Therefore decommissioning of the component is possible without any constraints.
.. math::
\\text{capMin}^{comp}_{loc} \\cdot commisBin^{comp}_{loc,ip} \\leq cap^{comp}_{loc,ip}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
declareBinOpVarSet
¶
declareBinOpVarSet(
esM,
pyM,
binaryOperationParameter=["partLoadMin"],
binaryOperationSetName="operationBinVarSet",
)
Declare binary operation variables.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
declareBinaryDesignDecisionVars
¶
Declare binary variables [-] indicating if a component is considered at a location or not [-].
If a isBuiltFix parameter is given, the bounds are set to enforce
.. math:: bin^{comp}{loc} = \text{binFix}^{comp}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 | |
declareCapacityVars
¶
Declare capacity variables.
.. math::
\\text{capMin}^{comp}_{loc} \\leq cap^{comp}_{loc} \\leq \\text{capMax}^{comp}_{loc}
If a capacityFix parameter is given, the bounds are set to enforce
.. math:: \text{cap}^{comp}{loc} = \text{capFix}^{comp}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
declareCommissioningVarSet
¶
Declare set for commissioning variables in the pyomo object for a modeling class.
The commissioning variable must be set for past investment periods (stock commissioning) and future/optimized investment periods
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
declareCommissioningVars
¶
Declare commissioning variable for capacity development of component.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
declareComponentConstraints
abstractmethod
¶
Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises). Declare constraints of components in the componentModel class.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
declareContinuousDesignVarSet
¶
Declare set for continuous number of installed components in the pyomo object for a modeling class.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
declareDecommissioningVars
¶
Declare decommissioning variable for capacity development of component.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
declareDesignDecisionVarSet
¶
Declare set for design decision variables in the pyomo object for a modeling class.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
declareDesignVarSet
¶
Declare set for capacity variables in the pyomo object for a modeling class.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
declareDiscreteDesignVarSet
¶
Declare set for discrete number of installed components in the pyomo object for a modeling class.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
declareIntNumbersVars
¶
Declare variables representing the (discrete/integer) number of installed components [-].
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
declareLocationComponentSet
¶
Declare set with location and component in the pyomo object for a modeling class.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
declareOpConstrSet1
¶
Declare set of locations and components for which hasCapacityVariable is set to True and neither the maximum nor the fixed operation rate is given.
Source code in fine/component.py
declareOpConstrSet2
¶
Declare set of locations and components for which hasCapacityVariable is set to True and a fixed operation rate is given.
Source code in fine/component.py
declareOpConstrSet3
¶
Declare set of locations and components for which hasCapacityVariable is set to True and a maximum operation rate is given.
Source code in fine/component.py
declareOpConstrSet4
¶
Declare set of locations and components for which hasCapacityVariable is set to True and a minimum operation rate is given.
Source code in fine/component.py
declareOpConstrSetMinPartLoad
¶
Declare set of locations and components for which partLoadMin is not None.
Source code in fine/component.py
declareOpVarSet
¶
Declare operation related sets (operation variables and mapping sets) in the pyomo object for a modeling class.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 | |
declareOperationBinaryVars
¶
Declare binary operation variables.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
declareOperationModeSets
¶
Declare operating mode sets.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param constrSetName: name of the constraint set. :type constrSetName: string
:param rateMax: attribute of the considered component which stores the maximum operation rate data. :type rateMax: string
:param rateMax: attribute of the considered component which stores the minimum operation rate data. :type rateMax: string
:param rateFix: attribute of the considered component which stores the fixed operation rate data. :type rateFix: string
Source code in fine/component.py
declareOperationVars
¶
declareOperationVars(
pyM,
esM,
opVarName,
opRateFixName="processedOperationRateFix",
opRateMaxName="processedOperationRateMax",
isOperationCommisYearDepending=False,
flexibleConversion=False,
relevanceThreshold=None,
)
Declare operation variables.
The following operation modes are directly handled during variable creation as bounds instead of constraints.
operation mode 4: If operationRateFix is given for components without a capacity variable, the variables are fixed with operationRateFix, i.e. the operation [commodityUnit*h] is equal to a time series.
.. math:: op^{comp,opType}{loc,p,t} = \text{opRateFix}^{comp,opType}
operation mode 5: If operationRateMax is given for components without a capacity variable, the variables are bounded by operationRateMax, i.e. the operation [commodityUnit*h] is limited by a time series.
.. math:: op^{comp,opType}{loc,p,t} \leq \text{opRateMax}^{comp,opType}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param relevanceThreshold: Force operation parameters to be 0 if values are below the relevance threshold. |br| * the default value is None :type relevanceThreshold: float (>=0) or None
:param isOperationCommisYearDepending: defines whether the operation variable is depending on the year of commissioning of the component. E.g. relevant if the commodity conversion, for example the efficiency, varies over the transformation pathway :type isOperationCommisYearDepending: str
Source code in fine/component.py
1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 | |
declarePathwaySets
¶
Declare set for capacity development in the pyomo object for a modeling class.
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
declareRealNumbersVars
¶
Declare variables representing the (continuous) number of installed components [-].
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
declareSets
abstractmethod
¶
Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises). Declare sets of components and constraints in the componentModel class.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
declareVariables
abstractmethod
¶
Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises). Declare variables of components in the componentModel class.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param relevanceThreshold: Force operation parameters to be 0 if values are below the relevance threshold. |br| * the default value is None :type relevanceThreshold: float (>=0) or None
Source code in fine/component.py
declareYearlyFullLoadHoursMaxSet
¶
Declare set of locations and components for which maximum yearly full load hours are given.
Source code in fine/component.py
declareYearlyFullLoadHoursMinSet
¶
Declare set of locations and components for which minimum yearly full load hours are given.
Source code in fine/component.py
decommissioningConstraint
¶
Declase the decommissioning after the technical lifetime from investment period of commissioning.
.. math::
decommis^{comp}_{loc,ip} = commis^{comp}_{loc,ip-\\mathrm{ipTechnicalLifetime}}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
designBinFix
¶
Set, if applicable, the installed capacities of a component.
.. math::
bin^{comp}_{(loc_1,loc_2),ip} = \\text{binFix}^{comp}_{(loc_1,loc_2)}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
designDevelopmentConstraint
¶
Link the capacity development between investment periods.
For stochastic: The capacity design must be equal between the different years.
.. math::
cap^{comp}_{loc,ip+1} = cap^{comp}_{loc,ip}
For the development pathway, the capacity of an investment period is composed of the capacity of the previous investment periods and the commissioning and decommissioning in the current investment period.
.. math::
cap^{comp}_{loc,ip+1} = cap^{comp}_{loc,ip} + commis^{comp}_{loc,ip} - decommis^{comp}_{loc,ip}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 | |
getCommodityBalanceContribution
abstractmethod
¶
Abstract method which has to be implemented by subclasses (otherwise a NotImplementedError raises). Get contribution to a commodity balance.
Source code in fine/component.py
getEconomicsDesign
¶
getEconomicsDesign(
pyM,
esM,
factorNames,
lifetimeAttr,
varName,
divisorName="",
QPfactorNames=[],
QPdivisorNames=[],
getOptValue=False,
getOptValueCostType=TAC,
)
Set design dependent cost equations for the individual components. The equations will be set for all components of a modeling class and all locations.
Required arguments
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
:param factorNames: Strings of the parameters that have to be multiplied within the equation. (e.g. ['processedInvestPerCapacity'] to multiply the capacity variable with the investment per each capacity unit). :type factorNames: list of strings
:param varName: String of the variable that has to be multiplied within the equation (e.g. 'cap' for capacity variable). :type varName: string
:param divisorName: String of the variable that is used as a divisor within the equation (e.g. 'CCF'). If the divisorName is an empty string, there is no division within the equation. |br| * the default value is "". :type divisorName: string
:param QPfactorNames: Strings of the parameters that have to be multiplied when quadratic programming is used. (e.g. ['processedQPcostScale']) :type QPfactorNames: list of strings
:param QPdivisorNames: Strings of the parameters that have to be used as divisors when quadratic programming is used. (e.g. ['QPbound']) :type QPdivisorNames: list of strings
:param getOptValue: Boolean that defines the output of the function:
- True: Return the optimal cost values.
- False: Return the cost equation.
|br| * the default value is False.
:type getoptValue: boolean
:param getOptValueCostType: the cost type can either be TAC (total anualized costs) or NPV (net present value) |br| * the default value is None. :type getOptValueCostType: string
Source code in fine/component.py
3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 | |
getEconomicsOperation
¶
getEconomicsOperation(
pyM,
esM,
fncType,
factorNames,
varName,
dictName,
getOptValue=False,
getOptValueCostType=TAC,
)
Set time-dependent equations for the individual components. The equations will be set for all components of a modeling class and all locations as well as for each considered time step. In case of a two-dimensional component (e.g. a transmission component), the equations will be set for all possible connections between the defined locations.
Required arguments:
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: EnergySystemModel instance representing the energy system in which the components should be modeled. :type esM: esM - EnergySystemModel class instance
:param fncType: Function type, either "TD" or "TimeSeries" :type fncType: string
:param factorNames: Strings of the time-dependent parameters that have to be multiplied within the equation. (e.g. ['opexPerOperation'] to multiply the operation variable with the costs for each operation). :type factorNames: list of strings
:param varName: String of the variable that has to be multiplied within the equation (e.g. 'op' for operation variable). :type varName: string
:param dictName: String of the variable set (e.g. 'operationVarDict') :type dictName: string
Default arguments:
:param getOptValue: Boolean that defines the output of the function:
- True: Return the optimal value.
- False: Return the equation.
|br| * the default value is False.
:type getoptValue: boolean
:param getOptValueCostType: the cost type can either be TAC (total annualized costs) or NPV (net present value) |br| * the default value is None. :type getOptValueCostType: string
Source code in fine/component.py
3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 | |
getLocEconomicsDesign
¶
getLocEconomicsDesign(
pyM,
esM,
factorNames,
varName,
loc,
compName,
ip,
divisorName="",
QPfactorNames=[],
QPdivisorNames=[],
getOptValue=False,
)
Set time-independent equation specified for one component in one location in one investment period.
Required arguments:
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
:param factorNames: Strings of the parameters that have to be multiplied within the equation. (e.g. ['processedInvestPerCapacity'] to multiply the capacity variable with the investment per each capacity unit). :type factorNames: list of strings
:param varName: String of the variable that has to be multiplied within the equation (e.g. 'cap' for capacity variable). :type varName: string
:param loc: String of the location for which the equation should be set up. :type loc: string
:param compName: String of the component name for which the equation should be set up. :type compName: string
Default arguments:
:param ip: investment period :type ip: int
:param divisorName: String of the variable that is used as a divisor within the equation (e.g. 'CCF'). If the divisorName is an empty string, there is no division within the equation. |br| * the default value is ''. :type divisorName: string
:param QPfactorNames: Strings of the parameters that have to be multiplied when quadratic programming is used. (e.g. ['processedQPcostScale']) :type QPfactorNames: list of strings
:param QPdivisorNames: Strings of the parameters that have to be used as divisors when quadratic programming is used. (e.g. ['QPbound']) :type QPdivisorNames: list of strings
:param getOptValue: Boolean that defines the output of the function:
- True: Return the optimal value.
- False: Return the equation.
|br| * the default value is False.
:type getoptValue: boolean
Source code in fine/component.py
3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 | |
getLocEconomicsOperation
¶
getLocEconomicsOperation(
pyM,
esM,
fncType,
factorNames,
varName,
loc,
compName,
ip,
getOptValue=False,
)
Set time-dependent cost functions for the individual components. The equations will be set for all components of a modeling class and all locations as well as for each considered time step.
Required arguments:
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: EnergySystemModel instance representing the energy system in which the components should be modeled. :type esM: esM - EnergySystemModel class instance
:param fncType: Function type, either "TD" or "TimeSeries :type fncType: string
:param factorName: String of the time-dependent parameter that have to be multiplied within the equation. (e.g. 'commodityCostTimeSeries' to multiply the operation variable with the costs for each operation). :type factorNames: string
:param varName: String of the variable that has to be multiplied within the equation (e.g. 'op' for operation variable). :type varName: string
:param dictName: String of the variable set (e.g. 'operationVarDict') :type dictName: string
:param loc: String of the location for which the equation should be set up. :type loc: string
:param compName: String of the component name for which the equation should be set up. :type compName: string
:param ip: investment period of transformation path analysis. :type ip: int
Default arguments:
:param getOptValue: Boolean that defines the output of the function:
- True: Return the optimal value.
- False: Return the equation.
|br| * the default value is False.
:type getoptValue: boolean
Source code in fine/component.py
3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 | |
getObjectiveFunctionContribution
¶
Get contribution to the objective function.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
Source code in fine/component.py
getOptimalValues
¶
Return optimal values of the components.
:param name: name of the variables of which the optimal values should be returned:
* 'capacityVariablesOptimum',
* 'isBuiltVariablesOptimum',
* 'operationVariablesOptimum',
* 'commissioningVariablesOptimum'
* 'decommissioningVariablesOptimum'
* 'all' or another input: all variables are returned.
:type name: string
:param ip: investment period of transformation path analysis. |br| * the default value is 0 :type ip: int
:returns: a dictionary with the optimal values of the components :rtype: dict
Source code in fine/component.py
getSharedPotentialContribution
¶
Get the share which the components of the modeling class have on a shared maximum potential at a location.
Source code in fine/component.py
hasOpVariablesForLocationCommodity
abstractmethod
¶
Check if operation variables exist in the modeling class at a location which are connected to a commodity.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: esM - EnergySystemModel class instance
:param loc: name of the regarded location (locations are defined in the EnergySystemModel instance) :type loc: string
:param commod: name of the regarded commodity (commodities are defined in the EnergySystemModel instance) :param commod: string
Source code in fine/component.py
operationMode1
¶
operationMode1(
pyM,
esM,
constrName,
constrSetName,
opVarName,
factorName=None,
*,
isOperationCommisYearDepending=False,
)
Define operation mode 1. The operation [commodityUnith] is limited by the installed capacity in:\n * [commodityUnith] (for storages) or in * [commodityUnit] multiplied by the hours per time step (else).\n An additional factor can limited the operation further.
.. math::
op^{comp,opType}_{loc,ip,p,t} \\leq \\tau^{hours} \\cdot \\text{opFactor}^{opType} \\cdot cap^{comp}_{loc,ip}
Source code in fine/component.py
2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 | |
operationMode2
¶
operationMode2(
pyM,
esM,
constrName,
constrSetName,
opVarName,
opRateName="processedOperationRateFix",
*,
isOperationCommisYearDepending=False,
)
Define operation mode 2.
The operation [commodityUnith] is equal to the installed capacity multiplied with a time series in:\n * [commodityUnith] (for storages) or in * [commodityUnit] multiplied by the hours per time step (else).\n
.. math::
op^{comp,opType}_{loc,ip,p,t} \\leq \\tau^{hours} \\cdot \\text{opRateMax}^{comp,opType}_{loc,ip,p,t} \\cdot cap^{comp}_{loc,ip}
Source code in fine/component.py
2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 | |
operationMode3
¶
operationMode3(
pyM,
esM,
constrName,
constrSetName,
opVarName,
opRateName="processedOperationRateMax",
*,
isOperationCommisYearDepending=False,
relevanceThreshold=None,
)
Define operation mode 3.
The operation [commodityUnith] is limited by an installed capacity multiplied with a time series in:\n * [commodityUnith] (for storages) or in * [commodityUnit] multiplied by the hours per time step (else).\n
.. math:: op^{comp,opType}{loc,ip,p,t} = \tau^{hours} \cdot \text{opRateFix}^{comp,opType}} \cdot cap^{comp}_{loc,ip
:param relevanceThreshold: Force operation parameters to be 0 if values are below the relevance threshold. |br| * the default value is None :type relevanceThreshold: float (>=0) or None
Source code in fine/component.py
2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 | |
operationMode4
¶
operationMode4(
pyM,
esM,
constrName,
constrSetName,
opVarName,
opRateName="processedOperationRateMin",
*,
isOperationCommisYearDepending=False,
relevanceThreshold=None,
)
Define operation mode 4.
The operation [commodityUnith] is limited by an installed capacity multiplied with a time series in:\n * [commodityUnith] (for storages) or in * [commodityUnit] multiplied by the hours per time step (else).\n
.. math:: op^{comp,opType}{loc,ip,p,t} = \tau^{hours} \cdot \text{opRateFix}^{comp,opType}} \cdot cap^{comp}_{loc,ip
:param relevanceThreshold: Force operation parameters to be 0 if values are below the relevance threshold. |br| * the default value is None :type relevanceThreshold: float (>=0) or None
Source code in fine/component.py
2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 | |
setOptimalValues
¶
Set the optimal values for the considered components and return a summary of them. The function is called after optimization was successful and an optimal solution was found. Each sub class of the component class calls this function for setting the common optimal values, e.g. investment and maintenance costs proportional to optimal capacity expansion.
Required arguments
:param esM: EnergySystemModel instance representing the energy system in which the components are modeled. :type esM: EnergySystemModel instance
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param ip: investment period of transformation path analysis. :type ip: int
:param indexColumns: set of strings with the columns indices of the summary. The indices represent the locations or connections between the locations are used to call the optimal values of the variables of the components in the model class. :type indexColumns: set
:param plantUnit: attribute of the component that describes the unit of the plants to which maximum capacity limitations, cost parameters and the operation time series refer to. Depending on the considered component, possible inputs are "commodityUnit" (e.g. for transmission components) or "physicalUnit" (e.g. for conversion components). :type plantUnit: string
Default arguments
:param unitApp: string which appends the capacity unit in the optimization summary. For example, for the StorageModel class, the parameter is set to '\*h'. |br| * the default value is ''. :type unitApp: string
:return: summary of the optimized values. :rtype: pandas DataFrame
Source code in fine/component.py
3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 | |
stockCapacityConstraint
¶
Set the stock capacity constraint. The stock capacity is the sum of the stock commissioning, which do not exceed its technical lifetime.
For stochastic, the stock of past investment periods is not only valid for ip=0 but for all investment periods. .. math::
cap^{comp}_{loc,ip} = stockCap^{comp}_{loc} + commis^{comp}_{loc,ip} - decommis^{comp}_{loc,0}
For capacity development, the stock is only considered for the first investment periods.
.. math::
cap^{comp}_{loc,0} = stockCap^{comp}_{loc} + commis^{comp}_{loc,0} - decommis^{comp}_{loc,0}
:param pyM: pyomo ConcreteModel which stores the mathematical formulation of the model. :type pyM: pyomo ConcreteModel
:param esM: energy system model containing general information. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/component.py
stockCommissioningConstraint
¶
Set commissioning variable for past investment periods. For past investment periods, where no stock commissioning is specified the commissioning variable is set to zero.
Source code in fine/component.py
yearlyFullLoadHoursMax
¶
yearlyFullLoadHoursMax(
pyM,
esM,
constrSetName,
constrName,
opVarName,
isOperationCommisYearDepending=False,
)
Limit the annual full load hours to a maximum value.
: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
:param constrName: name for the constraint in esM.pyM :type constrName: str
:param constrSetName: name of the constraint set :type constrSetName: str
:param opVarName: name of the operation variables :type opVarName: str
:param isOperationCommisYearDepending: defines whether the operation variable is depending on the year of commissioning of the component. E.g. relevant if the commodity conversion, for example the efficiency, varies over the transformation pathway :type isOperationCommisYearDepending: str
Source code in fine/component.py
2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 | |
yearlyFullLoadHoursMin
¶
yearlyFullLoadHoursMin(
pyM,
esM,
constrSetName,
constrName,
opVarName,
isOperationCommisYearDepending=False,
)
Limit the annual full load hours to a minimum value.
: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
:param constrName: name for the constraint in esM.pyM :type constrName: str
:param constrSetName: name of the constraint set :type constrSetName: str
:param opVarName: name of the operation variables :type opVarName: str
:param isOperationCommisYearDepending: defines whether the operation variable is depending on the year of commissioning of the component. E.g. relevant if the commodity conversion, for example the efficiency, varies over the transformation pathway :type isOperationCommisYearDepending: str
Source code in fine/component.py
2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 | |
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,
commissioningDependentCcf=False,
emissionFactors=None,
flowShares=None,
pwlcfParameters=None,
rampUpMax=None,
rampDownMax=None,
useTemporalCyclicConstraints=True,
)
Bases: Component
A Conversion component converts commodities into each other.
Create an instance of the Conversion class, with capacities 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:
:param physicalUnit: reference physical unit of the plants to which maximum capacity limitations, cost parameters and the operation time series refer to. :type physicalUnit: string
:param 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 varied
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, ...])}, ...}
If a conversion component can decide between multiple in- or outputs which one to use
(e.g. a chp plant) a flexible conversion component can be specified. This enables the
component to substitute in- or output commodities within a commodity group. To allow
this behavior an additional level needs to be specified:
* A CHP plant can decide between the production of heat or electricity (or a mix of both).
When electricity is produced the conversion factor is 0.2 and for heat 0.5:
{'gas': -1, 'out': {electricity: 0.2, heat: 0.5}}
Location-dependent (time-invariant) conversion factors can be provided as pandas.Series
indexed by the energy system model locations.
Example: {'electricity': -1, 'heat': pd.Series({'DE': 0.9, 'FR': 0.8})}
:type commodityConversionFactors:
* dictionary, assigns commodities (string) to a conversion factors
(float/int, pandas.Series indexed by locations, or pandas.DataFrame
with locations as columns and time steps as index)
* dictionary with investment periods as key and one of the first option as value
* dictionary with tuple of (commissioning year, investment period) as key and one
of the first option above as value
Example: { 2025: {'electricity': -1, 'hydrogen': pd.DataFrame( {'ElectrolyzerLocation': [0.5, 0.6, 0.7, ...], 'IndustryLocation': [1.0, 0.9, 0.8, ...]}, index=esM.totalTimeSteps)}, 2030: {'electricity': -1, 'hydrogen': pd.DataFrame( {'ElectrolyzerLocation': [0.6, 0.7, 0.8, ...], 'IndustryLocation': [0.9, 0.8, 0.7, ...]}, index=esM.totalTimeSteps)} }
Default arguments:
:param linkedConversionCapacityID: if specifies, indicates that all conversion components with the same ID have to have the same capacity. |br| * the default value is None :type linkedConversionCapacityID: string
:param 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. |br| * the default value is None :type operationRateMin: * None * pandas DataFrame with positive (>=0). The row indices have to match the in the energy system model specified time steps. The column indices have to match the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param 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. |br| * the default value is None :type operationRateMax: * None * pandas DataFrame with positive (>=0). The row indices have to match the in the energy system model specified time steps. The column indices have to match the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param 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. |br| * the default value is None :type operationRateFix: * None * Pandas DataFrame with positive (>=0). The row indices have to match the in the energy system model specified time steps. The column indices have to match the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param tsaWeight: weight with which the time series of the component should be considered when applying time series aggregation. |br| * the default value is 1 :type tsaWeight: positive (>= 0) float
:param 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). |br| * the default value is 0 :type opexPerOperation: * Pandas Series with positive (>=0) entries. The indices of the series have to equal the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param commissioningDependentCcf: specifies if commodity conversion factors are dependent on commissioning or operation year. If set to False, the factors are only dependent on the year of operation and no new operation variables are introduced. If set to True, the factors are dependent on commissioning year and new operation variables are introduced for every commissioning year. |br| * the default value is False :type commissioningDependentCcf:bool
:param emissionFactors: can be used to specify emissions for flexible conversion components. This parameter can only be specified if the component is a flexible conversion component (see explanations on commodity conversion factors above). When specified, the emission factors indicate what emissions are produced when a particular commodity is used by the component. Note: For non-flexible conversion components emissions must be specified as commodity conversion factors.
Example: The CO2 emissions of a power plant are dependent on the type of fuel is used (e.g. coal has
higher emissions than gas): {'co2': {'coal': 3, 'gas': 1}}
:type emissionFactors: dict with emission commodities as key and a dict as value. The inner dict holds the emission factors which are dependent on the utilized commodity.
:param flowShares: can be used to constrain the operation of flexible conversion components (see explanations on commodity conversion factors above). When used, the flow shares must be specified as 'min', 'max', or 'fix' values that limit the commodity specific operation rate of a flexible conversion component relative to the overall rate of that component (e.g. if the flow share max for H2 is set to 0.75 and the overall operation rate is 4 MW, then the H2 operation rate must be smaller or equal to 3 MW). Flow shares can be set up for all, some, or none of the modeled investment periods, and can either apply to all regions (if defined as int) or depend on individual regions (if defined as pandas series). Flow shares must be between 0 and 1 if specified.
Example: In the first investment period in Location1 only a small share of 10 % of the modeled gas heaters
are able to burn hydrogen instead of natural gas. In the second investment period more hydrogen ready
heaters are available and 50% of the heaters can burn hydrogen instead of natural gas (10 % of
those heaters can only burn hydrogen). In Location2 only 5 % can burn hydrogen in first period and 40 % can
burn hydrogen in second period:
flowShares = {
0: {
'max': {'hydrogen': pd.Series([0.1, 0.05], index=['loc1', 'loc2'])}
},
1: {
'max': {'hydrogen': pd.Series([0.1, 0.05], index=['loc1', 'loc2'])},
'min': {'hydrogen': pd.Series([0.1], index=['loc1'])}
}
}
:type flowShares: dict
:param rampUpMax: A maximum ramping rate to limit the increase in the operation of the component as share of the installed capacity. The maximum ramping is defined per hour and not per hoursPerTimeStep. |br| * the default value is None :type rampUpMax: None or float value in range ]0.0,1.0]
:param rampDownMax: A maximum ramping rate to limit the decrease in the operation of the component as share of the installed capacity. The maximum ramping is defined per hour and not per hoursPerTimeStep. |br| * the default value is None :type rampDownMax: None or float value in range ]0.0,1.0]
:param useTemporalCyclicConstraints: If True, the temporal cyclic constraints are used. This means that the operation of the first time steps are mathematically linked to the operation of the last time steps. |br| * the default value is True :type useTemporalCyclicConstraints: boolean
Methods:
-
addToEnergySystemModel–Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in
-
getDataForTimeSeriesAggregation–Get the required data if a time series aggregation is requested.
-
getTSAOutput–Return a reformatted time series data after applying time series aggregation, if the original time series
-
prepareTSAInput–Format the time series data of a component to fit the requirements of the time series aggregation package and
-
setAggregatedTimeSeriesData–Determine the aggregated maximum rate and the aggregated fixed operation rate.
-
setTimeSeriesData–Set the maximum operation rate and fixed operation rate depending on whether a time series analysis is requested or not.
Source code in fine/conversion.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
addToEnergySystemModel
¶
Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in the esM, it is added as well.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
Source code in fine/component.py
getDataForTimeSeriesAggregation
¶
Get the required data if a time series aggregation is requested.
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/conversion.py
getTSAOutput
¶
Return a reformatted time series data after applying time series aggregation, if the original time series data is not None.
:param rate: Full (unclustered) time series data or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param data: Pandas DataFrame with the clustered time series data of all components in the energy system :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
:return: reformatted data or None :rtype: Pandas DataFrame
Source code in fine/component.py
prepareTSAInput
¶
Format the time series data of a component to fit the requirements of the time series aggregation package and return a list of formatted data.
:param rate: a fixed/maximum/minimum operation time series or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param rateWeight: weight of the time series in the clustering process :type rateWeight: positive float (>=0)
:param weightDict: dictionary to which the weight is added :type weightDict: dict
:param data: list to which the formatted data is added :type data: list of Pandas DataFrames
:param ip: investment period of transformation path analysis. :type ip: int
:return: data :rtype: Pandas DataFrame
Source code in fine/component.py
setAggregatedTimeSeriesData
¶
Determine the aggregated maximum rate and the aggregated fixed operation rate.
:param data: Pandas DataFrame with the clustered time series data of the conversion component :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/conversion.py
setTimeSeriesData
¶
Set the maximum operation rate and fixed operation rate depending on whether a time series analysis is requested or not.
:param hasTSA: states whether a time series aggregation is requested (True) or not (False). :type hasTSA: boolean
Source code in fine/conversion.py
ConversionDynamic
¶
ConversionDynamic(
esM,
name,
physicalUnit,
commodityConversionFactors,
downTimeMin=None,
upTimeMin=None,
useTemporalCyclicConstraints=True,
**kwargs,
)
Bases: Conversion
Extension of the conversion class with more specific ramping behavior.
Create a ConversionDynamic class instance. The ConversionDynamic component specific input arguments are described below. The Conversion specific input arguments are described in the Conversion class and the general component input arguments are described in the Component class.
Default arguments:
:param downTimeMin: if specified, indicates minimal down time of the component [hours]. |br| * the default value is None :type downTimeMin: None or integer value in range [0,numberOfTimeSteps*hoursPerTimeStep]
:param upTimeMin: if specified, indicates minimal up time of the component [hours]. |br| * the default value is None :type upTimeMin: None or integer value in range [0,numberOfTimeSteps*hoursPerTimeStep]
:param useTemporalCyclicConstraints: If True, the temporal cyclic constraints are used. This means that the operation of the first time steps are mathematically linked to the operation of the last time steps. |br| * the default value is True :type useTemporalCyclicConstraints: boolean
:param kwargs: All other keyword arguments of the conversion class can be defined as well. :type kwargs: Check Conversion Class documentation.
Methods:
-
addToEnergySystemModel–Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in
-
getDataForTimeSeriesAggregation–Get the required data if a time series aggregation is requested.
-
getTSAOutput–Return a reformatted time series data after applying time series aggregation, if the original time series
-
prepareTSAInput–Format the time series data of a component to fit the requirements of the time series aggregation package and
-
setAggregatedTimeSeriesData–Determine the aggregated maximum rate and the aggregated fixed operation rate.
-
setTimeSeriesData–Set the maximum operation rate and fixed operation rate depending on whether a time series
Source code in fine/subclasses/conversionDynamic.py
addToEnergySystemModel
¶
Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in the esM, it is added as well.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
Source code in fine/component.py
getDataForTimeSeriesAggregation
¶
Get the required data if a time series aggregation is requested.
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/conversion.py
getTSAOutput
¶
Return a reformatted time series data after applying time series aggregation, if the original time series data is not None.
:param rate: Full (unclustered) time series data or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param data: Pandas DataFrame with the clustered time series data of all components in the energy system :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
:return: reformatted data or None :rtype: Pandas DataFrame
Source code in fine/component.py
prepareTSAInput
¶
Format the time series data of a component to fit the requirements of the time series aggregation package and return a list of formatted data.
:param rate: a fixed/maximum/minimum operation time series or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param rateWeight: weight of the time series in the clustering process :type rateWeight: positive float (>=0)
:param weightDict: dictionary to which the weight is added :type weightDict: dict
:param data: list to which the formatted data is added :type data: list of Pandas DataFrames
:param ip: investment period of transformation path analysis. :type ip: int
:return: data :rtype: Pandas DataFrame
Source code in fine/component.py
setAggregatedTimeSeriesData
¶
Determine the aggregated maximum rate and the aggregated fixed operation rate.
:param data: Pandas DataFrame with the clustered time series data of the conversion component :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/conversion.py
setTimeSeriesData
¶
Set the maximum operation rate and fixed operation rate depending on whether a time series analysis is requested or not.
:param hasTSA: states whether a time series aggregation is requested (True) or not (False). :type hasTSA: boolean
Source code in fine/subclasses/conversionDynamic.py
ConversionPartLoad
¶
ConversionPartLoad(
esM,
name,
physicalUnit,
commodityConversionFactors,
commodityConversionFactorsPartLoad,
nSegments=None,
**kwargs,
)
Bases: Conversion
A ConversionPartLoad component maps the (nonlinear) part-load 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.
Create 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:
:param commodityConversionFactorsPartLoad: A dictionary containing key-value pairs, where each key represents a commodity (e.g., "electricity", "hydrogen") and each value provides the conversion factors that vary with the operation load. These conversion factors dictate the efficiency or rate at which one commodity is transformed into another under different operational conditions. The (nonlinear) part load behavior, which is the relationship between the conversion factors (or efficiency) and the operational load, can be described either using a lambda function for a direct mathematical relationship or a Pandas DataFrame. If a Pandas DataFrame is used, it should contain two columns: one for the x-axis, which represents the operation level (nominal load), and one for the y-axis, which represents the corresponding conversion factor (efficiency) at the corresponding operation level. A negative value indicates that the commodity is consumed. A positive value indicates that the commodity is produced.
Example: * An electrolyzer converts, simply put, electricity into hydrogen with an electrical efficiency depending on the operation level. The physicalUnit is given as GW_electric, the unit for the 'electricity' commodity isgiven in GW_electric and the 'hydrogen' commodity is given in GW_hydrogen_lowerHeatingValue. Here, electricity consumption is represented by a negative value (-1), and hydrogen production efficiency is detailed in a DataFrame with operation levels and corresponding efficiencies.
# Efficiency Curve of Electrolyzer
Operation_level = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95]
Efficiency = [0.1, 0.15, 0.5, 0.7, 0.7, 0.65, 0.63, 0.62, 0.61, 0.60]
d = {"x": Operation_level, "y": Efficiency}
partLoadData = pd.DataFrame(d)
# Definition of commodityConversionFactorsPartLoad
-> the commodityConversionFactorsPartLoad are defined as {'electricity':-1,'hydrogen':partLoadData}.
Default arguments:
:param nSegments: 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. |br| * the default value is None :type nSegments: None or integer or string
:param kwargs: All other keyword arguments of the conversion class can be defined as well. :type kwargs: * Check Conversion Class documentation.
Methods:
-
addToEnergySystemModel–Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in
-
getDataForTimeSeriesAggregation–Get the required data if a time series aggregation is requested.
-
getTSAOutput–Return a reformatted time series data after applying time series aggregation, if the original time series
-
prepareTSAInput–Format the time series data of a component to fit the requirements of the time series aggregation package and
-
setAggregatedTimeSeriesData–Determine the aggregated maximum rate and the aggregated fixed operation rate.
-
setTimeSeriesData–Set the maximum operation rate and fixed operation rate depending on whether a time series analysis is requested or not.
Source code in fine/subclasses/conversionPartLoad.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
addToEnergySystemModel
¶
Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in the esM, it is added as well.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
Source code in fine/component.py
getDataForTimeSeriesAggregation
¶
Get the required data if a time series aggregation is requested.
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/conversion.py
getTSAOutput
¶
Return a reformatted time series data after applying time series aggregation, if the original time series data is not None.
:param rate: Full (unclustered) time series data or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param data: Pandas DataFrame with the clustered time series data of all components in the energy system :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
:return: reformatted data or None :rtype: Pandas DataFrame
Source code in fine/component.py
prepareTSAInput
¶
Format the time series data of a component to fit the requirements of the time series aggregation package and return a list of formatted data.
:param rate: a fixed/maximum/minimum operation time series or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param rateWeight: weight of the time series in the clustering process :type rateWeight: positive float (>=0)
:param weightDict: dictionary to which the weight is added :type weightDict: dict
:param data: list to which the formatted data is added :type data: list of Pandas DataFrames
:param ip: investment period of transformation path analysis. :type ip: int
:return: data :rtype: Pandas DataFrame
Source code in fine/component.py
setAggregatedTimeSeriesData
¶
Determine the aggregated maximum rate and the aggregated fixed operation rate.
:param data: Pandas DataFrame with the clustered time series data of the conversion component :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/conversion.py
setTimeSeriesData
¶
Set the maximum operation rate and fixed operation rate depending on whether a time series analysis is requested or not.
:param hasTSA: states whether a time series aggregation is requested (True) or not (False). :type hasTSA: boolean
Source code in fine/conversion.py
EnergySystemModel
¶
EnergySystemModel(
locations,
commodities,
commodityUnitsDict,
numberOfTimeSteps=8760,
hoursPerTimeStep=1,
startYear=0,
numberOfInvestmentPeriods=1,
investmentPeriodInterval=1,
stochasticModel=False,
costUnit="1e9 Euro",
lengthUnit="km",
verboseLogLevel=0,
balanceLimit=None,
pathwayBalanceLimit=None,
annuityPerpetuity=False,
)
EnergySystemModel class.
The functionality provided by the EnergySystemModel class is fourfold:
- With it, the basic structure (spatial and temporal resolution, considered commodities) of the investigated energy system is defined.
- It serves as a container for all components investigated in the energy system model. These components, namely sources and sinks, conversion options, storage options, and transmission options (in the core module), can be added to an EnergySystemModel instance.
- It provides the core functionality of modeling and optimizing the energy system based on the specified structure and components on the one hand and of specified simulation parameters on the other hand.
- It stores optimization results which can then be post-processed with other modules.
The parameters which are stored in an instance of the class refer to:
- the modeled spatial representation of the energy system (locations, lengthUnit)
- the modeled temporal representation of the energy system (totalTimeSteps, hoursPerTimeStep, startYear, numberOfInvementPeriods, investmentPeriodInterval, periods, periodsOrder, periodsOccurrences, timeStepsPerPeriod, interPeriodTimeSteps, isTimeSeriesDataClustered, typicalPeriods, tsaInstance, timeUnit)
- the considered commodities in the energy system (commodities, commodityUnitsDict)
- the considered components in the energy system (componentNames, componentModelingDict, costUnit)
- optimization related parameters (pyM, solverSpecs)
The parameters are first set when a class instance is initiated. The parameters which are related to the components (e.g. componentNames) are complemented by adding the components to the class instance.
Instances of this class provide functions for\n * adding components and their respective modeling classes (add) * clustering the time series data of all added components using the time series aggregation package tsam, cf. https://github.com/FZJ-IEK3-VSA/tsam (cluster) * optimizing the specified energy system (optimize), for which a pyomo concrete model instance is built and filled with
(0) basic time sets,
(1) sets, variables and constraints contributed by the component modeling classes,
(2) basic, component overreaching constraints, and
(3) an objective function.
The pyomo instance is then optimized by a specified solver. The optimization results are processed once available. * getting components and their attributes (getComponent, getCompAttr, getOptimizationSummary)
Create an EnergySystemModel class instance.
Required arguments:
:param locations: locations considered in the energy system :type locations: set of strings
:param commodities: commodities considered in the energy system :type commodities: set of strings
:param commodityUnitsDict: dictionary which assigns each commodity a quantitative unit per time (e.g. GW_el, GW_H2, Mio.t_CO2/h). The dictionary is used for results output.
.. note::
Note for advanced users: the scale of these units can influence the numerical stability of the
optimization solver, cf. http://files.gurobi.com/Numerics.pdf where a reasonable range of model
coefficients is suggested.
:type commodityUnitsDict: dictionary of strings
Default arguments:
:param numberOfTimeSteps: number of time steps considered when modeling the energy system (for each time step, or each representative time step, variables and constraints are constituted). Together with the hoursPerTimeStep, the total number of hours considered can be derived. The total number of hours is again used for scaling the arising costs to the arising total annual costs (TAC) which are minimized during optimization. |br| * the default value is 8760. :type totalNumberOfHours: strictly positive integer
:param hoursPerTimeStep: hours per time step |br| * the default value is 1 :type hoursPerTimeStep: strictly positive float
:param numberOfInvestmentPeriods: number of investment periods of transformation path analysis, e.g. for a transformation pathway from 2020 to 2030 with the years 2020, 2025, 2030, the numberOfInvestmentPeriods is 3 |br| * the default value is 1 :type numberOfInvestmentPeriods: strictly positive integer
:param investmentPeriodInterval: interval between the investment of transformation path analysis, e.g. for a transformation pathway from 2020 to 2030 with the years 2020, 2025, 2030, the investmentPeriodInterval is 5 |br| * the default value is 1 :type investmentPeriodInterval: strictly positive integer
:param startYear: year name of first investment period, e.g. for a transformation pathway from 2020 to 2030 with the years 2020, 2025, 2030, the startYear is 2020 |br| * the default value is 0 :type startYear: integer
:param stochasticModel: defines whether to set up a stochastic optimization. The goal of the stochastic optimization is to find a more robust energy system by considering different requirements to find a single energy system design (e.g. various weather years or demand forecasts). These requirements are represented in different investment periods of the model. In contrast to the classical perfect foresight optimization the investment periods do not represent steps of a transformation pathway but possible boundary conditions for the energy system, which need to be considered for the system design and operation |br| * the default value is False :type mode: bool
:param costUnit: cost unit of all cost related values in the energy system. This argument sets the unit of all cost parameters which are given as an input to the EnergySystemModel instance (e.g. for the invest per capacity or the cost per operation).
.. note::
Note for advanced users: the scale of this unit can influence the numerical stability of the
optimization solver, cf. http://files.gurobi.com/Numerics.pdf where a reasonable range of model
coefficients is suggested.
|br| * the default value is '10^9 Euro' (billion euros), which can be a suitable scale for national
energy systems.
:type costUnit: string
:param lengthUnit: length unit for all length-related values in the energy system.
.. note::
Note for advanced users: the scale of this unit can influence the numerical stability of the
optimization solver, cf. http://files.gurobi.com/Numerics.pdf where a reasonable range of model
coefficients is suggested.
|br| * the default value is 'km' (kilometers).
:type lengthUnit: string
:param verboseLogLevel: defines how verbose the console logging is:
- 0: general model logging, warnings and optimization solver logging are displayed.
- 1: warnings are displayed.
- 2: no general model logging or warnings are displayed, the optimization solver logging is set to a
minimum.
.. note::
if required, the optimization solver logging can be separately enabled in the optimizationSpecs
of the optimize function.
|br| * the default value is 0
:type verboseLogLevel: integer (0, 1 or 2)
:param balanceLimit: defines the balanceLimit constraint (various different balanceLimitIDs possible) for specific regions or the whole model and optional also per investment period. The balancelimitID can be assigned to various components of e.g. SourceSinkModel or TransmissionModel to limit the balance of production, consumption and im/export.
Regional dependency:
The balanceLimit is defined as a pd.DataFrame. Each row contains an individual balanceLimitID as
index, the corresponding regional scope as columns and the values as data. The regional scope can be set
for a region with the matching region name as column name or "Total" as column name for setting for the entire system.
If no balanceLimit is to be set for a given location, replace the corresponding entry with 'None' (not 'np.nan').
Temporal dependency:
If the balanceLimit is passed as a dict with the described pd.DataFrames as values it is considered per investment period.
Values are always given in the unit of the esM commodities unit.\n
Optional: A column named 'lowerBound' can be passed to specify if
the limit is an upper or lower bound.
By default an upperBound is considered ('lowerBound'=False).
However, multiple cases can be considered:\n
1) Sources:\n
a) LowerBound=False: UpperBound for commodity from SourceComponent (Define positive value in
balanceLimit). Example: Limit CO2-Emission\n
b) LowerBound=True: LowerBound for commodity from SourceComponent (Define positive value in
balanceLimit). Example: Require minimum production from renewables.\n
2) Sinks:\n
a) LowerBound=False: UpperBound in a mathematical sense for commodity from SinkComponent
(Logically minimum limit for negative values, define negative value in balanceLimit).
Example: Minimum export/consumption of hydrogen.\n
b) LowerBound=True: LowerBound in a mathematical sense for commodity from SourceComponent
(Logically maximum limit for negative values, define negative value in balanceLimit).
Example: Define upper limit for Carbon Capture & Storage.\n
Examples: - balanceLimit for commodity flow into system/ location e.g. due to a source [positive value; lowerBound=False] (e.g. natural gas field): balanceLimit=pd.DataFrame(columns=["Total"], index=["Gas production", "lowerBound"], data=[1000, False] ) - balanceLimit for commodity flow out of system/ location e.g. due to a sink [negative value; lowerBound=True] (e.g. CO2 sink): balanceLimit=pd.DataFrame(columns=["Total"], index=["CO2 Limit", "lowerBound"], data=[-1000, True] ) - balanceLimit per region and per system (flow into system/ location): balanceLimit=pd.DataFrame(columns=["Region1", "Total"], index=["CO2 Limit"], data=[1000, 2000] ) - multiple balanceLimits for different IDs: balanceLimit=pd.DataFrame(columns=["Total", "lowerBound"], index=["CO2 limit", "Gas production"], data=[[400, False], [1000, True]] ) - Different CO2 Limits for each investment period and minimum installed capacity for renewables: balanceLimit = { 2020: pd.DataFrame(index=["CO2 limit", "Renewables"], columns=["Total", "lowerBound"], data=[[-366 * (1 - CO2_reductionTarget * 0.33), True],[430000, True]] ), 2025: pd.DataFrame(index=["CO2 limit", "Renewables"], columns=["Region1", "Total", "lowerBound"], data=[[-366 * (1 - CO2_reductionTarget * 0.67), True],[430000, True]] ), 2030: pd.DataFrame(index=["CO2 limit", "Renewables"], columns=["Region1", "Total", "lowerBound"], data=[[-366 * (1 - CO2_reductionTarget), True],[430000, True]] ) } .. note:: If bounds for sinks shall be specified (e.g. min. export, max. sink volume), values must be defined as negative.
|br| * the default value is None
:type balanceLimit:
* pd.DataFrame
* dictionary with investment periods years as keys, and pd.DataFrame as values
|br| * the default value is None
:type lowerBound: bool
:param pathwayBalanceLimit: the pathway balance limit defines commodity balance (lower or upper bound) for the pathway. The structure is similar to the balanceLimit, however does without the temporal dependency per investment period. Examples: CO2 budget for the entire transformation pathway |br| * the default value is None :type pathwayBalanceLimit: None or pd.DataFrame
:param annuityPerpetuity: if set to True, it is assumed that the design and operation of the last investment period will be maintained forever. Therefore, the cost contribution of each component's last investment period is divided by the component's interest rate to account for perpetuity costs.
To enable annuity perpetuity the interest rate of every component must be greater than 0.
|br| * the default value is False
:type: annuityPerpetuity: bool
Methods:
-
add–Add a component and, if required, its respective modeling class to the EnergySystemModel instance.
-
aggregateSpatially–Spatially clusters the data of all components considered in the Energy System Model (esM) instance
-
aggregateTemporally–Temporally cluster the time series data of all components considered in the EnergySystemModel instance and then
-
createTimeSeriesDataForAggregation–Create and return the time series data, weights, and zero-data columns for aggregation.
-
declareBalanceLimitConstraint–Declare balance limit constraint.
-
declareCommodityBalanceConstraints–Declare commodity balance constraints (one balance constraint for each commodity, location and time step).
-
declareComponentLinkedQuantityConstraints–Declare linked component quantity constraint, e.g. if an engine (E-Motor) is built also a storage (Battery)
-
declareObjective–Declare the objective function by obtaining the contributions to the objective function from all modeling
-
declareOptimizationProblem–Declare the optimization problem belonging to the specified energy system for which a pyomo concrete model
-
declareSharedPotentialConstraints–Declare shared potential constraints, e.g. if a maximum potential of salt caverns has to be shared by
-
declareTimeSets–Set and initialize basic time parameters and sets.
-
getComponent–Return a component of the energy system.
-
getComponentAttribute–Return an attribute of a component considered in the energy system.
-
getOptimizationSummary–Return the optimization summary (design variables, aggregated operation variables, and objective contributions) of a modeling class.
-
optimize–Optimize the specified energy system for which a pyomo ConcreteModel instance is built or called upon.
-
removeComponent–Remove a component from the energy system.
-
updateComponent–Overwrite selected attributes of an existing esM component with new values.
Source code in fine/energySystemModel.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
add
¶
Add a component and, if required, its respective modeling class to the EnergySystemModel instance. The added component has to inherit from the FINE class Component.
:param component: the component to be added :type component: An object which inherits from the FINE class Component
Source code in fine/energySystemModel.py
aggregateSpatially
¶
aggregateSpatially(
shapefile,
grouping_mode="parameter_based",
n_groups=3,
distance_threshold=None,
aggregatedResultsPath=None,
**kwargs,
)
Spatially clusters the data of all components considered in the Energy System Model (esM) instance and returns a new esM instance with the aggregated data.
:param shapefile: Either the path to the shapefile or the read-in shapefile :type shapefile: string, GeoDataFrame
Default arguments:
:param grouping_mode: Defines how to spatially group the regions. Refer to grouping.py for more information. |br| * the default value is 'parameter_based' :type grouping_mode: string, Options: 'string_based', 'distance_based', 'parameter_based'
:param n_groups: The number of region groups to be formed from the original region set.
This parameter is irrelevant if grouping_mode is 'string_based'.
|br| * the default value is 3
:type n_groups: strictly positive integer, None
:param distance_threshold: The distance threshold at or above which regions will not be aggregated into one. |br| * the default value is None. If not None, n_groups must be None :type distance_threshold: float
:param aggregatedResultsPath: Indicates path to which the aggregated results should be saved. If None, results are not saved. |br| * the default value is None :type aggregatedResultsPath: string, None
Additional keyword arguments that can be passed via kwargs:
:param geom_col_name: The geometry column name in shapefile
|br| * the default value is 'geometry'
:type geom_col_name: string
:param geom_id_col_name: The column in shapefile consisting geom IDs
|br| * the default value is 'index'
:type geom_id_col_name: string
:param separator: Relevant only if grouping_mode is 'string_based'.
The character or string in the region IDs that defines where the ID should be split.
E.g.: region IDs -> ['01_es', '02_es'] and separator='_', then IDs are split at _
and the last part ('es') is taken as the group ID
|br| * the default value is None
:type separator: string
:param position: Relevant only if grouping_mode is 'string_based'.
Used to define the position(s) of the region IDs where the split should happen.
An int i would mean the part from 0 to i is taken as the group ID. A tuple (i,j) would mean
the part i to j is taken at the group ID.
.. note:: either `separator` or `position` must be passed in order to perform string_based_grouping
|br| * the default value is None
:type position: integer/tuple
:param weights: Relevant only if grouping_mode is 'parameter_based'.
Through the weights dictionary, one can assign weights to variable-component pairs. When calculating
distance corresponding to each variable-component pair, these specified weights are
considered, otherwise taken as 1.
It must be in one of the formats:
- If you want to specify weights for particular variables and particular corresponding components:
{ 'components' : Dict[<component_name>, <weight>}], 'variables' : List[<variable_name>] }
- If you want to specify weights for particular variables, but all corresponding components:
{ 'components' : {'all' : <weight>}, 'variables' : List[<variable_name>] }
- If you want to specify weights for all variables, but particular corresponding components:
{ 'components' : Dict[<component_name>, <weight>}], 'variables' : 'all' }
<weight> can be of type integer/float
|br| * the default value is None
:type weights: dictionary
:param aggregation_method: Relevant only if grouping_mode is 'parameter_based'.
The clustering method that should be used to group the regions. Options:
- 'kmedoids_contiguity':
kmedoids clustering with added contiguity constraint.
Refer to TSAM docs for more info: https://github.com/FZJ-IEK3-VSA/tsam/blob/master/tsam/utils/k_medoids_contiguity.py
- 'hierarchical':
sklearn's agglomerative clustering with complete linkage, with a connectivity matrix to ensure contiguity.
Refer to Sklearn docs for more info: https://scikit-learn.org/stable/modules/generated/sklearn.cluster.AgglomerativeClustering.html
|br| * the default value is 'kmedoids_contiguity'
:type aggregation_method: string, Options: 'kmedoids_contiguity', 'hierarchical'
:param solver: Relevant only if grouping_mode is 'parameter_based' and aggregation_method is 'kmedoids_contiguity'
The optimization solver to be chosen.
|br| * the default value is 'gurobi'
:type solver: string, Options: 'gurobi', 'highs', 'glpk'
:param aggregation_function_dict: Contains information regarding the mode of aggregation for each individual variable.
- Possibilities: mean, weighted mean, sum, bool (boolean OR).
- Format of the dictionary
- {<variable_name>: (<mode_of_aggregation>, <weights>),
<variable_name>: (<mode_of_aggregation>, None)}.
<weights> is required only if <mode_of_aggregation> is
'weighted mean'. The name of the variable that should act as weights should be provided. Can be None otherwise.
A default dictionary is considered with the following corresponding modes.
If `aggregation_function_dict` is passed, this default dictionary is updated.
| {"operationRateMax": ("weighted mean", "capacityMax"),
| "operationRateFix": ("sum", None),
| "processedLocationalEligibility": ("bool", None),
| "capacityMax": ("sum", None),
| "investPerCapacity": ("mean", None),
| "investIfBuilt": ("bool", None),
| "opexPerOperation": ("mean", None),
| "opexPerCapacity": ("mean", None),
| "opexIfBuilt": ("bool", None),
| "interestRate": ("mean", None),
| "economicLifetime": ("mean", None),
| "capacityFix": ("sum", None),
| "losses": ("mean", None),
| "distances": ("mean", None),
| "commodityCost": ("mean", None),
| "commodityRevenue": ("mean", None),
| "opexPerChargeOperation": ("mean", None),
| "opexPerDischargeOperation": ("mean", None),
| "QPcostScale": ("sum", None),
| "technicalLifetime": ("mean", None)}
:type aggregation_function_dict: dictionary
:param aggregated_shp_name: Name to be given to the saved shapefiles after aggregation |br| * the default value is 'aggregated_regions' :type aggregated_shp_name: string
:param crs: Coordinate reference system (crs) in which to save the shapefiles |br| * the default value is 3035 :type crs: integer
:param crs: Coordinate reference system (crs) in which to save the shapefiles |br| * the default value is 3035 :type crs: integer
:param aggregated_xr_filename: Name to be given to the saved netCDF file containing aggregated esM data |br| * the default value is 'aggregated_xr_dataset.nc' :type aggregated_xr_filename: string
:returns: Aggregated esM instance
Source code in fine/energySystemModel.py
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | |
aggregateTemporally
¶
aggregateTemporally(
numberOfTypicalPeriods=40,
numberOfTimeStepsPerPeriod=24,
segmentation=True,
numberOfSegmentsPerPeriod=12,
clusterMethod="hierarchical",
representationMethod="durationRepresentation",
sortValues=False,
storeTSAinstance=False,
rescaleClusterPeriods=False,
**kwargs,
)
Temporally cluster the time series data of all components considered in the EnergySystemModel instance and then stores the clustered data in the respective components. For this, the time series data is broken down into an ordered sequence of periods (e.g. 365 days) and to each period a typical period (e.g. 7 typical days with 24 hours) is assigned. Moreover, the time steps within the periods can further be clustered to bigger time steps with an irregular duration using the segmentation option. For the clustering itself, the tsam package is used (cf. https://github.com/FZJ-IEK3-VSA/tsam). Additional keyword arguments for the TimeSeriesAggregation instance can be added (facilitated by kwargs). As an example: it might be useful to add extreme periods to the clustered typical periods.
.. note:: The segmentation option can be freely combined with all subclasses. However, an irregular time step length is not meaningful for the minimumDownTime and minimumUpTime in the conversionDynamic module, because the time would be different for each segment.
Default arguments:
:param numberOfTypicalPeriods: states the number of typical periods into which the time series data should be clustered. The number of time steps per period must be an integer multiple of the total number of considered time steps in the energy system.
.. note::
Please refer to the tsam package documentation of the parameter noTypicalPeriods for more
information.
|br| * the default value is 7
:type numberOfTypicalPeriods: strictly positive integer
:param numberOfTimeStepsPerPeriod: states the number of time steps per period |br| * the default value is 24 :type numberOfTimeStepsPerPeriod: strictly positive integer
:param segmentation: states whether the typical periods should be further segmented to fewer time steps |br| * the default value is False :type segmentation: boolean
:param numberOfSegmentsPerPeriod: states the number of segments per period |br| * the default value is 24 :type numberOfSegmentsPerPeriod: strictly positive integer
:param clusterMethod: states the method which is used in the tsam package for clustering the time series data. Options are for example 'averaging', 'k_means', 'exact k_medoid' or 'hierarchical'.
.. note::
Please refer to the tsam package documentation of the parameter clusterMethod for more information.
|br| * the default value is 'hierarchical'
:type clusterMethod: string
:param representationMethod: Chosen representation. If specified, the clusters are represented in the chosen way. Otherwise, each clusterMethod has its own commonly used default representation method.
.. note::
Please refer to the tsam package documentation of the parameter representationMethod for more information.
|br| * the default Value is "durationRepresentation"
:type representationMethod: string
:param rescaleClusterPeriods: states if the cluster periods shall get rescaled such that their weighted mean value fits the mean value of the original time series
.. note::
Please refer to the tsam package documentation of the parameter rescaleClusterPeriods for more information.
|br| * the default value is False
:type rescaleClusterPeriods: boolean
:param sortValues: states if the algorithm in the tsam package should use
(a) the sorted duration curves (-> True) or
(b) the original profiles (-> False)
of the time series data within a period for clustering.
.. note::
Please refer to the tsam package documentation of the parameter sortValues for more information.
|br| * the default value is True
:type sortValues: boolean
:param storeTSAinstance: states if the TimeSeriesAggregation instance created during clustering should be stored in the EnergySystemModel instance. |br| * the default value is False :type storeTSAinstance: boolean
Source code in fine/energySystemModel.py
875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 | |
createTimeSeriesDataForAggregation
¶
Create and return the time series data, weights, and zero-data columns for aggregation.
Returns: tuple[pd.DataFrame, dict, pd.Index]: Time series data, weight dictionary, and columns containing only zero values.
Source code in fine/energySystemModel.py
declareBalanceLimitConstraint
¶
Declare balance limit constraint.
Balance limit constraint can limit the exchange of commodities within the model or over the model region boundaries. See the documentation of the parameters for further explanation. In general the following equation applies:
E_source - E_sink + E_exchange,in - E_exchange,out <= E_lim (LowerBound=False)
E_source - E_sink + E_exchange,in - E_exchange,out >= E_lim (LowerBound=True)
:param pyM: a pyomo ConcreteModel instance which contains parameters, sets, variables, constraints and objective required for the optimization set up and solving. :type pyM: pyomo ConcreteModel
:param timeSeriesAggregation: 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).
|br| * the default value is False
:type timeSeriesAggregation: boolean
Source code in fine/energySystemModel.py
1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 | |
declareCommodityBalanceConstraints
¶
Declare commodity balance constraints (one balance constraint for each commodity, location and time step).
.. math::
\\underset{\\text{comp} \\in \\mathcal{C}^{comm}_{loc}}{\\sum} \\text{C}^{comp,comm}_{loc,ip,p,t} = 0
:param pyM: a pyomo ConcreteModel instance which contains parameters, sets, variables, constraints and objective required for the optimization set up and solving. :type pyM: pyomo ConcreteModel
Source code in fine/energySystemModel.py
declareComponentLinkedQuantityConstraints
¶
Declare linked component quantity constraint, e.g. if an engine (E-Motor) is built also a storage (Battery) and a vehicle body (e.g. BEV Car) needs to be built. Not the capacity of the components, but the number of the components is linked.
:param pyM: a pyomo ConcreteModel instance which contains parameters, sets, variables, constraints and objective required for the optimization set up and solving. :type pyM: pyomo ConcreteModel
Source code in fine/energySystemModel.py
1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 | |
declareObjective
¶
Declare the objective function by obtaining the contributions to the objective function from all modeling classes. Currently, the only objective function which can be selected is the sum of the net present value of all components.
.. math:: z^* = \min \underset{comp \in \mathcal{C}}{\sum} \ \underset{loc \in \mathcal{L}^{comp}}{\sum} \left( NPV_{loc}^{comp,cap} + NPV_{loc}^{comp,bin} + NPV_{loc}^{comp,op} \right)
Objective Function detailed:
.. math:: z^* = \min \underset{comp \in \mathcal{C}}{\sum} \ \underset{loc \in \mathcal{L}^{comp}}{\sum} \ \underset{ip \in \mathcal{IP}}{\sum} \text{design}^{comp}{loc,ip} + \text{design}^{comp}} + \text{op}^{comp}_{loc,ip
Contribution of design variable to the objective function
.. math:: design^{comp}{loc,ip} = \sum\limits \text{F}^{comp,bin}}}^{ip{loc,year} \cdot \left( \frac{\text{investPerCap}^{comp}}}{\text{CCF}^{comp{loc,year}} + \text{opexPerCap}^{comp}} \right) \cdot commis^{comp{loc,year} \cdot \text{APVF}^{comp}} \cdot \text{discFactor}^{comp}_{loc,ip
Contribution of binary design variables to the objective function
.. math:: design^{comp}{bin\ loc,ip} = \sum\limits \text{F}^{comp,bin}}}^{ip{loc,year} \cdot \left( \frac{\text{investIfBuilt}^{comp}}} {\text{CCF}^{comp{loc,year}} + \text{opexIfBuilt}^{comp}} \right) \cdot bin^{comp{loc,year} \cdot \text{APVF}^{comp}} \cdot \text{discFactor}^{comp}_{loc,ip
Contribution of operation variables to the objective function
.. math:: op^{comp}{loc,ip} = \underset{(p,t) \in \mathcal{P} \times \mathcal{T}}{\sum} \ \underset{\text{opType} \in \mathcal{O}^{comp}}{\sum} \text{factorPerOp}^{comp,opType}} \cdot op^{comp,opType{loc,ip,p,t} \cdot \frac{\text{freq(p)}}{\tau^{years}} \cdot \text{APVF}^{comp}} \cdot \text{discFactor}^{comp}_{loc,ip
With the annuity present value factor (Rentenbarwertfaktor):
.. math:: APVF^{comp}{loc} = \frac{(1 + \text{interestRate}^{comp}})^{interval} - 1}{\text{interestRate}^{comp{loc} \cdot (1 + \text{interestRate}^{comp} != 0 \ else \ 1})^{interval}} \ if \text{interestRate}^{comp}_{loc
and the discount factor.
.. math:: \text{discFactor}^{comp}{loc,ip} = \frac{1+\text{interestRate}^{comp})^{ip \cdot \text{interval}}}}}{(1+\text{interestRate}^{comp}_{loc
:param pyM: a pyomo ConcreteModel instance which contains parameters, sets, variables, constraints and objective required for the optimization set up and solving. :type pyM: pyomo ConcreteModel
Source code in fine/energySystemModel.py
1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 | |
declareOptimizationProblem
¶
declareOptimizationProblem(
timeSeriesAggregation=False,
relaxIsBuiltBinary=False,
relevanceThreshold=None,
)
Declare the optimization problem belonging to the specified energy system for which a pyomo concrete model instance is built and filled with.
- basic time sets,
- sets, variables and constraints contributed by the component modeling classes,
- basic, component overreaching constraints, and
- an objective function.
Default arguments:
:param timeSeriesAggregation: 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).
|br| * the default value is False
:type timeSeriesAggregation: boolean
:param relaxIsBuiltBinary: states if the optimization problem should be solved as a relaxed LP to get the lower bound of the problem. |br| * the default value is False :type declaresOptimizationProblem: boolean
:param relevanceThreshold: Force operation parameters to be 0 if values are below the relevance threshold. |br| * the default value is None :type relevanceThreshold: float (>=0) or None
Source code in fine/energySystemModel.py
1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 | |
declareSharedPotentialConstraints
¶
Declare shared potential constraints, e.g. if a maximum potential of salt caverns has to be shared by salt cavern storing methane and salt caverns storing hydrogen.
.. math::
\\underset{\\text{comp} \\in \\mathcal{C}^{ID}}{\\sum} \\text{cap}^{comp}_{loc} / \\text{capMax}^{comp}_{loc} \\leq 1
:param pyM: a pyomo ConcreteModel instance which contains parameters, sets, variables, constraints and objective required for the optimization set up and solving. :type pyM: pyomo ConcreteModel
Source code in fine/energySystemModel.py
declareTimeSets
¶
Set and initialize basic time parameters and sets.
:param pyM: a pyomo ConcreteModel instance which contains parameters, sets, variables, constraints and objective required for the optimization set up and solving. :type pyM: pyomo ConcreteModel
:param timeSeriesAggregation: 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).
|br| * the default value is False
:type timeSeriesAggregation: boolean
:param segmentation: states if the optimization of the energy system model based on clustered time series data should be done with
(a) aggregated typical periods with the original time step length (False) or
(b) aggregated typical periods with further segmented time steps (True).
|br| * the default value is False
:type segmentation: boolean
Source code in fine/energySystemModel.py
1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 | |
getComponent
¶
Return a component of the energy system.
:param componentName: name of the component that should be returned :type componentName: string
:returns: the component which has the name componentName :rtype: Component
Source code in fine/energySystemModel.py
getComponentAttribute
¶
Return an attribute of a component considered in the energy system.
:param componentName: name of the component from which the attribute should be obtained :type componentName: string
:param attributeName: name of the attribute that should be returned :type attributeName: string
:returns: the attribute specified by the attributeName of the component with the name componentName :rtype: depends on the specified attribute
Source code in fine/energySystemModel.py
getOptimizationSummary
¶
Return the optimization summary (design variables, aggregated operation variables, and objective contributions) of a modeling class.
:param modelingClass: name of the modeling class from which the optimization summary should be obtained :type modelingClass: string
:param outputLevel: states the level of detail of the output summary:
- 0: full optimization summary is returned
- 1: full optimization summary is returned but rows in which all values are NaN (not a number) are dropped
- 2: full optimization summary is returned but rows in which all values are NaN or 0 are dropped
|br| * the default value is 0
:type outputLevel: integer (0, 1 or 2)
:returns: the optimization summary of the requested modeling class :rtype: pandas DataFrame
Source code in fine/energySystemModel.py
optimize
¶
optimize(
declaresOptimizationProblem=True,
relaxIsBuiltBinary=False,
timeSeriesAggregation=False,
logFileName="",
threads=3,
solver="None",
timeLimit=None,
optimizationSpecs="",
warmstart=False,
relevanceThreshold=None,
includePerformanceSummary=False,
)
Optimize the specified energy system for which a pyomo ConcreteModel instance is built or called upon. A pyomo instance is optimized with the specified inputs, and the optimization results are further processed.
Default arguments:
:param declaresOptimizationProblem: states if the optimization problem should be declared (True) or not (False).
(a) If true, the declareOptimizationProblem function is called and a pyomo ConcreteModel instance is built.
(b) If false a previously declared pyomo ConcreteModel instance is used.
|br| * the default value is True
:type declaresOptimizationProblem: boolean
:param relaxIsBuiltBinary: states if the optimization problem should be solved as a relaxed LP to get the lower bound of the problem. |br| * the default value is False :type declaresOptimizationProblem: boolean
:param timeSeriesAggregation: 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).
|br| * the default value is False
:type timeSeriesAggregation: boolean
:param segmentation: states if the optimization of the energy system model based on clustered time series data should be done with
(a) aggregated typical periods with the original time step length (False) or
(b) aggregated typical periods with further segmented time steps (True).
|br| * the default value is False
:type segmentation: boolean
:param logFileName: logFileName is used for naming the log file of the optimization solver output if gurobi is used as the optimization solver. If the logFileName is given as an absolute path (e.g. logFileName = os.path.join(os.getcwd(), 'Results', 'logFileName.txt')) the log file will be stored in the specified directory. Otherwise, it will be stored by default in the directory where the executing python script is called. |br| * the default value is 'job' :type logFileName: string
:param threads: number of computational threads used for solving the optimization (solver dependent input) if gurobi is used as the solver. A value of 0 results in using all available threads. If a value larger than the available number of threads are chosen, the value will reset to the maximum number of threads. |br| * the default value is 3 :type threads: positive integer
:param solver: specifies which solver should solve the optimization problem (which of course has to be installed on the machine on which the model is run). |br| * the default value is 'gurobi' :type solver: string
:param timeLimit: if not specified as None, indicates the maximum solve time of the optimization problem in seconds (solver dependent input). The use of this parameter is suggested when running models in runtime restricted environments (such as clusters with job submission systems). If the runtime limitation is triggered before an optimal solution is available, the best solution obtained up until then (if available) is processed. |br| * the default value is None :type timeLimit: strictly positive integer or None
:param optimizationSpecs: specifies parameters for the optimization solver (see the respective solver documentation for more information). Example: 'LogToConsole=1 OptimalityTol=1e-6' |br| * the default value is an empty string ('') :type optimizationSpecs: string
:param warmstart: specifies if a warm start of the optimization should be considered (not always supported by the solvers). |br| * the default value is False :type warmstart: boolean
:param relevanceThreshold: Force operation parameters to be 0 if values are below the relevance threshold. |br| * the default value is None :type relevanceThreshold: float (>=0) or None
:param includePerformanceSummary: If True this will store a performance summary (in Dataframe format) as attribute ('self.performanceSummary') in the esM instance. The performance summary includes Data about RAM usage (assesed by the psutil package), Gurobi values (extracted from gurobi log with the gurobi-logtools package) and other various paramerts such as model buildtime, runtime and time series aggregation paramerters. |br| * the default value is False :type includePerformanceSummary: boolean
Last edited: November 16, 2023 |br| @author: FINE Developer Team (FZJ IEK-3)
Source code in fine/energySystemModel.py
1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 | |
removeComponent
¶
Remove a component from the energy system.
:param componentName: name of the component that should be removed :type componentName: string
:param track: specifies if the removed components should be tracked or not |br| * the default value is False :type track: boolean
:returns: dictionary with the removed componentName and component instance if track is set to True else None. :rtype: dict or None
Source code in fine/energySystemModel.py
updateComponent
¶
Overwrite selected attributes of an existing esM component with new values.
.. note:: Be aware of the fact that some attributes are filled automatically while initializing a component. E.g., if you want to change attributes like economic lifetime, there might occur the error that the new value does not match with the technical lifetime of the component. Additionally: You cannot change the name of an existing component by using this function. If you do so, you will not update the component but create a new one with the new name. The old component will still exist.
:param componentName: Name of the component that shall be updated. :type componentName: str
:param updateAttrs: A dict of component attributes as keys and values that shall be set as dict values. :type updateAttrs: dict
Source code in fine/energySystemModel.py
ImplementedSolvers
¶
Implemented solvers.
Methods:
-
set_standard_solver–Detect available solver and set STANDARD_SOLVER accordingly.
set_standard_solver
classmethod
¶
Detect available solver and set STANDARD_SOLVER accordingly.
LinearOptimalPowerFlow
¶
LinearOptimalPowerFlow(
esM,
name,
commodity,
reactances,
losses=0,
distances=None,
hasCapacityVariable=True,
capacityVariableDomain="continuous",
capacityPerPlantUnit=1,
hasIsBuiltBinaryVariable=False,
bigM=None,
operationRateMax=None,
operationRateFix=None,
tsaWeight=1,
locationalEligibility=None,
capacityMin=None,
capacityMax=None,
partLoadMin=None,
sharedPotentialID=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,
stockCommissioning=None,
floorTechnicalLifetime=True,
)
Bases: Transmission
A LinearOptimalPowerFlow component shows the behavior of a Transmission component but additionally models a linearized power flow (i.e. for AC lines). The LinearOptimalPowerFlow class inherits from the Transmission class.
Create a LinearOptimalPowerFlow class instance. The LinearOptimalPowerFlow component specific input arguments are described below. The Transmission component specific input arguments are described in the Transmission class and the general component input arguments are described in the Component class.
Required arguments:
:param reactances: reactances for DC power flow modeling (of AC lines) given as a Pandas DataFrame. The row and column indices of the DataFrame have to equal the in the energy system model specified locations. :type reactances: Pandas DataFrame.
Methods:
-
addToEnergySystemModel–Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in
-
getDataForTimeSeriesAggregation–Get the required data if a time series aggregation is requested.
-
getTSAOutput–Return a reformatted time series data after applying time series aggregation, if the original time series
-
prepareTSAInput–Format the time series data of a component to fit the requirements of the time series aggregation package and
-
setAggregatedTimeSeriesData–Determine the aggregated maximum rate and the aggregated fixed operation rate.
-
setTimeSeriesData–Set the maximum operation rate and fixed operation rate depending on whether a time series analysis is requested or not.
Source code in fine/subclasses/lopf.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
addToEnergySystemModel
¶
Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in the esM, it is added as well.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
Source code in fine/component.py
getDataForTimeSeriesAggregation
¶
Get the required data if a time series aggregation is requested.
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/transmission.py
getTSAOutput
¶
Return a reformatted time series data after applying time series aggregation, if the original time series data is not None.
:param rate: Full (unclustered) time series data or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param data: Pandas DataFrame with the clustered time series data of all components in the energy system :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
:return: reformatted data or None :rtype: Pandas DataFrame
Source code in fine/component.py
prepareTSAInput
¶
Format the time series data of a component to fit the requirements of the time series aggregation package and return a list of formatted data.
:param rate: a fixed/maximum/minimum operation time series or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param rateWeight: weight of the time series in the clustering process :type rateWeight: positive float (>=0)
:param weightDict: dictionary to which the weight is added :type weightDict: dict
:param data: list to which the formatted data is added :type data: list of Pandas DataFrames
:param ip: investment period of transformation path analysis. :type ip: int
:return: data :rtype: Pandas DataFrame
Source code in fine/component.py
setAggregatedTimeSeriesData
¶
Determine the aggregated maximum rate and the aggregated fixed operation rate.
:param data: Pandas DataFrame with the clustered time series data of the conversion component :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/transmission.py
setTimeSeriesData
¶
Set the maximum operation rate and fixed operation rate depending on whether a time series analysis is requested or not.
:param hasTSA: states whether a time series aggregation is requested (True) or not (False). :type hasTSA: boolean
Source code in fine/transmission.py
Sink
¶
Sink(
esM,
name,
commodity,
hasCapacityVariable,
capacityVariableDomain="continuous",
capacityPerPlantUnit=1,
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,
commodityCost=0,
commodityRevenue=0,
commodityCostTimeSeries=None,
commodityRevenueTimeSeries=None,
opexPerCapacity=0,
opexIfBuilt=0,
QPcostScale=0,
interestRate=0.08,
economicLifetime=10,
technicalLifetime=None,
balanceLimitID=None,
pathwayBalanceLimitID=None,
stockCommissioning=None,
floorTechnicalLifetime=True,
)
Bases: Source
A Sink component can transfer a commodity over the energy system boundary out of the system.
Create a 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.
Methods:
-
addToEnergySystemModel–Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in
-
getDataForTimeSeriesAggregation–Get the required data if a time series aggregation is requested.
-
getTSAOutput–Return a reformatted time series data after applying time series aggregation, if the original time series
-
prepareTSAInput–Format the time series data of a component to fit the requirements of the time series aggregation package and
-
setAggregatedTimeSeriesData–Determine the aggregated maximum rate and the aggregated fixed operation rate.
-
setTimeSeriesData–Set the maximum operation rate, fixed operation rate, and cost or revenue time series depending on whether a time series analysis is requested or not.
Source code in fine/sourceSink.py
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | |
addToEnergySystemModel
¶
Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in the esM, it is added as well.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
Source code in fine/component.py
getDataForTimeSeriesAggregation
¶
Get the required data if a time series aggregation is requested.
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/sourceSink.py
getTSAOutput
¶
Return a reformatted time series data after applying time series aggregation, if the original time series data is not None.
:param rate: Full (unclustered) time series data or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param data: Pandas DataFrame with the clustered time series data of all components in the energy system :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
:return: reformatted data or None :rtype: Pandas DataFrame
Source code in fine/component.py
prepareTSAInput
¶
Format the time series data of a component to fit the requirements of the time series aggregation package and return a list of formatted data.
:param rate: a fixed/maximum/minimum operation time series or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param rateWeight: weight of the time series in the clustering process :type rateWeight: positive float (>=0)
:param weightDict: dictionary to which the weight is added :type weightDict: dict
:param data: list to which the formatted data is added :type data: list of Pandas DataFrames
:param ip: investment period of transformation path analysis. :type ip: int
:return: data :rtype: Pandas DataFrame
Source code in fine/component.py
setAggregatedTimeSeriesData
¶
Determine the aggregated maximum rate and the aggregated fixed operation rate.
:param data: Pandas DataFrame with the clustered time series data of the source component :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/sourceSink.py
setTimeSeriesData
¶
Set the maximum operation rate, fixed operation rate, and cost or revenue time series depending on whether a time series analysis is requested or not.
:param hasTSA: states whether a time series aggregation is requested (True) or not (False). :type hasTSA: boolean
Source code in fine/sourceSink.py
Source
¶
Source(
esM,
name,
commodity,
hasCapacityVariable,
capacityVariableDomain="continuous",
capacityPerPlantUnit=1,
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,
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,
pathwayBalanceLimitID=None,
stockCommissioning=None,
floorTechnicalLifetime=True,
pwlcfParameters=None,
)
Bases: Component
A Source component can transfer a commodity over the energy system boundary into the system.
Create a 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:
:param commodity: to the component related commodity. :type commodity: string
:param hasCapacityVariable: 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 -> hasCapacityVariable is False.
:type hasCapacityVariable: boolean
Default arguments: :param operationRateMin: if specified, indicates a minimum operation rate for each location and each time, if required also for each investment period, if 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. |br| * the default value is None :type operationRateMin:
* None
* 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.
* a dict
:param operationRateMax: if specified, indicates a maximum operation rate for each location and each time, if required also for each investment period, if 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. |br| * the default value is None :type operationRateMax:
* None
* 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.
* a dictionary with investment periods as keys and one of the two options above as values
:param operationRateFix: if specified, indicates a fixed operation rate for each location and each time, if required also for each investment period, 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. |br| * the default value is None :type operationRateFix:
* None
* Pandas DataFrame with positive (>=0) per investment period. 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.
* a dictionary with investment periods as keys and one of the two options above as values
:param commodityCostTimeSeries: if specified, indicates commodity cost rates for each location and each time step, if required also for each investment period, by a positive float. The values are given as specific values relative to the commodityUnit for each time step. |br| * the default value is None :type commodityCostTimeSeries:
* None
* 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.
* a dictionary with investment periods as keys and one of the two options above as values
:param commodityRevenueTimeSeries: if specified, indicates commodity revenue rate for each location and each time step, if required also for each investment period, by a positive float. The values are given as specific values relative to the commodityUnit for each time step. |br| * the default value is None :type commodityRevenueTimeSeries:
* None
* 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.
* a dictionary with investment periods as keys and one of the two options above as values
:param tsaWeight: weight with which the time series of the component should be considered when applying time series aggregation. |br| * the default value is 1 :type tsaWeight: positive (>= 0) float
:param 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 or a dictionary per investment period with one of the previous options. 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). |br| * the default value is 0 :type opexPerOperation:
* positive (>=0) float
* Pandas Series with positive (>=0) values. The indices of the series have to equal the in the energy system model specified locations.
* a dictionary with investment periods as keys and one of the two options above as values.
:param commodityCost: 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 or a dictionary per investment period with one of the two previous options. 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.
|br| * the default value is 0
:type commodityCost:
* positive (>=0) float
* Pandas Series with positive (>=0).The indices of the series have to equal the in the energy system model specified locations.
* a dictionary with investment periods as keys and one of the two options above as values.
:param commodityRevenue: 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 or a dictionary per investment period with one of the two previous options. 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
|br| * the default value is 0
:type commodityRevenue:
* positive (>=0) float
* Pandas Series with positive (>=0). The indices of the series have to equal the in the energy system model specified locations.
* a dictionary with investment periods as keys and one of the two options above as values.
:param balanceLimitID: 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. |br| * the default value is None :type balanceLimitID: string
:param pathwayBalanceLimitID: similar to balanceLimitID just as restriction over the entire pathway. |br| * the default value is None :type pathwayBalanceLimitID: string
Methods:
-
addToEnergySystemModel–Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in
-
getDataForTimeSeriesAggregation–Get the required data if a time series aggregation is requested.
-
getTSAOutput–Return a reformatted time series data after applying time series aggregation, if the original time series
-
prepareTSAInput–Format the time series data of a component to fit the requirements of the time series aggregation package and
-
setAggregatedTimeSeriesData–Determine the aggregated maximum rate and the aggregated fixed operation rate.
-
setTimeSeriesData–Set the maximum operation rate, fixed operation rate, and cost or revenue time series depending on whether a time series analysis is requested or not.
Source code in fine/sourceSink.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | |
addToEnergySystemModel
¶
Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in the esM, it is added as well.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
Source code in fine/component.py
getDataForTimeSeriesAggregation
¶
Get the required data if a time series aggregation is requested.
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/sourceSink.py
getTSAOutput
¶
Return a reformatted time series data after applying time series aggregation, if the original time series data is not None.
:param rate: Full (unclustered) time series data or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param data: Pandas DataFrame with the clustered time series data of all components in the energy system :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
:return: reformatted data or None :rtype: Pandas DataFrame
Source code in fine/component.py
prepareTSAInput
¶
Format the time series data of a component to fit the requirements of the time series aggregation package and return a list of formatted data.
:param rate: a fixed/maximum/minimum operation time series or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param rateWeight: weight of the time series in the clustering process :type rateWeight: positive float (>=0)
:param weightDict: dictionary to which the weight is added :type weightDict: dict
:param data: list to which the formatted data is added :type data: list of Pandas DataFrames
:param ip: investment period of transformation path analysis. :type ip: int
:return: data :rtype: Pandas DataFrame
Source code in fine/component.py
setAggregatedTimeSeriesData
¶
Determine the aggregated maximum rate and the aggregated fixed operation rate.
:param data: Pandas DataFrame with the clustered time series data of the source component :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/sourceSink.py
setTimeSeriesData
¶
Set the maximum operation rate, fixed operation rate, and cost or revenue time series depending on whether a time series analysis is requested or not.
:param hasTSA: states whether a time series aggregation is requested (True) or not (False). :type hasTSA: boolean
Source code in fine/sourceSink.py
Storage
¶
Storage(
esM,
name,
commodity,
chargeRate=1,
dischargeRate=1,
chargeEfficiency=1,
dischargeEfficiency=1,
selfDischarge=0,
cyclicLifetime=None,
stateOfChargeMin=0,
stateOfChargeMax=1,
hasCapacityVariable=True,
capacityVariableDomain="continuous",
capacityPerPlantUnit=1,
hasIsBuiltBinaryVariable=False,
bigM=None,
doPreciseTsaModeling=False,
chargeOpRateMax=None,
chargeOpRateFix=None,
chargeTsaWeight=1,
dischargeOpRateMax=None,
dischargeOpRateFix=None,
dischargeTsaWeight=1,
isPeriodicalStorage=False,
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,
opexPerChargeOperation=0,
opexPerDischargeOperation=0,
opexPerCapacity=0,
opexIfBuilt=0,
interestRate=0.08,
economicLifetime=10,
technicalLifetime=None,
floorTechnicalLifetime=True,
socOffsetDown=-1,
socOffsetUp=-1,
stockCommissioning=None,
pwlcfParameters=None,
)
Bases: Component
A Storage component can store a commodity and thus transfers it between time steps.
Create a Storage class instance. The Storage component specific input arguments are described below. The general component input arguments are described in the Component class.
Required arguments:
:param commodity: to the component related commodity. :type commodity: string
Default arguments:
:param chargeRate: ratio of the maximum storage inflow (in commodityUnit/hour) to the storage capacity (in commodityUnit).
Example: * A hydrogen salt cavern which can store 133 GWh_H2_LHV can be charged 0.45 GWh_H2_LHV during one hour. The chargeRate thus equals 0.45/133 1/h.
|br| * the default value is 1
:type chargeRate: 0 < float
:param dischargeRate: ratio of the maximum storage outflow (in commodityUnit/hour) to the storage capacity (in commodityUnit).
Example: * A hydrogen salt cavern which can store 133 GWh_H2_LHV can be discharged 0.45 GWh_H2_LHV during one hour. The dischargeRate thus equals 0.45/133.
|br| * the default value is 1
:type dischargeRate: 0 < float
:param chargeEfficiency: defines the efficiency with which the storage can be charged (equals the percentage of the injected commodity that is transformed into stored commodity). Enter 0.98 for 98% etc. |br| * the default value is 1 :type chargeEfficiency: 0 <= float <=1
:param dischargeEfficiency: defines the efficiency with which the storage can be discharged (equals the percentage of the withdrawn commodity that is transformed into stored commodity). Enter 0.98 for 98% etc. |br| * the default value is 1 :type dischargeEfficiency: 0 <= float <=1
:param selfDischarge: percentage of self-discharge from the storage during one hour |br| * the default value is 0 :type selfDischarge: 0 <= float <=1
:param cyclicLifetime: if specified, the total number of full cycle equivalents that are supported by the technology.
Setting this parameter introduces a commissioning-dependent charge operation
variable with one entry per *(loc, compName, commis, ip, p, t)* tuple.
This can significantly increase the number of optimization variables and
constraints, especially for models with many investment periods or long
technical lifetimes, and may noticeably increase solver runtime.
The state of charge is tracked for the total installed capacity, not
per commissioning year. As a result, the optimizer may allocate charge to a
single commissioning year beyond what its commissioned capacity could
physically hold, as long as the aggregate SoC constraint is satisfied.
|br| * the default value is None
:type cyclicLifetime: None or positive float
:param stateOfChargeMin: threshold (percentage) that the state of charge can not drop under |br| * the default value is 0 :type stateOfChargeMax: * 0 <= float <=1 * 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 match the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param stateOfChargeMax: threshold (percentage) that the state of charge can not exceed |br| * the default value is 1 :type stateOfChargeMax: * 0 <= float <=1 * 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 match the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param doPreciseTsaModeling: determines whether the state of charge is limited precisely (True) or with a simplified method (False). The error is small if the selfDischarge is small. |br| * the default value is False :type doPreciseTsaModeling: boolean
:param chargeOpRateMax: if specified, indicates a maximum charging 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 commodityUnit, referring to the charged commodity (before multiplying the charging efficiency) during one time step. |br| * the default value is None :type chargeOpRateMax: * None * 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 match the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param chargeOpRateFix: if specified, indicates a fixed charging 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 commodityUnit, referring to the charged commodity (before multiplying the charging efficiency) during one time step. |br| * the default value is None :type chargeOpRateFix: * None * 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 match the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param chargeTsaWeight: weight with which the chargeOpRate (max/fix) time series of the component should be considered when applying time series aggregation. |br| * the default value is 1 :type chargeTsaWeight: positive (>= 0) float
:param dischargeOpRateMax: if specified, indicates a maximum discharging 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 commodityUnit, referring to the discharged commodity (after multiplying the discharging efficiency) during one time step. |br| * the default value is None :type dischargeOpRateMax: * None * 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 match the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param dischargeOpRateFix: if specified, indicates a fixed discharging 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 commodityUnit, referring to the charged commodity (after multiplying the discharging efficiency) during one time step. |br| * the default value is None :type dischargeOpRateFix: * None * 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 match the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param dischargeTsaWeight: weight with which the dischargeOpRate (max/fix) time series of the component should be considered when applying time series aggregation. |br| * the default value is 1 :type dischargeTsaWeight: positive (>= 0) float
:param isPeriodicalStorage: indicates if the state of charge of the storage has to be at the same value after the end of each period. This is especially relevant when using daily periods where short term storage can be restrained to daily cycles. Benefits the run time of the model. |br| * the default value is False :type isPeriodicalStorage: boolean
:param opexPerChargeOperation: describes the cost for one unit of the charge operation. The cost which is directly proportional to the charge operation of the component is obtained by multiplying the opexPerChargeOperation parameter with the annual sum of the operational time series of the components. The opexPerChargeOperation can either be given as a float or a Pandas Series with location specific values or a dictionary per investment period with one of the two previous options. 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). |br| * the default value is 0 :type opexPerChargeOperation: positive (>=0) float or Pandas Series with positive (>=0) values or dict of positive (>=0) float or Pandas Series with positive (>=0) values per investment period. The indices of the series have to equal the in the energy system model specified locations.
:param opexPerDischargeOperation: describes the cost for one unit of the discharge operation. The cost which is directly proportional to the discharge operation of the component is obtained by multiplying the opexPerDischargeOperation parameter with the annual sum of the operational time series of the components. The opexPerDischargeOperation can either be given as a float or a Pandas Series with location specific values or a dictionary per investment period with one of the two previous options. 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). |br| * the default value is 0 :type opexPerDischargeOperation: * positive (>=0) float * Pandas Series with positive (>=0) values. The indices of the series have to equal the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param socOffsetDown: determines whether the state of charge at the end of a period p has to be equal to the one at the beginning of a period p+1 (socOffsetDown=-1) or if it can be smaller at the beginning of p+1 (socOffsetDown>=0). In the latter case, the product of the parameter socOffsetDown and the actual soc offset is used as a penalty factor in the objective function. |br| * the default value is -1 :type socOffsetDown: float
:param socOffsetUp: determines whether the state of charge at the end of a period p has to be equal to the one at the beginning of a period p+1 (socOffsetUp=-1) or if it can be larger at the beginning of p+1 (socOffsetUp>=0). In the latter case, the product of the parameter socOffsetUp and the actual soc offset is used as a penalty factor in the objective function. |br| * the default value is -1 :type socOffsetUp: float
Methods:
-
addToEnergySystemModel–Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in
-
getDataForTimeSeriesAggregation–Get the required data if a time series aggregation is requested.
-
getTSAOutput–Return a reformatted time series data after applying time series aggregation, if the original time series
-
prepareTSAInput–Format the time series data of a component to fit the requirements of the time series aggregation package and
-
setAggregatedTimeSeriesData–Determine the aggregated maximum rate and the aggregated fixed operation rate for charging and discharging.
-
setTimeSeriesData–Set the maximum operation rate and fixed operation rate for charging and discharging depending on whether a time series analysis is requested or not.
Source code in fine/storage.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
addToEnergySystemModel
¶
Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in the esM, it is added as well.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
Source code in fine/component.py
getDataForTimeSeriesAggregation
¶
Get the required data if a time series aggregation is requested.
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/storage.py
getTSAOutput
¶
Return a reformatted time series data after applying time series aggregation, if the original time series data is not None.
:param rate: Full (unclustered) time series data or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param data: Pandas DataFrame with the clustered time series data of all components in the energy system :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
:return: reformatted data or None :rtype: Pandas DataFrame
Source code in fine/component.py
prepareTSAInput
¶
Format the time series data of a component to fit the requirements of the time series aggregation package and return a list of formatted data.
:param rate: a fixed/maximum/minimum operation time series or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param rateWeight: weight of the time series in the clustering process :type rateWeight: positive float (>=0)
:param weightDict: dictionary to which the weight is added :type weightDict: dict
:param data: list to which the formatted data is added :type data: list of Pandas DataFrames
:param ip: investment period of transformation path analysis. :type ip: int
:return: data :rtype: Pandas DataFrame
Source code in fine/component.py
setAggregatedTimeSeriesData
¶
Determine the aggregated maximum rate and the aggregated fixed operation rate for charging and discharging.
:param data: Pandas DataFrame with the clustered time series data of the source component :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/storage.py
setTimeSeriesData
¶
Set the maximum operation rate and fixed operation rate for charging and discharging depending on whether a time series analysis is requested or not.
:param hasTSA: states whether a time series aggregation is requested (True) or not (False). :type hasTSA: boolean
Source code in fine/storage.py
Transmission
¶
Transmission(
esM,
name,
commodity,
losses=0,
distances=None,
hasCapacityVariable=True,
capacityVariableDomain="continuous",
capacityPerPlantUnit=1,
hasIsBuiltBinaryVariable=False,
bigM=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,
floorTechnicalLifetime=True,
balanceLimitID=None,
pathwayBalanceLimitID=None,
stockCommissioning=None,
pwlcfParameters=None,
)
Bases: Component
A Transmission component can transmit a commodity between locations of the energy system.
Create a Transmission class instance. The Transmission component specific input arguments are described below. The general component input arguments are described in the Component class.
Required arguments:
:param commodity: to the component related commodity. :type commodity: string
Default arguments:
:param losses: relative losses per lengthUnit (lengthUnit as specified in the energy system model) in percentage of the commodity flow. This loss factor can capture simple linear losses
.. math::
trans_{in, ij} = (1 - \\text{losses} \\cdot \\text{distances}) \\cdot trans_{out, ij}
(with trans being the commodity flow at a certain point in
time and i and j being locations in the energy system). The losses can either be given as a float or a
Pandas DataFrame with location specific values.
|br| * the default value is 0
:type losses: positive float (0 <= float <= 1) or Pandas DataFrame with positive values (0 <= float <= 1). The row and column indices of the DataFrame have to equal the in the energy system model specified locations.
:param distances: distances between locations given in the lengthUnit (lengthUnit as specified in the energy system model). |br| * the default value is None :type distances: positive float (>= 0) or Pandas DataFrame with positive values (>= 0). The row and column indices of the DataFrame have to equal the in the energy system model specified locations.
:param operationRateMax: if specified, indicates a maximum operation rate for all possible connections (both directions) of the transmission component at 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 commodityUnit, referring to the transmitted commodity (before considering losses) during one time step. |br| * the default value is None :type operationRateMax: * None * Pandas DataFrame with positive (>= 0) entries. The row indices have to match the in the energy system model specified time steps. The column indices are combinations of locations (as defined in the energy system model), separated by a underscore (e.g. "location1_location2"). The first location indicates where the commodity is coming from. The second location indicates where the commodity is going too. If a flow is specified from location i to location j, it also has to be specified from j to i. * a dictionary with investment periods as keys and one of the two options above as values.
:param operationRateFix: if specified, indicates a fixed operation rate for all possible connections (both directions) of the transmission component at 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 commodityUnit, referring to the transmitted commodity (before considering losses) during one time step. |br| * the default value is None :type operationRateFix: * None * Pandas DataFrame with positive (>= 0). The row indices have to match the in the energy system model specified time steps. The column indices are combinations of locations (as defined in the energy system model), separated by a underscore (e.g. "location1_location2"). The first location indicates where the commodity is coming from. The second one location indicates where the commodity is going too. If a flow is specified from location i to location j, it also has to be specified from j to i. * a dictionary with investment periods as keys and one of the two options above as values.
:param tsaWeight: weight with which the time series of the component should be considered when applying time series aggregation. |br| * the default value is 1 :type tsaWeight: positive (>= 0) float
:param 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 DataFrame with location specific values or a dictionary per investment period with one of the previous options. 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 value has to match the unit costUnit/operationUnit (e.g. Euro/kWh, Dollar/kWh). |br| * the default value is 0 :type opexPerOperation: * positive (>=0) float * Pandas DataFrame with positive (>=0).The row and column indices of the DataFrame have to equal the in the energy system model specified locations. * a dictionary with investment periods as keys and one of the two options above as values.
:param balanceLimitID: ID for the respective balance limit (out of the balance limits introduced in the esM). Should be specified if the respective component of the TransmissionModel 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. |br| * the default value is None :type balanceLimitID: string
:param pathwayBalanceLimitID: similar to balanceLimitID just as restriction over the entire pathway. |br| * the default value is None :type pathwayBalanceLimitID: string
Methods:
-
addToEnergySystemModel–Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in
-
getDataForTimeSeriesAggregation–Get the required data if a time series aggregation is requested.
-
getTSAOutput–Return a reformatted time series data after applying time series aggregation, if the original time series
-
prepareTSAInput–Format the time series data of a component to fit the requirements of the time series aggregation package and
-
setAggregatedTimeSeriesData–Determine the aggregated maximum rate and the aggregated fixed operation rate.
-
setTimeSeriesData–Set the maximum operation rate and fixed operation rate depending on whether a time series analysis is requested or not.
Source code in fine/transmission.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
addToEnergySystemModel
¶
Add the component to an EnergySystemModel instance (esM). If the respective component class is not already in the esM, it is added as well.
:param esM: EnergySystemModel instance representing the energy system in which the component should be modeled. :type esM: EnergySystemModel instance
Source code in fine/component.py
getDataForTimeSeriesAggregation
¶
Get the required data if a time series aggregation is requested.
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/transmission.py
getTSAOutput
¶
Return a reformatted time series data after applying time series aggregation, if the original time series data is not None.
:param rate: Full (unclustered) time series data or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param data: Pandas DataFrame with the clustered time series data of all components in the energy system :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
:return: reformatted data or None :rtype: Pandas DataFrame
Source code in fine/component.py
prepareTSAInput
¶
Format the time series data of a component to fit the requirements of the time series aggregation package and return a list of formatted data.
:param rate: a fixed/maximum/minimum operation time series or None :type rate: Pandas DataFrame or None
:param rateName: name of the time series (to ensure uniqueness if a component has multiple relevant time series) :type rateName: string
:param rateWeight: weight of the time series in the clustering process :type rateWeight: positive float (>=0)
:param weightDict: dictionary to which the weight is added :type weightDict: dict
:param data: list to which the formatted data is added :type data: list of Pandas DataFrames
:param ip: investment period of transformation path analysis. :type ip: int
:return: data :rtype: Pandas DataFrame
Source code in fine/component.py
setAggregatedTimeSeriesData
¶
Determine the aggregated maximum rate and the aggregated fixed operation rate.
:param data: Pandas DataFrame with the clustered time series data of the conversion component :type data: Pandas DataFrame
:param ip: investment period of transformation path analysis. :type ip: int
Source code in fine/transmission.py
setTimeSeriesData
¶
Set the maximum operation rate and fixed operation rate depending on whether a time series analysis is requested or not.
:param hasTSA: states whether a time series aggregation is requested (True) or not (False). :type hasTSA: boolean
Source code in fine/transmission.py
fixBinaryVariables
¶
Search for the optimized binary variables and set them as fixed.
:param esM: energy system model to which the component should be added. Used for unit checks. :type esM: EnergySystemModel instance from the FINE package
Source code in fine/expansionModules/optimizeTSAmultiStage.py
getShadowPrices
¶
getShadowPrices(
esM,
constraint,
ip=0,
dualValues=None,
hasTimeSeries=False,
periodOccurrences=None,
periodsOrder=None,
)
Get dual values of constraint ("shadow prices").
:param esM: considered energy system model :type esM: EnergySystemModel class instance
:param constraint: constraint from which the dual values should be obtained (e.g. pyM.commodityBalanceConstraint) :type constraint: pyomo.core.base.constraint.SimpleConstraint
:param ip: investment period of transformation path analysis. :type ip: int
:param dualValues: dual values of the optimized model instance. If it is not specified, it is set by using the function getDualValues(). |br| * the default value is None :type dualValues: None or Series
:param hasTimeSeries: If the constaint is time dependent, this parameter concatenates the dual values to a full time series (particularly usefull if time series aggregation was considered). |br| * the default value is False :type hasTimeSeries: bool
:param periodOccurrences: Only required if hasTimeSeries is set to True. |br| * the default value is None :type periodOccurrences: list or None
:param periodsOrder: Only required if hasTimeSeries is set to True. |br| * the default value is None :type periodsOrder: list or None
:return: Pandas Series with the dual values of the specified constraint
Source code in fine/IOManagement/standardIO.py
optimizeSimpleMyopic
¶
optimizeSimpleMyopic(
esM,
startYear,
endYear=None,
nbOfSteps=None,
nbOfRepresentedYears=None,
timeSeriesAggregation=True,
numberOfTypicalPeriods=7,
numberOfTimeStepsPerPeriod=24,
clusterMethod="hierarchical",
logFileName="",
threads=3,
solver="gurobi",
timeLimit=None,
optimizationSpecs="",
warmstart=False,
CO2Reference=366,
CO2ReductionTargets=None,
saveResults=True,
trackESMs=True,
)
Optimization function for myopic approach. For each optimization run, the newly installed capacities will be given as a stock (with capacityFix) to the next optimization run.
:param esM: EnergySystemModel instance representing the energy system which should be optimized by considering the transformation pathway (myopic foresight). :type esM: esM - EnergySystemModel instance
:param startYear: year of the first optimization :type startYear: int
Default arguments:
:param endYear: year of the last optimization :type endYear: int
:param nbOfSteps: number of optimization runs excluding the start year (minimum number of optimization runs is 2: one optimization for the start year and one for the end year). |br| * the default value is None :type nbOfSteps: int or None
:param noOfRepresentedYears: number of years represented by one optimization run |br| * the default value is None :type nbOfRepresentedYears: int or None
:param timeSeriesAggregation: 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).
|br| * the default value is False
:type timeSeriesAggregation: boolean
:param numberOfTypicalPeriods: states the number of typical periods into which the time series data should be clustered. The number of time steps per period must be an integer multiple of the total number of considered time steps in the energy system. This argument is used if timeSeriesAggregation is set to True. Note: Please refer to the tsam package documentation of the parameter noTypicalPeriods for more information. |br| * the default value is 7 :type numberOfTypicalPeriods: strictly positive integer
:param numberOfTimeStepsPerPeriod: states the number of time steps per period |br| * the default value is 24 :type numberOfTimeStepsPerPeriod: strictly positive integer
:param clusterMethod: states the method which is used in the tsam package for clustering the time series data. Options are for example 'averaging','k_means','exact k_medoid' or 'hierarchical'.
.. note::
Please refer to the tsam package documentation of the parameter clusterMethod for more information.
|br| * the default value is 'hierarchical'
:type clusterMethod: string
:param CO2Reference: gives the reference value of the CO2 emission to which the reduction should be applied to. The default value refers to the emissions of 1990 within the electricity sector (366kt CO2_eq) |br| * the default value is 366 :type CO2Reference: float
:param CO2ReductionTargets: specifies the CO2 reduction targets for all optimization periods. If specified, the length of the list must equal the number of optimization steps, and an object of the sink class which counts the CO2 emission is required. |br| * the default value is None :type CO2ReductionTargets: list of strictly positive integer or None
:param saveResults: specifies if the results are saves in excelfiles or not. |br| * the default value is True :type saveResults: boolean
:param trackESMs: specifies if the energy system model instances of each model run should be stored in a dictionary or not. It´s not recommended to track the ESMs if the model is quite big. |br| * the default value is True :type trackESMs: boolean
:returns: myopicResults: Store all optimization outputs in a dictionary for further analyses. If trackESMs is set to false, nothing is returned. :rtype: dict of all optimized instances of the EnergySystemModel class or None.
Source code in fine/expansionModules/transformationPath.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
optimizeTSAmultiStage
¶
optimizeTSAmultiStage(
esM,
declaresOptimizationProblem=True,
relaxIsBuiltBinary=False,
numberOfTypicalPeriods=30,
numberOfTimeStepsPerPeriod=24,
clusterMethod="hierarchical",
logFileName="",
threads=3,
solver="gurobi",
timeLimit=None,
optimizationSpecs="",
warmstart=False,
)
Call the optimize function for a temporally aggregated MILP (so the model has to include hasIsBuiltBinaryVariables in all or some components). Fix the binary variables and run it again without temporal aggregation. Furthermore, a LP with relaxed binary variables can be solved to obtain both, an upper and lower bound for the fully resolved MILP.
Required arguments:
:param esM: energy system model to which the component should be added. Used for unit checks. :type esM: EnergySystemModel instance from the FINE package
Default arguments:
:param declaresOptimizationProblem: states if the optimization problem should be declared (True) or not (False).
(a) If true, the declareOptimizationProblem function is called and a pyomo ConcreteModel instance is built.
(b) If false a previously declared pyomo ConcreteModel instance is used.
|br| * the default value is True
:type declaresOptimizationProblem: boolean
:param relaxIsBuiltBinary: states if the optimization problem should be solved as a relaxed LP to get the lower bound of the problem. |br| * the default value is False :type declaresOptimizationProblem: boolean
:param numberOfTypicalPeriods: states the number of typical periods into which the time series data should be clustered. The number of time steps per period must be an integer multiple of the total number of considered time steps in the energy system.
.. note::
Please refer to the tsam package documentation of the parameter noTypicalPeriods for more
information.
|br| * the default value is 30
:type numberOfTypicalPeriods: strictly positive integer
:param numberOfTimeStepsPerPeriod: states the number of time steps per period |br| * the default value is 24 :type numberOfTimeStepsPerPeriod: strictly positive integer
:param clusterMethod: states the method which is used in the tsam package for clustering the time series data. Options are for example 'averaging','k_means','exact k_medoid' or 'hierarchical'.
.. note::
Please refer to the tsam package documentation of the parameter clusterMethod for more information.
|br| * the default value is 'hierarchical'
:type clusterMethod: string
:param logFileName: logFileName is used for naming the log file of the optimization solver output if gurobi is used as the optimization solver. If the logFileName is given as an absolute path (e.g. logFileName = os.path.join(os.getcwd(), 'Results', 'logFileName.txt')) the log file will be stored in the specified directory. Otherwise, it will be stored by default in the directory where the executing python script is called. |br| * the default value is 'job' :type logFileName: string
:param threads: number of computational threads used for solving the optimization (solver dependent input) if gurobi is used as the solver. A value of 0 results in using all available threads. If a value larger than the available number of threads are chosen, the value will reset to the maximum number of threads. |br| * the default value is 3 :type threads: positive integer
:param solver: specifies which solver should solve the optimization problem (which of course has to be installed on the machine on which the model is run). |br| * the default value is 'gurobi' :type solver: string
:param timeLimit: if not specified as None, indicates the maximum solve time of the optimization problem in seconds (solver dependent input). The use of this parameter is suggested when running models in runtime restricted environments (such as clusters with job submission systems). If the runtime limitation is triggered before an optimal solution is available, the best solution obtained up until then (if available) is processed. |br| * the default value is None :type timeLimit: strictly positive integer or None
:param optimizationSpecs: specifies parameters for the optimization solver (see the respective solver documentation for more information). Example: 'LogToConsole=1 OptimalityTol=1e-6' |br| * the default value is an empty string ('') :type timeLimit: string
:param warmstart: specifies if a warm start of the optimization should be considered (not always supported by the solvers). |br| * the default value is False :type warmstart: boolean
Source code in fine/expansionModules/optimizeTSAmultiStage.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
plotLocationalColorMap
¶
plotLocationalColorMap(
esM,
compName,
locationsShapeFileName,
indexColumn,
ip=0,
perArea=True,
areaFactor=1000.0,
crs="EPSG:3035",
variableName="capacityVariablesOptimum",
doSum=False,
cmap="viridis",
vmin=0,
vmax=-1,
zlabel=None,
figsize=(6, 6),
fontsize=12,
save=False,
fileName="capacity.png",
dpi=200,
**kwargs,
)
Plot the data of a component for each location.
Required arguments:
:param esM: considered energy system model :type esM: EnergySystemModel class instance
:param compName: component name :type compName: string
:param locationsShapeFileName: file name or path to a shape file :type locationsShapeFileName: string
:param indexColumn: name of the column in which the location indices are stored :type indexColumn: string
Default arguments:
:param ip: investment period |br| * the default value is 0 :type ip: int
:param perArea: indicates if the capacity should be given per area |br| * the default value is False :type perArea: boolean
:param areaFactor: meter * areaFactor = km --> areaFactor = 1e3 (--> capacity/km) |br| * the default value is 1e3 :type areaFactor: scalar > 0
:param crs: coordinate reference system |br| * the default value is 'EPSG:3035' :type crs: string
:param variableName: parameter for plotting installed capacity ('_capacityVariablesOptimum') or operation ('_operationVariablesOptimum'). In case of plotting the operation, set the parameter doSum to True. |br| * the default value is '_capacityVariablesOptimum' :type variableName: string
:param doSum: indicates if the variable has to be summarized for the location (e.g. for operation variables) |br| * the default value is False :type doSum: boolean
:param cmap: heat map (color map) (see matplotlib options) |br| * the default value is 'viridis' :type cmap: string
:param vmin: minimum value in heat map |br| * the default value is 0 :type vmin: integer
:param vmax: maximum value in heat map. If -1, vmax is set to the maximum value of the operation time series. |br| * the default value is -1 :type vmax: integer
:param zlabel: z-label of the plot |br| * the default value is 'operation' :type zlabel: string
:param figsize: figure size in inches |br| * the default value is (12,4) :type figsize: tuple of positive floats
:param fontsize: font size of the axis |br| * the default value is 12 :type fontsize: positive float
:param save: indicates if figure should be saved |br| * the default value is False :type save: boolean
:param fileName: output file name |br| * the default value is 'capacity.png' :type fileName: string
:param dpi: resolution in dots per inch |br| * the default value is 200 :type dpi: scalar > 0
Source code in fine/IOManagement/standardIO.py
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | |
plotLocations
¶
plotLocations(
locationsShapeFileName,
indexColumn,
plotLocNames=False,
crs="EPSG:3035",
faceColor="none",
edgeColor="black",
fig=None,
ax=None,
linewidth=0.5,
figsize=(6, 6),
fontsize=12,
save=False,
fileName="",
dpi=200,
**kwargs,
)
Plot locations from a shape file.
Required arguments:
:param locationsShapeFileName: file name or path to a shape file :type locationsShapeFileName: string
:param indexColumn: name of the column in which the location indices are stored :type indexColumn: string
Default arguments:
:param plotLocNames: indicates if the names of the locations should be plotted |br| * the default value is False :type plotLocNames: boolean
:param crs: coordinate reference system |br| * the default value is 'EPSG:3035' :type crs: string
:param faceColor: face color of the plot |br| * the default value is 'none' :type faceColor: string
:param edgeColor: edge color of the plot |br| * the default value is 'black' :type edgeColor: string
:param fig: None or figure to which the plot should be added |br| * the default value is None :type fig: matplotlib Figure
:param ax: None or ax to which the plot should be added |br| * the default value is None :type ax: matplotlib Axis
:param linewidth: linewidth of the plot |br| * the default value is 0.5 :type linewidth: positive float
:param figsize: figure size in inches |br| * the default value is (6,6) :type figsize: tuple of positive floats
:param fontsize: font size of the axis |br| * the default value is 12 :type fontsize: positive float
:param save: indicates if figure should be saved |br| * the default value is False :type save: boolean
:param fileName: output file name |br| * the default value is 'operation.png' :type fileName: string
:param dpi: resolution in dots per inch |br| * the default value is 200 :type dpi: scalar > 0
Source code in fine/IOManagement/standardIO.py
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | |
plotOperation
¶
plotOperation(
esM,
compName,
loc,
ip=0,
locTrans=None,
tMin=0,
tMax=-1,
variableName="operationVariablesOptimum",
xlabel="time step",
ylabel="operation time series",
figsize=(12, 4),
color="k",
fontsize=12,
save=False,
fileName="operation.png",
dpi=200,
**kwargs,
)
Plot operation time series of a component at a location.
Required arguments:
:param esM: considered energy system model :type esM: EnergySystemModel class instance
:param compName: component name :type compName: string
:param loc: location :type loc: string
Default arguments:
:param ip: investment period |br| * the default value is 0 :type ip: int
:param locTrans: second location, required when Transmission components are plotted |br| * the default value is None :type locTrans: string
:param tMin: first time step to be plotted (starting from 0) |br| * the default value is 0 :type tMin: integer
:param tMax: last time step to be plotted |br| * the default value is -1 (i.e. the last available index) :type tMax: integer
:param variableName: name of the operation time series. Checkout the component model class to see which options are available. |br| * the default value is '_operationVariablesOptimum' :type variableName: string
:param xlabel: x-label of the plot |br| * the default value is 'time step' :type xlabel: string
:param ylabel: y-label of the plot |br| * the default value is 'operation time series' :type ylabel: string
:param figsize: figure size in inches |br| * the default value is (12,4) :type figsize: tuple of positive floats
:param color: color of the operation line |br| * the default value is 'k' :type color: string
:param fontsize: font size of the axis |br| * the default value is 12 :type fontsize: positive float
:param save: indicates if figure should be saved |br| * the default value is False :type save: boolean
:param fileName: output file name |br| * the default value is 'operation.png' :type fileName: string
:param dpi: resolution in dots per inch |br| * the default value is 200 :type dpi: scalar > 0
Source code in fine/IOManagement/standardIO.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
plotOperationColorMap
¶
plotOperationColorMap(
esM,
compName,
loc,
ip=0,
locTrans=None,
nbPeriods=365,
nbTimeStepsPerPeriod=24,
variableName="operationVariablesOptimum",
cmap="viridis",
vmin=0,
vmax=-1,
xlabel="period",
ylabel="timestep per period",
zlabel="",
figsize=(12, 4),
fontsize=12,
save=False,
fileName="",
xticks=None,
yticks=None,
xticklabels=None,
yticklabels=None,
monthlabels=False,
dpi=200,
pad=0.12,
aspect=15,
fraction=0.2,
orientation="horizontal",
**kwargs,
)
Plot operation time series of a component at a location.
Required arguments:
:param esM: considered energy system model :type esM: EnergySystemModel class instance
:param compName: component name :type compName: string
:param loc: location :type loc: string
Default arguments:
:param ip: investment period of transformation path analysis. :type ip: int
:param locTrans: second location, required when Transmission components are plotted |br| * the default value is None :type locTrans: string
:param nbPeriods: number of periods to be plotted |br| * the default value is 365 :type nbPeriods: integer
:param nbTimeStepsPerPeriod: time steps per period to be plotted (nbPeriods*nbTimeStepsPerPeriod=length of time series) |br| * the default value is 24 :type nbTimeStepsPerPeriod: integer
:param variableName: name of the operation time series. Checkout the component model class to see which options are available. |br| * the default value is '_operationVariablesOptimum' :type variableName: string
:param cmap: heat map (color map) (see matplotlib options) |br| * the default value is 'viridis' :type cmap: string
:param vmin: minimum value in heat map |br| * the default value is 0 :type vmin: integer
:param vmax: maximum value in heat map. If -1, vmax is set to the maximum value of the operation time series. |br| * the default value is -1 :type vmax: integer
:param xlabel: x-label of the plot |br| * the default value is 'day' :type xlabel: string
:param ylabel: y-label of the plot |br| * the default value is 'hour' :type ylabel: string
:param zlabel: z-label of the plot |br| * the default value is 'operation' :type zlabel: string
:param figsize: figure size in inches |br| * the default value is (12,4) :type figsize: tuple of positive floats
:param fontsize: font size of the axis |br| * the default value is 12 :type fontsize: positive float
:param save: indicates if figure should be saved |br| * the default value is False :type save: boolean
:param fileName: output file name |br| * the default value is 'operation.png' :type fileName: string
:param xticks: user specified ticks of the x axis |br| * the default value is None :type xticks: list
:param yticks: user specified ticks of the ý axis |br| * the default value is None :type yticks: list
:param xticklabels: user specified tick labels of the x axis |br| * the default value is None :type xticklabels: list
:param yticklabels: user specified tick labels of the ý axis |br| * the default value is None :type yticklabels: list
:param monthlabels: specifies if month labels are to be plotted (only works correctly if 365 days are specified as the number of periods) |br| * the default value is False :type monthlabels: boolean
:param dpi: resolution in dots per inch |br| * the default value is 200 :type dpi: scalar > 0
:param pad: pad parameter of colorbar |br| * the default value is 0.12 :type pad: float
:param aspect: aspect parameter of colorbar |br| * the default value is 15 :type aspect: float
:param fraction: fraction parameter of colorbar |br| * the default value is 0.2 :type fraction: float
:param orientation: orientation parameter of colorbar |br| * the default value is 'horizontal' :type orientation: float
Source code in fine/IOManagement/standardIO.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |
plotPieChart
¶
plotPieChart(
locFilePath,
results_df,
Property_to_plot="capacity",
indexColumn_in_shp="index",
color_list=[
"skyBlue",
"green",
"yellowGreen",
"#FFB732",
"yellow",
"darkOrange",
"#996300",
"steelBlue",
"darkBlue",
],
scaling_factor=500,
legend_fontsize=14,
)
Plot pie charts on a map.
Source code in fine/IOManagement/standardIO.py
1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | |
plotTransmission
¶
plotTransmission(
esM,
compName,
transmissionShapeFileName,
loc0,
loc1,
ip=0,
crs="EPSG:3035",
variableName="capacityVariablesOptimum",
color="k",
loc=7,
alpha=0.5,
ax=None,
fig=None,
linewidth=10,
figsize=(6, 6),
fontsize=12,
save=False,
fileName="",
dpi=200,
**kwargs,
)
Plot build transmission lines from a shape file.
Required arguments:
:param esM: considered energy system model :type esM: EnergySystemModel class instance
:param compName: component name :type compName: string
:param transmissionShapeFileName: file name or path to a shape file :type transmissionShapeFileName: string
:param loc0: name of the column in which the location indices are stored (e.g. start/end of line) :type loc0: string
:param loc1: name of the column in which the location indices are stored (e.g. end/start of line) :type loc1: string
Default arguments:
:param ip: investment periods |br| * the default value is 0 :type ip: int
:param crs: coordinate reference system |br| * the default value is 'EPSG:3035' :type crs: string
:param variableName: parameter for plotting installed capacity ('_capacityVariablesOptimum') or operation ('_operationVariablesOptimum'). |br| * the default value is '_capacityVariablesOptimum' :type variableName: string
:param color: color of the transmission line |br| * the default value is 'k' :type color: string
:param loc: location of the legend in the plot |br| * the default value is 7 :type loc: 0 <= integer <= 10
:param alpha: transparency of the legend |br| * the default value is 0.5 :type alpha: 0 <= scalar <= 1
:param fig: None or figure to which the plot should be added |br| * the default value is None :type fig: matplotlib Figure
:param ax: None or ax to which the plot should be added |br| * the default value is None :type ax: matplotlib Axis
:param linewidth: line width of the plot |br| * the default value is 0.5 :type linewidth: positive float
:param figsize: figure size in inches |br| * the default value is (6,6) :type figsize: tuple of positive floats
:param fontsize: font size of the axis |br| * the default value is 12 :type fontsize: positive float
:param save: indicates if figure should be saved |br| * the default value is False :type save: boolean
:param fileName: output file name |br| * the default value is 'operation.png' :type fileName: string
:param dpi: resolution in dots per inch |br| * the default value is 200 :type dpi: scalar > 0
Source code in fine/IOManagement/standardIO.py
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 | |