lib.psycrometry module

Psychrometry is the field of science concerned with the thermodynamic properties of any gas-vapor mixture, nevertheless it’s mainly used for moist air, the mixture of dry air and water vapor. This module try to implement the procedures to calculate the properties for humid air because of its great practical importance in the simulation of air-conditioning systems, solid dryers or scrubbers.

The module include several functions with the definition of stantdard atmosphere:

  • _Pbar(): Calculate barometric pressure for a specified altitude

  • _height(): Calculate the altitude for a specified pressure

  • _Tbar(): Calculate standard temperature for a specified altitude

Saturation state properties:
  • _Psat(): Calculate saturation pressure for a specified Tdb

  • _Tsat(): Calculate saturation temperature for a specified pressure

  • _Ws(): Saturation humidity calculation procedure

Calculation procedures using a perfect gas definition for humid air:
  • _h(): Specific enthalpy calculation procedure

  • _v(): Specific volume calculation procedure

  • _W_twb(): Humidity ratio calculation procedure

  • _tdp(): Dew point temperature calculation procedure

  • _twb(): Wet bulb temperature calculation procedure

Calculation procedure used in the plot procedure:
  • _Tdb(): Dry bulb temperature calculation procedure

  • _Tdb_V(): Tdb calculation procedure from specified volume

  • _W_V(): Humidity ratio calculation procedure from specified volume

Finally for grouping all functionality and integrate in main program with a OOP scheme it’s define the class:

  • PsyState: Psychrometric state general class with common

functionality * PsyIdeal: Psychrometric state model using idial gas equation * PsyVirial: Unimplemented * PsyCoolprop: Psychrometric state model using CoolProp library * PsyRefprop: Unimplemented * PsychroState: PsyState subclass used as define in preferences

lib.psycrometry.translate(context: str, sourceText: str, disambiguation: str = None, n: int = -1) str
lib.psycrometry._Pbar(Z)[source]

Standard atmosphere pressure as a function of altitude as explain in [1] pag 1.1 Eq 3

Parameters:
Zfloat

Altitude, [m]

Returns:
Pfloat

Standard barometric pressure, [Pa]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

Examples

Selected point from Table 1 in [1]

>>> "%0.3f" % _Pbar(-500).kPa
'107.478'
>>> "%0.3f" % _Pbar(8000).kPa
'35.600'
lib.psycrometry._height(P)[source]

Inverted _Pbar function

Parameters:
Pfloat

Standard barometric pressure, [Pa]

Returns:
Zfloat

Altitude, [m]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

Examples

Selected point from Table 1 in [1]

>>> "%0.0f" % _height(107478)
'-500'
lib.psycrometry._Tbar(Z)[source]

Standard temperature as a function of altitude as explain in [1] pag 1.1 Eq 4

Parameters:
Zfloat

Altitude, [m]

Returns:
Tfloat

Temperature, [K]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

Examples

Selected point from Table 1 in [1]

>>> "%0.1f" % _Tbar(-500).C
'18.2'
>>> "%0.1f" % _Tbar(8000).C
'-37.0'
lib.psycrometry._Psat(T)[source]

Water vapor saturation pressure calculation as explain in [1] pag 1.2, Eq 5-6

Parameters:
Tfloat

Temperature, [K]

Returns:
Pfloat

Saturation pressure, [Pa]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

lib.psycrometry._Tsat(Pv)[source]

Water vapor saturation temperature calculation as explain in [1], inverted from pag 1.2, Eq 5-6 to calculate Tdb

Parameters:
Pfloat

Saturation pressure, [Pa]

Returns:
Tfloat

Temperature, [K]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

lib.psycrometry._Ws(P, Tdb)[source]

Calculate the saturated humidity ratio of a humid air as a perfet gas, Ws, as explain in [1], pag 1.8, Eq 22

Parameters:
Pfloat

Pressure, [Pa]

Tdb: float

Dry bulb temperature, [K]

Returns:
Wsfloat

Saturated Humidity ratio, [kgw/kgda]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

lib.psycrometry._h(Tdb, W)[source]

Calculate the enthalpy of a humid air as a perfect gas, h, as explain in [1], pag 1.8, Eq 22

Parameters:
Tdb: float

Dry bulb temperature, [K]

Wfloat

Humidity ratio, [kgw/kgda]

Returns:
hfloat

Enthalpy of humid air, [kJ/kgda]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

lib.psycrometry._v(P, Tdb, W)[source]

Calculate the specific volume of a humid air as a perfect gas, v, as explain in [1], pag 1.8, Eq 28

Parameters:
Pfloat

Pressure, [Pa]

Tdb: float

Dry bulb temperature, [K]

Wfloat

Humidity ratio, [kgw/kgda]

Returns:
vfloat

Specific volume, [m³/kgda]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

lib.psycrometry._W_twb(tdb, twb, P)[source]

Calculate the humidity ratio of a humid air as a perfet gas, W, as explain in [1], pag 1.9, Eq 35-37

Parameters:
Tdb: float

Dry bulb temperature, [K]

Twb: float

Wet bulb temperature, [K]

Pfloat

Pressure, [Pa]

Returns:
Wfloat

Humidity ratio, [kgw/kgda]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

lib.psycrometry._tdp(Pw)[source]

Calculate the dew-point temperature of a humid air as a perfet gas, as explain in [1], pag 1.9, Eq 39-40

Parameters:
Pfloat

Water vapor partial pressure, [Pa]

Returns:
Tdp: float

Dew-point temperature, [K]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

lib.psycrometry._twb(tdb, W, P)[source]

Calculate the wet-bulb temperature of a humid air as a perfet gas, as explain in [1], pag 1.9, inveted Eq 35-37

Parameters:
Tdb: float

Dry bulb temperature, [K]

Wfloat

Humidity ratio, [kgw/kgda]

Pfloat

Pressure, [Pa]

Returns:
Twb: float

Wet bulb temperature, [K]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

lib.psycrometry._Tdb(twb, w, P)[source]

Calculate the dry-bulb temperature of a humid air as a perfet gas, as explain in [1], pag 1.9, inveted Eq 35-37

Parameters:
Twb: float

Wet bulb temperature, [K]

Wfloat

Humidity ratio, [kgw/kgda]

Pfloat

Pressure, [Pa]

Returns:
Tdb: float

Dry bulb temperature, [K]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

lib.psycrometry._Tdb_V(v, P)[source]

Calculate the specific volume of a humid air as a perfect gas, v, as explain in [1], pag 1.8, inverted Eq 28, used to calculate Tdb in a isochor line in plots

Parameters:
vfloat

Specific volume, [m³/kgda]

Pfloat

Pressure, [Pa]

Returns:
Tdb: float

Dry bulb temperature, [K]

References

[1] ; 2013 ASHRAE Handook. Fundamentals (SI Edition).

lib.psycrometry._W_V(Tdb, P, v)[source]

Calculate the humidity ratio of a humid air as a perfect gas, as explain in [1], pag 1.8, inverted Eq 28, used to calculate W in a isochor line in plots

Parameters:
Tdb: float

Dry bulb temperature, [K]

Pfloat

Pressure, [Pa]

vfloat

Specific volume, [m³/kgda]

Returns:
Function to calculate isochor line
input:

dry bulb temperature, K barometric pressure, Pa specified volume, m3/kg air

return

humidity ratio, kg H2O/kg air

class lib.psycrometry.PsyState(**kwargs)[source]

Bases: object

Class to model a psychrometric state with properties kwargs definition parameters:

P: Pressure, Pa z: altitude, m

tdp: dew-point temperature tdb: dry-bulb temperature twb: web-bulb temperature w: Humidity Ratio [kg water/kg dry air] HR: Relative humidity h: Mixture enthalpy v: Mixture specified volume

P: mandatory input for barometric pressure, z as an alternative P input it needs other two input parameters:

0 - tdb, w 1 - tdb, HR 2 - tdb, twb 3 - tdb, tdp 4 - tdp, HR 5 - tdp, twb 6 - twb, w

Attributes:
calculable

Methods

LineList(name, Preferences)

Return a list with the values of isoline name to plot

__call__(**kwargs)

Call self as a function.

calculatePlot()

Funtion to calculate point in chart, each child class must define it, as default use ideal gas equation of state

calculo

status = 0
msg = 'Unknown variables'
TEXT_MODE = ['T dry bulb, Humidity Ratio', 'T dry bulb, Relative humidity', 'T dry bulb, T wet bulb', 'T dry bulb, T dew point', 'T dew point, Relative humidity', 'T wet bulb, Relative humidity']
VAR_NAME = [('tdb', 'w'), ('tdb', 'HR'), ('tdb', 'twb'), ('tdb', 'tdp'), ('tdp', 'HR'), ('twb', 'HR')]
__init__(**kwargs)[source]
kwargs = {'HR': None, 'P': 0.0, 'h': None, 'tdb': 0.0, 'tdp': 0.0, 'twb': 0.0, 'v': 0.0, 'w': None, 'z': 0.0}
property calculable
_P()[source]

Barometric pressure calculation, Pa

_lib()[source]

Properties calculate library, customize in each subclass

calculo()[source]
classmethod calculatePlot()[source]

Funtion to calculate point in chart, each child class must define it, as default use ideal gas equation of state

static LineList(name, Preferences)[source]

Return a list with the values of isoline name to plot

class lib.psycrometry.PsyIdeal(**kwargs)[source]

Bases: PsyState

Psychrometric state using ideal gas equation

Methods

calculatePlot(parent)

Funtion to calculate point in chart

_lib()[source]

Properties calculate library

classmethod calculatePlot(parent)[source]

Funtion to calculate point in chart

class lib.psycrometry.PsyVirial(**kwargs)[source]

Bases: PsyState

Psychrometric state using virial equation of state

_lib()[source]

Properties calculate library

_virial(T)[source]

Calculate the humid-air virial coefficient.

Parameters:
Tfloat

Temperature [K]

Returns:
propdict

Dictionary with critical coefficient:

  • Baa: Second virial coefficient of dry air, [cm³/mol]

  • Baw: Second air-water cross virial coefficient, [cm³/mol]

  • Bww: Second virial coefficient of water, [cm³/mol]

  • Caaa: Third virial coefficient of dry air, [cm⁶/mol]

  • Caaw: Third air-water cross virial coefficient, [cm⁶/mol]

  • Caww: Third air-water cross virial coefficient, [cm⁶/mol]

  • Cwww: Third virial coefficient of dry air, [cm⁶/mol]

_virialMixture(T, phi_w)[source]

Calculate the mixture humid air virial coefficient

Parameters:
Tfloat

Temperature, [K]

phi_wfloat

Molar fraction of water, [-]

Returns:
_Pwsat(T)[source]

Calculate the partial pressure of water in saturated moint air

_f(T, P)[source]
_v(P, T, phi_w)[source]

Calculate the real volume of a humid air using the virial equation of state

Parameters:
Tfloat

Temperature, [K]

phi_wfloat

Molar fraction of water, [-]

Returns:
_h(v, T, phi_w)[source]
_tdp(P, phi_w, tdb)[source]

Calculation of dew-point temperature

_twb(P, phi_w, tdb)[source]
class lib.psycrometry.PsyCoolprop(**kwargs)[source]

Bases: PsyState

Psychrometric state using coolprop external library

Attributes:
calculable

Methods

calculatePlot(parent)

Funtion to calculate point in chart

args

property calculable
args()[source]
property _P_kPa

Property for ease access to pressure in kPa

_lib()[source]

Properties calculate library, customize in each subclass

classmethod calculatePlot(parent)[source]

Funtion to calculate point in chart

class lib.psycrometry.PsyRefprop(**kwargs)[source]

Bases: PsyState

Psychrometric state using refprop external library

lib.psycrometry.PsychroState

alias of PsyIdeal

References