Replies: 2 comments 1 reply
-
Hi Ronja, the issue here is, that you are specifying enthalpy and your calculation of enthalpy does not fit the calculation of enthalpy in the back-end of tespy. Those input values cannot be handled by the solver, you can use temperature instead. If you want to know, how tespy calculates these things, you have to check the source code of the from tespy.networks import Network
from tespy.components import CycleCloser,Compressor,HeatExchanger,Valve,Sink,Source,Condenser, SimpleHeatExchanger
from tespy.connections import Connection
import CoolProp.CoolProp as CP
# from pyfluids import Fluid, FluidsList, Input
from CoolProp.HumidAirProp import HAPropsSI
nw = Network(T_unit="C",p_unit="Pa",h_unit="J / kg",m_unit = "kg / s")
heat_exchanger = SimpleHeatExchanger('heat exchanger')
source = Source("source")
sink = Sink("sink")
c1 = Connection(source,'out1',heat_exchanger,'in1',label = '1')
c2 = Connection(heat_exchanger, 'out1', sink, 'in1', label = '2')
nw.add_conns(c1,c2)
xH2O = 0.0686
xH2O_out = 0.0568
t_in = 51
p_in = 99000-133
t_out = 43.3
p_out = 99000-133-173
m_total = 35039.9 / 3600
print(xH2O)
c1.set_attr(fluid = {'H2O': xH2O, 'air': 1 - xH2O})
c1.set_attr(T=t_in)
c1.set_attr(p=p_in)
c1.set_attr(m=m_total)
c2.set_attr(T=t_out)#h=xH2O_out*CP.PropsSI('H','T',273.15+t_out,'P',p_out,'water')+(1-xH2O_out)*CP.PropsSI('H','T',273.15+t_out,'P',p_out,'air'))
c2.set_attr(p=p_out)
nw.solve('design') # not working : Could not find a feasible value for mixture temperature at connection 1. The values for temperature, specific volume, volumetric flow and entropy are set to nan.
nw.print_results()
c1.set_attr(fluid ={"H2O": None, "air": None}) # to reset properties pass emtpy dictionary
# dry air: 0.2315 O2 + 0.7556 N2 + 0.0129 Ar
c1.set_attr(fluid={'O2': 0.2315 * (1 - xH2O), 'N2': 0.7556 * (1 - xH2O), "Ar": 0.0129 * (1 - xH2O), 'H2O': xH2O}) # O2 0.2314*(1-xH2O) # N2 0.7552*(1-xH2O) # H2O xH2O
nw.solve('design')
# this is not meant to be a method exposed to the user, it is used in the back-end to determine
# what mass and molar fractions of water are liquid and gaseous in a mixture
from tespy.tools.fluid_properties.mixtures import cond_check
mass_fractions_gas_1, _, mass_water_liquid_1, _ = cond_check(c1.p.val_SI, c1.T.val_SI, c1.fluid_data, "H2O")
mass_fractions_gas_2, _, mass_water_liquid_2, _ = cond_check(c2.p.val_SI, c2.T.val_SI, c2.fluid_data, "H2O")
print(mass_fractions_gas_1, mass_water_liquid_1) # no liquid water here
print("Gas phase specific mass fractions:", mass_fractions_gas_2)
print("Liquid water mass fraction of total mass", mass_water_liquid_2)
print("Gaseous water mass fraction of total mass:", c2.fluid.val["H2O"] - mass_water_liquid_2)
# heat extraction
print((c2.h.val_SI - c1.h.val_SI) * m_total)
# I do not know, how the HAPropsSI enthalpy works exactly, but I would think that we need Hha
# for enthalpy of total mass. The absolute water content should be the same at inlet and outlet
# we need kg water per kg dry air, therefore substract water content from total air mass
# in denominator
print(2403.9 / (35039.9 - 2403.9))
h1 = HAPropsSI("Hha", "T", 273.15 + t_in, "P", p_in, "W", (2403.9) / (35039.9 - 2403.9))
h2 = HAPropsSI("Hha", "T", 273.15 + t_out, "P", p_out, "W", (2403.9) / (35039.9 - 2403.9))
# heat extraction
print((h2 - h1) * m_total) |
Beta Was this translation helpful? Give feedback.
-
@ronja2023: I lost connection again and the mailadress was then lost... This would be the general idea: from tespy.networks import Network
from tespy.components import Compressor, SimpleHeatExchanger, Source, Sink
from tespy.connections import Connection, Bus
from tespy.tools import ExergyAnalysis
from CoolProp.CoolProp import PropsSI as CP
from tespy.tools.helpers import get_chem_ex_lib
nw = Network(T_unit="C", p_unit="bar")
so = Source("Source")
si = Sink("sink")
cp = Compressor("compressor")
sh = SimpleHeatExchanger("compressor heat loss")
c1 = Connection(so, "out1", cp, "in1", label="1")
c2 = Connection(cp, "out1", sh, "in1", label="2")
c3 = Connection(sh, "out1", si, "in1", label="3")
nw.add_conns(c1, c2, c3)
c1.set_attr(fluid={"R290": 1}, m=1, x=1, T=30)
cp.set_attr(pr=3, eta_s=0.85)
sh.set_attr(pr=1)
c3.set_attr(T=87)
nw.solve("design")
nw.print_results()
heat_loss_ratio = sh.Q.val / cp.P.val
heat_loss_bus = Bus("heat loss")
heat_loss_bus.add_comps(
{"comp": cp, "char": abs(heat_loss_ratio)},
{"comp": sh, "char": 1}
)
heat_loss_bus.set_attr(P=0)
nw.add_busses(heat_loss_bus)
# 0 = P_compressor * 0.02 + Q_heat_loss
c3.set_attr(T=None)
# Ergebnis ohne andere Änderungen: T muss wieder 87 sein
nw.solve("design")
nw.print_results()
# z. B. Druckverältnis und Massenstrom ändern sich
c1.set_attr(m=0.75)
cp.set_attr(pr=2.5)
nw.solve("design")
nw.print_results()
print(c3.T.val - c2.T.val) You can contact me via mail (see my gh profile) or the mail here: https://github.com/oemof/tespy/blob/dev/pyproject.toml |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am working with a humid exhaust gas which should condensate during heat exchanger. I am using a SimpleHeatExchanger arrangement as seen in the picture.
From manufacturer specification I know that the transferred heat is supposed to be 471.1 kW and the inlet temperature is 51 °C and the outlet temperature is 43.3 °C meanwhile the water content drops from 2403.9 kg/h in 35039.9 kg/h humid air to 1964 kg/h water mass flow rate. The pressure drops from 98867 to 98694 Pa.
Using pressure and enthalpy (based on temperature, pressure and water content) the program does not find the required temperature. Could you have a look at this?
Kind regards and thanks,
Ronja
Beta Was this translation helpful? Give feedback.
All reactions