Skip to content

Conversation

luke-kiernan
Copy link
Collaborator

@luke-kiernan luke-kiernan commented Aug 11, 2025

Replace some of the copy-pastes in computing the ybus entries with multiple dispatch. Some of this infrastructure (_get_angle, _get_tap, TransformerWindingDispatch) could be moved into PSY if desired.

(In order to recover the flows after a degree 2 reduction, I need to go from the component to the the 4 y_{ff/tf/ft/tt} numbers. Since I was refactoring things anyway, I decided to take the time to figure out how to de-duplicate things.)

Copy link
Member

@jd-lara jd-lara left a comment

Choose a reason for hiding this comment

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

I am not convinced that using a macro for the three winding transformer here is necessary. It is way over engineered for a relatively simple function. Please provide more detail as to why this makes sense.

Copy link
Member

@jd-lara jd-lara left a comment

Choose a reason for hiding this comment

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

My biggest concern with this code is that I can't tell if those macros will be compiled at pre-compiled or need to wait for a runtime execution.

@luke-kiernan
Copy link
Collaborator Author

I'll remove the macros, and put the 3WT code back to how it was.

Copy link
Contributor

@m-bossart m-bossart left a comment

Choose a reason for hiding this comment

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

We can update this with the name changes in PowerSystems: NREL-Sienna/PowerSystems.jl#1511

return
end

_get_shunt(br::PSY.ACTransmission, node::Symbol) =
Copy link
Member

Choose a reason for hiding this comment

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

There is some mild type piracy here but it isn't outrageous

@jd-lara jd-lara merged commit a1a3c8c into psy5 Aug 15, 2025
3 of 8 checks passed
@luke-kiernan luke-kiernan deleted the lk/ybus-refactor branch August 15, 2025 21:13
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.

3 participants