From 7d5c8972b3f35311846d1798817778eb133e3ff9 Mon Sep 17 00:00:00 2001 From: David M Fobes Date: Thu, 9 May 2024 11:01:01 -0600 Subject: [PATCH] FIX: branch power magnitude bound --- src/form/en_acr.jl | 8 ++++---- src/form/en_shared.jl | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/form/en_acr.jl b/src/form/en_acr.jl index 4ab28882d..262249bb6 100644 --- a/src/form/en_acr.jl +++ b/src/form/en_acr.jl @@ -64,11 +64,11 @@ function constraint_mc_generator_power_wye(pm::AbstractExplicitNeutralACRModel, ( pg[idx]*vi_pn[idx] - qg[idx]*vr_pn[idx] )/( vr_pn[idx]^2 + vi_pn[idx]^2 ) ) pg_bus_unmerged = [ - [JuMP.@expression(pm.model, vr[p]*crg[idx]+vi[p]*cig[idx]) for (idx,p) in enumerate(phases)]..., + [JuMP.@expression(pm.model, -vr[p]*-crg[idx]-vi[p]*-cig[idx]) for (idx,p) in enumerate(phases)]..., JuMP.@expression(pm.model, vr[n]*sum(-crg[idx] for idx in 1:P)+vi[n]*sum(-cig[idx] for idx in 1:P)) ] qg_bus_unmerged = [ - [JuMP.@expression(pm.model, -vr[p]*cig[idx]+vi[p]*crg[idx]) for (idx,p) in enumerate(phases)]..., + [JuMP.@expression(pm.model, vr[p]*-cig[idx]-vi[p]*-crg[idx]) for (idx,p) in enumerate(phases)]..., JuMP.@expression(pm.model, -vr[n]*sum(-cig[idx] for idx in 1:P)+vi[n]*sum(-crg[idx] for idx in 1:P)) ] end @@ -124,8 +124,8 @@ function constraint_mc_generator_power_delta(pm::AbstractExplicitNeutralACRModel crg_bus = JuMP.@expression(pm.model, [idx in 1:P], crg[idx] - crg[idxs_prev[idx]]) cig_bus = JuMP.@expression(pm.model, [idx in 1:P], cig[idx] - cig[idxs_prev[idx]]) - pg_bus_unmerged = [JuMP.@expression(pm.model, vr[p]*crg_bus[idx]+vi[p]*cig_bus[idx]) for (idx,p) in enumerate(ph)] - qg_bus_unmerged = [JuMP.@expression(pm.model, -vr[p]*cig_bus[idx]+vi[p]*crg_bus[idx]) for (idx,p) in enumerate(ph)] + pg_bus_unmerged = [JuMP.@expression(pm.model, -vr[p]*-crg_bus[idx]-vi[p]*-cig_bus[idx]) for (idx,p) in enumerate(ph)] + qg_bus_unmerged = [JuMP.@expression(pm.model, vr[p]*-cig_bus[idx]-vi[p]*-crg_bus[idx]) for (idx,p) in enumerate(ph)] var(pm, nw, :pg_bus)[id] = pg_bus = _merge_bus_flows(pm, pg_bus_unmerged, connections) var(pm, nw, :qg_bus)[id] = qg_bus = _merge_bus_flows(pm, qg_bus_unmerged, connections) diff --git a/src/form/en_shared.jl b/src/form/en_shared.jl index 309ab7aea..dc087ba9a 100644 --- a/src/form/en_shared.jl +++ b/src/form/en_shared.jl @@ -138,7 +138,7 @@ function constraint_mc_current_balance(pm::RectangularVoltageExplicitNeutralMode + sum(crsw[a_sw][t] for (a_sw, conns) in bus_arcs_sw if t in conns) + sum(crt[a_trans][t] for (a_trans, conns) in bus_arcs_trans if t in conns) == - sum(crg[g][t] for (g, conns) in bus_gens if t in conns) + - sum(-crg[g][t] for (g, conns) in bus_gens if t in conns) - sum(crs[s][t] for (s, conns) in bus_storage if t in conns) - sum(crd[d][t] for (d, conns) in bus_loads if t in conns) - sum( Gt[idx,jdx]*vr[u] -Bt[idx,jdx]*vi[u] for (jdx,u) in ungrounded_terminals) # shunts @@ -148,7 +148,7 @@ function constraint_mc_current_balance(pm::RectangularVoltageExplicitNeutralMode + sum(cisw[a_sw][t] for (a_sw, conns) in bus_arcs_sw if t in conns) + sum(cit[a_trans][t] for (a_trans, conns) in bus_arcs_trans if t in conns) == - sum(cig[g][t] for (g, conns) in bus_gens if t in conns) + - sum(-cig[g][t] for (g, conns) in bus_gens if t in conns) - sum(cis[s][t] for (s, conns) in bus_storage if t in conns) - sum(cid[d][t] for (d, conns) in bus_loads if t in conns) - sum( Gt[idx,jdx]*vi[u] +Bt[idx,jdx]*vr[u] for (jdx,u) in ungrounded_terminals) # shunts @@ -206,7 +206,7 @@ function constraint_mc_power_balance(pm::RectangularVoltageExplicitNeutralModels + sum(psw[arc][t] for (arc, conns) in bus_arcs_sw if t in conns) + sum( pt[arc][t] for (arc, conns) in bus_arcs_trans if t in conns) == - sum(pg[gen][t] for (gen, conns) in bus_gens if t in conns) + - sum(-pg[gen][t] for (gen, conns) in bus_gens if t in conns) - sum(ps[strg][t] for (strg, conns) in bus_storage if t in conns) - sum(pd[load][t] for (load, conns) in bus_loads if t in conns) + ( -vr[t] * sum(Gt[idx,jdx]*vr[u]-Bt[idx,jdx]*vi[u] for (jdx,u) in ungrounded_terminals) @@ -220,7 +220,7 @@ function constraint_mc_power_balance(pm::RectangularVoltageExplicitNeutralModels + sum(qsw[arc][t] for (arc, conns) in bus_arcs_sw if t in conns) + sum( qt[arc][t] for (arc, conns) in bus_arcs_trans if t in conns) == - sum(qg[gen][t] for (gen, conns) in bus_gens if t in conns) + - sum(-qg[gen][t] for (gen, conns) in bus_gens if t in conns) - sum(qd[load][t] for (load, conns) in bus_loads if t in conns) - sum(qs[strg][t] for (strg, conns) in bus_storage if t in conns) + ( vr[t] * sum(Gt[idx,jdx]*vi[u]+Bt[idx,jdx]*vr[u] for (jdx,u) in ungrounded_terminals)