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
Parameter | Type | Description |
---|---|---|
bus | EventBus | the event bus |
flightPlanner | FlightPlanner | a flight planner |
planIndexSub | Subscribable <number > | a subscribable regarding the index of the flight plan we want to predict for |
activeLegIndexSub | Subscribable <number > | a subscribable regarding the index of the displayed active leg, specific to the avionics suite |
config | FlightPlanPredictorConfiguration | configuration 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
Parameter | Type | Description |
---|---|---|
distance | number | the distance |
out | ActiveOrUpcomingLegPredictions | the 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
Parameter | Type | Description |
---|---|---|
legIndex | number | the 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
Parameter | Type | Description |
---|---|---|
legIndex | number | the 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
Parameter | Type | Description |
---|---|---|
destinationFacility | AirportFacility | the 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
Parameter | Type | Description |
---|---|---|
facility | Facility | the 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
Parameter | Type | Description |
---|---|---|
legIndex | number | the 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
Parameter | Type | Description |
---|---|---|
leg | LegDefinition | the target leg |
Returns
boolean
boolean
iteratePredictions()
iteratePredictions(
startAtIndex
):Generator
<LegPredictions
>
Defined in: src/sdk/utils/predictions/FlightPlanPredictor.ts:230
Iterator for existing predictions
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
startAtIndex | number | 0 | the 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
Parameter | Type | Default value | Description |
---|---|---|---|
startAtIndex | number | 0 | the 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
Parameter | Type | Description |
---|---|---|
leg | LegDefinition | the 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
Parameter | Type | Description |
---|---|---|
index | number | the 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
Parameter | Type | Default value | Description |
---|---|---|---|
initialValue | number | undefined | initial accumulator value |
reducer | (accumulator , predictions ) => number | undefined | reducer function |
upTo | number | -1 | index to reduce to |
Returns
number
reduced value
update()
update():
void
Defined in: src/sdk/utils/predictions/FlightPlanPredictor.ts:91
Updates the predictor
Returns
void