Skip to content

Commit

Permalink
turbine_h_s
Browse files Browse the repository at this point in the history
  • Loading branch information
thermalogic committed Aug 16, 2023
1 parent 7b1f5f7 commit 1dc79a4
Showing 1 changed file with 43 additions and 10 deletions.
53 changes: 43 additions & 10 deletions demo_using_lib/Turbine_H-S.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@
H-S(Mollier) Diagram of Steam Turbine Expansion
4 lines:
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
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)
Expand All @@ -28,6 +31,7 @@ def turbine_stage(pi, ti, 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):
Expand Down Expand Up @@ -62,39 +66,68 @@ def expansionline(self):
s_expL = np.array([self.sin, self.sex])

# plot lines
plt.figure(figsize=(6, 8))
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.9], ncol=2, shadow=True, title=_title)
0.6, 0.94], ncol=2, shadow=True, title=_title)

# annotate the inlet and exlet
txt = "h1(%.2f,%.2f)" % (self.pin, self.tin)
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=10,
xytext=(+1, +10), textcoords='offset points', fontsize=8,
arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2"))

txt = "h2(%.2f,%.2f)" % (self.pex, self.tex)
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=10,
xytext=(+1, +10), textcoords='offset points', fontsize=8,
arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2"))
# annotate h2s
txt = "h2s(%.2f,%.2f)" % (self.pex, ph2t(self.pex, h_isos[1]))
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=10,
xytext=(+1, +10), textcoords='offset points', fontsize=8,
arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2"))

plt.xlabel('s(kJ/(kg.K))')
Expand Down

0 comments on commit 1dc79a4

Please sign in to comment.