Advertisement
NBK_PlanB

New Calcs for Heat Index and Dew Point

Jan 1st, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. double calcDewPointFast(double T, double RH)
  2. {
  3. double ans = (T - (14.55 + 0.114 * T) * (1 - (0.01 * RH)) - pow(((2.5 + 0.007 * T) * (1 - (0.01 * RH))),3) - (15.9 + 0.117 * T) * pow((1 - (0.01 * RH)), 14));
  4. double Td = (ans * 1.8) + 32; // Convert the Dew Point to F
  5. if (Td < 0) Td = 0;
  6. return Td;
  7. }
  8.  
  9. double calcHeatIndex(double T, double RH)
  10. {
  11. // The Rothfusz regression is not appropriate when conditions of temperature and humidity warrant a heat index value below about 80 degrees F.
  12. // In those cases, a simpler formula is applied to calculate values consistent with Steadman's results:
  13. // HI = 0.5 * {T + 61.0 + [(T-68.0)*1.2] + (RH*0.094)}
  14. // In practice, the simple formula is computed first and the result averaged with the temperature. If this heat index value is 80 degrees F or higher, the full regression equation along with any adjustment as described above is applied.
  15.  
  16. double HI = 0.5 * (T + 61.0 + ((T-68.0)*1.2) + (RH*0.094));
  17.  
  18. if (HI > 80.0)
  19. {
  20. HI = -42.379 + 2.04901523*T + 10.14333127*RH - .22475541*T*RH - .00683783*T*T - .05481717*RH*RH + .00122874*T*T*RH + .00085282*T*RH*RH - .00000199*T*T*RH*RH;
  21. // If the RH is less than 13% and the temperature is between 80 and 112 degrees F
  22. // ADJUSTMENT = [(13-RH)/4]*SQRT{[17-ABS(T-95.)]/17}
  23. if (RH < 13 & (T > 80.0 & T < 112.0))
  24. {
  25. double ADJUSTMENT = ((13-RH)/4)*sqrt((17-abs(T-95.))/17);
  26. HI = HI - ADJUSTMENT;
  27. }
  28. // If the RH is greater than 85% and the temperature is between 80 and 87 degrees F
  29. // ADJUSTMENT = [(RH-85)/10] * [(87-T)/5]
  30. if (RH > 85 & (T > 80.0 & T < 87.0))
  31. {
  32. double ADJUSTMENT = ((RH-85)/10) * ((87-T)/5);
  33. HI = HI - ADJUSTMENT;
  34. }
  35. }
  36. return HI;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement