• API
• FAQ
• Tools
• Archive
SHARE
TWEET # Untitled a guest Apr 7th, 2020 292 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. from pyXSteam.XSteam import XSteam
2. import matplotlib.pyplot as plt
3.
4. steamTable = XSteam(XSteam.UNIT_SYSTEM_BARE)
5.
6. batch_time = 5  # timmar
7.
8. dm_eth = 11.37  # [m^3/h]
9. T1 = [74.3, 72, 70, 75, 70]  # [C] dynamisk
10. T2 = [13, 14, 15, 13, 12]  # [C] dynamisk
11. P2 = 0.3  # MPa
12.
13. dQ_C_list = []
14. dQ_H_list = []
15.
16.
17. def heat_sink(P2, h2, dm_h2o):  # Function heat sink
18.     h3 = steamTable.hL_p(P2)
19.     dQ_H = dm_h2o*(h2-h3)  # [kW]
20.     return dQ_H
21.
22.
23. def heat_exchange(T1, T2):
24.     # density of ethanol
25.     den = 785.3  # kg/m^3
26.
27.     # specific heat capacity {isobaric gas} should be dynamic
28.     c_eth = 2.18  # [kJ/kg K]
29.
30.     # heat transferred to cooling agent
31.     dQ_C = dm_eth * c_eth * (T1 - T2) * den
32.
33.     # enthalpy at saturated steam
34.     h_H = steamTable.hV_p(0.101325)
35.
36.     s_L3 = steamTable.sL_p(0.3)
37.     s_low = s_L3
38.
39.     h_low = steamTable.h_ps(0.101325, s_low)
40.
41.     dm_h2o = dQ_C / (h_H-h_low)
42.
43.     # entropy of water at atmospheric pressure
44.     s1 = steamTable.sV_p(0.101325)
45.
46.     # entropy after compression given ideal conditions
47.     s2 = s1
48.
49.     # enthalpy entering heat exchanger
50.     h2 = steamTable.h_ps(P2, s2)
51.
52.     return dQ_C, h2, dm_h2o
53.
54.
55. for x in range(batch_time):
56.     dQ_C, h2, dm_h2o = heat_exchange(T1[x], T2[x])
57.     dQ_C_list.append(dQ_C)
58.     dQ_H_list.append(heat_sink(P2, h2, dm_h2o))
59.
60.
61. fig, ax = plt.subplots()
62. ax.plot(range(batch_time), dQ_C_list, '--o', label= 'Värmeöverföring Eth/kyl [kJ/timme]')
63. ax.plot(range(batch_time), dQ_H_list, '--o', label= 'Värmeöverföring kyl/ånga [kJ/timme]')
64. ax.set_xlabel('Tid [timme]')
65. ax.set_ylabel('Värmeöverföring [kJ/timme]')
66. ax.set_title('Kylbehov per timme under en körning')
67. ax.axis([0, batch_time, 0, 1.1*max(dQ_C_list)])
68. ax.legend()
69. plt.show()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top