G1000 panel.xml
Basics
Introduction
The panel.xml
file allows developers to configure their aircraft-specific G1000 installation. A basic understanding of the XML language is recommended when working with panel.xml
. For a general introduction to panel.xml
, see the main MSFS developer documentation.
File Structure
Below is an example of a simple panel.xml
file:
<PlaneHTMLConfig>
<Instrument>
<Name>AS1000_PFD</Name>
</Instrument>
<Instrument>
<Name>AS1000_MFD</Name>
</Instrument>
</PlaneHTMLConfig>
The file contains the root tag <PlaneHTMLConfig>
under which all other tags must be placed. There is one <Instrument>
tag for each JS/HTML instrument in the plane. The <Name>
tag identifies the specific instrument referenced by its parent <Instrument>
tag. In this example, there are two declared instruments: one PFD and one MFD.
Tag Scope
Each tag parsed by the G1000 has a required scope, defined as the parent under which it must be placed. If a tag is placed in an incorrect scope, it may not be parsed at all or it may be interpreted as a different type of tag with the same name. Therefore, it is important to ensure that all tags are defined in the correct scope.
The tags documentation details the scope of each tag. When the scope is listed as "Global", this means the tag should be placed directly under the root <PlaneHTMLConfig>
tag. When the scope is listed as "PFD" or "MFD", this means the tag should be placed directly under the PFD or MFD <Instrument>
tag, respectively.
Required vs. Optional Tags
Tags and attributes can either be required or optional. Required tags/attributes must be explicitly defined for panel.xml
to be successfully parsed. If a required tag/attribute is missing, the G1000 will throw a Javascript error during initialization with a message describing what was missing. Optional tags/attributes do not have to be explicitly defined, and omitting these will have no adverse effects. When an optional tag/attribute is omitted, the option it defines will revert to a default value.
The tags documentation details which tags and attributes are required and which are optional, as well as the default values for optional tags/attributes.
If the G1000 detects that an optional attribute or tag was not formatted correctly (e.g. a mis-spelled option, an out-of-bounds numeral, etc), it will emit a console warning and revert the option to its default value. Therefore, during development it is recommended that you monitor the console output of all instruments to ensure that panel.xml
is being parsed cleanly.
Redundant Tags
When you define multiple copies of a tag that is meant to be a singleton, only the first instance of the tag (in tree order) will apply. Take the following example:
<AirspeedIndicator>
<Scale min="20" max="999" window="60" major-tick-interval="10" minor-tick-factor="2" />
</AirspeedIndicator>
<AirspeedIndicator>
<Scale min="20" max="999" window="60" major-tick-interval="20" minor-tick-factor="2" />
</AirspeedIndicator>
Of the two <AirspeedIndicator>
tags defined, only the top one will apply. As a result, the PFD will have an airspeed indicator with major ticks at 10 knot intervals instead of 20 knot intervals.
Numeric Tags and Operators
Certain G1000-specific tags define numeric values. One such tag is the generic <Number>
, which is a numeric tag that returns a constant value equal to its content (for example, <Number>0</Number>
returns a value of zero). Other numeric tags may return values with more complicated logic.
Numeric tags can be used together with numeric operator tags to generate computed numeric values. Each numeric operator tag accepts one or more numeric tags as children (the operands) and outputs the result of the operation as a new numeric value. Numeric operators also are considered numeric tags, so they can be used as operands of other numeric operator tags.
The available numeric operator tags are:
Operator | Operand Count | Description |
---|---|---|
<Min> | One or More | Returns the minimum value among all operands. |
<Max> | One or More | Returns the maximum value among all operands. |
The following are examples of numeric operator usage:
<!-- Always returns 0 -->
<Min>
<Number>0</Number>
<Number>5</Number>
<Number>10</Number>
</Min>
<!-- Always returns 100 -->
<Max>
<Number>10</Number>
<Min>
<Number>100</Number>
<Number>1000</Number>
</Min>
</Max>