def test_enthalpy_moist_air(self): """Check the enthalpy of humid air.""" from psychrochart.equations import ( PRESSURE_STD_ATM_KPA, saturation_pressure_water_vapor, humidity_ratio, enthalpy_moist_air) # From http://www.engineeringtoolbox.com/enthalpy-moist-air-d_683.html # Check the enthalpy of humid air at 25ºC with specific # moisture content x = 0.0203 kg/kg (saturation). press = PRESSURE_STD_ATM_KPA dry_temp_c, w_kg_kga = 25, 0.0203 p_sat = saturation_pressure_water_vapor(dry_temp_c) w_max = humidity_ratio(p_sat, press) ratio_humid = w_kg_kga / w_max p_w_kpa = ratio_humid * p_sat h_m = enthalpy_moist_air(dry_temp_c, p_w_kpa, press) h_m_bis = enthalpy_moist_air(dry_temp_c, p_w_kpa, press) self.assertEqual(h_m, h_m_bis) self.assertEqual(round(h_m, 1), 76.9)
def Qest(self): """Carga de refrigeração sensível e latente para fluxo de ar estabelecido kW""" import psychrochart.equations as pce area_p = self.h_porta * self.l_porta tbs = self.temp_externa('tbs') tbu = self.temp_externa('tbu') h_externo = pce.humidity_ratio_from_temps(tbs, tbu) w_externo = pce.water_vapor_pressure(h_externo) hi = pce.enthalpy_moist_air(tbs, w_externo) t_estoc = self.dados_produto('T Estoc') u_estoc = self.dados_produto('UR') t_bu_refri = pce.wet_bulb_temperature_empiric(t_estoc, u_estoc) h_refri = pce.humidity_ratio_from_temps(t_estoc, t_bu_refri) w_refri = pce.water_vapor_pressure(h_refri) hr = pce.enthalpy_moist_air(t_estoc, w_refri) pi = 1 / pce.specific_volume(tbs, w_externo) pr = 1 / pce.specific_volume(t_estoc, w_refri) Fm = (2 / (1 + (pr / pi)**(1 / 3)))**1.5 Uest = 0.442 * Fm * ((pr - pi) * 9.81 * self.h_porta / pr)**0.5 Qest = 0.5 * area_p * (hi - hr) * pr * Uest return Qest
def _make_chart_data(self, styles: Union[dict, str]=None, zones_file: Union[dict, str]=None) -> None: """Generate the data to plot the psychrometric chart.""" # Get styling config = load_config(styles) self.d_config = config self.temp_step = config['limits']['step_temp'] self.figure_params = config['figure'] self.dbt_min, self.dbt_max = config['limits']['range_temp_c'] self.w_min, self.w_max = config['limits']['range_humidity_g_kg'] self.chart_params = config['chart_params'] # Base pressure if config['limits'].get('pressure_kpa') is not None: self.p_atm_kpa = config['limits']['pressure_kpa'] elif config['limits'].get('altitude_m') is not None: self.altitude_m = config['limits']['altitude_m'] self.p_atm_kpa = pressure_by_altitude(self.altitude_m) # Dry bulb constant lines (vertical): if self.chart_params["with_constant_dry_temp"]: step = self.chart_params["constant_temp_step"] style = config['constant_dry_temp'] temps_vl = f_range(self.dbt_min, self.dbt_max, step) heights = [1000 * humidity_ratio( saturation_pressure_water_vapor(t), p_atm_kpa=self.p_atm_kpa) for t in temps_vl] self.constant_dry_temp_data = PsychroCurves( [PsychroCurve([t, t], [self.w_min, h], style, type_curve='constant_dry_temp_data', label=None, logger=self._logger) for t, h in zip(temps_vl, heights)], family_label=self.chart_params["constant_temp_label"]) # Absolute humidity constant lines (horizontal): if self.chart_params["with_constant_humidity"]: step = self.chart_params["constant_humid_step"] style = config['constant_humidity'] ws_hl = f_range(self.w_min + step, self.w_max + step / 10, step) dew_points = solve_curves_with_iteration( 'DEW POINT', [x / 1000 for x in ws_hl], lambda x: dew_point_temperature( water_vapor_pressure( x, p_atm_kpa=self.p_atm_kpa)), lambda x: humidity_ratio( saturation_pressure_water_vapor(x), p_atm_kpa=self.p_atm_kpa)) self.constant_humidity_data = PsychroCurves( [PsychroCurve([t_dp, self.dbt_max], [w, w], style, type_curve='constant_humidity_data', label=None, logger=self._logger) for w, t_dp in zip(ws_hl, dew_points)], family_label=self.chart_params["constant_humid_label"]) # Constant relative humidity curves: if self.chart_params["with_constant_rh"]: rh_perc_values = self.chart_params["constant_rh_curves"] rh_label_values = self.chart_params.get("constant_rh_labels", []) label_loc = self.chart_params.get("constant_rh_labels_loc", .85) style = config["constant_rh"] temps_ct_rh, curves_ct_rh = _gen_list_curves_range_temps( curve_constant_humidity_ratio, self.dbt_min, self.dbt_max, self.temp_step, rh_perc_values, p_atm_kpa=self.p_atm_kpa) self.constant_rh_data = PsychroCurves( [PsychroCurve( temps_ct_rh, curve_ct_rh, style, type_curve='constant_rh_data', label_loc=label_loc, label='RH {:g} %'.format(rh) if round(rh, 1) in rh_label_values else None, logger=self._logger) for rh, curve_ct_rh in zip(rh_perc_values, curves_ct_rh)], family_label=self.chart_params["constant_rh_label"]) # Constant enthalpy lines: if self.chart_params["with_constant_h"]: step = self.chart_params["constant_h_step"] start, end = self.chart_params["range_h"] enthalpy_values = f_range(start, end, step) h_label_values = self.chart_params.get("constant_h_labels", []) label_loc = self.chart_params.get("constant_h_labels_loc", 1.) style = config["constant_h"] temps_max_constant_h = [ dry_temperature_for_enthalpy_of_moist_air( self.w_min / 1000, h) for h in enthalpy_values] sat_points = solve_curves_with_iteration( 'ENTHALPHY', enthalpy_values, lambda x: dry_temperature_for_enthalpy_of_moist_air( self.w_min / 1000 + 0.1, x), lambda x: enthalpy_moist_air( x, saturation_pressure_water_vapor(x), p_atm_kpa=self.p_atm_kpa)) self.constant_h_data = PsychroCurves( [PsychroCurve( [t_sat, t_max], [1000 * humidity_ratio( saturation_pressure_water_vapor(t_sat), self.p_atm_kpa), self.w_min], style, type_curve='constant_h_data', label_loc=label_loc, label='{:g} kJ/kg_da'.format(h) if round(h, 3) in h_label_values else None, logger=self._logger) for t_sat, t_max, h in zip( sat_points, temps_max_constant_h, enthalpy_values)], family_label=self.chart_params["constant_h_label"]) # Constant specific volume lines: if self.chart_params["with_constant_v"]: step = self.chart_params["constant_v_step"] start, end = self.chart_params["range_vol_m3_kg"] vol_values = f_range(start, end, step) vol_label_values = self.chart_params.get("constant_v_labels", []) label_loc = self.chart_params.get("constant_v_labels_loc", 1.) style = config["constant_v"] temps_max_constant_v = [ dry_temperature_for_specific_volume_of_moist_air( 0, specific_vol, p_atm_kpa=self.p_atm_kpa) for specific_vol in vol_values] sat_points = solve_curves_with_iteration( 'CONSTANT VOLUME', vol_values, lambda x: dry_temperature_for_specific_volume_of_moist_air( 0, x, p_atm_kpa=self.p_atm_kpa), lambda x: specific_volume( x, saturation_pressure_water_vapor(x), p_atm_kpa=self.p_atm_kpa)) self.constant_v_data = PsychroCurves( [PsychroCurve( [t_sat, t_max], [1000 * humidity_ratio( saturation_pressure_water_vapor(t_sat), self.p_atm_kpa), 0], style, type_curve='constant_v_data', label_loc=label_loc, label='{:g} m3/kg_da'.format(vol) if round(vol, 3) in vol_label_values else None, logger=self._logger) for t_sat, t_max, vol in zip( sat_points, temps_max_constant_v, vol_values)], family_label=self.chart_params["constant_v_label"]) # Constant wet bulb temperature lines: if self.chart_params["with_constant_wet_temp"]: step = self.chart_params["constant_wet_temp_step"] start, end = self.chart_params["range_wet_temp"] wbt_values = f_range(start, end, step) wbt_label_values = self.chart_params.get( "constant_wet_temp_labels", []) label_loc = self.chart_params.get( "constant_wet_temp_labels_loc", .05) style = config["constant_wet_temp"] w_max_constant_wbt = [humidity_ratio( saturation_pressure_water_vapor(wbt), self.p_atm_kpa) for wbt in wbt_values] self.constant_wbt_data = PsychroCurves( [PsychroCurve( [wbt, self.dbt_max], [1000 * w_max, 1000 * humidity_ratio( saturation_pressure_water_vapor(self.dbt_max) * relative_humidity_from_temps( self.dbt_max, wbt, p_atm_kpa=self.p_atm_kpa), p_atm_kpa=self.p_atm_kpa)], style, type_curve='constant_wbt_data', label_loc=label_loc, label='{:g} °C'.format(wbt) if wbt in wbt_label_values else None, logger=self._logger) for wbt, w_max in zip(wbt_values, w_max_constant_wbt)], family_label=self.chart_params["constant_wet_temp_label"]) # Saturation line: if True: sat_style = config["saturation"] temps_sat_line, w_sat_line = _gen_list_curves_range_temps( curve_constant_humidity_ratio, self.dbt_min, self.dbt_max, self.temp_step, [100], p_atm_kpa=self.p_atm_kpa) self.saturation = PsychroCurves( [PsychroCurve( temps_sat_line, w_sat_line[0], sat_style, type_curve='saturation', logger=self._logger)]) # Zones if self.chart_params["with_zones"] or zones_file is not None: self.append_zones(zones_file)
import psychrochart.equations as psc_e # Temperatura de bulbo seco; pressao vapor # entalpia = psc_e.enthalpy_moist_air() # print(help(psc_e.specific_volume)) # print(help(psc_e.water_vapor_pressure)) # print(help(psc_e.enthalpy_moist_air)) # psc_e.relative_humidity_from_temps() # print(help(psc_e.wet_bulb_temperature_empiric)) # print(help(psc_e.humidity_ratio_from_temps)) # t_bu_externo = psc_e.wet_bulb_temperature_empiric(33, 0.75) hratio_externo = psc_e.humidity_ratio_from_temps(34, 26) t_bu_refrig = psc_e.wet_bulb_temperature_empiric(-20.5, 0.925) hratio_refrig = psc_e.humidity_ratio_from_temps(-20.5, t_bu_refrig) w_v_pexterno = psc_e.water_vapor_pressure(hratio_externo) w_v_prefrig = psc_e.water_vapor_pressure(hratio_refrig) entalpia_externa = psc_e.enthalpy_moist_air(34, w_v_pexterno) entalpia_refrigeracao = psc_e.enthalpy_moist_air(-20.5, w_v_prefrig) densidade_refri = psc_e.specific_volume(-20.5, w_v_prefrig) densidade_externo = psc_e.specific_volume(34, w_v_pexterno) print("""Relação de humidade: {} Pressão de vapor: {} Entalpia do ar: {} Volume específico: {} Densidade: {} """.format(hratio_externo, w_v_pexterno, entalpia_externa, densidade_externo, 1 / densidade_externo))