-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output correct CRM values for THERM plants with maintenance #589
Merged
cfe316
merged 5 commits into
GenXProject:develop
from
cfe316:feature-output-correct-crm-for-maintenance
Dec 1, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f2ff6e6
start functionizing thermal plants crm
cfe316 6a4f821
Use thermal_effective_capacity function
cfe316 8289bf2
Use `fill` instead of * one. Format.
cfe316 f8fa6da
Experimental use of expressions
cfe316 66b8f10
eliminate unneeded function
cfe316 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could similarly use
weighted_price
to replace calls todual.(EP[:cCapResMargin][i, :])
on other lines but I felt that would be better as a separate "refactor" PR.