From 4dc3b3895afc5a8193db761f96e580503d98702d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 03:13:08 +0000 Subject: [PATCH 1/2] Bump grid-data-models from 2.3.0 to 2.3.1 Bumps [grid-data-models](https://github.com/NREL-Distribution-Suites/grid-data-models) from 2.3.0 to 2.3.1. - [Release notes](https://github.com/NREL-Distribution-Suites/grid-data-models/releases) - [Commits](https://github.com/NREL-Distribution-Suites/grid-data-models/compare/V2.3.0...v2.3.1) --- updated-dependencies: - dependency-name: grid-data-models dependency-version: 2.3.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 692236e..79693cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ ] dependencies = [ "opendssdirect.py", - "grid-data-models==2.3.0", + "grid-data-models==2.3.1", "rdflib", "NREL-altdss-schema==0.0.2", "typer", From 4f07d0757252d4d7fcbc7dbb209cf9f2db81a35c Mon Sep 17 00:00:00 2001 From: Aadil Latif Date: Thu, 5 Mar 2026 21:30:14 -0700 Subject: [PATCH 2/2] Fix compatibility with grid-data-models 2.3.1 --- .github/workflows/pull_request_tests.yml | 2 +- src/ditto/readers/opendss/components/branches.py | 11 ++++++++--- src/ditto/readers/opendss/graph_utils.py | 4 ++++ tests/test_opendss/conftest.py | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull_request_tests.yml b/.github/workflows/pull_request_tests.yml index 2e87148..90ddbfc 100644 --- a/.github/workflows/pull_request_tests.yml +++ b/.github/workflows/pull_request_tests.yml @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest name: "ruff" steps: - - uses: davidslusser/actions_python_ruff@v1.0.1 + - uses: davidslusser/actions_python_ruff@v1.0.3 with: src: "check src" pip_install_command: "pip install -e .[dev,mcp]" diff --git a/src/ditto/readers/opendss/components/branches.py b/src/ditto/readers/opendss/components/branches.py index db7bfda..073db74 100644 --- a/src/ditto/readers/opendss/components/branches.py +++ b/src/ditto/readers/opendss/components/branches.py @@ -240,6 +240,13 @@ def get_matrix_branch_equipments() -> ( return matrix_branch_equipments_catalog, thermal_limit_catalog +def _add_neutral_phase_to_buses(system, bus1, bus2): + for bus in [bus1, bus2]: + bus_obj = system.get_component(DistributionBus, bus) + if Phase.N not in bus_obj.phases: + bus_obj.phases.append(Phase.N) + + def get_branches( system: System, mapping: dict[str, str], @@ -283,9 +290,7 @@ def get_branches( nodes.append("4") if "4" in nodes: - for bus in [bus1, bus2]: - bus_obj = system.get_component(DistributionBus, bus) - bus_obj.phases.append(Phase.N) + _add_neutral_phase_to_buses(system, bus1, bus2) geometry_branch = GeometryBranch.model_construct( name=odd.Lines.Name().lower(), diff --git a/src/ditto/readers/opendss/graph_utils.py b/src/ditto/readers/opendss/graph_utils.py index 4bea64a..d6edb0d 100644 --- a/src/ditto/readers/opendss/graph_utils.py +++ b/src/ditto/readers/opendss/graph_utils.py @@ -145,12 +145,16 @@ def _fix_bus_phases( if u != hv_xfmr_bus: bus = system.get_component(DistributionBus, u) bus.phases = _mapped_phases(mapped_split_phases, bus.phases) + if Phase.N in bus.phases: + bus.phases.remove(Phase.N) for _, _, data in subgraph.edges(data=True): model: DistributionBranchBase = system.get_component(data["type"], data["name"]) if not issubclass(model.__class__, DistributionBranchBase): raise TypeError(f"Unsupported model type {model.__class__.__name__}") model.phases = _mapped_phases(mapped_split_phases, model.phases) + if Phase.N in model.phases: + model.phases.remove(Phase.N) def _mapped_phases(mapped_split_phases, phases): diff --git a/tests/test_opendss/conftest.py b/tests/test_opendss/conftest.py index ab931ed..7adc9b0 100644 --- a/tests/test_opendss/conftest.py +++ b/tests/test_opendss/conftest.py @@ -203,7 +203,7 @@ def build_split_phase_distribution_buses(): update={ "uuid": uuid4(), "name": f"split_phase_bus_{i}", - "phases": [Phase.S1, Phase.S2, Phase.N], + "phases": [Phase.S1, Phase.S2], "rated_voltage": Voltage(120, "volt"), "voltage_type": VoltageTypes.LINE_TO_GROUND, }