From 83f2e35907d4a779723682ea0062c3065a5e6eaf Mon Sep 17 00:00:00 2001 From: ulteq Date: Fri, 29 May 2015 10:30:30 +0200 Subject: [PATCH] Fixed incorrect unit conversion in the barometric pressure calculation --- addons/atragmx/functions/fnc_calculate_range_card.sqf | 2 +- addons/atragmx/functions/fnc_calculate_target_solution.sqf | 2 +- addons/weather/functions/fnc_calculateBarometricPressure.sqf | 2 +- extensions/advanced_ballistics/AdvancedBallistics.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/atragmx/functions/fnc_calculate_range_card.sqf b/addons/atragmx/functions/fnc_calculate_range_card.sqf index 5d5253d1bf..483be187f0 100644 --- a/addons/atragmx/functions/fnc_calculate_range_card.sqf +++ b/addons/atragmx/functions/fnc_calculate_range_card.sqf @@ -47,7 +47,7 @@ _temperature = GVAR(temperature); _barometricPressure = GVAR(barometricPressure); _relativeHumidity = GVAR(relativeHumidity); if (!GVAR(atmosphereModeTBH)) then { - _barometricPressure = 1013.25 * exp(-(_altitude) / 7990); + _barometricPressure = (101325 * exp(-(_altitude) / 7990)) / 100; _relativeHumidity = 50; }; diff --git a/addons/atragmx/functions/fnc_calculate_target_solution.sqf b/addons/atragmx/functions/fnc_calculate_target_solution.sqf index 2be1197a9b..ffbfc7b4bd 100644 --- a/addons/atragmx/functions/fnc_calculate_target_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_target_solution.sqf @@ -47,7 +47,7 @@ _temperature = GVAR(temperature); _barometricPressure = GVAR(barometricPressure); _relativeHumidity = GVAR(relativeHumidity); if (!GVAR(atmosphereModeTBH)) then { - _barometricPressure = 1013.25 * exp(-(_altitude) / 7990); + _barometricPressure = (101325 * exp(-(_altitude) / 7990)) / 100; _relativeHumidity = 50; }; diff --git a/addons/weather/functions/fnc_calculateBarometricPressure.sqf b/addons/weather/functions/fnc_calculateBarometricPressure.sqf index 1e1d47098c..2062fc4695 100644 --- a/addons/weather/functions/fnc_calculateBarometricPressure.sqf +++ b/addons/weather/functions/fnc_calculateBarometricPressure.sqf @@ -14,4 +14,4 @@ */ #include "script_component.hpp" -(1013.25 * exp(-(GVAR(Altitude) + _this) / 7990) - 10 * overcast) +(101325 * exp(-(GVAR(Altitude) + _this) / 7990) - 1000 * overcast) / 100 diff --git a/extensions/advanced_ballistics/AdvancedBallistics.cpp b/extensions/advanced_ballistics/AdvancedBallistics.cpp index 06a398f342..5c2753f296 100644 --- a/extensions/advanced_ballistics/AdvancedBallistics.cpp +++ b/extensions/advanced_ballistics/AdvancedBallistics.cpp @@ -501,7 +501,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) trueSpeed = sqrt(pow(trueVelocity[0], 2) + pow(trueVelocity[1], 2) + pow(trueVelocity[2], 2)); temperature = bulletDatabase[index].temperature - 0.0065 * position[2]; - pressure = 1013.25 * exp(-(bulletDatabase[index].altitude + position[2]) / 7990) - 10 * bulletDatabase[index].overcast; + pressure = (101325 * exp(-(bulletDatabase[index].altitude + position[2]) / 7990) - 1000 * bulletDatabase[index].overcast) / 100; if (bulletDatabase[index].ballisticCoefficients.size() == bulletDatabase[index].velocityBoundaries.size() + 1) { dragRef = deltaT * bulletDatabase[index].airFriction * bulletSpeed * bulletSpeed;