Skip to content

Commit

Permalink
FIX: branch power magnitude bound
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudocubic committed May 9, 2024
1 parent f4e6f0d commit 7d5c897
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/form/en_acr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/form/en_shared.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 7d5c897

Please sign in to comment.