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 tx(self): self.p = if97.tx2p(self.t, self.x) self.h = if97.tx2h(self.t, self.x) self.s = if97.tx2s(self.t, self.x) self.v = if97.tx2v(self.t, self.x)
# 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) # 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()