-
Notifications
You must be signed in to change notification settings - Fork 1
/
Turbine_H-S.py
150 lines (122 loc) · 5.15 KB
/
Turbine_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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
"""
The Python example to call the seuif97
H-S(Mollier) Diagram of Steam Turbine Expansion
6 lines:
1. Isobar line:p inlet
2. Isobar line:p outlet
3. isentropic line: (p inlet ,t inlet h inlet,s inlet), (p outlet,s inlet)
4. Expansion line: inlet,outlet
5. Isobar lines
6. Isotherm lines
Author: Cheng Maohua
Email: cmh@seu.edu.cn
"""
from seuif97 import ph2t, ps2h, pt2h, pt2s, ts2h, ps2t
import matplotlib.pyplot as plt
import numpy as np
def turbine_stage(pi, ti, pe, te):
""" superheated steam zone """
hi = pt2h(pi, ti)
si = pt2s(pi, ti)
he_isos = ps2h(pe, si)
ishd = (hi - he_isos)
he = pt2h(pe, te)
se = pt2s(pe, te)
real_hd = (hi - he)
return hi, si, he, se, ishd, (100.0 * real_hd / ishd)
class Turbine:
def __init__(self, pin, tin, pex, tex):
self.pin = pin
self.tin = tin
self.pex = pex
self.tex = tex
def analysis(self):
self.hin, self.sin, self.hex, self.sex, self.his, self.ef = turbine_stage(
self.pin, self.tin, self.pex, self.tex)
def expansionline(self):
sdelta = 0.01
# 1 Isobar pin
s_isopin = np.array([self.sin - sdelta, self.sin + sdelta])
h_isopin = np.array([ps2h(self.pin, s_isopin[0]),
ps2h(self.pin, s_isopin[1])])
# 2 Isobar pex
s_isopex = np.array([s_isopin[0], self.sex + sdelta])
h_isopex = np.array([ps2h(self.pex, s_isopex[0]),
ps2h(self.pex, s_isopex[1])])
# 3 isentropic lines
h_isos = np.array([self.hin, self.hin-self.his])
s_isos = np.array([self.sin, self.sin])
# 4 expansion Line
h_expL = np.array([self.hin, self.hex])
s_expL = np.array([self.sin, self.sex])
# plot lines
plt.figure(figsize=(6, 9))
plt.title("H-S(Mollier) Diagram of Steam Turbine Expansion")
plt.plot(s_isopin, h_isopin, 'b-') # Isobar line: pin
plt.plot(s_isopex, h_isopex, 'b-') # Isobar line: pex
plt.plot(s_isos, h_isos, 'ys-') # isoentropic line:
plt.plot(s_expL, h_expL, 'r-', label='Expansion Line')
plt.plot(s_expL, h_expL, 'rs')
# Isobar lines and Isotherm lines
s_diff = self.sex-self.sin+2 * sdelta
isos = np.array([self.sin-sdelta + s_diff*(i/7) for i in range(8)])
# Isobar lines to plot,MPa
p_diff = self.pin-self.pex
isop = np.array([self.pex+p_diff*(i/7) for i in range(8)])
for p in isop:
h = np.array([ps2h(p, s) for s in isos])
plt.plot(isos, h, 'b--', lw=0.5)
# annotate Isobar line
txt = "%.2f MPa" % (p)
plt.annotate(txt,
xy=(isos[6], h[6]), xycoords='data',
xytext=(+1, -10), textcoords='offset points', fontsize=6)
# Isotherm lines to plot, ºC
t_isos = ps2t(self.pex, self.sin)
t_diff = self.tin - t_isos
isot = np.array([t_isos+t_diff*(i/9) for i in range(10)])
for t in isot:
h = np.array([ts2h(t, s) for s in isos])
plt.plot(isos, h, 'm', lw=0.5)
# annotate Isotherm line
txt = "%.2f°C" % (t)
plt.annotate(txt,
xy=(isos[0], h[0]), xycoords='data',
xytext=(+1, -10), textcoords='offset points', fontsize=6)
_title = 'The isentropic efficiency = ' + \
r'$\frac{h_1-h_2}{h_1-h_{2s}}$' + '=' + \
'{:.2f}'.format(self.ef) + '%'
plt.legend(loc="center", bbox_to_anchor=[
0.6, 0.94], ncol=2, shadow=True, title=_title)
# annotate the inlet and exlet
txt = "%.2fMPa,%.2f°C" % (self.pin, self.tin)
plt.annotate(txt,
xy=(self.sin, self.hin), xycoords='data',
xytext=(+1, +10), textcoords='offset points', fontsize=8,
arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2"))
txt = "%.2fMPa,%.2f°C" % (self.pex, self.tex)
plt.annotate(txt,
xy=(self.sex, self.hex), xycoords='data',
xytext=(+1, +10), textcoords='offset points', fontsize=8,
arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2"))
# annotate h2s
txt = "%.2fMPa,%.2f°C" % (self.pex, ph2t(self.pex, h_isos[1]))
plt.annotate(txt,
xy=(self.sin, h_isos[1]), xycoords='data',
xytext=(+1, +10), textcoords='offset points', fontsize=8,
arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2"))
plt.xlabel('s(kJ/(kg.K))')
plt.ylabel('h(kJ/kg)')
plt.grid()
plt.show()
def __str__(self):
result = ('\n Inlet(p, t) {:>6.2f} MPa {:>6.2f} °C \n Exlet(p, t) {:>6.2f} MPa {:>6.2f} °C \nThe isentropic efficiency: {:>5.2f}%'
.format(self.pin, self.tin, self.pex, self.tex, self.ef))
return result
if __name__ == '__main__':
pin, tin = 16.0, 535.0
pex, tex = 3.56, 315.0
tb1 = Turbine(pin, tin, pex, tex)
tb1.analysis()
print(tb1)
tb1.expansionline()