Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double calcDewPointFast(double T, double RH)
- {
- 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));
- double Td = (ans * 1.8) + 32; // Convert the Dew Point to F
- if (Td < 0) Td = 0;
- return Td;
- }
- double calcHeatIndex(double T, double RH)
- {
- // The Rothfusz regression is not appropriate when conditions of temperature and humidity warrant a heat index value below about 80 degrees F.
- // In those cases, a simpler formula is applied to calculate values consistent with Steadman's results:
- // HI = 0.5 * {T + 61.0 + [(T-68.0)*1.2] + (RH*0.094)}
- // 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.
- double HI = 0.5 * (T + 61.0 + ((T-68.0)*1.2) + (RH*0.094));
- if (HI > 80.0)
- {
- 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;
- // If the RH is less than 13% and the temperature is between 80 and 112 degrees F
- // ADJUSTMENT = [(13-RH)/4]*SQRT{[17-ABS(T-95.)]/17}
- if (RH < 13 & (T > 80.0 & T < 112.0))
- {
- double ADJUSTMENT = ((13-RH)/4)*sqrt((17-abs(T-95.))/17);
- HI = HI - ADJUSTMENT;
- }
- // If the RH is greater than 85% and the temperature is between 80 and 87 degrees F
- // ADJUSTMENT = [(RH-85)/10] * [(87-T)/5]
- if (RH > 85 & (T > 80.0 & T < 87.0))
- {
- double ADJUSTMENT = ((RH-85)/10) * ((87-T)/5);
- HI = HI - ADJUSTMENT;
- }
- }
- return HI;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement