|
4 | 4 | from carsons.carsons import ( |
5 | 5 | CarsonsEquations, |
6 | 6 | perform_kron_reduction, |
| 7 | + calculate_sequence_impedance_matrix, |
| 8 | + calculate_sequence_impedances, |
7 | 9 | ) |
8 | 10 | from tests.test_overhead_line import ( |
9 | 11 | ACBN_geometry_line, |
@@ -136,6 +138,32 @@ def expected_z_abc_three_neutrals(): |
136 | 138 | [-14 + 0j, -14 + 0j, -13 + 0j]]) |
137 | 139 |
|
138 | 140 |
|
| 141 | +def z_abc_kersting_4_1(): |
| 142 | + """Kron-reduced impedance matrix from Kersting 3rd Ed., ex. 4.1""" |
| 143 | + return array([ |
| 144 | + [0.4576+1.078j, 0.1560+0.5017j, 0.1535+0.3849j], |
| 145 | + [0.1560+0.5017j, 0.4666+1.*1.0482j, 0.1580+0.4236j], |
| 146 | + [0.1535+0.3849j, 0.1580+0.4236j, 0.4615+1.0651j]]) |
| 147 | + |
| 148 | + |
| 149 | +def z_012_kersting_4_1(): |
| 150 | + """Sequence impedance matrix from Kersting 3rd Ed., ex. 4.1""" |
| 151 | + return array([ |
| 152 | + [0.7735+1.9373j, 0.0256+0.0115j, -0.0321+0.0159j], |
| 153 | + [-0.0321+0.0159j, 0.3061+0.6270j, -0.0723-0.0060j], |
| 154 | + [0.0256+0.0115j, 0.0723-0.0059j, 0.3061+0.6270j]]) |
| 155 | + |
| 156 | + |
| 157 | +def z_1_kersting_4_1(): |
| 158 | + """Positive-sequence impedance from Kersting 3rd Ed., ex. 4.1""" |
| 159 | + return 0.3061 + 0.6270j |
| 160 | + |
| 161 | + |
| 162 | +def z_0_kersting_4_1(): |
| 163 | + """Zero-sequence impedance from Kersting 3rd Ed., ex. 4.1""" |
| 164 | + return 0.7735 + 1.9373j |
| 165 | + |
| 166 | + |
139 | 167 | @pytest.mark.parametrize( |
140 | 168 | "line,z_primitive_expected", |
141 | 169 | [(ACBN_geometry_line(), ACBN_line_z_primitive()), |
@@ -169,3 +197,22 @@ def test_balanced_carsons_equations(line, z_primitive_expected): |
169 | 197 | def test_kron_reduction(z_primitive, expected_z_abc): |
170 | 198 | actual_z_abc = perform_kron_reduction(z_primitive) |
171 | 199 | assert (actual_z_abc == expected_z_abc).all() |
| 200 | + |
| 201 | + |
| 202 | +@pytest.mark.parametrize( |
| 203 | + "z_abc,z_012_expected", |
| 204 | + [(z_abc_kersting_4_1(), z_012_kersting_4_1())]) |
| 205 | +def test_sequence_impedance_matrix(z_abc, z_012_expected): |
| 206 | + z_012_computed = calculate_sequence_impedance_matrix(z_abc) |
| 207 | + assert_array_almost_equal(z_012_expected, z_012_computed, decimal=0.001) |
| 208 | + |
| 209 | + |
| 210 | +@pytest.mark.parametrize( |
| 211 | + "z_abc,expected_z1,expected_z0", |
| 212 | + [(z_abc_kersting_4_1(), z_1_kersting_4_1(), z_0_kersting_4_1())]) |
| 213 | +def test_sequence_impedance(z_abc, expected_z1, expected_z0): |
| 214 | + actual_z1, actual_z0 = calculate_sequence_impedances(z_abc) |
| 215 | + assert actual_z1.real == pytest.approx(expected_z1.real, 0.001) |
| 216 | + assert actual_z1.imag == pytest.approx(expected_z1.imag, 0.001) |
| 217 | + assert actual_z0.real == pytest.approx(expected_z0.real, 0.001) |
| 218 | + assert actual_z0.imag == pytest.approx(expected_z0.imag, 0.001) |
0 commit comments