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
Name | Type | Description |
---|---|---|
bus | EventBus | the event bus |
flightPlanner | FlightPlanner <any > | 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
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
Name | Type | Description |
---|---|---|
distance | number | the distance |
out | ActiveOrUpcomingLegPredictions | the 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
Name | Type | Description |
---|---|---|
legIndex | number | the 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
Name | Type | Description |
---|---|---|
legIndex | number | the 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
Name | 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
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
Name | Type | Description |
---|---|---|
facility | Facility | the 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
Name | Type | Description |
---|---|---|
legIndex | number | the 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
Name | Type | Description |
---|---|---|
leg | LegDefinition | the 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
Name | Type | Default value | Description |
---|---|---|---|
startAtIndex | number | 0 | the 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
Name | Type | Default value | Description |
---|---|---|---|
startAtIndex | number | 0 | the 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
Name | Type | Description |
---|---|---|
leg | LegDefinition | the 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
Name | Type | Description |
---|---|---|
index | number | the 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
Name | Type | Default value | Description |
---|---|---|---|
initialValue | number | undefined | initial accumulator value |
reducer | (accumulator : number , predictions : ActiveOrUpcomingLegPredictions ) => number | undefined | reducer function |
upTo | number | -1 | index 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