[Bldg-sim] wetbulb formula

James V Dirkes II, PE jvd2pe at tds.net
Thu Dec 9 19:00:22 PST 2010


Dear Alec,

 

Here is a suite of VBA functions that are tested (except where indicated
otherwise) and have served me well.  Most have been tested against the
ASHRAE Psychrometric Chart program and the results compare well.  You’ll
have to be the final judge, depending on your accuracy and other needs.

 

p.s., They’re all IP units-based.

 

'  Version 1.1 09/07/09

'  These functions are written in Visual Basic for Excel.

'  The routines are approximations based on empirical data as published

'  in the ASHRAE document called "Computerized Algorithms for Psychrometric
Approximations".

 

'  Input for all functions require the following units:

'

'  ElevInFt = Elevation above sea level, feet

'  pvs = vapor pressure at saturation, inches Hg

'  pv = vapor pressure, inches Hg

'  db = Dry Bulb Temperature, °F

'  wb = Wet Bulb Temperature, °F

'  rh = Relative humidity (0<rh<100)

'  RH = Relative Humidity, decimal

'  h = Enthalpy, btu/lb

'  W = # H2O / # air

'  Patm (Atmospheric Pressure) = psia

 

Function Cp_1(DB)

'     Calculate specific heat of air (temp-corrected)

 

Cp_1 = -2.0921943E-14 * DB ^ 4 + 2.5588383E-11 * DB ^ 3 + 0.000000012900877
* DB ^ 2 + 0.0000058045267 * DB + 0.23955919

 

End Function

 

Function Cp_2(DB, W)

'     Calculate specific heat of air (temp and moisture-corrected)

 

Cp_h = Cp_1(DB)

Cp_2 = Cp_h * DB + W * (1061 + 0.444 * DB)

 

End Function

 

Function Patm(ElevInFt)

'     Calculate Atmospheric pressure (psia) given elevation in ft.

 

Patm = 14.696 * (1 - 0.0000068753 * ElevInFt) ^ 5.2559

 

End Function

 

Function Patm_hg(ElevInFt)

'     Calculate Atmospheric pressure (in.Hg) given elevation in ft.

 

Patm_hg = Patm(ElevInFt) * 2.03602

 

End Function

 

Function DBfromW_RH(W, RH, ElevInFt)

'     Calculate DB given W, RH, Elevation ASL

'     validated 1/8/08 by JVDII

 

'     Calculate Dewpoint (in F) for given W (this is the lowest possible
value for DB)

DB = DewPt2(ElevInFt, W)

P = Patm(ElevInFt)

 

    Do

ps = Pws(DB)

RHtest = W * (P - W * P / (0.62198 + W)) / (0.62198 * ps)

DB = DB + 1

    Loop Until RHtest < RH

 

DB = DB - 1.1

    

    Do

ps = Pws(DB)

RHtest = W * (P - W * P / (0.62198 + W)) / (0.62198 * ps)

DB = DB + 0.1

    Loop Until RHtest < RH

 

DB = DB - 0.1

DBfromW_RH = DB

 

End Function

 

Function Twb_h(DB, H, ElevInFt)

'     Calculate DB given W, H, Elevation ASL

'     Not validated yet.

 

    WBtest = DB

    Do

      htest = 0.24 * WBtest + (1061 + 0.444 * WBtest) * HumRat3(WBtest,
WBtest, ElevInFt)

      WBtest = WBtest - 1

    Loop Until htest < H

    WBtest = WBtest + 2

    Do

      htest = 0.24 * WBtest + (1061 + 0.444 * WBtest) * HumRat3(WBtest,
WBtest, ElevInFt)

      WBtest = WBtest - 0.1

    Loop Until htest < H

    WBtest = WBtest + 0.1

    Twb_h = WBtest

End Function

 

Function Twb(DB, W, ElevInFt)

'     Calculate WB given DB, W, Elevation ASL

'     validated 1/8/08 by JVDII

 

' Start checking at 70F below DB

 

 

WBtest = DB - 70

Wtest = 0

P_atm = Patm(ElevInFt)

 

'     This macro uses the "For" structure in combination with the "Do"
structure to prevent

'     infinite looping when one of the cells used in calculation is
undefined.

 

    For I = 1 To 70

P_ws = Pws(WBtest)

wsat = (P_ws * 0.62198) / (P_atm - P_ws)

wnum = (1093 - 0.556 * WBtest) * wsat - 0.24 * (DB - WBtest)

wdenom = 1093 + 0.444 * DB - WBtest

Wtest = wnum / wdenom

    If Wtest > W Then GoTo 100

WBtest = WBtest + 1

    Next I

 

100  WBtest = WBtest - 1.1

    

    Do

P_ws = Pws(WBtest)

wsat = (P_ws * 0.62198) / (P_atm - P_ws)

wnum = (1093 - 0.556 * WBtest) * wsat - 0.24 * (DB - WBtest)

wdenom = 1093 + 0.444 * DB - WBtest

Wtest = wnum / wdenom

WBtest = WBtest + 0.1

    Loop Until Wtest > W

Twb = WBtest - 0.1

If Twb > DB Then Twb = DB

 

End Function

 

 

Function HumRat(DB6, WB, ElevInFt)

'     Calculate Humidity Ratio (W) given DB, WB, Elevation ASL

'     validated 1/8/08 by JVDII

 

wsat = (Pws(WB) * 0.62198) / (Patm(ElevInFt) - Pws(WB))

 

If WB > 32 Then

HumRat = ((1093 - 0.556 * WB) * wsat - Cp_1(DB6) * (DB6 - WB)) / (1093 +
0.444 * DB6 - WB)

Else

HumRat = ((1061 + 0.444 * WB - (-143.34 + 0.5 * (WB - 32))) * wsat -
Cp_1(DB6) * (DB6 - WB)) / (1061 + 0.444 * WB - (-143.34 + 0.5 * (WB - 32)))

End If

 

End Function

 

Function HumRat2(DB, RH, ElevInFt)

'     Calculate Humidity Ratio (W) given dry bulb temp, relative humidity,
and elevation

'     validated 1/8/08 by JVDII

 

atm = Patm_hg(ElevInFt)

  wsat = Pvs(DB)

  wtemp = 0.62198 * wsat / (atm - wsat)

  HumRat2 = RH * wtemp

 

End Function

 

Function HumRat3(DB, WB, ElevInFt)

'     Calculate Humidity Ratio (W) given dry bulb temp, wet bulb temp, and
elevation

'     This form is used by the v() function

 

atm = Patm_hg(ElevInFt)

  vp = Pv1(DB, WB, atm)

  HumRat3 = 0.62198 * vp / (atm - vp)

 

End Function

 

Function Pws(Temp)

'      Calculate Pws (psia) given temp in F

'      Validated by JVDII

 

Rt = Temp + 459.67

If Rt > 491.67 Then

Pws = Exp(-10440.4 / Rt - 11.29465 - 0.027022355 * Rt + 0.00001289036 * Rt ^
2 - 0.000000002478068 * Rt ^ 3 + 6.5459673 * Log(Rt))

Else

Pws = Exp(-10214.165 / Rt - 4.8932428 - 0.0053765794 * Rt + 0.00000019202377
* Rt ^ 2 - 3.5575832E-10 * Rt ^ 3 + 9.0344688E-14 * Rt ^ 4 + 4.1635019 *
Log(Rt))

End If

 

End Function

 

 

Function log10(number)

'     Calculate the Logarithm of a number to the base 10 (used in Pvs
function)

 

  log10 = Log(number) / Log(10#)

 

End Function

 

Function Pvs(DB)

'     Calculate vapor pressure (in. Hg) at saturation given dry bulb temp

'     (Same as Pws, except uses in. HG for units and is applicable below
32F)

 

ta = (DB + 459.688) / 1.8

 

If ta > 273.16 Then

   Z = 373.16 / ta

   p1 = (Z - 1) * (-7.90298)

   p2 = log10(Z) * 5.02808

   p3 = ((10 ^ ((1 - (1 / Z)) * 11.344)) - 1) * (-0.00000013816)

   p4 = ((10 ^ ((-3.49149) * (Z - 1))) - 1) * 0.0081328

  Else

   Z = 273.16 / ta

   p1 = (-9.09718) * (Z - 1)

   p2 = (-3.56654) * log10(Z)

   p3 = 0.876793 * (1 - (1 / Z))

   p4 = log10(0.0060273)

End If

 

Pvs = 29.921 * (10 ^ (p1 + p2 + p3 + p4))

 

End Function

 

Function Pv1(DB, WB, ElevInFt)

'     Calculate Vapor Pressure given dry bulb temp, wet bulb temp, and
elevation

 

atm = Patm_hg(ElevInFt)

pvp = Pvs(WB)

Ws = (pvp / (atm - pvp)) * 0.62198

If WB <= 32# Then

   Pv1 = pvp - 0.0005704 * atm * (DB - WB) / 1.8

 

Else

   hl = 1093.049 + (0.441 * (DB - WB))

   ch = 0.24 + (0.441 * Ws)

   wh = Ws - (ch * (DB - WB) / hl)

   Pv1 = atm * (wh / (0.62198 + wh))

 

End If

End Function

 

Function DewPt1(Pv)

'     Calculate dew point temp. given Vapor Pressure

 

  y = Log(Pv)

  If Pv < 0.18036 Then

    DewPt1 = 71.98 + (24.873 * y) + (0.8927 * y ^ 2)

   Else

    DewPt1 = 79.047 + (30.579 * y) + (1.8893 * y ^ 2)

  End If

 

End Function

 

Function DewPt2(ElevInFt, W)

'     Calculate dewpoint given Patm, Humidity ratio

 

P = Patm(ElevInFt)

 

Pw = (P * W) / (0.62198 + W)

alpha = Log(Pw)

 

DewPt2 = 100.45 + 33.193 * alpha + 2.319 * alpha ^ 2 + 0.17074 * alpha ^ 3 +
1.2063 * (Pw) ^ 0.1984

 

End Function

 

Function Enth(DB, WB, ElevInFt)

'     Calculate Enthalpy given dry bulb temp, wet bulb temp, and elevation

 

Enth = (DB * 0.24) + ((1061 + (0.444 * DB)) * (W(DB, WB, ElevInFt)))

 

End Function

 

Function Enth2(DB, W)

 

'     Calculate Enthalpy given dry bulb temp, humidity ratio

Enth2 = Cp_1(DB) * DB + W * (1061 + 0.444 * DB)

 

End Function

 

Function RH(DB, WB, ElevInFt)

'     Doesn't work.........use RH2() until I figure it out

 

Rt = WB + 459.67

pt = Patm(ElevInFt)

wsat = (Pws(DB) * 0.62198) / (pt - Pws(DB))

wnum = (1093 - 0.556 * WB) * wsat - 0.24 * (DB - WB)

wdenom = 1093 + 0.444 * DB - WB

W_1 = wnum / wdenom

 

Pw = (W_1 * pt) / (0.62198 + W_1)

Rt = DB + 459.67

 

ps = Pws(Rt)

pa = pt - Pw

 

RH = (W_1 * pa) / (0.62198 * ps)

 

End Function

 

Function RH2(DB, WB, ElevInFt)

'     Calculate relative humidity given dry bulb temp, wet bulb temp, and
elevation

 

atm = Patm_hg(ElevInFt)

  RH2 = Pv1(DB, WB, ElevInFt) / Pvs(DB)

  

End Function

 

Function v(DB, WB, ElevInFt)

'     Calculate Specific Volume given dry bulb temp, wet bulb temp, and
elevation

 

atm = Patm_hg(ElevInFt)

  v = (0.754 * (DB + 459.7) * (1 + (7000 * HumRat3(DB, WB, ElevInFt) /
4360))) / atm

 

End Function

 

 

 

The Building Performance Team
James V. Dirkes II, P.E., LEED AP
1631 Acacia Drive NW
Grand Rapids, MI 49504
616 450 8653

 

From: bldg-sim-bounces at lists.onebuilding.org
[mailto:bldg-sim-bounces at lists.onebuilding.org] On Behalf Of R B
Sent: Thursday, December 09, 2010 6:11 PM
To: Alec Stevens
Cc: bldg-sim at lists.onebuilding.org
Subject: Re: [Bldg-sim] wetbulb formula

 

You should be able to find these routines in the HVAC Toolkit book - sold by
ashrae. I don't have it handy so not sure if you can use the routine
directly in excel - you might need visual basic. I have done this previously
in matlab, C++
-Rohini

On Thu, Dec 9, 2010 at 4:43 PM, Alec Stevens <astevens at dmiinc.com> wrote:

Hi,

Does anyone have an Excel-friendly equation they would be willing to share
that can convert Tdb and RH into Twb?  We have metered data giving us Tdb,
RH, and Tdp, but we need to know wetbulb.  We usually solve this problem
with an Excel psychrometric add-in, but we need to distribute this
spreadsheet to a client and cannot distribute the add-in at the same time.

 

We’ve tried a couple of multivariable regressions on the data, but because
it is nonlinear, it is not proving to be that straightforward.  Next stop
might be a two-way lookup table, but that is kind of cumbersome and was
hoping to avoid it.

 

Any help much appreciated.

 

Sincerely,
Alec Stevens

 

DMI
35 Walnut Street, Wellesley, MA 02481
p: 781 431 1100 x11   f:781 431 1109
e: astevens at dmiinc.com

 


_______________________________________________
Bldg-sim mailing list
http://lists.onebuilding.org/listinfo.cgi/bldg-sim-onebuilding.org
To unsubscribe from this mailing list send  a blank message to
BLDG-SIM-UNSUBSCRIBE at ONEBUILDING.ORG




-- 
----------------------------------------------------------------------------
----
Rohini Brahme, Ph.D. LEED AP
Building energy analysis, tool development, and training
Dallas/Fort Worth, TX

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/bldg-sim-onebuilding.org/attachments/20101209/576a7ec2/attachment-0002.htm>


More information about the Bldg-sim mailing list