AvgRunOverTime

This function returns the running average of the specified value over time.

Syntax

AvgRunOverTime ( number, valueTimestamp, interval)

Remarks

The number parameter specifies the data value for which the running average is to be calculated. The valueTimestamp is the timestamp for this data value. (The Timestamp function can be used to obtain this timestamp.) The interval parameter is the time interval, in nanoseconds, over which to calculate the running average. The predefined time constants can be used to easily input the number of nanoseconds in a microsecond (nsecPerUSec), millisecond (nsecPerMSec), second (nsecPerSec), minute (nsecPerMin), hour (nsecPerHour), day (nsecPerDay), or week (nsecPerWeek). The function will buffer any values whose time is within the specified interval. Any value that evaluates to –INF, INF, or NAN will be ignored. If there are no valid values stored, this function will return NAN.

Example

The following example will calculate the running average of the variable Temp_F over the past day. (The StartRelativeToNewest function backfills the data set initially to the full 24 hour interval, provided that the data is available in the data source.)

StartRelativeToNewest(nsecPerDay, OrderCollected); AvgRunOverTime("Server:CR1000.SECOND.Temp_F",Timestamp("Server:CR1000.SECOND.Temp_F"),nSecPerDay)