Skip to main content

Class: FlightPlanPredictor

Creates leg-by-leg predictions for a flight plan, both in the future by estimating performance and in the past by recording predicted data and actual achieved performance.

Constructors

constructor

new FlightPlanPredictor(bus, flightPlanner, planIndexSub, activeLegIndexSub, config): FlightPlanPredictor

Ctor

Parameters

NameTypeDescription
busEventBusthe event bus
flightPlannerFlightPlanner<any>a flight planner
planIndexSubSubscribable<number>a subscribable regarding the index of the flight plan we want to predict for
activeLegIndexSubSubscribable<number>a subscribable regarding the index of the displayed active leg, specific to the avionics suite
configFlightPlanPredictorConfigurationconfiguration object

Returns

FlightPlanPredictor

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:33

Accessors

planAndPredictionsValid

get planAndPredictionsValid(): boolean

Whether the flight plan exists and has an active lateral leg index >= 1

Returns

boolean

boolean

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:48

Methods

applyPredictionsForDistance

applyPredictionsForDistance(distance, out): void

Applies active or upcoming predictions for a given distance, outputting the result in the out argument

Parameters

NameTypeDescription
distancenumberthe distance
outActiveOrUpcomingLegPredictionsthe object in which to output the predictions

Returns

void

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:392


findNextPredictedLegIndex

findNextPredictedLegIndex(legIndex): number

Returns the previous index for which a prediction exists. Note: this will force an update to happen.

Parameters

NameTypeDescription
legIndexnumberthe leg index to start at

Returns

number

the index, or -1 if none is found

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:448


findPreviousPredictedLegIndex

findPreviousPredictedLegIndex(legIndex): number

Returns the previous index for which a prediction exists. Note: this will force an update to happen.

Parameters

NameTypeDescription
legIndexnumberthe leg index to start at

Returns

number

the index, or -1 if none is found

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:427


getDestinationPrediction

getDestinationPrediction(destinationFacility): null | ActiveOrUpcomingLegPredictions

Returns predictions for the destination airport.

If the dest leg (defined as the last leg that is not part of the missed approach) is not a runway, then the direct distance between the termination of that leg and the provided airport facility is added to the result. Otherwise, the prediction to that leg is used.

Parameters

NameTypeDescription
destinationFacilityAirportFacilitythe airport facility to use in case a direct distance needs to be calculated

Returns

null | ActiveOrUpcomingLegPredictions

predictions for the destination airport, or null if they cannot be computed

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:262


getPposToFacilityPredictions

getPposToFacilityPredictions(facility): ActiveOrUpcomingLegPredictions

Returns predictions for an arbitrary facility.

The distance used for predictions is the great circle distance between PPOS and the given facility.

Parameters

NameTypeDescription
facilityFacilitythe facility to use

Returns

ActiveOrUpcomingLegPredictions

predictions for the facility

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:332


isLegIndexPredicted

isLegIndexPredicted(legIndex): boolean

Whether the leg at an index is predicted

Parameters

NameTypeDescription
legIndexnumberthe target leg index

Returns

boolean

boolean

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:403


isLegPredicted

isLegPredicted(leg): boolean

Whether the leg is predicted

Parameters

NameTypeDescription
legLegDefinitionthe target leg

Returns

boolean

boolean

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:414


iteratePredictions

iteratePredictions(startAtIndex?): Generator<LegPredictions, any, unknown>

Iterator for existing predictions

Parameters

NameTypeDefault valueDescription
startAtIndexnumber0the index to start at

Returns

Generator<LegPredictions, any, unknown>

a generator

Yields

predictions

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:230


iteratePredictionsReverse

iteratePredictionsReverse(startAtIndex?): Generator<LegPredictions, any, unknown>

Iterator for existing predictions in reverse

Parameters

NameTypeDefault valueDescription
startAtIndexnumber0the index to start at

Returns

Generator<LegPredictions, any, unknown>

a generator

Yields

predictions

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:245


predictionsForLeg

predictionsForLeg(leg): null | LegPredictions

Returns active or upcoming predictions for a given leg definition

Parameters

NameTypeDescription
legLegDefinitionthe leg

Returns

null | LegPredictions

the predictions object, or null if they cannot be computed

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:376


predictionsForLegIndex

predictionsForLegIndex(index): null | LegPredictions

Returns active or upcoming predictions for a given leg index

Parameters

NameTypeDescription
indexnumberthe leg index

Returns

null | LegPredictions

the predictions object, or null if they cannot be computed

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:365


reducePredictions

reducePredictions(initialValue, reducer, upTo?): number

Applies a reducer function to the predictions of active and upcoming legs

Parameters

NameTypeDefault valueDescription
initialValuenumberundefinedinitial accumulator value
reducer(accumulator: number, predictions: ActiveOrUpcomingLegPredictions) => numberundefinedreducer function
upTonumber-1index to reduce to

Returns

number

reduced value

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:471


update

update(): void

Updates the predictor

Returns

void

Defined in

src/sdk/utils/predictions/FlightPlanPredictor.ts:91