コード例 #1
0
 def test_number_of_vars(self):
     for t in self.testtimesteps:
         DCs._solve_DC_flows_(self.network_constr, self.N, t,\
                              self.mode, self.sum_of_squared_flows_constr,
                              self.mean_loads)
         expected_number = 3*self.Nnodes
         self.assertTrue(len(self.network_constr.getVars())==expected_number)
コード例 #2
0
    def test_only_bal_or_curt(self):
        """ This test makes sure that in the unconstrained case,
            all the total balancing or the total curtailment is 0

            """

        for t in self.testtimesteps:
            results = DCs._solve_DC_flows_(self.network_copper, self.N, t, \
                                  self.mode, self.sum_of_squared_flows_copper,\
                                  self.mean_loads)
            bal = results[1::3]
            curt = results[2::3]
            self.assertTrue(sum(bal)<=1e-5 or sum(curt)<=1e-5)