From f2ff6e6156091cdf1216074a372e8e66e92b27bd Mon Sep 17 00:00:00 2001 From: Jacob Schwartz Date: Wed, 29 Nov 2023 12:57:12 -0500 Subject: [PATCH] start functionizing thermal plants crm --- .../write_capacity_value.jl | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/write_outputs/capacity_reserve_margin/write_capacity_value.jl b/src/write_outputs/capacity_reserve_margin/write_capacity_value.jl index 1acae4ee7f..b2841c6e36 100644 --- a/src/write_outputs/capacity_reserve_margin/write_capacity_value.jl +++ b/src/write_outputs/capacity_reserve_margin/write_capacity_value.jl @@ -121,3 +121,23 @@ function capacity_reserve_margin_price(EP::Model, inputs::Dict, setup::Dict, cap scale_factor = setup["ParameterScale"] == 1 ? ModelScalingFactor : 1 return dual.(EP[:cCapacityResMargin][capres_zone, :]) ./ ω * scale_factor end + +function thermal_plant_effective_capacity(EP::Model, inputs::Dict, r_id::Int, capres_zone::Int)::Vector{Float} + y = r_id + T = inputs["T"] + dfGen = inputs["dfGen"] + capresfactor(y, capres) = dfGen[y, Symbol("CapRes_$capres")] + eTotalCap = value.(EP[:eTotalCap][y]) + + effective_capacity = capresfactor(y, capres_zone) * eTotalCap * ones(T) + + if has_maintenance(inputs) + resource_component(y) = dfGen[y, :Resource] + cap_size = dfGen[y, :Cap_Size] + down_var(y) = EP[Symbol(maintenance_down_name(resource_component(y)))] + vDOWN = value.(down_var(y)) + effective_capacity -= capresfactor(y, capres) * vDOWN * cap_size + end + + return effective_capacity +end