MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / dewPoint

Function dewPoint

libraries/Temperature/temperature.cpp:34–51  ·  view source on GitHub ↗

reference: [1] https://wahiduddin.net/calc/density_algorithms.htm [2] https://web.archive.org/web/20100528030817/https://www.colorado.edu/geography/weather_station/Geog_site/about.htm dewPoint function based on code of [2] calculation of the saturation vapour pressure part is based upon NOAA ESGG(temp)

Source from the content-addressed store, hash-verified

32// dewPoint function based on code of [2]
33// calculation of the saturation vapour pressure part is based upon NOAA ESGG(temp)
34float dewPoint(float celsius, float humidity)
35{
36 // Calculate saturation vapour pressure
37 // ratio 100C and actual temp in Kelvin
38 float A0 = 373.15 / (273.15 + celsius);
39 // SVP = Saturation Vapor Pressure - based on ESGG() NOAA
40 float SVP = -7.90298 * (A0 - 1.0);
41 SVP += 5.02808 * log10(A0);
42 SVP += -1.3816e-7 * (pow(10, (11.344 * ( 1.0 - 1.0/A0))) - 1.0 );
43 SVP += 8.1328e-3 * (pow(10, (-3.49149 * (A0 - 1.0 ))) - 1.0 ) ;
44 SVP += log10(1013.246);
45
46 // calculate actual vapour pressure VP;
47 // note to convert to KPa the -3 is used
48 float VP = pow(10, SVP - 3) * humidity;
49 float T = log( VP / 0.61078); // temp var
50 return (241.88 * T) / (17.558 - T);
51}
52
53
54// dewPointFast() is > 5x faster than dewPoint() - run dewpoint_test.ino

Callers 1

unittestFunction · 0.85

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.68