Skip to content

Commit

Permalink
Update endogenous_retirement.jl
Browse files Browse the repository at this point in the history
Moved the endogenous retirement discharge docstring to the appropriate location within the file
  • Loading branch information
sambuddhac authored Mar 18, 2024
1 parent 87ee894 commit 9aca15b
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/multi_stage/endogenous_retirement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@ 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
Expand Down Expand Up @@ -134,6 +121,24 @@ function endogenous_retirement!(EP::Model, inputs::Dict, setup::Dict)

end

@doc raw"""
endogenous_retirement_discharge!(EP::Model, inputs::Dict, num_stages::Int, cur_stage::Int, stage_lens::Array{Int, 1})
This function models the following constraint
```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 endogenous_retirement_discharge!(EP::Model, inputs::Dict, num_stages::Int, cur_stage::Int, stage_lens::Array{Int, 1})

println("Endogenous Retirement (Discharge) Module")
Expand Down

0 comments on commit 9aca15b

Please sign in to comment.