Replies: 1 comment
-
Hi @mortezaep, thanks for reaching out!
from tespy.components import Sink, Source, HeatExchanger
from tespy.connections import Connection
from tespy.networks import Network
import shutil
nw = Network(p_unit='bar', T_unit='C')
so1 = Source('source1')
si1 = Sink('sink1')
so2 = Source('source2')
si2 = Sink('sink2')
des = HeatExchanger('heat_exchanger')
des.component()
so1_des = Connection(so1, 'out1', des, 'in1')
des_si1 = Connection(des, 'out1', si1, 'in1')
so2_des = Connection(so2, 'out1', des, 'in2')
des_si2 = Connection(des, 'out2', si2, 'in1')
nw.add_conns(so1_des, des_si1, so2_des, des_si2)
des.set_attr(pr1=1, pr2=1)
so1_des.set_attr(fluid={'water': 1}, T=120, p=10, m=50)
so2_des.set_attr(fluid={'R410A': 1}, T=10, m=20)
des_si2.set_attr(x=0, T=50)
nw.solve('design')
des_si2.set_attr(T=None)
# NOTE: You are setting a two-phase constraint (x=0) on the des_si2 connection
# therefore assume, your result will be in two-phase region. You must make sure
# your temperature is then below the critical temperature of the fluid, otherwise
# the simulation cannot converge successfully.
# The ttd_u specification has to be really high, since it is difference between so1_des.T - des_si2.T.
des.set_attr(ttd_u=50)
nw.solve("design")
nw.print_results() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear all
I'm trying to create a heat exchanger. In my first try, I wrote the below code that perfectly works:
Nonetheless, I faced two problems in further development:
when I change the line (
so2_des.set_attr(fluid={'water': 1}, T=10, m=20)
) to (so2_des.set_attr(fluid={'water': 1}, T=10, p=1.692)
) I get an error about (Singularity in jacobian matrix ...). The only difference is that instead of pressure, the mass rate is unknown.By changing the working fluid to R410A, I get coolprop error. So the below code doesn't work.
I do appreciate any help from your side.
Beta Was this translation helpful? Give feedback.
All reactions