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

Fix #584: derating factor for VRE_STOR in write_capacity_value #618

Merged
merged 1 commit into from
Feb 1, 2024
Merged
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
21 changes: 14 additions & 7 deletions src/write_outputs/capacity_reserve_margin/write_capacity_value.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
DC_CHARGE_EX = intersect(DC_CHARGE, VRE_STOR_EX)
AC_CHARGE_EX = intersect(inputs["VS_STOR_AC_CHARGE"], VRE_STOR_EX)
dfVRE_STOR = inputs["dfVRE_STOR"]
crm_derate_vrestor(i, y::Vector{Int}) = by_rid_df(y, Symbol("CapResVreStor_$i"), dfVRE_STOR)'

Check warning on line 36 in src/write_outputs/capacity_reserve_margin/write_capacity_value.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/capacity_reserve_margin/write_capacity_value.jl#L36

Added line #L36 was not covered by tests
end

crm_derate(i, y::Vector{Int}) = dfGen[y, Symbol("CapRes_$i")]'
Expand Down Expand Up @@ -79,21 +80,27 @@
capvalue_dc_charge = zeros(T, G)
capvalue_dc_charge[riskyhour, DC_CHARGE] = capres_dc_charge ./ charge_eff

capvalue[riskyhour, VRE_STOR_EX] = crm_derate(i, VRE_STOR_EX) .* power(VRE_STOR_EX) ./ total_cap(VRE_STOR_EX)
capvalue[riskyhour, VRE_STOR_EX] = crm_derate_vrestor(i, VRE_STOR_EX) .* power(VRE_STOR_EX) ./ total_cap(VRE_STOR_EX)

Check warning on line 83 in src/write_outputs/capacity_reserve_margin/write_capacity_value.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/capacity_reserve_margin/write_capacity_value.jl#L83

Added line #L83 was not covered by tests

charge_vre_stor = value.(EP[:vCHARGE_VRE_STOR][VRE_STOR_STOR_EX, riskyhour].data)'
capvalue[riskyhour, VRE_STOR_STOR_EX] -= crm_derate(i, VRE_STOR_STOR_EX) .* charge_vre_stor ./ total_cap(VRE_STOR_STOR_EX)
capvalue[riskyhour, VRE_STOR_STOR_EX] -= crm_derate_vrestor(i, VRE_STOR_STOR_EX) .* charge_vre_stor ./ total_cap(VRE_STOR_STOR_EX)

Check warning on line 86 in src/write_outputs/capacity_reserve_margin/write_capacity_value.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/capacity_reserve_margin/write_capacity_value.jl#L86

Added line #L86 was not covered by tests

capvalue[riskyhour, DC_DISCHARGE_EX] += crm_derate(i, DC_DISCHARGE_EX) .* capvalue_dc_discharge[riskyhour, DC_DISCHARGE_EX] ./ total_cap(DC_DISCHARGE_EX)
capvalue[riskyhour, DC_DISCHARGE_EX] += crm_derate_vrestor(i, DC_DISCHARGE_EX) .* capvalue_dc_discharge[riskyhour, DC_DISCHARGE_EX] ./ total_cap(DC_DISCHARGE_EX)

Check warning on line 88 in src/write_outputs/capacity_reserve_margin/write_capacity_value.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/capacity_reserve_margin/write_capacity_value.jl#L88

Added line #L88 was not covered by tests
capres_ac_discharge = value.(EP[:vCAPRES_AC_DISCHARGE][AC_DISCHARGE_EX, riskyhour].data)'
capvalue[riskyhour, AC_DISCHARGE_EX] += crm_derate(i, AC_DISCHARGE_EX) .* capres_ac_discharge ./ total_cap(AC_DISCHARGE_EX)
capvalue[riskyhour, AC_DISCHARGE_EX] += crm_derate_vrestor(i, AC_DISCHARGE_EX) .* capres_ac_discharge ./ total_cap(AC_DISCHARGE_EX)

Check warning on line 90 in src/write_outputs/capacity_reserve_margin/write_capacity_value.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/capacity_reserve_margin/write_capacity_value.jl#L90

Added line #L90 was not covered by tests

capvalue[riskyhour, DC_CHARGE_EX] -= crm_derate(i, DC_CHARGE_EX) .* capvalue_dc_charge[riskyhour, DC_CHARGE_EX] ./ total_cap(DC_CHARGE_EX)
capvalue[riskyhour, DC_CHARGE_EX] -= crm_derate_vrestor(i, DC_CHARGE_EX) .* capvalue_dc_charge[riskyhour, DC_CHARGE_EX] ./ total_cap(DC_CHARGE_EX)

Check warning on line 92 in src/write_outputs/capacity_reserve_margin/write_capacity_value.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/capacity_reserve_margin/write_capacity_value.jl#L92

Added line #L92 was not covered by tests
capres_ac_charge = value.(EP[:vCAPRES_AC_CHARGE][AC_CHARGE_EX, riskyhour].data)'
capvalue[riskyhour, AC_CHARGE_EX] -= crm_derate(i, AC_CHARGE_EX) .* capres_ac_charge ./ total_cap(AC_CHARGE_EX)
capvalue[riskyhour, AC_CHARGE_EX] -= crm_derate_vrestor(i, AC_CHARGE_EX) .* capres_ac_charge ./ total_cap(AC_CHARGE_EX)

Check warning on line 94 in src/write_outputs/capacity_reserve_margin/write_capacity_value.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/capacity_reserve_margin/write_capacity_value.jl#L94

Added line #L94 was not covered by tests
end
capvalue = collect(transpose(capvalue))
temp_dfCapValue = DataFrame(Resource = inputs["RESOURCES"], Zone = dfGen.Zone, Reserve = fill(Symbol("CapRes_$i"), G))

# CapRes_* for all resources except VRE_STOR, CapResVreStor_* for VRE_STOR
reserve = Array{Symbol}(undef, G)
reserve[filter(x-> x ∉ VRE_STOR, dfGen.R_ID)] .= Symbol("CapRes_$i")
reserve[VRE_STOR] .= Symbol("CapResVreStor_$i")

Check warning on line 101 in src/write_outputs/capacity_reserve_margin/write_capacity_value.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/capacity_reserve_margin/write_capacity_value.jl#L99-L101

Added lines #L99 - L101 were not covered by tests

temp_dfCapValue = DataFrame(Resource = inputs["RESOURCES"], Zone = dfGen.Zone, Reserve = reserve)

Check warning on line 103 in src/write_outputs/capacity_reserve_margin/write_capacity_value.jl

View check run for this annotation

Codecov / codecov/patch

src/write_outputs/capacity_reserve_margin/write_capacity_value.jl#L103

Added line #L103 was not covered by tests
temp_dfCapValue = hcat(temp_dfCapValue, DataFrame(capvalue, :auto))
auxNew_Names = [Symbol("Resource"); Symbol("Zone"); Symbol("Reserve"); [Symbol("t$t") for t in 1:T]]
rename!(temp_dfCapValue, auxNew_Names)
Expand Down
Loading