Added utility functions to calculate heat index and wind chill

This commit is contained in:
ulteq 2015-05-15 19:00:11 +02:00
parent 8d7f9c9a0d
commit e6ed1e5dbd
4 changed files with 58 additions and 0 deletions

View File

@ -5,8 +5,10 @@ ADDON = false;
PREP(calculateAirDensity);
PREP(calculateBarometricPressure);
PREP(calculateHeatIndex);
PREP(calculateRoughnessLength);
PREP(calculateTemperatureAtHeight);
PREP(calculateWindChill);
PREP(calculateWindSpeed);
PREP(displayWindInfo);
PREP(getMapData);

View File

@ -0,0 +1,23 @@
/*
* Author: Ruthberg
*
* Calculates heat index based on temperature and humidity
*
* Arguments:
* 0: temperature - degrees celcius <NUMBER>
* 2: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
*
* Return Value:
* 0: heat index <NUMBER>
*
* Return value:
* None
*/
#include "script_component.hpp"
PARAMS_2(_t, _rh);
_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)

View File

@ -0,0 +1,22 @@
/*
* Author: Ruthberg
*
* Calculates wind chill based on temperature and wind speed
*
* Arguments:
* 0: temperature - degrees celcius <NUMBER>
* 2: wind speed - m/s <NUMBER>
*
* Return Value:
* 0: wind chill <NUMBER>
*
* Public: No
*/
#include "script_component.hpp"
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)

View File

@ -18,3 +18,14 @@
#define WATER_VAPOR_MOLAR_MASS 0.018016
#define DRY_AIR_MOLAR_MASS 0.028964
#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 1.2308094 · 10^(2)
#define __C6 1.6424828 · 10^(2)
#define __C7 2.211732 · 10^(3)
#define __C8 7.2546 · 10^(4)
#define __C9 3.582 · 10^(6)