Getting Started Workbook - BfX_AD function

Started by DTV Student, September 16, 2014, 10:06:05 PM

Previous topic - Next topic

DTV Student

Hi Folks,

I am a newbie and have been exploring some of the BfX functions documented in the "Getting Started.XLS" file.  The one I am currently working on is for calculating Air Density, BfX_AD. 

I noticed that there is NOT an input parameter for the "Altitude Above Sea Level".  I live near the "Smoky Mountains".  They are old and eroded.  They are not impressive when compared to the Swiss Alps.  LOL...  The altitude of my "hills" range from 1000 feet to about 6000 feet above sea level.

The atmospheric pressure reported on the radio, television, and internet is NOT reported as absolute pressure.  The reported pressure has been adjusted for the local weather station's altitude to sea level conditions.

The adjustment to sea level means that the normal range of fluctuations in atmospheric pressure is the same for everyone.  The pressures that are considered high pressure or low pressure do not depend on geographical location.  This makes isobars on weather maps meaningful and useful tools.

So, I am thinking this is another good reason to know what the local altitude is so that the reported barometric pressure can be corrected back to the observed absolute pressure.

I have heard that changes in the Air Density due to temperature, barometric pressure, altitude, and % relative humidity might have as much as a 5 % effect on the flight path of a projectile.  Is this true?

Your comments and suggestions are always appreciated.

DTV Student

DTV Student

Hi Folks,

I think I am beginning to understand why "Altitude" is not part of the parameters for the BfX_AD and BfX_C functions.  I think it is because the barometric pressure input is expected to be an absolute pressure, not a pressure that has been adjusted to sea level conditions.  I suspect the absolute barometric pressure input is often measured at the rifle range with one of those expensive portable "Kestrel" weather stations. 

I do not have access to that sort of hardware, so I rely on weather reports to supply the temperature, barometric pressure and percent relative humidity.  I try to pick a weather stations close to my rifle range or close to my favorite hunting areas.  I wrote some VBA code last summer to sort of "undo" barometric pressure adjusted to sea level conditions as part of my version of an "Air Density" function.  Most of the formulas were collected from Wikipedia.   The "undo" code is contained in a few lines in the middle of following:

Public Function AirDensity(Altitude, BarometericPressure, RelativeHumidity, Temperature)
    Const ProcedureName = "AirDensity"
    On Error GoTo ProcedureErrorTrap
    Dim Alt As Double                               ' Altitude Above Sea Level (input units = feet)
    Dim BP As Double                               ' Barometeric Pressure (input units = inches Hg)
    Dim RH As Double                               ' Relative Humidity (input units = percent)
    Dim TempF As Double                          ' Ambient Temperature (input units = degrees F)
    Dim TempC As Double                          ' Temperature converted to degrees Celcius
    Dim TempK As Double                           ' Temperature converted to degrees Kelvin
    Dim ReportedPressure As Double           ' Reported pressure (inches Hg) at a given altitude
    Dim ExpectedPressure As Double           ' Expected pressure (inches Hg) at a given altitude
    Dim PressureAdjustment As Double        ' Adjustment (inches Hg) for sea level conditions
    Dim ObservedPressure As Double          ' Observed total absolute pressure (inches Hg)
    Dim Pta As Double                                ' Total Absolute Pressure (Pascals)
    Dim Pda As Double                               ' Partial Pressure of Dry Air (Pascals)
    Dim Pwv As Double                               ' Partial Pressure of Water Vapor (Pascals)
    Dim AirD As Double                              ' Air Density (kg/m^3)
    Alt = Altitude
    BP = BarometericPressure
    RH = RelativeHumidity
    TempF = Temperature
    TempC = (TempF - 32) / 1.8                                     ' Units = degrees Celcius
    TempK = TempC + 273.15                                        ' Units = degrees Kelvin
    ' A weather station observes the actual total absolute pressure, adjusts this pressure to
    ' what it would be at sea level, and then reports the result as the atmospheric pressure.
    ' We need to reverse this process to estimate the observed total absolute pressure.
    ReportedPressure = BP
    ExpectedPressure = 29.92126 * (TempK / (TempK + (-0.0019812 * Alt))) _
        ^ ((32.17405 * 28.9644) / (89494.596 * (-0.0019812)))
    PressureAdjustment = 29.92126 - ExpectedPressure
    ObservedPressure = ReportedPressure - PressureAdjustment         ' Units = inches mercury
    Pta = ObservedPressure * (101325 / 29.92)                                  ' Units = Pascals
    Pwv = RH * (6.1078 * 10 ^ ((7.5 * TempC) / (237.3 + TempC)))    ' Units = Pascals
    Pda = Pta - Pwv                                              ' Units = Pascals
    AirD = (Pda / (287.05 * TempK)) + (Pwv / (461.495 * TempK))      ' Units = kilograms/cubic meter
    'MsgBox "TempF = " & TempF & vbCrLf _
        & "TempC = " & TempC & vbCrLf _
        & "TempK = " & TempK & vbCrLf & vbCrLf _
        & "ReportedPressure = " & Format(ReportedPressure, "0.000") & " (inches Hg)" & vbCrLf _
        & "ExpectedPressure = " & Format(ExpectedPressure, "0.000") & " (inches Hg)" & vbCrLf _
        & "PressureAdjustment = " & Format(PressureAdjustment, "0.000") & " (inches Hg)" & vbCrLf _
        & "ObservedPressure = " & Format(ObservedPressure, "0.000") & " (inches Hg)" & vbCrLf & vbCrLf _
        & "Pta = " & Pta & " (Pascals)" & vbCrLf _
        & "Pwv = " & Pwv & " (Pascals)" & vbCrLf _
        & "Pda = " & Pda & " (Pascals)" & vbCrLf & vbCrLf _
        & "AirD = " & AirD & " (kg/m^3)" & vbCrLf _
        , , "De-Bugging Air Density Calculations"
    AirDensity = AirD
    Exit Function
    Exit Function
    Select Case Err.Number
        Case Else
            MsgBox "ProcedureName = " & ProcedureName & vbCrLf & vbCrLf _
                & "Err.Number = " & Err.Number & vbCrLf & vbCrLf _
                & "Err.Description = " & Err.Description, vbCritical, "We Have An Error..."
            Resume ProcedureExit
    End Select
End Function

Thank you,
DTV Student


Years ago I was puzzling with these matters, should altitude be a paremeter?
Yet it is much easier to measure pressure and calculate the density from it. Hence I removed the altitude parameter.

Clearly one can study the sensitivity of a path to atmospheric conditions via BfX_C. Yet, in al those years I have used BfX, I seldom used it. And, if so, mostly for rather academic purposes, to develop an intuition.

Some of the guys on the forum, shooting long range in Australia and Finland, at extreme temperatures, might be devoted users.

Measuring pressure certainly does not require devices that exceed 20 Euro's. For that price I have a electronic weather station over here (not measuring wind speed)

Furthermore, I think that the influence of temperature on the burning of the powder might cause more deviation  than through density fluctuations. However, I am not able to do te calculations. The aformementioned forum users keep their amunition in a  coolbox. In Finland to keep them warm, in Australia to keep them cool  ;D


For my purposes as a recreational shooter altitude matters only insofar as I may climb or descend while out in my area of operations. It might be hunting or just poking at steel but altitude still has to be accounted for in my shooting solutions occasionally.

My own Excel spreadsheet (ballisticxlr) has extra data on it that's meant to deal with variations of air temp, air pressure, ammo temp, etc... for that reason.