Skip to content

Commit

Permalink
ComponentSelector: make scope_limiter an optional first argument
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielKS committed Jan 17, 2025
1 parent 819a49a commit bbaf11e
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions src/simulation/get_components_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ PSY.get_components(
) where {T <: IS.InfrastructureSystemsComponent} =
IS.get_components(filter_func, T, res; subsystem_name = subsystem_name)

PSY.get_components(selector::IS.ComponentSelector, res::IS.Results; kwargs...) =
IS.get_components(selector, res; kwargs...)
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
"""
Expand All @@ -41,13 +48,27 @@ PSY.get_component(
) where {T <: IS.InfrastructureSystemsComponent} =
IS.get_component(T, res, name)

PSY.get_component(selector::IS.SingularComponentSelector, res::IS.Results; kwargs...) =
IS.get_component(selector, res; kwargs...)
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`](@ref) on
the system attached to the results.
"""
PSY.get_groups(selector::IS.ComponentSelector, res::IS.Results; kwargs...) =
IS.get_groups(selector, res; kwargs...)
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)

0 comments on commit bbaf11e

Please sign in to comment.