コード例 #1
0
    def test_config_option(self):
        """
        Test single and multiple config_option passed to `andes.run`.
        """

        path = andes.get_case("5bus/pjm5bus.json")
        self.assertRaises(ValueError,
                          andes.load,
                          path,
                          config_option={"TDS = 1"})
        self.assertRaises(ValueError,
                          andes.load,
                          path,
                          config_option={"System.TDS.any = 1"})
        self.assertRaises(ValueError,
                          andes.load,
                          path,
                          config_option={"TDS.tf == 1"})

        ss = andes.load(path,
                        config_option={"PQ.pq2z = 0"},
                        default_config=True)
        self.assertEqual(ss.PQ.config.pq2z, 0)

        ss = andes.load(path, config_option={"PQ.pq2z=0"}, default_config=True)
        self.assertEqual(ss.PQ.config.pq2z, 0)

        ss = andes.load(path,
                        config_option=["PQ.pq2z=0", "TDS.tf = 1"],
                        default_config=True)
        self.assertEqual(ss.PQ.config.pq2z, 0)
        self.assertEqual(ss.TDS.config.tf, 1)
コード例 #2
0
ファイル: test_paths.py プロジェクト: Hello-World-Py/andes
    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)
コード例 #3
0
ファイル: test_paths.py プロジェクト: willjschmitt/andes
    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,
        )
コード例 #4
0
ファイル: test_services.py プロジェクト: treymingee/andes
    def test_backref_ieee14(self):
        ss = andes.load(andes.get_case("ieee14/ieee14_gentrip.xlsx"))

        self.assertSequenceEqual(ss.Area.Bus.v[0], [1, 2, 3, 4, 5])
        self.assertSequenceEqual(ss.Area.Bus.v[1], [6, 7, 8, 9, 10, 11, 12, 13, 14])

        self.assertSequenceEqual(ss.StaticGen.SynGen.v[0], ['GENROU_2'])
        self.assertSequenceEqual(ss.SynGen.TurbineGov.v[0], ['TGOV1_1'])
コード例 #5
0
    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)
コード例 #6
0
    def test_output_xyname(self):
        """
        Test x_name and y_name for Output
        """

        ss = andes.load(andes.get_case("5bus/pjm5bus.json"),
                        no_output=True,
                        setup=False,
                        default_config=True)

        ss.add("Output", {"model": "GENCLS", "varname": "omega"})
        ss.add("Output", {"model": "GENCLS", "varname": "delta", "dev": 2})
        ss.add("Output", {"model": "Bus"})

        ss.setup()

        ss.PFlow.run()
        ss.TDS.config.tf = 0.1
        ss.TDS.run()
        ss.TDS.load_plotter()

        nt = len(ss.dae.ts.t)
        nx = 5
        ny = 10

        self.assertEqual(len(ss.dae.x_name_output), nx)
        self.assertEqual(len(ss.dae.y_name_output), ny)

        self.assertEqual(ss.dae.ts.x.shape[1], nx)
        self.assertEqual(ss.dae.ts.y.shape[1], ny)

        np.testing.assert_array_equal(ss.Output.xidx, [1, 4, 5, 6, 7])
        np.testing.assert_array_equal(ss.Output.yidx,
                                      [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

        # test loaded data by plot
        self.assertEqual(ss.TDS.plt._data.shape, (nt, nx + ny + 1))
        np.testing.assert_array_equal(
            ss.TDS.plt._process_yidx(ss.GENCLS.omega, a=None), [2, 3, 4, 5])
        np.testing.assert_array_equal(
            ss.TDS.plt._process_yidx(ss.GENCLS.delta, a=None), [1])
        np.testing.assert_array_equal(
            ss.TDS.plt._process_yidx(ss.TG2.pout, a=None), [])
コード例 #7
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.")