logo

 
 
 
 
 
 
 

 

Library of Psychrometric Functions in C and VBA


Psychrometrics are the determination of physical and thermodynamic properties of moist air. These properties include, for example, the air's dew point temperature, its wet bulb temperature, relative humidity, humidity ratio, enthalpy, etc.

The library of freeware functions in C and VBA provided here enables the calculation of psychrometric properties of moist and dry air. The functions are based of formulae from the ASHRAE Handbook of Fundamentals, 2009 edition, and include both SI and IP versions. They can be divided into two categories:

1. Functions enabling the calculation of dew point temperature, wet-bulb temperature, partial vapour pressure of water, humidity ratio or relative humidity, knowing any other of these and dry bulb temperature and atmospheric pressure;

2. Functions enabling the calculation of other moist air properties. All these use the humidity ratio as input.

Relationships between these various functions are illustrated in Figure 1. To compute a moist air property such as enthalpy, knowing a humidity parameter such as dew point temperature, one first has to compute the humidity ratio from the dew point temperature, then compute the enthalpy from the humidity ratio. The functions in point (1) above include primary relationships corresponding to formulae from the ASHRAE Handbook, and secondary relationships which use a combination of primary relationships to calculate the result. For example, to compute dew point temperature knowing the partial pressure of water vapor in moist air, the library uses a formula from the ASHRAE Handbook (primary relationship). On the other hand to compute dew point temperature from relative humidity, the library first computes the partial pressure of water vapor, then computes the dew point temperature (secondary relationship). Primary relationships are shown with bold double arrows on Figure 1.

Figure 1 - Psychrometric relationships.

 

An example of application developed with Numerical Logics' psychrometric library is PsychroCalc, a freeware, stand-alone Windows program to calculate psychrometric variables, and PsychroCalc.xls, an Excel-based psychrometric calculator.

A list of functions available in the library can be found in the Psychrometric Library Documentation page.

Credits

The formulae used in the psychrometric library and in PsychroCalc are those published in the 2009 ASHRAE Handbook of Fundamentals. This publication is available from the American Society of Heating, Refrigerating and Air Conditioning Engineers.

System requirements

The psychrometrics library in C is provided in source code; its use requires a C or C++ compiler. The VBA library is provided as a text file, and can be imported as a module in Excel.

Licensing conditions

Numerical Logics' library of psychrometric functions are freeware; licensing is subject to the GNU General Public License, which enables you (provided you give credit where it is due) to use the functions in your own applications.

Downloads

C/C++

Download the psychrometrics.zip file from the link below and expand the two files (psychrometrics.cpp and psychrometrics.h) to the directory of your choice.

Download the psychrometrics library in SI units
Download the psychrometrics library in IP units

VBA

Import files for use with Excel.

Download the psychrometrics library in SI units
Download the psychrometrics library in IP units


Comments or questions?

Please send us your comments or questions at:
numlog email