예제 #1
0
 def test_FlowStatePoly(self):
     refData = mc.RefData("air", 2, 101325., {
         'T': [200, 250, 300, 350, 400]
     })
     flow = mc.FlowStatePoly(refData, 1.0, mc.PT_INPUTS, 101325., 293.15)
     self.assertAlmostEqual(flow.rho() - 1.205, 0, 3)
     self.assertAlmostEqual(flow.cp() / 1000 - 1.006, 0, 3)
     self.assertAlmostEqual(flow.k() - 0.0257, 0, 3)
예제 #2
0
 def test_RefData_populate_data(self):
     refData = mc.RefData("air", 2, 101325., {'T': [200, 300, 400, 500]})
     rhoData = [1.765, 1.177, 0.8824, 0.7060]
     viscData = [1.329e-5, 1.846e-5, 2.286e-5, 2.670e-5]
     all(
         self.assertAlmostEqual(refData.data['rho'][i] - rhoData[i], 0, 2)
         for i in range(len(rhoData)))
     all(
         self.assertAlmostEqual(refData.data['visc'][i] - viscData[i], 0, 2)
         for i in range(len(viscData)))
예제 #3
0
 def test_RefData_error_len_data(self):
     with self.assertRaises(ValueError):
         mc.RefData(
             "air", 2, 101325., {
                 'T': [200, 250, 300, 350, 400],
                 'h': [0.1, 0.1, 0.1],
                 'rho': [0.1, 0.1, 0.1],
                 's': [0.1, 0.1, 0.1],
                 'visc': [0.1, 0.1, 0.1],
                 'k': [0.1, 0.1, 0.1],
                 'cp': [0.1, 0.1, 0.1]
             })
예제 #4
0
 def test_FlowStatePoly_error_pressure(self):
     refData = mc.RefData("air", 2, 101325., {
         'T': [200, 250, 300, 350, 400]
     })
     with self.assertRaises(ValueError):
         mc.FlowStatePoly(refData, 1.0, mc.PT_INPUTS, 201325., 293.15)
예제 #5
0
 def test_RefData_error_len_data(self):
     with self.assertRaises(ValueError):
         refData = mc.RefData("air", 2, 101325., [200, 250, 300, 350, 400],
                              [0.1, 0.1, 0.1])
예제 #6
0
 def test_accept_FlowStatePoly(self):
     refData = mc.RefData("air", 2, 101325.,
                          {'T': [200, 250, 300, 350, 400]})
     flow = mc.FlowStatePoly(refData, 1.0, mc.PT_INPUTS, 101325., 293.15)
     self.hxUnit.update({'flowInSf': flow})
예제 #7
0
# ************************************************
print("Begin Rankine cycle setup...")
wf = mc.FlowState("R123")
pEvap = 10.e5
superheat = 0
TCond = 300.
subcool = 0
comp = mc.CompBasic(nan, 0.7, sizeAttr="pRatio")
print("  - created compressor")
sourceIn_m = 0.09
sourceIn_T = 1170.
sourceIn_p = 1.116e5
sourceFluid = "N2[{0}]&CO2[{1}]".format(0.75, 0.25)
TData = [300, 500, 700, 900, sourceIn_T]
sourceRefData = mc.RefData(sourceFluid,
                           2,
                           sourceIn_p, {'T': TData},
                           phaseCP=CP.iphase_gas)
sourceIn = mc.FlowStatePoly(sourceRefData, 0.09, CP.PT_INPUTS, sourceIn_p,
                            sourceIn_T)
sourceAmbient = mc.FlowState(sourceFluid, CP.iphase_gas, -1, CP.PT_INPUTS,
                             0.88260e5, 281.65)

evap = mc.library.alfaLaval_AC30EQ(sizeAttr="NPlate")
print("  - created evaporator")
exp = mc.ExpBasic(-1, 0.7, sizeAttr="pRatio")
print("  - created expander")
sinkIn = mc.FlowState("Air", -1, -1, CP.PT_INPUTS, 0.88260e5, 281.65)
sinkAmbient = sinkIn.copy()
cond = mc.ClrBasic(constraint=mc.CONSTANT_P, -1, 1, sizeAttr="Q")
print("  - created condenser")
config = mc.Config()