diff --git a/src/multi_stage/endogenous_retirement.jl b/src/multi_stage/endogenous_retirement.jl index 209ec71536..2750ef368c 100644 --- a/src/multi_stage/endogenous_retirement.jl +++ b/src/multi_stage/endogenous_retirement.jl @@ -10,6 +10,19 @@ inputs: * stage\_lens – An Int array representing the length $L$ of each model stage. returns: An Int representing the model stage in before which the resource must retire due to endogenous lifetime retirements. + +```math +\begin{aligned} +& RETCAP_{y,p} \geq \sum^p_{t=1} MINRET_{y,t} + \sum^r_{t=1}CAP_{y,t} - \sum^p_{t=1}RETCAP_{y,p} +\end{aligned} +``` +where $r \in \{1, ..., (p-1)\}$ is defined as the last stage such that if we built $y$ at the end of stage $r$, it would reach its end of life before the end of stage $p$. +In other words, it is the largest index $r \in \{1, ..., (p-1)\}$ such that: +```math +\begin{aligned} +\sum^p_{t=r+1}StageLength[t] \leq LifeTime[y] +\end{aligned} +``` """ function get_retirement_stage(cur_stage::Int, lifetime::Int, stage_lens::Array{Int, 1}) years_from_start = sum(stage_lens[1:cur_stage]) # Years from start from the END of the current stage