flight-planner
Version:
Plan and route VFR flights
193 lines (192 loc) • 7.89 kB
TypeScript
import { Aircraft } from './aircraft.js';
/**
* Enum defining different flight phases used in performance calculations.
*
* @enum {string}
* @readonly
*/
export declare enum FlightPhase {
Taxi = "taxi",
Takeoff = "takeoff",
Climb = "climb",
Cruise = "cruise",
Descent = "descent",
Approach = "approach",
Landing = "landing"
}
/**
* Interface representing performance parameters for a specific flight phase.
*
* @interface PhasePerformance
* @property {number} fuelFlow - Fuel flow rate in liters or gallons per hour
* @property {number} speed - Speed in knots (TAS for climb/cruise/descent)
* @property {number} duration - Typical duration of the phase in minutes
* @property {number} rateOfClimbDescent - Rate of climb or descent in feet per minute (positive for climb, negative for descent)
*/
export interface PhasePerformance {
fuelFlow: number;
speed: number;
duration: number;
rateOfClimbDescent?: number;
}
/**
* Interface representing detailed aircraft performance data.
*
* @interface AircraftPerformanceProfile
* @property {Record<FlightPhase, PhasePerformance>} phasePerformance - Performance data for each flight phase
* @property {number} reserveFuel - Standard reserve fuel in liters or gallons
* @property {number} reserveFuelTime - Standard reserve fuel time in minutes
* @property {number} climbFuelAddition - Additional fuel percentage to add for climbs (e.g., 0.1 for 10%)
* @property {number} contingencyFuel - Contingency fuel percentage (e.g., 0.05 for 5%)
*/
export interface AircraftPerformanceProfile {
phasePerformance: Record<FlightPhase, PhasePerformance>;
reserveFuel: number;
reserveFuelTime: number;
climbFuelAddition: number;
contingencyFuel: number;
}
/**
* Interface representing distance segments for various flight phases.
*
* @interface DistanceSegments
* @property {number} climbDistance - Distance covered during climb in nautical miles
* @property {number} cruiseDistance - Distance covered during cruise in nautical miles
* @property {number} descentDistance - Distance covered during descent in nautical miles
* @property {number} totalDistance - Total distance in nautical miles
*/
export interface DistanceSegments {
climbDistance: number;
cruiseDistance: number;
descentDistance: number;
totalDistance: number;
}
/**
* Interface representing time segments for various flight phases.
*
* @interface TimeSegments
* @property {number} taxiTime - Time spent taxiing in minutes
* @property {number} takeoffTime - Time spent in takeoff phase in minutes
* @property {number} climbTime - Time spent climbing in minutes
* @property {number} cruiseTime - Time spent in cruise in minutes
* @property {number} descentTime - Time spent in descent in minutes
* @property {number} approachTime - Time spent in approach phase in minutes
* @property {number} landingTime - Time spent in landing phase in minutes
* @property {number} totalTime - Total flight time in minutes
*/
export interface TimeSegments {
taxiTime: number;
takeoffTime: number;
climbTime: number;
cruiseTime: number;
descentTime: number;
approachTime: number;
landingTime: number;
totalTime: number;
}
/**
* Interface representing fuel consumption for various flight phases.
*
* @interface FuelSegments
* @property {number} taxiFuel - Fuel used during taxi in liters/gallons
* @property {number} takeoffFuel - Fuel used during takeoff in liters/gallons
* @property {number} climbFuel - Fuel used during climb in liters/gallons
* @property {number} cruiseFuel - Fuel used during cruise in liters/gallons
* @property {number} descentFuel - Fuel used during descent in liters/gallons
* @property {number} approachFuel - Fuel used during approach in liters/gallons
* @property {number} landingFuel - Fuel used during landing in liters/gallons
* @property {number} contingencyFuel - Additional contingency fuel in liters/gallons
* @property {number} reserveFuel - Reserve fuel in liters/gallons
* @property {number} alternateFuel - Fuel to reach alternate airport in liters/gallons
* @property {number} totalTripFuel - Total trip fuel excluding reserves in liters/gallons
* @property {number} totalFuelRequired - Total fuel required including reserves in liters/gallons
*/
export interface FuelSegments {
taxiFuel: number;
takeoffFuel: number;
climbFuel: number;
cruiseFuel: number;
descentFuel: number;
approachFuel: number;
landingFuel: number;
contingencyFuel: number;
reserveFuel: number;
alternateFuel: number;
totalTripFuel: number;
totalFuelRequired: number;
}
/**
* Interface representing a complete flight performance calculation result.
*
* @interface FlightPerformance
* @property {DistanceSegments} distance - Distance segments breakdown
* @property {TimeSegments} time - Time segments breakdown
* @property {FuelSegments} fuel - Fuel segments breakdown
* @property {Date} departureTime - Planned departure time
* @property {Date} arrivalTime - Estimated arrival time
*/
export interface FlightPerformance {
distance: DistanceSegments;
time: TimeSegments;
fuel: FuelSegments;
departureTime: Date;
arrivalTime: Date;
}
/**
* Calculates the standard rate of climb for an aircraft based on its type.
*
* @param aircraft - The aircraft object containing type and performance data
* @param pressureAltitude - Pressure altitude in feet
* @param temperature - Temperature in Celsius
* @returns The standard rate of climb in feet per minute
*/
export declare function calculateRateOfClimb(aircraft: Aircraft, pressureAltitude?: number, temperature?: number): number;
/**
* Calculates the standard rate of descent for an aircraft based on its type.
*
* @param aircraft - The aircraft object containing type and performance data
* @returns The standard rate of descent in feet per minute (returned as a negative number)
*/
export declare function calculateRateOfDescent(aircraft: Aircraft): number;
/**
* Creates a default performance profile for an aircraft based on its characteristics.
*
* @param aircraft - The aircraft object to create a performance profile for
* @returns A performance profile with estimated values based on aircraft type
*/
export declare function createDefaultPerformanceProfile(aircraft: Aircraft): AircraftPerformanceProfile;
/**
* Calculates distance covered during climb.
*
* @param aircraft - The aircraft object
* @param cruiseAltitude - Target cruise altitude in feet
* @param profile - Performance profile for the aircraft
* @returns Distance covered during climb in nautical miles
*/
export declare function calculateClimbDistance(aircraft: Aircraft, cruiseAltitude: number, profile: AircraftPerformanceProfile): number;
/**
* Calculates distance covered during descent.
*
* @param aircraft - The aircraft object
* @param cruiseAltitude - Starting cruise altitude in feet
* @param profile - Performance profile for the aircraft
* @returns Distance covered during descent in nautical miles
*/
export declare function calculateDescentDistance(aircraft: Aircraft, cruiseAltitude: number, profile: AircraftPerformanceProfile): number;
/**
* Calculates detailed performance for a route segment.
*
* @param distance - Total distance in nautical miles
* @param aircraft - The aircraft being used
* @param cruiseAltitude - Cruise altitude in feet
* @param options - Optional calculation parameters
* @returns Detailed flight performance data
*/
export declare function calculateDetailedPerformance(distance: number, aircraft: Aircraft, cruiseAltitude?: number, options?: {
departureTime?: Date;
headwind?: number;
temperature?: number;
pressureAltitude?: number;
alternateDistance?: number;
performanceProfile?: AircraftPerformanceProfile;
}): FlightPerformance;