def CylinderEff(cylinder): """simple function for cylinde using 'dict' """ cylinder['inlet']['h'] = pt2h(cylinder['inlet']['p'], cylinder['inlet']['t']) cylinder['inlet']['s'] = pt2s(cylinder['inlet']['p'], cylinder['inlet']['t']) cylinder['outlet']['h'] = pt2h(cylinder['outlet']['p'], cylinder['outlet']['t']) cylinder['outlet']['s'] = pt2s(cylinder['outlet']['p'], cylinder['outlet']['t']) # h2s is the specific enthalpy at state 2 for the isentropic turbine h2s = ps2h(cylinder['outlet']['p'], cylinder['inlet']['s']) cylinder['h2s'] = h2s hds = cylinder['inlet']['h'] - h2s # isentropic specific enthalpy drop hd = cylinder['inlet']['h'] - cylinder['outlet'][ 'h'] # specific enthalpy drop cylinder['ef'] = 100 * hd / hds return cylinder
def CylinderEff(cylinder): """simple function for cylinde using 'dict' """ cylinder['inlet']['h'] = pt2h(cylinder['inlet']['p'], cylinder['inlet']['t']) cylinder['inlet']['s'] = pt2s(cylinder['inlet']['p'], cylinder['inlet']['t']) cylinder['outlet']['h'] = pt2h(cylinder['outlet']['p'], cylinder['outlet']['t']) cylinder['outlet']['s'] = pt2s(cylinder['outlet']['p'], cylinder['outlet']['t']) # h2s is the specific enthalpy at state 2 for the isentropic turbine h2s = ps2h(cylinder['outlet']['p'], cylinder['inlet']['s']) cylinder['h2s'] = h2s hds = cylinder['inlet']['h'] - h2s # isentropic specific enthalpy drop hd = cylinder['inlet']['h'] - cylinder['outlet']['h'] # specific enthalpy drop cylinder['ef'] = 100 * hd / hds return cylinder
def CalNodeProperties(nodes): """ get node properties using seuif97 """ for node in nodes: if node['p'] != None and node['t'] != None: node['h'] = pt2h(node['p'], node['t']) node['s'] = pt2s(node['p'], node['t']) node['x'] = pt2x(node['p'], node['t']) elif node['p'] != None and node['x'] != None: node['t'] = px2t(node['p'], node['x']) node['h'] = px2h(node['p'], node['x']) node['s'] = px2s(node['p'], node['x']) elif node['t'] != None and node['x'] != None: node['p'] = tx2p(node['t'], node['x']) node['h'] = tx2h(node['t'], node['x']) node['s'] = tx2s(node['t'], node['x'])
def pt(self): self.h = if97.pt2h(self.p, self.t) self.s = if97.pt2s(self.p, self.t) self.v = if97.pt2v(self.p, self.t) self.x = None
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 # Isotherm lines to plot, values in ÂșC 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]) 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)
# -*- coding: utf-8 -*- import seuif97 p = 0.00353658941 t = 300 - 273.15 s1 = seuif97.px2s(p, 0) s2 = seuif97.px2s(p, 1) h1 = seuif97.px2h(p, 0) h2 = seuif97.px2h(p, 1) x = 0.20 s = s1 + x * (s2 - s1) h = h1 + x * (h2 - h1) v = seuif97.hs2t(h, s) print(v) p = 3 t = 300 - 273.15 s = seuif97.ph2s(p, t) print(s) t = 310 - 273.15 s = seuif97.ph2s(p, t) print(s) s = seuif97.pt2s(0.000611212677444, 273.15) print(s) h = seuif97.pt2h(0.000611212677444, 273.15) print(h)
# -*- coding: utf-8 -*- import seuif97 p = 0.00353658941 t = 300 - 273.15 s1 = seuif97.px2s(p, 0) s2 = seuif97.px2s(p, 1) h1 = seuif97.px2h(p, 0) h2 = seuif97.px2h(p, 1) x = 0.20 s = s1 + x * (s2 - s1) h = h1 + x * (h2 - h1) v = seuif97.hs2t(h, s) print(v) p = 3 t = 300 - 273.15 s = seuif97.ph2s(p, t) print(s) t = 310 - 273.15 s = seuif97.ph2s(p, t) print(s) s = seuif97.pt2s(0.000611212677444, 273.15) print(s) h = seuif97.pt2h(0.000611212677444, 273.15) print(h)
def pt(self): self.h = if97.pt2h(self.p, self.t) self.s = if97.pt2s(self.p, self.t) self.v = if97.pt2v(self.p, self.t) self.x = None
1 ??2?(in1,in2) , e.g: h=pt2h(p,t) 2 ??(in1,in2,propertyID), , e.g: h=pt(p,t,4), the propertyID h is 4 License: this code is in the public domain Author: Cheng Maohua([email protected]) Last modified: 2018.11.28 """ import seuif97 p, t = 16.10, 535.10 # ??2?(in1,in2) h = seuif97.pt2h(p, t) s = seuif97.pt2s(p, t) v = seuif97.pt2v(p, t) print("(p,t),h,s,v:", "{:>.2f}\t {:>.2f}\t {:>.2f}\t {:>.3f}\t {:>.4f}".format(p, t, h, s, v)) # ??(in1,in2,propertyid) t = seuif97.ph(p, h, 1) s = seuif97.ph(p, h, 5) v = seuif97.ph(p, h, 3) print("(p,h),t,s,v:", "{:>.2f}\t {:>.2f}\t {:>.2f}\t {:>.3f}\t {:>.4f}".format(p, h, t, s, v))