Skip to content

Commit

Permalink
add no-load IEEE13 SDP test
Browse files Browse the repository at this point in the history
  • Loading branch information
NLaws committed Jul 28, 2024
1 parent 644dee7 commit d5f419a
Show file tree
Hide file tree
Showing 6 changed files with 322 additions and 50 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### transition to CommonOPF.Network (from CommonOPF.Inputs)
- add model_single_phase_network.jl and test build and solve
- this will replace model_single_phase.jl in next release
- remove `combine_parallel_lines!!` (maybe adapt it later for)
- remove `combine_parallel_lines!!`

## v0.4.3
- upgrade CommonOPF to v0.3.8
Expand Down
1 change: 1 addition & 0 deletions src/checks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Warnings express any values with rank greater than one.
function check_rank_one(m::JuMP.AbstractModel, net::Network, tol=1e-3)
for j in busses(net), t in 1:net.Ntimesteps
if j == net.substation_bus continue end
# TODO use LinearAlgebra.rank w/ atol kwarg
eigs = eigvals!(JuMP.value.(m[:H][t][j]))
eigs ./= maximum(eigs)
rank_H = sum(map(x-> x > tol ? 1 : 0, eigs))
Expand Down
8 changes: 5 additions & 3 deletions src/model_multi_phase_network.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ function add_variables(m, net::Network{MultiPhase}; PSD::Bool=true)
base_name="l_" * string(t) *"_"* string(i) *"_"* string(j) *"_"* string(phs1) * string(phs2),
upper_bound = net.bounds.i_upper^2,
lower_bound = 0.0, # diagonal values are real, positive
start = 0.01
)

m[:w][t][j][phs1, phs2] = @variable(m,
Expand All @@ -162,7 +163,7 @@ function add_variables(m, net::Network{MultiPhase}; PSD::Bool=true)
m[:l][t][i_j][phs1, phs2] = @variable(m,
set = ComplexPlane(), base_name="l_" * string(t) *"_"* string(i) *"_"* string(j) *"_"* string(phs1) * string(phs2),
upper_bound = net.bounds.i_upper^2 + im * net.bounds.i_upper^2,
# lower_bound = net.bounds.i_lower^2 + im * net.bounds.i_lower^2, # must have negative imaginary parts in Hermitian matrix
lower_bound = net.bounds.i_lower^2 + im * net.bounds.i_lower^2, # must have negative imaginary parts in Hermitian matrix
)

m[:w][t][j][phs1, phs2] = @variable(m,
Expand Down Expand Up @@ -190,7 +191,8 @@ function add_variables(m, net::Network{MultiPhase}; PSD::Bool=true)
m[:H][t][j] = M

@constraint(m, M in HermitianPSDCone())
else # SOC?
else
# SOC

end
end
Expand Down Expand Up @@ -254,7 +256,7 @@ function constrain_power_balance(m, net::Network{MultiPhase})

if j == net.substation_bus # include the slack power variables
m[:loadbalcons][j] = @constraint(m, [t in 1:net.Ntimesteps],
m[:Sj][t][j] + Sj[t, :]
m[:Sj][t][j] + Sj[t, :]
- diag(w[t][j] * conj(yj(j, net))) * net.Zbase # put yj in per-unit
- sum( diag( Sij[t][(j,k)] ) for k in j_to_k(j, net) )
.== 0
Expand Down
33 changes: 33 additions & 0 deletions test/data/case3_unbalanced.dss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Clear
New Circuit.3Bus_example
! define a really stiff source
~ basekv=0.4 pu=0.9959 MVAsc1=1e6 MVAsc3=1e6 basemva=0.5


New linecode.556MCM nphases=3 basefreq=50 ! ohms per 5 mile
~ rmatrix = ( 0.1000 | 0.0400 0.1000 | 0.0400 0.0400 0.1000)
~ xmatrix = ( 0.0583 | 0.0233 0.0583 | 0.0233 0.0233 0.0583)
~ cmatrix = (50.92958178940651 | -0 50.92958178940651 | -0 -0 50.92958178940651 ) ! small capacitance


New linecode.4/0QUAD nphases=3 basefreq=50 ! ohms per 100ft
~ rmatrix = ( 0.1167 | 0.0467 0.1167 | 0.0467 0.0467 0.1167)
~ xmatrix = (0.0667 | 0.0267 0.0667 | 0.0267 0.0267 0.0667 )
~ cmatrix = (50.92958178940651 | -0 50.92958178940651 | -0 -0 50.92958178940651 ) ! small capacitance


New Line.OHLine bus1=sourcebus.1.2.3 Primary.1.2.3 linecode = 556MCM length=1 ! 5 mile line
New Line.Quad Bus1=Primary.1.2.3 loadbus.1.2.3 linecode = 4/0QUAD length=1 ! 100 ft


New Load.L1 phases=1 loadbus.1.0 kV=( 0.4 3 sqrt / ) kW=9 kvar=3 model=1
New Load.L2 phases=1 loadbus.2.0 kV=( 0.4 3 sqrt / ) kW=6 kvar=3 model=1
New Load.L3 phases=1 loadbus.3.0 kV=( 0.4 3 sqrt / ) kW=6 kvar=3 model=1


Set voltagebases=[0.4]
Set tolerance=0.000001
set defaultbasefreq=50
Calcvoltagebases

Solve
94 changes: 94 additions & 0 deletions test/data/ieee13/IEEE13Nodeckt_no_trfxs.dss
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Clear

new circuit.IEEE13Nodeckt
~ basekv=4.16 pu=1.0 phases=3 bus1=650
~ MVAsc3=20000 MVASC1=20000 ! stiffen the source to approximate inf source


// these are local matrix line codes
// corrected 9-14-2011
New linecode.mtx601 nphases=3 BaseFreq=60
~ rmatrix = (0.3465 | 0.1560 0.3375 | 0.1580 0.1535 0.3414 )
~ xmatrix = (1.0179 | 0.5017 1.0478 | 0.4236 0.3849 1.0348 )
~ units=mi
New linecode.mtx602 nphases=3 BaseFreq=60
~ rmatrix = (0.7526 | 0.1580 0.7475 | 0.1560 0.1535 0.7436 )
~ xmatrix = (1.1814 | 0.4236 1.1983 | 0.5017 0.3849 1.2112 )
~ units=mi
New linecode.mtx603 nphases=2 BaseFreq=60
~ rmatrix = (1.3238 | 0.2066 1.3294 )
~ xmatrix = (1.3569 | 0.4591 1.3471 )
~ units=mi
New linecode.mtx604 nphases=2 BaseFreq=60
~ rmatrix = (1.3238 | 0.2066 1.3294 )
~ xmatrix = (1.3569 | 0.4591 1.3471 )
~ units=mi
New linecode.mtx605 nphases=1 BaseFreq=60
~ rmatrix = (1.3292 )
~ xmatrix = (1.3475 )
~ units=mi

New Linecode.mtx606 nphases=3 Units=mi
~ Rmatrix=[0.791721 |0.318476 0.781649 |0.28345 0.318476 0.791721 ]
~ Xmatrix=[0.438352 |0.0276838 0.396697 |-0.0184204 0.0276838 0.438352 ]
New linecode.mtx607 nphases=1 BaseFreq=60
~ rmatrix = (1.3425 )
~ xmatrix = (0.5124 )
~ units=mi


!LOAD DEFINITIONS
New Load.671 Bus1=671.1.2.3 Phases=3 Conn=Wye Model=1 kV=4.16 kW=1155 kvar=660
New Load.633a Bus1=633.1 Phases=1 Conn=Wye Model=1 kV=2.4 kW=160 kvar=110
New Load.633b Bus1=633.2 Phases=1 Conn=Wye Model=1 kV=2.4 kW=120 kvar=90
New Load.633c Bus1=633.3 Phases=1 Conn=Wye Model=1 kV=2.4 kW=120 kvar=90
New Load.645 Bus1=645.2 Phases=1 Conn=Wye Model=1 kV=2.4 kW=170 kvar=125
New Load.646 Bus1=646.3 Phases=1 Conn=Wye Model=1 kV=4.16 kW=230 kvar=132
New Load.692 Bus1=692.3 Phases=1 Conn=Wye Model=1 kV=4.16 kW=170 kvar=151
New Load.675a Bus1=675.1 Phases=1 Conn=Wye Model=1 kV=2.4 kW=485 kvar=190
New Load.675b Bus1=675.2 Phases=1 Conn=Wye Model=1 kV=2.4 kW=68 kvar=60
New Load.675c Bus1=675.3 Phases=1 Conn=Wye Model=1 kV=2.4 kW=290 kvar=212
New Load.611 Bus1=611.3 Phases=1 Conn=Wye Model=1 kV=2.4 kW=170 kvar=80
New Load.652 Bus1=652.1 Phases=1 Conn=Wye Model=1 kV=2.4 kW=128 kvar=86
New Load.670a Bus1=670.1 Phases=1 Conn=Wye Model=1 kV=2.4 kW=17 kvar=10
New Load.670b Bus1=670.2 Phases=1 Conn=Wye Model=1 kV=2.4 kW=66 kvar=38
New Load.670c Bus1=670.3 Phases=1 Conn=Wye Model=1 kV=2.4 kW=117 kvar=68

!CAPACITOR DEFINITIONS
!New Capacitor.Cap1 Bus1=675 phases=3 kVAR=600 kV=4.16
!New Capacitor.Cap2 Bus1=611.3 phases=1 kVAR=100 kV=2.4

!Bus 670 is the concentrated point load of the distributed load on line 632 to 671 located at 1/3 the distance from node 632

!LINE DEFINITIONS
New Line.659632 Phases=3 Bus1=650.1.2.3 Bus2=632.1.2.3 LineCode=mtx601 Length=0.3787878787878788 units=mi
New Line.632670 Phases=3 Bus1=632.1.2.3 Bus2=670.1.2.3 LineCode=mtx601 Length=0.12632575757575756 units=mi
New Line.670671 Phases=3 Bus1=670.1.2.3 Bus2=671.1.2.3 LineCode=mtx601 Length=0.2524621212121212 units=mi
New Line.671680 Phases=3 Bus1=671.1.2.3 Bus2=680.1.2.3 LineCode=mtx601 Length=0.1893939393939394 units=mi
New Line.632633 Phases=3 Bus1=632.1.2.3 Bus2=633.1.2.3 LineCode=mtx602 Length=0.0946969696969697 units=mi
New Line.632645 Phases=2 Bus1=632.2.3 Bus2=645.2.3 LineCode=mtx603 Length=0.0946969696969697 units=mi
New Line.645646 Phases=2 Bus1=645.2.3 Bus2=646.2.3 LineCode=mtx603 Length=0.0568181818181818 units=mi
New Line.692675 Phases=3 Bus1=692.1.2.3 Bus2=675.1.2.3 LineCode=mtx606 Length=0.0946969696969697 units=mi
New Line.671684 Phases=2 Bus1=671.1.3 Bus2=684.1.3 LineCode=mtx604 Length=0.05681818181818181 units=mi
New Line.684611 Phases=1 Bus1=684.3 Bus2=611.3 LineCode=mtx605 Length=0.05681818181818181 units=mi
New Line.684652 Phases=1 Bus1=684.1 Bus2=652.1 LineCode=mtx607 Length=0.15151515151515152 units=mi


!SWITCH DEFINITIONS
New Line.671692 Phases=3 Bus1=671 Bus2=692 Switch=y r1=1e-4 r0=1e-4 x1=0.000 x0=0.000 c1=0.000 c0=0.000

Set Voltagebases=[4.16]
calcv
Solve
!BusCoords IEEE13Node_BusXY.csv

!---------------------------------------------------------------------------------------------------------------------------------------------------
!----------------Show some Results -----------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------------------------


// Show Voltages LN Nodes
// Show Currents Elem
// Show Powers kVA Elem
// Show Losses
// Show Taps
Loading

0 comments on commit d5f419a

Please sign in to comment.