Limych / ha-apparent-temperature

Sensor of Apparent Temperature for Home Assistant.
Other
100 stars 12 forks source link

Formulae for calculation? #18

Open stigvi opened 3 years ago

stigvi commented 3 years ago

Is it possible to document how the "feels like" temperature is calculated and also how you get to this particular formulae?

phreaq commented 3 years ago

I just looked thru the code, and here's the formula

e_value = humd * 0.06105 * math.exp((17.27 * temp) / (237.7 + temp))        
feeling = temp + 0.348 * e_value - 0.7 * wind - 4.25

fwiw, it seems like wind is a large factor, so excluding it will give the 'feels like' temperature a higher reading

TATERxxWARDY commented 3 years ago

Does this account for heat index as well? I was looking into writing up this calculation elsewhere before I found this integration on HACS and the scientific resources I found mentioned heat index playing a large factor during the summer months

Limych commented 3 years ago

This sensor actually calculates the "temperature in the shade", because there is not enough calculation of the contribution of solar radiation. This parameter depends on the specific location, and it is rather difficult to calculate it mathematically.

Limych commented 3 years ago

The whole formula:

image where Ta = Dry bulb temperature (°C) e = Water vapour pressure (hPa) [humidity] ws = Wind speed (m/s) at an elevation of 10 meters Q = Net radiation absorbed per unit area of body surface (W/m2)

E is computed like this image where rh = Relative Humidity [%]

While temperature and humidity are regional and seasonal factors, wind and radiation are microclimatic factors and are influenced by the local environment.

Margucci commented 2 years ago

For the wind speed, is the input supposed to be in kph, mph, or m/s?

Limych commented 2 years ago

For the wind speed, is the input supposed to be in kph, mph, or m/s?

For this sensor — any of this units. Value will be automatically converted to m/s for calculations.

Sudo-Rob commented 1 year ago

I've been looking for a solution for adding feels-like temperature to a weather card and thought this could be perfect. The issue I'm experiencing is the feels-like values are well off from where I'd expect them to be. When I look at your calculations, it appears you have omitted the use of Q. This results in a relatively large spread between ambient temperature and the feels-like temperature.

Comparing results with the US/Canada methodology (http://solberg.snr.missouri.edu/gcc/OFCMWindchillReport.pdf), I can get close with Q = 64 W-m^-2. That said, I have only checked a couple of cases. When I try to match the Australian BoM data (http://www.bom.gov.au/info/thermal_stress/#apparent), it looks as if Q could be a function of wind speed. There's not much specificity regarding Q.

I'm not a proponent of any particular method, but the NWS formulae are easy to calculate. At least I can match the models to the published charts. There are a few corner cases for heat-index requiring some conditional logic, but they're manageable. The wind chill calculation has two limitations to consider. There is a gap, however, between 50°F and 70°F where neither method is typically used. I've come up with a way of bridging the gap which seems reasonable to me. Effectively, its a weighted average between the two methods of calculating feels-like temperature. Here's how it behaves for a wind speed of 40 mph and relative humidity of 80%.

image

I appreciate the work you've done as it solves a problem I have with using the NWS API. If you're taking requests for improvement, I respectfully suggest either providing an option for including Q in the calculation (that is, if a static value can work), or alternately migrating to a different model.

Additional references: https://www.weather.gov/media/epz/wxcalc/windChill.pdf https://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml https://journals.ametsoc.org/downloadpdf/journals/apme/23/12/1520-0450_1984_023_1674_ausoat_2_0_co_2.xml

Edit: I have a working sensor template using the NWS model as described above.