Operators for Calculation Variables

You can use any of the following operators in your calculation. Each of the operators can be used with any number, a variable that represents a numeric indicator reading, or a calculation that results in a number.

Arithmetic Operators

+
Example:
Indicator1 / 2
^

Trigonometric and Exponential Operators

In this table, “x” represents any numeric constant, numeric indicator, or a calculation that results in a number.
To calculate the base-10 logarithm for the number 50 [Log10(50)], divide the natural logarithm of 50 by the natural logarithm of 10 as follows:
If x is: Less than zero
Rnd generates: The same number every time, using x as the seed
If x is: Greater than zero
Rnd generates: The next random number in the sequence
If x is: Equal to zero
Rnd generates: The most recently generated number
If x is: Not supplied
Rnd generates: The next random number in the sequence

Rounding Operators

In this table, “x” represents any numeric constant, numeric indicator, or a calculation that results in a number.
Abs(-20.5) and Abs(20.5) both return 20.5
Both Int and Fix remove the fractional part of x and return the resulting integer value.
The difference between Int and Fix is that if x is negative, Int returns the first negative integer less than or equal to x, whereas Fix returns the first negative integer greater than or equal to x.
Int(99.8) Returns 99
Fix(99.2) Returns 99
Int(-99.8) Returns -100
Fix(-99.8) Returns -99
Int(-99.2) Returns -100
Fix(-99.2) Returns -99
Sgn(Indicator1) Returns 1
Sgn(Indicator2) Returns -1
Sgn(Indicator3) Returns 0

Conversion Operators

In this table, “x” represents any numeric constant, numeric indicator, or a calculation that results in a number.
Hex(5) Returns 5
Hex(10) Returns A
Hex(459) Returns 1CB
Oct(4) Returns 4
Oct(8) Returns 10
Oct(459) Returns 713

Order of Evaluating Operators

When you include more than one operator in a calculation, each part is evaluated and resolved in a predetermined order:
To force parts of a calculation to be evaluated before other parts, you can include those parts in brackets. For example:
(Indicator1 + Indicator2) * 2 will add the two variables first, then multiply the result by 2
Indicator1 + Indicator2 * 2 will multiply Indicator2 by 2, then add the result to Indicator1
Operations within brackets are always performed before those outside. Operators within brackets are evaluated in the normal order.

Functions and Logical Operators

A function is a series of VB.NET or C# statements that return a value. You can use functions to create a calculation for a calculated indicator or asset health calculation that includes logical operators such as IF, AND, OR, and so on. For example, you could do this if you want a calculation that includes an IF THEN statement.
Note: To create a calculation using a function, you should be familiar with VB.NET or C# scripting.
For example:

VB.NET

If A > B Then
return A
Else
return B
End if

C#

if (A > B)
{
return A;
]
else
[
return B;
}
Where A and B are the argument names.
A function returns a value by assigning a value to the function’s name in one or more statements of the procedure. The return data type of a function is always a Variant.

Calculation Inputs and Argument Names

In order for a function to work, the calculation input names defined for the indicator must match the arguments named in the function. Therefore, in this example you must also define calculation inputs named “A” and “B”. This is similar to entering a regular calculation expression.
When you define a calculation for an indicator without functions, the system processes the calculation by wrapping your expression in a function statement. For example, if your calculation is A / B, the system processes it as:
A / B
When you create a calculation by defining your own function, the system behaves similarly: in the first line of the statement the system inserts your calculation input names as arguments for the function. This means that you can leave the arguments for the function blank. However, for your own record-keeping, you will probably want to enter the argument names anyway.
Note: Your calculation input names must match the names of the arguments used in the function.

Logical Operators and Statements

With functions, you can use the following logical operators or statements in your calculation. :
result = expression1 AND expression2
result = NOT expression
result = expression1 OR expression2
result = expression1 Xor expression2
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements]] . . .
[Else
[elsestatements]]
Select Case testexpression
[Case expressionlist-n
[statements-n]] . . .
[Case Else expressionlist-n
[elsestatements-n]]