Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tests For Configurable Frequency #33

Merged
merged 4 commits into from
Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 52 additions & 13 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, ƒ=60):
self.frequency = ƒ

@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, ƒ=60):
self.frequency = ƒ

@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, ƒ=60):
self.frequency = ƒ

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


def ACBN_line_geometry_phase_impedance():
""" IEEE 13 Configuration 601 Impedance Solution """
def ACBN_line_phase_impedance():
""" IEEE 13 Configuration 601 Impedance Solution At 60Hz """
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 At 50Hz """
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 Solution 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 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.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 Solution 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.