Historical Functions
Historical functions retrieve and analyze historical data for a specified variable and time range. Because these functions access historical storage, they can take longer to execute than non-historical functions.
Function Reference:
|
Function |
Name |
Description |
Format |
Returned Value |
|---|---|---|---|---|
|
tagfind |
Find Timestamp |
Returns the first timestamp matching the specified criteria. |
|
DateTime |
|
tagfindstate |
Find Timestamp for State |
Returns the first timestamp matching a specified Boolean state. |
|
DateTime |
|
Average |
Returns the average value. |
|
DataValue |
|
|
tagtavg |
Time Weighted Average |
Returns the time-weighted average value. |
|
DataValue |
|
tagtotalize |
Totalize |
Returns the time-weighted total. Learn more. |
|
DataValue |
|
tagtotal |
Total |
Returns the simple sum of the sample values. Learn more. |
|
DataValue |
|
tagmin |
Minimum |
Returns the minimum value. |
|
DataValue |
|
tagmax |
Maximum |
Returns the maximum value. |
|
DataValue |
|
tagdelta |
Delta |
Returns the difference between the first and last good values. |
|
DataValue |
|
tagrange |
Range |
Returns the difference between the maximum and minimum values. |
|
DataValue |
|
tagcount |
Samples Count |
Returns the number of samples. |
|
DataValue |
|
tagtimestate0 |
Time Duration in State 0 |
Returns the duration spent in state 0. |
|
DataValue |
|
tagtimestate1 |
Time Duration in State 1 |
Returns the duration spent in a nonzero state. |
|
DataValue |
|
tagntrans |
Number of Transitions |
Returns the number of state transitions. |
|
DataValue |
|
tagpctgood |
Percent Good |
Returns the percentage of time with good quality. |
|
DataValue |
|
tagpctbad |
Percent Bad |
Returns the percentage of time with bad quality. |
|
DataValue |
|
tagtimegood |
Good Quality Duration |
Returns the duration with good quality. |
|
DataValue |
|
tagtimebad |
Bad Quality Duration |
Returns the duration with bad quality. |
|
DataValue |
|
tagworstqual |
Worst Quality |
Returns the worst quality value. |
|
DataValue |
|
Value-Based Time Duration |
Returns the time values match specified criteria. |
|
DataValue |
|
|
tagstddev |
Standard Deviation (N−1) |
Returns standard deviation using Bessel's correction. |
|
DataValue |
|
tagstddev2 |
Standard Deviation (N) |
Returns standard deviation using N. |
|
DataValue |
|
tagvariance |
Variance (N−1) |
Returns variance using Bessel's correction. |
|
DataValue |
|
tagvariance2 |
Variance (N) |
Returns variance using N. |
|
DataValue |
Total and Totalized Values
The tagtotal and tagtotalize functions both return a total for the specified time range, but they calculate it differently.
-
tagtotal returns the simple sum of every sample in the time range. It does not account for the time between samples.
-
tagtotalize returns a time-weighted total. It accounts for the duration that each sample value is in effect within the time range.
For example, if three samples in the time range have the values a, b, and c and are in effect for the durations x, y, and z respectively, the two functions calculate the following:
|
Function |
Calculation |
|---|---|
|
tagtotal |
|
|
tagtotalize |
|