Skip to content

Commit

Permalink
Adds support for converting omd to networkx in dss_to_networkx.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjankovic committed Mar 18, 2024
1 parent 549d243 commit 7906525
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions omf/solvers/opendss/dssConvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,12 @@ def omdToTree(omdFilePath):
dss_tree = evilGldTreeToDssTree(evil_tree)
return dss_tree

def dss_to_networkx(dssFilePath, tree=None):
def dss_to_networkx(dssFilePath, tree=None, omd=None):
''' Return a networkx directed graph from a dss file. If tree is provided, build graph from that instead of the file. '''
if tree == None:
tree = dssToTree(dssFilePath)
omd = evilDssTreeToGldTree(tree)
if omd == None:
omd = evilDssTreeToGldTree(tree)
# Gather edges, leave out source and circuit objects
edges = [(ob['from'],ob['to']) for ob in omd.values() if 'from' in ob and 'to' in ob]
edges_sub = [
Expand Down

0 comments on commit 7906525

Please sign in to comment.