oemof / tespy

Thermal Engineering Systems in Python (TESPy). This package provides a powerful simulation toolkit for thermal engineering plants such as power plants, district heating systems or heat pumps.
https://tespy.readthedocs.io
MIT License
272 stars 85 forks source link

Getting negative quality value #257

Closed govind-menon110 closed 3 years ago

govind-menon110 commented 3 years ago

Hi @fwitte, I used to get proper values for steam quality but recently after updating to tespy 0.4.2.post-2, I get steam quality values of -1 constantly

Adding the simple plant made for checking:

# %% Importing modules
from tespy.networks import Network
from tespy.components import Sink, Source, CombustionChamber
from tespy.components import HeatExchangerSimple, Turbine
from tespy.components import Merge, Splitter
from tespy.connections import Connection

# %% Starting the Network
fluid_list = ['water']
nw = Network(fluids=fluid_list, T_unit='C', p_unit='bar', h_unit='kJ / kg', p_range=[0.01, 250])

# %% Instantiating Components

#src sink
wtr_src = Source('Water Source')
hpt_sink = Sink('HPT Sink')
ipt_sink = Sink('IPT Sink')

#Heat Exhangers

sup = HeatExchangerSimple('Superheater')
reh = HeatExchangerSimple('Reheater')

sup.set_attr(pr=0.98, design=['pr'], offdesign=['zeta', 'kA'])
reh.set_attr(pr=0.98, design=['pr'], offdesign=['zeta', 'kA'])

#Splitter
hpt_spl = Splitter('HPT Splitter')

#Turbines
hpt = Turbine('HPT')
ipt = Turbine('IPT')

hpt.set_attr(eta_s=0.89, design=['eta_s'], offdesign=['eta_s_char', 'cone'])
ipt.set_attr(eta_s=0.903, design=['eta_s'], offdesign=['eta_s_char', 'cone'])

# %% Setting the Connections
src_sup = Connection(wtr_src, 'out1', sup, 'in1')
sup_hpt = Connection(sup, 'out1', hpt, 'in1')
hpt_hptspl = Connection(hpt, 'out1', hpt_spl, 'in1')
hptspl_sink = Connection(hpt_spl, 'out1', hpt_sink, 'in1')
hptspl_reh = Connection(hpt_spl, 'out2', reh, 'in1')

reh_ipt = Connection(reh, 'out1', ipt, 'in1')
ipt_iptsink = Connection(ipt, 'out1', ipt_sink, 'in1')

src_sup.set_attr(p=193.7, T=253.2, m=425.8, fluid={'water': 1})
sup_hpt.set_attr(T=537)
hpt_hptspl.set_attr(p=44.1)
hptspl_reh.set_attr(m=380.5)
reh_ipt.set_attr(T=537)
ipt_iptsink.set_attr(p=7.3)

nw.add_conns(src_sup, sup_hpt, hpt_hptspl, hptspl_reh, hptspl_sink, reh_ipt, ipt_iptsink)

# %% Solving Plant
nw.solve('design')
nw.print_results()

print(hpt_hptspl.x.val)

Am I doing this right?

fwitte commented 3 years ago

Hi @govind-menon110, negative steam mass fraction means the state is outside the two-phase region. The boiling point temperature at 44.1 bar should be somewhere at 250 °C, the actual temperature of that stream is 321 °C. Best regards

govind-menon110 commented 3 years ago

Thank you for the quick response @fwitte. Closing the issue :)