-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem by modeling of a heat pump #213
Comments
Hi @yuson95, |
Hi, # -*- coding: utf-8 -*-
from tespy.networks import network
from tespy.components import (
sink, source, splitter, compressor, condenser, pump, heat_exchanger_simple,
valve, drum, heat_exchanger, cycle_closer
)
from tespy.connections import connection, ref
from tespy.tools.characteristics import char_line
from tespy.tools.characteristics import load_default_char as ldc
import numpy as np
import pandas as pd
# %% network
nw = network(
fluids=['water', 'R134a', 'air'], T_unit='C', p_unit='bar', h_unit='kJ / kg',
m_unit='kg / s'
)
# %% components
# sources & sinks
cc = cycle_closer('coolant cycle closer')
cb = source('consumer back flow')
cf = sink('consumer feed flow')
amb = source('ambient air')
amb_out1 = sink('sink ambient 1')
amb_out2 = sink('sink ambient 2')
# ambient air system
sp = splitter('splitter')
fan = compressor('fan')
# consumer system
cd = condenser('condenser')
dhp = pump('district heating pump')
cons = heat_exchanger_simple('consumer')
# evaporator system
ves = valve('valve')
dr = drum('drum')
ev = heat_exchanger('evaporator')
su = heat_exchanger('superheater')
erp = pump('evaporator reciculation pump')
# compressor-system
cp1 = compressor('compressor 1')
cp2 = compressor('compressor 2')
ic = heat_exchanger('intercooler')
# %% connections
# consumer system
c_in_cd = connection(cc, 'out1', cd, 'in1')
cb_dhp = connection(cb, 'out1', dhp, 'in1')
dhp_cd = connection(dhp, 'out1', cd, 'in2')
cd_cons = connection(cd, 'out2', cons, 'in1')
cons_cf = connection(cons, 'out1', cf, 'in1')
nw.add_conns(c_in_cd, cb_dhp, dhp_cd, cd_cons, cons_cf)
# connection condenser - evaporator system
cd_ves = connection(cd, 'out1', ves, 'in1')
nw.add_conns(cd_ves)
# evaporator system
ves_dr = connection(ves, 'out1', dr, 'in1')
dr_erp = connection(dr, 'out1', erp, 'in1')
erp_ev = connection(erp, 'out1', ev, 'in2')
ev_dr = connection(ev, 'out2', dr, 'in2')
dr_su = connection(dr, 'out2', su, 'in2')
nw.add_conns(ves_dr, dr_erp, erp_ev, ev_dr, dr_su)
amb_fan = connection(amb, 'out1', fan, 'in1')
fan_sp = connection(fan, 'out1', sp, 'in1')
sp_su = connection(sp, 'out1', su, 'in1')
su_ev = connection(su, 'out1', ev, 'in1')
ev_amb_out = connection(ev, 'out1', amb_out1, 'in1')
nw.add_conns(amb_fan, fan_sp, sp_su, su_ev, ev_amb_out)
# connection evaporator system - compressor system
su_cp1 = connection(su, 'out2', cp1, 'in1')
nw.add_conns(su_cp1)
# compressor-system
cp1_he = connection(cp1, 'out1', ic, 'in1')
he_cp2 = connection(ic, 'out1', cp2, 'in1')
cp2_c_out = connection(cp2, 'out1', cc, 'in1')
sp_ic = connection(sp, 'out2', ic, 'in2')
ic_out = connection(ic, 'out2', amb_out2, 'in1')
nw.add_conns(cp1_he, he_cp2, sp_ic, ic_out, cp2_c_out)
# %% component parametrization
# condenser system
cd.set_attr(pr1=0.99, pr2=0.99, ttd_u=5, design=['pr2', 'ttd_u'],
offdesign=['zeta2', 'kA_char'])
dhp.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char'])
cons.set_attr(pr=0.99, design=['pr'], offdesign=['zeta'])
# air fan
fan.set_attr(eta_s=0.65, design=['eta_s'], offdesign=['eta_s_char'])
# evaporator system
kA_char1 = ldc('heat exchanger', 'kA_char1', 'DEFAULT', char_line)
kA_char2 = ldc('heat exchanger', 'kA_char2', 'EVAPORATING FLUID', char_line)
ev.set_attr(pr1=0.999, pr2=0.99, ttd_l=5,
kA_char1=kA_char1, kA_char2=kA_char2,
design=['pr1', 'ttd_l'], offdesign=['zeta1', 'kA_char'])
su.set_attr(pr1=0.999, pr2=0.99, ttd_u=2, design=['pr1', 'pr2', 'ttd_u'],
offdesign=['zeta1', 'zeta2', 'kA_char'])
erp.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char'])
# compressor system
cp1.set_attr(eta_s=0.85, design=['eta_s'], offdesign=['eta_s_char'])
cp2.set_attr(eta_s=0.9, pr=3, design=['eta_s'], offdesign=['eta_s_char'])
ic.set_attr(pr1=0.99, pr2=0.999, design=['pr1', 'pr2'],
offdesign=['zeta1', 'zeta2', 'kA_char'])
# %% connection parametrization
# condenser system
c_in_cd.set_attr(fluid={'air': 0, 'R134a': 1, 'water': 0})
cb_dhp.set_attr(T=60, p=10, fluid={'air': 0, 'R134a': 0, 'water': 1})
cd_cons.set_attr(T=90)
cons_cf.set_attr(h=ref(cb_dhp, 1, 0), p=ref(cb_dhp, 1, 0))
# evaporator system cold side
erp_ev.set_attr(m=ref(ves_dr, 1.25, 0), p0=5)
su_cp1.set_attr(p0=5, h0=1700)
# evaporator system hot side
# fan blows at constant rate
amb_fan.set_attr(T=12, p=1, fluid={'air': 1, 'R134a': 0, 'water': 0},
offdesign=['v'])
sp_su.set_attr(offdesign=['v'])
ev_amb_out.set_attr(p=1, T=9, design=['T'])
# compressor-system
he_cp2.set_attr(Td_bp=5, p0=20, design=['Td_bp'])
ic_out.set_attr(T=30, design=['T'])
# %% key paramter
cons.set_attr(Q=-200e3)
# %% Calculation
nw.solve('design')
nw.print_results()
nw.save('heat_pump_air')
T_range = [6, 12, 18, 24, 30]
Q_range = np.array([100e3, 120e3, 140e3, 160e3, 180e3, 200e3, 220e3])
df = pd.DataFrame(columns=Q_range / -cons.Q.val)
for T in T_range:
amb_fan.set_attr(T=T)
eps = []
for Q in Q_range:
cons.set_attr(Q=-Q)
nw.solve('offdesign', design_path='heat_pump_air')
if nw.lin_dep:
eps += [np.nan]
else:
eps += [
abs(cd.Q.val) / (cp1.P.val + cp2.P.val + erp.P.val + fan.P.val)
]
df.loc[T] = eps
df.to_csv('COP_air.csv')
`
And here is the arised ERROR:
`ValueError: unable to solve 1phase PY flash with Tmin=288.895, Tmax=682.5 due to error: HSU_P_flash_singlephase_Brent could not find a solution because Hmolar [173454 J/mol] is above the maximum value of 87946.3997716 J/mol`
The Version is 0.3.2
Thank you! |
Changing the refrigerant without changing the parameters of the model appropriately is the issue here:
Specifically, the following modifications will make the model solvable: # use a starting value for pressure at the condenser inlet
c_in_cd.set_attr(fluid={'air': 0, 'R134a': 1, 'water': 0}, p0=30)
# modify the pressure starting values and remove the enthalpy starting value.
# Instead add a condition for the fluid to be at gaseous state at the superheater outlet.
# This condition does not add an equation but stabilizes the solution process.
# At the date of the creation of the example, this tool had not been implemented but it
# is surperior to the enthalpy starting value. I will add a reminder, that I need to change
# the example here.
erp_ev.set_attr(m=ref(ves_dr, 1.25, 0), p0=2)
su_cp1.set_attr(p0=2, state='g') Code to generate this diagram: from fluprodia import FluidPropertyDiagram
import numpy as np
diagram = FluidPropertyDiagram('R134a')
diagram.set_unit_system(T='°C', p='bar', h='kJ/kg')
iso_T = np.arange(-50, 201, 25)
diagram.set_isolines(T=iso_T)
diagram.calc_isolines()
diagram.set_limits(x_min=750, x_max=2000, y_min=-50, y_max=200)
diagram.draw_isolines('Ts')
diagram.save('Ts_diagram.svg')
diagram.set_limits(x_min=0, x_max=750, y_min=1e-1, y_max=1e2)
diagram.draw_isolines('logph')
diagram.save('logph_diagram.svg') |
Thank you! I tried to change the pressure there before, but it raised the same error. And I tried the pressure you gave, it still doesn't work. But Now I know where the problem is. thank you! |
Forgot the modification of this line: he_cp2.set_attr(Td_bp=5, p0=10, design=['Td_bp']) Also, I did only look at the design case. You might need to change the refrigerant in case you want to go for higher temperature levels at the heating side. Best regards |
Yeah I see. And the tool fluprodia is really cool. Thank you so much! |
You're welcome :), happy to see people using tespy (and fluprodia of course :D). Have a nice week! |
Hi @yuson95, |
Yeah of cause! Thanks for your replying!
获取 Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
发件人: Francesco Witte <notifications@github.com>
发送时间: Friday, October 9, 2020 12:22:01 PM
收件人: oemof/tespy <tespy@noreply.github.com>
抄送: yuson95 <yuson_chen@outlook.com>; Mention <mention@noreply.github.com>
主题: Re: [oemof/tespy] problem by modeling of a heat pump (#213)
Hi @yuson95<https://github.com/yuson95>,
can we close this issue? It may be useful for other users, to append the information on changing the working fluid change in the online documentation, too.
Best regards
―
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#213 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIFJYGM553LPZOK36V3ZCE3SJ3P4TANCNFSM4PIDJENQ>.
|
Hi, I got a problem by using tespy to model a heat pump. In the examples of heat pump, NH3 ist used as the Refrigerant, if I thought about it right. If I need to change to other Refrigerant such as R134a or R410a. There will be an error by calculating. I think I may use it wrong. Could you please tell me how to fix that problem? Thank you!
The text was updated successfully, but these errors were encountered: