Skip to content

Commit

Permalink
filter_attributes logic.
Browse files Browse the repository at this point in the history
Signed-off-by: Bertrand Rix <[email protected]>
  • Loading branch information
obrix committed Sep 20, 2024
1 parent 8dc62f0 commit ba1c684
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Network.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ module Network
end

function get_elements(network::NetworkHandle, type::Powsybl.ElementType, all_attributes::Bool = false, attributes::Vector{String} = Vector{String}())
series_array = Powsybl.create_network_elements_series_array(network.handle, type, StdVector{StdString}(attributes), Powsybl.ALL_ATTRIBUTES, per_unit, nominal_apparent_power)
filter_attributes = Powsybl.DEFAULT_ATTRIBUTES
if all_attributes
filter_attributes = Powsybl.ALL_ATTRIBUTES
elseif !isempty(attributes)
filter_attributes = Powsybl.SELECTION_ATTRIBUTES
end

if all_attributes && !isempty(attributes)
throw("parameters \"all_attributes\" and \"attributes\" are mutually exclusive")
end
series_array = Powsybl.create_network_elements_series_array(network.handle, type, StdVector{StdString}(attributes), filter_attributes, per_unit, nominal_apparent_power)
return create_dataframe_from_series_array(series_array[])
end

Expand Down

0 comments on commit ba1c684

Please sign in to comment.