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

5.1.16.2 Allowed operators

Supported operators

Use the following operators in a SmartConfig2 Formula action. SmartSampler2 evaluates the expression when the configured user-defined program reaches that action.

OperatorDescriptionExampleResult
+Addition or unary plusA + BSum of A and B
-Subtraction or unary minusA - CDifference between A and C
*MultiplicationB * DProduct of B and D
/DivisionC / AQuotient of C and A
%RemainderA % 2Remainder after division by 2
^ExponentiationA ^ 2A squared
()Groups an expression(A + B) * CAdds A and B before multiplication

Constants and variables

Formulas support the constants pi and e. They can also use the supported runtime values available to the user-defined program, including sensor-data inputs, user-defined parameters, temporary values, counters, and the previous formula result.

  • AD are assigned from the four selected sensor-data positions. The formula editor also supports the documented runtime variable set shown in SmartConfig2, including AE, GN, UZ, and R/r for the formula result.
  • The four input fields are labelled a position, b position, c position, and d position. Positions refer to one-based fields in the latest comma-separated sensor-data string.
  • Enter 0 for an unused input position. A missing or out-of-range selected input is treated as zero.
  • The calculated result is available as the formula result and can be used by supported later actions, such as a delay, output control, flow-control value, comparison, or custom telemetry action.

Validate and test a formula

In the F14 Formula action, enter one expression and assign the four input positions. SmartConfig2 validates the formula before accepting the configuration. If validation fails, the message identifies the error position and explains the problem where available.

Select Test formula to evaluate the expression with supplied sensor data and runtime values. Successful feedback displays the formula, input data, calculated result, and resolved input values. An invalid expression produces an error instead of a usable numeric result.

A formula is a single expression. Do not enter commas inside it: commas separate fields in the configured formula data.

For available functions, see 5.2.3 Supported Functions. For a complete setup workflow, see 5.2.1 Getting Started.

Related hardware: SmartSampler2 hardware reference.

Ask an engineering questionSoftware & downloads