Skip to content

feat: Add opt-in construction-attribute classification for distribution lines - #92

Open
m1muralid wants to merge 4 commits into
mainfrom
mm/update_dist_line_mapping
Open

feat: Add opt-in construction-attribute classification for distribution lines#92
m1muralid wants to merge 4 commits into
mainfrom
mm/update_dist_line_mapping

Conversation

@m1muralid

Copy link
Copy Markdown
Collaborator

The c_matrix threshold (> 0.05 uF/km = underground) misclassifies models whose converted underground cables carry default or low capacitance values. USE_CONSTRUCTION_ATTRIBUTE in gdm_mapping (default False, legacy behavior unchanged) switches the two distribution-line filters to the equipment's construction attribute instead.

Usage:

import erad.gdm_mapping
erad.gdm_mapping.USE_CONSTRUCTION_ATTRIBUTE = True   # before AssetSystem.from_gdm(...)

Testing:

  • pytest: 111 passed, the 3 failures also fail on main.

…ranch

The c_matrix threshold (> 0.05 uF/km = underground) misclassifies models
whose converted underground cables carry default or low capacitance
values. USE_CONSTRUCTION_ATTRIBUTE in gdm_mapping (default False, legacy
behavior unchanged) switches the two distribution-line filters to the
equipment's construction attribute instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds an opt-in switch in erad.gdm_mapping to classify distribution MatrixImpedanceBranch lines as overhead vs underground using the GDM equipment construction attribute (via LineType) instead of the legacy c_matrix capacitance threshold heuristic, while keeping default behavior unchanged.

Changes:

  • Introduced USE_CONSTRUCTION_ATTRIBUTE (default False) to toggle classification logic.
  • Updated the distribution underground/overhead MatrixImpedanceBranch filters to use equipment.construction when the flag is enabled.
  • Added LineType import to support the new construction-based comparisons.
File summaries
File Description
src/erad/gdm_mapping.py Adds an opt-in flag and updates distribution line classification filters to optionally use equipment.construction (LineType) instead of c_matrix thresholds.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/erad/gdm_mapping.py
Comment thread src/erad/gdm_mapping.py
Comment on lines +45 to +49
component_filter=lambda x: (
x.equipment.construction == LineType.UNDERGROUND
if USE_CONSTRUCTION_ATTRIBUTE
else x.equipment.c_matrix[0, 0].to("microfarad/kilometer").magnitude > 0.05
)
m1muralid and others added 3 commits September 1, 2026 11:08
Per copilot suggestion

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…-Distribution-Suites/ERAD into mm/update_dist_line_mapping

Merging upstream and downstream changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants