# Internals

## Index

`EnergyModelsInvestments.add_investment_constraints`

`EnergyModelsInvestments.capex`

`EnergyModelsInvestments.capex`

`EnergyModelsInvestments.capex_offset`

`EnergyModelsInvestments.capex_offset`

`EnergyModelsInvestments.capex_offset`

`EnergyModelsInvestments.capex_offset`

`EnergyModelsInvestments.get_var_add`

`EnergyModelsInvestments.get_var_add`

`EnergyModelsInvestments.get_var_capex`

`EnergyModelsInvestments.get_var_capex`

`EnergyModelsInvestments.get_var_current`

`EnergyModelsInvestments.get_var_current`

`EnergyModelsInvestments.get_var_inst`

`EnergyModelsInvestments.get_var_inst`

`EnergyModelsInvestments.get_var_invest_b`

`EnergyModelsInvestments.get_var_invest_b`

`EnergyModelsInvestments.get_var_rem`

`EnergyModelsInvestments.get_var_rem`

`EnergyModelsInvestments.get_var_remove_b`

`EnergyModelsInvestments.get_var_remove_b`

`EnergyModelsInvestments.increment`

`EnergyModelsInvestments.increment`

`EnergyModelsInvestments.increment`

`EnergyModelsInvestments.increment`

`EnergyModelsInvestments.invest_capacity`

`EnergyModelsInvestments.invest_capacity`

`EnergyModelsInvestments.invest_capacity`

`EnergyModelsInvestments.invest_capacity`

`EnergyModelsInvestments.lifetime`

`EnergyModelsInvestments.lifetime`

`EnergyModelsInvestments.lifetime`

`EnergyModelsInvestments.lifetime`

`EnergyModelsInvestments.lifetime_mode`

`EnergyModelsInvestments.max_add`

`EnergyModelsInvestments.max_add`

`EnergyModelsInvestments.max_add`

`EnergyModelsInvestments.max_add`

`EnergyModelsInvestments.max_installed`

`EnergyModelsInvestments.max_installed`

`EnergyModelsInvestments.min_add`

`EnergyModelsInvestments.min_add`

`EnergyModelsInvestments.min_add`

`EnergyModelsInvestments.min_add`

`EnergyModelsInvestments.set_capacity_cost`

`EnergyModelsInvestments.set_capacity_installation`

`EnergyModelsInvestments.set_capex_discounter`

`EnergyModelsInvestments.set_capex_value`

`EnergyModelsInvestments.set_capex_value`

`EnergyModelsInvestments.set_capex_value`

`EnergyModelsInvestments.start_cap`

## Types

## Methods

`EnergyModelsInvestments.add_investment_constraints`

— Method```
add_investment_constraints(
m,
element,
inv_data::AbstractInvData,
cap,
prefix,
𝒯ᴵⁿᵛ::TS.StratPeriods,
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.StratPeriods`

: the strategic periods structure.`disc_rate`

: the discount rate used in the lifetime calculation for reinvestment and end of life calculations.

`EnergyModelsInvestments.capex`

— Method`capex(n::AbstractInvData, t_inv)`

Returns the CAPEX of the investment data `inv_data`

in investment period `t_inv`

.

`EnergyModelsInvestments.capex`

— Method`capex(inv_data::AbstractInvData)`

Returns the CAPEX of the investment data `inv_data`

as `TimeProfile`

.

`EnergyModelsInvestments.capex_offset`

— Method`capex_offset(inv_data::AbstractInvData, t_inv)`

Returns the offset of the CAPEX of the investment data `inv_data`

in investment period `t_inv`

.

`EnergyModelsInvestments.capex_offset`

— Method`capex_offset(inv_data::AbstractInvData)`

Returns the offset of the CAPEX of the investment data `inv_data`

as `TimeProfile`

.

`EnergyModelsInvestments.capex_offset`

— Method`capex_offset(inv_mode::SemiContinuousOffsetInvestment, t_inv)`

Returns the offset of the CAPEX of the investment mode `inv_mode`

in investment period `t_inv`

.

`EnergyModelsInvestments.capex_offset`

— Method`capex_offset(inv_mode::SemiContinuousOffsetInvestment)`

Returns the offset of the CAPEX of the investment mode `inv_mode`

as `TimeProfile`

.

`EnergyModelsInvestments.get_var_add`

— Method`get_var_add(m, prefix::Symbol, element)`

When the type `element`

is used as conditional input, it extracts only the variable for the specified element.

`EnergyModelsInvestments.get_var_add`

— Method`get_var_add(m, prefix::Symbol)`

Extracts the investment capacity variable with a given `prefix`

from the model.

`EnergyModelsInvestments.get_var_capex`

— Method`get_var_capex(m, prefix::Symbol, element)`

When the type `element`

is used as conditional input, it extracts only the variable for the specified element.

`EnergyModelsInvestments.get_var_capex`

— Method`get_var_capex(m, prefix::Symbol)`

Extracts the CAPEX variable with a given `prefix`

from the model.

`EnergyModelsInvestments.get_var_current`

— Method`get_var_current(m, prefix::Symbol, element)`

When the type `element`

is used as conditional input, it extracts only the variable for the specified element.

`EnergyModelsInvestments.get_var_current`

— Method`get_var_current(m, prefix::Symbol)`

Extracts the current capacity variable with a given `prefix`

from the model.

`EnergyModelsInvestments.get_var_inst`

— Method`get_var_inst(m, prefix::Symbol, element)`

`element`

is used as conditional input, it extracts only the variable for the specified element.

`EnergyModelsInvestments.get_var_inst`

— Method`get_var_inst(m, prefix::Symbol)`

Extracts the installed capacity variable with a given `prefix`

from the model.

`EnergyModelsInvestments.get_var_invest_b`

— Method`get_var_invest_b(m, prefix::Symbol, element)`

`element`

is used as conditional input, it extracts only the variable for the specified element.

`EnergyModelsInvestments.get_var_invest_b`

— Method`get_var_invest_b(m, prefix::Symbol)`

Extracts the binary investment variable with a given `prefix`

from the model.

`EnergyModelsInvestments.get_var_rem`

— Method`get_var_rem(m, prefix::Symbol, element)`

`element`

is used as conditional input, it extracts only the variable for the specified element.

`EnergyModelsInvestments.get_var_rem`

— Method`get_var_rem(m, prefix::Symbol)`

Extracts the retired capacity variable with a given `prefix`

from the model.

`EnergyModelsInvestments.get_var_remove_b`

— Method`get_var_remove_b(m, prefix::Symbol, element)`

`element`

is used as conditional input, it extracts only the variable for the specified element.

`EnergyModelsInvestments.get_var_remove_b`

— Method`get_var_remove_b(m, prefix::Symbol)`

Extracts the binary retirement variable with a given `prefix`

from the model.

`EnergyModelsInvestments.increment`

— Method`increment(inv_data::AbstractInvData, t_inv)`

Returns the capacity increment of the investment data `inv_data`

in investment period `t_inv`

.

`EnergyModelsInvestments.increment`

— Method`increment(inv_data::AbstractInvData)`

Returns the capacity increment of the investment data `inv_data`

as `TimeProfile`

.

`EnergyModelsInvestments.increment`

— Method`increment(inv_mode::Investment, t_inv)`

Returns the capacity increment of the investment mode `inv_mode`

in investment period `t_inv`

.

`EnergyModelsInvestments.increment`

— Method`increment(inv_mode::Investment)`

Returns the capacity increment of the investment mode `inv_mode`

as `TimeProfile`

.

`EnergyModelsInvestments.invest_capacity`

— Method`invest_capacity(inv_data::AbstractInvData, t_inv)`

Returns the capacity profile for investments of the investment data `inv_data`

in investment period `t_inv`

.

`EnergyModelsInvestments.invest_capacity`

— Method`invest_capacity(inv_data::AbstractInvData)`

Returns the capacity investments of the investment data `inv_data`

as `TimeProfile`

.

`EnergyModelsInvestments.invest_capacity`

— Method`invest_capacity(inv_mode::Investment, t_inv)`

Returns the capacity profile for investments of the investment mode `inv_mode`

in investment period `t_inv`

.

`EnergyModelsInvestments.invest_capacity`

— Method`invest_capacity(inv_mode::Investment)`

Returns the capacity investments of the investment mode `inv_mode`

as `TimeProfile`

.

`EnergyModelsInvestments.lifetime`

— Method`lifetime(inv_data::AbstractInvData, t_inv)`

Return the lifetime of the investment data `inv_data`

in investment period `t_inv`

.

`EnergyModelsInvestments.lifetime`

— Method`lifetime(inv_data::AbstractInvData)`

Return the lifetime of the investment data `inv_data`

as `TimeProfile`

.

`EnergyModelsInvestments.lifetime`

— Method`lifetime(lifetime_mode::LifetimeMode, t_inv)`

Return the lifetime of the lifetime mode `lifetime_mode`

in investment period `t_inv`

.

`EnergyModelsInvestments.lifetime`

— Method`lifetime(lifetime_mode::LifetimeMode)`

Return the lifetime of the lifetime mode `lifetime_mode`

as `TimeProfile`

.

`EnergyModelsInvestments.lifetime_mode`

— Method`lifetime_mode(inv_data::AbstractInvData)`

Return the lifetime mode of the investment data `inv_data`

. By default, all investments are unlimited.

`EnergyModelsInvestments.max_add`

— Method`max_add(inv_data::AbstractInvData, t_inv)`

Returns the maximum allowed added capacity of the investment data `inv_data`

in investment period `t_inv`

.

`EnergyModelsInvestments.max_add`

— Method`max_add(inv_data::AbstractInvData)`

Returns the maximum allowed added capacity of the investment data `inv_data`

as `TimeProfile`

.

`EnergyModelsInvestments.max_add`

— Method`max_add(inv_mode::Investment, t_inv)`

Returns the maximum allowed added capacity of the investment mode `inv_mode`

investment period `t_inv`

.

`EnergyModelsInvestments.max_add`

— Method`max_add(inv_mode::Investment)`

Returns the maximum allowed added capacity of the investment mode `inv_mode`

as `TimeProfile`

.

`EnergyModelsInvestments.max_installed`

— Method`max_installed(inv_data::AbstractInvData, t_inv)`

Returns the maximum allowed installed capacity of the investment data `inv_data`

in investment period `t_inv`

.

`EnergyModelsInvestments.max_installed`

— Method`max_installed(inv_data::AbstractInvData)`

Returns the maximum allowed installed capacity the investment data `inv_data`

as `TimeProfile`

.

`EnergyModelsInvestments.min_add`

— Method`min_add(inv_data::AbstractInvData, t_inv)`

Returns the minimum allowed added capacity of the investment data `inv_data`

in investment period `t_inv`

.

`EnergyModelsInvestments.min_add`

— Method`min_add(inv_data::AbstractInvData)`

Returns the minimum allowed added capacity of the investment data `inv_data`

as `TimeProfile`

.

`EnergyModelsInvestments.min_add`

— Method`min_add(inv_mode::Investment, t_inv)`

Returns the minimum allowed added capacity of the investment mode `inv_mode`

in investment period `t_inv`

.

`EnergyModelsInvestments.min_add`

— Method`min_add(inv_mode::Investment)`

Returns the minimum allowed added capacity of the investment mode `inv_mode`

as `TimeProfile`

.

`EnergyModelsInvestments.set_capacity_cost`

— Method`set_capacity_cost(m, element, inv_data, prefix, 𝒯ᴵⁿᵛ, disc_rate)`

Set the capex_cost based on the technology investment cost, and strategic period length to include the needs for reinvestments and the rest value. It implements different versions of the lifetime implementation:

- UnlimitedLife: The investment life is not limited. The investment costs do not consider any reinvestment or rest value.
- StudyLife: The investment last for the whole study period with adequate reinvestments at end of lifetime and rest value.
- PeriodLife: The investment is considered to last only for the strategic period. the excess lifetime is considered in the rest value.
- RollingLife: The investment is rolling to the next strategic periods and it is retired at the end of its lifetime or the end of the previous sp if its lifetime ends between two sp.

`EnergyModelsInvestments.set_capacity_installation`

— Method`set_capacity_installation(m, element, prefix, 𝒯ᴵⁿᵛ, inv_mode)`

Add constraints related to installation depending on investment mode of type `element`

.

`EnergyModelsInvestments.set_capex_discounter`

— Method`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.

`EnergyModelsInvestments.set_capex_value`

— Method`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.

`EnergyModelsInvestments.set_capex_value`

— Method`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.

`EnergyModelsInvestments.set_capex_value`

— Method`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.

`EnergyModelsInvestments.start_cap`

— Method`start_cap(element, t_inv, inv_data::AbstractInvData, cap)`

Returns the starting capacity of the type `element`

in the first investment period. If `NoStartInvData`

is used for the starting capacity, it requires the definition of a method for the corresponding `element`

.