Reputation: 439
I'm trying to determine wind chill in metric. I found some good information from the BBC (where it's known as the "Feels Like temperature"), but I can't quite figure out how to convert it to C code.
Here is their calculation information:
T(wc) = 13.12 + 0.6215T - 11.37V**0.16 + 0.3965TV**0.16
With these notes
(Where T(wc) is the wind chill index based on the Celsius scale, T is the air temperature in °C, and V is the air speed in km/h measured at 10 m (33 ft, standard anemometer height).
So I create this but I get output that is sometimes negative
float feelslike = 13.12 + 0.6215 * temperature - 11.37 * windSpeed * 0.16 + 0.3965 * temperature * windSpeed * 0.16;
Maybe I'm missing something? I assume when it has "0.6215T" that it means "0.6215 * T" but I'm not sure how to interpret the double "*" in the equation either.
Sample output:
feelslike 15.126314 temp 19.719999 wind 18.040001
feelslike 15.126314 temp 19.719999 wind 18.040001
feelslike 14.308528 temp 20.070000 wind 20.670000
feelslike 14.308528 temp 20.070000 wind 20.670000
feelslike 12.485908 temp 20.049999 wind 23.930000
feelslike 12.485908 temp 20.049999 wind 23.930000
feelslike 9.340910 temp 19.450001 wind 27.110001
feelslike 9.340910 temp 19.450001 wind 27.110001
feelslike 5.497787 temp 18.330000 wind 28.969999
feelslike 5.497787 temp 18.330000 wind 28.969999
feelslike 2.776235 temp 16.740000 wind 27.400000
feelslike 2.776235 temp 16.740000 wind 27.400000
feelslike 0.058707 temp 14.950000 wind 25.670000
feelslike 0.058707 temp 14.950000 wind 25.670000
feelslike -1.787689 temp 13.130000 wind 23.389999
feelslike -1.787689 temp 13.130000 wind 23.389999
feelslike -1.408279 temp 12.460000 wind 21.650000
feelslike -1.408279 temp 12.460000 wind 21.650000
feelslike -0.960956 temp 11.810000 wind 20.020000
feelslike -0.960956 temp 11.810000 wind 20.020000
feelslike -1.235470 temp 11.550000 wind 19.820000
Upvotes: 3
Views: 822
Reputation: 11826
**
often means "raised to the power of". You can use pow
in math.h. For example:
pow(windSpeed, 0.16)
Your full calculation should be:
float feelslike = 13.12 + 0.6215 * temperature -
11.37 * pow(windSpeed, 0.16) +
0.3965 * temperature * pow(windSpeed, 0.16);
Don't forget to #include <math.h>
.
Upvotes: 5
Reputation: 23634
T(wc) = 13.12 + 0.6215T - 11.37V**0.16 + 0.3965TV**0.16
means:
T(wc) = 13.12 + 0.6215*T - 11.37*pow(V,0.16) + 0.3965*T*pow(V,0.16)
in C/C++
Upvotes: 6
Reputation: 1111
Maybe I'm crazy, but isn't it okay for you to have negative numbers? It just means it feels like it is below freezing?
Upvotes: 0