Avg (Tag-based PE function)
- Last UpdatedOct 04, 2024
- 1 minute read
- PI System
- PI Server 2018
- PI Server
Return the average of all the arguments.
Syntax
Avg (x1,[...])
Arguments
x1, [...]
May be numbers, times, or periods but all must be the same data type.
Returns
The average of the arguments. The result is the same data type as the operands.
Exceptions
Arguments whose run-time values are character strings or digital states are not included in the average. If all values are character strings or digital states, Avg returns an error value.
Example
Avg(TagVal('tag1', '*'),TagVal('tag2', '*'),1,2)
-
The average of the value of tag1 at the current time ('*'), tag2 at the current time ('*'), and the values 1 and 2.
Avg('*', 't', '14-Dec-97', '14 8:00')
-
The average of four different time values.
Avg('tag1', 'tag2')
-
The average of the current values of tag1 and tag2.