18 float const temp_fahrenheit =
19 1.8 * (std::get<0>(input) - 273.15) +
21 float const relative_humidity =
22 std::get<1>(input) * 100;
26 float heat_index_temperature;
28 if (temp_fahrenheit <= 40) {
29 heat_index_temperature = temp_fahrenheit;
33 heat_index_temperature =
34 -10.3 + 1.1 * temp_fahrenheit + 0.047 * relative_humidity;
35 if (heat_index_temperature > 79) {
38 const float c1 = -42.379;
39 const float c2 = 2.04901523;
40 const float c3 = 10.14333127;
41 const float c4 = -0.22475541;
42 const float c5 = -0.00683783;
43 const float c6 = -0.05481717;
44 const float c7 = 0.00122874;
45 const float c8 = 0.00085282;
46 const float c9 = -0.00000199;
49 heat_index_temperature =
50 c1 + c2 * temp_fahrenheit + c3 * relative_humidity +
51 c4 * temp_fahrenheit * relative_humidity +
52 c5 * pow(temp_fahrenheit, 2) + c6 * pow(relative_humidity, 2) +
53 c7 * pow(temp_fahrenheit, 2) * relative_humidity +
54 c8 * temp_fahrenheit * pow(relative_humidity, 2) +
55 c9 * pow(temp_fahrenheit, 2) * pow(relative_humidity, 2);
59 if (relative_humidity <= 13 && 80 <= temp_fahrenheit &&
60 temp_fahrenheit <= 112) {
61 heat_index_temperature = heat_index_temperature -
62 ((13 - relative_humidity) / 4) *
63 sqrt(17 - abs(temp_fahrenheit - 95) / 17);
68 else if (relative_humidity > 85 && 80 <= temp_fahrenheit &&
69 temp_fahrenheit <= 87) {
70 heat_index_temperature =
71 heat_index_temperature +
72 0.02 * (relative_humidity - 85) * (87 - temp_fahrenheit);
77 this->
emit((heat_index_temperature - 32) / 1.8 +
86 const float heat_index_temperature =
88 String heat_index_effect =
"";
89 if (heat_index_temperature > 54) {
90 heat_index_effect =
"Extreme danger";
91 }
else if (heat_index_temperature > 41) {
92 heat_index_effect =
"Danger";
93 }
else if (heat_index_temperature > 32) {
94 heat_index_effect =
"Extreme Caution";
95 }
else if (heat_index_temperature > 27) {
96 heat_index_effect =
"Caution";
99 this->
emit(heat_index_effect);