When changing a bus name, something is corrupted in the system references making it not possible to remove an arc that was attached to the same bus.
using PowerSystems
using PowerSystemCaseBuilder
# Works as expected:
sys = build_system(PSITestSystems, "c_sys5")
br = get_component(Line, sys, "1")
arc = get_arc(br)
remove_component!(sys, br)
remove_component!(sys, arc)
# Changing the name of the bus causes an error when trying to remove the attached arc:
sys = build_system(PSITestSystems, "c_sys5")
b = get_component(ACBus, sys, "nodeA")
set_name!(sys, b, "nodeA_newname")
br = get_component(Line, sys, "1")
arc = get_arc(br)
remove_component!(sys, br)
remove_component!(sys, arc)
ERROR: ArgumentError: component Arc name=nodeA_newname -> nodeB is not stored
Stacktrace:
[1] _remove_component!(::Type{…}, components::InfrastructureSystems.Components, name::String; remove_time_series::Bool, remove_supplemental_attributes::Bool)
@ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/yetBs/src/components.jl:187
[2]
@ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/yetBs/src/components.jl:145
[3] remove_component!
@ ~/.julia/packages/InfrastructureSystems/yetBs/src/components.jl:139 [inlined]
[4] remove_component!(data::InfrastructureSystems.SystemData, component::Arc)
@ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/yetBs/src/system_data.jl:404
[5] remove_component!(sys::System, component::Arc)
@ PowerSystems ~/Documents/PowerSystems.jl/src/base.jl:1282
[6] top-level scope
@ ~/Documents/PowerSystems.jl/_test_dev_remove_arcs_bug.jl:18
Some type information was truncated. Use `show(err)` to see complete types.
When changing a bus name, something is corrupted in the system references making it not possible to remove an arc that was attached to the same bus.
To reproduce:
Stacktrace: