-
Notifications
You must be signed in to change notification settings - Fork 100
update supplemental accessors #1574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jd-lara
wants to merge
1
commit into
main
Choose a base branch
from
jd/review_supplemental-accessors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,10 +95,67 @@ Returns 1/(R + jX) where R is resistance and X is reactance. | |
| """ | ||
| get_series_admittance(b::ACTransmission) = 1 / (get_r(b) + get_x(b) * 1im) | ||
|
|
||
| """ | ||
| Calculate the series admittance of a [`PhaseShiftingTransformer`](@ref) accounting for the tap ratio. | ||
| For a phase-shifting transformer, the series admittance is calculated as the inverse of the | ||
| complex impedance modified by the tap ratio, following the same pattern as the susceptance calculation: | ||
| Y = 1/(tap * (R + jX)). | ||
| The phase angle α affects the admittance matrix construction but not the series impedance magnitude directly. | ||
|
|
||
| See also: [`get_series_susceptance`](@ref) | ||
| """ | ||
| function get_series_admittance(b::PhaseShiftingTransformer) | ||
| tap = get_tap(b) | ||
| Z_series = get_r(b) + get_x(b) * 1im | ||
| return 1 / (tap * Z_series) | ||
| end | ||
|
|
||
| """ | ||
| Calculate the series admittance of a [`TapTransformer`](@ref) accounting for the tap ratio. | ||
| For a tap transformer, the series admittance is calculated as the inverse of the | ||
| complex impedance modified by the tap ratio, following the same pattern as the susceptance calculation: | ||
| Y = 1/(tap * (R + jX)). | ||
|
|
||
| See also: [`get_series_susceptance`](@ref) | ||
| """ | ||
| function get_series_admittance(b::TapTransformer) | ||
| tap = get_tap(b) | ||
| Z_series = get_r(b) + get_x(b) * 1im | ||
| return 1 / (tap * Z_series) | ||
| end | ||
|
|
||
| """ | ||
| Calculate the series admittances of a [`PhaseShiftingTransformer3W`](@ref) as three complex values | ||
| (for each of the 3 branches) accounting for turns ratios. | ||
| For each winding, the series admittance is calculated following the same pattern as the susceptance calculation: | ||
| Yi = 1/(turns_ratio_i * (Ri + jXi)). | ||
| The phase shift angles affect the admittance matrix construction but not the series impedance magnitudes directly. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "The phase shift angles affect the admittance matrix construction but not the series admittance values directly." |
||
|
|
||
| See also: [`get_series_admittance`](@ref) for 2-winding transformers | ||
| """ | ||
| function get_series_admittances(b::PhaseShiftingTransformer3W) | ||
| # Get the turns ratios for each winding | ||
| tap_primary = get_primary_turns_ratio(b) | ||
| tap_secondary = get_secondary_turns_ratio(b) | ||
| tap_tertiary = get_tertiary_turns_ratio(b) | ||
|
|
||
| # Calculate series impedances | ||
| Z1 = get_r_primary(b) + get_x_primary(b) * 1im | ||
| Z2 = get_r_secondary(b) + get_x_secondary(b) * 1im | ||
| Z3 = get_r_tertiary(b) + get_x_tertiary(b) * 1im | ||
|
|
||
| # Calculate admittances accounting for turns ratios (consistent with susceptance pattern) | ||
| Y1 = 1 / (tap_primary * Z1) | ||
| Y2 = 1 / (tap_secondary * Z2) | ||
| Y3 = 1 / (tap_tertiary * Z3) | ||
|
|
||
| return (Y1, Y2, Y3) | ||
| end | ||
|
|
||
| function get_series_admittance(::Union{PhaseShiftingTransformer3W, Transformer3W}) | ||
| throw( | ||
| ArgumentError( | ||
| "get_series_admittance not implemented for multi-winding transformers.", | ||
| "get_series_admittance not implemented for multi-winding transformers, use get_series_admittances instead.", | ||
| ), | ||
| ) | ||
| end | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The phase angle α affects the admittance matrix construction but not the series admittance value directly."