Range
- Last UpdatedJan 11, 2023
- 2 minute read
- PI System
- PI Server 2024 R2
- PI Server
Find the time-weighted or event-weighted difference between the maximum and minimum values for an attribute during a specified time range. Time-weighted values are interpolated at time boundaries when possible and extrapolated otherwise.
Syntax
Range(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 over 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 difference between the attribute's maximum and minimum values during the specified time. Time-weighted values are interpolated at time boundaries when possible and extrapolated otherwise
Exceptions
If the attribute has no good values or the pctgood minimum is not reached in the given time range, an error is returned
Notes
-
Bad values are excluded from Range 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
-
Range('att1', 't', '+1h')
[Return the time-weighted difference between the maximum and minimum values for 'att1' between 12:00 and 1:00am today]
-
Range('att1', 't', '+1h', 80)
[Return the time-weighted difference between the maximum and minimum values for 'att1' between 12:00 and 1:00am today when at least 80% of the values were good]
-
Range('att1', 't', '+1h', 80, "EventWeighted")
[Return the event-weighted difference between the maximum and minimum values for 'att1' between 12:00 and 1:00am today when at least 80% of the values were good]