当前位置: 首页>編程日記>正文

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

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

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有一定的差距,原因是没有进行分段修正。

解决办法:在网上找了个连接,计算出来结果和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 minT<T[Deg.K]<maxT.*/
function PVS(T) {if (T<minT || T>maxT) return NaN;else if (T<C_OFFSET)return pvsIce(T);elsereturn pvsWater(T);
}/*** Compute dewPoint for given relative humidity RH[%] and temperature T[Deg.K].*/
function dewPoint(RH,T) {return solve(PVS, RH/100*PVS(T), T);
}/*** Newton's Method to solve f(x)=y for x with an initial guess of x0.*/
function solve(f,y,x0) {var x = x0;var maxCount = 10;var count = 0;do {var xNew;var dx = x/1000;var z=f(x);xNew = x + dx*(y-z)/(f(x+dx)-z);if (Math.abs((xNew-x)/xNew)<0.0001)return xNew;else if (count>maxCount) {xnew=NaN;throw new Error(1, "Solver does not converge.");break;}x = xNew;count ++;} while (true);
}

 


https://www.fengoutiyan.com/post/14724.html

相关文章:

  • 鏡像模式如何設置在哪,圖片鏡像操作
  • 什么軟件可以把圖片鏡像翻轉,C#圖片處理 解決左右鏡像相反(旋轉圖片)
  • 手機照片鏡像翻轉,C#圖像鏡像
  • 視頻鏡像翻轉軟件,python圖片鏡像翻轉_python中鏡像實現方法
  • 什么軟件可以把圖片鏡像翻轉,利用PS實現圖片的鏡像處理
  • 照片鏡像翻轉app,java實現圖片鏡像翻轉
  • 什么軟件可以把圖片鏡像翻轉,python圖片鏡像翻轉_python圖像處理之鏡像實現方法
  • matlab下載,matlab如何鏡像處理圖片,matlab實現圖像鏡像
  • 圖片鏡像翻轉,MATLAB:鏡像圖片
  • 鏡像翻轉圖片的軟件,圖像處理:實現圖片鏡像(基于python)
  • canvas可畫,JavaScript - canvas - 鏡像圖片
  • 圖片鏡像翻轉,UGUI優化:使用鏡像圖片
  • Codeforces,CodeForces 1253C
  • MySQL下載安裝,Mysql ERROR: 1253 解決方法
  • 勝利大逃亡英雄逃亡方案,HDU - 1253 勝利大逃亡 BFS
  • 大一c語言期末考試試題及答案匯總,電大計算機C語言1253,1253《C語言程序設計》電大期末精彩試題及其問題詳解
  • lu求解線性方程組,P1253 [yLOI2018] 扶蘇的問題 (線段樹)
  • c語言程序設計基礎題庫,1253號C語言程序設計試題,2016年1月試卷號1253C語言程序設計A.pdf
  • 信奧賽一本通官網,【信奧賽一本通】1253:抓住那頭牛(詳細代碼)
  • c語言程序設計1253,1253c語言程序設計a(2010年1月)
  • 勝利大逃亡英雄逃亡方案,BFS——1253 勝利大逃亡
  • 直流電壓測量模塊,IM1253B交直流電能計量模塊(艾銳達光電)
  • c語言程序設計第三版課后答案,【渝粵題庫】國家開放大學2021春1253C語言程序設計答案
  • 18轉換為二進制,1253. 將數字轉換為16進制
  • light-emitting diode,LightOJ-1253 Misere Nim
  • masterroyale魔改版,1253 Dungeon Master
  • codeformer官網中文版,codeforces.1253 B
  • c語言程序設計考研真題及答案,2020C語言程序設計1253,1253計算機科學與技術專業C語言程序設計A科目2020年09月國家開 放大學(中央廣播電視大學)
  • c語言程序設計基礎題庫,1253本科2016c語言程序設計試題,1253電大《C語言程序設計A》試題和答案200901
  • 肇事逃逸車輛無法聯系到車主怎么辦,1253尋找肇事司機