mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Finished heat index and wet bulb functions
This commit is contained in:
parent
8b878552cb
commit
0377526a7c
@ -15,6 +15,16 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#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
|
||||||
|
|
||||||
PARAMS_2(_t,_rh);
|
PARAMS_2(_t,_rh);
|
||||||
|
|
||||||
_rh = _rh * 100; // relative humidity in %
|
_rh = _rh * 100; // relative humidity in %
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
* Calculates wet bulb based on temperature and relative humidity
|
* Calculates wet bulb based on temperature and relative humidity
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
*
|
* 0: temperature - degrees celcius <NUMBER>
|
||||||
|
* 1: pressure - hPa <NUMBER>
|
||||||
|
* 2: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* 0: wet bulb <NUMBER>
|
* 0: wet bulb <NUMBER>
|
||||||
@ -14,6 +16,26 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
// TODO: ...
|
private ["_es", "_e", "_eDiff", "_eGuessPrev", "_cTempDelta", "_twGuess", "_eguess"];
|
||||||
|
|
||||||
GVAR(currentTemperature)
|
PARAMS_3(_temperature,_pressure,_relativeHumidity);
|
||||||
|
|
||||||
|
// Source: http://cosmoquest.org/forum/showthread.php?155366-Calculating-Wet-Bulb-Temperature-from-RH-amp-Dry-Bulb
|
||||||
|
_es = 6.112 * exp((17.67 * _temperature) / (_temperature + 243.5));
|
||||||
|
_e = _es * _relativeHumidity;
|
||||||
|
_eDiff = _es - _e;
|
||||||
|
_eGuessPrev = _es;
|
||||||
|
_cTempDelta = 3.3145;
|
||||||
|
_twGuess = _temperature;
|
||||||
|
|
||||||
|
for "_j" from 1 to 50 do {
|
||||||
|
_twGuess = _twGuess - _cTempDelta;
|
||||||
|
_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
|
||||||
|
@ -18,14 +18,3 @@
|
|||||||
#define WATER_VAPOR_MOLAR_MASS 0.018016
|
#define WATER_VAPOR_MOLAR_MASS 0.018016
|
||||||
#define DRY_AIR_MOLAR_MASS 0.028964
|
#define DRY_AIR_MOLAR_MASS 0.028964
|
||||||
#define SPECIFIC_GAS_CONSTANT_DRY_AIR 287.058
|
#define SPECIFIC_GAS_CONSTANT_DRY_AIR 287.058
|
||||||
|
|
||||||
// Heat index coefficients
|
|
||||||
#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
|
|
||||||
|
Loading…
Reference in New Issue
Block a user