-
Notifications
You must be signed in to change notification settings - Fork 1
/
Diagram_H-S.py
62 lines (49 loc) · 1.48 KB
/
Diagram_H-S.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""
The Python example to call the seuif97
H-S(Mollier) Diagram
1 Calculating Isotherm lines isot(0.0,800.0)°C
2 Calculating Isobar lines isop(611.657e-6, 100.0)Mpa
3 Calculating saturation lines x=0,x=1
4 Calculating isoquality lines x(0.1,0.9)
Author: Cheng Maohua
Email: [email protected]
"""
from seuif97 import pt2h, pt2s, tx2h, tx2s
import matplotlib.pyplot as plt
import numpy as np
xAxis = "s"
yAxis = "h"
title = {"h": "h, kJ/kg", "s": "s, kJ/kgK"}
plt.title("%s-%s Diagram" % (yAxis, xAxis))
plt.xlabel(title[xAxis])
plt.ylabel(title[yAxis])
plt.xlim(0, 12.5)
plt.ylim(0, 4300)
plt.grid()
Pt = 611.657e-6
isot = np.array([0, 50, 100, 200, 300, 400, 500, 600, 700, 800])
isop = np.array([Pt, 0.001, 0.01, 0.1, 1, 10, 20, 50, 100])
# Isotherm lines to plot, values in ºC
for t in isot:
h = np.array([pt2h(p, t) for p in isop])
s = np.array([pt2s(p, t) for p in isop])
plt.plot(s, h, 'g', lw=0.5)
# Isobar lines to plot
for p in isop:
h = np.array([pt2h(p, t) for t in isot])
s = np.array([pt2s(p, t) for t in isot])
plt.plot(s, h, 'b', lw=0.5)
tc = 647.096-273.15
T = np.linspace(0.1, tc, 100)
# Calculate saturation line
for x in np.array([0, 1.0]):
h = np.array([tx2h(t, x) for t in T])
s = np.array([tx2s(t, x) for t in T])
plt.plot(s, h, 'r', lw=1.0)
# Isoquality lines to plot
isox = np.linspace(0.1, 0.9, 11)
for x in isox:
h = np.array([tx2h(t, x) for t in T])
s = np.array([tx2s(t, x) for t in T])
plt.plot(s, h, 'r--', lw=0.5)
plt.show()