@squawk/flight-math
Advanced tools
| /** | ||
| * Flight planning calculations: fuel burn estimation, endurance, range, | ||
| * point-of-no-return (PNR), and equal-time-point (ETP). Classic E6B | ||
| * computations where the consumer provides ground speed as input. | ||
| */ | ||
| import type { PlanningPoint } from './types/planning.js'; | ||
| /** | ||
| * Computes the fuel required for a flight leg given distance, ground speed, | ||
| * and fuel burn rate. | ||
| * | ||
| * The result is in the same unit as `fuelBurnPerHr` (gallons, liters, pounds, | ||
| * etc.) - the function is unit-agnostic for fuel quantity. | ||
| * | ||
| * @param distanceNm - Leg distance in nautical miles. | ||
| * @param groundSpeedKt - Ground speed in knots. | ||
| * @param fuelBurnPerHr - Fuel burn rate per hour (in any consistent unit). | ||
| * @returns Fuel required for the leg (same unit as `fuelBurnPerHr`). | ||
| */ | ||
| export declare function fuelRequired(distanceNm: number, groundSpeedKt: number, fuelBurnPerHr: number): number; | ||
| /** | ||
| * Computes the endurance (time aloft) given available fuel and burn rate. | ||
| * | ||
| * @param fuelAvailable - Fuel on board (in any consistent unit). | ||
| * @param fuelBurnPerHr - Fuel burn rate per hour (same unit as `fuelAvailable`). | ||
| * @returns Endurance in hours. | ||
| */ | ||
| export declare function endurance(fuelAvailable: number, fuelBurnPerHr: number): number; | ||
| /** | ||
| * Computes the maximum distance the aircraft can fly on available fuel at a | ||
| * given ground speed and burn rate. | ||
| * | ||
| * @param fuelAvailable - Fuel on board (in any consistent unit). | ||
| * @param fuelBurnPerHr - Fuel burn rate per hour (same unit as `fuelAvailable`). | ||
| * @param groundSpeedKt - Ground speed in knots. | ||
| * @returns Maximum range in nautical miles. | ||
| */ | ||
| export declare function enduranceDistanceNm(fuelAvailable: number, fuelBurnPerHr: number, groundSpeedKt: number): number; | ||
| /** | ||
| * Computes the point of no return (PNR), also called the point of safe return | ||
| * (PSR). This is the farthest distance from departure beyond which the aircraft | ||
| * cannot return to the departure point with the fuel remaining. | ||
| * | ||
| * Two separate ground speed parameters allow the consumer to account for wind: | ||
| * outbound ground speed may differ from the return ground speed due to | ||
| * headwind/tailwind components. | ||
| * | ||
| * @param fuelAvailable - Fuel on board (in any consistent unit). | ||
| * @param fuelBurnPerHr - Fuel burn rate per hour (same unit as `fuelAvailable`). | ||
| * @param groundSpeedOutKt - Ground speed on the outbound leg in knots. | ||
| * @param groundSpeedBackKt - Ground speed on the return leg in knots. | ||
| * @returns The PNR as a {@link PlanningPoint} (distance and time from departure). | ||
| */ | ||
| export declare function pointOfNoReturn(fuelAvailable: number, fuelBurnPerHr: number, groundSpeedOutKt: number, groundSpeedBackKt: number): PlanningPoint; | ||
| /** | ||
| * Computes the equal-time-point (ETP), also called the critical point (CP). | ||
| * This is the point along a route where it takes the same time to continue to | ||
| * the destination as it does to return to the departure point. | ||
| * | ||
| * Two separate ground speed parameters allow the consumer to account for wind: | ||
| * the ground speed continuing to the destination may differ from the return | ||
| * ground speed. | ||
| * | ||
| * @param totalDistanceNm - Total route distance in nautical miles. | ||
| * @param groundSpeedOutKt - Ground speed continuing toward the destination in knots. | ||
| * @param groundSpeedBackKt - Ground speed returning toward the departure in knots. | ||
| * @returns The ETP as a {@link PlanningPoint} (distance and time from departure). | ||
| */ | ||
| export declare function equalTimePoint(totalDistanceNm: number, groundSpeedOutKt: number, groundSpeedBackKt: number): PlanningPoint; | ||
| //# sourceMappingURL=planning.d.ts.map |
| {"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../src/planning.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GACpB,MAAM,CAGR;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GACpB,MAAM,CAER;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,EACxB,iBAAiB,EAAE,MAAM,GACxB,aAAa,CAOf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,EACxB,iBAAiB,EAAE,MAAM,GACxB,aAAa,CAIf"} |
| /** | ||
| * Flight planning calculations: fuel burn estimation, endurance, range, | ||
| * point-of-no-return (PNR), and equal-time-point (ETP). Classic E6B | ||
| * computations where the consumer provides ground speed as input. | ||
| */ | ||
| /** | ||
| * Computes the fuel required for a flight leg given distance, ground speed, | ||
| * and fuel burn rate. | ||
| * | ||
| * The result is in the same unit as `fuelBurnPerHr` (gallons, liters, pounds, | ||
| * etc.) - the function is unit-agnostic for fuel quantity. | ||
| * | ||
| * @param distanceNm - Leg distance in nautical miles. | ||
| * @param groundSpeedKt - Ground speed in knots. | ||
| * @param fuelBurnPerHr - Fuel burn rate per hour (in any consistent unit). | ||
| * @returns Fuel required for the leg (same unit as `fuelBurnPerHr`). | ||
| */ | ||
| export function fuelRequired(distanceNm, groundSpeedKt, fuelBurnPerHr) { | ||
| const timeHrs = distanceNm / groundSpeedKt; | ||
| return timeHrs * fuelBurnPerHr; | ||
| } | ||
| /** | ||
| * Computes the endurance (time aloft) given available fuel and burn rate. | ||
| * | ||
| * @param fuelAvailable - Fuel on board (in any consistent unit). | ||
| * @param fuelBurnPerHr - Fuel burn rate per hour (same unit as `fuelAvailable`). | ||
| * @returns Endurance in hours. | ||
| */ | ||
| export function endurance(fuelAvailable, fuelBurnPerHr) { | ||
| return fuelAvailable / fuelBurnPerHr; | ||
| } | ||
| /** | ||
| * Computes the maximum distance the aircraft can fly on available fuel at a | ||
| * given ground speed and burn rate. | ||
| * | ||
| * @param fuelAvailable - Fuel on board (in any consistent unit). | ||
| * @param fuelBurnPerHr - Fuel burn rate per hour (same unit as `fuelAvailable`). | ||
| * @param groundSpeedKt - Ground speed in knots. | ||
| * @returns Maximum range in nautical miles. | ||
| */ | ||
| export function enduranceDistanceNm(fuelAvailable, fuelBurnPerHr, groundSpeedKt) { | ||
| return endurance(fuelAvailable, fuelBurnPerHr) * groundSpeedKt; | ||
| } | ||
| /** | ||
| * Computes the point of no return (PNR), also called the point of safe return | ||
| * (PSR). This is the farthest distance from departure beyond which the aircraft | ||
| * cannot return to the departure point with the fuel remaining. | ||
| * | ||
| * Two separate ground speed parameters allow the consumer to account for wind: | ||
| * outbound ground speed may differ from the return ground speed due to | ||
| * headwind/tailwind components. | ||
| * | ||
| * @param fuelAvailable - Fuel on board (in any consistent unit). | ||
| * @param fuelBurnPerHr - Fuel burn rate per hour (same unit as `fuelAvailable`). | ||
| * @param groundSpeedOutKt - Ground speed on the outbound leg in knots. | ||
| * @param groundSpeedBackKt - Ground speed on the return leg in knots. | ||
| * @returns The PNR as a {@link PlanningPoint} (distance and time from departure). | ||
| */ | ||
| export function pointOfNoReturn(fuelAvailable, fuelBurnPerHr, groundSpeedOutKt, groundSpeedBackKt) { | ||
| const enduranceHrs = endurance(fuelAvailable, fuelBurnPerHr); | ||
| const distanceNm = enduranceHrs * | ||
| ((groundSpeedOutKt * groundSpeedBackKt) / (groundSpeedOutKt + groundSpeedBackKt)); | ||
| const timeHrs = distanceNm / groundSpeedOutKt; | ||
| return { distanceNm, timeHrs }; | ||
| } | ||
| /** | ||
| * Computes the equal-time-point (ETP), also called the critical point (CP). | ||
| * This is the point along a route where it takes the same time to continue to | ||
| * the destination as it does to return to the departure point. | ||
| * | ||
| * Two separate ground speed parameters allow the consumer to account for wind: | ||
| * the ground speed continuing to the destination may differ from the return | ||
| * ground speed. | ||
| * | ||
| * @param totalDistanceNm - Total route distance in nautical miles. | ||
| * @param groundSpeedOutKt - Ground speed continuing toward the destination in knots. | ||
| * @param groundSpeedBackKt - Ground speed returning toward the departure in knots. | ||
| * @returns The ETP as a {@link PlanningPoint} (distance and time from departure). | ||
| */ | ||
| export function equalTimePoint(totalDistanceNm, groundSpeedOutKt, groundSpeedBackKt) { | ||
| const distanceNm = totalDistanceNm * (groundSpeedBackKt / (groundSpeedOutKt + groundSpeedBackKt)); | ||
| const timeHrs = distanceNm / groundSpeedOutKt; | ||
| return { distanceNm, timeHrs }; | ||
| } |
| /** | ||
| * Planning-related type definitions for fuel burn, point-of-no-return, | ||
| * and equal-time-point calculations. | ||
| */ | ||
| /** | ||
| * A computed point along a route, expressed as both a distance and time | ||
| * from the departure point. Returned by {@link planning.pointOfNoReturn} | ||
| * and {@link planning.equalTimePoint}. | ||
| */ | ||
| export interface PlanningPoint { | ||
| /** Distance from departure in nautical miles. */ | ||
| distanceNm: number; | ||
| /** Time from departure in hours. */ | ||
| timeHrs: number; | ||
| } | ||
| //# sourceMappingURL=planning.d.ts.map |
| {"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../src/types/planning.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB"} |
| /** | ||
| * Planning-related type definitions for fuel burn, point-of-no-return, | ||
| * and equal-time-point calculations. | ||
| */ | ||
| export {}; |
+1
-0
@@ -23,2 +23,3 @@ /** | ||
| export * as magnetic from './magnetic.js'; | ||
| export * as planning from './planning.js'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,kBAAkB,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,kBAAkB,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC"} |
+1
-0
@@ -23,1 +23,2 @@ /** | ||
| export * as magnetic from './magnetic.js'; | ||
| export * as planning from './planning.js'; |
@@ -8,2 +8,3 @@ /** | ||
| export * from './magnetic.js'; | ||
| export * from './planning.js'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"} |
@@ -8,1 +8,2 @@ /** | ||
| export * from './magnetic.js'; | ||
| export * from './planning.js'; |
+1
-1
| { | ||
| "name": "@squawk/flight-math", | ||
| "version": "0.3.1", | ||
| "version": "0.4.0", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Aviation flight computer calculations - the programmatic equivalent of an E6B", |
117387
8.71%59
11.32%2199
8.7%