def test_pT_functions(self): """Tests to verify all functions with the Parameters p and T of Region 1 by comparing the Results to IF-97 Page 9 Table 5""" # %* 7.1 Verifiy region 1 # %IF-97 Table 5, Page 9 p = [3.0, 80.0, 3.0] T = [300.0, 300.0, 500.0] IF97 = [[0.00100215168, 0.000971180894, 0.001202418], [115.331273, 184.142828, 975.542239], [112.324818, 106.448356, 971.934985], [0.392294792, 0.368563852, 2.58041912], [4.17301218, 4.01008987, 4.65580682], [1507.73921, 1634.69054, 1240.71337]] R1 = numpy.zeros((6, 3)) for i in range(0, 3): R1[0][i] = Region1.v1_pT(p[i], T[i]) R1[1][i] = Region1.h1_pT(p[i], T[i]) R1[2][i] = Region1.u1_pT(p[i], T[i]) R1[3][i] = Region1.s1_pT(p[i], T[i]) R1[4][i] = Region1.Cp1_pT(p[i], T[i]) R1[5][i] = Region1.w1_pT(p[i], T[i]) Region1_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97)) self.assertLess( Region1_error, self.maxMatrixError, 'Test of p,T Functions for Region 1 failed. Error was %(error)e allowed: %(max)e' % { 'error': Region1_error, 'max': self.maxMatrixError })
def test_hs_function(self): """Tests to verify all functions with the Parameters h and s of Region 1 by comparing the Results to IF-97 Page 6 Table 3""" # % Supplementary Release on Backward Equations # % for Pressure as a Function of Enthalpy and Entropy p(h, s) # % Table 3, Page 6 h = [0.001, 90.0, 1500.0] s = [0.0, 0.0, 3.4] IF97 = [0.0009800980612, 91.929547272, 58.68294423] R1 = numpy.zeros(3) for i in range(0, 3): R1[i] = Region1.p1_hs(h[i], s[i]) p1_hs_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97)) self.assertLess(p1_hs_error, self.maxError, 'Test of p(h,s) Function for Region 1 failed. Error was %(error)e allowed: %(max)e' % {'error': p1_hs_error, 'max': self.maxError})
def test_pT_functions(self): """Tests to verify all functions with the Parameters p and T of Region 1 by comparing the Results to IF-97 Page 9 Table 5""" # %* 7.1 Verifiy region 1 # %IF-97 Table 5, Page 9 p = [3.0, 80.0, 3.0] T = [300.0, 300.0, 500.0] IF97 = [[0.00100215168, 0.000971180894, 0.001202418], [115.331273, 184.142828, 975.542239], [112.324818, 106.448356, 971.934985], [0.392294792, 0.368563852, 2.58041912], [4.17301218, 4.01008987, 4.65580682], [1507.73921, 1634.69054, 1240.71337]] R1 = numpy.zeros((6, 3)) for i in range(0, 3): R1[0][i] = Region1.v1_pT(p[i], T[i]) R1[1][i] = Region1.h1_pT(p[i], T[i]) R1[2][i] = Region1.u1_pT(p[i], T[i]) R1[3][i] = Region1.s1_pT(p[i], T[i]) R1[4][i] = Region1.Cp1_pT(p[i], T[i]) R1[5][i] = Region1.w1_pT(p[i], T[i]) Region1_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97)) self.assertLess(Region1_error, self.maxMatrixError, 'Test of p,T Functions for Region 1 failed. Error was %(error)e allowed: %(max)e' % {'error': Region1_error, 'max': self.maxMatrixError})
def test_ps_function(self): """Tests to verify all functions with the Parameters p and s of Region 1 by comparing the Results to IF-97 Page 12 Table 9""" # % IF - 97 Table 9, Page 12 p = [3.0, 80.0, 80.0] s = [0.5, 0.5, 3.0] IF97 = [307.842258, 309.979785, 565.899909] R1 = numpy.zeros(3) for i in range(0, 3): R1[i] = Region1.T1_ps(p[i], s[i]) T1_ps_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97)) self.assertLess( T1_ps_error, self.maxError, 'Test of T(p,s) Function for Region 1 failed. Error was %(error)e allowed: %(max)e' % { 'error': T1_ps_error, 'max': self.maxError })
def test_ph_function(self): """Tests to verify all functions with the Parameters p and h of Region 1 by comparing the Results to IF-97 Page 11 Table 7""" # % IF - 97 Table 7, Page 11 p = [3.0, 80.0, 80.0] h = [500.0, 500.0, 1500.0] IF97 = [391.798509, 378.108626, 611.041229] R1 = numpy.zeros(3) for i in range(0, 3): R1[i] = Region1.T1_ph(p[i], h[i]) T1_ph_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97)) self.assertLess( T1_ph_error, self.maxError, 'Test of T(p,h) Function for Region 1 failed. Error was %(error)e allowed: %(max)e' % { 'error': T1_ph_error, 'max': self.maxError })
def test_hs_function(self): """Tests to verify all functions with the Parameters h and s of Region 1 by comparing the Results to IF-97 Page 6 Table 3""" # % Supplementary Release on Backward Equations # % for Pressure as a Function of Enthalpy and Entropy p(h, s) # % Table 3, Page 6 h = [0.001, 90.0, 1500.0] s = [0.0, 0.0, 3.4] IF97 = [0.0009800980612, 91.929547272, 58.68294423] R1 = numpy.zeros(3) for i in range(0, 3): R1[i] = Region1.p1_hs(h[i], s[i]) p1_hs_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97)) self.assertLess( p1_hs_error, self.maxError, 'Test of p(h,s) Function for Region 1 failed. Error was %(error)e allowed: %(max)e' % { 'error': p1_hs_error, 'max': self.maxError })