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

Updates for supplemental attributes #323

Merged
merged 3 commits into from
Jan 15, 2024

Conversation

daniel-thom
Copy link
Contributor

This PR adds these items:

  1. Fix handling of assign_new_uuid. The function now has to go through the system because of the UUID dictionary that we are managing.
  2. Add a function to get all components attached to a supplemental attribute.

@daniel-thom daniel-thom requested a review from jd-lara January 9, 2024 16:19
old_uuid = get_uuid(component)
new_uuid = make_uuid()
if has_time_series(component)
container = get_time_series_container(component)
# There may be duplicates because of transform operations.
changed_uuids = Set{Tuple{Base.UUID, String}}()
for (key, ts_metadata) in container.data
changed_uuid = (old_uuid, key.name)
ts_uuid = get_time_series_uuid(ts_metadata)
changed_uuid = (ts_uuid, key.name)
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 an existing bug that affects some use case in PowerSystems, like convert_component!. Users would know if they experienced it. We could back-port the if necessary. Since no one has reported it, that is probably not needed.

Copy link
Member

Choose a reason for hiding this comment

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

ok

The code used to allow changing a component UUID directly through the
component. That is no longer allowed because the system keeps a separate
dictionary of component UUIDs. So, the function call must now go through
the system.
@jd-lara jd-lara self-assigned this Jan 9, 2024
@@ -851,6 +866,11 @@ end
get_components_by_name(::Type{T}, data::SystemData, args...) where {T} =
get_components_by_name(T, data.components, args...)

function get_components(data::SystemData, attribute::SupplementalAttribute)
Copy link
Member

Choose a reason for hiding this comment

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

Are we ok with letting the compiler figure out the eltype of the resulting vector or should we add a type annotation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The eltype could be concrete or abstract depending on whether all components are the same type. The compiler should make the eltype the concrete type or first common supertype.

src/system_data.jl Outdated Show resolved Hide resolved
src/system_data.jl Outdated Show resolved Hide resolved
Copy link
Member

@jd-lara jd-lara left a comment

Choose a reason for hiding this comment

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

Left some minor comments to consider

Copy link

codecov bot commented Jan 9, 2024

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (651a389) 78.93% compared to head (9c59ca2) 78.81%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #323      +/-   ##
==========================================
- Coverage   78.93%   78.81%   -0.13%     
==========================================
  Files          52       52              
  Lines        4121     4135      +14     
==========================================
+ Hits         3253     3259       +6     
- Misses        868      876       +8     
Flag Coverage Δ
unittests 78.81% <66.66%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/component.jl 94.67% <100.00%> (-0.57%) ⬇️
src/internal.jl 80.70% <100.00%> (ø)
src/time_series_interface.jl 82.12% <100.00%> (ø)
src/system_data.jl 89.71% <56.25%> (-1.40%) ⬇️

@jd-lara jd-lara merged commit 0ac534a into NREL-Sienna:main Jan 15, 2024
7 of 9 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