Skip to content

Commit

Permalink
Adds support for dss circuits without declared buses in dssToOmd.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjankovic committed Mar 26, 2024
1 parent 2f0fc27 commit d52e62d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions omf/solvers/opendss/dssConvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,17 +552,18 @@ def dssToOmd(dssFilePath, omdFilePath, RADIUS=0.0002, write_out=True):
parent_name = ob['parent']
# Only do child movement if RADIUS > 0.
if RADIUS > 0:
# get location of parent object.
parent_loc = name_map[parent_name]
parent_ob = evil_glm[parent_loc]
parent_lat = parent_ob.get('latitude', None)
parent_lon = parent_ob.get('longitude', None)
# place randomly on circle around parent.
angle = random.random()*3.14159265*2;
x = math.cos(angle)*RADIUS;
y = math.sin(angle)*RADIUS;
ob['latitude'] = str(float(parent_lat) + x)
ob['longitude'] = str(float(parent_lon) + y)
if name_map.get(parent_name): # Dss files without explicity set bus coords will break on this function without this line.
# get location of parent object.
parent_loc = name_map[parent_name]
parent_ob = evil_glm[parent_loc]
parent_lat = parent_ob.get('latitude', None)
parent_lon = parent_ob.get('longitude', None)
# place randomly on circle around parent.
angle = random.random()*3.14159265*2;
x = math.cos(angle)*RADIUS;
y = math.sin(angle)*RADIUS;
ob['latitude'] = str(float(parent_lat) + x)
ob['longitude'] = str(float(parent_lon) + y)
if write_out:
evilToOmd(evil_glm, omdFilePath)
return evil_glm
Expand Down

0 comments on commit d52e62d

Please sign in to comment.