From 48412248ee9915000eb990bd1b66c7509a958fbb Mon Sep 17 00:00:00 2001 From: alefcastelli Date: Tue, 1 Aug 2023 22:30:23 -0600 Subject: [PATCH] found some bugs --- src/virtual_lodf_calculations.jl | 5 ++--- test/test_virtual_ptdf.jl | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/virtual_lodf_calculations.jl b/src/virtual_lodf_calculations.jl index 5ae1ced7..314a24f5 100644 --- a/src/virtual_lodf_calculations.jl +++ b/src/virtual_lodf_calculations.jl @@ -242,10 +242,9 @@ function _getindex( lodf_row[row] = -1.0 # add slack bus value (zero) and make copy of temp into the cache if get_tol(vlodf) > eps() - vlodf.cache[row] = make_entries_zero!(deepcopy(lodf_row), get_tol(vlodf)) - else - vlodf.cache[row] = deepcopy(lodf_row) + make_entries_zero!(lodf_row, get_tol(vlodf)) end + vlodf.cache[row] = deepcopy(lodf_row) return vlodf.cache[row][column] end end diff --git a/test/test_virtual_ptdf.jl b/test/test_virtual_ptdf.jl index fb2d6c57..6ba5d0e6 100644 --- a/test/test_virtual_ptdf.jl +++ b/test/test_virtual_ptdf.jl @@ -71,10 +71,12 @@ end @testset "Test virtual PTDF with distributed slack" begin # get 5 bus system sys = PSB.build_system(PSB.PSITestSystems, "c_sys5") + bus_number = length(PNM.get_buses(sys)) + dist_slack = 1 / bus_number * ones(bus_number) # compute full PTDF - ptdf = PTDF(sys; dist_slack = slack_array) + ptdf = PTDF(sys; dist_slack = dist_slack) # compute each row of the virtual PTDF and compare values - vptdf = VirtualPTDF(sys; dist_slack = slack_array) + vptdf = VirtualPTDF(sys; dist_slack = dist_slack) for row in 1:size(ptdf.data, 2) # evaluate the column (just needs one element) vptdf[row, 1]