def values_test(self): """Testa cada valor""" rel_err = .0026 for i in range(len(Ps)): relative_eq_(T_sats[i], steam.T_sat(Ps[i]), rel_err) relative_eq_(h_ls[i], steam.h_l(Ps[i]), rel_err) relative_eq_(D_ls[i], steam.D_l(Ps[i]), rel_err) relative_eq_(h_gs[i], steam.h_g(Ps[i]), rel_err) relative_eq_(D_gs[i], steam.D_g(Ps[i]), rel_err)
def get_values_from_steam_table(self, P): """Atualiza valores com aproximação da tabela de vapor""" self.h_w = steam.h_l(P) self.h_s = steam.h_g(P) self.ro_w = steam.D_l(P) self.ro_s = steam.D_g(P) self.t_s = steam.T_sat(P) self.dh_w_dP = steam.dh_l_dP(P) self.dh_s_dP = steam.dh_g_dP(P) self.dro_w_dP = steam.dD_l_dP(P) self.dro_s_dP = steam.dD_g_dP(P) self.dt_s_dP = steam.dT_sat_dP(P) self.h_c = self.h_s - self.h_w
def values_plot_test(self): rc('text', usetex=True) mathtext.fontset = "Computer Modern" Psf = [x/100. for x in range(120, 900)] steam_tables = [T_sats, h_ls, D_ls, h_gs, D_gs] funcs = [[steam.T_sat(x) for x in Psf], [steam.h_l(x) for x in Psf], [steam.D_l(x) for x in Psf], [steam.h_g(x) for x in Psf], [steam.D_g(x) for x in Psf]] ylabels = [r"$T_{sat} (^oC)$", r'$h_w (J/kg)$', r"$\rho_w (kg/m^3)$", r"$h_s (J/kg)$", r"$\rho_s (kg/m^3)$"] pyplot.clf() pyplot.figure(1) plot_grid_sz = 320 for i in range(len(steam_tables)): pyplot.subplot(plot_grid_sz + i + 1) pyplot.xlabel(r'Press\~{a}o (MPa)') pyplot.ylabel(ylabels[i]) pyplot.plot(Psf, funcs[i]) pyplot.scatter(Ps, steam_tables[i], c='g', marker='+', s=80) pyplot.tight_layout() pyplot.savefig("plots/steam_table_test.png")