Modular field instruments · Engineered and produced in Germanyinfo@smartsamplersolutions.com

5.1.16.1 Getting started

Purpose:
Allows user-defined mathematical expressions to process incoming sensor data.

Syntax in user-defined code

F14,<formula>,<A_pos>,<B_pos>,<C_pos>,<D_pos>

<formula>: A math expression using sensor placeholders (ABCD), configurable global variables (GHIKLM), the previous result (R), and temporary runtime variables (XYZ).

<A_pos> to <D_pos>: Indexes referring to the values in the sensorString, starting after the timestamp

In the SmartConfig2 formula editor, the corresponding inputs are shown as a, b, c, and d. Their positions refer to fields in the last comma-separated sensor-data string and are one-based. Enter 0 when an input is not used.

Placeholders

PlaceholderDescription
ADValues from the sensorString
G, H, I, K, L, MSix configurable global values available to user-defined formulas
RResult from the previous F14 calculation
XZTemporary runtime values for intermediate calculations

The result of each calculation is stored in R, which can be used in subsequent formulas. SmartConfig2 also displays the result as r in supported value selectors.

Global variables allow the same formula to reuse configured values without changing the formula itself. For example, A * G multiplies sensor input A by the current value of global variable G. Set the required global value before running the program.

Configure and test a formula

  1. Open a formula action in the Visual Programmer.
  2. Enter the expression and the four input positions. Use 0 for an unused position.
  3. Enter a representative comma-separated sensor string in the test area.
  4. Select Test formula to display the resolved inputs and result.
  5. Use the validation feedback to correct an invalid expression or position before selecting OK.

Supported expressions include arithmetic operators, parentheses, unary plus and minus, supported constants, named runtime variables, and supported single-argument mathematical functions. Commas must not be entered inside the expression because commas separate the F14 fields.

Example

Configuration line:

F14,A*1,2,0,0,0

Incoming sensor string:

2025/06/23 09:46:50,12453,0,22.3

After skipping the timestamp:

  • Index 0 → 12453
  • Index 1 → 0
  • Index 2 → 22.3

A = 22.3

Formula: A * 1

Result: R = 22.3

Notes

  • Comma-separated sensorString values are indexed starting at 0 (after timestamp).
  • In the formula editor, input positions for ad are one-based fields in the sensor-data string; use 0 for an unused input.
  • Only available in User-Defined Mode
  • Avoid invalid math operations, such as division by zero. Invalid expressions produce an evaluation error rather than a usable numeric result.
  • Missing or out-of-range selected inputs are treated as zero by SmartSampler2.
  • Use the Simulation tab to check how the formula result affects later actions.
  • Useful for scaling, offsetting, combining, or converting raw values on-device.
Ask an engineering questionSoftware & downloads