Skip to content

1ph short circuit: calculate ip/ith, and honour the neutral earthing impedance of trafo3w - #3083

Open
binggao1230 wants to merge 1 commit into
e2nIEE:developfrom
binggao1230:fix-1ph-ip-ith-and-trafo3w-neutral-earthing
Open

1ph short circuit: calculate ip/ith, and honour the neutral earthing impedance of trafo3w#3083
binggao1230 wants to merge 1 commit into
e2nIEE:developfrom
binggao1230:fix-1ph-ip-ith-and-trafo3w-neutral-earthing

Conversation

@binggao1230

Copy link
Copy Markdown

Two things calc_sc(..., fault="1ph") silently dropped. Fixing both lets test_iec_60909_4_1ph, skipped since early 2021 with "1ph gen-close sc calculation still under develop", be un-skipped and pass against the IEC 60909-4 reference values.

1. ip / ith were accepted but never calculated

net = iec_60909_4()
calc_sc(net, fault="1ph", case="max", ip=True, ith=True, tk_s=0.1, kappa_method="C")
net.res_bus_sc.ip_ka    # all NaN
net.res_bus_sc.ith_ka   # all NaN

_calc_current() (3ph/2ph) calls _calc_ip/_calc_ith; _calc_sc_1ph() never did. No warning, no error, the columns are just NaN. _add_kappa_to_ppc was already being called on the 1ph path, so kappa was there all along, only unused.

The ip values already sitting in the skipped test are the check: the kappa pandapower computes on that path (method C, positive sequence) times sqrt(2) times the published I"k1 reproduces the published ip1 to six significant figures at the five buses where I"k1 was already correct.

bus published ip sqrt(2)*kappa*I"k1
1 60.9982 60.998180
2 40.5086 40.508567
3 24.2424 24.242478
4 20.5464 20.546358
5 42.8337 42.833723

2. trafo3w ignored the neutral earthing impedance

net.trafo has had xn_ohm/rn_ohm for a while (and rn_ohm was added in #3016); net.trafo3w had no equivalent, so a star point earthed through a neutral reactor or resistor could not be modelled at all. Since a three-winding transformer can have more than one earthed star point, the columns are per winding: xn_hv_ohm/rn_hv_ohm, xn_mv_ohm/rn_mv_ohm, xn_lv_ohm/rn_lv_ohm. 3*Z_N goes in series with that winding's zero-sequence branch, exactly as for the two-winding case.

Why the skipped test failed, and why it now passes

iec_60909_4() builds the 10 kV network with T5 (Yyd) and T6 (Yynd), so T6's mv winding is the only earth of that network, and it is earthed through the 100 Ohm reactor the builder already mentions:

                                     vector_group="Yynd", ..., tap_step_percent=0.1)
                                     # reactor is 100 Ohm

Without it the 10 kV buses came out solidly earthed and the current was about 400x too high (25.485 kA computed vs 0.06337 kA published at bus 6). With xn_mv_ohm=100. all ten buses match the published I"k1 within the test's existing atol=1e-4, and the previously commented out ip assertion holds at atol=1e-3 (the same tolerance the 2ph test already uses for ip; the reference values are quoted to four decimals). The published currents pin the reactor tightly, xn_mv_ohm=100.5 already breaks the assertion, so this is not a fitted parameter.

Tests

  • test_iec_60909_4_1ph un-skipped, ip assertion re-enabled, ith checked for finiteness and ith >= ikss.
  • test_trafo3w_neutral_earthing_impedance: parametrised over hv/mv/lv, two vector groups each, both inverse_y paths. Asserts Z_N adds exactly 3*Z_N to rk0_ohm/xk0_ohm, leaves the positive sequence untouched and reduces ikss_ka. The hv bus is fed through a delta so the ext_grid is not in parallel with the transformer's earth, and the rated voltages differ from the bus voltages so that referring Z_N with the wrong base is caught.
  • test_1ph_ip_ith: ip/ith are finite, ip == sqrt(2)*kappa*ikss with kappa taken from the 3ph run at the same buses, and they stay unset when not requested.

pytest --ignore=pandapower/test/opf is otherwise unchanged (my environment misses geopandas/pyproj/matplotlib, so six geo/plotting tests fail identically before and after).

One thing this does not fix

The other two 1ph gen-close skips in test_1ph.py stay skipped. Different cause, at the 110 kV buses, and I could not reconcile their references. test_iec_60909_4_small_with_t2_1ph expects [24.57717, 16.96235, 11.6109, 18.07836], but its network is electrically identical to the one in test_iec60909_example_4_two_trafo3w, which passes today against [24.5772, 14.7247, 8.1060, 15.2749] (labelled as PowerFactory results): emptying net.gen leaves only a dead-end Yd transformer, which contributes nothing in either sequence, and the computed values are bit-identical to the passing test. So one of those two reference sets has to be wrong and I did not want to guess which. Both tests also still read net.res_bus_ikss_ka instead of net.res_bus_sc.ikss_ka, so they would raise before reaching the assert. I left them alone rather than touch tests I cannot make pass.

Two things the single-phase path silently dropped:

- calc_sc(..., fault="1ph", ip=True, ith=True) accepted both options but
  _calc_sc_1ph never called _calc_ip/_calc_ith, so res_bus_sc.ip_ka and
  ith_ka were returned as all NaN with no warning. kappa was already
  being calculated on that path, it was just never used.

- The zero sequence model of a three winding transformer ignored any
  neutral earthing impedance. net.trafo has had xn_ohm/rn_ohm for a long
  time; trafo3w now takes the same per winding, as xn_hv_ohm/rn_hv_ohm,
  xn_mv_ohm/rn_mv_ohm and xn_lv_ohm/rn_lv_ohm, adding 3*Z_N in series
  with that winding's zero sequence branch.

With both in place the IEC 60909-4 single-phase test can be un-skipped:
the 10 kV network of iec_60909_4() is earthed only through T6, over the
100 Ohm reactor the network builder already mentions in a comment but
could not model. Modelling it reproduces the published I"k1 at all ten
buses within the existing atol of 1e-4, and the commented out ip
assertion now holds as well (ip = kappa*sqrt(2)*I"k1).
@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.56098% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.15%. Comparing base (44d7d69) to head (58bf441).

Files with missing lines Patch % Lines
pandapower/pd2ppc_zero.py 97.29% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3083      +/-   ##
===========================================
+ Coverage    72.12%   72.15%   +0.02%     
===========================================
  Files          355      355              
  Lines        39376    39417      +41     
===========================================
+ Hits         28400    28441      +41     
  Misses       10976    10976              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant