Skip to content

Commit

Permalink
PS: move Parsers and Indexes into PowerSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
frapac committed Mar 10, 2021
1 parent 524d6ef commit ce1bfe7
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 19 deletions.
6 changes: 0 additions & 6 deletions src/ExaPF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion src/PowerSystem/PowerSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module PowerSystem

using Printf
using SparseArrays
using ..ExaPF: ParsePSSE, ParseMAT, IndexSet, Spmat

import Base: show, get

Expand Down Expand Up @@ -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")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

module ParseMAT

using ..ExaPF: IndexSet
using ..PowerSystem: IndexSet

include("matlab.jl")
include("im_common.jl")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions test/Evaluators/test_rgm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
12 changes: 7 additions & 5 deletions test/Polar/matpower.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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())
Expand All @@ -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())
Expand All @@ -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())
Expand Down
5 changes: 3 additions & 2 deletions test/powersystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"]
Expand Down
2 changes: 0 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit ce1bfe7

Please sign in to comment.