Skip to content

Commit

Permalink
Fix capres access
Browse files Browse the repository at this point in the history
  • Loading branch information
cfe316 committed Oct 26, 2023
1 parent 5b4b2e1 commit 550c55c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/model/resources/storage/storage_all.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ function storage_all_reserves!(EP::Model, inputs::Dict, setup::Dict)
add_similar_to_expression!(expr[STOR_REG, :], vREG_discharge[STOR_REG, :])
add_similar_to_expression!(expr[STOR_RSV, :], vRSV_discharge[STOR_RSV, :])
if CapacityReserveMargin > 0
add_similar_to_expression!(expr[STOR_ALL, :], EP[:vCAPRES_discharge][STOR_ALL, :])
vCAPRES_discharge = EP[:vCAPRES_discharge]
add_similar_to_expression!(expr[STOR_ALL, :], vCAPRES_discharge[STOR_ALL, :])
end
# Maximum discharging rate and contribution to reserves up must be less than power rating
@constraint(EP, [y in STOR_ALL, t in T], expr[y, t] <= eTotalCap[y])
Expand Down
2 changes: 1 addition & 1 deletion src/model/resources/storage/storage_asymmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ function storage_asymmetric_reserves!(EP::Model, inputs::Dict, setup::Dict)

vCHARGE = EP[:vCHARGE]
vREG_charge = EP[:vREG_charge]
vCAPRES_charge = EP[:vCAPRES_charge]
eTotalCapCharge = EP[:eTotalCapCharge]

expr = @expression(EP, [y in STOR_ASYMMETRIC, t in T], 1 * vCHARGE[y, t]) # NOTE load-bearing "1 *"
add_similar_to_expression!(expr[STOR_ASYM_REG, :], vREG_charge[STOR_ASYM_REG, :])
if CapacityReserveMargin
vCAPRES_charge = EP[:vCAPRES_charge]
add_similar_to_expression!(expr[STOR_ASYMMETRIC, :], vCAPRES_charge[STOR_ASYMMETRIC, :])
end
@constraint(EP, [y in STOR_ASYMMETRIC, t in T], expr[y, t] <= eTotalCapCharge[y])
Expand Down
4 changes: 2 additions & 2 deletions src/model/resources/storage/storage_symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ function storage_symmetric_reserves!(EP::Model, inputs::Dict, setup::Dict)
vRSV_charge = EP[:vRSV_charge]
vREG_discharge = EP[:vREG_discharge]
vRSV_discharge = EP[:vRSV_discharge]
vCAPRES_charge = EP[:vCAPRES_charge]
vCAPRES_discharge = EP[:vCAPRES_discharge]
eTotalCap = EP[:eTotalCap]

# Maximum charging rate plus contribution to regulation down must be less than symmetric power rating
Expand All @@ -72,6 +70,8 @@ function storage_symmetric_reserves!(EP::Model, inputs::Dict, setup::Dict)
add_similar_to_expression!(expr[REG, :], vREG_discharge[REG, :])
add_similar_to_expression!(expr[RSV, :], vRSV_discharge[RSV, :])
if CapacityReserveMargin
vCAPRES_charge = EP[:vCAPRES_charge]
vCAPRES_discharge = EP[:vCAPRES_discharge]
add_similar_to_expression!(expr[SYMMETRIC, :], vCAPRES_charge[SYMMETRIC, :])
add_similar_to_expression!(expr[SYMMETRIC, :], vCAPRES_discharge[SYMMETRIC, :])
end
Expand Down

0 comments on commit 550c55c

Please sign in to comment.