2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-05-15 17:58:24 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Calculates dew point based on temperature and relative humidity
|
|
|
|
*
|
|
|
|
* Arguments:
|
2016-01-05 07:39:29 +00:00
|
|
|
* 0: temperature - degrees celsius <NUMBER>
|
|
|
|
* 1: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
2015-05-15 17:58:24 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-04 00:11:24 +00:00
|
|
|
* dew point <NUMBER>
|
2015-05-15 17:58:24 +00:00
|
|
|
*
|
2016-01-05 07:39:29 +00:00
|
|
|
* Example:
|
|
|
|
* [32, 0.4] call ace_weather_fnc_calculateDewPoint
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-05-15 17:58:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define __b 17.67
|
|
|
|
#define __c 243.5
|
|
|
|
|
2015-08-04 00:11:24 +00:00
|
|
|
params ["_t", "_rh"];
|
2015-05-15 17:58:24 +00:00
|
|
|
|
2015-05-16 19:10:34 +00:00
|
|
|
if (_rh == 0) exitWith { CELSIUS(0) };
|
|
|
|
|
2015-05-15 17:58:24 +00:00
|
|
|
// Source: https://en.wikipedia.org/wiki/Dew_point
|
2015-05-16 10:39:52 +00:00
|
|
|
|
2016-01-05 07:39:29 +00:00
|
|
|
private _gamma = ln(_rh) + (__b * _t) / (__c + _t);
|
2015-05-15 17:58:24 +00:00
|
|
|
|
|
|
|
(__c * _gamma) / (__b - _gamma)
|