From 090feccf70c55b75cc2e799b752ba3d1d8ab4ee8 Mon Sep 17 00:00:00 2001 From: Jacob Schwartz Date: Tue, 5 Dec 2023 18:18:20 -0500 Subject: [PATCH] Fix #559: report electrolyzer power per-zone (#596) Previously, electrolyzers reported their power as if they were in every zone. --- src/write_outputs/write_power_balance.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/write_outputs/write_power_balance.jl b/src/write_outputs/write_power_balance.jl index 8db0b72a4c..ae45be8aed 100644 --- a/src/write_outputs/write_power_balance.jl +++ b/src/write_outputs/write_power_balance.jl @@ -49,8 +49,9 @@ function write_power_balance(path::AbstractString, inputs::Dict, setup::Dict, EP powerbalance[(z-1)*L+9, :] = -(value.(EP[:eLosses_By_Zone][z, :])) end powerbalance[(z-1)*L+10, :] = (((-1) * inputs["pD"][:, z]))' # Transpose - if (!isempty(ELECTROLYZER)) - powerbalance[(z-1)*L+11, :] = (-1) * sum(value.(EP[:vUSE][ELECTROLYZER, :].data), dims = 1) + if !isempty(ELECTROLYZER) + ELECTROLYZER_ZONE = intersect(dfGen[dfGen.Zone.==z, :R_ID], ELECTROLYZER) + powerbalance[(z-1)*L+11, :] = (-1) * sum(value.(EP[:vUSE][ELECTROLYZER_ZONE, :].data), dims = 1) end end if setup["ParameterScale"] == 1