Internal functions
Index
EnergyModelsInvestments.add_investment_constraintsEnergyModelsInvestments.capexEnergyModelsInvestments.capex_offsetEnergyModelsInvestments.get_var_addEnergyModelsInvestments.get_var_capexEnergyModelsInvestments.get_var_currentEnergyModelsInvestments.get_var_instEnergyModelsInvestments.get_var_invest_bEnergyModelsInvestments.get_var_remEnergyModelsInvestments.get_var_remove_bEnergyModelsInvestments.incrementEnergyModelsInvestments.invest_capacityEnergyModelsInvestments.lifetimeEnergyModelsInvestments.lifetime_modeEnergyModelsInvestments.max_addEnergyModelsInvestments.max_installedEnergyModelsInvestments.min_addEnergyModelsInvestments.set_capacity_costEnergyModelsInvestments.set_capacity_installationEnergyModelsInvestments.set_capex_discounterEnergyModelsInvestments.set_capex_valueEnergyModelsInvestments.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 aNodeor 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 aTwoLevelorTwoLevelTreestructure.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:
Investmentresults in provding a lower and upper bound to the variablevar_addthrough the functionsmin_addandmax_add. This approach is the default approach for all investment modes.BinaryInvestmentresults in setting the variablevar_invest_bas binary variable. Furthermore, the variablevar_currentis only able to be 0 or a provided value through the functioninvest_capacity.DiscreteInvestmentresults in setting the variablesvar_invest_bandvar_remove_bas positive integer variables. Furthermore, the variablevar_currentis only able to be equal to a multiple of a provided value through the functionincrement.SemiContiInvestmentresults in setting the variablevar_invest_bas binary variable. Furthermore, the variablevar_addis bound through the functionsmin_addandmax_addor 0.FixedInvestmentresults in setting the variablevar_invest_bas binary variable. Furthermore, the variablevar_currentis 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:
UnlimitedLiferesults in an unlimited investment. The investment costs do not consider any reinvestment or rest value.StudyLiferesults in the investment lasting for the whole study period with adequate reinvestments at end of lifetime and rest value.PeriodLiferesults 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.RollingLiferesults 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, 𝒯)forStudyLifeandduration(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.