Skip to content
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Copy link
Member

@petersalemink95 petersalemink95 Nov 14, 2025

Choose a reason for hiding this comment

The 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;
}
};
Expand Down
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": {}
}
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 tests/data/power_flow/linear-pf-sparse-matrix-error/input.json
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}
]
}
}
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"calculation_method": "linear",
"rtol": 1e-08,
"atol": 1e-08
}
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 tests/data/short_circuit/sc-sparse-matrix-error/input.json
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}
]
}
}
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
6 changes: 6 additions & 0 deletions tests/data/short_circuit/sc-sparse-matrix-error/params.json
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"
}
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
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": {}
}
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
Loading