Skip to content
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

Fixing transformer kt min case #2168

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions pandapower/build_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@

if net._options["tdpf"]:
# todo implement idx_brch_dc_tdpf
raise NotImplementedError("temperature-related calculation for line_dc not implemented")

Check warning on line 293 in pandapower/build_branch.py

View check run for this annotation

Codecov / codecov/patch

pandapower/build_branch.py#L293

Added line #L293 was not covered by tests
# branch_dc[f:t, TDPF] = line_dc["in_service"].values & line_dc["tdpf"].fillna(False).values.astype(bool)
# branch_dc[f:t, BR_R_REF_OHM_PER_KM] = line_dc["r_ohm_per_km"].values / parallel
# branch_dc[f:t, BR_LENGTH_KM] = length_km
Expand All @@ -310,7 +310,7 @@

# temperature correction
if net["_options"]["consider_line_temperature"]:
branch_dc[f:t, DC_BR_R] *= _end_temperature_correction_factor(net)

Check warning on line 313 in pandapower/build_branch.py

View check run for this annotation

Codecov / codecov/patch

pandapower/build_branch.py#L313

Added line #L313 was not covered by tests

# todo check if DC line_dc model has shunt components
# b = 2 * net.f_hz * math.pi * line_dc["c_nf_per_km"].values * 1e-9 * baseR * length_km * parallel
Expand Down Expand Up @@ -437,12 +437,11 @@
else:
g, b = 0, 0 # why for sc are we assigning y directly as 0?
if isinstance(trafo_df, pd.DataFrame): # 2w trafo is dataframe, 3w trafo is dict
bus_lookup = net._pd2ppc_lookups["bus"]
cmax = ppc["bus"][bus_lookup[net.trafo.lv_bus.values], C_MAX]
# todo: kt is only used for case = max and only for network transformers! (IEC 60909-0:2016 section 6.3.3)
# kt is only calculated for network transformers (IEC 60909-0:2016 section 6.3.3)
if not net._options.get("use_pre_fault_voltage", False):
kt = _transformer_correction_factor(trafo_df, trafo_df.vk_percent, trafo_df.vkr_percent, trafo_df.sn_mva, cmax)
bus_lookup = net._pd2ppc_lookups["bus"]
cmax = ppc["bus"][bus_lookup[net.trafo.lv_bus.values], C_MAX]
case = net._options["case"]
kt = _transformer_correction_factor(trafo_df, trafo_df.vk_percent, trafo_df.vkr_percent, trafo_df.sn_mva, cmax, case)
r *= kt
x *= kt
else:
Expand Down Expand Up @@ -585,7 +584,7 @@
degree_is_set = _replace_nan(tap_step_degree[phase_shifters]) != 0
percent_is_set = _replace_nan(tap_step_percent[phase_shifters]) != 0
if (degree_is_set & percent_is_set).any():
raise UserWarning(

Check warning on line 587 in pandapower/build_branch.py

View check run for this annotation

Codecov / codecov/patch

pandapower/build_branch.py#L587

Added line #L587 was not covered by tests
"Both tap_step_degree and tap_step_percent set for ideal phase shifter")
trafo_shift[phase_shifters] += np.where(
(degree_is_set),
Expand Down Expand Up @@ -1002,8 +1001,8 @@
new_indices = np.arange(n_bus, n_bus + n_oos_buses_at_lines)
# the newly created buses
if dc:
ppc_col_var = [DC_BUS_TYPE, DC_BUS_AREA, DC_VM, DC_ZONE, DC_VMAX, DC_VMIN]
ppc_col_val = np.array([DC_P, 1, 1, 1, 2, 0], dtype=np.int64)

Check warning on line 1005 in pandapower/build_branch.py

View check run for this annotation

Codecov / codecov/patch

pandapower/build_branch.py#L1004-L1005

Added lines #L1004 - L1005 were not covered by tests
else:
ppc_col_var = [BUS_TYPE, BUS_AREA, VM, ZONE, VMAX, VMIN]
ppc_col_val = np.array([PQ, 1, 1, 1, 2, 0], dtype=np.int64)
Expand Down Expand Up @@ -1094,7 +1093,7 @@
# endtemp_degree is line temperature that is reached as the result of a short circuit
# this value is the property of the lines
if "endtemp_degree" not in net[element].columns:
raise UserWarning(f"Specify end temperature for {element}s in net.{element}.endtemp_degree")

Check warning on line 1096 in pandapower/build_branch.py

View check run for this annotation

Codecov / codecov/patch

pandapower/build_branch.py#L1096

Added line #L1096 was not covered by tests

delta_t_degree_celsius = net[element].endtemp_degree.values.astype(np.float64) - 20
# alpha is the temperature correction factor for the electric resistance of the material
Expand All @@ -1103,7 +1102,7 @@
else:
# temperature_degree_celsius is line temperature for load flow calculation
if "temperature_degree_celsius" not in net[element].columns:
raise UserWarning(f"Specify {element} temperature in net.{element}.temperature_degree_celsius")

Check warning on line 1105 in pandapower/build_branch.py

View check run for this annotation

Codecov / codecov/patch

pandapower/build_branch.py#L1105

Added line #L1105 was not covered by tests

delta_t_degree_celsius = net[element].temperature_degree_celsius.values.astype(np.float64) - 20

Expand All @@ -1117,7 +1116,7 @@
return r_correction_for_temperature


def _transformer_correction_factor(trafo_df, vk, vkr, sn, cmax):
def _transformer_correction_factor(trafo_df, vk, vkr, sn, cmax, case):
"""
2W-Transformer impedance correction factor in short circuit calculations,
based on the IEC 60909-0:2016 standard.
Expand All @@ -1126,6 +1125,7 @@
vkr: real-part of transformer short-circuit voltage, percent
sn: transformer rating, kVA
cmax: voltage factor to account for maximum worst-case currents, based on the lv side
case: short-circuit calculation case (str, "min"/"max")

Returns:
kt: transformer impedance correction factor for short-circuit calculations
Expand All @@ -1134,7 +1134,12 @@
----------
trafo_df

"""
"""

# The transformer correction factor shall only be applied in the max case according to
# norm IEC 60909-0:2016 section 6.3.3
if case != "max":
return np.ones(len(trafo_df))

if "power_station_unit" in trafo_df.columns:
power_station_unit = trafo_df.power_station_unit.fillna(False).values.astype(bool)
Expand Down Expand Up @@ -1168,13 +1173,15 @@
nr_trafos = len(net["trafo3w"])
if sequence==1:
mode_tmp = "type_c" if mode == "sc" and net._options.get("use_pre_fault_voltage", False) else mode
_calculate_sc_voltages_of_equivalent_transformers(t3, trafo2, mode_tmp, characteristic=net.get(
case = net._options.get("case", False) if "case" in net._options else "max"
_calculate_sc_voltages_of_equivalent_transformers(t3, trafo2, mode_tmp, case, characteristic=net.get(
'characteristic'))
elif sequence==0:
if mode != "sc":
raise NotImplementedError(
"0 seq impedance calculation only implemented for short-circuit calculation!")
_calculate_sc_voltages_of_equivalent_transformers_zero_sequence(t3, trafo2,)
case = net._options.get("case", False) if "case" in net._options else "max"
_calculate_sc_voltages_of_equivalent_transformers_zero_sequence(t3, trafo2, case)
else:
raise UserWarning("Unsupported sequence for trafo3w convertion")
_calculate_3w_tap_changers(t3, trafo2, sides)
Expand Down Expand Up @@ -1203,7 +1210,7 @@
return {var: np.concatenate([trafo2[var][side] for side in sides]) for var in trafo2.keys()}


def _calculate_sc_voltages_of_equivalent_transformers(t3, t2, mode, characteristic):
def _calculate_sc_voltages_of_equivalent_transformers(t3, t2, mode, case, characteristic):
vk_hv, vkr_hv, vk_mv, vkr_mv, vk_lv, vkr_lv = _get_vk_values(t3, characteristic, "3W")

vk_3w = np.stack([vk_hv, vk_mv, vk_lv])
Expand All @@ -1213,7 +1220,7 @@
vk_2w_delta = z_br_to_bus_vector(vk_3w, sn)
vkr_2w_delta = z_br_to_bus_vector(vkr_3w, sn)
if mode == "sc":
kt = _transformer_correction_factor(t3, vk_3w, vkr_3w, sn, 1.1)
kt = _transformer_correction_factor(t3, vk_3w, vkr_3w, sn, 1.1, case)
vk_2w_delta *= kt
vkr_2w_delta *= kt
vki_2w_delta = np.sqrt(vk_2w_delta ** 2 - vkr_2w_delta ** 2)
Expand All @@ -1227,7 +1234,7 @@
t2["sn_mva"] = {"hv": sn[0, :], "mv": sn[1, :], "lv": sn[2, :]}


def _calculate_sc_voltages_of_equivalent_transformers_zero_sequence(t3, t2):
def _calculate_sc_voltages_of_equivalent_transformers_zero_sequence(t3, t2, case):
vk_3w = np.stack([t3.vk_hv_percent.values, t3.vk_mv_percent.values, t3.vk_lv_percent.values])
vkr_3w = np.stack([t3.vkr_hv_percent.values, t3.vkr_mv_percent.values, t3.vkr_lv_percent.values])
vk0_3w = np.stack([t3.vk0_hv_percent.values, t3.vk0_mv_percent.values, t3.vk0_lv_percent.values])
Expand All @@ -1238,7 +1245,7 @@
vkr0_2w_delta = z_br_to_bus_vector(vkr0_3w, sn)

# Only for "sc", calculated with positive sequence value
kt = _transformer_correction_factor(t3, vk_3w, vkr_3w, sn, 1.1)
kt = _transformer_correction_factor(t3, vk_3w, vkr_3w, sn, 1.1, case)
vk0_2w_delta *= kt
vkr0_2w_delta *= kt

Expand Down Expand Up @@ -1290,7 +1297,7 @@
tap_arrays["tap_side"][side][tap_mask] = "hv" if side == "hv" else "lv"

# t3 trafos with tap changer at star points
if any_at_star_point & np.any(mask_star_point := (tap_mask & at_star_point)):
if any_at_star_point & np.any(mask_star_point := (tap_mask & at_star_point)):
t = tap_arrays["tap_step_percent"][side][mask_star_point] * np.exp(1j * np.deg2rad(tap_arrays["tap_step_degree"][side][mask_star_point]))
tap_pos = tap_arrays["tap_pos"][side][mask_star_point]
t_corrected = 100 * t / (100 + (t * tap_pos))
Expand Down
3 changes: 2 additions & 1 deletion pandapower/pd2ppc_zero.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ def _add_trafo_sc_impedance_zero(net, ppc, trafo_df=None, k_st=None):

if mode == "sc": # or trafo_model == "pi":
cmax = net._ppc["bus"][lv_buses_ppc, C_MAX]
kt = _transformer_correction_factor(trafos, vk_percent, vkr_percent, sn_trafo_mva, cmax)
case = net._options["case"]
kt = _transformer_correction_factor(trafos, vk_percent, vkr_percent, sn_trafo_mva, cmax, case)
z0_k *= kt

# different formula must be applied for power station unit transformers:
Expand Down
3 changes: 2 additions & 1 deletion pandapower/shortcircuit/ppc_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def _add_kt(net, ppc):
f, t = net["_pd2ppc_lookups"]["branch"]["trafo"]
trafo_df = net["trafo"]
cmax = ppc["bus"][bus_lookup[get_trafo_values(trafo_df, "lv_bus")], C_MAX]
kt = _transformer_correction_factor(trafo_df, trafo_df.vk_percent, trafo_df.vkr_percent, trafo_df.sn_mva, cmax)
case = net._options["case"] if net._options.get("mode", "") == "sc" else None
kt = _transformer_correction_factor(trafo_df, trafo_df.vk_percent, trafo_df.vkr_percent, trafo_df.sn_mva, cmax, case)
branch[f:t, K_T] = kt


Expand Down
20 changes: 10 additions & 10 deletions pandapower/test/shortcircuit/test_1ph.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ def test_1ph_shortcircuit_3w():

def test_1ph_shortcircuit_min():
results = {
"Yy": [0.52209346201, 0.66632662571, 0.66756160176, 0.72517293174]
,"Yyn": [0.52209346201, 2.4135757259, 1.545054139, 0.99373917957]
,"Yd": [0.52209346201, 0.66632662571, 0.66756160176, 0.72517293174]
,"YNy": [0.62316686505, 0.66632662571, 0.66756160176, 0.72517293174]
,"YNyn":[0.620287259, 2.9155736491, 1.7561556936, 1.0807305212]
,"YNd": [0.75434229157, 0.66632662571, 0.66756160176, 0.72517293174]
,"Dy": [0.52209346201, 0.66632662571, 0.66756160176, 0.72517293174]
,"Dyn": [0.52209346201, 3.4393798093, 1.9535982949, 1.1558364456]
,"Dd": [0.52209346201, 0.66632662571, 0.66756160176, 0.72517293174]
"Yy": [0.52209345151, 0.66680074537, 0.66803609106, 0.72571559085]
,"Yyn": [0.52209345151, 2.40601861813, 1.54211362172, 0.99258179645]
,"Yd": [0.52209345151, 0.66680074537, 0.66803609106, 0.72571559085]
,"YNy": [0.62305132639, 0.66680074537, 0.66803609106, 0.72571559085]
,"YNyn":[0.62019004941, 2.90615348290, 1.75300032937, 1.07961489722]
,"YNd": [0.75372631070, 0.66680074537, 0.66803609106, 0.72571559085]
,"Dy": [0.52209345151, 0.66680074537, 0.66803609106, 0.72571559085]
,"Dyn": [0.52209345151, 3.42429321754, 1.94906060941, 1.15434123431]
,"Dd": [0.52209345151, 0.66680074537, 0.66803609106, 0.72571559085]
}

for inv_y in (False, True):
Expand Down Expand Up @@ -373,7 +373,7 @@ def test_iec60909_example_4_two_trafo3w_two_earth():
# r = 0.59621204768
# x = 6.0598429694
ikss_pf_max = [26.0499, 20.9472, 9.1722, 18.7457]
ikss_pf_min = [3.9622, 8.3914, 5.0248, 6.9413]
ikss_pf_min = [3.9447, 8.2164, 4.9642, 6.8273]

sc.calc_sc(net, fault="1ph", case="max")
assert np.allclose(net.res_bus_sc.ikss_ka.values[:4], np.array(ikss_pf_max), atol=1e-4)
Expand Down
44 changes: 37 additions & 7 deletions pandapower/test/shortcircuit/test_all_currents.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,32 +730,59 @@ def test_trafo_3w():
pass


def test_trafo_impedance():
@pytest.fixture(scope='module')
def net_trafo_impedance():
net = pp.create_empty_network(sn_mva=0.16)
pp.create_bus(net, 20)
pp.create_buses(net, 2, 0.4)
pp.create_ext_grid(net, 0, s_sc_max_mva=346.4102, rx_max=0.1)
pp.create_ext_grid(net, 0,
s_sc_max_mva=346.4102, rx_max=0.1,
s_sc_min_mva=346.4102, rx_min=0.1)
v_lv = 410
pp.create_transformer_from_parameters(net, 0, 1, 0.4, 20, v_lv / 1e3, 1.15, 4, 0, 0)
pp.create_line_from_parameters(net, 1, 2, 0.004, 0.208, 0.068, 0, 1, parallel=2)
pp.create_line_from_parameters(net, 1, 2, 0.004, 0.208, 0.068, 0, 1, parallel=2, endtemp_degree=20)
# pp.create_load(net, 2, 0.1)

pp.runpp(net)

sc.calc_sc(net, case='max', lv_tol_percent=6., bus=2, branch_results=True, use_pre_fault_voltage=False)
return net


@pytest.fixture(scope='module')
def trafo_impedance_base():
# trafo:
v_lv = 410
z_tlv = 4 / 100 * v_lv ** 2 / (400 * 1e3)
r_tlv = 4600 * v_lv ** 2 / ((400 * 1e3) ** 2)
x_tlv = np.sqrt(z_tlv**2 - r_tlv**2)
z_tlv = r_tlv + 1j*x_tlv
x_t = x_tlv * 400*1e3 / (v_lv ** 2)
k_t = 0.95 * 1.05 / (1+0.6 * x_t)
return z_tlv, x_t


@pytest.fixture(scope='module')
def trafo_impedance_case(request, trafo_impedance_base):

case = request.param
z_tlv, x_t = trafo_impedance_base

if case == "max":
k_t = 0.95 * 1.05 / (1 + 0.6 * x_t)
else:
k_t = 1

z_tk = k_t * z_tlv

# line:
z_l = 0.416 * 1e-3 + 1j * 0.136 * 1e-3 # Ohm
return z_tk, case


@pytest.mark.parametrize("trafo_impedance_case", ["max", "min"], indirect=["trafo_impedance_case"])
def test_trafo_impedance(trafo_impedance_case, net_trafo_impedance):

z_tk, case = trafo_impedance_case
net = net_trafo_impedance

sc.calc_sc(net, case=case, lv_tol_percent=6., bus=2, branch_results=True, use_pre_fault_voltage=False)

# assert np.allclose(net.res_bus_sc.rk_ohm * 1e3, 5.18, rtol=0, atol=1e-6)
# assert np.allclose(net.res_bus_sc.xk_ohm * 1e3, 16.37, rtol=0, atol=1e-6)
Expand All @@ -766,6 +793,9 @@ def test_trafo_impedance():
tap = ppci["branch"][:, TAP].real
ikss1 = ppci["bus"][:, IKSS1] * np.exp(1j * np.deg2rad(ppci["bus"][:, PHI_IKSS1_DEGREE]))

# line:
z_l = 0.416 * 1e-3 + 1j * 0.136 * 1e-3 # Ohm

v_1 = ikss1[2] * z_l / 0.4 * np.sqrt(3) # kA * Ohm / V_base -> p.u.
np.abs(v_1)
np.angle(v_1, deg=True)
Expand Down
4 changes: 2 additions & 2 deletions pandapower/test/shortcircuit/test_iec60909_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ def test_iec_60909_4_3ph_min():
net.ext_grid["rx_min"] = net.ext_grid["rx_max"]
sc.calc_sc(net, fault="3ph", case="min", ip=True, tk_s=0.1, kappa_method="C")

ikss_min = [5.0501, 12.2915, 10.3292, 9.4708, 11.8604,
28.3052, 18.6148, 10.9005, 44.5098, 67.9578]
ikss_min = [5.0257, 12.0645, 10.2108, 9.3820, 11.6761,
27.7655, 18.3930, 10.9024, 44.4310, 67.8216]

assert np.allclose(net.res_bus_sc.ikss_ka.values[:10], np.array(ikss_min), atol=1e-3)

Expand Down
24 changes: 12 additions & 12 deletions pandapower/test/shortcircuit/test_meshing_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,32 +57,32 @@ def test_min_10_meshed_grid(meshed_grid):
net = meshed_grid
sc.calc_sc(net, case='min', ip=True, ith=True, lv_tol_percent= 10., kappa_method="B")
assert np.allclose(net.res_bus_sc.ikss_ka.values[:10],
[2.309401, 11.3267, 2.879343, 1.884323, 10.40083,
1.693922, 0.7107017, 0.9000445, 1.055881, 0.928488], atol=1e-5)
[2.309401, 11.409498, 2.882583, 1.884323, 10.571978,
1.696813, 0.711139, 0.900761, 1.056227, 0.929242], atol=1e-5)

assert np.allclose(net.res_bus_sc.ip_ka.values[:10],
[5.702418, 26.01655, 4.166047, 3.124163, 20.04053,
2.813883, 1.179085, 1.493293, 1.523338, 1.540432], atol=1e-5)
[5.702418, 26.210173, 4.170478, 3.124163, 20.351853,
2.818552, 1.179808, 1.494475, 1.523833, 1.541675], atol=1e-5)

assert np.allclose(net.res_bus_sc.ith_ka.values[:10],
[2.348476, 11.44622, 2.883161, 1.889675, 10.45195,
1.698768, 0.712725, 0.9026074, 1.057233, 0.9311316], atol=1e-5)
[2.348476, 11.529984, 2.886403, 1.889675, 10.623765,
1.701667, 0.713164, 0.903326, 1.057579, 0.931887], atol=1e-5)


def test_min_6_meshed_grid(meshed_grid):
net = meshed_grid
sc.calc_sc(net, case='min', ip=True, ith=True, lv_tol_percent = 6., kappa_method="B")
assert np.allclose(net.res_bus_sc.ikss_ka.values[:10],
[2.309401, 11.75072, 2.895465, 1.884323, 10.77961,
1.700202, 0.7116519, 0.9016006, 1.0576, 0.9301236], atol=1e-5)
[2.309401, 11.409498, 2.882583, 1.884323, 10.571978,
1.696813, 0.711139, 0.900761, 1.056227, 0.929242], atol=1e-5)

assert np.allclose(net.res_bus_sc.ip_ka.values[:10],
[5.702418, 27.00861, 4.18812, 3.124163, 20.72881,
2.824028, 1.180654, 1.495858, 1.525799, 1.543131], atol=1e-5)
[5.702418, 26.210173, 4.170478, 3.124163, 20.351853,
2.818552, 1.179808, 1.494475, 1.523833, 1.541675], atol=1e-5)

assert np.allclose(net.res_bus_sc.ith_ka.values[:10],
[2.348476, 11.87518, 2.899291, 1.889675, 10.8322,
1.705064, 0.7136779, 0.9041679, 1.058954, 0.9327717], atol=1e-5)
[2.348476, 11.529984, 2.886403, 1.889675, 10.623765,
1.701667, 0.713164, 0.903326, 1.057579, 0.931887], atol=1e-5)

if __name__ == '__main__':
pytest.main([__file__, "-xs"])
6 changes: 3 additions & 3 deletions pandapower/test/shortcircuit/test_trafo3w.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def test_trafo3w_max(trafo3w_net):
def test_trafo3w_min(trafo3w_net):
net = trafo3w_net
sc.calc_sc(net, case="min", lv_tol_percent=6., ip=True, ith=True)
assert np.allclose(net.res_bus_sc.ikss_ka.values, [0.1049727799, 0.56507157823, 1.5934473235])
assert np.allclose(net.res_bus_sc.ip_ka.values, [0.25920083485, 1.3972274925, 3.9422963436])
assert np.allclose(net.res_bus_sc.ith_ka.values, [0.10674893166, 0.57473904595, 1.6208335668])
assert np.allclose(net.res_bus_sc.ikss_ka.values, [0.10497277622, 0.56364359158, 1.5877756314])
assert np.allclose(net.res_bus_sc.ip_ka.values, [0.25920082653, 1.3937300547, 3.9283892193])
assert np.allclose(net.res_bus_sc.ith_ka.values, [0.10674892795, 0.57328848095, 1.6150713675])

pp.runpp(net)
sc.calc_sc(net, case="min", lv_tol_percent=6., ip=True, ith=True, use_pre_fault_voltage=True)
Expand Down
16 changes: 8 additions & 8 deletions pandapower/test/shortcircuit/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,41 +65,41 @@ def test_min_10_trafo(net_transformer):
sc.calc_sc(net, case='min', ip=True, ith=True, lv_tol_percent=10.)
assert (abs(net.res_bus_sc.ikss_ka.at[0] - 2.309401) < 1e-5)
assert (abs(net.res_bus_sc.ikss_ka.at[1] - 2.309401) < 1e-5)
assert (abs(net.res_bus_sc.ikss_ka.at[2] - 12.912468695) < 1e-5)
assert (abs(net.res_bus_sc.ikss_ka.at[2] - 13.001649531) < 1e-5)

assert (abs(net.res_bus_sc.ip_ka.at[0] - 5.702418) < 1e-5)
assert (abs(net.res_bus_sc.ip_ka.at[1] - 5.702418) < 1e-5)
assert (abs(net.res_bus_sc.ip_ka.at[2] - 32.405489528) < 1e-5)
assert (abs(net.res_bus_sc.ip_ka.at[2] - 32.628291607) < 1e-5)

assert (abs(net.res_bus_sc.ith_ka.at[0] - 2.348476) < 1e-5)
assert (abs(net.res_bus_sc.ith_ka.at[1] - 2.348476) < 1e-5)
assert (abs(net.res_bus_sc.ith_ka.at[2] - 13.162790807) < 1e-5)
assert (abs(net.res_bus_sc.ith_ka.at[2] - 13.253631311) < 1e-5)


def test_min_6_trafo(net_transformer):
net = net_transformer
sc.calc_sc(net, case='min', ip=True, ith=True, lv_tol_percent=6.)
assert (abs(net.res_bus_sc.ikss_ka.at[0] - 2.309401) < 1e-5)
assert (abs(net.res_bus_sc.ikss_ka.at[1] - 2.309401) < 1e-5)
assert (abs(net.res_bus_sc.ikss_ka.at[2] - 13.39058012) < 1e-5)
assert (abs(net.res_bus_sc.ikss_ka.at[2] - 13.001649531) < 1e-5)

assert (abs(net.res_bus_sc.ip_ka.at[0] - 5.702418) < 1e-5)
assert (abs(net.res_bus_sc.ip_ka.at[1] - 5.702418) < 1e-5)
assert (abs(net.res_bus_sc.ip_ka.at[2] - 33.599801499) < 1e-5)
assert (abs(net.res_bus_sc.ip_ka.at[2] - 32.628291607) < 1e-5)

assert (abs(net.res_bus_sc.ith_ka.at[0] - 2.348476) < 1e-5)
assert (abs(net.res_bus_sc.ith_ka.at[1] - 2.348476) < 1e-5)
assert (abs(net.res_bus_sc.ith_ka.at[2] - 13.649789214) < 1e-5)
assert (abs(net.res_bus_sc.ith_ka.at[2] - 13.253631311) < 1e-5)


def test_min_10_trafo_2ph(net_transformer):
net = net_transformer
sc.calc_sc(net, fault="2ph", case='min', ip=True, ith=True, lv_tol_percent=10.)
assert (abs(net.res_bus_sc.ikss_ka.at[0] - 2.0000000702) < 1e-5)
assert (abs(net.res_bus_sc.ikss_ka.at[2] - 11.182525915) < 1e-5)
assert (abs(net.res_bus_sc.ikss_ka.at[2] - 11.259758785) < 1e-5)

assert (abs(net.res_bus_sc.ip_ka.at[0] - 4.9384391739) < 1e-5)
assert (abs(net.res_bus_sc.ip_ka.at[2] - 28.063977154) < 1e-5)
assert (abs(net.res_bus_sc.ip_ka.at[2] - 28.256929414) < 1e-5)


# assert (abs(net.res_bus_sc.ith_ka.at[0] - 2.0000000702) <1e-5)
Expand Down
Loading