Page 1 of 1

wetbulb?

Posted: Fri 24 Jan 2014 1:23 am
by n9mfk
Hi Steve,
What formula does cumulus use to do wetbulb?
Thank Beau

Re: wetbulb?

Posted: Fri 24 Jan 2014 1:35 am
by beteljuice
Based on the one I gave here I think: https://cumulus.hosiene.co.uk/viewtopic.p ... lb&start=0

Re: wetbulb?

Posted: Fri 24 Jan 2014 8:09 am
by steve
I ended up using a direct formula that appears on the web in various places (e.g. here: http://www.aprweather.com/pages/calc.htm) which doesn't use an iterative approach (and is possibly hence slightly less accurate).

Re: wetbulb?

Posted: Sat 25 Jan 2014 12:19 am
by n9mfk
ok I missed something
htp://99.108.42.167/weather/test3/wxwetbulb.php

Code: Select all

use these numbers
$Tc = -2.0555555555556
$RH = 51
$P = 1012.7337934

i get 3.9960679808406
cumulus 24.5 

Code: Select all

<?php
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (Canada/World-ML template set)
############################################################################
#
#   Project:    Sample Included Website Design
#   Module:     sample.php
#   Purpose:    Sample Page
#   Authors:    Kevin W. Reed <kreed@tnet.com>
#               TNET Services, Inc.
#
# 	Copyright:	(c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
#	This document uses Tab 4 Settings
############################################################################
require_once("Settings.php");
require_once("common.php");
############################################################################
$TITLE = langtransstr($SITE['organ']) . " - " .langtransstr('wetbulb test page');
$showGizmo = true;  // set to false to exclude the gizmo
include("top.php");
############################################################################
?>
</head>
<body>
<?php
############################################################################
include("header.php");
############################################################################
include("menubar.php");
############################################################################
?>

<div id="main-copy">
   
 <?php echo 'temperature: '.$WX['temp'];?><br />
 <?php echo 'humidity: '.$WX['hum']; ?><br />
 <?php echo '$baro: '.$WX['press']; ?>
<br /> 
 <?php echo'wetbulb: '.  $WX['wetbulb']; ?><br />

 
 <?php
 
$Tc =($WX['temp']-32)/1.8;
$P = 33.8639 * $WX['press'];
$RH = $WX['hum'];

 echo'$Tc = '.  $Tc.'<br />';
echo'$RH = '.  $RH.'<br />';
echo'$P = '.  $P.'<br />';
echo'<br />';
//echo $tc;
$Tdc = (($Tc - (14.55 + 0.114 * $Tc) * (1 - (0.01 * $RH)) - ((2.5 + 0.007 * $Tc) * 
(1 - (0.01 * $RH))) ^ 3 - (15.9 + 0.117 * $Tc) * (1 - (0.01 * $RH)) ^ 14));

$E = (6.11 * 10 ^ (7.5 * $Tdc / (237.7 + $Tdc)));

$WBc = (((0.00066 * $P) * $Tc) + ((4098 * $E) / (($Tdc + 237.7) ^ 2) * $Tdc)) / ((0.00066 * $P) + (4098 * $E) / (($Tdc + 237.7) ^ 2));

echo '<br />'; 
echo $WBc;



?>
 
 </div><!-- end main-copy -->

<?php
############################################################################
include("footer.php");
############################################################################
# End of Page
############################################################################
?>


Re: wetbulb?

Posted: Sat 25 Jan 2014 2:10 am
by beteljuice
Edit: code corrected - thanks to mark ;)

$Tc = -2.0555555555556
$RH = 51
$P = 1012.7337934

Tdc= -10.877659778338

E= 2.6691050528504


$WBC = -4.1844761761292 WBf = 24.5

You are NOT using php math !

2 ^ 3 is not php, pow(2, 3) is ..

Code: Select all

$Tdc = (($Tc - (14.55 + 0.114 * $Tc) * (1 - (0.01 * $RH)) - pow((2.5 + 0.007 * $Tc) * (1 - (0.01 * $RH)) , 3) - (15.9 + 0.117 * $Tc) * pow(1 - (0.01 * $RH),  14)));


$E = (6.11 * pow(10 , (7.5 * $Tdc / (237.7 + $Tdc))));

$WBc = (((0.00066 * $P) * $Tc) + ((4098 * $E) / pow(($Tdc + 237.7) , 2) * $Tdc)) / ((0.00066 * $P) + (4098 * $E) / pow(($Tdc + 237.7) , 2));
The figure now agrees (Deg F) with what you say Cumulus gives

You are still using Relative (sea level) instead of Absolute (station) pressure, although this will only make a (very) small difference.

Re: wetbulb?

Posted: Sat 25 Jan 2014 10:02 am
by mcrossley
beteljuice, you still have a '^' lurking in the Tdc calculation

Re: wetbulb?

Posted: Sat 25 Jan 2014 11:03 am
by beteljuice
Well spotted .. thank you Mark.

Post edited with new results and code correction.

Re: wetbulb?

Posted: Sat 25 Jan 2014 2:40 pm
by n9mfk
thank you beteljuice and Mark