Internals

Index

Core functions

EnergyModelsInvestments.add_investment_constraintsFunction
add_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. In EnergyModelsBase, the individual element is either a Node or a TransmissionMode.
  • inv_data::AbstractInvData: the investment data for the node and capacity cap.
  • 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 a TwoLevel or TwoLevelTree structure.
  • disc_rate: the discount rate used in the lifetime calculation for reinvestment and end of life calculations.
source
EnergyModelsInvestments.set_capacity_installationFunction
set_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 variable var_add through the functions min_add and max_add. This approach is the default approach for all investment modes.
  • BinaryInvestment results in setting the variable var_invest_b as binary variable. Furthermore, the variable var_current is only able to be 0 or a provided value through the function invest_capacity.
  • DiscreteInvestment results in setting the variables var_invest_b and var_remove_bas positive integer variables. Furthermore, the variable var_current is only able to be equal to a multiple of a provided value through the function increment.
  • SemiContiInvestment results in setting the variable var_invest_b as binary variable. Furthermore, the variable var_add is bound through the functions min_add and max_add or 0.
  • FixedInvestment results in setting the variable var_invest_b as binary variable. Furthermore, the variable var_current is fixed to a provided value through the function invest_capacity. This allows to incorporate the cost for the correct value of the objective function.
Introducing new investment modes

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.

source
EnergyModelsInvestments.set_capacity_costFunction
set_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.
Introducing new lifetime modes

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.

source
EnergyModelsInvestments.set_capex_valueFunction
set_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 of AbstractInvData.
  • prefix: the prefix used for variables for this element.
  • 𝒯ᴵⁿᵛ: the strategic periods structure.
source
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.

source
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.

source

Variable extraction functions

EnergyModelsInvestments.get_var_capexFunction
get_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.

source
EnergyModelsInvestments.get_var_instFunction
get_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.

source
EnergyModelsInvestments.get_var_currentFunction
get_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.

source
EnergyModelsInvestments.get_var_remFunction
get_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.

source
EnergyModelsInvestments.get_var_addFunction
get_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.

source
EnergyModelsInvestments.get_var_invest_bFunction
get_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.

source
EnergyModelsInvestments.get_var_remove_bFunction
get_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.

source

Functions for extracting fields

EnergyModelsInvestments.capexFunction
capex(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.

source
EnergyModelsInvestments.max_installedFunction
max_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.

source
EnergyModelsInvestments.min_addFunction
min_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.

source
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.

source
EnergyModelsInvestments.max_addFunction
max_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.

source
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.

source
EnergyModelsInvestments.capex_offsetFunction
capex_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.

source
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.

source
EnergyModelsInvestments.invest_capacityFunction
invest_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.

source
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.

source
EnergyModelsInvestments.incrementFunction
increment(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.

source
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.

source
EnergyModelsInvestments.lifetimeFunction
lifetime(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.

source
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.

source

Utility functions

EnergyModelsInvestments.set_capex_discounterFunction
set_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 considered LifetimeMode, using remaining(t_inv, 𝒯) for StudyLife and duration(t_inv) for PeriodLife.
  • lifetime: the lifetime of the element.
  • disc_rate: the discount rate.
source
EnergyModelsInvestments.start_capFunction
start_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.

source