def setup(self): self.nw = nwk.network(['H2O', 'N2', 'O2', 'Ar', 'CO2', 'H2']) self.comb = cmp.combustion_chamber('combustion chamber') c1 = con.connection(cmp.source('air'), 'out1', self.comb, 'in1') c2 = con.connection(cmp.source('fuel'), 'out1', self.comb, 'in2') c3 = con.connection(self.comb, 'out1', cmp.sink('flue gas'), 'in1') self.nw.add_conns(c1, c2, c3)
def test_combustion_chamber(self): """ Test component properties of combustion chambers. """ instance = cmp.combustion_chamber('combustion chamber', fuel='CH4') c1, c2, c3 = self.setup_network_21(instance) air = {'N2': 0.7556, 'O2': 0.2315, 'Ar': 0.0129, 'INCOMP::DowQ': 0, 'H2O': 0, 'NH3': 0, 'CO2': 0, 'CH4': 0} fuel = {'N2': 0, 'O2': 0, 'Ar': 0, 'INCOMP::DowQ': 0, 'H2O': 0, 'NH3': 0, 'CO2': 0.04, 'CH4': 0.96} c1.set_attr(fluid=air, p=1, T=30) c2.set_attr(fluid=fuel, T=30) c3.set_attr(T=1200) b = con.bus('thermal input', P=1e6) b.add_comps({'c': instance}) self.nw.add_busses(b) self.nw.solve('design') self.nw.print_results() eq_(round(b.P.val, 1), round(instance.ti.val, 1), 'Value of thermal input must be ' + str(b.P.val) + ', is ' + str(instance.ti.val) + '.') # test unspecified fuel instance.set_attr(fuel=np.nan) try: self.nw.solve('design') except hlp.TESPyComponentError: pass # test wrongly specified fuel instance.set_attr(fuel='Ar') try: self.nw.solve('design') except hlp.TESPyComponentError: pass
def test_combustion_chamber_missing_fuel(self): """ Test no fuel in network. """ nw = nwk.network(['H2O', 'N2', 'O2', 'Ar', 'CO2']) comb = cmp.combustion_chamber('combustion chamber') c1 = con.connection(cmp.source('air'), 'out1', comb, 'in1') c2 = con.connection(cmp.source('fuel'), 'out1', comb, 'in2') c3 = con.connection(comb, 'out1', cmp.sink('flue gas'), 'in1') nw.add_conns(c1, c2, c3) nw.solve('design', init_only=True)
# define unit systems and fluid property ranges nw = nwk.network(fluids=fluid_list, p_unit='bar', T_unit='C', p_range=[0.5, 10], T_range=[10, 1200]) # %% components # sinks & sources amb = cmp.source('ambient') sf = cmp.source('fuel') fg = cmp.sink('flue gas outlet') # combustion chamber comb = cmp.combustion_chamber(label='combustion chamber') # %% connections amb_comb = con.connection(amb, 'out1', comb, 'in1') sf_comb = con.connection(sf, 'out1', comb, 'in2') comb_fg = con.connection(comb, 'out1', fg, 'in1') nw.add_conns(sf_comb, amb_comb, comb_fg) # %% component parameters # set combustion chamber fuel, air to stoichometric air ratio and thermal input comb.set_attr(fuel='CH4', lamb=3, ti=20000) # %% connection parameters
# %% network fluid_list = ['Ar', 'N2', 'O2', 'CO2', 'CH4', 'H2O'] nw = nwk.network(fluids=fluid_list, p_unit='bar', T_unit='C', h_unit='kJ / kg', p_range=[1, 10], T_range=[110, 1500], h_range=[500, 4000]) # %% components # gas turbine part comp = cmp.compressor('compressor') c_c = cmp.combustion_chamber('combustion') g_turb = cmp.turbine('gas turbine') CH4 = cmp.source('fuel source') air = cmp.source('ambient air') # waste heat recovery suph = cmp.heat_exchanger('superheater') evap = cmp.heat_exchanger('evaporator') drum = cmp.drum('drum') eco = cmp.heat_exchanger('economizer') dh_whr = cmp.heat_exchanger('waste heat recovery') ch = cmp.sink('chimney') # steam turbine part turb = cmp.turbine('steam turbine')