Skip to content

Commit

Permalink
Styling fix and updated test according to e2nIEE#1064, use 0 instead …
Browse files Browse the repository at this point in the history
…of nan
  • Loading branch information
wangzhenassd committed Jan 5, 2021
1 parent 049de72 commit 4f117f4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pandapower/shortcircuit/calc_sc.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _calc_sc_single(net, bus):
_add_auxiliary_elements(net)
ppc, ppci = _pd2ppc(net)
_calc_ybus(ppci)

if net["_options"]["inverse_y"]:
_calc_zbus(net, ppci)
_calc_rx(net, ppci, bus=None)
Expand Down
2 changes: 1 addition & 1 deletion pandapower/shortcircuit/currents.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def calc_branch_results(net, ppci, V):
Ybus = ppci["internal"]["Ybus"]
Yf = ppci["internal"]["Yf"]
Yt = ppci["internal"]["Yt"]
baseMVA, bus, gen, branch, ref, _, pq, _, _, _, ref_gens = _get_pf_variables_from_ppci(ppci)
baseMVA, bus, gen, branch, ref, _, _, _, _, _, ref_gens = _get_pf_variables_from_ppci(ppci)
bus, gen, branch = pfsoln_pypower(baseMVA, bus, gen, branch, Ybus, Yf, Yt, V, ref, ref_gens)
ppci["bus"], ppci["gen"], ppci["branch"] = bus, gen, branch

Expand Down
6 changes: 4 additions & 2 deletions pandapower/test/shortcircuit/test_all_currents.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,14 @@ def test_all_currents_with_oos_elements(three_bus_example):

assert np.allclose(net.res_line_sc.ikss_ka.loc[[(0, 0), (0, 1)]].values,
np.array([0.01259673, 0.49593036]), atol=1e-5)
assert all(net.res_line_sc.ikss_ka.loc[[(0, 2), (1, 0), (1, 1), (1, 2)]].isnull())
assert np.allclose(net.res_line_sc.ikss_ka.loc[[(0, 2), (1, 0), (1, 1), (1, 2)]].values,
0, atol=1e-10)

sc.calc_sc(net, case="min", branch_results=True, return_all_currents=True)
assert np.allclose(net.res_line_sc.ikss_ka.loc[[(0, 0), (0, 1)]].values,
np.array([0.01259673, 0.3989686]), atol=1e-5)
assert all(net.res_line_sc.ikss_ka.loc[[(0, 2), (1, 0), (1, 1), (1, 2)]].isnull())
assert np.allclose(net.res_line_sc.ikss_ka.loc[[(0, 2), (1, 0), (1, 1), (1, 2)]].values,
0, atol=1e-10)


def test_branch_all_currents_gen(gen_three_bus_example):
Expand Down
2 changes: 1 addition & 1 deletion pandapower/test/shortcircuit/test_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_branch_results_open_ring(ring_network):
net = ring_network
sc.calc_sc(net, branch_results=True, inverse_y=False)
assert np.allclose(net.res_trafo_sc.ikss_lv_ka.values, [0.47705988])
assert np.allclose(net.res_line_sc.ikss_ka.values, [0.45294928, np.nan, 0.47125418], equal_nan=True)
assert np.allclose(net.res_line_sc.ikss_ka.values, [0.45294928, 0.0, 0.47125418])

def test_branch_results_open_ring_with_impedance(ring_network):
net = ring_network
Expand Down

0 comments on commit 4f117f4

Please sign in to comment.