Skip to content

Commit

Permalink
UPD: JuMP 1.23.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudocubic committed Sep 18, 2024
1 parent a5c13bb commit de1f6fd
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 217 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- none

## v0.4.0

- Updated to JuMP 1.23.2 to use new NL syntax

## v0.3.3

- Update compat for PowerModelsDistribution v0.15
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ All new dependencies should be carefully considered before being added. It is im

All new dependencies are are ultimately approved should also include an entry under `[compat]` indicating the acceptable versions (Julia automerge requirement). This includes test-only dependencies that appear under `[extras]`

The `Manifest.toml` __should not__ be included in the repo.
The `Manifest.toml` **should not** be included in the repo.

## Pull Requests

Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "PowerModelsStability"
uuid = "f9e4c324-c3b6-4bca-9c3d-419775f0bd17"
authors = ["Haoxiang Yang", "Harsha Nagarajan", "David M Fobes"]
repo = "https://github.com/lanl-ansi/PowerModelsStability.jl.git"
version = "0.3.3"
version = "0.4"

[deps]
InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0"
Expand All @@ -16,9 +16,9 @@ PowerModelsDistribution = "d7431456-977f-11e9-2de3-97ff7677985e"
InfrastructureModels = "0.7"
Ipopt = "0.9, 1"
JSON = "0.21"
JuMP = "0.22, 0.23, 1"
JuMP = "1.23.2"
Memento = "1"
PowerModelsDistribution = "0.14, 0.15"
PowerModelsDistribution = "0.16"
julia = "1.6"

[extras]
Expand Down
6 changes: 3 additions & 3 deletions src/core/constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Given a matrix A with NL expression and an eigenvector v, calculate the multiplication v^\\top A v"
function matrixMulti(mp::JuMP.Model, A::Array{Any,2}, v)
n = length(v)
multiExpression = JuMP.@NLexpression(mp, sum(sum(v[i] * A[i,j] * v[j] for j in 1:n) for i in 1:n))
multiExpression = JuMP.@expression(mp, sum(sum(v[i] * A[i,j] * v[j] for j in 1:n) for i in 1:n))

return multiExpression
end
Expand Down Expand Up @@ -36,7 +36,7 @@ function obtainGlobal_var(mpData, pm, rN, omega0)
Isub = PMS.obtainI_inverter_global(mpData, rN, omega0, busList, brList, loadList, load_L, load_R, load_X, loadConnections)

Atot = PMS.combineSub(busList, brList, inverters, invBusDict, Asub, Bsub, Csub, Dsub, Esub, Fsub, Gsub, Hsub, Isub, 2)

return Atot
end

Expand All @@ -46,6 +46,6 @@ function constraint_stability(pm::_PMD.AbstractUnbalancedPowerModel, nw::Int, ei
for ev in eigenVectorList
evMulti_real = PMS.matrixMulti(pm.model, Amg, real(ev))
evMulti_imag = PMS.matrixMulti(pm.model, Amg, imag(ev))
JuMP.@NLconstraint(pm.model, evMulti_real + evMulti_imag <= 0)
JuMP.@constraint(pm.model, evMulti_real + evMulti_imag <= 0)
end
end
2 changes: 1 addition & 1 deletion src/core/generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function obtainA_diesel(mpData, opfSol, iBusList, omega0, kD)
iQ = Dict()
A = Dict()
error_list = []

for i in iBusList
if mpData["bus"][i]["bus_type"] == 3
delta0[i] = opfSol["solution"]["bus"][i]["va"][1]
Expand Down
322 changes: 161 additions & 161 deletions src/core/inverter.jl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/io/preprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ end

"Obtain the load parameters from the model data"
function get_load_parameters(mpData, loadList, vnomList, omega0, loadConnections)

θ_list = [0, 2π/3, -2π/3]
load_R = Dict()
load_X = Dict()
Expand Down
60 changes: 16 additions & 44 deletions test/data/case2_inverters.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,22 @@
"tau": 0.0001,
"inverter_bus": true,
"r": [
[0.001,0,0],
[0,0.001,0],
[0,0,0.001]
[0.001, 0, 0],
[0, 0.001, 0],
[0, 0, 0.001]
],
"x": [
[0.001,0,0],
[0,0.001,0],
[0,0,0.001]
],
"pg": [
33.3333,
33.3333,
33.3333
],
"qg": [
33.3333,
33.3333,
33.3333
],
"pg_lb": [
0.0,
0.0,
0.0
],
"qg_lb": [
0.0,
0.0,
0.0
],
"pg_ub": [
100.0,
100.0,
100.0
],
"qg_ub": [
0.0,
0.0,
0.0
],
"vg": [
4.6,
4.6,
4.6
]
}
]
[0.001, 0, 0],
[0, 0.001, 0],
[0, 0, 0.001]
],
"pg": [33.3333, 33.3333, 33.3333],
"qg": [33.3333, 33.3333, 33.3333],
"pg_lb": [0.0, 0.0, 0.0],
"qg_lb": [0.0, 0.0, 0.0],
"pg_ub": [100.0, 100.0, 100.0],
"qg_ub": [0.0, 0.0, 0.0],
"vg": [4.6, 4.6, 4.6]
}
]
}
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const PMS = PowerModelsStability

PMD.silence!()

ipopt_solver = PMD.optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 3, "tol"=>1e-5, "max_iter" => Int(1E4), "sb" => "yes")
ipopt_solver = PMD.optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0, "tol"=>1e-5, "max_iter" => Int(1E4), "sb" => "yes")

@testset "PowerModelsStability" begin
include("test_2bus.jl")
end
end
2 changes: 1 addition & 1 deletion test/test_2bus.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@testset "test the two bus system" begin

println(">>>>>>> Testing 2-bus system <<<<<<<<")

# load the data
Expand Down

0 comments on commit de1f6fd

Please sign in to comment.