示例#1
0
    def test_pwl(self):
        """ Test UDOPF solver with pwl auction case.
        """
        case = Case.load(PWL_FILE)
        solver = UDOPF(case, dc=True)
        solution = solver.solve()
        generators = self.case.generators

        self.assertTrue(solution["converged"] == True)
        self.assertTrue(False not in [g.online for g in generators])
示例#2
0
class UOPFTestCase(unittest.TestCase):
    """ Defines a test case for the UOPF routine.
    """

    def setUp(self):
        """ The test runner will execute this method prior to each test.
        """
        case = self.case = Case.load(DATA_FILE)
        self.solver = UDOPF(case, dc=True)


    def test_dc(self):
        """ Test solver using DC formulation.
        """
        solution = self.solver.solve()
        generators = self.case.generators

        self.assertTrue(solution["converged"] == True)
        # Generator 1 gets shutdown.
        self.assertFalse(generators[0].online)
        self.assertAlmostEqual(generators[1].p, 110.80, places=2)
        self.assertAlmostEqual(generators[2].p,  99.20, places=2)

        self.assertAlmostEqual(solution["f"], 2841.59, places=2)


    def test_pwl(self):
        """ Test UDOPF solver with pwl auction case.
        """
        case = Case.load(PWL_FILE)
        solver = UDOPF(case, dc=True)
        solution = solver.solve()
        generators = self.case.generators

        self.assertTrue(solution["converged"] == True)
        self.assertTrue(False not in [g.online for g in generators])
示例#3
0
 def setUp(self):
     """ The test runner will execute this method prior to each test.
     """
     case = self.case = Case.load(DATA_FILE)
     self.solver = UDOPF(case, dc=True)