Skip to content

Commit

Permalink
Tightening QCWRTriModel for opf (#332)
Browse files Browse the repository at this point in the history
* update case5 to test non-contiguous bus ids
* tightening QC Tri
* update changelog
  • Loading branch information
kaarthiksundar authored and ccoffrin committed Jul 17, 2018
1 parent 11adcfa commit bf63d62
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PowerModels.jl Change Log
- nothing

### v0.8.1
- Strengthened the QCWRTri Power Flow formulation
- Added support for implicit single conductor to buspairs data
- Made add_setpoint more flexible when working with a mixture of data types
- Fixed a bug in TNEP voltage variable definitions
Expand Down
26 changes: 25 additions & 1 deletion src/form/wr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,29 @@ function variable_voltage(pm::GenericPowerModel{T}; kwargs...) where T <: QCWRTr
variable_current_magnitude_sqr(pm; kwargs...)
end

"qc lambda formulation based relaxation tightening"
function relaxation_tighten_vv(m, x, y, lambda_a, lambda_b)
x_ub = getupperbound(x)
x_lb = getlowerbound(x)
y_ub = getupperbound(y)
y_lb = getlowerbound(y)

@assert length(lambda_a) == 8
@assert length(lambda_b) == 8

val = [x_lb * y_lb
x_lb * y_lb
x_lb * y_ub
x_lb * y_ub
x_ub * y_lb
x_ub * y_lb
x_ub * y_ub
x_ub * y_ub]

@constraint(m, sum(lambda_a[i]*val[i] - lambda_b[i]*val[i] for i in 1:8) == 0)

+end

""
function constraint_voltage(pm::GenericPowerModel{T}, n::Int, c::Int) where T <: QCWRTriForm
v = var(pm, n, c, :vm)
Expand Down Expand Up @@ -814,6 +837,7 @@ function constraint_voltage(pm::GenericPowerModel{T}, n::Int, c::Int) where T <:
relaxation_cos(pm.model, td[bp], cs[bp])
InfrastructureModels.relaxation_trilinear(pm.model, v[i], v[j], cs[bp], wr[bp], lambda_wr[bp,:])
InfrastructureModels.relaxation_trilinear(pm.model, v[i], v[j], si[bp], wi[bp], lambda_wi[bp,:])
relaxation_tighten_vv(pm.model, v[i], v[j], lambda_wr[bp,:], lambda_wi[bp,:])

# this constraint is redudant and useful for debugging
#InfrastructureModels.relaxation_complex_product(pm.model, w[i], w[j], wr[bp], wi[bp])
Expand All @@ -830,4 +854,4 @@ function constraint_voltage(pm::GenericPowerModel{T}, n::Int, c::Int) where T <:
end
end

end
end
6 changes: 3 additions & 3 deletions test/opf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,13 @@ end
result = run_opf("../test/data/matpower/case3.m", QCWRTriPowerModel, ipopt_solver)

@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 5817.58; atol = 1e0)
@test isapprox(result["objective"], 5817.91; atol = 1e0)
end
@testset "5-bus asymmetric case" begin
result = run_opf("../test/data/matpower/case5_asym.m", QCWRTriPowerModel, ipopt_solver)

@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 15816.9; atol = 1e0)
@test isapprox(result["objective"], 15929.2; atol = 1e0)
end
@testset "5-bus gap case" begin
result = run_opf("../test/data/matpower/case5_gap.m", QCWRTriPowerModel, ipopt_solver)
Expand All @@ -436,7 +436,7 @@ end
result = run_opf("../test/data/matpower/case24.m", QCWRTriPowerModel, ipopt_solver)

@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 76752.3; atol = 1e0)
@test isapprox(result["objective"], 76785.4; atol = 1e0)
end
end

Expand Down

0 comments on commit bf63d62

Please sign in to comment.