Skip to main content

Class: FlightPlanPredictor

Defined in: src/sdk/utils/predictions/FlightPlanPredictor.ts:16

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

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

Ctor

Parameters​

ParameterTypeDescription
busEventBusthe event bus
flightPlannerFlightPlannera 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

Accessors​

planAndPredictionsValid​

Get Signature​

get planAndPredictionsValid(): boolean

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

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

Returns​

boolean

boolean

Methods​

applyPredictionsForDistance()​

applyPredictionsForDistance(distance, out): void

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

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

Parameters​

ParameterTypeDescription
distancenumberthe distance
outActiveOrUpcomingLegPredictionsthe object in which to output the predictions

Returns​

void


findNextPredictedLegIndex()​

findNextPredictedLegIndex(legIndex): number

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

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

Parameters​

ParameterTypeDescription
legIndexnumberthe leg index to start at

Returns​

number

the index, or -1 if none is found


findPreviousPredictedLegIndex()​

findPreviousPredictedLegIndex(legIndex): number

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

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

Parameters​

ParameterTypeDescription
legIndexnumberthe leg index to start at

Returns​

number

the index, or -1 if none is found


getDestinationPrediction()​

getDestinationPrediction(destinationFacility): null | ActiveOrUpcomingLegPredictions

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

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​

ParameterTypeDescription
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


getPposToFacilityPredictions()​

getPposToFacilityPredictions(facility): ActiveOrUpcomingLegPredictions

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

Returns predictions for an arbitrary facility.

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

Parameters​

ParameterTypeDescription
facilityFacilitythe facility to use

Returns​

ActiveOrUpcomingLegPredictions

predictions for the facility


isLegIndexPredicted()​

isLegIndexPredicted(legIndex): boolean

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

Whether the leg at an index is predicted

Parameters​

ParameterTypeDescription
legIndexnumberthe target leg index

Returns​

boolean

boolean


isLegPredicted()​

isLegPredicted(leg): boolean

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

Whether the leg is predicted

Parameters​

ParameterTypeDescription
legLegDefinitionthe target leg

Returns​

boolean

boolean


iteratePredictions()​

iteratePredictions(startAtIndex): Generator<LegPredictions>

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

Iterator for existing predictions

Parameters​

ParameterTypeDefault valueDescription
startAtIndexnumber0the index to start at

Returns​

Generator<LegPredictions>

a generator

Yields​

predictions


iteratePredictionsReverse()​

iteratePredictionsReverse(startAtIndex): Generator<LegPredictions>

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

Iterator for existing predictions in reverse

Parameters​

ParameterTypeDefault valueDescription
startAtIndexnumber0the index to start at

Returns​

Generator<LegPredictions>

a generator

Yields​

predictions


predictionsForLeg()​

predictionsForLeg(leg): null | LegPredictions

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

Returns active or upcoming predictions for a given leg definition

Parameters​

ParameterTypeDescription
legLegDefinitionthe leg

Returns​

null | LegPredictions

the predictions object, or null if they cannot be computed


predictionsForLegIndex()​

predictionsForLegIndex(index): null | LegPredictions

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

Returns active or upcoming predictions for a given leg index

Parameters​

ParameterTypeDescription
indexnumberthe leg index

Returns​

null | LegPredictions

the predictions object, or null if they cannot be computed


reducePredictions()​

reducePredictions(initialValue, reducer, upTo): number

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

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

Parameters​

ParameterTypeDefault valueDescription
initialValuenumberundefinedinitial accumulator value
reducer(accumulator, predictions) => numberundefinedreducer function
upTonumber-1index to reduce to

Returns​

number

reduced value


update()​

update(): void

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

Updates the predictor

Returns​

void