@squawk
    Preparing search index...

    Function computeRouteTiming

    • Computes wind-corrected per-leg timing for a parsed flight plan route.

      Reuses computeRouteDistance for the leg geometry, then for each leg derives the initial true course, samples the wind at the leg midpoint via the optional WindProvider, and solves the wind triangle for heading, wind correction angle, and ground speed. Estimated time enroute is leg distance divided by ground speed, and fuel (when a burn rate is given) follows from the same ground speed.

      When the provider returns undefined for a leg, that leg is timed as calm: heading equals course, wind correction angle is zero, and ground speed equals true airspeed.

      Ground speed comes from solveWindTriangle as a magnitude, so it is never negative. A leg is left untimed (eteHrs undefined) only when ground speed is not positive, which occurs at the boundary where a pure headwind equals true airspeed. A headwind exceeding true airspeed still yields a positive magnitude and inherits the clamping behavior documented on solveWindTriangle; such legs are not separately flagged here. A single untimed leg makes totalEteHrs (and totalFuelRequired, when fuel is requested) undefined.

      import { createFlightplanResolver, computeRouteTiming } from '@squawk/flightplan';

      const resolver = createFlightplanResolver({ airports, navaids, fixes, airways });
      const route = resolver.parse('KJFK DCT MERIT J60 MARTN DCT KLAX');
      const result = computeRouteTiming(route, {
      trueAirspeedKt: 450,
      windProvider: (lat, lon) => ({ directionDeg: 270, speedKt: 80 }),
      fuelBurnPerHr: 600,
      });
      console.log(result.totalEteHrs, result.totalFuelRequired);

      Parameters

      Returns RouteTimingResult

      Per-leg wind-corrected timing with route totals.