Skip to content

Commit

Permalink
start functionizing thermal plants crm
Browse files Browse the repository at this point in the history
  • Loading branch information
cfe316 committed Nov 30, 2023
1 parent d1c6fa0 commit f2ff6e6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/write_outputs/capacity_reserve_margin/write_capacity_value.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f2ff6e6

Please sign in to comment.