Skip to content

Commit

Permalink
more test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Jan 19, 2025
1 parent 8903969 commit 90d7155
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
13 changes: 7 additions & 6 deletions test/test_lodf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@
P5 = PTDF(sys5)
L5NS_from_ptdf = LODF(A, P5)
L5NS_from_ptdf2 = LODF(A, P5; linear_solver = "Dense")
if !PowerNetworkMatrices.USE_AA
L5NS_from_ptdf3 = LODF(A, P5; linear_solver = "MKLPardiso")
@test getindex(L5NS_from_ptdf3, "5", "6") - -0.3071 <= 1e-4
end
@test getindex(L5NS_from_ptdf, "5", "6") - -0.3071 <= 1e-4
@test getindex(L5NS_from_ptdf2, "5", "6") - -0.3071 <= 1e-4
total_error = abs.(L5NS_from_ptdf.data' .- Lodf_5)
total_error2 = abs.(L5NS_from_ptdf2.data' .- Lodf_5)
total_error3 = abs.(L5NS_from_ptdf3.data' .- Lodf_5)
@test isapprox(sum(total_error), 0.0, atol = 1e-3)
@test isapprox(sum(total_error2), 0.0, atol = 1e-3)
@test isapprox(sum(total_error3), 0.0, atol = 1e-3)

if !PowerNetworkMatrices.USE_AA
L5NS_from_ptdf3 = LODF(A, P5; linear_solver = "MKLPardiso")
@test getindex(L5NS_from_ptdf3, "5", "6") - -0.3071 <= 1e-4
total_error3 = abs.(L5NS_from_ptdf3.data' .- Lodf_5)
@test isapprox(sum(total_error3), 0.0, atol = 1e-3)
end

# A, ABA, and BA case
ABA = ABA_Matrix(sys5; factorize = true)
Expand Down
5 changes: 2 additions & 3 deletions test/test_ptdf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,12 @@ end

P5_1 = PTDF(sys5; dist_slack = slack_array, linear_solver = "KLU")
P5_2 = PTDF(sys5; dist_slack = slack_array, linear_solver = "Dense")
@test isapprox(P5_1.data, P5_2.data, atol = 1e-5)
if !PowerNetworkMatrices.USE_AA
P5_3 = PTDF(sys5; dist_slack = slack_array, linear_solver = "MKLPardiso")
@test isapprox(P5_2.data, P5_3.data, atol = 1e-5)
@test isapprox(P5_1.data, P5_3.data, atol = 1e-5)
end

@test isapprox(P5_1.data, P5_2.data, atol = 1e-5)
@test isapprox(P5_1.data, P5_3.data, atol = 1e-5)
end

@testset "Test PTDF matrix with distributed bus and with 2 reference buses" begin
Expand Down

0 comments on commit 90d7155

Please sign in to comment.