Exergy analysis of a combinded process (gas turbine and steam boiler) runs in a AttributeError #498
Answered
by
fwitte
tub-hofmann
asked this question in
Q&A
-
I create a simple model of a gasturbine and a steam boiler to produce 40 bar steam. Model is solved with starting values. And solved for a second time setting ttd_l at Economizer to 50K. The exergy analysis runs in a AttributeError. Any ideas? from tespy.networks import Network
from tespy.components import (Sink, Source, CombustionChamber, HeatExchanger, Drum, Pump, Compressor, Turbine)
from tespy.connections import Connection, Bus
from tespy.tools import ExergyAnalysis
from CoolProp.CoolProp import PropsSI as CP
# fluids
air = {'O2': 0.21, 'N2': 0.79}
fuel = {'CH4': 1}
water = {'H2O': 1}
# network
gtsteamboiler = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s')
# components
src_air = Source('air-source')
src_fuel = Source('fuel-source')
snk_fluegas = Sink('flue-gas-sink')
src_water = Source('water')
snk_steam = Sink('steam')
cmp_comp = Compressor('air-compressor')
cmp_cc = CombustionChamber('combustion chamber')
cmp_exp = Turbine('expander')
cmp_pump = Pump('pump')
cmp_econ = HeatExchanger('economizer')
cmp_drum = Drum('drum')
cmp_evap = HeatExchanger('evaporator')
# connections
c11 = Connection(src_air, 'out1', cmp_comp, 'in1', label='11 (air)')
c12 = Connection(cmp_comp, 'out1', cmp_cc, 'in1', label='12 (compressed air)')
c13 = Connection(src_fuel, 'out1', cmp_cc, 'in2', label='13 (fuel)')
c14 = Connection(cmp_cc, 'out1', cmp_exp, 'in1', label='14 (hot and compressed fluegas)')
c15 = Connection(cmp_exp, 'out1', cmp_evap, 'in1', label='15 (fluegas)')
c16 = Connection(cmp_evap, 'out1', cmp_econ, 'in1', label='16 (fluegas)')
c17 = Connection(cmp_econ, 'out1', snk_fluegas, 'in1', label='17 (fluegas)')
c21 = Connection(src_water, 'out1', cmp_pump, 'in1', label='21 (water, lq.)')
c22 = Connection(cmp_pump, 'out1', cmp_econ, 'in2', label='22 (water, lq.)')
c23 = Connection(cmp_econ, 'out2', cmp_drum, 'in1', label='23 (water, x=0)')
c24 = Connection(cmp_drum, 'out1', cmp_evap, 'in2', label='24 (drum circulation)')
c25 = Connection(cmp_evap, 'out2', cmp_drum, 'in2', label='25 (drum circulation)')
c26 = Connection(cmp_drum, 'out2', snk_steam, 'in1', label='26 (steam, x=1)')
gtsteamboiler.add_conns(c11,c12,c13,c14,c15,c16,c17,c21,c22,c23,c24,c25,c26)
# parameters
# components
cmp_comp.set_attr(eta_s=0.8, pr=20)
cmp_cc.set_attr(lamb=2.5)
cmp_exp.set_attr(eta_s=0.9)
cmp_pump.set_attr(eta_s=0.8)
cmp_econ.set_attr(pr1=1, pr2=1)
cmp_evap.set_attr(pr1=1)
# connections
c11.set_attr(p=1, T=25, fluid=air)
c13.set_attr(m=3, T=25, fluid=fuel)
c17.set_attr(p=1)
c21.set_attr(m=25, p=1, T=60, fluid=water)
c22.set_attr(p=40)
c23.set_attr(h=CP('H', 'P', 40*1E5, 'Q', 0, 'water')/1E3)
c25.set_attr(x=0.6)
# busses
heat_output = Bus('heat-output')
power_output = Bus('power-output')
fuel_input = Bus('fuel-input')
heat_output.add_comps(
{'comp': cmp_econ, 'char': -1},
{'comp': cmp_evap, 'char': -1})
power_output.add_comps(
{'comp': cmp_comp, 'base': 'bus', 'char': 1},
{'comp': cmp_exp, 'char': 1})
fuel_input.add_comps({'comp': cmp_cc, 'base': 'bus'})
gtsteamboiler.add_busses(heat_output, power_output, fuel_input)
# solve
gtsteamboiler.solve(mode='design')
gtsteamboiler.print_results()
c13.set_attr(m=None)
cmp_econ.set_attr(ttd_l=50)
gtsteamboiler.solve(mode='design')
gtsteamboiler.print_results()
# exergy analysis
pamb = 1
Tamb = 25
ean = ExergyAnalysis(network=gtsteamboiler, E_F=[fuel_input], E_P=[power_output, heat_output])
ean.analyse(pamb, Tamb) |
Beta Was this translation helpful? Give feedback.
Answered by
fwitte
Mar 14, 2024
Replies: 1 comment 9 replies
-
Hi and thanks for reaching out! The issue arises from the fact you are providing the wrong components to the exergy analysis busses.
heat_output = Bus('heat-output')
power_output = Bus('power-output')
fuel_input = Bus('fuel-input')
flue_gas_output = Bus('flue-gas-output')
heat_output.add_comps(
{'comp': snk_steam, 'base': 'component'},
{'comp': src_water, 'base': 'bus'}
)
power_output.add_comps(
{'comp': cmp_comp, 'base': 'bus', 'char': 1},
{'comp': cmp_pump, 'base': 'bus', 'char': 1},
{'comp': cmp_exp, 'char': 1}
)
fuel_input.add_comps({'comp': src_fuel, 'base': 'bus'})
flue_gas_output.add_comps({'comp': snk_fluegas, 'base': 'component'})
(...)
ean = ExergyAnalysis(network=gtsteamboiler, E_F=[fuel_input], E_P=[power_output, heat_output], E_L=[flue_gas_output]) |
Beta Was this translation helpful? Give feedback.
9 replies
Answer selected by
fwitte
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi and thanks for reaching out!
The issue arises from the fact you are providing the wrong components to the exergy analysis busses.
base
component
, water sink withbase
bus
)E_L
of the network.