Aeronautical Utilities Reference

Table of contents


Introduction

These functions and constants are useful for aeronautical computations. The functions categories are:

Importing

The aeronautical utility functions and constants are available for import from common/aero/exports.js.


Constants

LB_PER_GAL_JETA

The standard weight of Jet-A fuel in pounds per US gallon: 6.7.

LB_PER_GAL_AVGAS

The standard weight of aviation gasoline in pounds per US gallon: 6.

STD_ATM_HPA

The standard atmospheric pressure in hectopascals: 1013.25.

STD_ATM_HG

The standard atmospheric pressure in inches of Mercury: 29.92.

STD_TEMP_LAPSE

The standard atmospheric temperature lapse rate in °C/foot: 0.001981.

STD_TRANSITION_ALT

The standard US transition altitude in feet: 18,000.

Aircraft performance functions

adjustRocForPower()

Syntax

adjustRocForPower(roc, weight, oldHp, newHp)

Returns an aircraft's rate of climb adjusted for changes in power at the same climb airspeed. The roc, weight, and oldHp arguments are the current rate of climb, aircraft weight and power. The newHp argument is the new power setting.

The computation is adapted from Aerodynamics for Naval Aviators, page 154.

Parameters

Return value

The rate of climb in ft/min at newHp.


adjustRocForWeight()

Syntax

adjustRocForWeight(roc, oldWeight, newWeight)

Returns an aircraft's rate of climb adjusted for changes in weight at the same climb airspeed. The roc and oldWeight arguments are the current rate of climb and aircraft weight. The newWeight argument is the new weight to compute the rate of climb for.

The computation is adapted from Aerodynamics for Naval Aviators, page 154.

Parameters

Return value

The rate of climb in ft/min at newWeight.


climbGradient()

Syntax

climbGradient(roc, gs)

Returns an aircraft's climb gradient in ft/nm given a rate of climb and ground speed.

Parameters

Return value

The climb gradient in ft/nm.


climbGradientToRoc()

Syntax

climbGradientToRoc(aoc, tas)

Returns an aircraft's rate of climb in ft/min given a climb gradient and true airspeed.

Parameters

Return value

The rate of climb in ft/min.


createExtendedPtable()

Syntax

createExtendedPtable(table, data)

Creates a new copy of a Ptable with extended data by adding new elements to the end of the original Ptable's a data array. This only extends the data for the first input parameter.

This is often used for gross weight increase options to add new weight data to a table whose first input parameter is weight. This function will not do the right thing if the first parameter is not weight.

For example, if stallIasTable has one parameter, 'weight', and produces a stall airspeed, then:

newStallIasTable = createExtendedPtable(stallIasTable, {p:3000, v:59})

Will create a new Ptable with the data from stallIasTable with a new entry appended at the end of the a data array.

Parameters

Return value

A Ptable.


createWeightIncrIasPtable()

Syntax

createWeightIncrIasPtable(table, newWeight)
createWeightIncrIasPtable(table, newWeight, newSpeed)

Creates a copy of a weight to airspeed Ptable with extended data. The original table must have one parameter, 'weight', and produce an airspeed output. The copy has an additional entry with newWeight and newSpeed at the end of the data. If newSpeed is omitted, then it is computed from the old maximum weight and the associated airspeed in the last entry of the original table using weightAdjustCas().

For example, if stallIasTable has one parameter, 'weight', and produces a stall airspeed, then the following two statements produce the same result:

newStallIasTable = createExtendedPtable(stallIasTable, {p:3000, v:59})
newStallIasTable = createWeightIncrIasPtable(stallIasTable, 3000, 59)

Parameters

Return value

A Ptable.


crosswind()

Syntax

crosswind(angle, windSpeed)

Return the crosswind component given an angle in degrees and a windSpeed. A negative value means the crosswind is coming from the left.

Parameters

Return value

The crosswind component of the wind.


effectiveHeadwind()

Syntax

effectiveHeadwind(windSpeed, windDirection, tas, course)

Returns the "effective headwind": the difference between the tas and the ground speed along the desired course (track). It accounts for the portion of the true airspeed used to crab into the wind to maintain the course.

Parameters

Return value

The headwind component of the wind.

gasPressureAdjust()

Syntax

gasPressureAdjust(pressure, oldTemp, newTemp)

Compute the new gas pressure at temperature newTemp, for a fixed volume that had pressure at temperature oldTemp. Uses Gay-Lussac's gas pressure law.

This is useful to to adjust oxygen or tire pressure for temperature.

Parameters

Return value

The new gas pressure in pounds per square inch.


glideDistance()

Syntax

glideDistance(glideRatio, cas, hwind, fromAltitude, toAltitude, isa)

Returns the distance to glide dropping from fromAltitude to toAltitude as affected by wind. The glide ratio (glideRatio) for a glide is fixed (i.e., the slope of the glide) so that the distance covered for a given altitude drop remains constant throughout the glide. However, the time for a given altitude drop varies because the TAS changes as altitude drops for a fixed glide cas. To be conservative headwinds are assumed to be steady all the way down and tailwinds are assumed to decrease linearly to zero on the way down.

Parameters

Return value

The distance covered by the glide in nautical miles.


glideTime()

Syntax

glideTime(glideRatio, cas, fromAltitude, toAltitude, isa)

Returns the glide time in minutes to glide dropping from fromAltitude to toAltitude. The glide ratio (glideRatio) for a glide is fixed (i.e., the slope of the glide), but the time for a given altitude drop varies because the TAS changes as altitude drops for a fixed glide cas.

glideTime() sums the time it takes to drop each 1,000 ft of drop.

Parameters

Return value

The glide time in minutes.


headwind()

Syntax

headwind(angle, windSpeed)

Return a the headwind component given an angle in degrees and a windSpeed.

Parameters

Return value

The headwind component of the wind.


takeoffSlopeAdjust()

Syntax

takeoffSlopeAdjust(roll, slope, Vrgs)

Returns a takeoff roll adjusted for slope. The given roll is computed for a flat surface. The function only adjusts for positive slopes because this calculation is not in the POH. Vrgs is the rotation or liftoff ground speed.

Parameters

Return value

The adjusted takeoff roll in feet.


Airspeed functions

bankAdjustCas()

Syntax

bankAdjustCas(cas, bank)

Returns an adjusted V-speed in KCAS for a bank angle in degrees. The adjustment applies to airspeeds related to the angle of attack, like stall speeds and operating maneuvering speed.

Parameters

Return value

The adjusted airspeed in knots.


Airspeed functions

casToMach()

Syntax

casToMach(cas, pressureAltitude)

Returns an airspeed in Mach given a calibrated airspeed in knots and a pressure altitude.

Parameters

Return value

The converted airspeed in Mach.


casToTas()

Syntax

casToTas(cas, pressureAltitude, sat)

Returns a true airspeed in knots given a calibrated airspeed in knots, a pressure altitude, and a static air temperature.

Parameters

Return value

The converted airspeed in knots.


tasToCas()

Syntax

tasToCas(tas, pressureAltitude, sat)

Returns a calibrated airspeed in knots given a true airspeed in knots, a pressure altitude, and a static air temperature.

Parameters

Return value

The converted airspeed in knots.


weightAdjustCas()

Syntax

weightAdjustCas(cas, oldWeight, newWeight)

Returns an adjusted V-speed in KCAS at a given weight for a new weight. The adjustment applies to airspeeds related to the angle of attack, like stall speeds and operating maneuvering speed.

Parameters

Return value

The calibrated airspeed at newWeight.


Altitude functions

coldAdjAlt()

Syntax

coldAdjAlt(altitude, arptElevation, arptOat)

Returns a procedure altitude adjusted using the standard cold weather altitude adjustment. When the temperature is below standard conditions, the true altitude will be lower than the indicated altitude. This computes a new indicated altitude that should be used in place of the charted altitude.

Parameters

Return value

The adjusted altitude MSL in feet.


densityAlt()

Syntax

densityAlt(altitude, altimeter, oat)

Returns the dry density altitude for given altitude, altimeter setting, and OAT. The dry density altitude does not take humidity into account, but it is the reported density altitude in ATIS or ASOS announcement. See Density Altitude.

Parameters

Return value

The dry density altitude MSL in feet.


densityAltWet()

Syntax

densityAltWet(altitude, altimeter, oat)

Returns the wet density altitude for given altitude, altimeter setting, OAT, and dew point. The wet density altitude takes humidity into account. See Density Altitude.

Parameters

Return value

The wet density altitude MSL in feet.


indicatedAltitude()

Syntax

indicatedAltitude(pressureAltitude)
indicatedAltitude(pressureAltitude, altimeter)
indicatedAltitude(pressureAltitude, altimeter, transitionAltitude)

Returns the indicated altitude given the pressure altitude, altimeter setting, and transition altitude. Above the transition altitude, the indicated altitude is returned.

Parameters

Return value

The indicated altitude in feet MSL.


pressureAltitude()

Syntax

pressureAltitude(altitude)
pressureAltitude(altitude, altimeter)
pressureAltitude(altitude, altimeter, transitionAltitude)

Returns the pressure altitude given the indicated altitude, altimeter setting, and transition altitude. Above the transition altitude, the pressure altitude is returned.

Parameters

Return value

The pressure altitude in feet MSL.


stdPressure()

Syntax

stdPressure(altitude)
stdPressure(altitude, altimeter)

Returns the absolute pressure at standard temperature given the altitude and altimeter setting. See Station Pressure.

Parameters

Return value

The pressure altitude in feet MSL.


fmtHeading()

Syntax

fmtHeading(dir)

Return the return a 3-digit heading string from a direction in degrees. For example:

fmtHeading(2.5) === '003'

Parameters

Return value

A heading string.


gcBearingTo()

Syntax

gcBearingTo(lat1, long1, lat2, long2)

Return the great circle bearing from an origin (lat1,long1) to a destination (lat2,long2). See Calculate distance, bearing and more between Latitude/Longitude points.

Parameters

Return value

A heading in degrees from true north. The returned value will be greater than 0 and less than or equal to 360.


gcDistance()

Syntax

gcDistance(lat1, long1, lat2, long2)

Return the great circle distance from an origin (lat1,long1) to a destination (lat2,long2). See Calculate distance, bearing and more between Latitude/Longitude points.

Parameters

Return value

A distance in nautical miles.


magVar()

Syntax

magVar(lat, long)
magVar(lat, long, altitude)
magVar(lat, long, altitude, date)

Return a numeric magnetic variation given a location, altitude MSL, and date. If no date is provided, the current date is assumed. If no altitude is provided, then 0 MSL is assumed.

Add the magnetic variation to the magnetic heading to get the true heading.

Parameters

Return value

A magnetic variance in degrees.


magVarFromString()

Syntax

magVarFromString(magVarStr)

Return a numeric magnetic variation from a magnetic variation string. For example:

magVarFromString('14W') === -14

Add the magnetic variation to the magnetic heading to get the true heading.

Parameters

Return value

A magnetic variance in degrees.


magVarToString()

Syntax

magVarToString(magVar)

Return a magnetic variation string given a numeric magnetic variation. A negative magVar is west. For example:

magVarFromString(-14) === '14W'

Parameters

Return value

A magnetic variance string of the form /(\d{1,3})([EW])/.


runwayIdToDir()

Syntax

runwayIdToDir(id)

Return the magnetic runway direction from the runway ID. This strips the [LRC] from the end and multiplies by 10.

Parameters

Return value

A Number representing the magnetic heading in degrees.
export function runwayRecip (id) {


runwayRecip()

Syntax

runwayRecip(id)

Return the reciprocal runway identifier string given the base identifier. Esentially this flips the base ID 180 degrees and flips any L or R designation.

Parameters

Return value

A runway ID string for the reciprocal runway


Temperature functions

iatToSat()

Syntax

iatToSat(iat, tas)

Returns the static air temperature (SAT or OAT) given the indicated outside air temperature and the true airspeed. iatToSat() computes the increase in temperature measured at the outside temperature probe due to airspeed and subtracts that from the indicated temperature.

Parameters

Return value

The static air temperature (SAT or OAT) in degrees Celsius.


ramRise()

Syntax

ramRise(tas)

Returns the ram rise: the increase in temperature measured at the outside temperature probe due to airspeed.

Parameters

Return value

The ram rise in degrees Celsius.


satToIat()

Syntax

satToIat(sat, tas)

Returns the indicated outside air temperature given the static air temperature (SAT or OAT) and the true airspeed. iatToSat() computes the increase in temperature measured at the outside temperature probe due to airspeed and adds that to the static temperature.

Parameters

Return value

The indicated air temperature (SAT or OAT) in degrees Celsius.


stdTemp()

Syntax

stdTemp(pressureAltitude)

Returns the standard temperature at a pressure altitude.

Parameters

Return value

The standard air temperature in degrees Celsius.


stdTempDiff()

Syntax

stdTempDiff(pressureAltitude, oat)

Returns the ISA temperature difference: the difference between the standard temperature at a pressure altitude and the outside air temperature.

Parameters

Return value

The standard air temperature difference in degrees Celsius.


tempDiffCtoF()

Syntax

tempDiffCtoF(c)

Returns the ISA temperature difference in Fahrenheit given an ISA temperature difference in degrees Celsius.

Parameters

Return value

The standard air temperature difference in degrees Fahrenheit.


export function tempDiffFtoC (f) {

tempDiffFtoC()

Syntax

tempDiffFtoC(f)

Returns the ISA temperature difference in degrees Celsius given an ISA temperature difference in Fahrenheit.

Parameters

Return value

The standard air temperature difference in degrees Celsius.


Aircraft functions

fmtSerialNum()

Syntax

acType.fmtSerialNum()
acType.fmtSerialNum(serialNum)
acType.fmtSerialNum(serialNum, modelInfo)

This function returns a formatted version of an aircraft serial number, specified by serialNum, according to the parameters in modelInfo. If modelInfo has a serialFixedWidth property, then a serial number that is less than the required width, not including the prefix, will be extended with leading zeroes. If modelInfo has a serialPrefix property, then the serialPrefix is prepended to the (extended) serial number.

If modelData is omitted, then the current aircraft (acData) is used. If serialNum is omitted then the current serial number (acData.serialNumber) is used.

Parameters

Return value

A full serial number string of proper width, and includes the serial number prefix.


fmtSerialNum()

Syntax

acType.fmtSerialNum()
acType.fmtSerialNum(modelInfo)

This function returns a formatted version of the serial number range in modelInfo.serialNumbers. If modelInfo is omitted, then the current aircraft (acData) is used. The returned string converts the serial number range into a human-readable format. If modelInfo.serialFixedWidth is specified, then leading zeros are prepended to the serial number to make it the required width. Any prefix specified by modelInfo.serialPrefix is also prepended to each serial number.

For example, the serial number range string: 512-1024 with a fixed width of 5 and a prefix of '172' will be converted to "17200512 thru 17201024", and '1025-' will be converted to "17201025 and up".

Parameters

Return value

A string with a human-readable version of a serial number range string.