PowerSystems.jl icon indicating copy to clipboard operation
PowerSystems.jl copied to clipboard

Give error/warning when removing component (service) that is not in the system

Open rodrigomha opened this issue 1 year ago • 2 comments

Currently, you are allowed to remove a service from another system if they have the same name (I think) but then it breaks the uuid from devices that have the service.

rodrigomha avatar Oct 25 '23 18:10 rodrigomha

The title of this issue seems to conflict with the description.

Regarding the title, if you call remove_component!(Service, sys, name) and there is no such service stored, it should throw an exception. Are you saying that this doesn’t work? (The exact Service type must be concrete.)

Regarding the description, the function signature is as follows:

function remove_component!(
    ::Type{T},
    sys::System,
    name::AbstractString,
) where {T <: Component}

If the system has a service matching type and name, it will be removed. If you call this on the wrong system, how can we detect that?

daniel-thom avatar Jan 25 '24 23:01 daniel-thom

I believe this issue was more complicated than this. I'm killing myself here for not adding the code that created this issue, and I'm not able to replicate this issue.

I'm guessing this could be related with #1016, of adding the same service in two different systems, and then trying to remove one, creating issues in another system.

This is my bad, since I can't recall what was the test case I was using for this issue. @jd-lara Do you remember exactly about this issue? If not, we can close it for now, and re-open it once we encounter it again.

rodrigomha avatar Jan 26 '24 01:01 rodrigomha

Since #1016 is fixed and this issue can’t be reproduced, I’ll close it.

daniel-thom avatar Mar 19 '24 13:03 daniel-thom