diff --git a/src/ExaPF.jl b/src/ExaPF.jl index dc106bf8..626c9f5a 100644 --- a/src/ExaPF.jl +++ b/src/ExaPF.jl @@ -33,14 +33,8 @@ include("models.jl") # Import submodules include("autodiff.jl") using .AutoDiff -include("indexes.jl") -using .IndexSet include("LinearSolvers/LinearSolvers.jl") using .LinearSolvers -include("parsers/parse_mat.jl") -using .ParseMAT -include("parsers/parse_psse.jl") -using .ParsePSSE include("PowerSystem/PowerSystem.jl") using .PowerSystem diff --git a/src/PowerSystem/PowerSystem.jl b/src/PowerSystem/PowerSystem.jl index 45f347a3..7506c323 100644 --- a/src/PowerSystem/PowerSystem.jl +++ b/src/PowerSystem/PowerSystem.jl @@ -2,7 +2,6 @@ module PowerSystem using Printf using SparseArrays -using ..ExaPF: ParsePSSE, ParseMAT, IndexSet, Spmat import Base: show, get @@ -299,6 +298,12 @@ function import_dataset(datafile::String) end end +include("indexes.jl") +using .IndexSet +include("parsers/parse_mat.jl") +using .ParseMAT +include("parsers/parse_psse.jl") +using .ParsePSSE include("topology.jl") include("power_network.jl") diff --git a/src/indexes.jl b/src/PowerSystem/indexes.jl similarity index 100% rename from src/indexes.jl rename to src/PowerSystem/indexes.jl diff --git a/src/parsers/im_common.jl b/src/PowerSystem/parsers/im_common.jl similarity index 100% rename from src/parsers/im_common.jl rename to src/PowerSystem/parsers/im_common.jl diff --git a/src/parsers/matlab.jl b/src/PowerSystem/parsers/matlab.jl similarity index 100% rename from src/parsers/matlab.jl rename to src/PowerSystem/parsers/matlab.jl diff --git a/src/parsers/parse_con.jl b/src/PowerSystem/parsers/parse_con.jl similarity index 100% rename from src/parsers/parse_con.jl rename to src/PowerSystem/parsers/parse_con.jl diff --git a/src/parsers/parse_inl.jl b/src/PowerSystem/parsers/parse_inl.jl similarity index 100% rename from src/parsers/parse_inl.jl rename to src/PowerSystem/parsers/parse_inl.jl diff --git a/src/parsers/parse_mat.jl b/src/PowerSystem/parsers/parse_mat.jl similarity index 99% rename from src/parsers/parse_mat.jl rename to src/PowerSystem/parsers/parse_mat.jl index 0592976b..8bb31302 100644 --- a/src/parsers/parse_mat.jl +++ b/src/PowerSystem/parsers/parse_mat.jl @@ -9,7 +9,7 @@ module ParseMAT -using ..ExaPF: IndexSet +using ..PowerSystem: IndexSet include("matlab.jl") include("im_common.jl") diff --git a/src/parsers/parse_psse.jl b/src/PowerSystem/parsers/parse_psse.jl similarity index 100% rename from src/parsers/parse_psse.jl rename to src/PowerSystem/parsers/parse_psse.jl diff --git a/src/parsers/parse_raw.jl b/src/PowerSystem/parsers/parse_raw.jl similarity index 100% rename from src/parsers/parse_raw.jl rename to src/PowerSystem/parsers/parse_raw.jl diff --git a/src/parsers/parse_rop.jl b/src/PowerSystem/parsers/parse_rop.jl similarity index 100% rename from src/parsers/parse_rop.jl rename to src/PowerSystem/parsers/parse_rop.jl diff --git a/test/Evaluators/test_rgm.jl b/test/Evaluators/test_rgm.jl index a77f484d..e7bcca4a 100644 --- a/test/Evaluators/test_rgm.jl +++ b/test/Evaluators/test_rgm.jl @@ -6,8 +6,6 @@ using ForwardDiff using LinearAlgebra using KernelAbstractions -import ExaPF: ParseMAT, PowerSystem, IndexSet - @testset "RGM Optimal Power flow 9 bus case" begin datafile = joinpath(INSTANCES_DIR, "case9.m") diff --git a/test/Polar/matpower.jl b/test/Polar/matpower.jl index affc0b02..8f09832e 100644 --- a/test/Polar/matpower.jl +++ b/test/Polar/matpower.jl @@ -3,11 +3,13 @@ using KernelAbstractions using Test using ExaPF -import ExaPF: ParseMAT, PowerSystem, IndexSet +import ExaPF: PowerSystem + +const PS = PowerSystem @testset "Power flow 9 bus case" begin datafile = joinpath(dirname(@__FILE__), "..", "..", "data", "case9.m") - pf = PowerSystem.PowerNetwork(datafile) + pf = PS.PowerNetwork(datafile) # test impedance matrix entries @test isapprox(real(pf.Ybus[1, 1]), 0.0) @@ -44,7 +46,7 @@ end @testset "Power flow 14 bus case" begin datafile = joinpath(dirname(@__FILE__), "..", "..", "data", "case14.m") - pf = PowerSystem.PowerNetwork(datafile) + pf = PS.PowerNetwork(datafile) polar = PolarForm(pf, CPU()) x = ExaPF.initial(polar, State()) u = ExaPF.initial(polar, Control()) @@ -67,7 +69,7 @@ end @testset "Power flow 30 bus case" begin datafile = joinpath(dirname(@__FILE__), "..", "..", "data", "case30.m") - pf = PowerSystem.PowerNetwork(datafile) + pf = PS.PowerNetwork(datafile) # retrieve initial state of network polar = PolarForm(pf, CPU()) @@ -91,7 +93,7 @@ end @testset "Power flow 300 bus case" begin datafile = joinpath(dirname(@__FILE__), "..", "..", "data", "case300.m") - pf = PowerSystem.PowerNetwork(datafile) + pf = PS.PowerNetwork(datafile) polar = PolarForm(pf, CPU()) x = ExaPF.initial(polar, State()) diff --git a/test/powersystem.jl b/test/powersystem.jl index 929db9a0..13995317 100644 --- a/test/powersystem.jl +++ b/test/powersystem.jl @@ -4,7 +4,8 @@ using KernelAbstractions using Test using TimerOutputs -import ExaPF: ParsePSSE, PowerSystem, IndexSet +import ExaPF: PowerSystem +import ExaPF.PowerSystem: ParsePSSE const PS = PowerSystem @@ -18,7 +19,7 @@ const PS = PowerSystem # Parsed data indexes BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, VA, BASE_KV, ZONE, VMAX, VMIN, - LAM_P, LAM_Q, MU_VMAX, MU_VMIN = IndexSet.idx_bus() + LAM_P, LAM_Q, MU_VMAX, MU_VMIN = PS.IndexSet.idx_bus() # retrive required data bus = data["bus"] diff --git a/test/runtests.jl b/test/runtests.jl index 0c97e70a..05829d62 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -9,9 +9,7 @@ using Test using TimerOutputs using FiniteDiff -import ExaPF: ParsePSSE, PowerSystem, IndexSet import ExaPF: AutoDiff - Random.seed!(2713) const INSTANCES_DIR = joinpath(dirname(@__FILE__), "..", "data")