diff --git a/README.md b/README.md index 58759bf..fe78310 100644 --- a/README.md +++ b/README.md @@ -76,8 +76,7 @@ julia --project=. # Start Julia with the project e julia> include("jump.jl") # Load the solve_opf function from one of the example files julia> solve_opf("data/pglib_opf_case5_pjm.m") # Run the solve_opf function on a specific AC-OPF case file ``` -Note that due to Julia's JIT, it is very likely that the first call to `solve_opf` will take significantly more time than the second call. - +Note that due to Julia's JIT, it is very likely that the first call to `solve_opf` will take significantly more time than the second call. The case file `data/opf_warmup.m` can be used to remove the bulk of overheads related to Julia's JIT when collecting precise runtime data on one of the `solve_opf` functions. ## License diff --git a/data/opf_warmup.m b/data/opf_warmup.m new file mode 100644 index 0000000..a1c0132 --- /dev/null +++ b/data/opf_warmup.m @@ -0,0 +1,49 @@ +% +% This matpower case was developed as part of the rosetta-opf project. +% +% It is designed to be used for warming up the Julia JIT for solving similar +% AC-OPF porblems. This network data is designed to cover a wide range of +% model features in a minimal case file. It is not representative of a +% realistic power network. +% +% +function mpc = opf_warmup +mpc.version = '2'; +mpc.baseMVA = 100.0; + +%% bus data +% bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin +mpc.bus = [ + 1 1 150.0 98.0 0.1 10.0 1 1.00000 0.00000 230.0 1 1.10000 0.90000; + 2 3 0.0 0.0 0.0 0.0 1 1.00000 0.00000 230.0 1 1.11000 0.91000; + 3 2 200.0 -52.0 0.0 -15.0 1 1.00000 0.00000 230.0 1 1.12000 0.92000; + 4 2 300.0 131.0 0.0 0.0 1 1.00000 0.00000 230.0 1 1.13000 0.93000; +]; + +%% generator data +% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin +mpc.gen = [ + 3 20.0 0.0 30.0 -30.0 1.0 100.0 1 40.0 0.0; + 3 85.0 0.0 127.5 -127.5 1.0 100.0 1 170.0 0.0; + 4 100.0 0.0 150.0 -150.0 1.0 100.0 1 200.0 0.0; + 2 300.0 0.0 450.0 -450.0 1.0 100.0 1 600.0 0.0; +]; + +%% generator cost data +% 2 startup shutdown n c(n-1) ... c0 +mpc.gencost = [ + 2 0.0 0.0 3 1.00 5.00 0.00; + 2 0.0 0.0 3 0.30 10.00 0.00; + 2 0.0 0.0 3 0.00 30.00 0.00; + 2 0.0 0.0 3 0.00 40.00 0.00; +]; + +%% branch data +% fbus tbus r x b rateA rateB rateC ratio angle status angmin angmax +mpc.branch = [ + 1 2 0.00281 0.0281 0.00712 400.0 400.0 400.0 1.1 0.0 1 -30.0 30.0; + 2 3 0.00108 0.0108 0.01852 426.0 426.0 426.0 0.0 5.0 1 -30.0 30.0; + 2 4 0.00297 0.0297 0.00674 240.0 240.0 240.0 0.0 0.0 1 -30.0 30.0; + 3 4 0.00297 0.0297 0.00674 426.0 426.0 426.0 0.9 -5.0 1 -30.0 30.0; +]; + diff --git a/jump.jl b/jump.jl index 60b9958..452d89e 100755 --- a/jump.jl +++ b/jump.jl @@ -171,5 +171,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/data/opf_warmup.m") end diff --git a/nlpmodels.jl b/nlpmodels.jl index ef59402..fd12fd3 100755 --- a/nlpmodels.jl +++ b/nlpmodels.jl @@ -358,5 +358,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/data/opf_warmup.m") end diff --git a/nonconvex.jl b/nonconvex.jl index d245b7f..ec8fa74 100755 --- a/nonconvex.jl +++ b/nonconvex.jl @@ -266,5 +266,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/data/opf_warmup.m") end diff --git a/optim.jl b/optim.jl index ee946ea..932bdbd 100755 --- a/optim.jl +++ b/optim.jl @@ -399,5 +399,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/data/opf_warmup.m") end diff --git a/optimization.jl b/optimization.jl index 415c3bd..b825b71 100755 --- a/optimization.jl +++ b/optimization.jl @@ -374,5 +374,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/data/opf_warmup.m") end diff --git a/test/runtests.jl b/test/runtests.jl index d2ffaf8..8ad203d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,11 +12,12 @@ include("validator.jl") ] include(joinpath(dirname(@__DIR__), "$framework.jl")) @testset "$case" for case in [ - "case5_pjm", - "case14_ieee", - "case24_ieee_rts", + "opf_warmup.m", + "pglib_opf_case5_pjm.m", + "pglib_opf_case14_ieee.m", + "pglib_opf_case24_ieee_rts.m", ] - test_case = joinpath(dirname(@__DIR__), "data/pglib_opf_$case.m") + test_case = joinpath(dirname(@__DIR__), "data", case) result = solve_opf(test_case) validate_result(test_case, result) end diff --git a/variants/casadi.jl b/variants/casadi.jl index f1e874d..ac781f0 100644 --- a/variants/casadi.jl +++ b/variants/casadi.jl @@ -189,5 +189,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/../data/opf_warmup.m") end diff --git a/variants/jump-nl.jl b/variants/jump-nl.jl index 2fd913b..4c75267 100644 --- a/variants/jump-nl.jl +++ b/variants/jump-nl.jl @@ -156,5 +156,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/../data/opf_warmup.m") end diff --git a/variants/jump-polar-vectorized.jl b/variants/jump-polar-vectorized.jl index 4866621..5e7ae0c 100644 --- a/variants/jump-polar-vectorized.jl +++ b/variants/jump-polar-vectorized.jl @@ -276,6 +276,6 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/../data/opf_warmup.m") end diff --git a/variants/jump-rectangular-complex.jl b/variants/jump-rectangular-complex.jl index 218d2f4..09e1663 100644 --- a/variants/jump-rectangular-complex.jl +++ b/variants/jump-rectangular-complex.jl @@ -147,5 +147,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/../data/opf_warmup.m") end diff --git a/variants/jump-rectangular-real.jl b/variants/jump-rectangular-real.jl index 2c4a144..cdd185b 100644 --- a/variants/jump-rectangular-real.jl +++ b/variants/jump-rectangular-real.jl @@ -147,5 +147,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/../data/opf_warmup.m") end diff --git a/variants/jump-symbolic-ad.jl b/variants/jump-symbolic-ad.jl index 066b4d1..b0c7f5d 100644 --- a/variants/jump-symbolic-ad.jl +++ b/variants/jump-symbolic-ad.jl @@ -172,5 +172,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/../data/opf_warmup.m") end diff --git a/variants/jump-traced.jl b/variants/jump-traced.jl index 3e886a2..1d11f12 100755 --- a/variants/jump-traced.jl +++ b/variants/jump-traced.jl @@ -399,5 +399,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/../data/opf_warmup.m") end diff --git a/variants/optimization-cs-asrd.jl b/variants/optimization-cs-asrd.jl index 0933ba6..f603828 100644 --- a/variants/optimization-cs-asrd.jl +++ b/variants/optimization-cs-asrd.jl @@ -546,6 +546,6 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/../data/opf_warmup.m") end diff --git a/variants/pyomo.jl b/variants/pyomo.jl index 2637f49..a41cc90 100644 --- a/variants/pyomo.jl +++ b/variants/pyomo.jl @@ -259,5 +259,5 @@ function solve_opf(file_name) end if isinteractive() == false - solve_opf("$(@__DIR__)/../data/pglib_opf_case5_pjm.m") + solve_opf("$(@__DIR__)/../data/opf_warmup.m") end