2015-05-15 17:00:11 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
*
|
2015-05-15 17:58:24 +00:00
|
|
|
* Calculates heat index based on temperature and relative humidity
|
2015-05-15 17:00:11 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: temperature - degrees celcius <NUMBER>
|
2015-08-04 00:11:24 +00:00
|
|
|
* 1: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
2015-05-15 17:00:11 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-04 00:11:24 +00:00
|
|
|
* heat index <NUMBER>
|
2015-05-15 17:00:11 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* None
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-16 10:39:52 +00:00
|
|
|
#define __C1 0.363445176
|
|
|
|
#define __C2 0.988622465
|
|
|
|
#define __C3 4.777114035
|
|
|
|
#define __C4 -0.114037667
|
|
|
|
#define __C5 -0.000850208
|
|
|
|
#define __C6 -0.020716198
|
|
|
|
#define __C7 0.000687678
|
|
|
|
#define __C8 0.000274954
|
2015-05-16 09:12:29 +00:00
|
|
|
|
2015-08-04 00:11:24 +00:00
|
|
|
params ["_t", "_rh"];
|
2015-05-15 17:00:11 +00:00
|
|
|
|
2015-05-16 10:39:52 +00:00
|
|
|
// Source: https://en.wikipedia.org/wiki/Heat_index
|
|
|
|
|
2015-05-16 19:10:34 +00:00
|
|
|
_t = TO_FAHRENHEIT(_t);
|
2015-05-15 17:00:11 +00:00
|
|
|
_rh = _rh * 100; // relative humidity in %
|
|
|
|
|
2015-05-16 19:10:34 +00:00
|
|
|
TO_CELSIUS(__C1 + __C2 * _t + __C3 * _rh + __C4 * _t * _rh + __C5 * _t^2 + __C6 * _rh^2 + __C7 * _t^2 * _rh + __C8 * _t * _rh^2)
|