Open ccoffrin opened 4 years ago
This has been added to PowerPlots, where the the data in turned into a struct with fields that are dataframes of the components. https://github.com/WISPO-POP/PowerPlots.jl/blob/35abd1406afd702d6dc1495c60386253a49dc040/src/core/types.jl#L41
For quick code that turns a component dictionary into a dataframe there is _comp_dict_to_dataframe()
This currently works for single and multi-networks (I know nothing about multi-infrastructure). The struct is only for components that PowerPlots currently supports, but that could be modified.
julia> using PowerPlots, PowerModels
julia> data = PowerModels.parse_file("$(joinpath(dirname(pathof(PowerModels)), ".."))/test/data/matpower/case5.m")
julia> data_mn = replicate(data,2)
julia> PMDF = PowerModelsDataFrame(data_mn)
julia> PMDF.bus
10×13 DataFrame
Row │ zone bus_i bus_type vmax ComponentType source_id nw_id area vmin index va vm base_kv
│ Int64 Int64 Int64 Float64 String String String Int64 Float64 Int64 Float64 Float64 Float64
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ 1 4 3 1.1 bus Any["bus", 4] 1 1 0.9 4 0.0 1.0 230.0
2 │ 1 1 2 1.1 bus Any["bus", 1] 1 1 0.9 1 0.048935 1.0 230.0
3 │ 1 10 2 1.1 bus Any["bus", 10] 1 1 0.9 10 0.0626631 1.0 230.0
....
If there is interest, this feature could be a part of PMA.
One feature that I have heard a request for is transforming the data dict into a collection of DataFrames so that it can be used in standard data analytics processes.