Write formulae
- Last UpdatedAug 11, 2025
- 3 minute read
In a number of places, AVEVA Unified Supply Chain allows you to enter formulae relating property measurements to one another. The mathematical, logical and arithmetical operations which are allows in these formulae are explained in this appendix.
Mathematical operators
The combination rules for the operators follow the standard mathematical rules of precedence:
-
Brackets and functions
-
Power
-
Multiplication and division
-
Addition and subtraction
-
Logical operations
These operators are not case sensitive in any of the AVEVA Unified Supply Chain formulae.
Name
Explanation
Example
E
Constant e (2.718281828...)
E+1
PI
Constant π (3.14159265...)
PI+1
PLUS_INF
Positive infinity
PLUS_INF
MINUS_INF
Negative infinity
MINUS_INF
()
Brackets
(X+1)*10
|
Operation |
Explanation |
Example |
|---|---|---|
|
- |
Negation of value |
-X |
|
+ |
Addition |
X+1 |
|
- |
Subtraction |
X-1 |
|
* |
Multiplication |
X*10 |
|
/ |
Division |
X/10 |
|
Operator |
Explanation |
Example |
|---|---|---|
|
LOG10 |
Logarithm to base 10 |
LOG10(X) |
|
LN |
Logarithm to base e |
LN(X) |
|
^ |
Power |
10^X |
|
EXP |
e to the power of |
EXP(X) |
|
EXP10 |
10 to the power of |
EXP10(X) |
|
ABS |
Absolute value |
ABS(X) |
|
SQRT |
Square root |
SQRT(X) |
|
MAX |
Maximum of two values |
MAX(X,SQRT(X)) |
|
MIN |
Minimum of two values |
MIN(X,SQRT(X)) |
|
TANH |
Hyperbolic tangent |
TANH(X) |
|
ATANH |
Inverse hyperbolic tangent |
ATANH(X) |
|
SIN |
Sine |
SIN(X) |
|
COS |
Cosine |
COS(X) |
|
Operator |
Explanation |
Example |
|---|---|---|
|
IF |
Checks whether a condition is met and returns one value if TRUE and another value if FALSE |
IF(X>1,LOG10(X),0) |
|
< |
Less than |
IF(X<1,0,1) |
|
> |
Greater than |
IF(X>1,0,1) |
|
<= |
Less than or equal to |
IF(X<=1,0,1) |
|
>= |
Greater than or equal to |
IF(X>=1,0,1) |
|
= |
Equal to |
IF(X=1,0,1) |
|
!= |
Not equal to |
IF(X!=1,0,1) |
|
NOT |
Changes FALSE to TRUE, or TRUE to FALSE |
IF(NOT X>1,0,1) |
|
AND |
Returns TRUE if all arguments are TRUE; returns FALSE if any argument is FALSE |
IF(X>1 AND X<2,0,1) |
|
OR |
Returns TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE |
IF(X=1 OR X=2,0,1) |
|
XOR |
Returns TRUE if one condition is TRUE but not both; returns FALSE if both conditions are FALSE or both conditions are TRUE |
IF(X=1 XOR X=2,0,1) |
|
true |
Logical TRUE value |
IF(true,1,0) |
|
false |
Logical FALSE value |
IF(false,1,0) |
Note: Logical operators are not supported in optimization. The operator will be used during any simulation run, but the logical constructs are not evaluated during optimization runs.
Variable identifiers
An identifier is a name for a function, variable or another user defined item. An identifier is useful if it meets the following rules:
-
The first character of the identifier is a lower case letter in the range [a-z], or an upper case letter in the range [A-Z].
-
The subsequent characters of the identifier are either lower case letters in the range [a-z], upper case letters in the range [A-Z], or numerals in the range [0-9].
-
The identifier is not a reserved word included in the list of operators in the tables above.
Illegal characters in variable names
Several characters cannot be used as variable names when writing formula. These are shown in the table below:
|
Illegal variable names example |
Explanation |
|---|---|
|
CUM_YLD |
Underscore character present in identifier. |
|
CET(976) |
Parentheses characters present in identifier. |
|
C04P- |
Minus sign character present in identifier. |
|
D1160 BP |
Space character present in identifier. |
|
NOT |
Identifier is the same as a reserved word. |
Error messages when writing formulae
If there are any errors in the formulae entered an error message will be shown. Possible error messages are shown in the table below. The string %s in the example error message shown below is a placeholder for a string that shows more details about the error.
|
Error message |
Description |
Example |
Instance |
|---|---|---|---|
|
Unexpected symbols at end of expression: '%s'. |
Syntax error. The symbols following the given expression cannot be understood. |
X+5) |
Unexpected symbols at end of expression: ')' |
|
Missing ')' after '%s'. |
Syntax error. The expression is missing a parenthesis. |
X + (4 * 3 |
Missing ')' after 'X + (4 *' |
|
Missing ')' or ',' after '%s'. |
Syntax error. The expression is missing a parenthesis or comma. |
IF (X > 0, X 0) |
Missing ')' or ',' after 'IF(X > 0, X' |
|
Expected an identifier after '%s'. |
Syntax error. An identifier is missing after a given expression. |
IF (X > 0, X, ) |
Expected an identifier after ')' |
|
Unknown function '%s' |
The operation or function indicated cannot be recognized by the parser. |
LN(NOT (X = X)) |
Unknown function LN(bool) |
|
Type mismatch : '%s' can't act on '%s' |
Type mismatch error. The types of the operator and operand do not match. |
NOT LOG10(X) |
Type mismatch: 'NOT' can't act on double |
|
Type mismatch : '%s' can't act on '%s', '%s' |
Type mismatch error. The types of the operator and operands do not match. |
LOG10(X) AND LOG10(Y) |
Type mismatch: 'AND' can't act on double, double |
|
Unidentified error in formula |
Miscellaneous error. An unknown error has occurred. |
X = X + 1 |
Unidentified error in formula |