-
Notifications
You must be signed in to change notification settings - Fork 465
/
test_ring.py
65 lines (50 loc) · 2.63 KB
/
test_ring.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2023 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import numpy as np
import pytest
import pandapower as pp
import pandapower.shortcircuit as sc
def ring_network():
net = pp.create_empty_network(sn_mva=2.)
b0 = pp.create_bus(net, 220)
b1 = pp.create_bus(net, 110)
b2 = pp.create_bus(net, 110)
b3 = pp.create_bus(net, 110)
pp.create_ext_grid(net, b0, s_sc_max_mva=100., s_sc_min_mva=80., rx_min=0.4, rx_max=0.4)
pp.create_transformer(net, b0, b1, "100 MVA 220/110 kV")
pp.create_line(net, b1, b2, std_type="305-AL1/39-ST1A 110.0" , length_km=20.)
l2 = pp.create_line(net, b2, b3, std_type="N2XS(FL)2Y 1x185 RM/35 64/110 kV" , length_km=15.)
pp.create_line(net, b3, b1, std_type="N2XS(FL)2Y 1x185 RM/35 64/110 kV" , length_km=10.)
pp.create_switch(net, b3, l2, closed=False, et="l")
return net
def test_branch_results_open_ring():
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, 0.0, 0.47125418])
def test_branch_results_open_ring_with_impedance():
net = ring_network()
sc.calc_sc(net, branch_results=True, inverse_y=False)
res_line_no_imp = net.res_line_sc.ikss_ka.values.copy()
# Make sure that with fault impedance, the total current should be smaller
sc.calc_sc(net, branch_results=True, inverse_y=False, r_fault_ohm=1, x_fault_ohm=5)
non_null_flag = np.abs(res_line_no_imp) > 1e-10
assert np.all(net.res_line_sc.ikss_ka.values[non_null_flag] < res_line_no_imp[non_null_flag])
def test_branch_results_closed_ring():
net = ring_network()
net.switch.closed = True
sc.calc_sc(net, branch_results=True)
assert np.allclose(net.res_trafo_sc.ikss_lv_ka.values, [0.47705988])
assert np.allclose(net.res_line_sc.ikss_ka.values, [0.17559325, 0.29778739, 0.40286545])
def test_kappa_methods():
net = ring_network()
net.switch.closed = True
sc.calc_sc(net, kappa_method="B", ip=True, inverse_y=False)
assert np.allclose(net.res_bus_sc.ip_ka.values,
[0.48810547956, 0.91192962511, 1.0264898716, 1.0360554521])
sc.calc_sc(net, kappa_method="C", ip=True, topology="auto")
assert np.allclose(net.res_bus_sc.ip_ka.values,
[0.48810547956, 0.91192962511, 0.89331396461, 0.90103415924])
if __name__ == '__main__':
pytest.main(["test_ring.py"])