通过温度和湿度计算露点函数

float calc_dewpoint(float t,float h){
	double logex;
	double dew;
	logex=0.66077+7.5*t/(237.3+t)+ (log10(h)-2);
	dew=(logex-0.66077)*237.3/(0.66077+7.5-logex);
	return (float)dew;
}

计算出来的值:

温度:5°,湿度:10%RH, 露点:-24.2,

与专业软件VAISALA Humidity Calculator的结果:-21.7有一定的差距,原因是没有进行分段修正。

通过温度和湿度计算露点函数_第1张图片

解决办法:在网上找了个连接,计算出来结果和VAISALA一致,JS脚本如下方代码所示。(我已参照JS转换成C代码,用于ARM的设备里,经测试,0度以上与VAISALA软件完全一致,0度以下有一些偏差,可自行通过修订解决。C代码下载地址:https://download.csdn.net/download/shjhuang/13664809 )

 


var minT = 173; // -100 Deg. C.
var maxT = 678;

/*
 * Saturation Vapor Pressure formula for range -100..0 Deg. C.
 * This is taken from
 *   ITS-90 Formulations for Vapor Pressure, Frostpoint Temperature,
 *   Dewpoint Temperature, and Enhancement Factors in the Range 100 to +100 C
 * by Bob Hardy
 * as published in "The Proceedings of the Third International Symposium on Humidity & Moisture",
 * Teddington, London, England, April 1998
*/
var k0 = -5.8666426e3;
var k1 = 2.232870244e1;
var k2 = 1.39387003e-2;
var k3 = -3.4262402e-5;
var k4 = 2.7040955e-8;
var k5 = 6.7063522e-1;

function pvsIce(T) {
  lnP = k0/T + k1 + (k2 + (k3 + (k4*T))*T)*T + k5*Math.log(T);
  return Math.exp(lnP);
}

/**
 * Saturation Vapor Pressure formula for range 273..678 Deg. K.
 * This is taken from the
 *   Release on the IAPWS Industrial Formulation 1997
 *   for the Thermodynamic Properties of Water and Steam
 * by IAPWS (International Association for the Properties of Water and Steam),
 * Erlangen, Germany, September 1997.
 *
 * This is Equation (30) in Section 8.1 "The Saturation-Pressure Equation (Basic Equation)"
*/

var n1 = 0.11670521452767e4;
var n6 = 0.14915108613530e2;
var n2 = -0.72421316703206e6;
var n7 = -0.48232657361591e4;
var n3 = -0.17073846940092e2;
var n8 = 0.40511340542057e6;
var n4 = 0.12020824702470e5;
var n9 = -0.23855557567849;
var n5 = -0.32325550322333e7;
var n10 = 0.65017534844798e3;

function pvsWater(T) {
  var th = T+n9/(T-n10);
  var A = (th+n1)*th+n2;
  var B = (n3*th+n4)*th+n5;
  var C = (n6*th+n7)*th+n8;

  var p = 2*C/(-B+Math.sqrt(B*B-4*A*C));
  p *= p;
  p *= p;
  return p*1e6;
}

/**
 * Compute Saturation Vapor Pressure for minTmaxT) return NaN;
  else if (TmaxCount) {
      xnew=NaN;
      throw new Error(1, "Solver does not converge.");
      break;
    }
    x = xNew;
    count ++;
  } while (true);
}

 

你可能感兴趣的:(温湿度,露点)