Skip to content
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

Use scale_factor in write_min/max_capacity_requirement.jl #599

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ function write_maximum_capacity_requirement(path::AbstractString, inputs::Dict,
dfMaxCapPrice = DataFrame(Constraint = [Symbol("MaxCapReq_$maxcap") for maxcap = 1:NumberOfMaxCapReqs],
Price=-dual.(EP[:cZoneMaxCapReq]))

# Generally the scale_factor is used to convert
# GW (in the model) back to MW (for output)
# and likewise for $M to $.
scale_factor = setup["ParameterScale"] == 1 ? ModelScalingFactor : 1

dfMaxCapPrice.Price *= scale_factor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
NumberOfMinCapReqs = inputs["NumberOfMinCapReqs"]
dfMinCapPrice = DataFrame(Constraint = [Symbol("MinCapReq_$mincap") for mincap = 1:NumberOfMinCapReqs],
Price= dual.(EP[:cZoneMinCapReq]))
if setup["ParameterScale"] == 1
dfMinCapPrice.Price *= ModelScalingFactor # Convert Million $/GW to $/MW
end

scale_factor = setup["ParameterScale"] == 1 ? ModelScalingFactor : 1

Check warning on line 6 in src/write_outputs/min_max_capacity_requirement/write_minimum_capacity_requirement.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/min_max_capacity_requirement/write_minimum_capacity_requirement.jl#L6

Added line #L6 was not covered by tests

dfMinCapPrice.Price *= scale_factor # Convert Million $/GW to $/MW

Check warning on line 8 in src/write_outputs/min_max_capacity_requirement/write_minimum_capacity_requirement.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/min_max_capacity_requirement/write_minimum_capacity_requirement.jl#L8

Added line #L8 was not covered by tests

if haskey(inputs, "MinCapPriceCap")
dfMinCapPrice[!,:Slack] = convert(Array{Float64}, value.(EP[:vMinCap_slack]))
dfMinCapPrice[!,:Penalty] = convert(Array{Float64}, value.(EP[:eCMinCap_slack]))
if setup["ParameterScale"] == 1
dfMinCapPrice.Slack *= ModelScalingFactor # Convert GW to MW
dfMinCapPrice.Penalty *= ModelScalingFactor^2 # Convert Million $ to $
end
end
dfMinCapPrice[!,:Slack] = convert(Array{Float64}, value.(EP[:vMinCap_slack]))
dfMinCapPrice[!,:Penalty] = convert(Array{Float64}, value.(EP[:eCMinCap_slack]))
dfMinCapPrice.Slack *= scale_factor # Convert GW to MW
dfMinCapPrice.Penalty *= scale_factor^2 # Convert Million $ to $

Check warning on line 14 in src/write_outputs/min_max_capacity_requirement/write_minimum_capacity_requirement.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/min_max_capacity_requirement/write_minimum_capacity_requirement.jl#L11-L14

Added lines #L11 - L14 were not covered by tests
end
CSV.write(joinpath(path, "MinCapReq_prices_and_penalties.csv"), dfMinCapPrice)
end