Calculating Wet Bulb Temp From RH and DryBulb
Calculating Wet Bulb Temp From RH and DryBulb
Results 1 to 5 of 5
2015-Jan-23, 04:24 AM #1
RH = e/es
RH = relative humidity
e = vapor pressure
es = saturated vapor pressure
to calculate a wet bulb temperature in a MS Excel VBA program using RH and dry bulb
temperature as program inputs. If the above formula is arranged like so:
e = es * (RH / 100)
https://forum.cosmoquest.org/showthread.php?155366-Calculating-Wet-Bulb-Temperature... 12/6/2018
Calculating Wet Bulb Temperature from RH & Dry Bulb Page 2 of 7
Now the vapor pressure can be calculated for an air sample at a given relative humidity and
saturated vapor pressure. Saturated vapor pressure is give by the formula
And vapor pressure as it relates to wet bulb temperature is given by the formula:
The program starts by calculating the saturated pressure for the ambient dry bulb
temperature at a given RH, and stores what the vapor pressure (e) of the wet bulb
temperature should be. Next, the program loop code calculates vapor pressure values for
varying values of wet bulb (Twguess) temperature:
The program loop determines the value of Twguess by incrementally refining an estimate of
Twguess with error checking until |e – eguess| is less than a pre-selected value of accuracy
(currently set at +/- 0.001).
edifference = e – eguess
If Abs(edifference) <= 0.001 Then Exit Loop
……
WetBulb = Twguess
……..
The issue for me is how many loop iterations it takes to determine the final value for
Twguess.
The “tried and true” error correction method that decrements/increments Twguess by 10s,
then by 1s, then by 0.1s, by 0.01s, etc , works very well but to me requires a lot of iteration
- an average of 28 passes for Ctemp inputs of 0C to 50C, RH inputs 0 to 100% and
calculating for a +/- 0.001 wet bulb resolution.
Code:
mbpressure = 33.8639 * 24.896 ‘inHG
es = 6.112 * Exp((17.67 * CTemp) / (CTemp + 243.5))
e = es * (RH / 100)
Twguess = 0
incr = 10
previoussign = 1
Edifference = 1
J = 1
Do While edifference <> 0
Twguess = Twguess + (incr * previoussign)
J = J + 1 ‘loop counter
Eguess = 6.112 * Exp((17.67 * Twguess) / (Twguess + 243.5)
)
Eguess = Eguess - (mbpressure * (CTemp - Twguess) * 0.0006
6 * (1 + (0.00115 * Twguess)))
edifference = e – eguess
If Abs(edifference) <= 0.001 Then
https://forum.cosmoquest.org/showthread.php?155366-Calculating-Wet-Bulb-Temperature... 12/6/2018
Calculating Wet Bulb Temperature from RH & Dry Bulb Page 3 of 7
Exit Do
Else
If edifference < 0 Then
cursign = -1
If cursign <> previoussign Then
previoussign = cursign
incr = incr / 10
End If
Else
cursign = 1
Another error correction method I’ve found through basic trial and error is to find the
change in calculated vapor pressures between the previous (eguessprev) and current
(eguess) loop iterations and divide by the change in Twguess (Ctempdelta) for the current
iteration, then divide edifference (the error of Twguess in the current loop iteration) by that
amount. This gives the program a linear error correction to Ctempdelta for the next loop
iteration:
This method results in a reduction of loop iterations from an average of 28 using the first
method to 5 with no loss of accuracy using the same RH and dry bulb inputs. I think I can
even say the second method turns out to be slightly more accurate overall
.
Code:
mbpressure = 33.8639 * inHG
es = 6.112 * Exp((17.67 * CTemp) / (CTemp + 243.5))
e = es * (RH / 100)
edifference = es - e
eguessprev = es
CTempDelta = 3.3145 'optimized for 0 to 120 degrees f, 0 to 10
0% RH
Twguess = CTemp
J = 1 ‘loop counter
Do Until edifference = 0
J = J + 1
Twguess = Twguess - CTempDelta
eguess = 6.112 * Exp((17.67 * Twguess) / (Twguess + 243.5))
eguess = eguess - (mbpressure * (CTemp - Twguess) * 0.00066
* (1 + (0.00115 * Twguess)))
edifference = eguess - e
If Abs(edifference) <= 0.001 Then
Exit Do
End If
Ctempdelta = edifference / ((eguessprev - eguess) / Ctempde
lta)
What I’m really interested in is which error correction method is the fastest as far as cpu
time is concerned and how to make either method faster and how to tell which one is the
fastest. The obvious way (to my limited math skills) is to be able to calculate a first
approximation of incr (in the first method) or Ctempdelta (in the second) that would
eliminate a lot of initial error correction in approximating wet bulb to within +/- 1.0 degree
C (I have a very inelegant way to do it but then lose the ability to calculate for a change in
atmospheric pressure).
https://forum.cosmoquest.org/showthread.php?155366-Calculating-Wet-Bulb-Temperature... 12/6/2018
Calculating Wet Bulb Temperature from RH & Dry Bulb Page 4 of 7
Doug.
Last edited by DALeffler; 2015-Jan-23 at 04:55 AM. Reason: clarity
2015-Jan-23, 09:42 AM #2
this may not be any help but casting back to school days, a long time ago, I remember
Newtons method which the next guess is found using the derivative of the function which is
the slope of the graph of course. I think you divide the current guess calculation fx by the
derivative f'x and take that away from x for the next guess. I b elieve Newton's method un
derlies many subsequent iterative processes
2015-Jan-24, 07:11 PM #3
2015-Jan-27, 01:31 AM #4
trinitree88:
https://forum.cosmoquest.org/showthread.php?155366-Calculating-Wet-Bulb-Temperature... 12/6/2018
Calculating Wet Bulb Temperature from RH & Dry Bulb Page 5 of 7
I'm trying to create that table (or one very like it) programatically. The program would be
used to calcuate a sinlge wet bulb temperature from dry bulb and RH once a minute every
minute for as long as we can keep it running. It's intended use is in a chiller plant building
automation system and the output of the program would be used in plant change over from
mechanical cooling to evaporative cooling. The problem I have is slow processor speed and
limited memory - I need the code to be tight and short.
The reason I need to use Excel to run this program is to be able to see the table across a
range of temps and RHs because the two methods I know of that calculate wet bulb can
calculate some of the temps right but not all the temps. The one in the BAS at work is as
much as 17 degress F off has no atmospheric pressure input and the JS code on the source
page of this one at http://www.srh.noaa.gov/epz/?n=wxcalc_rh, which is where I got the
original code for method one, has a loop structure problem and can be as much as 18
degrees F off.
My biggest problem is not knowing enough math - I've learned a ton from everybody here
but still got some to go to get this where I want it and can always use calculated tables from
other sources for results comparison - Thanks!
profloater:
Change in New Guess = Amount of new error / ((Amount of old error - Amount of new
error) / Change in Old Guess)
New guess = This guess - (change caused by this guess / change caused by old guess)
I think...
I'll need some new variables but at the very least, that opens up a whole new angle for me
to play with on this problem - thanks!
Doug.
Last edited by DALeffler; 2015-Jan-27 at 02:01 AM.
2015-Jan-27, 12:57 PM #5
https://forum.cosmoquest.org/showthread.php?155366-Calculating-Wet-Bulb-Temperature... 12/6/2018
Calculating Wet Bulb Temperature from RH & Dry Bulb Page 6 of 7
Yes exactly, would you believe we learned this at school using mechanical calculators! Those
rather clever Swiss machines became obsolete within a decade although it was rather longer
before computers became personal. I then used a spread sheet to make similar iterations
and as you say the slope of the iteration graph can be approximated as the difference
between subsequent guesses.
Posting Permissions
You may BB
not post code is
new On
threads
You may
not post
replies
You may
not post
attachments
https://forum.cosmoquest.org/showthread.php?155366-Calculating-Wet-Bulb-Temperature... 12/6/2018
Calculating Wet Bulb Temperature from RH & Dry Bulb Page 7 of 7
You may
not edit
your posts
Smilies are On
[IMG] code is On
[VIDEO] code is
On
HTML code is Off
Forum
Rules
-- CosmoQuest Contact Us Cosmoquest Archive Top
https://forum.cosmoquest.org/showthread.php?155366-Calculating-Wet-Bulb-Temperature... 12/6/2018