Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double BME280::dewPoint(void)
- {
- double celsius = (double)readTempC();
- double humidity = (double)readFloatHumidity();
- // (1) Saturation Vapor Pressure = ESGG(T)
- double RATIO = 373.15 / (273.15 + celsius);
- double RHS = -7.90298 * (RATIO - 1);
- RHS += 5.02808 * log10(RATIO);
- RHS += -1.3816e-7 * (pow(10, (11.344 * (1 - 1/RATIO ))) - 1) ;
- RHS += 8.1328e-3 * (pow(10, (-3.49149 * (RATIO - 1))) - 1) ;
- RHS += log10(1013.246);
- // factor -3 is to adjust units - Vapor Pressure SVP * humidity
- double VP = pow(10, RHS - 3) * humidity;
- // (2) DEWPOINT = F(Vapor Pressure)
- double T = log(VP/0.61078); // temp var
- return (241.88 * T) / (17.558 - T);
- }
- // delta max = 0.6544 wrt dewPoint()
- // 6.9 x faster than dewPoint()
- // reference: http://en.wikipedia.org/wiki/Dew_point
- double BME280::dewPointFast(void)
- {
- double celsius = (double)readTempC();
- double humidity = (double)readFloatHumidity();
- double a = 17.271;
- double b = 237.7;
- double temp = (a * celsius) / (b + celsius) + log(humidity*0.01);
- double Td = (b * temp) / (a - temp);
- return Td;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement