diff --git a/addons/weather/functions/fnc_calculateDewPoint.sqf b/addons/weather/functions/fnc_calculateDewPoint.sqf index 750b384ea0..c5de883090 100644 --- a/addons/weather/functions/fnc_calculateDewPoint.sqf +++ b/addons/weather/functions/fnc_calculateDewPoint.sqf @@ -21,6 +21,7 @@ PARAMS_2(_t,_rh); // Source: https://en.wikipedia.org/wiki/Dew_point + private ["_gamma"]; _gamma = ln(_rh) + (__b * _t) / (__c + _t); diff --git a/addons/weather/functions/fnc_calculateHeatIndex.sqf b/addons/weather/functions/fnc_calculateHeatIndex.sqf index 95060bd0a2..085edcd1a9 100644 --- a/addons/weather/functions/fnc_calculateHeatIndex.sqf +++ b/addons/weather/functions/fnc_calculateHeatIndex.sqf @@ -15,19 +15,20 @@ */ #include "script_component.hpp" -#define __C1 -8.784695 -#define __C2 1.61139411 -#define __C3 2.338549 -#define __C4 -0.14611605 -#define __C5 -0.012308094 -#define __C6 -0.016424828 -#define __C7 0.002211732 -#define __C8 0.00072546 -#define __C9 -0.000003582 +#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 PARAMS_2(_t,_rh); +// Source: https://en.wikipedia.org/wiki/Heat_index + +_t = FAHRENHEIT(_t); _rh = _rh * 100; // relative humidity in % -// Source: https://en.wikipedia.org/wiki/Heat_index -(__C1 + __C2 * _t + __C3 * _rh + __C4 * _t * _rh + __C5 * _t^2 + __C6 * _rh^2 + __C7 * _t^2 * _rh + __C8 * _t * _rh^2 + __C9 * _t^2 * _rh^2) +CELSIUS(__C1 + __C2 * _t + __C3 * _rh + __C4 * _t * _rh + __C5 * _t^2 + __C6 * _rh^2 + __C7 * _t^2 * _rh + __C8 * _t * _rh^2) diff --git a/addons/weather/functions/fnc_calculateWindChill.sqf b/addons/weather/functions/fnc_calculateWindChill.sqf index 04e26013d7..021d2f8b99 100644 --- a/addons/weather/functions/fnc_calculateWindChill.sqf +++ b/addons/weather/functions/fnc_calculateWindChill.sqf @@ -16,7 +16,10 @@ PARAMS_2(_t,_v); -_v = _v * 3,6; // wind speed in km/h - // Source: https://en.wikipedia.org/wiki/Wind_chill -(13.12 + 0.06215 * _t - 11.37 * _v ^ 0.16 + 0.3965 * _t * _v^0.16) + +if (_t > 10) exitWith { _t }; +if (_v < 1.39) exitWith { _t }; + +_v = _v * 3,6; // wind speed in km/h +(13.12 + 0.6215 * _t - 11.37 * _v ^ 0.16 + 0.3965 * _t * _v ^ 0.16) diff --git a/addons/weather/script_component.hpp b/addons/weather/script_component.hpp index edc1ac64d0..dedfc59236 100644 --- a/addons/weather/script_component.hpp +++ b/addons/weather/script_component.hpp @@ -18,3 +18,5 @@ #define WATER_VAPOR_MOLAR_MASS 0.018016 #define DRY_AIR_MOLAR_MASS 0.028964 #define SPECIFIC_GAS_CONSTANT_DRY_AIR 287.058 +#define CELSIUS(t) ((t - 32) / 1.8) +#define FAHRENHEIT(t) (t * 1.8 + 32)