TFDi Design Icon
TFDi Design

Flight Tracking Configuration

smartCARS 3 introduced a scriptable flight tracking system that allows for deep customization of tracking behavior. This script is editable via smartCARS Central. This document will explain how to write the scripts, give some important information on how to expect it to behave, and provide a list of possible variables and syntax instructions.

UI Editor

For an easier way to create and manage your flight tracking configuration without directly editing JSON, you can use the QVirtual Visual Flight Tracking Configuration Builder. This web-based tool provides a user-friendly interface to build your configuration by selecting conditions, messages, and other parameters, and then generates the correct JSON output for you.

You can access the builder at: https://qvirtualofficial.github.io/flight-tracking-configuration/

Formatting

The tracking configuration is a JSON object that contains an array of tracking events. An example of a configuration that only logs when pushback begins is below.

{
  "events": [
    {
      "condition": "{phase} equals 'PUSH_BACK'",
      "message": "Pushing back with {fuelTotalQuantityWeight} {weightUnits} of fuel",
      "initialValue": false,
      "timeout": 0
    }
  ]
}

The fields are as follows:

  • condition: the code string that smartCARS should evaluate to determine if this event is occurring
  • message: the templated string that will logged to smartCARS when the conditions have been met
  • initialValue: this optional field allows you to specify the initial value smartCARS should be expecting - this is used to prevent log items such as "engines off" when you first start the flight
  • timeout: this optional field tells smartCARS to ensure the condition remains met for the specified number of milliseconds - this helps prevent log items like "flaps set to 1", "flaps set to 2", back to back and instead only captures the final position

When the condition is met, the message value is parsed by smartCARS and any variables in the string are replaced with the actual data at that time. For example, the above message might generate something like Pushing back with 12516 lbs of fuel when the conditions are met.

Syntax

The Condition

The condition field has a relatively strict but simple syntax. The basic format is as follows:

SyntaxExample
{variable} comparison {reference}{engine1Firing} equals false

If you need more than one variable evaluation, you can use and and or as joiners. Note that smartCARS has no concept of an order of operations and evaluates all conditions left to right. The syntax for that is:

SyntaxExample
{variable} comparison {reference} joiner {variable} comparison {reference}{engine2Firing} not_equals false and {enginesCount} greater_than 1

Finally, you may want to log only when a variable changes (or increases/decreases). To accomplish this:

SyntaxExample
{variable} changed{flapsControl} changed

Reducing log spam

We recommend using a timeout value on most changed events to reduce the likelihood of log spam, a scenario where extremely frequent changes in the variable cause excessive amounts of logging.

The possible comparisons that accept a reference variable:

  • greater_than
  • less_than
  • equals
  • not_equals
  • increased_by
  • decreased_by

The possible comparisons that do not accept a variable but compare to their own previous value:

  • changed
  • increased
  • decreased

Certain variables are string types. To compare to a string instead of a number, simply wrap the reference in single quotes. For example, a condition that becomes true when we first receive a valid aircraft name would be {aircraftName} not_equals ''.

The Message

The message field has no syntax requirements with the exception of only using valid, existing variables from the list below.

Best practices are:

  • Keep the message in English
  • Avoid opinioned decisions
  • Keep it short and sweet

Applying Changes

Once you have your script ready, log in to smartCARS Central and navigate to the Community Editor.

Select the community you are editing (if applicable), ensure the Flight Tracking plugin by TFDi Design is installed, then expand the "Flight Tracking" plugin row by clicking its name.

/smartcars/applying_changes.gif

When ready, simply paste your new tracking configuration into the "Logger Configuration" box and click "Update". If there is any issue with the formatting, smartCARS Central will indicate this.

If the script is simply too large, you can minify it first to remove unneeded whitespace or padding. To do this, you can use any online minifier tool like the Code Beautify JSON Minifier.

Always keep a backup!

Although it is reversible, we recommend keeping a non-minified copy of your configuration to make editing easier.