def execute(self): Fl_I = self.Fl_I Fl_O = self.Fl_O fs_ideal = FlowStation() Fl_O.W = Fl_I.W if self.run_design: #Design Calculations Pt_out = self.Fl_I.Pt * self.PR_des self.PR = self.PR_des fs_ideal.setTotalSP(Fl_I.s, Pt_out) ht_out = (fs_ideal.ht - Fl_I.ht) / self.eff_des + Fl_I.ht Fl_O.setTotal_hP(ht_out, Pt_out) Fl_O.Mach = self.MNexit_des self._exit_area_des = Fl_O.area self._Wc_des = Fl_I.Wc else: #Assumed Op Line Calculation self.PR = self._op_line(Fl_I.Wc) self.eff = self.eff_des #TODO: add in eff variation with W #Operational Conditions Pt_out = Fl_I.Pt * self.PR fs_ideal.setTotalSP(Fl_I.s, Pt_out) ht_out = (fs_ideal.ht - Fl_I.ht) / self.eff + Fl_I.ht Fl_O.setTotal_hP(ht_out, Pt_out) Fl_O.area = self._exit_area_des #causes Mach to be calculated based on fixed area C = GAS_CONSTANT * math.log(self.PR) delta_s = Fl_O.s - Fl_I.s self.eff_poly = C / (C + delta_s) self.pwr = Fl_I.W * (Fl_O.ht - Fl_I.ht) * 1.4148532 #btu/s to hp self.tip_radius = (Fl_O.area / math.pi / (1 - self.hub_to_tip**2))**.5 self.hub_radius = self.hub_to_tip * self.tip_radius
def execute(self): Fl_I = self.Fl_I Fl_O = self.Fl_O Fl_O.copy_from( Fl_I ) Fl_bld1 = self.Fl_bld1 Fl_bld1.copy_from( Fl_I ) Fl_bld2 = self.Fl_bld2 Fl_bld2.copy_from( Fl_I ) FO_ideal = FlowStation() FO_ideal.copy_from( Fl_I ) PtOut = Fl_I.Pt*self.PR FO_ideal.setTotalSP( Fl_I.s,PtOut ) htOut = Fl_I.ht + ( FO_ideal.ht - Fl_I.ht )/self.eff # set the exit conditions to knowm enthalpy and pressure Fl_O.setTotalTP( 518, 15 ) Fl_O.setTotal_hP( htOut, PtOut ) # set the condtions for bleed 1 Wbleed1 = self.Wfrac1*Fl_I.W htBleed1 = Fl_I.ht+ self.hfrac1*( Fl_O.ht - Fl_I.ht ) PtBleed1 = Fl_I.Pt + self.Pfrac1*( Fl_O.Pt - Fl_I.Pt ) Fl_bld1.setTotal_hP( htBleed1,PtBleed1 ) Fl_bld1.W = Wbleed1 # set the conditions for bleed 2 Wbleed2 = self.Wfrac2*Fl_I.W; htBleed2 = Fl_I.ht+ self.hfrac2*( Fl_O.ht - Fl_I.ht) PtBleed2 = Fl_I.Pt + self.Pfrac2*( Fl_O.Pt - Fl_I.Pt ) Fl_bld2.setTotal_hP( htBleed2,PtBleed2 ) Fl_bld2.W = Wbleed2 # subtract the bleed flow from the exit flow Wout = Fl_I.W - Fl_bld1.W - Fl_bld2.W Fl_O.W = Wout # determine the power self.pwr = Fl_I.W * ( Fl_I.ht - Fl_O.ht ) * 1.4148; self.pwr = self.pwr - Fl_bld1.W*(Fl_bld1.ht-Fl_O.ht)*1.4148 - Fl_bld2.W*(Fl_bld2.ht-Fl_O.ht)*1.4148 self.trq = 550. * self.pwr / self.Nmech;
def execute(self): Fl_I = self.Fl_I Fl_O = self.Fl_O fs_ideal = FlowStation() Fl_O.W = Fl_I.W if self.run_design: #Design Calculations Pt_out = self.Fl_I.Pt*self.PR_des self.PR = self.PR_des fs_ideal.setTotalSP(Fl_I.s, Pt_out) ht_out = (fs_ideal.ht-Fl_I.ht)/self.eff_des + Fl_I.ht Fl_O.setTotal_hP(ht_out, Pt_out) Fl_O.Mach = self.MNexit_des self._exit_area_des = Fl_O.area self._Wc_des = Fl_I.Wc else: #Assumed Op Line Calculation self.PR = self._op_line(Fl_I.Wc) self.eff = self.eff_des #TODO: add in eff variation with W #Operational Conditions Pt_out = Fl_I.Pt*self.PR fs_ideal.setTotalSP(Fl_I.s, Pt_out) ht_out = (fs_ideal.ht-Fl_I.ht)/self.eff + Fl_I.ht Fl_O.setTotal_hP(ht_out, Pt_out) Fl_O.area = self._exit_area_des #causes Mach to be calculated based on fixed area C = GAS_CONSTANT*math.log(self.PR) delta_s = Fl_O.s - Fl_I.s self.eff_poly = C/(C+delta_s) self.pwr = Fl_I.W*(Fl_O.ht - Fl_I.ht) * 1.4148532 #btu/s to hp self.tip_radius = (Fl_O.area/math.pi/(1-self.hub_to_tip**2))**.5 self.hub_radius = self.hub_to_tip*self.tip_radius
class FlowStationTestCase(unittest.TestCase): def setUp(self): """Initialization function called before every test function""" self.fs = FlowStation() self.fs.W = 100 self.fs.setDryAir() self.fs.setTotalTP(518, 15) def tearDown(self): """Clean up function called after every test function""" pass #nothing to do for this test def test_copyFS(self): #print "TESTING" self.new_fs = FlowStation() self.new_fs.copy_from(self.fs) assert_rel_error(self, self.new_fs.Tt, 518, .0001) assert_rel_error(self, self.new_fs.Pt, 15, .0001) #all test function have to start with "test_" as the function name def test_setTotalTP(self): self.assertAlmostEqual(self.fs.Pt, 15.0, places=2) self.assertAlmostEqual(self.fs.Tt, 518, places=2) self.assertAlmostEqual( self.fs.ht, -6.32357, places=4) #Tom says the ht values will be different self.assertAlmostEqual(self.fs.W, 100, places=2) self.assertAlmostEqual(self.fs.rhot, .07812, places=4) def test_setTotal_hP(self): ht = self.fs.ht self.fs.setTotalTP(1000, 40) #just to move things around a bit self.fs.setTotal_hP(ht, 15) self.test_setTotalTP( ) #just call this since it has all the checks we need def test_setTotal_SP(self): s = self.fs.s self.fs.setTotalTP(1000, 40) #just to move things around a bit self.fs.setTotalSP(s, 15) self.test_setTotalTP( ) #just call this since it has all the checks we need def test_delh(self): ht = self.fs.ht self.fs.setTotalTP(1000, 40) diffh = self.fs.ht - ht assert_rel_error(self, diffh, 117.4544, .0001) def test_dels(self): s = self.fs.s self.fs.setTotalTP(1000, 40) diffs = self.fs.s - s assert_rel_error(self, diffs, .092609, .0001) def test_set_WAR(self): self.fs.setWAR(0.02) self.fs.setTotalTP(1000, 15) assert_rel_error(self, self.fs.Pt, 15., .0001) assert_rel_error(self, self.fs.Tt, 1000, .0001) assert_rel_error(self, self.fs.WAR, 0.02, .0001) assert_rel_error(self, self.fs.FAR, 0, .0001) assert_rel_error(self, self.fs.ht, -.11513, .0001) def test_setDryAir(self): self.fs.setDryAir() self.fs.setTotalTP(1000, 15) assert_rel_error(self, self.fs.Pt, 15., .0001) assert_rel_error(self, self.fs.Tt, 1000, .0001) assert_rel_error(self, self.fs.WAR, 0.0, .0001) assert_rel_error(self, self.fs.FAR, 0, .0001) assert_rel_error(self, self.fs.ht, 111.129, .0001) assert_rel_error(self, self.fs.WAR, 0, .0001) assert_rel_error(self, self.fs.FAR, 0, .0001)
class FlowStationTestCase(unittest.TestCase): def setUp(self): """Initialization function called before every test function""" self.fs = FlowStation() self.fs.W = 100 self.fs.setDryAir() self.fs.setTotalTP(518, 15) def tearDown(self): """Clean up function called after every test function""" pass #nothing to do for this test def test_copyFS(self): #print "TESTING" self.new_fs = FlowStation() self.new_fs.copy_from(self.fs) assert_rel_error(self,self.new_fs.Tt, 518, .0001) assert_rel_error(self,self.new_fs.Pt, 15, .0001) #all test function have to start with "test_" as the function name def test_setTotalTP(self): self.assertAlmostEqual(self.fs.Pt, 15.0, places=2) self.assertAlmostEqual(self.fs.Tt, 518, places=2) self.assertAlmostEqual(self.fs.ht, -6.32357, places=4) #Tom says the ht values will be different self.assertAlmostEqual(self.fs.W, 100, places=2) self.assertAlmostEqual(self.fs.rhot, .07812, places=4) def test_setTotal_hP(self): ht = self.fs.ht self.fs.setTotalTP(1000, 40) #just to move things around a bit self.fs.setTotal_hP(ht, 15) self.test_setTotalTP() #just call this since it has all the checks we need def test_setTotal_SP(self): s = self.fs.s self.fs.setTotalTP(1000, 40) #just to move things around a bit self.fs.setTotalSP(s, 15) self.test_setTotalTP() #just call this since it has all the checks we need def test_delh(self): ht = self.fs.ht self.fs.setTotalTP(1000, 40) diffh = self.fs.ht - ht assert_rel_error(self,diffh, 117.4544, .0001) def test_dels(self): s = self.fs.s self.fs.setTotalTP(1000, 40) diffs = self.fs.s - s assert_rel_error(self,diffs, .092609, .0001) def test_set_WAR(self): self.fs.setWAR( 0.02 ) self.fs.setTotalTP(1000, 15); assert_rel_error(self,self.fs.Pt, 15., .0001) assert_rel_error(self,self.fs.Tt, 1000, .0001) assert_rel_error(self,self.fs.WAR, 0.02, .0001) assert_rel_error(self,self.fs.FAR, 0, .0001) assert_rel_error(self,self.fs.ht, -.11513, .0001) def test_setDryAir(self): self.fs.setDryAir() self.fs.setTotalTP(1000, 15); assert_rel_error(self,self.fs.Pt, 15.,.0001) assert_rel_error(self,self.fs.Tt, 1000, .0001) assert_rel_error(self,self.fs.WAR, 0.0, .0001) assert_rel_error(self,self.fs.FAR, 0, .0001) assert_rel_error(self,self.fs.ht, 111.129, .0001) assert_rel_error(self,self.fs.WAR, 0, .0001) assert_rel_error(self,self.fs.FAR, 0, .0001)