Skip to content

Commit

Permalink
found some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
alefcastelli committed Aug 2, 2023
1 parent 00c8b20 commit 4841224
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/virtual_lodf_calculations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/test_virtual_ptdf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 4841224

Please sign in to comment.