-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1196 from NREL-Sienna/gks/use_component_selector
Add `ComponentSelector` feature: PSI portion
- Loading branch information
Showing
5 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Analogous to `src/get_components_interface.jl` in PowerSystems.jl, see comments there. | ||
|
||
# get_components | ||
""" | ||
Calling `get_components` on a `Results` is the same as calling | ||
[`get_available_components`] on the system attached to the results. | ||
""" | ||
PSY.get_components( | ||
::Type{T}, | ||
res::IS.Results; | ||
subsystem_name = nothing, | ||
) where {T <: IS.InfrastructureSystemsComponent} = | ||
IS.get_components(T, res; subsystem_name = subsystem_name) | ||
|
||
PSY.get_components(res::IS.Results, attribute::IS.SupplementalAttribute) = | ||
IS.get_components(res, attribute) | ||
|
||
PSY.get_components( | ||
filter_func::Function, | ||
::Type{T}, | ||
res::IS.Results; | ||
subsystem_name = nothing, | ||
) where {T <: IS.InfrastructureSystemsComponent} = | ||
IS.get_components(filter_func, T, res; subsystem_name = subsystem_name) | ||
|
||
PSY.get_components( | ||
scope_limiter::Union{Function, Nothing}, | ||
selector::IS.ComponentSelector, | ||
res::IS.Results, | ||
) = | ||
IS.get_components(scope_limiter, selector, res) | ||
|
||
PSY.get_components(selector::IS.ComponentSelector, res::IS.Results) = | ||
IS.get_components(selector, res) | ||
|
||
# get_component | ||
""" | ||
Calling `get_component` on a `Results` is the same as calling | ||
[`get_available_component`] on the system attached to the results. | ||
""" | ||
PSY.get_component(res::IS.Results, uuid::Base.UUID) = IS.get_component(res, uuid) | ||
PSY.get_component(res::IS.Results, uuid::String) = IS.get_component(res, uuid) | ||
|
||
PSY.get_component( | ||
::Type{T}, | ||
res::IS.Results, | ||
name::AbstractString, | ||
) where {T <: IS.InfrastructureSystemsComponent} = | ||
IS.get_component(T, res, name) | ||
|
||
PSY.get_component( | ||
scope_limiter::Union{Function, Nothing}, | ||
selector::IS.SingularComponentSelector, | ||
res::IS.Results, | ||
) = | ||
IS.get_component(scope_limiter, selector, res) | ||
|
||
PSY.get_component(selector::IS.SingularComponentSelector, res::IS.Results) = | ||
IS.get_component(selector, res) | ||
|
||
# get_groups | ||
""" | ||
Calling `get_groups` on a `Results` is the same as calling [`get_available_groups`] on | ||
the system attached to the results. | ||
""" | ||
PSY.get_groups( | ||
scope_limiter::Union{Function, Nothing}, | ||
selector::IS.ComponentSelector, | ||
res::IS.Results, | ||
) = | ||
IS.get_groups(scope_limiter, selector, res) | ||
|
||
PSY.get_groups(selector::IS.ComponentSelector, res::IS.Results) = | ||
IS.get_groups(selector, res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters