Skip to content

Commit

Permalink
export and use CommonOPF.opf_results
Browse files Browse the repository at this point in the history
  • Loading branch information
NLaws committed Aug 26, 2024
1 parent 1e36cfe commit ad9e1a4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/BranchFlowModel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export
splitting_busses,
Network_IEEE13_SinglePhase,
Network_Papavasiliou_2018,
Results,
opf_results,
reduce_tree!,
# end new methods TODO distinguish all exports by module

Expand Down
2 changes: 2 additions & 0 deletions src/model_multi_phase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ function add_sdp_variables(m, net::Network{MultiPhase})
# Hermitian PSD matrices
m[:H] = multiphase_bus_variable_container()

net.var_names = [:w, :l, :Sij, :sj]

for t in 1:net.Ntimesteps
m[:w][net.substation_bus][t] = substation_voltage_squared(net)
# slack bus power injection
Expand Down
1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ end
vsqrd = get_variable_values(:vsqrd, m)
vs = Dict(k => sqrt.(v) for (k,v) in vsqrd)

# I = get_variable_values(:lij, m, p)
for b in keys(vs)
try
@test abs(vs[b][1] - dss_voltages[b][1]) < 0.005
Expand Down
8 changes: 4 additions & 4 deletions test/test_nlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@

@test termination_status(m) in [MOI.OPTIMAL, MOI.ALMOST_OPTIMAL, MOI.LOCALLY_SOLVED]

vs = Dict(
b => abs.(JuMP.value.(m[:v][b][1]))
for b in busses(net)
)
r = CPF.opf_results(m, net)

# remove time indices from results for convenience
vs = Dict(b => abs.(vv[1]) for (b, vv) in pairs(r[:v]))

i_ij = Dict(
e => JuMP.value.(m[:i][e][1])
Expand Down

0 comments on commit ad9e1a4

Please sign in to comment.