StDev
- Last UpdatedJan 11, 2023
- 2 minute read
- PI System
- PI Server 2018
- PI Server
Find the time-weighted or event-weighted standard deviation of values for an attribute from a specified time range.
Syntax
StDev(attname, starttime, endtime [, pctgood, calculationBasis])
Arguments
-
attname
attribute with time series data (such as PI point data reference) enclosed in single quotes
-
starttime
time expression representing the beginning of a time range enclosed in single quotes; can be a relative time (such as'-3h') in reference to an absolute endtime
-
endtime
time expression representing the end of a time range enclosed in single quotes; can be a relative time (such as '+1h') in reference to an absolute starttime
-
pctgood
Optional. Time-weighted or event-weighted minimum time percentage during a specified time range for which the attribute had good values
-
calculationBasis
Optional. A string indicating the type of calculation to be performed enclosed in double quotes. Choose between "TimeWeighted" or "EventWeighted". If omitted, the default is time-weighted
Returns
The time-weighted or event-weighted standard deviation for attribute values from the specified time range
Exceptions
If the attribute has no good values or the pctgood minimum is not reached for the given time range, an error is returned
Notes
-
Bad values are excluded from StDev calculation
-
In order to configure an optional parameter, any previous optional parameter must be specified
Note: If the attribute has very few good values during the time range, this function's result may not be trustworthy. Use the PctGood function to find out what percentage of the values is good
Example
-
StDev('att1', 't', '+1h')
[Return the time-weighted standard deviation of values for 'att1' between 12:00 and 1:00am today]
-
StDev('att1', 't', '+1h', 80)
[Return the time-weighted standard deviation of values for 'att1' between 12:00 and 1:00am today when at least 80% of the values were good]
-
StDev('att1', 't', '+1h', 80, "EventWeighted")
[Return the event-weighted standard deviation of values for 'att1' between 12:00 and 1:00am today when at least 80% of the values were good]