From bfb47619e8e48d498c5ccf781ffb0d935100a7a5 Mon Sep 17 00:00:00 2001 From: ccoffrin Date: Fri, 11 May 2018 15:31:47 -0600 Subject: [PATCH] update to PowerModels v0.7 --- REQUIRE | 3 ++- src/PowerModelsGMD.jl | 3 ++- src/core/constraint.jl | 2 +- src/form/wr.jl | 20 ++++++++++---------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/REQUIRE b/REQUIRE index 3fb4075..93c2396 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,6 +1,7 @@ julia 0.6 -PowerModels 0.6 0.7- +PowerModels 0.7 0.8- +InfrastructureModels 0.0.4 0.2- CurveFit Compat 0.26.0 diff --git a/src/PowerModelsGMD.jl b/src/PowerModelsGMD.jl index 232733d..eb82585 100644 --- a/src/PowerModelsGMD.jl +++ b/src/PowerModelsGMD.jl @@ -1,8 +1,9 @@ isdefined(Base, :__precompile__) && __precompile__() module PowerModelsGMD - using PowerModels using JuMP + using InfrastructureModels + using PowerModels using CurveFit using Memento diff --git a/src/core/constraint.jl b/src/core/constraint.jl index a041267..66926fb 100644 --- a/src/core/constraint.jl +++ b/src/core/constraint.jl @@ -123,7 +123,7 @@ function constraint_dc_ohms_on_off{T}(pm::GenericPowerModel{T}, n::Int, i, gs, v z = pm.var[:nw][n][:branch_z][ac_branch] @constraint(pm.model, v_dc_diff == vf - vt) - PowerModels.relaxation_product(pm.model, z, v_dc_diff, vz) + InfrastructureModels.relaxation_product(pm.model, z, v_dc_diff, vz) @constraint(pm.model, dc == gs*(vz + z*vs) ) end diff --git a/src/form/wr.jl b/src/form/wr.jl index b1b4813..d2923b2 100644 --- a/src/form/wr.jl +++ b/src/form/wr.jl @@ -76,7 +76,7 @@ function constraint_current(pm::GenericPowerModel{T}, n::Int, i, f_idx, f_bus, t if buspair["branch"] == i # p_fr^2 + q_fr^2 <= l * w comes for free with constraint_power_magnitude_sqr of PowerModels.jl l = pm.var[:nw][n][:cm][(f_bus, t_bus)] - PowerModels.relaxation_sqr(pm.model, i_ac_mag, l) + InfrastructureModels.relaxation_sqr(pm.model, i_ac_mag, l) else l = pm.var[:nw][n][:cm_p][i] w = pm.var[:nw][n][:w][f_bus] @@ -84,7 +84,7 @@ function constraint_current(pm::GenericPowerModel{T}, n::Int, i, f_idx, f_bus, t q_fr = pm.var[:nw][n][:q][arc_from] @constraint(pm.model, p_fr^2 + q_fr^2 <= l * w) - PowerModels.relaxation_sqr(pm.model, i_ac_mag, l) + InfrastructureModels.relaxation_sqr(pm.model, i_ac_mag, l) end end @@ -110,27 +110,27 @@ function constraint_thermal_protection(pm::GenericPowerModel{T}, n::Int, i, coef ieff = pm.var[:nw][n][:i_dc_mag][i] ieff_sqr = pm.var[:nw][n][:i_dc_mag_sqr][i] - @constraint(pm.model, i_ac_mag <= coeff[1] + coeff[2]*ieff/ibase + coeff[3]*ieff_sqr/(ibase^2)) - PowerModels.relaxation_sqr(pm.model, ieff, ieff_sqr) + @constraint(pm.model, i_ac_mag <= coeff[1] + coeff[2]*ieff/ibase + coeff[3]*ieff_sqr/(ibase^2)) + InfrastructureModels.relaxation_sqr(pm.model, ieff, ieff_sqr) end "Constraint for computing qloss" function constraint_qloss(pm::GenericPowerModel{T}, n::Int, k, i, j) where T <: PowerModels.AbstractWRForm i_dc_mag = pm.var[:nw][n][:i_dc_mag][k] qloss = pm.var[:nw][n][:qloss] - iv = pm.var[:nw][n][:iv][(k,i,j)] + iv = pm.var[:nw][n][:iv][(k,i,j)] vm = pm.var[:nw][n][:vm][i] @constraint(pm.model, qloss[(k,i,j)] == 0.0) - @constraint(pm.model, qloss[(k,j,i)] == 0.0) - PowerModels.relaxation_product(pm.model, i_dc_mag, vm, iv) + @constraint(pm.model, qloss[(k,j,i)] == 0.0) + InfrastructureModels.relaxation_product(pm.model, i_dc_mag, vm, iv) end "Constraint for computing qloss" function constraint_qloss(pm::GenericPowerModel{T}, n::Int, k, i, j, K, branchMVA) where T <: PowerModels.AbstractWRForm i_dc_mag = pm.var[:nw][n][:i_dc_mag][k] qloss = pm.var[:nw][n][:qloss] - iv = pm.var[:nw][n][:iv][(k,i,j)] + iv = pm.var[:nw][n][:iv][(k,i,j)] vm = pm.var[:nw][n][:vm][i] if getlowerbound(i_dc_mag) > 0.0 || getupperbound(i_dc_mag) < 0.0 @@ -139,6 +139,6 @@ function constraint_qloss(pm::GenericPowerModel{T}, n::Int, k, i, j, K, branchMV # K is per phase @constraint(pm.model, qloss[(k,i,j)] == K*iv/(3.0*branchMVA)) - @constraint(pm.model, qloss[(k,j,i)] == 0.0) - PowerModels.relaxation_product(pm.model, i_dc_mag, vm, iv) + @constraint(pm.model, qloss[(k,j,i)] == 0.0) + InfrastructureModels.relaxation_product(pm.model, i_dc_mag, vm, iv) end