From bd8e34479db5c20f18e7a5ef9783c3b3d69d8b81 Mon Sep 17 00:00:00 2001 From: Joseph McKinsey Date: Mon, 25 Mar 2024 17:34:32 -0600 Subject: [PATCH] Add incidence matrix fix for 3-winding transformer --- LocalFeeder/FeederSimulator.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/LocalFeeder/FeederSimulator.py b/LocalFeeder/FeederSimulator.py index db13800..c4b3a97 100644 --- a/LocalFeeder/FeederSimulator.py +++ b/LocalFeeder/FeederSimulator.py @@ -829,9 +829,11 @@ def get_incidences(self) -> IncidenceList: dss.Circuit.SetActiveElement("Line." + line) names = dss.CktElement.BusNames() if len(names) != 2: - logging.info(f"Line {line} does not have two terminals") - continue - from_bus, to_bus = names + bus_names = map(lambda x: x.split(".")[0], names) + # dicts are insert-ordered in >=3.7 + from_bus, to_bus = dict.fromkeys(bus_names) + else: + from_bus, to_bus = names from_list.append(from_bus.upper()) to_list.append(to_bus.upper()) equipment_ids.append(line) @@ -840,8 +842,8 @@ def get_incidences(self) -> IncidenceList: dss.Circuit.SetActiveElement("Transformer." + transformer) names = dss.CktElement.BusNames() if len(names) != 2: - logging.info(f"Transformer {transformer} does not have two terminals") - continue + bus_names = map(lambda x: x.split(".")[0], names) + from_bus, to_bus = dict.fromkeys(bus_names) from_bus, to_bus = names from_list.append(from_bus.upper()) to_list.append(to_bus.upper())