Agricultura

Air psychrometric properties are important in several areas of agricultural engineering, such as calculation of evaluation of the animal environment and air control in grain storage units. Due to their relevance and the complexity and the uncertainties in the use of psychrometric charts, the objective of this paper was to develop the software, PsyCalculator , which stands out for the automated function that allows presenting the data acquired through sensors and the respective psychrometric properties of the air, either in graph or tables. The automatic data acquisition system consists of a microcontroller that performs readings of sensors that measure the dry bulb temperature and another variable, which may be: wet bulb temperature, relative air humidity or dew point temperature. Then, the values are sent to the PsyCalculator software system. In addition to the values of dry bulb temperature, the software system presents wet bulb temperature and dew point temperature, values of saturation vapor pressure, vapor pressure, mixing ratio, specific volume, enthalpy and degree of saturation. Among the psychometric variables analyzed, the software developed in the study presented a maximum error of 2.14% for the calculation of dew point temperature. The developed software allows the automation of systems that depend on the psychrometric parameters in a friendly and precise fashion


INTRODUCTION
Psychrometry is the study of the thermodynamic properties of the vapor-gas mixtures. It is an indispensable science for the calculation of energy in the drying and cooling of agricultural products, humidity and temperature control in storage units, evaluation of animal environments, meteorological calculations, cooling towers, human comfort and evapotranspiration calculations among others. It is also necessary in processes that use air conditioning, since the air is not dry; it is a mixture of dry air and water vapor (BELTRÁN-PRIETO et al., 2016;GUPTA & PATEL, 2017;JESUS & SILVA, 2002;ROGDAKIS, 2014;SENAY, 2018) The following properties of humid air may be related to the amount of water vapor: vapor pressure, mixing ratio, absolute humidity, relative air humidity, specific humidity and degree of saturation. Those directly related to temperature are the dry bulb temperature, wet bulb temperature and dew point temperature. In addition, the air properties may also be related to thermal energy and specific volume (LOPES et al., 2000) . In general, the dry bulb temperature (T db ) is known, and together with another parameter, such as relative air humidity (H r ), dew point temperature (T d ), or wet bulb temperature (T wb ), it allows obtaining all the other psychrometric values. Over the years, many formulas to obtain psychrometric air properties, with different levels of complexity and precision, have been proposed (BELL et al., 2017). As an alternative to the traditional methods, such as the table, the psychrometric chart and semi-empirical mathematical models (AGRAWAL & RAO, 1974), researchers have been developing computer programs and even web pages (ASHRAH , 2018), where it is possible to calculate the psychrometric properties of air. They were developed to help determining the air properties, since the psychrometric graph, which is the most complete description of parameters in the analysis of humid air (SCHIAVON et al., 2014), brings a great deal of information. Thus, it may be confusing and lead to reading errors. Therefore, the automated methods allow calculating the psychrometric values with greater precision. Several programs, with and without graphical interfaces, have been developed to calculate the psychrometric properties of air, including Grapsi andPsicro 2009 (COMPAGNON et al., 2009;MELO et al., 2004;PELLANDA, 2016). However, these available programs are not integrated into an automatic data acquisition system for real-time calculation of the desired psychrometric parameters. Thus, in the existing programs, users must input the data and save the results later. The software system developed in this study, PsyCalculator, allows users to calculate and present all the psychrometric properties of the environment, both in graphs and tables, using the data of the measured parameters by the sensors and in real time. Basic functionalities were also implemented, such as saving measured parameters and calculating individually or in the form of database. This research aims to present the PsyCalculator software system, valid for temperatures between -40°C and 110°C, as well as the equations used and the error rate when compared to the ASHRAE (American Society of Heating, Refrigerating and Air-Conditioning Engineers), the most commonly used psychrometric calculation system (ROGDAKIS, 2014),presented in Wilhelm (1976). The software was registered in July, 2018 at the National Institute of Industrial Property (INPI) from Brazil with process number: BR 51 2018 001063-6.

MATERIALS AND METHODS
The program was developed in Visual Studio C# 2017, using equations to determine the psychrometric parameters described in section 2.1. The implemented software has two main modes of functionality. The first is the manual, in which the user types the values of two input parameters. In the automatic option, the user configures the serial port to receive the input data. In addition, the user must inform the collection period of the input data. Subsequently, to test the PsyCalculator software, a data acquisition system was developed, with the Arduino platform and the one-wire sensor, DHT22, for dry bulb temperature and relative air humidity sensing manufactured by of the Aosong Electronics.

Psychrometric properties of air
The determination of the psychrometric properties of air was performed in the PysCalculator software system, using the equations described below.

Saturation vapor pressure and partial vapor pressure
The saturation vapor pressure (P sv ) is a key element for psychrometric calculations. Therefore, it must be accurate (SINGH et al., 2002;WILHELM, 1976). The software program uses two equations to determine the saturation vapor pressure for dry bulb temperature values between -40°C and 0°C (eq. 1) and another equation for values between 0°C and 110°C (eq. 2). These two equations were recommended by Wilhelm (1976). (1) The partial vapor pressure equation (eq. 3) is used when the value of the relative air humidity of the air is known. On the contrary, equation 4 is used. Both equations were discussed by Wilhelm (1976).

Relative air humidity
The relative air humidity was calculated using equation 5. (5) where, P v = partial vapor pressure (kPa); P sv = saturation vapor pressure (kPa), and H r = relative air humidity (%).

Mixing Ratio
The mixing ratio (W), which is the ratio between the amount of water vapor present in the air and the amount of dry air in a volume of mixture, was calculated by equation 6 Wilhelm (1976). When the wet bulb temperature is unknown, equation 7 is used to determine the T wb . The latter is based on the energy balance for adiabatic saturation processes (WILHELM, 1976). (6) where, P = atmospheric pressure (kPa); P v = partial vapor pressure (kPa), and W = mixing ratio (g vapor .kg dry air -1 ).

Degree of saturation
The degree of saturation was calculated by equation 10.

Dew point temperature
The dew point temperature (T d ) was calculated using three equations, each one for a dry bulb temperature range: between -50°C and 0°C, equation 11; between 0°C and 20°C, equation 12, both recommended by Wilhelm (1976). For values greater than 20°C, we used equation 13 proposed by Tetens (HJ ANDREWS EXPERIMENTAL FOREST, 2018) because it achieved results to the values tabulated by ASHRAE when compared to the equation recommended by Wilhelm (1976).

Relationship between altitude and atmospheric pressure
The relationship used to calculate the atmospheric pressure through the altitude is indicated in equation 14 (NOVA et al., 2002). (14) where, P = atmosphere pressure (kPa), and H = height (m).

Routines used by the program
The use of the psychrometric calculations requires the knowledge of at least a pair of parameters, which can be: (i) dry bulb temperature and wet bulb temperature, or; (ii) dry bulb temperature and relative air humidity, or; (iii) dry bulb temperature and dew point temperature. For each pair of the chosen parameters, a computer program routine was implemented, named routine 01, routine 02 and routine 03, respectively. Figure  1 shows the program flowchart for automatic and manual modes: Input parameters: dry bulb temperature and relative humidity, routine 01 Considering as input parameter the dry bulb temperature, T db and humidity, H r , the program performs routine 01: 1. Calculation of the saturation pressure, P sv and mixing ratio at saturation pressure, W s ; 2. Calculation of the properties of vapor pressure, P v , mixing ratio, W, degree of saturation, D s , volume, v, enthalpy, h and dew point, T d ; and 3. Calculation of wet bulb temperature, T wb through iterations using (1) or (2) and (7) equations by trial and error.
Input parameters: dry bulb temperature and wet bulb temperature, routine 02 Considering as input parameter the dry bulb temperature, T db and wet bulb temperature, T wb , the program performs routine 02: 1. Calculation of the saturation pressure, Psv and mixing ratio at saturation pressure, Ws using wet bulb values; 2. Calculation of the saturation pressure, Psv and mixing ratio at saturation pressure, Ws, using dry bulb values; and 3. Calculation of the mixing ratio properties, W, vapor pressure, Pv, relative humidity, Hr, volume, v, enthalpy, h, dew point temperature, Td, degree of saturation, Ds.

Input parameters: dry bulb temperature and dew point temperature, routine 03
Considering as input parameter the dry bulb temperature, T db and dew point temperature, T d , the program performs routine 03: 1. Calculation of saturation pressure, P sv and mixing ratio at saturation pressure, W s ; 2. Calculation of the properties of vapor pressure, P v , mixing ratio, W, degree of saturation, D s , volume, v and enthalpy, h; and 3. Calculation of the wet bulb temperature through iterations using (1) or (2) and (7) equations by trial and error.

Automatic system for psychrometric calculations
The automatic system for data acquisition, developed to perform the psychrometric calculations, is composed of sensors that measure two input parameters required by the PsyCalculator software system, as mentioned in section 2.2, and a microcontroller that performs the communication between the sensors and the developed program. In the automatic system, several types of sensors and even actuators can be used. However, the automatic system developed in this work demands sensors that measure dry bulb temperature and relative air humidity or dry bulb temperature and wet bulb temperature or dry bulb temperature and air dew point temperature, besides a microcontroller that performs the readings of these sensors and the analogical digital conversion, if necessary, and sends the values to PsyCalculator software system, when requested.
The system, developed in this work for testing, used a DHT22 sensor to measure dry bulb temperature and relative air humidity and the Arduino platform, using serial communication for the communication between the PsyCalculator software system and the sensor, as shown in Figure  2.

DHT22 sensor
The DHT22 is a digital sensor based on the use of a thermistor for temperature measurement and a capacitive sensor for relative air humidity measurement. It is a sensor capable of measuring temperatures between -40°C and 80°C and values of relative air humidity between 0% and 99.9%, with accuracy of ± 0.5°C and ± 2% and resolution of 0.1°C and 0.1%, respectively. For using this sensor, the transmission distance of the data must not exceed 20 meters. The distance used at this project was no more than one meter. The minimum response time for this sensor is two seconds, an important parameter that might prevent its selection for certain projects that require faster readings (AOSONG, 2018;MARTÍN-GARÍN et al., 2018).
The sensor uses the one-wire communication protocol, in other words, the communication is conducted using only one communication line. Therefore, the microcontroller communicates with the sensor using only one data pin. This sensor was chosen due to the ease of working with the Arduino and the fact that it measures the dry bulb temperature and the relative humidity of the air simultaneously, thus meeting one of the possibilities of input pairs of parameters for psychrometric calculations.

Arduino Uno
The Arduino Uno is an open source programming platform comprised of an ATmega328 microcontroller with 14 digital outputs/inputs and six analog inputs, which can be powered through USB or external power source. Arduino was selected due to its ease and simplicity of use, besides the compatibility with the temperature and relative air humidity sensor, model DHT22. Another microcontroller, such as PIC (Programmable Interface Controller), may also be used in the psychrometric calculation automatic system. Arduino can be programmed in C/C ++ Integrated Development Environment (IDE).
In this study, the developed program verified whether data were available in the serial port. If they were, the program analyzed whether the data matched the pre-defined code for the requisition of the parameters for psychrometric calculations. If they did, the program carried out dry bulb temperature and relative air humidity readings of the air using the multi sensor device. Next, the microcontroller platform, Arduino, sent this information to the PsyCalculator software system and awaited the next request, as shown in Figure 3.

Serial communication
The serial communication, a simple and commonly used method, was used between the Arduino and the PsyCalculator software system, that is, the serial port sends and receives bytes of data, in a bit at a time pace.
The settings in both the Arduino and the PsyCalculator software system require some parameters to perform this communication, namely, the port, baud rate, parity, stop bits and number of bits. The configuration of the port establishes which port will be connected; baud rate is a measure of speed for communication, i.e., number of bits transmitted per second; parity is a way of verifying serial communication errors; stop bits are used to indicate the end of the communication for a packet; and the number of bits is the number of bits sent per byte, e. g. 8 bits.
After setting this configuration, the user must configure the collection period of input data and the other parameter used as an input besides the dry bulb temperature parameter.

Comparison of results
The values obtained by the PsyCalculator software system, the available Grapsi software system 8.1 (MELO et al., 2004;MELO, 2011) and the program developed by Wilhelm (1976) were compared to the values tabulated by ASHRAE and converted to the International System (SI) as shown in table 1. The errors were computed for the three routines developed to calculate psychometric properties, as well as the dew point temperature, relative air humidity, mixing ratio, specific volume and enthalpy.  Figure 4 shows the initial screen of the PsyCalculator software in manual mode. On the screen, we can see the menus for viewing data in a table; performing data saving; showing program information; and exiting the program. The graph access menu ( Figure 5) is only available when the automatic option is selected, since the data is drawn on the graph, according to the information received by the sensors.

RESULTS AND DISCUSSION
The comparison between the results obtained by the PsyCalculator software system and ASHRAE tabulated values showed a small error for specific volume (0.44%), followed by enthalpy (0.48%), mixing ratio (0.63%), relative humidity (0.74%), and finally, the dew point temperature (2.14%), as shown in Table 2. In addition, the error of each routine for the parameters under study was analyzed. It was observed that routine 03 presented the smallest error, about 0.33%, as expected, since the largest error, among the variables analyzed, was associated to the determination of the dew point variable, Table 3. Routine 02 and routine 01 presented errors of 1.48% and 0.52%, respectively. The greatest error associated with these two routines may be due to the greater error of determining the dew point temperature parameter. The Grasip software system presents higher error values not only for both routine 01 and routine 02, but also for the analyzed parameters, except specific volume, when compared to the PsyCalculator. It is observed that the developed program, PsyCalculator, presents the smallest error for the routine 02, about 63.9% smaller, respectively, when compared to the Grasip program and about 28% lower, respectively, when compared to the program developed by Wilhelm (1976). For routine 03, the developed program presents a higher error as the Grapsi software 8.1 (0.29%), while the program developed by Wilhelm (1976) presents the lowest error of 0.22%. Since the wet bulb values were not tabulated by ASHRAE, this parameter was not analyzed.
The difference among the results of the software is due to the equations used by each of them. There is no consensus to determine only one equation for the calculation of psychrometric properties, since Figure 4. PsyCalculator software main screen in manual mode with some results. the equations were developed over the years with complexity and accuracy (BELL et al., 2017). In addition, the programs used to develop each software system are different and may affect the results.

CONCLUSION
• We discuss the underlying methodology used by the software PsyCalculator. The software was developed by the authors to use measured  data to compute psychrometry values such as vapor pressure, mixing ratio, absolute humidity, relative air humidity, specific humidity and degree of saturation.
• The result of the accuracy tests performed by comparing the developed software with those from two other software systems available in the literature guarantees that the software system developed in this work is qualified to be used in system automation or monitoring in the field of agricultural engineering.
• Besides the accuracy of the developed software, it has a differential of calculating real time psychometric variables automatically; therefore, users do not have to input data into the program manually.
• Finally, the developed software allows the automation and control of processes that required psychrometric variables, in a friendly and precise fashion.