From 7a3ca00bf16916ec5e627c44a30fb2996a9f69fa Mon Sep 17 00:00:00 2001 From: lbonaldo Date: Wed, 14 Feb 2024 18:45:42 -0500 Subject: [PATCH] Merge with last PRs --- src/model/resources/hydro/hydro_res.jl | 2 +- .../write_operating_reserve_price_revenue.jl | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/model/resources/hydro/hydro_res.jl b/src/model/resources/hydro/hydro_res.jl index 2385891bc3..7d3da55db0 100644 --- a/src/model/resources/hydro/hydro_res.jl +++ b/src/model/resources/hydro/hydro_res.jl @@ -119,7 +119,7 @@ function hydro_res!(EP::Model, inputs::Dict, setup::Dict) CONSTRAINTSET = HYDRO_RES end - @constraint(EP, cHydroReservoirStart[y in CONSTRAINTSET,t in START_SUBPERIODS], EP[:vS_HYDRO][y,t] == EP[:vS_HYDRO][y, hoursbefore(p,t,1)]- (1/dfGen[y,:Eff_Down]*EP[:vP][y,t]) - vSPILL[y,t] + inputs["pP_Max"][y,t]*EP[:eTotalCap][y]) + @constraint(EP, cHydroReservoirStart[y in CONSTRAINTSET,t in START_SUBPERIODS], EP[:vS_HYDRO][y,t] == EP[:vS_HYDRO][y, hoursbefore(p,t,1)]- (1/efficiency_down(gen[y])*EP[:vP][y,t]) - vSPILL[y,t] + inputs["pP_Max"][y,t]*EP[:eTotalCap][y]) ### Constraints commmon to all reservoir hydro (y in set HYDRO_RES) ### @constraints(EP, begin diff --git a/src/write_outputs/reserves/write_operating_reserve_price_revenue.jl b/src/write_outputs/reserves/write_operating_reserve_price_revenue.jl index 769c8b9646..3e69afcef8 100644 --- a/src/write_outputs/reserves/write_operating_reserve_price_revenue.jl +++ b/src/write_outputs/reserves/write_operating_reserve_price_revenue.jl @@ -9,12 +9,18 @@ Function for reporting the operating reserve and regulation revenue earned by ge """ function write_operating_reserve_regulation_revenue(path::AbstractString, inputs::Dict, setup::Dict, EP::Model) scale_factor = setup["ParameterScale"] == 1 ? ModelScalingFactor : 1 - dfGen = inputs["dfGen"] + + gen = inputs["RESOURCES"] RSV = inputs["RSV"] REG = inputs["REG"] - dfOpRsvRevenue = DataFrame(Region = dfGen[RSV, :region], Resource = dfGen[RSV, :Resource], Zone = dfGen[RSV, :Zone], Cluster = dfGen[RSV, :cluster], AnnualSum = Array{Float64}(undef, length(RSV)),) - dfOpRegRevenue = DataFrame(Region = dfGen[REG, :region], Resource = dfGen[REG, :Resource], Zone = dfGen[REG, :Zone], Cluster = dfGen[REG, :cluster], AnnualSum = Array{Float64}(undef, length(REG)),) + regions = region.(gen) + clusters = cluster.(gen) + zones = zone_id.(gen) + names = inputs["RESOURCE_NAMES"] + + dfOpRsvRevenue = DataFrame(Region = regions[RSV], Resource = names[RSV], Zone = zones[RSV], Cluster = clusters[RSV], AnnualSum = Array{Float64}(undef, length(RSV)),) + dfOpRegRevenue = DataFrame(Region = regions[REG], Resource = names[REG], Zone = zones[REG], Cluster = clusters[REG], AnnualSum = Array{Float64}(undef, length(REG)),) weighted_reg_price = operating_regulation_price(EP, inputs, setup) weighted_rsv_price = operating_reserve_price(EP, inputs, setup)