Skip to content

Commit

Permalink
Merge 253e872 into 206171c
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilyYLMa committed Oct 18, 2019
2 parents 206171c + 253e872 commit 2963135
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 73 deletions.
63 changes: 51 additions & 12 deletions tests/test_carsons.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@
# conversion allows us to enter in impedance as ohm-per-mile in the test
# harness, which means we can lift matrices directly out of the ieee test
# network.
OHM_PER_MILE_TO_OHM_PER_METER = 1 / 1609.344
OHM_PER_MILE_TO_OHM_PER_METER = 1 / 1_609.344
OHM_PER_KILOMETER_TO_OHM_PER_METER = 1 / 1_000


class ACBN_geometry_line():
""" IEEE 13 Configuration 601 Line Geometry """

def __init__(self, **kwargs):
self.frequency = kwargs.get('ƒ', 60)

@property
def resistance(self):
return {
Expand Down Expand Up @@ -56,6 +61,9 @@ def phases(self):
class CBN_geometry_line():
""" IEEE 13 Configuration 603 Line Geometry """

def __init__(self, **kwargs):
self.frequency = kwargs.get('ƒ', 60)

@property
def resistance(self):
return {
Expand Down Expand Up @@ -92,6 +100,9 @@ def phases(self):
class CN_geometry_line():
""" IEEE 13 Configuration 605 Line Geometry"""

def __init__(self, **kwargs):
self.frequency = kwargs.get('ƒ', 60)

@property
def resistance(self):
return {
Expand Down Expand Up @@ -160,14 +171,22 @@ def phases(self):
]


def ACBN_line_geometry_phase_impedance():
def ACBN_line_phase_impedance():
""" IEEE 13 Configuration 601 Impedance Solution """
return OHM_PER_MILE_TO_OHM_PER_METER * array([
[0.3465 + 1.0179j, 0.1560 + 0.5017j, 0.1580 + 0.4236j],
[0.1560 + 0.5017j, 0.3375 + 1.0478j, 0.1535 + 0.3849j],
[0.1580 + 0.4236j, 0.1535 + 0.3849j, 0.3414 + 1.0348j]])


def ACBN_line_phase_impedance_50Hz():
""" IEEE 13 Configuration 601 Impedance Solution in ohms per km """
return OHM_PER_KILOMETER_TO_OHM_PER_METER * array([
[0.2101 + 0.5372j, 0.09171 + 0.2691j, 0.09295 + 0.2289j],
[0.09171 + 0.2691j, 0.20460 + 0.552j, 0.09021 + 0.2085j],
[0.09295 + 0.2289j, 0.09021 + 0.2085j, 0.207 + 0.5456j]])


def ACBN_line_z_primitive():
return array([
[1.74792626e-04+0.00085989j,
Expand Down Expand Up @@ -209,22 +228,38 @@ def ABCN_balanced_z_primitive():
])


def CBN_line_geometry_phase_impedance():
""" IEEE 13 Configuration 603 Impedance Solution """
def CBN_line_phase_impedance():
""" IEEE 13 Configuration 603 Impedance At 60Hz """
return OHM_PER_MILE_TO_OHM_PER_METER * array([
[0.0000 + 0.0000j, 0.0000 + 0.0000j, 0.0000 + 0.0000j],
[0.0000 + 0.0000j, 1.3294 + 1.3471j, 0.2066 + 0.4591j],
[0.0000 + 0.0000j, 0.2066 + 0.4591j, 1.3238 + 1.3569j]])


def CN_line_geometry_phase_impedance():
""" IEEE 13 Configuration 605 Impedance Solution """
def CBN_line_phase_impedance_50Hz():
""" IEEE 13 Configuration 603 Impedance At 50Hz """
return OHM_PER_KILOMETER_TO_OHM_PER_METER * array([
[0.0000 + 0.0000j, 0.0000 + 0.0000j, 0.0000 + 0.0000j],
[0.0000 + 0.0000j, 0.8128 + 0.7144j, 0.1153 + 0.2543j],
[0.0000 + 0.0000j, 0.1153 + 0.2543j, 0.8097 + 0.7189j]])


def CN_line_phase_impedance():
""" IEEE 13 Configuration 605 Impedance At 60Hz """
return OHM_PER_MILE_TO_OHM_PER_METER * array([
[0.0000 + 0.0000j, 0.0000 + 0.0000j, 0.0000 + 0.0000j],
[0.0000 + 0.0000j, 0.0000 + 0.0000j, 0.0000 + 0.0000j],
[0.0000 + 0.0000j, 0.0000 + 0.0000j, 1.3292 + 1.3475j]])


def CN_line_phase_impedance_50Hz():
""" IEEE 13 Configuration 605 Impedance Solution At 50Hz """
return OHM_PER_KILOMETER_TO_OHM_PER_METER * array([
[0.0000 + 0.0000j, 0.0000 + 0.0000j, 0.0000 + 0.0000j],
[0.0000 + 0.0000j, 0.0000 + 0.0000j, 0.0000 + 0.0000j],
[0.0000 + 0.0000j, 0.0000 + 0.0000j, 0.8127 + 0.7146j]])


def CN_line_z_primitive():
return array([
[0.0+0.j, 0.0+0.j, 0.0+0.j, 0.0+0.j],
Expand Down Expand Up @@ -271,12 +306,16 @@ def expected_z_abc_three_neutrals():


@pytest.mark.parametrize(
"line,expected_impedance",
[(ACBN_geometry_line(), ACBN_line_geometry_phase_impedance()),
(CBN_geometry_line(), CBN_line_geometry_phase_impedance()),
(CN_geometry_line(), CN_line_geometry_phase_impedance())])
def test_converts_geometry_to_phase_impedance(line, expected_impedance):
actual_impedance = convert_geometric_model(line)
"line,frequency,expected_impedance",
[(ACBN_geometry_line, 60, ACBN_line_phase_impedance()),
(CBN_geometry_line, 60, CBN_line_phase_impedance()),
(CN_geometry_line, 60, CN_line_phase_impedance()),
(ACBN_geometry_line, 50, ACBN_line_phase_impedance_50Hz()),
(CBN_geometry_line, 50, CBN_line_phase_impedance_50Hz()),
(CN_geometry_line, 50, CN_line_phase_impedance_50Hz())])
def test_converts_geometry_to_phase_impedance(
line, frequency, expected_impedance):
actual_impedance = convert_geometric_model(line(ƒ=frequency))
assert_array_almost_equal(expected_impedance,
actual_impedance)

Expand Down
61 changes: 0 additions & 61 deletions tests/test_configurable_frequency.py

This file was deleted.

0 comments on commit 2963135

Please sign in to comment.