Conversion and presentation

Before you create a variable, the project needs to know how to recalculate its value (a conversion) and how to display it (a presentation). The dependency chain is: a presentation references a conversion and a variable references a presentation — which is why they are created in the order conversion → presentation → variable. QInsight enforces this: the Add button for presentations becomes active only once at least one conversion exists, and for variables only once a presentation exists.

Conversion

A conversion recalculates the raw value from the device into the engineering value. It is added in Home → Project Configuration → Conversions with the + button. There are two types:

  • Linear — eng = raw × Multiplier + Offset. The defaults Multiplier = 1, Offset = 0 mean "no recalculation" (engineering = raw).
  • Enum — maps numeric states to texts. You define a list of Name + Value pairs (e.g. 0 = Off, 1 = Run, 2 = Error) and controls then display the state name instead of the number.

The conversion form — Enum typeThe conversion form — Enum type

Presentation

A presentation defines how the value is shown to the user. It is added in Home → Project Configuration → Presentations. Properties:

  • Name, Label — the name and caption,
  • Min, Max — the value range (used by controls such as a gauge or a chart axis),
  • Print Format — the output format, e.g. {0} or {0:F2} for two decimal places (a survey of useful formats below),
  • Unit — the unit (°C, rpm, bar…),
  • Conversion — a reference to the conversion used for the variable.

The presentation formThe presentation form

Useful Print Formats

The format is a .NET composite format string — always with the {0:…} placeholder (a bare F2 would be shown literally as text). What gets formatted is the engineering value, which is always a decimal number — the formats therefore work the same way for integer variables ({0:F2} shows an int 24 as 24.00). The decimal separator is a dot. Examples for the value 23.4567, resp. 1234.5:

FormatResultUse
{0:F0}23whole number (rounded)
{0:F2}23.462 decimal places — temperatures, voltages
{0:0.0##}23.457min. 1, max. 3 decimal places (trailing zeros hidden)
{0:N0}1,235thousands separators — counters, rpm
{0,8:F2} 23.46fixed width of 8 characters — values align in a column
{0:000.0}023.5zero-padded from the left
{0:E2}2.35E+001scientific notation — very small/large quantities
{0:G4}23.46max. 4 significant digits, switches to E for extremes
{0:+0.00;-0.00;0}+23.46forced sign (positive;negative;zero sections)
{0:F1} °C23.5 °Carbitrary text around the value

Three warnings:

  • Controls append the unit themselves from the Unit field — the format {0:F1} °C together with a filled-in Unit would show it twice. Use one or the other.
  • Hexadecimal formats ({0:X}) do not work — a decimal number is being formatted.
  • With an enum conversion the state name is shown and the Print Format is not applied.

Example

A temperature arrives from the device as an integer in tenths of a degree:

  1. Conversion "TempC": Linear, Multiplier = 0.1, Offset = 0.
  2. Presentation "Temperature": Min = 0, Max = 150, Print Format = {0:F1}, Unit = °C, Conversion = TempC.
  3. A variable with this presentation then displays the raw value 435 as 43.5 °C.

Next

Everything is ready — add a variable.