Abs (Tag-based PE function)
- Last UpdatedNov 13, 2024
- 1 minute read
- PI System
- PI Server 2023
- PI Server
Abs function in PI Server's Performance Equations (PE) subsystem is used to return the absolute (non-negative) value of a number or the result of a numeric expression. This function is particularly helpful in scenarios where the direction of a value (positive or negative) is not relevant, such as when calculating differences or deviations between values.
Syntax
Abs(x)
Arguments
x
Must be an integer, real number, or tag that provides a numeric value.
Returns
The absolute (non-negative ) value of x.
Exceptions
If x is not an integer or real number, an error returns value is returned.
Example
Abs(1) // Returns: 1
Abs(-2.2) // Returns: 2.2
Abs('tag1') // Returns the absolute value of the current value of 'tag1'
Abs('tag1' - 'tag2
') // Returns the absolute value of the difference between 'tag1' and 'tag2'
Usage
The Abs function can be incorporated into PI Performance Equations to ensure values remain non-negative, a useful approach for monitoring metrics or conditions where only the magnitude of a change matters. For example, you could define a new Performance Equation tag in PI System Management Tools (SMT) to track the absolute difference between two tags, using an expression like:
Abs('tag1' - 'tag2')
This setup helps capture deviations or comparative metrics without considering positive or negative signs, making it ideal for applications that require non-directional data. For more information, see Performance equations (PE) syntax and functions reference.