-
Notifications
You must be signed in to change notification settings - Fork 46
SparseMatrixErrors: power flow and short circuit special case #1175
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
Closed
Closed
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
934cacf
add cases
nitbharambe 49aaadc
add small admittance
nitbharambe fff6c74
approach 2
nitbharambe 9e4c593
minor
nitbharambe 859990e
minor 2
nitbharambe 963dc83
address comment
nitbharambe bca9cb2
try 1e-12
nitbharambe b45f026
add tests
nitbharambe 527e502
remove excess
nitbharambe 31997d9
add iteration diverge for xfail
nitbharambe fe07fd4
rename case
nitbharambe 99f4788
Merge branch 'main' into fix/sparse-matrix-errors-transformers
TonyXiang8787 a7834d9
[skip ci] down merge, add cassert
TonyXiang8787 6ccbdfa
[skip ci] restructure test
TonyXiang8787 b9c4e61
add suceeded scenarios
nitbharambe 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 |
|---|---|---|
|
|
@@ -257,6 +257,22 @@ class Transformer : public Branch { | |
| param0.ytt() = y0_series; | ||
| } | ||
|
|
||
| auto const low_from_admittance = 0.5 * 1e-6; | ||
| auto const low_to_admittance = 0.5 * 1e-6; | ||
| bool const zero_seq_available_from = | ||
| (winding_from_ == WindingType::wye_n && winding_to_ == WindingType::wye_n) || | ||
| (winding_from_ == WindingType::wye_n && winding_to_ == WindingType::delta) || | ||
| winding_from_ == WindingType::zigzag_n; | ||
| bool const zero_seq_available_to = (winding_to_ == WindingType::wye_n && winding_from_ == WindingType::wye_n) || | ||
| (winding_to_ == WindingType::wye_n && winding_from_ == WindingType::delta) || | ||
| winding_to_ == WindingType::zigzag_n; | ||
| if (!zero_seq_available_from && from_status()) { | ||
| param0.yff() += DoubleComplex{0.0, -low_from_admittance}; | ||
| } | ||
| if (!zero_seq_available_to && to_status()) { | ||
| param0.ytt() += DoubleComplex{0.0, -low_to_admittance}; | ||
| } | ||
|
|
||
| // for the rest param0 is zero | ||
| // calculate yabc | ||
| ComplexTensor<asymmetric_t> const sym_matrix = get_sym_matrix(); | ||
|
|
@@ -268,6 +284,16 @@ class Transformer : public Branch { | |
| y012 << param0.value[i], 0.0, 0.0, 0.0, param1.value[i], 0.0, 0.0, 0.0, param2.value[i]; | ||
| param.value[i] = dot(sym_matrix, y012, sym_matrix_inv); | ||
| } | ||
|
|
||
| // for (size_t phase = 0; phase < 3; ++phase) { | ||
|
Member
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. Just a reminder that there is commented out code here |
||
|
|
||
| // if (from_status()) { | ||
| // param.yff()(phase, phase) += DoubleComplex{0.0, -low_from_admittance}; | ||
| // } | ||
| // if (to_status()) { | ||
| // param.ytt()(phase, phase) += DoubleComplex{0.0, -low_to_admittance}; | ||
| // } | ||
| // } | ||
| return param; | ||
| } | ||
| }; | ||
|
|
||
7 changes: 7 additions & 0 deletions
7
tests/data/power_flow/linear-pf-sparse-matrix-error/asym_output.json
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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "version": "1.0", | ||
| "type": "asym_output", | ||
| "is_batch": false, | ||
| "attributes": {}, | ||
| "data": {} | ||
| } |
3 changes: 3 additions & 0 deletions
3
tests/data/power_flow/linear-pf-sparse-matrix-error/asym_output.json.license
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]> | ||
|
|
||
| SPDX-License-Identifier: MPL-2.0 |
18 changes: 18 additions & 0 deletions
18
tests/data/power_flow/linear-pf-sparse-matrix-error/input.json
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 |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "version": "1.0", | ||
| "type": "input", | ||
| "is_batch": false, | ||
| "attributes": {}, | ||
| "data": { | ||
| "node": [ | ||
| {"id": 2, "u_rated": 10000}, | ||
| {"id": 4, "u_rated": 100} | ||
| ], | ||
| "transformer": [ | ||
| {"id": 3, "from_node": 2, "to_node": 4, "from_status": 1, "to_status": 1, "u1": 10000, "u2": 400, "sn": 630000, "uk": 0.047, "pk": 1470, "i0": 0, "p0": 0, "winding_from": 0, "winding_to": 1, "clock": 0, "tap_side": 0, "tap_pos": 3, "tap_min": 1, "tap_max": 5, "tap_nom": 3, "tap_size": 250, "r_grounding_from": 0, "x_grounding_from": 0, "r_grounding_to": 0, "x_grounding_to": 0} | ||
| ], | ||
| "source": [ | ||
| {"id": 1, "node": 2, "status": 1, "u_ref": 1, "sk": 1000000000000000, "rx_ratio": 1, "z01_ratio": 1} | ||
| ] | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
tests/data/power_flow/linear-pf-sparse-matrix-error/input.json.license
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]> | ||
|
|
||
| SPDX-License-Identifier: MPL-2.0 |
5 changes: 5 additions & 0 deletions
5
tests/data/power_flow/linear-pf-sparse-matrix-error/params.json
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "calculation_method": "linear", | ||
| "rtol": 1e-08, | ||
| "atol": 1e-08 | ||
| } |
3 changes: 3 additions & 0 deletions
3
tests/data/power_flow/linear-pf-sparse-matrix-error/params.json.license
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]> | ||
|
|
||
| SPDX-License-Identifier: MPL-2.0 |
21 changes: 21 additions & 0 deletions
21
tests/data/short_circuit/sc-sparse-matrix-error/input.json
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 |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "version": "1.0", | ||
| "type": "input", | ||
| "is_batch": false, | ||
| "attributes": {}, | ||
| "data": { | ||
| "node": [ | ||
| {"id": 2, "u_rated": 10000}, | ||
| {"id": 4, "u_rated": 100} | ||
| ], | ||
| "transformer": [ | ||
| {"id": 3, "from_node": 2, "to_node": 4, "from_status": 1, "to_status": 1, "u1": 10000, "u2": 100, "sn": 100000, "uk": 0.10000000000000001, "pk": 1000, "i0": 0, "p0": 0, "winding_from": 1, "winding_to": 0, "clock": 0, "tap_side": 0, "tap_pos": -1, "tap_min": -10, "tap_max": 10, "tap_nom": 0, "tap_size": 100, "r_grounding_from": 0, "x_grounding_from": 0, "r_grounding_to": 0, "x_grounding_to": 0} | ||
| ], | ||
| "source": [ | ||
| {"id": 1, "node": 2, "status": 1, "u_ref": 1, "sk": 10000000000, "rx_ratio": 0.10000000000000001, "z01_ratio": 1} | ||
| ], | ||
| "fault": [ | ||
| {"id": 11, "status": 1, "fault_type": 2, "fault_phase": 4, "fault_object": 4, "r_f": 0, "x_f": 0} | ||
| ] | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
tests/data/short_circuit/sc-sparse-matrix-error/input.json.license
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]> | ||
|
|
||
| SPDX-License-Identifier: MPL-2.0 |
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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "calculation_method": "iec60909", | ||
| "rtol": 1e-08, | ||
| "atol": 1e-08, | ||
| "short_circuit_voltage_scaling": "maximum" | ||
| } |
3 changes: 3 additions & 0 deletions
3
tests/data/short_circuit/sc-sparse-matrix-error/params.json.license
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]> | ||
|
|
||
| SPDX-License-Identifier: MPL-2.0 |
7 changes: 7 additions & 0 deletions
7
tests/data/short_circuit/sc-sparse-matrix-error/sc_output.json
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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "version": "1.0", | ||
| "type": "sc_output", | ||
| "is_batch": false, | ||
| "attributes": {}, | ||
| "data": {} | ||
| } |
3 changes: 3 additions & 0 deletions
3
tests/data/short_circuit/sc-sparse-matrix-error/sc_output.json.license
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]> | ||
|
|
||
| SPDX-License-Identifier: MPL-2.0 |
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.
Uh oh!
There was an error while loading. Please reload this page.