Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix component-is-attached-to-system check #1080

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

daniel-thom
Copy link
Contributor

Fixes #1016. The check for whether a component is attached to a system was inadequate. It checked whether a component of the given type and name was attached to the system. If you built two systems with the same components and names, that check would incorrectly pass. This PR fixes that bug.

There were numerous tests that only passed because of this same-type-and-name comparison. This PR also fixes those tests.

_services = isnothing(services) ? [] : services
return System(base_power, buses, generators, loads, _services; kwargs...)
_branches = isnothing(branches) ? [] : branches
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently, the demo constructor never added branches or services...

return !isnothing(get_component(T, sys, name))
existing_component = get_component(T, sys, get_name(component))
isnothing(existing_component) && return false
return component === existing_component
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the fix.

@jd-lara jd-lara merged commit 5031237 into NREL-Sienna:psy4 Mar 19, 2024
2 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants