ACE3/addons/weather/functions/fnc_calculateWetBulb.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

41 lines
1.2 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Ruthberg
* Calculates wet bulb based on temperature and relative humidity
*
* Arguments:
* 0: temperature - degrees celsius <NUMBER>
* 1: pressure - hPa <NUMBER>
* 2: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
*
* Return Value:
* wet bulb <NUMBER>
*
* Example:
* [0, 1020, 0.5] call ace_weather_fnc_calculateWetBulb
*
* Public: No
*/
params ["_temperature", "_pressure", "_relativeHumidity"];
// Source: http://cosmoquest.org/forum/showthread.php?155366-Calculating-Wet-Bulb-Temperature-from-RH-amp-Dry-Bulb
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;
for "_j" from 1 to 50 do {
_twGuess = _twGuess - _cTempDelta;
private _eguess = 6.112 * exp((17.67 * _twGuess) / (_twGuess + 243.5));
_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;
};
_twGuess