Skip to content

Commit

Permalink
Merge pull request #72 from openEDI/jm/fix_incidence_aws
Browse files Browse the repository at this point in the history
Fix incidence for 3-winding transformers
  • Loading branch information
josephmckinsey authored Mar 26, 2024
2 parents 62c418a + d18ac8f commit 1369855
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions LocalFeeder/FeederSimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,14 +831,33 @@ def get_incidences(self) -> IncidenceList:
equipment_types = []
for line in dss.Lines.AllNames():
dss.Circuit.SetActiveElement("Line." + line)
from_bus, to_bus = dss.CktElement.BusNames()
names = dss.CktElement.BusNames()
if len(names) != 2:
bus_names = map(lambda x: x.split(".")[0], names)
# dicts are insert-ordered in >=3.7
names = list(dict.fromkeys(bus_names))
if len(names) != 2:
logging.info(
f"Line {line} has {len(names)} terminals, skipping in incidence matrix"
)
continue
from_bus, to_bus = names
from_list.append(from_bus.upper())
to_list.append(to_bus.upper())
equipment_ids.append(line)
equipment_types.append("Line")
for transformer in dss.Transformers.AllNames():
dss.Circuit.SetActiveElement("Transformer." + transformer)
from_bus, to_bus = dss.CktElement.BusNames()
names = dss.CktElement.BusNames()
if len(names) != 2:
bus_names = map(lambda x: x.split(".")[0], names)
names = list(dict.fromkeys(bus_names))
if len(names) != 2:
logging.info(
f"Transformer {transformer} has {len(names)} terminals, skipping in incidence matrix"
)
continue
from_bus, to_bus = names
from_list.append(from_bus.upper())
to_list.append(to_bus.upper())
equipment_ids.append(transformer)
Expand Down

0 comments on commit 1369855

Please sign in to comment.