acType reference

table of contents


Introduction

The acType object controls the presentation of aircraft data based on the selected aircraft model, serial number, and the selected options. The aircraft data may contain both data and methods. The data for the currently selected aircraft and options in assembled in the acData object. The acData object is global and does not need to be imported. It represents the POH data and the associated computation methods for a particular Pilot's Operating Handbook, Owner's Handbook, or Owner's Manua (we'll call all these POH), as amended by any Airplane Flight Manual Supplements (AFMS) for selected options.

Typically, the Aircraft page allows the user to configure and select aircraft and also sets the ac_data state variable to the contents of acData whenever a new model, serial number, or options are selected. This allows pages to use ac_data to trigger Model computations.

Internal and external model IDs

Each aircraft type (e.g., Beech Bonanza) may have several aircraft models (e.g., A36, V35, etc.). Sometimes, an aircraft model has more than one associated POH (e.g., Bonanza A36). The correct POH is selected by the serial number. The model name that the user associated with the aircraft (e.g., A36) is the "external" model. The set of data that is associated with a specific POH is the "internal" model. An internal model name is the external model name with a suffix consisting of a "#" followed by a string specifying the POH.

Serial numbers and ranges

Serial numbers consist of an alphanumeric prefix that does not vary within the model and can be empty, followed by a numeric string that varies with individual aircraft.

Applicable serial number ranges are specified by a string containing the following elements:

The isInSerialNums() method tests whether a specific serial number (without the prefix) falls within a serial number range string. The isValidSerialNumber() method return true if the serial number is valid for a particular internal model ID.

A model serial number can have a fixed width. If it does, the numeric part of the serial number may be extended with leading zeros as required. The serial numbers in serial number range strings need not contain leading zeros.

Creating aircraft models

Models are created by calling acType.createModel(), which takes an info object as a parameter. The object contains the following properties:

In POH Performance aircraft apps, the Aircraft page imports all the relevant model files to cause them to be loaded. This means that the aircraft models are already defined when the page's init() method is called, at which time the model selector state variable can be configured.

Type-wide data

Some aircraft data applies across all types that the app supports. Examples of type-wide data are risk parameters, the aircraft icon, the fuel type, and default methods, etc. These properties are included in all assembled aircraft data in acData. The type-wide data is set by calling acType.setTypeData(). The type-wide data can be overridden by the data in selected models or options if required.

Type-wide methods (e.g. tko.roll, climb.rate, ldg.roll) defined via setTypeData() form the base methods for every model in the type. A model file does not need to call modelDataMergeUnder() or otherwise re-declare these methods to get them — acType.init() merges each model's data over a copy of the type-wide data once at startup, and acType.setAcData() then copies that merged data. A model only needs to declare a method if it wants to override the type-wide default.

This automatic merging is also why option data functions receive a modelData argument that already contains the type-wide base methods: see Merging option data.

Merging aircraft-specific data

The type-wide data may include a type-specific data merge method mergeModelData which has the signature:

mergeModelData(target, ...sources)

If no mergeModelData method is provided, then objectOverlay() is used. The acType.init() method uses it to merge each model's data into a copy of the type-wide data once at startup. The acType.setAcData() method copies that merged model data to build the current aircraft object in acData, and uses the same method to merge data for the installed options into it.

The type-wide data may also include an isModelDataConflict(data1, data2) function. Installing options calls it to decide whether the data of two installed options conflict, and asserts if so. If it is absent, two option data objects conflict when they share any top-level key. A type can supply its own function to judge conflicts on nested keys. The function is read from the aircraft data (acData), so it only takes effect through the type-wide data.

If the aircraft data contains nested objects that must be overridden instead of overlayed when aircraft data is merged, then a mergeModelData method must be provided. Often, this method utilizes objectMergePathsOver() to merge only specific nested objects.

Options

Options are optional features that either have a separate AFMS or are embedded in the POH. Each option has an ID and separate data and methods that modify the base data and methods of the aircraft model they are applied to. Each option is identified by an option ID string and has an associated data object containing the modifications to the base model data.

Like model IDs, option IDs can have internal and external versions in cases where the same selected option has different data depending on the model or serial number. Like model IDs, the external and internal parts of the ID string are separated by "#". Each defined option must have a unique internal ID. Each internal option ID must apply to a unique combination of model and serial number. It is an error for a selected external option ID in a given aircraft to apply to more than one internal option ID.

Applicability string

Options are restricted to apply to a specified set of model IDs and serial numbers. These are specified by an applicability string composed of ${modelId}:${serialNumRange}. The modelId is an internal model ID or a RegExp string (without the surrounding '/'), and serialNumRange is a serial number range string or '-' that matches all serial numbers for the matching model IDs. Multiple models and serial ranges can be specified by separating them with a ';'. For example: A36#2:- matches all serial numbers associated the second A36 POH, and A36:-;G36:- or [AG]36:- match all serial numbers in all A36 and G36 POHs. Remember that the modelId being a RegExp can have unexpected effects if some model IDs are substrings of other model IDs. In some cases, it might be best to surround the model ID string with '^' and '$' as in ^[AG]36$:-.

Creating options

Options are created by calling acType.createOption(), which takes an info object as a parameter. The object contains some of the following properties:

The info object must also contain one of the following properties. It may contain both:

Merging option data

When an option is installed, its info.data property is retrieved and merged over the current model data. The options are merged in the order specified by info.order: options with the lowest numeric value of info.order are merged first, options that don't specify an order are merged last. An option that names another in info.overrides is always merged after it, whatever the order values.

info.data may be either an object or a function:

UseValue instances

An option can set the value of a key to a UseValue instance. This allows an option to build a custom value for a specific key. For example, to add a new weight point for a gross weight increase. Assume the model data contains the following property:

glideCasTbl: new Ptable({
	title: `Glide CAS`,
	inputs: [{key:'weight', limit:'clampLo'},],
	output: {key:'ias', rndMult:1},
	a: [
		{p:2100, v:63},
		{p:2600, v:73},
		{p:3100, v:78},
	],
}),

Then, one could write the options property for a gross weight increase to 3,200 lb as:

glideCasTbl: new UseValue((obj, modelData) => {
	const table = modelData.glideCasTbl;
	oldMaxWeight = table.a.at(-1).p;
	oldCas = table.a.at(-1).v;
	table.a.push({
		p: 3200,
		v: round(weightAdjustCas(oldCas, oldMaxWeight, 3200))
	}),
	return (table);
})

Selecting an aircraft model

In POH Performance apps, the Aircraft page allows the user to define and edit a list of aircraft. Each defined aircraft has a selected model within the aircraft type and serial number, along with a set of selected options. Once selected, the Aircraft page calls acType.setAcData() to set up acData according to the selected model, serial number, and options. acType.setAcData() builds the contents of acData by copying the selected model's data (which acType.init() already merged over the type-wide data), then merging the data objects of the installed options. If the serial number is not valid for the model (e.g., it is zero), it substitutes a default: the last serial number in the model's range, since the first aircraft are often development outliers. If the external model ID has several internal models and the serial number does not select one, it uses the internal model with isDefaultModel set, or else the latest. In addition, it adds the following acData properties:

Displaying selectable options

The user interface to select options is usually on the Aircraft page. The page can use acType.renderOptionRows() to display the options associated with the currently selected aircraft model as <Cr> components.

acType.renderOptionRows() only displays the options in the acData.options.available array. Options not in the acData.options.selectable array are disabled and greyed out, letting the user know that other selections have disabled them.

Presenting an option class as a selector

Options in the same option class exclude one another, so offering a checkbox for each is awkward: the user has to clear the installed option before any other becomes selectable. acType.optionUseSelector() marks a whole class to be presented as a single selector instead:

acType.optionUseSelector('Seats', 'Seat type');

acType.renderOptionRows() then draws one row for the class in place of the individual checkboxes, labelled with the title passed to acType.optionUseSelector(). Where the application would rather place the selector itself — beside a diagram the options affect, for example — acType.getSelector() returns the same selector as a component that can be placed anywhere. In that case leave the class's options out of every display group, so the generated option card does not offer them a second time.

The choices are the class's available options in display order, each labelled with the option's title and valued with its option ID. Choosing one installs it and uninstalls the class member it replaces in a single step: a member of the class being installed makes its siblings unselectable, so acType.selectOption() cannot be used to move between them.

If one of the class's options is installed by default on the model (its installedOn applies), the selector always shows a choice, and picking that option simply clears the class rather than selecting it as well. Otherwise the selector also offers an empty choice while none of the class is installed, since that is a real state in which the model's own data applies.

Conflicting options

When two or more options are to be installed, it's possible that they each try to modify the same properties. This is disallowed and will produce a conflict assertion failure. In addition, some options are incompatible with other options even if they don't produce a conflict. There are several ways to prevent this. The first is the option class: Each option can belong to one or more option classes. Only one option from each class can be installed. The optClass property in the info object contains an array of option class ID strings that the option belongs to. For example, an engine upgrade can belong to option classes 'Eng' and 'GWI' if it provides both an engine upgrade and gross weight increase. If this engine upgrade option is selected, then all other engine upgrades or gross weight increase options are removed from the selectable list.

Like a model ID, an option ID can contain a suffix consisting of a "#" followed by a string specifying a variant of an option. The base (prefix) part of the option ID forms an implicit option class ID. For example, option ID option1#variant1 will define an class ID of option1 in addition to any other class ID defined by optClass. This means that only one option variant is selectable or installed.

Sometimes two options are meant to modify the same property, because one supersedes the other: an STC that replaces a CG envelope installed on the same serial numbers, for example. The overrides property in the info object contains an option ID string, or an array of them, whose data this option replaces. Both options stay installed — so the properties the overriding option doesn't provide still apply — but the pair is exempt from the conflict assertion, and the overriding option is merged last so its values win. Use overrides when both options' data are wanted; use optClass or incompatibleWith when only one of them should be installed.

Sometimes two individually selectable options genuinely install together, but each replaces some of the same properties — oversize tires and a cargo compartment that both publish a go-around weight limit, for example. Rather than making the user select a third, manually combined option (appropriate when the combination itself is a user decision, such as a choice between two W&B envelopes), declare a combination option with createComboOption(). A combination option is internal — never displayed, selected, or stored. When every option in its combines list is installed, the members merge as one unit in combines order, followed by the combination option's own data (the fixup for the combined configuration), and the conflict assertion is suppressed among the members. Everything else still asserts, so an undeclared conflicting pair remains an error. When several combination options match, larger member sets win and subsumed ones are skipped; a partial overlap between two applicable combination options asserts — declare a combination option for the full set instead.

Sometimes, selecting an option conflicts with a specific set of other options. The incompatibleWith property in the info object contains an array of option ID strings for options that are incompatible with this one. If this option is selected, the listed options will be removed from the selectable and installed list, and if any option in the list is selected, then this option will also be removed from the selectable list. The incompatibleWith property will allow a selected option to override an installed option, for example, to provide an upgraded replacement for a manufacturer-installed device.

Dependent options

Sometimes an option depends on other options being installed. The enabledBy property in the info object contains an array of option ID strings for options that must be installed if this option is to be visible. If none of the enabling options in the list are installed, then this option is removed from the selectable list. It stays in the available list, so it is displayed disabled (greyed out). Use enabledBy when the option is obviously related to its dependencies, such that the user should see that it can't be selected until a dependency is. For example, a turbulence detection option that is dependent on radar being installed.

Alternatively, the includes property in the info object contains an array of option ID strings for options that must be installed if this option is selected. The option remains visible. If the option is selected then all the options in the list are automatically selected and removed from the selectable list so that they cannot be deselected. Use includes when the option is not obviously related to its dependencies so that it makes sence to have the option visible even when its dependencies are not selected. For example, when seat heaters are dependent on a particular interior package and the user may not be aware of the dependency.

Exported identifiers

acData

Syntax

import {acData} from 'common/aero/export.js';

The acData object contains the properties and methods that represent the currently selected aircraft model and serial number, as amended by the installed options. The acData object is also a global identifier and does not require an explicit import.


acType

Syntax

import {acType} from 'common/aero/export.js';

The acType object contains the properties and methods used to control the currently active aircraft data and define aircraft models and options.


baseId()

Syntax

import {baseId} from 'common/aero/export.js';
baseId(id)

Returns the external (base) part of an internal model or option ID: the ID with any # suffix removed (e.g., 'A36#2' returns 'A36').


hasIdSuffix()

Syntax

import {hasIdSuffix} from 'common/aero/export.js';
hasIdSuffix(id)

Returns true if the internal model or option ID has a # suffix.


serialPrefixFor()

Syntax

import {serialPrefixFor} from 'common/aero/export.js';
serialPrefixFor()
serialPrefixFor(serialNum)
serialPrefixFor(serialNum, modelInfo)

Returns the serial number prefix string for serialNum (default acData.serialNum) according to modelInfo (default acData). If modelInfo.serialPrefix is a string, it is returned. If it is an object that maps serial number ranges to prefixes, the prefix for the range containing serialNum is returned, or the first range's prefix if none contains it. An absent prefix returns ''.


toFixedWidth()

Syntax

import {toFixedWidth} from 'common/aero/export.js';
toFixedWidth(value, width)

Converts value to a string of exactly width characters, padded with leading zeros. If the value is too long, its leading digits are kept.


unpadded()

Syntax

import {unpadded} from 'common/aero/export.js';
unpadded(serialNum)

Returns the serial number as a string with any leading zeros removed (e.g., one saved while its model had a fixed width). A serial number of all zeros returns '0'.


acType methods

createModel()

Syntax

acType.createModel(info)

This function defines a new aircraft model according to the info object. All aircraft models should be defined when the application is loaded, but in any case, before acType.init() is called on startup.

Parameters


createComboOption()

Syntax

acType.createComboOption(info)

This function defines a combination option: an internal option applied automatically whenever every option named in info.combines is installed. Use it when two or more individually selectable options are legitimately installed together but their data would conflict (see Conflicting options). The combination option is never displayed, selected, or stored in the selected-options state; the member options remain the user-facing choices.

When applied, the members merge as one unit at the earliest position any member holds in the installation order — internally in combines order — followed by the combination option's own data, which carries only the combined configuration's fixups (often nothing at all, when the combines order alone resolves the overlap). The pairwise conflict assertion is suppressed among the members; the combination option's own data may only touch properties its members supply.

Applied combination options are listed in modelData.options.combos, may be tested with hasOption(), and their dataSource is appended to the aircraft's data sources.

Parameters

Return value

None.

comboOptionInfo()

Syntax

acType.comboOptionInfo(optId)

This function returns the info object that combination option optId was created with (see acType.createComboOption()). It asserts if the combination option ID is not defined. It is intended for the option self-tests.

Parameters

Return value

The combination option's info object.


createOption()

Syntax

acType.createOption(info)

This function defines a new aircraft option according to the info object. The option is identified by the internal option ID in info.optionId. info.data describes how the option modifies the base model data: it can be a plain object that is merged over the model data, or a function (modelData) => ({...}) that is called with the base model data and returns the object to merge. See Merging option data for guidance on when to use each form.

All aircraft options should be defined when the application is loaded, but in any case, before acType.init() is called on startup.

Parameters

The info object must contain at least one or both of optionOn or installedOn properties


displayableOptions()

Syntax

acType.displayableOptions(modelDataSv)
acType.displayableOptions(modelDataSv, displayGroup)

This function returns the option IDs to display for the current model data, sorted into display order. The result is the argument for acType.renderOptionRows(). It starts with the options in modelDataSv.value.options.available, leaves out the permanent options (the user has no choice about them), and sorts them by info.displayOrder (lower values first; options without a displayOrder come after the ones that have one; equal or undefined values sort by option title). If displayGroup is present, then only options whose info.displayGroup matches it are returned. This allows the Aircraft page to group the options into cards (e.g., "Engine", "TipTanks").

Parameters

Return value

An array of option ID strings.


externalModels()

Syntax

acType.externalModels()

This function returns an array of external model ID strings. It filters the list of all defined internal model ID strings to extract the unique external IDs.

Return value

An array of model ID strings.


findInternalModels()

Syntax

acType.findInternalModels(extModelId, serialNum)

This function returns an array of internal model ID strings corresponding to the external model ID extModelId and serial number serialNum. If the serial number is valid and corresponds to a single model, then that model ID is returned. If the serial number doesn't correspond to any model with that external model ID, all the internal model IDs with the specified external model ID are returned.

Parameters

Return value

An array of model ID strings.


getModelData()

Syntax

acType.getModelData(modelId)

This function returns the full model data without any options for the given internal modelId. This includes the type-wide data with the model data merged over it. Any uses of UseValue are resolved.

Parameters

Return value

An object containing the data for modelId merged over the type-wide data.


getOptionData()

Syntax

acType.getOptionData(optId, modelId)

This function returns the data associated with option optId as applied to model modelId. If info.data (see acType.createOption()) is a function, the function is called with the model data associated with modelId as an argument.

Parameters

Return value

An object containing the data for optionId.


getOptionInfo()

Syntax

acType.getOptionInfo(extModelId)
acType.getOptionInfo(extModelId, serialNum)
acType.getOptionInfo(extModelId, serialNum, selectedOptions)

This function returns the options object that would be set in acData for the model, serial number, and selected options. See Selecting an aircraft model.

Parameters

Return value

The options object: an object with all, available, permanent, installed, selectable, and combos properties, each an array of option ID strings. See Selecting an aircraft model.


getSelector()

Syntax

acType.getSelector(optClass)
acType.getSelector(optClass, options)

This function returns a Template containing a selector for the options of an option class marked by acType.optionUseSelector(), so the selector can be placed anywhere rather than only in the rows produced by acType.renderOptionRows(). The selector shows the installed option of the class and installs the option the user chooses, as described in Presenting an option class as a selector.

The function returns an empty string when the current aircraft offers none of the class's options, so the caller can place it without testing the model first.

It is an error to call this function for an option class that has not been marked by acType.optionUseSelector().

Parameters

Return value

A Template containing a <Selector> component, or an empty string when the aircraft offers none of the class's options.


getSelectorOption()

Syntax

acType.getSelectorOption(optClass)
acType.getSelectorOption(optClass, options)

This function returns the option ID of the option of an option class that the aircraft currently has installed: the selected member of the class, or the class's default option when none is selected. It returns an empty string when neither applies.

Parameters

Return value

An option ID string, or an empty string.


hasOption()

Syntax

acType.hasOption(optionExpr)

This function returns true if the aircraft has options installed according to an expression consisting of option IDs, spaces, and '&', '|', '^', and '!' representing logical AND, OR, XOR, and NOT, respectively. Parentheses may be used for grouping.

An option ID in the expression matches by base ID: Seats is true if any variant such as Seats#K100 is installed. If an ID contains a #, it must match the installed option ID exactly. IDs may also contain + (combination options, see createComboOption()) and -. Applied combination options in acData.options.combos match as well as installed options. In a compound expression, an ID that is not a defined option or base ID asserts.

Parameters

Return value

A Boolean.


init()

Syntax

acType.init()

This function initializes acType and sets up default aircraft data in acData. This function should be called by app.js after the app is loaded but before calling ctl.startApp to ensure aircraft data is present while the app is being initialized.

acType.init() builds the data for each model once, merging the model's data over a copy of the type-wide data (using mergeModelData), adding the model's title, serial number properties and dataSource, and storing the result as the model's full data returned by getModelData().


isApplicable()

Syntax

acType.isApplicable(appStr)
acType.isApplicable(appStr, modelId)
acType.isApplicable(appStr, modelId, serialNum)

This function returns true if the internal model ID modelId and serial number serialNum apply to the applicability string appStr. If serialNum is '-', then modelId must match a model RegExp in appStr that has a serialnumber range of '-'. If modelId and serialNum are unspecified, the data from the current aircraft is used.

Parameters

Return value

A truthy value if the model and serial number apply, otherwise a falsy value. The falsy value is not always a Boolean: it may be '' or undefined when appStr is empty or missing.


isInSerialNums()

Syntax

acType.isInSerialNums(serialNum, serialNums)

This function returns true if the serial number serialNum is in the serial number range specified by serialNums. If serialNums is '-' then all serial numbers are accepted.

Parameters

Return value

A Boolean.


isModel()

Syntax

acType.isModel(modelExp)
acType.isModel(modelExp, modelId)

This function returns true if the model expression modelExp (a RegExp or RegExp string) matches the internal model ID modelId.

This function is used to verify that the model expression extracted from an applicability string matches a specified internal model.

Parameters

Return value

A Boolean.


isSelectorClass()

Syntax

acType.isSelectorClass(optClass)

This function returns true if the option class has been marked to be presented as a selector by acType.optionUseSelector().

Parameters

Return value

A Boolean that is true if the option class is presented as a selector.


isValidSerialNumber()

Syntax

acType.isValidSerialNumber(modelId, serialNum)

This function returns true if serialNum in valid for the interhal modelId.

Parameters

Return value

A Boolean.


models()

Syntax

acType.models()

This function returns an array of all defined internal model IDs.

Return value

An array of model ID strings.


modelTitle()

Syntax

acType.modelTitle(modelId)

This function returns the title (info.title) of the internal model ID modelId.

Parameters

Return value

A string containing the model title.


newName()

Syntax

acType.newName(currentNames)

This function returns a new unique aircraft name that doesn't confilct with any existing name in the currentNames array. It is intended to be used by the Aircraft page when a new aircraft is defined to create a unique name.

acType.newName() returns N if it isn't in currentNames. Otherwise it returns the first of N 2, N 3, ... that isn't.

Parameters

Return value

A string containing a unique name.


optionConflicts()

Syntax

acType.optionConflicts(selected)

This function finds the incompatible combinations in a list of selected option IDs. The installation of an aircraft's options asserts on exactly these when the aircraft is set, so a caller holding a stored option list can check it first. Options conflict when they share an option class, either from optClass or from the base ID of a variant ID (e.g., FS510#1 and FS510#2). Repeated IDs and IDs that are not defined options are ignored.

Parameters

Return value

An array of [classId, [optId, ...]] entries, one for each option class that holds more than one of the selected options. It is empty if there are no conflicts.


optionDataConflicts()

Syntax

acType.optionDataConflicts(modelId)

This function finds data conflicts among the options offered on the internal model modelId: an option that one option includes while another option that can be installed alongside it excludes it (incompatibleWith), an option that something both includes and excludes, or an included option that is not offered on the model at all. The installation of options resolves a conflict deterministically (the exclusion wins) but asserts, so the aircraft data self-test runs this for every model. Applicability is judged by model only: two options offered on disjoint serial number ranges count as installable together.

Parameters

Return value

An array of conflict message strings. It is empty if there are no conflicts.


optionInfo()

Syntax

acType.optionInfo(optId)

This function returns the info object that option optId was created with (see acType.createOption()). It asserts if the option ID is not defined. It is intended for the option self-tests, which check every option's applicability and installation.

Parameters

Return value

The option's info object.


optionUseSelector()

Syntax

acType.optionUseSelector(optClass)
acType.optionUseSelector(optClass, title)

This function marks an option class to be presented to the user as a single selector rather than as a checkbox for each of its options, as described in Presenting an option class as a selector. It is normally called from the aircraft data file that defines the class's options.

The selector's choices are built from the class's available options, so the options themselves need no additional properties.

Parameters


renderAvailableDataSources()

Syntax

acType.renderAvailableDataSources(extModelId, serialNum)

If serial number serialNum identifies a valid internal model for the extern model ID extModelId then this function returns ''. Otherwise, the function returns a Template with a table containing the available data sources for the internal models associated with extModelId. The table contains the serial number ranges that apply to each data source.

This function is intended for use by the Aircraft page's render() method to inform users of which data POH data sources are available when the serial number is incorrect.

Parameters

Return value

A Template containing a <Table> component.


renderOptionRows()

Syntax

acType.renderOptionRows(displayable, modelDataSv, selectedOptSv)

This function returns a Template with a <When> component that triggers when either of the state variables modelDataSv or selectedOptSv is changed. modelDataSv.value contains the constructed model data for the current model and serial number. Normally, this mirrors the contents of acData. selectedOptSv.value contains an array of option IDs for the options that are currently installed in modelDataSv.value. When modelDataSv or selectedOptSv changes, the <When> component generates an array of card rows (<Cr> components) representing each option ID in displayable for the model and serial number. Use acType.displayableOptions() to get displayable from modelDataSv.value.options.available. When a checkbox is selected or deselected, the list in selectedOptSv.value is adjusted.

Each row contains a label with the option title and a value with a checkbox that will be checked if the option appears in the list in selectedOptSv.value. Options that are not in the list of selectable options in modelDataSv.value.options.selectable) will appear greyed out, and the checkbox will be disabled.

This function is intended for use by the Aircraft page's render() method to allow users to select and deselect options. The disabled options also make conflicting options visible.

Options belonging to a class marked by acType.optionUseSelector() are not given a checkbox each. They collapse into a single row holding a selector, drawn where the first of them would have appeared. See Presenting an option class as a selector.

The rows are drawn in the order of displayable. Filtering by display group, ordering by info.displayOrder, and leaving out permanent options are done by acType.displayableOptions(), not by this function.

Parameters

Return value

A Template containing a <When> component.


renderSourceList()

Syntax

acType.renderSourceList()

This function returns a Template with a <ul> containing a list of all aircraft data sources in the app. This includes all POHs (or Owners Manuals) and Aircraft Flight Manual Supplements.

Return value

A Template containing a <ul> list.


restoreAcData()

Syntax

acType.restoreAcData(modelData)

This function makes previously built model data the acData global again, for example after calling acType.setAcData() to temporarily set other aircraft to validate them. Any data loaded into modelData since it was built is kept. Unlike setAcData(), it doesn't rebuild the data.

Parameters

Return value

The acData object.


selectOption()

Syntax

acType.selectOption(selectedOptSv, optionId)

This function adds options ID optionId to the array in selectedOptSv.value. This does not rebuild the aircraft data or change acData. acType.setAcData() must eventually be called to rebuild the aircraft data with the new option settings. This function is for conveniently manipulating selectedOptSv.

Parameters


setAcData()

Syntax

acType.setAcData(extModelId)
acType.setAcData(extModelId, serialNum)
acType.setAcData(extModelId, serialNum, selectedOptions)

This function builds the current aircraft data according to the external model ID extModelId, the serial number serialNum, and the array of selected options in selectedOptions. The aircraft data is built by copying the full data of the internal model for extModelId and serialNum (the model data that acType.init() already merged over the type-wide data), then overlaying the data of the installed options. If serialNum is not valid for the model, the model's default serial number is used instead. If extModelId has several internal models and serialNum doesn't select one, the one with isDefaultModel set is used, or else the latest. See Selecting an aircraft model.

Parameters


setSelectorOption()

Syntax

acType.setSelectorOption(optClass, optionId)
acType.setSelectorOption(optClass, optionId, options)

This function installs an option of an option class, uninstalling whichever member of the class is installed now. Pass an empty string as optionId to install none of them. This is the operation the selector returned by acType.getSelector() performs when the user chooses an option.

The change is made in one assignment to selectedOptSv, because a member of the class being installed makes its siblings unselectable: acType.selectOption() would reject the new option. As with acType.selectOption(), this does not rebuild the aircraft data; acType.setAcData() must eventually be called.

Choosing the class's default option — the one whose installedOn applies to the model — clears the class rather than selecting the option as well, since that option installs itself.

Parameters


setTypeData()

Syntax

acType.setTypeData(info)

This function sets the type-wide data object to info. The properties in info will be used as a base for all defined aircraft. They may be overridden by either aircraft or option properties.

Parameters


unselectOption()

Syntax

acType.unselectOption(selectedOptSv, optionId)

This function removes options ID optionId from the array in selectedOptSv.value. This does not rebuild the aircraft data or change acData. acType.setAcData() must eventually be called to rebuild the aircraft data with the new option settings. This function is for conveniently manipulating selectedOptSv.

Parameters