def test_addfile_path(self): ieee14 = andes.get_case("ieee14/ieee14.raw") path, case = os.path.split(ieee14) andes.load('ieee14.raw', addfile='ieee14.dyr', input_path=path) andes.run('ieee14.raw', addfile='ieee14.dyr', input_path=path, no_output=True)
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)
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.")
def test_npcc_raw(self): self.ss = andes.run( get_case('npcc/npcc.raw'), default_config=True, ) os.remove(self.ss.files.txt)
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)
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.")
def test_npcc_raw(self): self.ss = andes.run( get_case('npcc/npcc.raw'), default_config=True, ) andes.main.misc(clean=True)
def test_addfile_path(self): path, case = os.path.split(self.ieee14) andes.load( 'ieee14.raw', addfile='ieee14.dyr', input_path=path, default_config=True, ) andes.run( 'ieee14.raw', addfile='ieee14.dyr', input_path=path, no_output=True, default_config=True, )
def test_save_load_ss(self): """ Test loading a snapshot and continuing the simulation """ # --- save a snapshot --- ss = andes.run(andes.get_case("kundur/kundur_full.xlsx"), no_output=True, default_config=True, # remove if outside tests ) ss.TDS.config.tf = 2.0 ss.TDS.run() path = save_ss('kundur_full_2s.pkl', ss) # --- load a snapshot --- ss = load_ss(path) # set a new simulation end time ss.TDS.config.tf = 3.0 ss.TDS.run() np.testing.assert_almost_equal(ss.GENROU.omega.v, np.array([1.00549119, 1.00529052, 1.00426882, 1.0039297])) os.remove(path)
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.")
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)
def setUp(self): self.ss = andes.run( andes.get_case("ieee14/ieee14_pvd1.xlsx"), default_config=True, no_output=True, ) self.ss.config.warn_limits = 0 self.ss.config.warn_abnormal = 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.")
def test_relative_path(self): ss = andes.run( 'ieee14.raw', input_path=andes.get_case('ieee14/', check=False), no_output=True, default_config=True, ) self.assertNotEqual(ss, None)
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, )
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()
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.")
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.")
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)
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.")
def test_PLBVFU1(self): """ Test PLVBFU1 model. """ ss = andes.run( andes.get_case("ieee14/ieee14_plbvfu1.xlsx"), default_config=True, no_output=True, ) ss.TDS.config.tf = 3.0 ss.TDS.run() self.assertEqual(ss.exit_code, 0)
def test_pert_file(self): """Test path of pert file""" path, case = os.path.split(self.ieee14) # --- with pert file --- ss = andes.run( 'ieee14.raw', pert='pert.py', input_path=path, no_output=True, default_config=True, ) ss.TDS.init() self.assertIsNotNone(ss.TDS.callpert) # --- without pert file --- ss = andes.run( 'ieee14.raw', input_path=path, no_output=True, default_config=True, ) ss.TDS.init() self.assertIsNone(ss.TDS.callpert)
def test_addfile_path(self): path, case = os.path.split(self.ieee14) ss = andes.load( 'ieee14.raw', addfile='ieee14.dyr', input_path=path, default_config=True, ) self.assertNotEqual(ss, None) ss = andes.run( 'ieee14.raw', addfile='ieee14.dyr', input_path=path, no_output=True, default_config=True, ) self.assertNotEqual(ss, None)
def test_npcc_raw(self): self.ss = andes.run( get_case('npcc/npcc.raw'), default_config=True, no_output=True, )
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)
def setUp(self) -> None: xlsx = get_case("kundur/kundur_full.xlsx") self.ss = andes.run(xlsx)
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)
def test_npcc_raw_convert(self): self.ss = andes.run(get_case('npcc/npcc48.raw'), convert=True) os.remove(self.ss.files.dump)
def test_npcc_raw(self): self.ss = andes.run(get_case('npcc/npcc48.raw')) andes.main.misc(clean=True)
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)