Skip to content

Commit

Permalink
Merge pull request #28 from invenia/bes/revert_strtypes
Browse files Browse the repository at this point in the history
Reverting change to `branches_by_breakpoints`
  • Loading branch information
BSnelling authored Aug 1, 2022
2 parents 4be5b4a + 58315d6 commit a845c8d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FullNetworkSystems"
uuid = "877b7152-b508-43dc-81fb-72341a693988"
authors = ["Invenia Technical Computing Corporation"]
version = "1.5.0"
version = "1.5.1"

[deps]
AxisKeys = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5"
Expand Down
8 changes: 4 additions & 4 deletions src/accessors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,17 @@ function gens_per_zone(system::System)
end

"""
branches_by_breakpoints(system::System) -> NTuple{3, Vector{$BranchName}}
branches_by_breakpoints(system::System)
Returns three vectors containing of the names of branches which have 0, 1, and 2 breakpoints.
"""
function branches_by_breakpoints(system::System)
zero_bp, one_bp, two_bp = BranchName[], BranchName[], BranchName[]
zero_bp, one_bp, two_bp = String[], String[], String[]
for branch in system.branches
if branch.is_monitored
if all(iszero, branch.break_points)
if all(branch.break_points .== 0.0)
push!(zero_bp, branch.name)
elseif iszero(last(branch.break_points))
elseif last(branch.break_points) == 0.0
push!(one_bp, branch.name)
else
push!(two_bp, branch.name)
Expand Down
5 changes: 2 additions & 3 deletions test/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,10 @@
@test v == gen_ids
end

zero_bp, one_bp, two_bp = branches_by_breakpoints(system)
zero_bp, one_bp, two_bp = branches_by_breakpoints(da_system)
@test zero_bp == ["3"]
@test one_bp == [] # unmonitored
@test one_bp == String[] #unmonitored
@test two_bp == ["1", "4"]
@test eltype(zero_bp) == eltype(one_bp) == eltype(two_bp) == FullNetworkSystems.BranchName

# Also test on a system with a 1-breakpoint branch
da_system.branches = Dictionary(
Expand Down

2 comments on commit a845c8d

@BSnelling
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/65418

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.5.1 -m "<description of version>" a845c8d1446e1248c18103b893f69bf35e774aaf
git push origin v1.5.1

Please sign in to comment.