import pandapower
import networkx
[docs]
def import_pandapower_model_json(json_path: str) -> pandapower.pandapowerNet:
"""
Import method to load pandapower model from the on windows
created JSON File.
:param json_path: path to the location of the json file to be \
imported
:type json_path: str
:return: **-** (pandapower.pandapowerNet) - pandapowerNet \
instance loaded from the json file
"""
return pandapower.from_json(json_path)
[docs]
def create_nxgraph(network: pandapower.pandapowerNet):
"""
Method to create a networkx graph of the pandapower network.
TODO check return types
:param network: pandapower network for which the networkx \
graph will be created
:type network: pandapower.pandapowerNet
:return: **nxg_network** (?) - networkx graph components of \
the considered network
**pos** (?) - position of the networkx graph \
components
"""
# get the networkx graph parameter of the pandapower network
nxg_network = pandapower.topology.create_nxgraph(
net=network,
include_trafos=True
)
# get the positions of nodes and edges for more structured plotting
pos = networkx.drawing.nx_agraph.graphviz_layout(nxg_network, prog="neato")
# return graph components and positions
return nxg_network, pos