From 550c55cd55929397ce0a0ecd5cc7ae707b00b01a Mon Sep 17 00:00:00 2001 From: Jacob Schwartz Date: Thu, 26 Oct 2023 13:31:50 -0400 Subject: [PATCH] Fix capres access --- src/model/resources/storage/storage_all.jl | 3 ++- src/model/resources/storage/storage_asymmetric.jl | 2 +- src/model/resources/storage/storage_symmetric.jl | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/model/resources/storage/storage_all.jl b/src/model/resources/storage/storage_all.jl index 990ce58bba..3d625d9cc1 100644 --- a/src/model/resources/storage/storage_all.jl +++ b/src/model/resources/storage/storage_all.jl @@ -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]) diff --git a/src/model/resources/storage/storage_asymmetric.jl b/src/model/resources/storage/storage_asymmetric.jl index 4149afec55..1623abb358 100644 --- a/src/model/resources/storage/storage_asymmetric.jl +++ b/src/model/resources/storage/storage_asymmetric.jl @@ -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]) diff --git a/src/model/resources/storage/storage_symmetric.jl b/src/model/resources/storage/storage_symmetric.jl index 20509ad861..23bbdfac64 100644 --- a/src/model/resources/storage/storage_symmetric.jl +++ b/src/model/resources/storage/storage_symmetric.jl @@ -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 @@ -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