예제 #1
0
    def test_range_validity(self):
        s = State(T=300, p=3)
        s1 = State(T=300, p=80)
        s2 = State(T=500, p=3)

        self.assertTrue(s in Region1())
        self.assertTrue(s2 in Region1())
        self.assertTrue(s2 in Region1())

        s = State(T=300, p=3)
        self.assertTrue(s in Region1())
예제 #2
0
    def test_backwards_p_Th(self):
        pees = [3, 80, 80]
        hs = [500, 500, 1500]
        tees = [0.391_798_509e3, 0.378_108_626e3, 0.611_041_229e3]

        for p, h, T in zip(pees, hs, tees):
            p_calc = Region1().p_Th(T, h)
            self.assertAlmostEqual(p, p_calc, places=4)
예제 #3
0
    def test_backwards_p_Ts(self):
        pees = [3, 80, 80]
        ss = [0.5, 0.5, 3]
        tees = [0.307_842_258e3, 0.309_979_785e3, 0.565_899_909e3]

        for p, s, T in zip(pees, ss, tees):
            p_calc = Region1().p_Ts(T, s)
            self.assertAlmostEqual(p, p_calc, places=4)
예제 #4
0
    def test_backwards_p_hs(self):
        hs = [0.001, 90, 1500]
        ss = [0, 0, 3.4]
        pees = [9.800_980_612e-4, 9.192_954_727e1, 5.868_294_423e1]

        for h, s, p in zip(hs, ss, pees):
            p_calc = Region1().p_hs(h, s)
            self.assertAlmostEqual(p, p_calc, places=6)
예제 #5
0
    def test_property_accuracy(self):
        """Test the results from Table 5."""
        s = State(T=300, p=3)
        s1 = State(T=300, p=80)
        s2 = State(T=500, p=3)
        states = [s, s1, s2]

        table5 = np.array([[0.100215168e-2, 0.971180894e-3, 0.120241800e-2],
                           [0.115331273e3, 0.184142828e3, 0.975542239e3],
                           [0.112324818e3, 0.106448356e3, 0.971934985e3],
                           [0.392294792, 0.368563852, 0.258041912e1],
                           [0.417301218e1, 0.401008987e1, 0.465580682e1],
                           [0.150773921e4, 0.163469054e4, 0.124071337e4]])
        table5 = table5.T

        for state, properties in zip(states, table5):
            r = Region1(state=state)
            p = [r.v, r.h, r.u, r.s, r.cp, r.w]
            np.testing.assert_almost_equal(properties, p, decimal=5)