<!-- hide from other browsers
/*********************************************************
Copyright June 1997, by G. Reza Zakeri. All Rights Reserved.
You may use, modify or copy this Script for non-commercial use,
as long as the copyright notice above is included in your
script. If you find any bugs ,let me know at:
http://www.termo.unit.no/kkt/grzifk/.
*********************************************************/
var Buffer, PrevBuffer;
var Buffer_dp;
var Buffer_db;
var Buffer_wb;
var Buffer_alt;
var Buffer_rh;
/************************************************
Calculate Atmospheric pressure given elevation
*************************************************/
//100
function psychro_atm(elev) {
var i = 0;
var el = new Array();
var press = new Array();
var psychro_atm;
//100
el[0] = -1000; press[0] = 31.02;
el[1] = -500; press[1] = 30.47;
el[2] = 0; press[2] = 29.921;
el[3] = 500; press[3] = 29.38;
el[4] = 1000; press[4] = 28.86;
el[5] = 2000; press[5] = 27.82;
el[6] = 3000; press[6] = 26.82;
el[7] = 4000; press[7] = 25.82;
el[8] = 5000; press[8] = 24.9;
el[9] = 6000; press[9] = 23.98;
el[10] = 7000; press[10] = 23.09;
el[11] = 8000; press[11] = 22.22;
el[12] = 9000; press[12] = 21.39;
el[13] = 10000; press[13] = 20.48;
el[14] = 15000; press[14] = 16.89;
el[15] = 20000; press[15] = 13.76;
el[16] = 30000; press[16] = 8.9;
el[17] = 40000; press[17] = 5.56;
el[18] = 50000; press[18] = 3.44;
el[19] = 60000; press[19] = 2.14;
while (elev > el[i])
i++
if (elev==el[i])
psychro_atm=press[i];
else
psychro_atm=(press[i]+(press[i+1]-press[i])/(el[i+1]-el[i])*(elev-el[i]));
return psychro_atm;
}
/*********************************************************
Calculate vapor pressure at saturation given temperature.
**********************************************************/
function psychro_pvs(temp) {
var psychro_pvs;
var z;
a1 = -1.021416462e4;
a2 = -4.89350301;
a3 = -5.37657944e-3;
a4 = 1.92023769e-7;
a5 = 3.55758316e-10;
a6 = -9.03446886e-14;
a7 = 4.1635019;
a8 = -1.044039708e4;
a9 = -1.12946496e1;
a10 = -2.7022355e-2;
a11 = 1.289036e-5;
a12 = -2.478068e-9;
a13 = 6.5459673;
var t = (temp + 459.67);
if (temp < 32) {
with (Math) {
psychro_pvs = exp( a1/t+a2+a3*t+a4*pow(t,2)
+a5*pow(t,3)+a6*pow(t,4)+a7*log(t));
}
}
else {
with (Math) {
psychro_pvs = exp( a8/t+a9+a10*t+a11*pow(t,2)
+a12*pow(t,3)+a13*log(t));
}
}
return (psychro_pvs*2.036021);
}
/**************************************************************************
Calculate Vapor Pressure given dry bulb temp, wet bulb temp, and pressure
***************************************************************************/
function psychro_pv1(db, wb, atm) {
var psychro_pv1;
var hl,ch,wh;
var pvp = psychro_pvs(wb);
var ws = (pvp / (parseFloat(atm) - pvp)) * 0.62198;
if (wb <= 32) {
wh=((1219.98+0.44*db-0.49*wb)*ws-0.24*(db-wb))/
(1219.98+0.44*db-0.49*wb);
psychro_pv1 = parseFloat(atm) * (wh / (0.62198 + wh));
}
else {
wh=((1093-0.556*wb)*ws-0.24*(db-wb))/
(1093+0.444*db-wb);
psychro_pv1 = parseFloat(atm) * (wh / (0.62198 + wh));
}
return psychro_pv1;
} //200
/***********************************************
Calculate dew point temp. given Vapor Pressure
************************************************/
function psychro_dp(pvp) {
var psychro_dp;
var y = Math.log(pvp*0.491154);
if (pvp < 0.18036)
psychro_dp = 90.12 + (26.142 * y) + (0.8927 * y * y);
else
psychro_dp = 100.45 + (33.193 * y) + (2.319 * y * y)
+0.17074*Math.pow(y,3)+1.2063*Math.pow((pvp*0.491154),0.1984);
return psychro_dp;
}
/***************************************************************************
Calculate Humidity Ratio given dry bulb temp, wet bulb temp, and pressure
***************************************************************************/
function psychro_w(db, wb, atm) {
var psychro_w;
var vp = psychro_pv1(db, wb, parseFloat(atm));
psychro_w = 0.622 * vp / (parseFloat(atm) - vp);
return psychro_w;
}
/***************************************************************************
Calculate Humidity Ratio given dry bulb temp, wet bulb temp, and pressure
***************************************************************************/
function psychro_w_pvp(pair, pvp) {
var psychro_w_pvp;
psychro_w_pvp = 0.622 * pvp / pair;
return psychro_w_pvp;
}
/*********************************************************************
Calculate Enthalpy given dry bulb temp, wet bulb temp, and pressure
*********************************************************************/
function psychro_h(db, wb, atm) {
var psychro_h;
psychro_h = (db * 0.24) + ((1061 + (0.444 * db)) *
(psychro_w(db, wb, atm)));
return psychro_h;
}
/*********************************************************************
Calculate Enthalpy given dry bulb temp and Humidity Ratio
*********************************************************************/
function psychro_h_w(db, w) {
var psychro_h_w;
psychro_h_w = (db * 0.24) + (1061 + (0.444 * db))
* w;
return psychro_h_w;
}
/******************************************************************************
Calculate relative humidity given dry bulb temp, wet bulb temp, and pressure
******************************************************************************/
function psychro_rh(db, wb, atm) {
var psychro_rh;
if (Buffer_db != Buffer_wb) {
psychro_rh = 100 * psychro_pv1(db, wb, atm) /
psychro_pvs(db);}
else
psychro_rh = 100;
return psychro_rh;
}
/*****************************************************************************
Calculate Specific Volume given dry bulb temp, wet bulb temp, and pressure
*****************************************************************************/
function psychro_v(db, wb, atm) {
var psychro_v;
psychro_v = ((0.754 * (db + 459.7)* (1 + (7000 *
psychro_w(db, wb, atm) / 4360))) / atm);
return psychro_v;
}
/****************************************
*****************************************/
function f_wratio(db,wb,wstar) {
var f_wratio;
var wh;
if (wb <= 32) {
wh=((1219.98+0.44*db-0.49*wb)*wstar-0.24*(db-wb))/
(1219.98+0.44*db-0.49*wb);}
else {
wh=((1093-0.556*wb)*wstar-0.24*(db-wb))/
(1093+0.444*db-wb);}
f_wratio=wh;
return f_wratio;
}
/***********************************************************
Computes wet-bulb temperature iteratively, dry bulb, dew point
enthalpy and atm pressure using Bisection method.
************************************************************/
function wet_bulb(db,dp,h,atm) {
var wet_bulb;
var psat,wstar;
var dx,fmid,xmid,rtb;
var j=1;
var acc=0.0001;
rtb=dp;
dx=db-dp;
for (j=1;j<40;j++) {
dx=dx*0.5;
xmid=rtb+dx;
psat=psychro_pvs(xmid);
wstar=psychro_w_pvp((atm-psat), psat);
fmid=psychro_h_w(xmid, wstar);
if ((h-fmid)>0.0)
rtb=xmid;
if (Math.abs(dx)<acc)
break;
}
wet_bulb=rtb;
return wet_bulb;
}
/**********************************************
Compute other properties given Dry Bulb and wet
bulb Temp. and Altitude.
***********************************************/
function Calculate_DWA() {
with (document.form2) {
Buffer_db=db.value*9/5+32;
Buffer_wb=wb.value*9/5+32;
Buffer_alt=Altitude.value/0.3048;}
// Call (psychro_rh) to calculate Relative Humidity.
var str_rh = psychro_rh(Buffer_db, Buffer_wb, psychro_atm(Buffer_alt));
str_rh = str_rh.toString();
str_rh = str_rh.substring(0,4);
document.form2.Relat_hum.value= str_rh;
}
/**********************************************
Compute other properties given Dry Bulb Temp.,
Relative Humidity and Altitude.
***********************************************/
//350
function Calculate_DRHA() {
var ws,w,wb,atm,rh;
var dp,h;
var pvs,pvp;
// deneme
with (document.form1) {
Buffer_db=db.value*9/5+32;
Buffer_rh=Relat_hum.value/100;
Buffer_dp=dp_temp.value*1;
Buffer_alt=Altitude.value/0.3048;}
atm=psychro_atm(Buffer_alt);
pvs=psychro_pvs(Buffer_db);
// pvs=0.9358690986338097;
pvp=pvs*Buffer_rh;
w=psychro_w_pvp((atm-pvp),pvp);
h=psychro_h_w(Buffer_db,w);
dp=psychro_dp(pvp);
//Calculate wet bulb temperature using an iterative method.
if (Buffer_rh !=1){
wb=wet_bulb(Buffer_db,dp,h,atm);
}
else {
wb=Buffer_db;
}
wb=(wb-32)*5/9 ;
var str_wb = wb.toString();
str_wb = str_wb.substring(0,4);
document.form1.wb.value=str_wb;
}
function initiate2() {
if (document.form2.input_var.value=='bb') {
Calculate_DWA();
}
}
function initiate1() {
if (document.form1.input_var.value=='aa') {
Calculate_DRHA();
}
}
// Stop hiding from other browsers -->
</script>
</head>
<body bgcolor="#FFF9FF" leftmargin="10" topmargin="0">
<table width="718" border="0" cellpadding="0" cellspacing="0" class="yazi-b">
<tr>
<td width="350" align="center"><form name=form2 method=post>
<table width="95%" border="0" style="border-top: navy 1px solid; border-bottom: navy 1px solid; border-left: navy 1px solid; border-right: navy 1px solid;" class="yazi-b" bgcolor="#F0F0F0">
<tr bgcolor="#3333FF">
<td height="25" colspan="5" align="center" valign="middle"><a class="arkabaslik">Nem Oranı Değeri Hesaplama Tablosu</a></td>
</tr>
<tr>
<td width="5%"> </td>
<td width="60%"><strong>Parametre</strong></td>
<td width="30"><strong>Değer</strong></td>
<td width="10%"><strong>Birim</strong></td>
<td width="5%"> </td>
</tr>
<tr>
<td> </td>
<td>Kuru Termometre Sıcaklığı</td>
<td><input type=text onchange=initiate2(); size=10 value=25 name=db></td>
<td>°C</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Yükseklik (Altitude)</td>
<td><input type=text onchange=initiate2(); size=10 value=0 name=Altitude></td>
<td>m</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Yaş Termometre Sıcaklığı</td>
<td><input type=text onchange=initiate2(); size=10 name=wb></td>
<td>°C</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><hr></td>
<td><hr></td>
<td><hr></td>
<td> </td>
<input type=hidden onchange=initiate2(); name=dp_temp value=10>
<input type=hidden onchange=initiate2(); name=input_var value="bb">
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Nem Oranı (Rel.Hum)</td>
<td><input type=text onchange=initiate2(); size=10 name=Relat_hum></td>
<td>%</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><input onClick="initiate2();return false;" type=button name=Calculate value=" Hesapla "></td>
<td></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>