Skip to content

Commit

Permalink
Merge pull request #672 from NREL-SIIP/jd/sort_ptdf
Browse files Browse the repository at this point in the history
add sort to PTDF
  • Loading branch information
jd-lara authored Nov 20, 2020
2 parents ef10e74 + 4000177 commit e9a1e43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/utils/network_calculations/lodf_calculations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ Builds the LODF matrix from a system. The return is a LOLDF array indexed with t
The distributed slack vector has to be the same length as the number of buses
"""
function LODF(sys::System, dist_slack::Vector{Float64} = [0.1])
branches = get_components(ACBranch, sys)
nodes = get_components(Bus, sys)
branches = sort!(
collect(get_components(ACBranch, sys)),
by = x -> (get_number(get_arc(x).from), get_number(get_arc(x).to)),
)
nodes = sort!(collect(get_components(Bus, sys)), by = x -> get_number(x))
return LODF(branches, nodes, dist_slack)
end
7 changes: 5 additions & 2 deletions src/utils/network_calculations/ptdf_calculations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ Builds the PTDF matrix from a system. The return is a PTDF array indexed with th
The distributed slack vector has to be the same length as the number of buses
"""
function PTDF(sys::System, dist_slack::Vector{Float64} = [0.1])
branches = get_components(ACBranch, sys)
nodes = get_components(Bus, sys)
branches = sort!(
collect(get_components(ACBranch, sys)),
by = x -> (get_number(get_arc(x).from), get_number(get_arc(x).to)),
)
nodes = sort!(collect(get_components(Bus, sys)), by = x -> get_number(x))
return PTDF(branches, nodes, dist_slack)
end

0 comments on commit e9a1e43

Please sign in to comment.