-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add ComponentSelector
feature: IS portion
#342
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #342 +/- ##
==========================================
+ Coverage 77.94% 78.47% +0.53%
==========================================
Files 69 71 +2
Lines 5622 5743 +121
==========================================
+ Hits 4382 4507 +125
+ Misses 1240 1236 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
We need working implementations of |
1732638
to
83ea408
Compare
Rebased onto |
f4e395d
to
d4c3aff
Compare
0344a74
to
915d247
Compare
915d247
to
b11ccf6
Compare
c5de532
to
78acc9d
Compare
ComponentSelector
feature: IS portion
This is now ready for in-depth code review! For a demonstration, see https://github.nrel.gov/gkonars/PowerAnalytics-demos/blob/main/component_selector_pr_demo.ipynb. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a first pass to get some pedantic stuff out of the way.
src/component_selector.jl
Outdated
function get_components(e::FilterComponentSelector, sys::SYSTEM_LIKE; filterby = nothing) | ||
components = get_components(e.filter_fn, e.component_subtype, sys) | ||
isnothing(filterby) && (return components) | ||
return Iterators.filter(filterby, components) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the function type unstable. We created FlattenIteratorWrapper
so that we know the length. We shouldn't return different types based on a kwarg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any performance concerns with adding the second filter + iterator? Basically, how much slower is this implementation vs combining the two filter functions into one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_components
now always returns FlattenIteratorWrapper
. I also ended up combining the two filter functions into one as an implementation detail (not for performance, it just ended up being more convenient with FlattenIteratorWrapper
).
This reverts commit 15b3f31.
edaf6b1
to
701591e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This draft PR will get filled in as @tengis-nrl and I move the ComponentSelector features from PowerAnalytics to InfrastructureSystems.Ready for review! Adds an immutable, lazy, system-independent representation of a grouped set of components. For more details and a demonstration, see https://github.nrel.gov/gkonars/PowerAnalytics-demos/blob/main/component_selector_pr_demo.ipynb.