2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-05-15 19:10:46 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Calculates wet bulb based on temperature and relative humidity
|
|
|
|
*
|
|
|
|
* Arguments:
|
2016-01-05 07:39:29 +00:00
|
|
|
* 0: temperature - degrees celsius <NUMBER>
|
2015-05-16 09:12:29 +00:00
|
|
|
* 1: pressure - hPa <NUMBER>
|
|
|
|
* 2: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
2015-05-15 19:10:46 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-04 00:11:24 +00:00
|
|
|
* wet bulb <NUMBER>
|
2015-05-15 19:10:46 +00:00
|
|
|
*
|
2016-01-05 07:39:29 +00:00
|
|
|
* Example:
|
|
|
|
* [0, 1020, 0.5] call ace_weather_fnc_calculateWetBulb
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-05-15 19:10:46 +00:00
|
|
|
*/
|
|
|
|
|
2015-08-04 00:11:24 +00:00
|
|
|
params ["_temperature", "_pressure", "_relativeHumidity"];
|
2015-05-16 09:12:29 +00:00
|
|
|
|
|
|
|
// Source: http://cosmoquest.org/forum/showthread.php?155366-Calculating-Wet-Bulb-Temperature-from-RH-amp-Dry-Bulb
|
2016-01-05 07:39:29 +00:00
|
|
|
private _es = 6.112 * exp((17.67 * _temperature) / (_temperature + 243.5));
|
|
|
|
private _e = _es * _relativeHumidity;
|
|
|
|
private _eDiff = _es - _e;
|
|
|
|
private _eGuessPrev = _es;
|
|
|
|
private _cTempDelta = 3.3145;
|
|
|
|
private _twGuess = _temperature;
|
2015-05-16 09:12:29 +00:00
|
|
|
|
|
|
|
for "_j" from 1 to 50 do {
|
|
|
|
_twGuess = _twGuess - _cTempDelta;
|
2016-01-05 07:39:29 +00:00
|
|
|
private _eguess = 6.112 * exp((17.67 * _twGuess) / (_twGuess + 243.5));
|
2015-05-16 09:12:29 +00:00
|
|
|
_eguess = _eguess - (_pressure * (_temperature - _twGuess) * 0.00066 * (1 + (0.00115 * _twGuess)));
|
|
|
|
_eDiff = _eguess - _e;
|
|
|
|
if (abs(_eDiff) <= 0.001) exitWith {};
|
|
|
|
_cTempDelta = _eDiff / ((_eguessprev - _eguess) / _cTempDelta);
|
|
|
|
_eguessprev = _eguess;
|
|
|
|
};
|
2015-05-15 19:10:46 +00:00
|
|
|
|
2015-05-16 09:12:29 +00:00
|
|
|
_twGuess
|