mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Implemented Density Altitude calculation
This commit is contained in:
parent
473ab7d7c0
commit
0364975c12
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
#include "initKeybinds.sqf"
|
#include "initKeybinds.sqf"
|
||||||
|
|
||||||
GVAR(Menus) = ["Date", "Direction", "Wind SPD m/s", "CROSSWIND m/s", "HEADWIND m/s", "TEMP °C", "CHILL °C", "HUMIDITY %", "HEAT INDEX °C", "DEW POINT °C", "WET BULB °C", "BARO hPA", "ALTITUDE m", "User Screen 1", "User Screen 2"];
|
GVAR(Menus) = ["Date", "Direction", "Wind SPD m/s", "CROSSWIND m/s", "HEADWIND m/s", "TEMP °C", "CHILL °C", "HUMIDITY %", "HEAT INDEX °C", "DEW POINT °C", "WET BULB °C", "BARO hPA", "ALTITUDE m", "DENS ALT m", "User Screen 1", "User Screen 2"];
|
||||||
|
|
||||||
GVAR(TOTAL) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
GVAR(TOTAL) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
GVAR(ENTRIES) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
GVAR(ENTRIES) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
|
|
||||||
GVAR(MinAvgMax) = false;
|
GVAR(MinAvgMax) = false;
|
||||||
GVAR(MinAvgMaxMode) = 0;
|
GVAR(MinAvgMaxMode) = 0;
|
||||||
|
@ -14,13 +14,15 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_altitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_fnc_updateMemory", "_windSpeed", "_crosswind", "_headwind"];
|
private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_altitude", "_airDensity", "_densityAltitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_fnc_updateMemory", "_windSpeed", "_crosswind", "_headwind"];
|
||||||
_playerDir = getDir ACE_player;
|
_playerDir = getDir ACE_player;
|
||||||
_playerAltitude = (getPosASL ACE_player) select 2;
|
_playerAltitude = (getPosASL ACE_player) select 2;
|
||||||
_temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
|
_temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
|
||||||
_humidity = EGVAR(weather,currentHumidity);
|
_humidity = EGVAR(weather,currentHumidity);
|
||||||
_barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
|
_barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
|
||||||
_altitude = EGVAR(weather,Altitude) + _playerAltitude;
|
_altitude = EGVAR(weather,Altitude) + _playerAltitude;
|
||||||
|
_airDensity = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateAirDensity);
|
||||||
|
_densityAltitude = _airDensity call EFUNC(weather,calculateDensityAltitude);
|
||||||
_chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill);
|
_chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill);
|
||||||
_heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex);
|
_heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex);
|
||||||
_dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint);
|
_dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint);
|
||||||
@ -33,7 +35,7 @@ if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then {
|
|||||||
|
|
||||||
{
|
{
|
||||||
GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1];
|
GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1];
|
||||||
} forEach [1, 5, 6, 7, 8, 9, 10, 11, 12];
|
} forEach [1, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
||||||
|
|
||||||
_fnc_updateMemory = {
|
_fnc_updateMemory = {
|
||||||
PARAMS_2(_slot,_value);
|
PARAMS_2(_slot,_value);
|
||||||
@ -86,3 +88,4 @@ if (GVAR(MinAvgMaxMode) == 1) then {
|
|||||||
[10, _wetBulb] call _fnc_updateMemory;
|
[10, _wetBulb] call _fnc_updateMemory;
|
||||||
[11, _barometricPressure] call _fnc_updateMemory;
|
[11, _barometricPressure] call _fnc_updateMemory;
|
||||||
[12, _altitude] call _fnc_updateMemory;
|
[12, _altitude] call _fnc_updateMemory;
|
||||||
|
[13, _densityAltitude] call _fnc_updateMemory;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
if (ACE_diagTime - GVAR(headingSetDisplayTimer) < 0.8) exitWith {["", "", " Heading Set", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]};
|
if (ACE_diagTime - GVAR(headingSetDisplayTimer) < 0.8) exitWith {["", "", " Heading Set", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]};
|
||||||
|
|
||||||
private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_fnc_dayOfWeek", "_dayString", "_monthString", "_windSpeed", "_windDir", "_textTop", "_textCenterBig", "_textCenter", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2", "_textBottomBig", "_textCenterLine1", "_textCenterLine2", "_textCenterLine3", "_textCenterLine4", "_textCenterLine5", "_textCenterLine6"];
|
private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_airDensity", "_densityAltitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_fnc_dayOfWeek", "_dayString", "_monthString", "_windSpeed", "_windDir", "_textTop", "_textCenterBig", "_textCenter", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2", "_textBottomBig", "_textCenterLine1", "_textCenterLine2", "_textCenterLine3", "_textCenterLine4", "_textCenterLine5", "_textCenterLine6"];
|
||||||
|
|
||||||
[] call FUNC(collectData);
|
[] call FUNC(collectData);
|
||||||
|
|
||||||
@ -52,6 +52,8 @@ _playerAltitude = (getPosASL ACE_player) select 2;
|
|||||||
_temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
|
_temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
|
||||||
_humidity = EGVAR(weather,currentHumidity);
|
_humidity = EGVAR(weather,currentHumidity);
|
||||||
_barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
|
_barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
|
||||||
|
_airDensity = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateAirDensity);
|
||||||
|
_densityAltitude = _airDensity call EFUNC(weather,calculateDensityAltitude);
|
||||||
_chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill);
|
_chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill);
|
||||||
_heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex);
|
_heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex);
|
||||||
_dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint);
|
_dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint);
|
||||||
@ -284,7 +286,19 @@ if (GVAR(referenceHeadingMenu) == 0) then {
|
|||||||
_textCenterLine3Right = Str(round(GVAR(Max) select 12));
|
_textCenterLine3Right = Str(round(GVAR(Max) select 12));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case 13: { // User Screen 1
|
case 13: { // DENSITY ALTITUDE
|
||||||
|
if (!GVAR(MinAvgMax)) then {
|
||||||
|
_textCenterBig = Str(round(_densityAltitude));
|
||||||
|
} else {
|
||||||
|
_textCenterLine1Left = "Min";
|
||||||
|
_textCenterLine2Left = "Avg";
|
||||||
|
_textCenterLine3Left = "Max";
|
||||||
|
_textCenterLine1Right = Str(round(GVAR(Min) select 13));
|
||||||
|
_textCenterLine2Right = Str(round((GVAR(Total) select 13) / (GVAR(Entries) select 13)));
|
||||||
|
_textCenterLine3Right = Str(round(GVAR(Max) select 13));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case 14: { // User Screen 1
|
||||||
_textCenterLine1Left = Str(round(_playerDir));
|
_textCenterLine1Left = Str(round(_playerDir));
|
||||||
_textCenterLine2Left = Str(round(EGVAR(weather,Altitude) + _playerAltitude));
|
_textCenterLine2Left = Str(round(EGVAR(weather,Altitude) + _playerAltitude));
|
||||||
_textCenterLine3Left = Str(round(abs(_windSpeed) * 10) / 10);
|
_textCenterLine3Left = Str(round(abs(_windSpeed) * 10) / 10);
|
||||||
@ -292,7 +306,7 @@ if (GVAR(referenceHeadingMenu) == 0) then {
|
|||||||
_textCenterLine2Right = "m";
|
_textCenterLine2Right = "m";
|
||||||
_textCenterLine3Right = "m/s";
|
_textCenterLine3Right = "m/s";
|
||||||
};
|
};
|
||||||
case 14: { // User Screen 2
|
case 15: { // User Screen 2
|
||||||
_textCenterLine1Left = Str(round(_temperature * 10) / 10);
|
_textCenterLine1Left = Str(round(_temperature * 10) / 10);
|
||||||
_textCenterLine2Left = Str(round(_humidity * 100 * 10) / 10);
|
_textCenterLine2Left = Str(round(_humidity * 100 * 10) / 10);
|
||||||
_textCenterLine3Left = Str(round((_playerAltitude call EFUNC(weather,calculateBarometricPressure)) * 10) / 10);
|
_textCenterLine3Left = Str(round((_playerAltitude call EFUNC(weather,calculateBarometricPressure)) * 10) / 10);
|
||||||
|
@ -5,6 +5,7 @@ ADDON = false;
|
|||||||
|
|
||||||
PREP(calculateAirDensity);
|
PREP(calculateAirDensity);
|
||||||
PREP(calculateBarometricPressure);
|
PREP(calculateBarometricPressure);
|
||||||
|
PREP(calculateDensityAltitude);
|
||||||
PREP(calculateDewPoint);
|
PREP(calculateDewPoint);
|
||||||
PREP(calculateHeatIndex);
|
PREP(calculateHeatIndex);
|
||||||
PREP(calculateRoughnessLength);
|
PREP(calculateRoughnessLength);
|
||||||
|
19
addons/weather/functions/fnc_calculateDensityAltitude.sqf
Normal file
19
addons/weather/functions/fnc_calculateDensityAltitude.sqf
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Author: Ruthberg
|
||||||
|
*
|
||||||
|
* Calculates density altitude for a given air density
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* density of air - kg * m^(-3) <NUMBER>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* density altitude - m <NUMBER>
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* None
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
// Source: http://wahiduddin.net/calc/density_altitude.htm
|
||||||
|
|
||||||
|
((44.3308 - 42.2665 * _this ^ 0.2349692456) * 1000)
|
Loading…
Reference in New Issue
Block a user