-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename part of test_andes.py to test_andes_mats.py
- Loading branch information
1 parent
13ae6e1
commit 43b7dbe
Showing
2 changed files
with
61 additions
and
232 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
""" | ||
Test ANDES matrices. | ||
""" | ||
|
||
import unittest | ||
import numpy as np | ||
import pkg_resources | ||
from pkg_resources import parse_version | ||
|
||
import ams | ||
|
||
|
||
class TestMatrices(unittest.TestCase): | ||
""" | ||
Tests for system matrices consistency. | ||
""" | ||
|
||
andes_version = pkg_resources.get_distribution("andes").version | ||
if parse_version(andes_version) < parse_version('1.9.2'): | ||
raise unittest.SkipTest("Requires ANDES version >= 1.9.2") | ||
|
||
sp = ams.load(ams.get_case('5bus/pjm5bus_demo.xlsx'), | ||
setup=True, no_output=True, default_config=True,) | ||
sa = sp.to_andes(setup=True, no_output=True, default_config=True,) | ||
|
||
def setUp(self) -> None: | ||
""" | ||
Test setup. | ||
""" | ||
|
||
def test_build_y(self): | ||
""" | ||
Test build_y consistency. | ||
""" | ||
ysp = self.sp.Line.build_y() | ||
ysa = self.sa.Line.build_y() | ||
np.testing.assert_equal(np.array(ysp.V), np.array(ysa.V)) | ||
|
||
def test_build_Bp(self): | ||
""" | ||
Test build_Bp consistency. | ||
""" | ||
Bp_sp = self.sp.Line.build_Bp() | ||
Bp_sa = self.sa.Line.build_Bp() | ||
np.testing.assert_equal(np.array(Bp_sp.V), np.array(Bp_sa.V)) | ||
|
||
def test_build_Bpp(self): | ||
""" | ||
Test build_Bpp consistency. | ||
""" | ||
Bpp_sp = self.sp.Line.build_Bpp() | ||
Bpp_sa = self.sa.Line.build_Bpp() | ||
np.testing.assert_equal(np.array(Bpp_sp.V), np.array(Bpp_sa.V)) | ||
|
||
def test_build_Bdc(self): | ||
""" | ||
Test build_Bdc consistency. | ||
""" | ||
Bdc_sp = self.sp.Line.build_Bdc() | ||
Bdc_sa = self.sa.Line.build_Bdc() | ||
np.testing.assert_equal(np.array(Bdc_sp.V), np.array(Bdc_sa.V)) |