Measurement Formula Tool

The Measurement Formula tool lets you create a mathematical expression containing one or more measurements from other measurement tools, up to a maximum of 20. The result of the calculation is returned in the tool's Result measurement.

The tool's default timeout is 5 seconds: if the tool fails to complete the calculation after 5 seconds, the result is set to Invalid.

The tool uses the C++ Mathematical Expression Toolkit Library (ExprTk). For full details on what it supports, see the toolkit's page (http://www.partow.net/programming/exprtk/).

For information on adding, managing, and removing tools, as well as detailed descriptions of settings common to most tools, see Tool Configuration.

Inputs

Inputs
Name Description
Enable Batching

When Enable Batching is checked, the tool takes an array as input and processes each element in the array individually.

For more information on arrays, batching, and aggregating, see Arrays, Batching, and Aggregation.

Input

If Enable Batching is disabled, set this parameter to any available input. The selected input has no effect on the tool's calculations.

If Enable Batching is enabled, set this to an array source, such as arrayed output from a multi-sensor system or from multi-layer G5 output, or from the output of an Array Create tool. For more information on arrays, batching, and aggregating, see Arrays, Batching, and Aggregation.

Variable {n}

A measurement from another tool.

The Measurement Count parameter controls the number of variable inputs.

Parameters

The following parameters are in the expandable Parameters section in the tool's configuration.

Parameters
Parameter Description

Measurement Count

Sets the number of variable inputs in the Inputs section. For each, a Variable {n} input and a Variable {n} Alias parameter is added, and

for use in the expression.

Formula

The mathematical expression.

Use the variable aliases from the Variable {n} Alias parameters in the expression. For example:

  • M1*3+M2/2+4

  • tan(M1/180*pi)

  • max(M1, M2, M3)

The tool supports complex mathematical formulas. For example, the following:

can be produced using this:

Copy
sqrt((1-a*exp(2t)+w^(pi))/(sin(2x/pi)+cos(pi/y)))

The following shows how to perform a while loop:

Copy
y:=0; while(x<10){y:=y+x;x+=1;};y

Note that ":=" is the assignment operator, and "=" is the equality operator.

The following shows how to use an if-else structure:

Copy
if(x>2){x:=x+2;}else{x:=x-2;};x

 

Variable {n} Alias

The alias of Variable {n}. Use these aliases in Formula.

External ID

The external ID of the tool that appears in GoHMI Designer. For more information, see GoHMI and GoHMI Designer.

Outputs

Outputs section with a measurement expanded to show user-configurable decision min/max fields and an external ID

You configure the Min and Max parameters by expanding the measurement in the Outputs section. In order for a measurement to return a Pass decision, the measurement must be between maximum and minimum values; the range is inclusive.

Measurements
Measurement

Result

The result of the calculation in Formula.