Example #1
0
 def test_turbine(self):
     """
     Test component properties of turbines.
     """
     instance = cmp.turbine('turbine')
     c1, c2 = self.setup_network_11(instance)
     fl = {'N2': 0.7556, 'O2': 0.2315, 'Ar': 0.0129, 'INCOMP::DowQ': 0, 'H2O': 0, 'NH3': 0, 'CO2': 0, 'CH4': 0}
     c1.set_attr(fluid=fl, m=15, p=10, T=120)
     c2.set_attr(p=1)
     instance.set_attr(eta_s=0.8)
     self.nw.solve('design')
     self.nw.save('tmp')
     # calculate isentropic efficiency the old fashioned way
     eta_s_d = (c2.h.val_SI - c1.h.val_SI) / (instance.h_os('') - c1.h.val_SI)
     eq_(round(eta_s_d, 3), round(instance.eta_s.val, 3), 'Value of isentropic efficiency must be ' + str(eta_s_d) + ', is ' + str(instance.eta_s.val) + '.')
     # trigger invalid isentropic efficiency
     instance.set_attr(eta_s=1.1)
     self.nw.solve('design')
     # calculate isentropic efficiency the old fashioned way
     eta_s = (c2.h.val_SI - c1.h.val_SI) / (instance.h_os('') - c1.h.val_SI)
     eq_(round(eta_s, 3), round(instance.eta_s.val, 3), 'Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(instance.eta_s.val) + '.')
     c1.set_attr(p=np.nan)
     instance.cone.is_set = True
     instance.eta_s_char.is_set = True
     instance.eta_s.is_set = False
     self.nw.solve('offdesign', design_path='tmp')
     eq_(round(eta_s_d, 2), round(instance.eta_s.val, 2), 'Value of isentropic efficiency (' + str(instance.eta_s.val) + ') must be identical to design case (' + str(eta_s_d) + ').')
     # lowering mass flow, inlet pressure must sink according to cone law
     c1.set_attr(m=c1.m.val*0.8)
     self.nw.solve('offdesign', design_path='tmp')
     eq_(0.125, round(instance.pr.val, 3), 'Value of pressure ratio (' + str(instance.pr.val) + ') must be at (' + str(0.125) + ').')
     self.nw.print_results()
     # testing more parameters for eta_s_char
     c1.set_attr(m=10)
     # test param specification v
     instance.eta_s_char.param='v'
     self.nw.solve('offdesign', design_path='tmp')
     eq_(0.8, round(instance.eta_s.val, 3), 'Value of isentropic efficiency (' + str(instance.eta_s.val) + ') must be (' + str(0.8) + ').')
     # test param specification pr
     instance.eta_s_char.param='pr'
     self.nw.solve('offdesign', design_path='tmp')
     eq_(0.769, round(instance.eta_s.val, 3), 'Value of isentropic efficiency (' + str(instance.eta_s.val) + ') must be (' + str(0.769) + ').')
     # test param specification dh_s
     instance.eta_s_char.param='dh_s'
     self.nw.solve('offdesign', design_path='tmp')
     eq_(0.799, round(instance.eta_s.val, 3), 'Value of isentropic efficiency (' + str(instance.eta_s.val) + ') must be (' + str(0.799) + ').')
     instance.eta_s_char.param=None
     # test for missing parameter declaration
     try:
         self.nw.solve('offdesign', design_path='tmp')
     except ValueError:
         pass
     shutil.rmtree('./tmp', ignore_errors=True)
Example #2
0
from tespy import con, cmp, nwk
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np

# %% network

fluids = ['water']

nw = nwk.network(fluids=fluids, p_unit='bar', T_unit='C', h_unit='kJ / kg')

# %% components

# turbine part
valve_turb = cmp.valve(label='valve_turb')
turbine_hp = cmp.turbine(label='turbine_hp')
split = cmp.splitter(label='splitter1')
turbine_lp = cmp.turbine(label='turbine_lp')

# condenser and preheater
condenser = cmp.condenser(label='condenser')
preheater = cmp.condenser(label='preheater')
valve_pre = cmp.valve(label='valve_pre')
valve = cmp.valve(label='valve1')
merge = cmp.merge(label='merge1')

# feed water
pump = cmp.pump(label='pump')
steam_generator = cmp.heat_exchanger_simple(label='steam generator')

# sources and sinks
Example #3
0
mass_flow_rate_brine = 3.4199e2
T_brine_in = 146.6
p_brine_in = 9.4
T_brine_out = 69.1

# calculation
T_before_turbine = PropsSI('T', 'P', p_after_pump*0.957627118*0.955752212*1e5, 'Q', 1, 'Isopentane')-273.15+2.3
# basic network
nw = nwk.network(fluids=fluids)
nw.set_attr(p_unit='bar', T_unit='C', h_unit='kJ / kg')
# main components
condenser = cmp.condenser('condenser')
ihe = cmp.heat_exchanger('internal heat exchanger')
pump = cmp.pump('feeding pump')
turbine = cmp.turbine('turbine')
p_and_e = cmp.heat_exchanger('preheater and evaporator')
# cooling air
source_ca = cmp.source('cooling air source')
sink_ca = cmp.sink('cooling air sink')
#brine
source_b = cmp.source('brine source')
sink_b = cmp.sink('brine sink')
# working fluid
source_wf_1 = cmp.source('working fluid source before turbine')
sink_wf_1 = cmp.sink('working fluid sink from before turbine')
source_wf_2 = cmp.source('working fluid source from ihe')
sink_wf_2 = cmp.sink('working fluid sink from ihe')
# connections
# main cycle
p_and_e_wf_in = con.connection(source_wf_2, 'out1', p_and_e, 'in2')
Example #4
0
# %% 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')
cond = cmp.condenser('condenser')
Example #5
0
from tespy import cmp, con, nwk, hlp, cmp_char, nwkr
import numpy as np
from matplotlib import pyplot as plt

# %% 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, 100], T_range=[10, 1500], h_range=[10, 4000])

# %% components
# gas turbine part
comp = cmp.compressor('compressor')
comp_fuel = cmp.compressor('fuel 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')
ch = cmp.sink('chimney')

# steam turbine part
turb_hp = cmp.turbine('steam turbine high pressure')
cond_dh = cmp.condenser('district heating condenser')
mp_split = cmp.splitter('mp split')