Example #1
0
 def setUp(self) -> None:
     raw = get_case("kundur/kundur.raw")
     dyr = get_case("kundur/kundur_full.dyr")
     self.ss_psse = andes.run(
         raw,
         addfile=dyr,
         default_config=True,
         no_output=True,
     )
Example #2
0
    def test_kundur_plot(self):
        ss = andes.run(
            get_case('kundur/kundur_full.xlsx'),
            routine='tds',
            tf=2.0,
            no_output=True,
            default_config=True,
        )

        ss.TDS.load_plotter()

        ss.TDS.plt.plot(
            ss.Bus.v,
            ylabel="Bus Voltages [pu]",
            title='Bus Voltage Plot',
            left=0.2,
            right=1.5,
            ymin=0.95,
            ymax=1.05,
            legend=True,
            grid=True,
            greyscale=True,
            hline1=1.01,
            hline2=1.02,
            vline1=0.5,
            vline2=0.8,
            dpi=80,
            line_width=1.2,
            font_size=11,
            show=False,
        )

        self.assertEqual(ss.exit_code, 0, "Exit code is not 0.")
Example #3
0
    def test_npcc_raw(self):
        self.ss = andes.run(
            get_case('npcc/npcc.raw'),
            default_config=True,
        )

        os.remove(self.ss.files.txt)
Example #4
0
    def test_npcc_raw(self):
        self.ss = andes.run(
            get_case('npcc/npcc.raw'),
            default_config=True,
        )

        andes.main.misc(clean=True)
Example #5
0
    def setUp(self) -> None:
        self.ss = andes.System()
        self.ss.undill()

        # load from excel file
        andes.io.xlsx.read(self.ss, get_case('5bus/pjm5bus.xlsx'))
        self.ss.setup()
Example #6
0
    def test_islands(self):
        ss = andes.run(get_case('kundur/kundur_islands.json'),
                       no_output=True,
                       default_config=True)

        self.assertEqual(ss.exit_code, 0, "Exit code is not 0.")
        self.assertEqual(len(ss.Bus.islands), 2)
Example #7
0
    def setUp(self) -> None:
        self.ss = System()
        self.ss.undill_calls()

        # load from excel file
        xlsx.read(self.ss, get_case('5bus/pjm5bus.xlsx'))
        self.ss.setup()
Example #8
0
 def test_kundur_COI_empty(self):
     ss = get_case('kundur/kundur_coi_empty.xlsx')
     exit_code = andes.run(ss,
                           routine='tds',
                           no_output=True,
                           tf=0.1,
                           cli=True)
     self.assertEqual(exit_code, 0, "Exit code is not 0.")
Example #9
0
    def test_xlsx_eig_run(self):
        self.xlsx = get_case("kundur/kundur_full.xlsx")
        self.ss = andes.run(self.xlsx, default_config=True)

        self.ss.EIG.run()

        os.remove(self.ss.files.txt)
        os.remove(self.ss.files.eig)
Example #10
0
    def test_npcc_raw_convert(self):
        self.ss = andes.run(get_case('npcc/npcc.raw'),
                            convert=True,
                            default_config=True,
                            )

        os.remove(self.ss.files.dump)
        self.assertEqual(self.ss.exit_code, 0, "Exit code is not 0.")
Example #11
0
    def test_shuntsw(self):
        """
        Test `ShuntSw` class.
        """

        case = get_case('ieee14/ieee14_shuntsw.xlsx')
        ss = andes.run(case,
                       no_output=True,
                       default_config=True,
                       )

        self.assertEqual(ss.exit_code, 0, "Exit code is not 0.")

        np.testing.assert_almost_equal(ss.ShuntSw.beff.v, [0.1, 0.1])
        np.testing.assert_almost_equal(ss.ShuntSw.beff.bcs[0],
                                       [0., 0.025, 0.05, 0.075, 0.1, 0.125])
        np.testing.assert_almost_equal(ss.ShuntSw.beff.bcs[1],
                                       [0., 0.05, 0.1, 0.15, 0.2, 0.25])
Example #12
0
    def test_xlsx_eig_run(self):
        self.xlsx = get_case("kundur/kundur_full.xlsx")
        self.ss = andes.run(
            self.xlsx,
            default_config=True,
            no_output=True,
        )

        self.ss.EIG.run()
Example #13
0
 def test_pflow_mpc_process(self):
     case_path = [
         get_case(os.path.join('matpower', item)) for item in self.cases
     ]
     andes.run(case_path,
               no_output=True,
               ncpu=2,
               pool=False,
               verbose=40,
               default_config=True)
Example #14
0
    def test_kundur_COI(self):
        ss = get_case('kundur/kundur_coi.json')
        exit_code = andes.run(
            ss,
            routine='tds',
            no_output=True,
            tf=0.1,
            cli=True,
            default_config=True,
        )

        self.assertEqual(exit_code, 0, "Exit code is not 0.")
Example #15
0
    def test_read_psse_from_memory(self):
        fd_raw = open(get_case('npcc/npcc.raw'), 'r')
        fd_dyr = open(get_case('npcc/npcc_full.dyr'), 'r')

        ss = andes.main.System(
            default_config=True,
            no_output=True,
        )
        # suppress out-of-normal info
        ss.config.warn_limits = 0
        ss.config.warn_abnormal = 0

        andes.io.psse.read(ss, fd_raw)
        andes.io.psse.read_add(ss, fd_dyr)
        ss.setup()
        ss.PFlow.run()
        ss.TDS.init()

        fd_raw.close()
        fd_dyr.close()
        self.assertEqual(ss.exit_code, 0, "Exit code is not 0.")
Example #16
0
    def test_pvd1_init(self):
        ss = andes.run(
            get_case('ieee14/ieee14_pvd1.json'),
            no_output=True,
            default_config=True,
        )
        ss.config.warn_limits = 0
        ss.config.warn_abnormal = 0

        ss.TDS.init()

        self.assertEqual(ss.exit_code, 0, "Exit code is not 0.")
Example #17
0
    def test_read_json_from_memory(self):
        fd = open(get_case('ieee14/ieee14_zip.json'), 'r')

        ss = andes.main.System(
            default_config=True,
            no_output=True,
        )
        andes.io.json.read(ss, fd)
        ss.setup()
        ss.PFlow.run()

        fd.close()
        self.assertEqual(ss.exit_code, 0, "Exit code is not 0.")
Example #18
0
    def test_read_mpc_from_memory(self):
        fd = open(get_case('matpower/case14.m'), 'r')

        ss = andes.main.System(
            default_config=True,
            no_output=True,
        )
        andes.io.matpower.read(ss, fd)
        ss.setup()
        ss.PFlow.run()

        fd.close()
        self.assertEqual(ss.exit_code, 0, "Exit code is not 0.")
Example #19
0
    def test_npcc_raw2json_convert(self):
        self.ss = andes.run(get_case('npcc/npcc.raw'),
                            convert='json',
                            default_config=True,
                            )

        self.ss2 = andes.run('npcc.json',
                             default_config=True,
                             no_output=True,
                             )

        os.remove(self.ss.files.dump)
        self.assertEqual(self.ss2.exit_code, 0, "Exit code is not 0.")
Example #20
0
    def test_kundur_vsc(self):
        """Test power flow exit code"""

        ss = get_case('kundur/kundur_vsc.json')
        exit_code = andes.run(
            ss,
            routine='pflow',
            no_output=True,
            cli=True,
            default_config=True,
        )

        self.assertEqual(exit_code, 0, "Exit code is not 0.")
Example #21
0
 def test_npcc_raw_tds(self):
     self.ss = andes.run(
         get_case('npcc/npcc48.raw'),
         verbose=50,
         routine='tds',
         no_output=True,
         profile=True,
         tf=10,
     )
     self.ss.dae.print_array('f')
     self.ss.dae.print_array('g')
     self.ss.dae.print_array('f', tol=1e-4)
     self.ss.dae.print_array('g', tol=1e-4)
Example #22
0
    def test_exac1_init(self):
        """
        Test EXAC1 initialization with one TGOV1 at lower limit.
        """
        ss = andes.load(
            get_case('ieee14/ieee14_exac1.json'),
            no_output=True,
            default_config=True,
        )
        ss.PV.config.pv2pq = 1
        ss.PFlow.run()

        # suppress EXAC1 warning from select
        np.seterr(invalid='ignore')

        ss.config.warn_limits = 0
        ss.config.warn_abnormal = 0

        ss.TDS.init()

        self.assertEqual(ss.exit_code, 0, "Exit code is not 0.")
Example #23
0
 def setUp(self) -> None:
     raw = get_case("kundur/kundur_full.raw")
     dyr = get_case("kundur/kundur_full.dyr")
     self.ss_psse = andes.run(raw, addfile=dyr)
Example #24
0
 def setUp(self) -> None:
     xlsx = get_case("kundur/kundur_full.xlsx")
     self.ss = andes.run(xlsx)
Example #25
0
 def test_npcc_raw2json_convert(self):
     self.ss = andes.run(get_case('npcc/npcc48.raw'), convert='json')
     self.ss2 = andes.run('npcc48.json')
     os.remove(self.ss.files.dump)
     andes.main.misc(clean=True)
Example #26
0
 def test_npcc_raw_convert(self):
     self.ss = andes.run(get_case('npcc/npcc48.raw'), convert=True)
     os.remove(self.ss.files.dump)
Example #27
0
 def test_npcc_raw(self):
     self.ss = andes.run(get_case('npcc/npcc48.raw'))
     andes.main.misc(clean=True)
Example #28
0
    def test_xlsx_eig_run(self):
        self.xlsx = get_case("kundur/kundur_full.xlsx")
        self.ss = andes.run(self.xlsx, default_config=True)

        self.ss.EIG.run()
        andes.main.misc(clean=True)
Example #29
0
 def test_npcc_raw(self):
     self.ss = andes.run(
         get_case('npcc/npcc.raw'),
         default_config=True,
         no_output=True,
     )
Example #30
0
 def setUp(self) -> None:
     self.ss = andes.main.load(
         get_case('5bus/pjm5bus.xlsx'),
         default_config=True,
         no_output=True,
     )