Skip to content
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include <cassert>
#include <cmath>
#include <complex>
#include <concepts>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,21 @@ class Transformer : public Branch {
param0.ytt() = y0_series;
}

auto const low_admittance = 0.5 * 1e-12 * sn_ / base_power_3p / uk_;
Copy link
Member

Choose a reason for hiding this comment

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

Should we call this admittance of susceptance? Since we're only adding it to the imaginary part of Y = G + jB

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_admittance};
}
if (!zero_seq_available_to && to_status()) {
param0.ytt() += DoubleComplex{0.0, -low_admittance};
}

// for the rest param0 is zero
// calculate yabc
ComplexTensor<asymmetric_t> const sym_matrix = get_sym_matrix();
Expand All @@ -269,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,21 @@
{
"version": "1.0",
"type": "asym_output",
"is_batch": false,
"attributes": {},
"data": {
"node": [
{"id": 1, "energized": 1, "u_pu": [0.99999999999992251, 0.99999999999992251, 0.99999999999992251], "u": [5773.5026918958101, 5773.5026918958101, 5773.5026918958101], "u_angle": [6.3296256469447942e-14, -2.0943951023931322, 2.0943951023932588], "p": [3.3332500041435393, 3.3332500041126596, 3.3332500041243667], "q": [33.165418788836249, 33.165418788872792, 33.165418788742407]},
{"id": 2, "energized": 1, "u_pu": [0.9999500024997976, 0.99995000249979771, 0.99995000249979749], "u": [57.732140311942509, 57.732140311942516, 57.732140311942501], "u_angle": [-0.52359877559823542, -2.6179938779914309, 1.5707963267949601], "p": [-2.4789040786828292e-12, -4.9578081573761396e-12, 2.7754187906233796e-11], "q": [-4.1299171686348346e-11, 8.2598343372696058e-11, -3.7005583874973505e-11]}
],
"transformer": [
{"id": 4, "energized": 1, "loading": 0.00099997500124996796, "p_from": [3.3332500041435393, 3.3332500041126596, 3.3332500041243667], "q_from": [33.165418788836249, 33.165418788872792, 33.165418788742407], "i_from": [0.0057733583615496827, 0.0057733583615554463, 0.0057733583615331785], "s_from": [33.332500041686274, 33.332500041719548, 33.332500041590983], "p_to": [-2.4789040786828292e-12, -4.9578081573761396e-12, 2.7754187906233796e-11], "q_to": [-4.1299171686348346e-11, 8.2598343372696058e-11, -3.7005583874973505e-11], "i_to": [7.1664588082487635e-13, 1.4332917616497527e-12, 8.012344526598183e-13], "s_to": [4.1373500545757385e-11, 8.2747001091514797e-11, 4.6256979843719079e-11]}
],
"source": [
{"id": 3, "energized": 1, "p": [3.3332500041435393, 3.3332500041126596, 3.3332500041243667], "q": [33.165418788836249, 33.165418788872792, 33.165418788742414], "i": [0.0057733583615496827, 0.0057733583615554454, 0.0057733583615331794], "s": [33.332500041686274, 33.332500041719541, 33.33250004159099], "pf": [0.099999999999247344, 0.099999999998221123, 0.099999999998958006]}
],
"asym_load": [
{"id": 21, "energized": 0, "p": [-0, -0, -0], "q": [-0, -0, -0], "i": [0, 0, 0], "s": [0, 0, 0], "pf": [0, 0, 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
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": 1, "u_rated": 10000},
{"id": 2, "u_rated": 100}
],
"transformer": [
{"id": 4, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "u1": 10000, "u2": 100, "sn": 100000, "uk": 0.10000000000000001, "pk": 1000, "i0": 0.001, "p0": 10, "winding_from": 2, "winding_to": 1, "clock": 1, "tap_side": 0, "tap_pos": 0, "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": 3, "node": 1, "status": 1, "u_ref": 1, "sk": 1000000000000000, "rx_ratio": 1, "z01_ratio": 2}
],
"asym_load": [
{"id": 21, "node": 2, "status": 0, "type": 0, "p_specified": [1000, 1000, 2000], "q_specified": [1000, 1000, 2000]}
]
}
}
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": "newton_raphson",
"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
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
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": 1, "u_rated": 10000},
{"id": 2, "u_rated": 100}
],
"transformer": [
{"id": 4, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "u1": 10000, "u2": 100, "sn": 100000, "uk": 0.10000000000000001, "pk": 1000, "i0": 0.001, "p0": 10, "winding_from": 0, "winding_to": 0, "clock": 0, "tap_side": 0, "tap_pos": 0, "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": 3, "node": 1, "status": 1, "u_ref": 1, "sk": 1000000000000000, "rx_ratio": 1, "z01_ratio": 2}
],
"asym_load": [
{"id": 21, "node": 2, "status": 0, "type": 0, "p_specified": [1000, 1000, 2000], "q_specified": [1000, 1000, 2000]}
]
}
}
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,9 @@
{
"calculation_method": "newton_raphson",
"rtol": 1e-08,
"atol": 1e-08,
"xfail": {
"raises": "IterationDiverge",
"reason": "Not possible to converge on loaded floating ground"
}
}
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": "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
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": 1, "u_rated": 10000},
{"id": 2, "u_rated": 100}
],
"transformer": [
{"id": 4, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "u1": 10000, "u2": 100, "sn": 100000, "uk": 0.10000000000000001, "pk": 1000, "i0": 0.001, "p0": 10, "winding_from": 0, "winding_to": 1, "clock": 0, "tap_side": 0, "tap_pos": 0, "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": 3, "node": 1, "status": 1, "u_ref": 1, "sk": 1000000000000000, "rx_ratio": 1, "z01_ratio": 2}
],
"asym_load": [
{"id": 21, "node": 2, "status": 0, "type": 0, "p_specified": [1000, 1000, 2000], "q_specified": [1000, 1000, 2000]}
]
}
}
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,9 @@
{
"calculation_method": "newton_raphson",
"rtol": 1e-08,
"atol": 1e-08,
"xfail": {
"raises": "IterationDiverge",
"reason": "Not possible to converge on loaded floating ground"
}
}
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": "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
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": 1, "u_rated": 10000},
{"id": 2, "u_rated": 100}
],
"transformer": [
{"id": 4, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "u1": 10000, "u2": 100, "sn": 100000, "uk": 0.10000000000000001, "pk": 1000, "i0": 0.001, "p0": 10, "winding_from": 1, "winding_to": 2, "clock": 1, "tap_side": 0, "tap_pos": 0, "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": 3, "node": 1, "status": 1, "u_ref": 1, "sk": 1000000000000000, "rx_ratio": 1, "z01_ratio": 2}
],
"asym_load": [
{"id": 21, "node": 2, "status": 0, "type": 0, "p_specified": [1000, 1000, 2000], "q_specified": [1000, 1000, 2000]}
]
}
}
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,9 @@
{
"calculation_method": "newton_raphson",
"rtol": 1e-08,
"atol": 1e-08,
"xfail": {
"raises": "IterationDiverge",
"reason": "Not possible to converge on loaded floating ground"
}
}
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": "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
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": 1, "u_rated": 10000},
{"id": 2, "u_rated": 100}
],
"transformer": [
{"id": 4, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "u1": 10000, "u2": 100, "sn": 100000, "uk": 0.10000000000000001, "pk": 1000, "i0": 0.001, "p0": 10, "winding_from": 1, "winding_to": 0, "clock": 0, "tap_side": 0, "tap_pos": 0, "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": 3, "node": 1, "status": 1, "u_ref": 1, "sk": 1000000000000000, "rx_ratio": 1, "z01_ratio": 2}
],
"asym_load": [
{"id": 21, "node": 2, "status": 0, "type": 0, "p_specified": [1000, 1000, 2000], "q_specified": [1000, 1000, 2000]}
]
}
}
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,9 @@
{
"calculation_method": "newton_raphson",
"rtol": 1e-08,
"atol": 1e-08,
"xfail": {
"raises": "IterationDiverge",
"reason": "Not possible to converge on loaded floating ground"
}
}
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,21 @@
{
"version": "1.0",
"type": "asym_output",
"is_batch": false,
"attributes": {},
"data": {
"node": [
{"id": 1, "energized": 1, "u_pu": [0.99999999999566591, 0.99999999998914324, 0.99999999998924516], "u": [5773.5026918712347, 5773.5026918335761, 5773.5026918341646], "u_angle": [7.4915929693360324e-14, -2.0943951023967693, 2.0943951023970944], "p": [1003.937292662088, 3401.1846204506114, 1615.948356796991], "q": [1039.1755421521718, 1716.5374268727244, 3453.9335695411701]},
{"id": 2, "energized": 1, "u_pu": [0.99665033518158141, 0.99665056845676936, 0.98657290535610098], "u": [57.541633930501675, 57.54164739865093, 56.95981324825361], "u_angle": [-0.52629268653201255, -2.620688080165293, 1.559910231031256], "p": [-999.99999999996146, -1000.0000000000449, -4000.0000000000387], "q": [-999.99999999998295, -999.99999999997976, -4000.0000000000296]}
],
"transformer": [
{"id": 4, "energized": 1, "loading": 0.090679706380342645, "p_from": [1003.937292662088, 3401.1846204506114, 1615.948356796991], "q_from": [1039.1755421521718, 1716.5374268727244, 3453.9335695411701], "i_from": [0.25026641175094039, 0.65987629660171387, 0.6604758783245096], "s_from": [1444.913801929009, 3809.7975747071659, 3813.2592613980901], "p_to": [-999.99999999996146, -1000.0000000000449, -4000.0000000000387], "q_to": [-999.99999999998295, -999.99999999997976, -4000.0000000000296], "i_to": [24.577222886669006, 24.577217134146018, 99.313075779191877], "s_to": [1414.2135623730558, 1414.2135623731126, 5656.8542494924277]}
],
"source": [
{"id": 3, "energized": 1, "p": [1003.937292662088, 3401.1846204506114, 1615.9483567969912], "q": [1039.1755421521718, 1716.5374268727246, 3453.9335695411701], "i": [0.25026641175094039, 0.65987629660171399, 0.6604758783245096], "s": [1444.913801929009, 3809.7975747071659, 3813.2592613980901], "pf": [0.69480773961865239, 0.89274680708253584, 0.42377091249875343]}
],
"asym_load": [
{"id": 21, "energized": 1, "p": [1000, 1000, 4000], "q": [1000, 1000, 4000], "i": [24.577222886669688, 24.577217134145712, 99.313075779191038], "s": [1414.2135623730949, 1414.2135623730949, 5656.8542494923795], "pf": [0.70710678118654757, 0.70710678118654757, 0.70710678118654757]}
]
}
}
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,21 @@
{
"version": "1.0",
"type": "input",
"is_batch": false,
"attributes": {},
"data": {
"node": [
{"id": 1, "u_rated": 10000},
{"id": 2, "u_rated": 100}
],
"transformer": [
{"id": 4, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "u1": 10000, "u2": 100, "sn": 100000, "uk": 0.10000000000000001, "pk": 1000, "i0": 0.001, "p0": 10, "winding_from": 2, "winding_to": 1, "clock": 1, "tap_side": 0, "tap_pos": 0, "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": 3, "node": 1, "status": 1, "u_ref": 1, "sk": 1000000000000000, "rx_ratio": 1, "z01_ratio": 2}
],
"asym_load": [
{"id": 21, "node": 2, "status": 1, "type": 0, "p_specified": [1000, 1000, 4000], "q_specified": [1000, 1000, 4000]}
]
}
}
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": "newton_raphson",
"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
Loading
Loading