-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Output correct CRM values for THERM plants with maintenance (#589)
- Loading branch information
Showing
4 changed files
with
74 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/write_outputs/capacity_reserve_margin/effective_capacity.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
@doc raw""" | ||
thermal_plant_effective_capacity(EP::Model, | ||
inputs::Dict, | ||
resources::Vector{Int}, | ||
capres_zone::Int, | ||
timesteps::Vector{Int})::Matrix{Float64} | ||
Effective capacity in a capacity reserve margin zone for certain resources in the given timesteps. | ||
""" | ||
function thermal_plant_effective_capacity( | ||
EP, | ||
inputs, | ||
resources::Vector{Int}, | ||
capres_zone::Int, | ||
timesteps::Vector{Int}, | ||
)::Matrix{Float64} | ||
eff_cap = | ||
thermal_plant_effective_capacity.( | ||
Ref(EP), | ||
Ref(inputs), | ||
resources, | ||
Ref(capres_zone), | ||
Ref(timesteps), | ||
) | ||
return reduce(hcat, eff_cap) | ||
end | ||
|
||
function thermal_plant_effective_capacity(EP::Model, inputs::Dict, y, capres_zone::Int) | ||
T = inputs["T"] | ||
timesteps = collect(1:T) | ||
return thermal_plant_effective_capacity(EP, inputs, y, capres_zone, timesteps) | ||
end | ||
|
||
function thermal_plant_effective_capacity( | ||
EP::Model, | ||
inputs::Dict, | ||
r_id::Int, | ||
capres_zone::Int, | ||
timesteps::Vector{Int}, | ||
)::Vector{Float64} | ||
y = r_id | ||
dfGen = inputs["dfGen"] | ||
capresfactor = dfGen[y, Symbol("CapRes_$capres_zone")] | ||
eTotalCap = value.(EP[:eTotalCap][y]) | ||
|
||
effective_capacity = fill(capresfactor * eTotalCap, length(timesteps)) | ||
|
||
if has_maintenance(inputs) && y in resources_with_maintenance(dfGen) | ||
adjustment = thermal_maintenance_capacity_reserve_margin_adjustment(EP, inputs, y, capres_zone, timesteps) | ||
effective_capacity = effective_capacity .+ value.(adjustment) | ||
end | ||
|
||
return effective_capacity | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters