Sie sind auf Seite 1von 5

' '''''''''''''''''''''''''''''''''''''' ' Humidity ratio given relative humidity ' ASHRAE Fundamentals (2005) ch. 6 eqn.

38 ' ASHRAE Fundamentals (2009) ch. 1 eqn. 38 ' Function GetHumRatioFromRelHum(ByVal TDryBulb As Variant, ByVal RelHum As Variant, ByVal Pressure As Variant) As Variant ' GetHumRatioFromRelHum: (o) Humidity Ratio [kgH2O/kgAIR] ' TDryBulb: (i) Dry bulb temperature [C] ' RelHum: (i) Relative humidity [0-1] ' Pressure: (i) Atmospheric pressure [Pa] Dim VapPres As Variant If IsError(RelHum) Then GetHumRatioFromRelHum = CVErr(2042) Else If RelHum > 0 And RelHum <= 1 Then VapPres = GetVapPresFromRelHum(TDryBulb, RelHum) GetHumRatioFromRelHum = GetHumRatioFromVapPres(VapPres, Pressure) If GetHumRatioFromRelHum < 0 Then GetHumRatioFromRelHum = CVErr(2042) MyMsgBox ("Humidity ratio is negative") End If Else GetHumRatioFromRelHum = CVErr(2042) MyMsgBox ("Relative humidity is outside range [0,1]") End If End If End Function

1
''''''''''''''''''''''''''''''''''''''' ' Saturation vapor pressure as a function of temperature ' ASHRAE Fundamentals (2005) ch. 6 eqn. 5, 6 ' ASHRAE Fundamentals (2009) ch. 1 eqn. 5, 6 ' Function GetSatVapPres(ByVal TDryBulb As Variant) As Variant ' GetSatVapPres: (o) Vapor Pressure of saturated air [Pa] ' TDryBulb: (i) Dry bulb temperature [C] Dim LnPws As Variant, T As Variant If IsError(TDryBulb) Then GetSatVapPres = CVErr(2042) Else If TDryBulb >= -100 And TDryBulb <= 200 Then T = CTOK(TDryBulb) If (TDryBulb >= -100 And TDryBulb <= 0) Then

LnPws = (-5.6745359 * 10 ^ 3 / T + 6.3925247 - 9.677843 * 10 ^ -3 * T + 6.2215701 * 10 ^ -7 * T * T) LnPws = LnPws + 2.0747825 * 10 ^ -9 * T ^ 3 - 9.484024 * 10 ^ -13 * T ^ 4 + 4.1635019 * Log(T) ElseIf (TDryBulb > 0 And TDryBulb <= 200) Then LnPws = -5800.2206 / T + 1.3914993 - 0.048640239 * T + 0.000041764768 * T * T - 0.000000014452093 * T ^ 3 + 6.5459673 * Log(T) Else GetSatVapPres = CVErr(2042) ' TDryBulb is out of range [-100, 200] MyMsgBox ("Dry bulb temperature is outside range [-100, 200]") End If GetSatVapPres = Exp(LnPws) Else GetSatVapPres = CVErr(2042) MyMsgBox ("Dry bulb temperature is outside range [-100, 200]") End If End If End Function

2
'''''''''''''''''''''''''''''''''''''''/ ' Partial pressure of water vapor as a function of relative humidity and ' temperature in C ' ASHRAE Fundamentals (2005) ch. 6, eqn. 24 ' ASHRAE Fundamentals (2009) ch. 1, eqn. 24 ' Function GetVapPresFromRelHum(ByVal TDryBulb As Variant, ByVal RelHum As Variant) As Variant ' GetVapPresFromRelHum: (o) Partial pressure of water vapor in moist air [Pa] ' TDryBulb: (i) Dry bulb temperature [C] ' RelHum: (i) Relative humidity [0-1] If RelHum > 0 And RelHum <= 1 Then GetVapPresFromRelHum = RelHum * GetSatVapPres(TDryBulb) Else GetVapPresFromRelHum = CVErr(2042) MyMsgBox ("Relative humidity is outside range [0,1]") End If End Function

3
'''''''''''''''''''''''''''''''''''''''/ ' Humidity ratio given water vapor pressure and atmospheric pressure ' ASHRAE Fundamentals (2005) ch. 6 eqn. 22 ' ASHRAE Fundamentals (2005) ch. 6 eqn. 22 ' Function GetHumRatioFromVapPres(ByVal VapPres As Variant, ByVal Pressure As Variant) As Variant ' GetHumRatioFromVapPres: (o) Humidity Ratio [kgH2O/kgAIR] ' VapPres: (i) Partial pressure of water vapor in moist air [Pa] ' Pressure: (i) Atmospheric pressure [Pa] If IsError(VapPres) Or VapPres < 0 Then GetHumRatioFromVapPres = CVErr(2042) MyMsgBox ("Partial pressure of water vapor in moist air is negative") Else GetHumRatioFromVapPres = 0.621945 * VapPres / (Pressure - VapPres) End If End Function

4 optional to calc enthalpy


''''''''''''''''''''''''''''''''''''''' ' Moist air enthalpy given dry bulb temperature and humidity ratio ' ASHRAE Fundamentals (2005) ch. 6 eqn. 32 ' ASHRAE Fundamentals (2009) ch. 1 eqn. 32 ' Function GetMoistAirEnthalpy(ByVal TDryBulb As Variant, ByVal HumRatio As Variant) As Variant ' GetMoistAirEnthalpy: (o) Moist Air Enthalpy [J/kg] ' TDryBulb: (i) Dry bulb temperature [C] ' HumRatio: (i) Humidity ratio [kgH2O/kgAIR] If IsError(HumRatio) Then GetMoistAirEnthalpy = CVErr(2042) ElseIf HumRatio > 0 Then GetMoistAirEnthalpy = (1.006 * TDryBulb + HumRatio * (2501 + 1.86 * TDryBulb)) * KILO Else GetMoistAirEnthalpy = CVErr(2042) MyMsgBox ("Humidity ratio is negative") End If End Function Const KILO = 1000 ' exact ' Conversions from Celsius to Kelvin Function CTOK(ByVal T_C As Variant) As Variant CTOK = (T_C + ZEROC) End Function

5
''''''''''''''''''''''''''''''''''''''' ' Humidity ratio of saturated air given dry bulb temperature and pressure. ' ASHRAE Fundamentals (2005) ch. 6 eqn. 23 ' ASHRAE Fundamentals (2009) ch. 1 eqn. 23 ' Function GetSatHumRatio(ByVal TDryBulb As Variant ' GetSatHumRatio: (o) Humidity ratio ' TDryBulb: (i) Dry bulb temperature ' Pressure: (i) Atmospheric pressure Dim SatVaporPres As Variant As Variant, ByVal Pressure As Variant) of saturated air [kgH2O/kgAIR] [C] [Pa]

SatVaporPres = GetSatVapPres(TDryBulb) If IsError(SatVaporPres) Then GetSatHumRatio = CVErr(2042) Else GetSatHumRatio = 0.621945 * SatVaporPres / (Pressure - SatVaporPres) End If End Function

6
''''''''''''''''''''''''''''''''''''''' ' Humidity ratio given wet bulb temperature and dry bulb temperature ' ASHRAE Fundamentals (2005) ch. 6 eqn. 35 ' ASHRAE Fundamentals (2009) ch. 1 eqn. 35 ' Function GetHumRatioFromTWetBulb(ByVal TDryBulb As Variant, ByVal TWetBulb As Variant, ByVal Pressure As Variant) As Variant ' GetHumRatioFromTWetBulb: (o) Humidity Ratio [kgH2O/kgAIR] ' TDryBulb: (i) Dry bulb temperature [C] ' TWetBulb: (i) Wet bulb temperature [C] ' Pressure: (i) Atmospheric pressure [Pa] Dim Wsstar As Variant If TWetBulb <= TDryBulb Then Wsstar = GetSatHumRatio(TWetBulb, Pressure) GetHumRatioFromTWetBulb = ((2501 - 2.326 * TWetBulb) * Wsstar - 1.006 * (TDryBulb - TWetBulb)) / (2501 + 1.86 * TDryBulb - 4.186 * TWetBulb) Else MyMsgBox ("Wet bulb temperature is above dry bulb temperature") GetHumRatioFromTWetBulb = CVErr(2042) End If End Function '''''''''''''''''''''''''''''''''''''''

7
''''''''''''''''''''''''''''''''''''''' ' Wet bulb temperature given humidity ratio ' ASHRAE Fundamentals (2005) ch. 6 eqn. 35 ' Function GetTWetBulbFromHumRatio(ByVal TDryBulb As Variant, ByVal HumRatio As Variant, ByVal Pressure As Variant) As Variant ' GetTWetBulbFromHumRatio: (o) Wet bulb temperature [C] ' TDryBulb: (i) Dry bulb temperature [C] ' HumRatio: (i) Humidity ratio [kgH2O/kgAIR] ' Pressure: (i) Atmospheric pressure [Pa] ' Declarations Dim Wstar As Variant Dim TDewPoint As Variant, TWetBulb As Variant, TWetBulbSup As Variant, TWetBulbInf As Variant If IsError(HumRatio) Then GetTWetBulbFromHumRatio = CVErr(2042) Else If HumRatio > 0 Then TDewPoint = GetTDewPointFromHumRatio(TDryBulb, HumRatio, Pressure) ' Initial guesses TWetBulbSup = TDryBulb TWetBulbInf = TDewPoint TWetBulb = (TWetBulbInf + TWetBulbSup) / 2 ' Bisection loop While (TWetBulbSup - TWetBulbInf > 0.001) ' Compute humidity ratio at temperature Tstar Wstar = GetHumRatioFromTWetBulb(TDryBulb, TWetBulb, Pressure) ' Get new bounds If (Wstar > HumRatio) Then TWetBulbSup = TWetBulb Else TWetBulbInf = TWetBulb End If ' New guess of wet bulb temperature TWetBulb = (TWetBulbSup + TWetBulbInf) / 2 Wend GetTWetBulbFromHumRatio = TWetBulb Else GetTWetBulbFromHumRatio = CVErr(2042) MyMsgBox ("Humidity ratio is negative") End If End If End Function