Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Analytics and Notifications for PI System Explorer (PI Server 2024 R2)

TimeEq

  • Last UpdatedJan 11, 2023
  • 2 minute read

Find the total time, within a range, when an attribute value is equal to a specified value. Time returned is in seconds.

Syntax

TimeEq(attname, starttime, endtime, x)

Arguments

  • attname

    The name of an attribute with a PI point data reference, enclosed in single quotation marks

  • 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

  • x

    The reference value of the search; must be an enumeration set (string), integer or real number

Returns

The total time (in seconds), within a range, when an attribute value is equal to a given value

Notes

Bad values are excluded from TimeEq calculation

Example

  • TimeEq('att1', 't', '+1h', 80)

    [Find the total time between 12:00 and 1:00am today when 'att1' was equal to 80. Return the result in seconds]

  • TimeEq('att1', '-1h', '*', TagVal('att1', 't+8h'))

    [Find the total time in the past hour when the value of 'att1' was equal to the value at 8am today. Return the result in seconds]

  • TimeEq('Temperature Status', '-1h', '*', "Normal")

    Expression

    Output Attribute (attribute mapped to a PI point)

    If 'Temp' > 500 THEN "HiLimit" ELSE "Normal"

    Temperature Status

    TimeEq('Temperature Status', '-1h', '*', "Normal")

    [Find the total time in the past hour when the value of the attribute 'Temperature Status' was equal to "Normal". Return the result in seconds]

  • TimeEq('enum_att1', '*-1d', '*', DigState("Normal", 'enum_att1'))

    [Find the total time in the past 24 hours when the value of 'enum_att1' was equal to "Normal". Return the result in seconds]

In This Topic
TitleResults for “How to create a CRG?”Also Available in