VaporConditions : Vepor related calculation library / 水蒸気関係の各種計算用ライブラリ Library for Calculate some vapor related values from Temperature, Relative Humidity and Air Pressure 温度、相対湿度、大気圧から水蒸気関係のいくつかの値を計算します。 The formulas are based on 計算式は以下を参考にしています。 http://www.mistral.co.jp/kestrel-japan/MistralHumiRatio.pdf http://www.kanomax.co.jp/img_data/file_731_1417598330.pdf

Dependents:   Condensation_Monitor BLE_Condensation_Monitor

Files at this revision

API Documentation at this revision

Comitter:
takafuminaka
Date:
Thu Apr 30 16:47:28 2015 +0000
Commit message:
Initiali Release

Changed in this revision

VaporCondition.h Show annotated file Show diff for this revision Revisions of this file
VaporConditon.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 11570780a596 VaporCondition.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VaporCondition.h	Thu Apr 30 16:47:28 2015 +0000
@@ -0,0 +1,39 @@
+/**
+ *  VaporConditions Vepor related calculation library 
+ *
+ *  @author  Takafumi Naka
+ *  @version 1.0
+ *  @date    30-Apr-2015
+ *
+ *  Library for Calculate some vapor related values from Temperature, Relative Humidity and Air Pressure
+ *  The formulas are based on 
+ *  http://www.mistral.co.jp/kestrel-japan/MistralHumiRatio.pdf
+ *  http://www.kanomax.co.jp/img_data/file_731_1417598330.pdf
+ */
+ 
+#ifndef Vapor_Condition_H
+#define Vapor_Condition_H
+
+#include "mbed.h"
+#include "math.h"
+
+class VaporCondition
+{
+public:
+    float t; // Temperature (degC) // 
+    float h; // Relative Humidity (%) //
+    float p; // Air Pressure (hPa) //
+
+    /* Saturated vapor pressure */ 
+    float Pvsat(void); 
+    float Pv(void);
+    float Rh(void);
+    float Tdp(void);
+
+private:
+};
+
+
+#endif // Vapor_Condition_H
+
+ 
\ No newline at end of file
diff -r 000000000000 -r 11570780a596 VaporConditon.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VaporConditon.cpp	Thu Apr 30 16:47:28 2015 +0000
@@ -0,0 +1,52 @@
+/**
+ *  VaporConditions Vepor related calculation library 
+ *
+ *  @author  Takafumi Naka
+ *  @version 1.0
+ *  @date    30-Apr-2015
+ *
+ *  Library for Calculate some vapor related values from Temperature, Relative Humidity and Air Pressure
+ *  The formulas are based on 
+ *  http://www.mistral.co.jp/kestrel-japan/MistralHumiRatio.pdf
+ *  http://www.kanomax.co.jp/img_data/file_731_1417598330.pdf
+ */
+ 
+#include "mbed.h"
+#include "math.h"
+#include "VaporCondition.h"
+
+// Saturated Vapor Pressure (hPa) //
+float VaporCondition::Pvsat()
+{
+    return (6.11*pow(10,7.5*t/(t+237.3))); 
+}
+
+// Vapor Pressure (hPa) //
+float VaporCondition::Pv()
+{
+    return (Pvsat()*h/100.);
+}
+
+// Humidity Ratio (g/kg) //
+float VaporCondition::Rh()
+{
+    return (6.22*Pv()*100/p);
+}
+
+// Dew Point Temperature //
+float VaporCondition::Tdp()
+{
+    float y,y2,y3,y4;
+    y = log(Pv()*100/611.213);
+    y2 = y*y;
+    y3 = y2*y;
+    y4 = y2*y2;
+    if ( y>=0 ) 
+    {
+        return (13.715 * y+ 8.4262e-1 * y2 +1.9048e-2 * y3 +7.8158e-3 * y4);
+    }
+    else
+    {
+        return (13.7204 * y +7.36631e-1 * y2 +3.32136e-2 * y3 +7.78591e-3 * y4);
+    }
+}
\ No newline at end of file