(Created page with "== Feature references == An expression may reference any feature inspection so far in the workflow for the current part. *To reference the entered value of a numeric feature (or the numeric field of a categorical feature), use <code>$x</code>, where <code>x</code> is the balloon label of the feature. *To reference the selected value of a categorical feature (even if it has a numeric value as well), use <code>$$x</code>, where <code>x</code> is the balloon label of the f...") |
No edit summary |
||
Line 1: | Line 1: | ||
== Feature references == | == Expression definition == | ||
=== Feature references === | |||
An expression may reference any feature inspection so far in the workflow for the current part. | An expression may reference any feature inspection so far in the workflow for the current part. | ||
Line 6: | Line 8: | ||
*Features without balloon labels cannot be referenced. | *Features without balloon labels cannot be referenced. | ||
== Logical operations == | === Logical operations === | ||
{| class="wikitable" | {| class="wikitable" | ||
|+The following logical operations are supported: | |+The following logical operations are supported: | ||
Line 55: | Line 57: | ||
Logical operations can be infinitely nested. For example, <code>((1 == 1) and (1 < 2)) or not ((3 > 4) and (2 > 1))</code> evaluates to <code>true</code>. | Logical operations can be infinitely nested. For example, <code>((1 == 1) and (1 < 2)) or not ((3 > 4) and (2 > 1))</code> evaluates to <code>true</code>. | ||
== Mathematical operations == | === Mathematical operations === | ||
{| class="wikitable" | {| class="wikitable" | ||
|+The following mathematical operations are supported: | |+The following mathematical operations are supported: | ||
Line 91: | Line 93: | ||
|} | |} | ||
== Functions == | === Functions === | ||
{| class="wikitable" | {| class="wikitable" | ||
|+The following functions are supported: | |+The following functions are supported: | ||
Line 162: | Line 164: | ||
Where <code>a</code> indicates an [[wikipedia:Inverse_trigonometric_functions|inverse function]] and <code>h</code> indicates a [[wikipedia:Hyperbolic_functions|hyperbolic function]]. | Where <code>a</code> indicates an [[wikipedia:Inverse_trigonometric_functions|inverse function]] and <code>h</code> indicates a [[wikipedia:Hyperbolic_functions|hyperbolic function]]. | ||
== Constants == | === Constants === | ||
{| class="wikitable" | {| class="wikitable" | ||
|+The following constants are predefined: | |+The following constants are predefined: | ||
Line 181: | Line 183: | ||
|1.618033988749895 | |1.618033988749895 | ||
|} | |} | ||
== Usage == | |||
=== Inspection calculations === | |||
During inspection, you may enter mathematical expressions following the rules outlined above and the evaluated (calculated) result will be entered for the feature's value. For example, you can enter <code>0.6712 - 0.431</code> into the measurement value field and the feature will be measured as <code>0.2402</code> upon leaving the input field. Focusing back into the input field ''before submitting the inspection'' will reveal the expression as it was originally entered for editing. | |||
You can also use the values entered for features that have already been measured in your expressions. For example, to enter a value that is equal to twice the value of the feature with balloon label <code>F3</code>, you can enter <code>$F3 * 2</code>. | |||
=== Conditional features === | |||
Features can have conditional expressions that are evaluated each time any feature in the workflow is measured. Any features whose conditional expressions do not evaluate to <code>true</code> will be hidden. | |||
The following rules apply to conditional feature expressions: | |||
* Expressions can reference the value of another feature with <code>$x</code>, where <code>x</code> is the feature's balloon label. | |||
* Expressions can reference the selected value of a categorical feature with <code>$$x</code>. If numeric entry is still allowed for a categorical feature, any entered numeric value can be referenced with <code>$x</code> like a normal feature. | |||
* Be careful not to reference features that come after the current one during inspection because they may not have values entered yet. | |||
==== Examples ==== | |||
* <code>$B2 < 0.1</code> | |||
* <code>$$C3 != "OK"</code> | |||
* <code>$$6 != "OK" or $6 >= 0.012</code> | |||
* <code>($$A1 == "OK" and $$A2 == "OK") or $$A3 == "NG"</code> | |||
[[Category:Inspection User Guid]] | [[Category:Inspection User Guid]] |
Revision as of 17:13, 25 October 2023
Expression definition
Feature references
An expression may reference any feature inspection so far in the workflow for the current part.
- To reference the entered value of a numeric feature (or the numeric field of a categorical feature), use
$x
, wherex
is the balloon label of the feature. - To reference the selected value of a categorical feature (even if it has a numeric value as well), use
$$x
, wherex
is the balloon label of the feature. - Features without balloon labels cannot be referenced.
Logical operations
Operator | Evaluates to true only when...
|
Example |
---|---|---|
==
|
Both arguments are equal | 1 == 2 → false
|
!=
|
Both arguments are not equal | 1 != 2 → true
|
<
|
Left argument is smaller | 1 < 2 → true
|
>
|
Right argument is smaller | 1 > 2 → false
|
<=
|
Left argument is smaller or equal | 1 <= 2 → true
|
>=
|
Right argument is smaller or equal | 1 >= 2 → false
|
or
|
Either input is true | (1 > 2) or (4 > 3) → true
|
and
|
Both inputs are true | (1 > 2) and (2 >= 3) → false
|
xor
|
Exactly one input is true | true xor true → false
|
not
|
The input is false | not true → false
|
Logical operations can be infinitely nested. For example, ((1 == 1) and (1 < 2)) or not ((3 > 4) and (2 > 1))
evaluates to true
.
Mathematical operations
Operator | Description | Example |
---|---|---|
+
|
Addition | 1 + 2 → 3
|
-
|
Subtraction | 2 - 0.5 → 1.5
|
*
|
Multiplication | 2 * 3 → 6
|
/
|
Division | 9 / 2 → 4.5
|
^
|
Exponentiation | 4 ^ 2 → 16
|
%
|
Remainder | 12 % 5 → 2
|
!
|
Factorial | 4! → 24
|
Functions
Name | Description | Example |
---|---|---|
abs(x)
|
Returns the absolute value of x | abs(-3) → 3
|
round(x)
|
Round x to the nearest integer | round(1.5) → 2
|
ceil(x)
|
Rounds x up | ceil(1.1) → 2
|
floor(x)
|
Rounds x down | ceil(2.9) → 2
|
log(x)
|
Computes the logarithm base e of x | log(5) → 1.60944...
|
log(x, b)
|
Computes the logarithm base b of x | log(5, 10) → 0.69897...
|
sqrt(x)
|
Returns the square root of x | sqrt(64) → 8
|
min(...)
|
Returns the smallest of its arguments | min(1, 2, 3) → 1
|
max(...)
|
Returns the largest of its arguments | max(1, 2, 3) → 3
|
mean(...)
|
Returns the average of its arguments | mean(1, 5, 10) → 2.666...
|
median(...)
|
Returns the middle of its arguments.
If there are an even number of arguments, it returns the average of the middle two. |
median(2, 5, 7) → 5
|
std(...)
|
Returns the standard deviation of its arguments. | mode(1, 5, 13, 20) → 8
|
sum(...)
|
Returns the sum of its arguments. | sum(1, 2, 3, 4) → 10
|
The following trigonometry functions are also available and operate in radians:
sin
,sinh
,asin
,asinh
cos
,cosh
,acos
,acosh
tan
,tanh
,atan
,atanh
sec
,sech
,asec
,asech
csc
,csch
,acsc
,acsch
cot
,coth
,acot
,acoth
Where a
indicates an inverse function and h
indicates a hyperbolic function.
Constants
Name | Description | Value |
---|---|---|
pi or PI
|
Pi (π) | 3.141592653589793 |
e or E
|
Euler's number (e) | 2.718281828459045 |
phi
|
Golden ratio (φ) | 1.618033988749895 |
Usage
Inspection calculations
During inspection, you may enter mathematical expressions following the rules outlined above and the evaluated (calculated) result will be entered for the feature's value. For example, you can enter 0.6712 - 0.431
into the measurement value field and the feature will be measured as 0.2402
upon leaving the input field. Focusing back into the input field before submitting the inspection will reveal the expression as it was originally entered for editing.
You can also use the values entered for features that have already been measured in your expressions. For example, to enter a value that is equal to twice the value of the feature with balloon label F3
, you can enter $F3 * 2
.
Conditional features
Features can have conditional expressions that are evaluated each time any feature in the workflow is measured. Any features whose conditional expressions do not evaluate to true
will be hidden.
The following rules apply to conditional feature expressions:
- Expressions can reference the value of another feature with
$x
, wherex
is the feature's balloon label. - Expressions can reference the selected value of a categorical feature with
$$x
. If numeric entry is still allowed for a categorical feature, any entered numeric value can be referenced with$x
like a normal feature. - Be careful not to reference features that come after the current one during inspection because they may not have values entered yet.
Examples
$B2 < 0.1
$$C3 != "OK"
$$6 != "OK" or $6 >= 0.012
($$A1 == "OK" and $$A2 == "OK") or $$A3 == "NG"