What is a variable

A variable represents one value communicated with a device in real time — e.g. engine speed, a temperature, or a status word. Variables are the center of the whole project: drivers and protocols feed them with data, Controls display them, the logger records them, and scripts work with them.

Two variable types

  • Scalar — a single value (a number, a string); the common case this section is about.
  • Matrix — a contiguous block of values with optional axes: an array, a curve, or a map (typically calibration data of control units). Covered in detail in the Matrix variable chapter.

The type is chosen when creating the variable, in the drop-down next to the + button.

Variable properties

  • Id — a numeric identifier within the project,
  • Namespace and Name — the namespace and name (the name is also used as the default identifier in the protocol),
  • Label and Description — a caption and an optional description,
  • Data Type — the value data type (Byte, Short, Int, Long and their unsigned variants, Float, Double, String),
  • Length — the length for value arrays (1 for a regular scalar variable),
  • Presentation — a reference to the presentation that defines how the value is displayed.

Raw and engineering value

A variable holds the raw value — exactly what arrived from the device (e.g. a 16-bit number from a CAN message). For display, the raw value is recalculated by a conversion into an engineering value in physical units (e.g. 4000 → 40.0 °C). How the result is formatted and which unit is shown is defined by the presentation.

When a variable is communicated

When the value is exchanged with the device is decided by the event chosen when connecting the variable to a protocol:

  • Periodic — regularly with a given period,
  • OnValueChanged — when the value changes (with a threshold),
  • OnRequest — on demand.

Events are defined in Home → Project Configuration → Events and are shared by the whole project — several variables can share one period.

Besides the name and period, an event has an optional Extra Params field with protocol-specific parameters — XCP uses it to switch variables from polling to DAQ streaming by the ECU. Everything about events — the types, the editor, and Extra Params — is in the separate Events chapter.

Next

Before creating a variable, prepare its conversion and presentation — the variable references them, which is why they are created first.