Hello All,
I am writing a code to get wet bulb temperature from dry bulb and relative humidity, but when I run my UDF, I am getting a #VALUE! error. I can't figure what parameters I should be setting to the correct data type as the are all numerical values. Any help is much appreciated.
'-------------------------------------------------------------------------------
'Calculate wet bulb temp given dry bulb temp and relative humidity
'
Function psychro_WBT(DBT, RH)
'
DBT = Dry_Bulb_°F
DBR = DBT + 459.67
c8 = -10440.397
c9 = -11.29465
c10 = -0.027022355
C11 = 0.00001289036
C12 = -2.4780681E-09
C13 = 6.5459673
Pws = Exp(c8 / DBR + c9 + c10 * DBR + C11 * DBR ^ 2 + C12 * DBR ^ 3 + C13 * Log(DBR))
Ws = 0.621945 * Pws / (14.7 - Pws)
Wact = RH * Pws
Do
WBT = DBR
Wnew = ((1093 - 0.556 * WBT) * Ws - 0.24 * (DBR - WBT)) / (1093 + 0.444 * DBR - WBT)
End
WBT = WBT - 0.1
Diff = (Wact - Wnew) / ((Wnew + Wact) / 2)
Loop Until Diff < 0.01
psychro_WBT = WBT
End Function
Bookmarks