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.
| Operator | Description | Example | Result |
|---|---|---|---|
+ | Addition or unary plus | A + B | Sum of A and B |
- | Subtraction or unary minus | A - C | Difference between A and C |
* | Multiplication | B * D | Product of B and D |
/ | Division | C / A | Quotient of C and A |
% | Remainder | A % 2 | Remainder after division by 2 |
^ | Exponentiation | A ^ 2 | A squared |
() | Groups an expression | (A + B) * C | Adds 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.
A–Dare assigned from the four selected sensor-data positions. The formula editor also supports the documented runtime variable set shown in SmartConfig2, includingA–E,G–N,U–Z, andR/rfor the formula result.- The four input fields are labelled
a position,b position,c position, andd position. Positions refer to one-based fields in the latest comma-separated sensor-data string. - Enter
0for 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.
