Internals
Index
EnergyModelsInvestments.add_investment_constraints
EnergyModelsInvestments.capex
EnergyModelsInvestments.capex_offset
EnergyModelsInvestments.get_var_add
EnergyModelsInvestments.get_var_capex
EnergyModelsInvestments.get_var_current
EnergyModelsInvestments.get_var_inst
EnergyModelsInvestments.get_var_invest_b
EnergyModelsInvestments.get_var_rem
EnergyModelsInvestments.get_var_remove_b
EnergyModelsInvestments.increment
EnergyModelsInvestments.invest_capacity
EnergyModelsInvestments.lifetime
EnergyModelsInvestments.lifetime_mode
EnergyModelsInvestments.max_add
EnergyModelsInvestments.max_installed
EnergyModelsInvestments.min_add
EnergyModelsInvestments.set_capacity_cost
EnergyModelsInvestments.set_capacity_installation
EnergyModelsInvestments.set_capex_discounter
EnergyModelsInvestments.set_capex_value
EnergyModelsInvestments.start_cap
Core functions
EnergyModelsInvestments.add_investment_constraints
— Functionadd_investment_constraints(
m,
element,
inv_data::AbstractInvData,
cap,
prefix,
𝒯ᴵⁿᵛ::TS.AbstractStratPers,
disc_rate::Float64,
)
Core function for introducing constraints on the investments. The constraints include introducing bounds on the available capacities as well as the calculation of the CAPEX.
The function calls two additional subroutines, set_capacity_installation
and set_capacity_cost
which are used for introducing bounds on the investment variables and calculating the CAPEX contribution of each investments. The utilization of subroutines allows the introduction of dispatch for the individual investment and lifetime options.
Arguments
m
: the JuMP model instance.element
: the element for which investment constraints should be added. Any potential element can be used. InEnergyModelsBase
, the individual element is either aNode
or aTransmissionMode
.inv_data::AbstractInvData
: the investment data for the node and capacitycap
.prefix
: the prefix used for variables for this element. This argument is used for extracting the individual investment variables.cap
: the field that is used if several capacities are provided.𝒯ᴵⁿᵛ::TS.AbstractStratPers
: the strategic periods structure. It can be created from both aTwoLevel
orTwoLevelTree
structure.disc_rate
: the discount rate used in the lifetime calculation for reinvestment and end of life calculations.
EnergyModelsInvestments.set_capacity_installation
— Functionset_capacity_installation(m, element, prefix, 𝒯ᴵⁿᵛ, inv_data, inv_mode)
Add constraints related to upper and lower bounds for investments depending on investment mode of type element
.
These constraints differ dependent on the chosen Investment
:
Investment
results in provding a lower and upper bound to the variablevar_add
through the functionsmin_add
andmax_add
. This approach is the default approach for all investment modes.BinaryInvestment
results in setting the variablevar_invest_b
as binary variable. Furthermore, the variablevar_current
is only able to be 0 or a provided value through the functioninvest_capacity
.DiscreteInvestment
results in setting the variablesvar_invest_b
andvar_remove_b
as positive integer variables. Furthermore, the variablevar_current
is only able to be equal to a multiple of a provided value through the functionincrement
.SemiContiInvestment
results in setting the variablevar_invest_b
as binary variable. Furthermore, the variablevar_add
is bound through the functionsmin_add
andmax_add
or 0.FixedInvestment
results in setting the variablevar_invest_b
as binary variable. Furthermore, the variablevar_current
is fixed to a provided value through the functioninvest_capacity
. This allows to incorporate the cost for the correct value of the objective function.
This function can be extended with a new method if you introduce a new Investment
. If not, you have to make certain that the functions min_add
and max_add
are applicable for your investment mode.
EnergyModelsInvestments.set_capacity_cost
— Functionset_capacity_cost(m, element, inv_data, prefix, 𝒯ᴵⁿᵛ, disc_rate)
Function for creating constraints for the variable var_capex
dependent on the chosen Investment
and LifetimeMode
.
The lifetime calculations are located within this function while the corresponding undiscounted CAPEX values are calculated in the function set_capex_value
, depending on the chosen investment mode.
It implements different versions of the lifetime implementation:
UnlimitedLife
results in an unlimited investment. The investment costs do not consider any reinvestment or rest value.StudyLife
results in the investment lasting for the whole study period with adequate reinvestments at end of lifetime and rest value.PeriodLife
results in the investment lasting only for the investment period, independent of the duration of the investment period. The excess lifetime is considered in the calculation of the rest value.RollingLife
results in the investment rolling to the next strategic periods. A capacity is retired at the end of its lifetime or the end of the previous strategic period if its lifetime ends between two strategic periods.
This function can be extended with a new method if you introduce a new LifetimeMode
. If not, you have to make certain that the function lifetime
is applicable for your lifetime mode.
EnergyModelsInvestments.set_capex_value
— Functionset_capex_value(m, element, inv_data, prefix, 𝒯ᴵⁿᵛ)
Calculate the cost value for the different investment modes of the investment data inv_data
for element element
.
Arguments
m
: the JuMP model instance.element
: the element type for which the absolute CAPEX should be calculated.r
: the discount rate.inv_data
: the investment data given as subtype ofAbstractInvData
.prefix
: the prefix used for variables for this element.𝒯ᴵⁿᵛ
: the strategic periods structure.
set_capex_value(m, element, inv_data, prefix, 𝒯ᴵⁿᵛ, ::Investment)
When no specialized method is defined for the investment mode, it calculates the capital cost based on the multiplication of the field capex
in inv_data
with the added capacity extracted from the model through the function get_var_add
.
set_capex_value(m, element, inv_data, prefix, 𝒯ᴵⁿᵛ, inv_mode::SemiContinuousOffsetInvestment)
When the investment mode is given by SemiContinuousOffsetInvestment
then there is an additional offset for the CAPEX.
Variable extraction functions
EnergyModelsInvestments.get_var_capex
— Functionget_var_capex(m, prefix::Symbol)
get_var_capex(m, prefix::Symbol, element)
Extracts the CAPEX variable with a given prefix
from the model or only the variable for the specified element
.
EnergyModelsInvestments.get_var_inst
— Functionget_var_inst(m, prefix::Symbol)
get_var_inst(m, prefix::Symbol, element)
Extracts the installed capacity variable with a given prefix
from the model or only the variable for the specified element
.
EnergyModelsInvestments.get_var_current
— Functionget_var_current(m, prefix::Symbol)
get_var_current(m, prefix::Symbol, element)
Extracts the current capacity variable with a given prefix
from the model or only the variable for the specified element
.
EnergyModelsInvestments.get_var_rem
— Functionget_var_rem(m, prefix::Symbol)
get_var_rem(m, prefix::Symbol, element)
Extracts the retired capacity variable with a given prefix
from the model or only the variable for the specified element
.
EnergyModelsInvestments.get_var_add
— Functionget_var_add(m, prefix::Symbol)
get_var_add(m, prefix::Symbol, element)
Extracts the investment capacity variable with a given prefix
from the model or only the variable for the specified element
.
EnergyModelsInvestments.get_var_invest_b
— Functionget_var_invest_b(m, prefix::Symbol)
get_var_invest_b(m, prefix::Symbol, element)
Extracts the binary investment variable with a given prefix
from the model or only the variable for the specified element
.
EnergyModelsInvestments.get_var_remove_b
— Functionget_var_remove_b(m, prefix::Symbol)
get_var_remove_b(m, prefix::Symbol, element)
Extracts the binary retirement variable with a given prefix
from the model or only the variable for the specified element
.
Functions for extracting fields
EnergyModelsInvestments.capex
— Functioncapex(inv_data::AbstractInvData)
capex(n::AbstractInvData, t_inv)
Returns the CAPEX of the investment data inv_data
as TimeProfile
or in investment period t_inv
.
EnergyModelsInvestments.max_installed
— Functionmax_installed(inv_data::AbstractInvData)
max_installed(inv_data::AbstractInvData, t_inv)
Returns the maximum allowed installed capacity the investment data inv_data
as TimeProfile
or in investment period t_inv
.
EnergyModelsInvestments.min_add
— Functionmin_add(inv_mode::Investment)
min_add(inv_mode::Investment, t_inv)
Returns the minimum allowed added capacity of the investment mode inv_mode
as TimeProfile
or in investment period t_inv
.
min_add(inv_data::AbstractInvData)
min_add(inv_data::AbstractInvData, t_inv)
Returns the minimum allowed added capacity of the investment data inv_data
as TimeProfile
or in investment period t_inv
.
EnergyModelsInvestments.max_add
— Functionmax_add(inv_mode::Investment)
max_add(inv_mode::Investment, t_inv)
Returns the maximum allowed added capacity of the investment mode inv_mode
as TimeProfile
or in investment period t_inv
.
max_add(inv_data::AbstractInvData)
max_add(inv_data::AbstractInvData, t_inv)
Returns the maximum allowed added capacity of the investment data inv_data
as TimeProfile
or in investment period t_inv
.
EnergyModelsInvestments.capex_offset
— Functioncapex_offset(inv_mode::SemiContinuousOffsetInvestment)
capex_offset(inv_mode::SemiContinuousOffsetInvestment, t_inv)
Returns the offset of the CAPEX of the investment mode inv_mode
as TimeProfile
or in investment period t_inv
.
capex_offset(inv_data::AbstractInvData)
capex_offset(inv_data::AbstractInvData, t_inv)
Returns the offset of the CAPEX of the investment data inv_data
as TimeProfile
or in investment period t_inv
.
EnergyModelsInvestments.invest_capacity
— Functioninvest_capacity(inv_mode::Investment)
invest_capacity(inv_mode::Investment, t_inv)
Returns the capacity investments of the investment mode inv_mode
as TimeProfile
or in investment period t_inv
.
invest_capacity(inv_data::AbstractInvData)
invest_capacity(inv_data::AbstractInvData, t_inv)
Returns the capacity investments of the investment data inv_data
as TimeProfile
or in investment period t_inv
.
EnergyModelsInvestments.increment
— Functionincrement(inv_mode::Investment)
increment(inv_mode::Investment, t_inv)
Returns the capacity increment of the investment mode inv_mode
as TimeProfile
or in investment period t_inv
.
increment(inv_data::AbstractInvData)
increment(inv_data::AbstractInvData, t_inv)
Returns the capacity increment of the investment data inv_data
as TimeProfile
or in investment period t_inv
.
EnergyModelsInvestments.lifetime_mode
— Functionlifetime_mode(inv_data::AbstractInvData)
Return the lifetime mode of the investment data inv_data
. By default, all investments are unlimited.
EnergyModelsInvestments.lifetime
— Functionlifetime(lifetime_mode::LifetimeMode)
lifetime(lifetime_mode::LifetimeMode, t_inv)
Return the lifetime of the lifetime mode lifetime_mode
as TimeProfile
or in investment period t_inv
.
lifetime(inv_data::AbstractInvData)
lifetime(inv_data::AbstractInvData, t_inv)
Return the lifetime of the investment data inv_data
as TimeProfile
or in investment period t_inv
.
Utility functions
EnergyModelsInvestments.set_capex_discounter
— Functionset_capex_discounter(years, lifetime, disc_rate)
Calculate the discounted values used in the lifetime calculations, when the LifetimeMode
is given by PeriodLife
and StudyLife
.
Arguments
years:
: the remaining years for calculating the discounted value. The years are depending on the consideredLifetimeMode
, usingremaining(t_inv, 𝒯)
forStudyLife
andduration(t_inv)
forPeriodLife
.lifetime
: the lifetime of the element.disc_rate
: the discount rate.
EnergyModelsInvestments.start_cap
— Functionstart_cap(element, t_inv, inv_data::AbstractInvData, cap)
Returns the starting capacity of the type element
in investment period t_inv
for capacity cap
.
If NoStartInvData
is used for the starting capacity, it requires the definition of a method for the corresponding element
.