G3000 Initialization
Introduction
The G3000 initialization feature (sometimes referred to as FMS initialization or avionics initialization) guides users through a list of pre-flight tasks every time the system powers up.
By default, the initialization feature is disabled in the G3000. In order to enable the feature in an airplane installation, you must create an instance of InitializationProcess
and return it via an MFD plugin's getInitializationProcess()
method.
The following sections will walk you through how to configure the feature using InitializationProcess
.
Choosing an ID
Each InitializationProcess
must be created with an ID string. The ID can be any arbitrary string and is mainly meant to be used by plugins to positively identify a particular InitializationProcess
instance. For example, because an InitializationProcess
returned by one plugin can be "overridden" by another plugin, a plugin can compare the ID of the process ultimately chosen by the G3000 system with the one it returned and take some action only if the IDs are the same.
Configuring Tasks
The initialization process is comprised of one or more tasks. All tasks must be completed in order for initialization to be completed. Tasks are presented to the user in a particular order with the intention that the tasks are completed in that order, but there is no strict requirement that the user must complete the tasks in order.
InitializationProcess
provides its tasks as an array via the tasks
property. The order of the tasks in the array determines the order in which the tasks are presented to the user.
An InitializationProcess
that does not define any tasks is treated as invalid and will lead to the initialization feature being disabled.
A task represents an action or set of related actions that the user must complete. Each task is associated with a particular GTC page. When selecting the task from the GTC Initialization page or advancing through tasks using the "Next" button, the associated GTC page is opened. Typically the associated page is where the user would complete the action(s) required by the task. Each task also has a completion state. The logic that governs whether a task is considered complete can be defined independently for each task.
Each task is implemented as an instance of InitializationTask
. The interface requires the following properties to be defined:
Name | Description |
---|---|
uid | The task's unique ID string. The ID must be unique across all tasks defined by the initialization process. |
label | The label text displayed for the task on the GTC Initialization page (see image below). |
iconSrc | The absolute path to the image asset to use for the icon displayed for the task on the GTC Initialization page (see image below). |
gtcPageKey | The key of the GTC page view associated with this task. |
isCompleted | A Subscribable that provides whether the task is considered complete. |
Configuring Reset
The user has the ability to reset the initialization process at any time. Resetting initialization should trigger state-modifying effects tied to each task defined by the process. These effects are implemented using the onReset()
callback method on InitializationProcess
. There are no enforced restrictions on what should happen in onReset()
, but it is recommended to implement it such that all tasks revert to the uncompleted state.
onReset()
is only called when the user manually resets the initialization process. It is not called when the G3000 system is power cycled.
When the user attempts to reset the initialization process in the GTC Initialization page, a popup confirmation dialog is displayed along with a message (see image below). This message is defined using the resetMessage
property on InitializationProcess
. Forced linebreaks can be inserted in the message using the newline character ('\n'
).
Listening to Initialization State
Plugins can monitor the state of the initialization process using the event bus. The InitializationEvents
interface defines the event bus topics to which initialization state data is published. GTC plugins also have access to initialization state data via GtcService::initializationDataProvider
, which provides an instance of InitializationDataProvider
.
Controlling Initialization State
The base G3000 package handles all typical user interaction with the initialization feature. However, if you require the ability to programmatically modify initialization state, you can do so by publishing the event bus topics defined in InitializationControlEvents
.
Example
The following example code creates a plugin that returns an initialization process with two commonly encountered tasks: initializing the active flight plan and initializing weight and fuel data.
import { ConsumerSubject, EventBus, registerPlugin, Subject, Subscribable } from '@microsoft/msfs-sdk';
import { Fms } from '@microsoft/msfs-garminsdk';
import {
FlightPlanStore, FuelTotalizerControlEvents, G3000FilePaths, GtcViewKeys, InitializationProcess, InitializationTask,
WeightFuelEvents, WeightFuelUserSettings
} from '@microsoft/msfs-wtg3000-common';
import { AbstractG3000MfdPlugin } from '@microsoft/msfs-wtg3000-mfd';
class ExampleInitializationPlugin extends AbstractG3000MfdPlugin {
public getInitializationProcess(): InitializationProcess {
return new ExampleInitializationProcess(this.binder.bus, this.binder.fms, this.binder.flightPlanStore);
}
}
registerPlugin(ExampleInitializationPlugin);
/**
* An example initialization process that defines two tasks: Flight Plan and Weight and Fuel.
*/
class ExampleInitializationProcess implements InitializationProcess {
public readonly id = 'example';
public readonly tasks: readonly InitializationTask[];
public readonly resetMessage = 'Resetting Init Clears:\nActive Flight Plan, Weight Data';
private readonly weightFuelSettingManager = WeightFuelUserSettings.getManager(this.bus);
public constructor(private readonly bus: EventBus, private readonly fms: Fms, flightPlanStore: FlightPlanStore) {
this.tasks = [
new ExampleFlightPlanInitializationTask(fms, flightPlanStore),
new ExampleWeightFuelInitializationTask(bus)
];
}
public async onReset(): Promise<void> {
// On reset:
// - Clear all flight plans.
// - Reset fuel on board and cargo weight settings to their default (un-initialized) values,
// and reset the fuel totalizer's fuel remaining value to zero.
await this.fms.resetAllFlightPlans();
this.weightFuelSettingManager.getSetting('weightFuelInitialFob').value = -1;
this.weightFuelSettingManager.getSetting('weightFuelCargo').value = 0;
this.bus.getPublisher<FuelTotalizerControlEvents>().pub('fuel_totalizer_set_remaining', 0, true, false);
}
}
/**
* An example flight plan initialization task. This task requires the user to create an active flight plan with at
* least two legs (single-leg flight plans are not considered valid flight plans in the G3000).
*/
class ExampleFlightPlanInitializationTask implements InitializationTask {
public readonly uid = 'flight-plan';
public readonly label = 'Flight Plan';
public readonly iconSrc = `${G3000FilePaths.ASSETS_PATH}/Images/GTC/icon_small_fplan.png`;
public readonly gtcPageKey = GtcViewKeys.FlightPlan;
private readonly _isCompleted = Subject.create(false);
public readonly isCompleted = this._isCompleted as Subscribable<boolean>;
public constructor(private readonly fms: Fms, flightPlanStore: FlightPlanStore) {
this.updateCompleted();
flightPlanStore.flightPlanLegsChanged.on(this.updateCompleted.bind(this));
}
private updateCompleted(): void {
this._isCompleted.set(this.fms.hasPrimaryFlightPlan() && this.fms.getPrimaryFlightPlan().length > 1);
}
}
/**
* An example weight and fuel initialization task. This task requires the user to initialize weight and fuel data
* such that a valid aircraft weight can be computed.
*/
class ExampleWeightFuelInitializationTask implements InitializationTask {
public readonly uid = 'weight-fuel';
public readonly label = 'Weight and\nFuel';
public readonly iconSrc = `${G3000FilePaths.ASSETS_PATH}/Images/GTC/icon_weight_fuel.png`;
public readonly gtcPageKey = GtcViewKeys.WeightAndFuel;
private readonly aircraftWeight = ConsumerSubject.create(null, -1);
public readonly isCompleted = this.aircraftWeight.map(weight => weight >= 0) as Subscribable<boolean>;
public constructor(bus: EventBus) {
this.aircraftWeight.setConsumer(bus.getSubscriber<WeightFuelEvents>().on('weightfuel_aircraft_weight'));
}
}
The following image shows the GTC Initialization page generated using the above example code.