TagAvg (Tag-based PE function)
- Last UpdatedOct 04, 2024
- 1 minute read
- PI System
- PI Server 2023
- PI Server
Find the time-weighted average value of a point over a given time, according to values stored in the PI Archive.
Syntax
TagAvg(tagname, starttime, endtime [, pctgood])
Arguments
tagname
A tagname. This point must represent a continuous variable.
starttime
Must be a time expression representing the beginning of the time range to search.
endtime
Must be a time expression, greater than starttime; representing the end of the time range to search.
pctgood
Optional. Minimum time percentage over the given time range, that the point's archived values must be good.
Returns
The point's time-weighted average value over the given time.
Exceptions
If the point has no good values or the pctgood minimum is not reached for the given time range, returns an error value.
Notes
Note: If the point has few good Archive values during the time period, this function's result may not be trustworthy. Use the PctGood function to find out what percentage of the values are good.
Example
TagAvg('tag1', 'y', '*')
TagAvg('tag1', '14-Dec-97', '+1d',70)
TagAvg('tag1', '14-Dec-97', '15-Dec-97')