Skip to content

Commit

Permalink
Merge pull request #1424 from acemod/barometricPressureFix
Browse files Browse the repository at this point in the history
Fixed incorrect barometric pressure calculation
  • Loading branch information
ulteq committed May 29, 2015
2 parents f2e21fc + 69b9d0e commit 1ec37aa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion addons/atragmx/functions/fnc_calculate_range_card.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ _temperature = GVAR(temperature);
_barometricPressure = GVAR(barometricPressure);
_relativeHumidity = GVAR(relativeHumidity);
if (!GVAR(atmosphereModeTBH)) then {
_barometricPressure = 1013.25 * exp(-(_altitude) / 7990);
_barometricPressure = 1013.25 * (1 - (0.0065 * _altitude) / (273.15 + _temperature + 0.0065 * _altitude)) ^ 5.255754495;
_relativeHumidity = 50;
};

Expand Down
2 changes: 1 addition & 1 deletion addons/atragmx/functions/fnc_calculate_target_solution.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ _temperature = GVAR(temperature);
_barometricPressure = GVAR(barometricPressure);
_relativeHumidity = GVAR(relativeHumidity);
if (!GVAR(atmosphereModeTBH)) then {
_barometricPressure = 1013.25 * exp(-(_altitude) / 7990);
_barometricPressure = 1013.25 * (1 - (0.0065 * _altitude) / (273.15 + _temperature + 0.0065 * _altitude)) ^ 5.255754495;
_relativeHumidity = 50;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
*/
#include "script_component.hpp"

(1013.25 * exp(-(GVAR(Altitude) + _this) / 7990) - 10 * overcast)
((1013.25 - 10 * overcast) * (1 - (0.0065 * (GVAR(Altitude) + _this)) / (KELVIN(GVAR(currentTemperature)) + 0.0065 * GVAR(Altitude))) ^ 5.255754495);
2 changes: 1 addition & 1 deletion extensions/advanced_ballistics/AdvancedBallistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (1013.25 - 10 * bulletDatabase[index].overcast) * pow(1 - (0.0065 * (bulletDatabase[index].altitude + position[2])) / (273.15 + temperature + 0.0065 * bulletDatabase[index].altitude), 5.255754495);

if (bulletDatabase[index].ballisticCoefficients.size() == bulletDatabase[index].velocityBoundaries.size() + 1) {
dragRef = deltaT * bulletDatabase[index].airFriction * bulletSpeed * bulletSpeed;
Expand Down

0 comments on commit 1ec37aa

Please sign in to comment.